Skip to content

ozoneRatchapon/rust_second_brain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Second Brain

A simple, fast, and efficient CLI application for managing your personal notes and thoughts, built with Rust. Create your own "Second Brain" system right from your terminal!

🧠 What is a Second Brain?

A Second Brain is a personal knowledge management system that helps you capture, organize, and retrieve your thoughts, ideas, and information. This CLI tool provides a lightweight way to:

  • Quickly jot down thoughts and ideas
  • Organize notes with timestamps
  • Search through your knowledge base
  • View and manage your collected wisdom

✨ Features

  • Quick Note Creation: Add notes with titles and multi-line content
  • Automatic Organization: Notes are timestamped and stored as Markdown files
  • Smart Search: Find notes by title or search within content
  • List Management: View all your notes with creation timestamps
  • Markdown Support: All notes are stored as .md files for portability
  • Sanitized Filenames: Automatic filename sanitization for cross-platform compatibility

🚀 Installation

Prerequisites

  • Rust (edition 2024 or later)
  • Git (to clone the repository)

Build from Source

  1. Clone the repository:
git clone <repository-url>
cd rust_second_brain
  1. Build the project:
cargo build --release
  1. The executable will be available at target/release/rust_second_brain

Optional: Add to PATH

To use the tool from anywhere, you can add it to your PATH or create an alias:

# Option 1: Copy to a directory in your PATH
cp target/release/rust_second_brain ~/.local/bin/second-brain

# Option 2: Create an alias in your shell profile (.bashrc, .zshrc, etc.)
alias second-brain="/path/to/rust_second_brain/target/release/rust_second_brain"

📖 Usage

The application provides four main commands:

Add a New Note

./rust_second_brain add "Your Note Title"

After running this command, you'll be prompted to enter the content of your note. Type your content and press Ctrl+D (on Unix) or Ctrl+Z (on Windows) on a new line to finish.

Example:

./rust_second_brain add "Meeting Notes"
Enter the content for your note (press Ctrl+D on a new line to finish):
Discussed project timeline
- Phase 1: Complete by end of month
- Phase 2: Research new technologies
- Follow up with team next week
^D
Note 'Meeting Notes' saved to second_brain_notes/20241229143022-meeting_notes.md

List All Notes

./rust_second_brain list

This displays all your notes with their original titles and creation timestamps.

Example output:

--- Your Second Brain Notes ---
- Meeting Notes (Created: 2024-12-29 14:30:22)
- Project Ideas (Created: 2024-12-28 09:15:45)
- Book Recommendations (Created: 2024-12-27 20:45:10)
-----------------------------

View a Specific Note

./rust_second_brain view "partial title"

You can use the full title or just part of it. The search is case-insensitive.

Example:

./rust_second_brain view "meeting"
--- Content of 'meeting_notes' ---
Discussed project timeline
- Phase 1: Complete by end of month
- Phase 2: Research new technologies
- Follow up with team next week
-----------------------------

Search Notes by Content

./rust_second_brain search "keyword"

Search for notes containing specific keywords in their content.

Example:

./rust_second_brain search "project"
--- Search results for 'project' ---
- Found in: Meeting Notes
- Found in: Project Ideas
-----------------------------

📁 File Organization

  • Notes are stored in the second_brain_notes/ directory
  • Each note is saved as a Markdown file with the format: YYYYMMDDHHMMSS-sanitized_title.md
  • The directory is automatically created when you first run the application

🛠️ Development

Dependencies

  • clap - Command-line argument parsing
  • chrono - Date and time handling for timestamps

Project Structure

rust_second_brain/
├── src/
│   └── main.rs          # Main application logic
├── second_brain_notes/  # Your notes directory (created automatically)
├── Cargo.toml          # Project configuration
├── Cargo.lock          # Dependency lock file
└── README.md           # This file

Running in Development

# Run directly with cargo
cargo run -- add "Test Note"
cargo run -- list
cargo run -- view "test"
cargo run -- search "keyword"

Building

# Debug build
cargo build

# Release build (optimized)
cargo build --release

🤝 Contributing

Contributions are welcome! Here are some ways you can help:

  • Report bugs or suggest features
  • Improve documentation
  • Add new functionality
  • Optimize performance

📝 License

This project is open source. Please check the license file for details.

🎯 Roadmap

Potential future enhancements:

  • Tag system for better organization
  • Export to different formats
  • Sync with cloud storage
  • Rich text formatting
  • Note templates
  • Interactive mode
  • Configuration file support

🔧 Troubleshooting

Common Issues

"No notes found" when you know you have notes:

  • Ensure you're running the command from the same directory where you created the notes
  • Check that the second_brain_notes/ directory exists and contains .md files

Can't find a note when using view command:

  • Note titles are sanitized (spaces become underscores, converted to lowercase)
  • Try using just part of the title
  • Use the list command to see all available notes

Build errors:

  • Ensure you have Rust 2024 edition or later
  • Run cargo clean and then cargo build again

Happy note-taking! 🧠✨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages