@saiprasadrao/2nd-brain
v0.1.0
Published
π§ Your personal AI second brain β self-hosted, end-to-end encrypted, zero data sharing
Maintainers
Readme
π§ Second Brain
Your personal AI second brain that captures ideas, tasks, and memories. Self-hosted, end-to-end encrypted, zero data sharing.
β¨ Features
- πΈ Capture Everything: Ideas, links, notes, tasks in natural language
- π Smart Recall: "What did I save about React?" β instantly find related captures
- π Intent Routing: Automatically categorizes captures, creates tasks, sets reminders
- π¬ Conversational: Chat naturally, it understands context
- π± Telegram/WhatsApp: Use your preferred messaging app
- π Self-Hosted: Run on your own machine, nothing leaves your device
- π Private: No cloud, no tracking, no data sharing
- π Dashboard: Beautiful TUI to manage everything
π Quick Start (5 minutes)
Prerequisites
- Node.js 20+ (download)
- Telegram Bot (get from @BotFather) or use WhatsApp
- Groq API Key (free tier)
- Google Account (for saving docs/tasks/calendar)
Installation
Option 1: One-liner (Recommended)
curl -fsSL https://raw.githubusercontent.com/thesaiprasadrao/second-brain/main/install.sh | bashOption 2: Global npm
npm install -g @saiprasadrao/2nd-brainOption 3: Manual
git clone https://github.com/thesaiprasadrao/second-brain.git
cd second-brain && npm installSetup & Run
# 1. Configure (interactive wizard)
2nd-brain setup
# 2. Start the daemon (runs in background)
2nd-brain start
# 3. Check status anytime
2nd-brain statusNow use Telegram to send messages to your brain!
π― Commands
2nd-brain setup # Interactive configuration
2nd-brain start # Start server (daemon mode)
2nd-brain stop # Stop the daemon
2nd-brain restart # Restart server
2nd-brain status # Show server status
2nd-brain logs [N] # View logs (last N lines)
2nd-brain send <message> # Send quick message
2nd-brain help # Show helpOr use npm:
npm start npm stop npm restart
npm run setup npm run status npm run logs
npm run send "msg"π Usage Examples
π‘ CAPTURE:
"check this: https://nextjs.org"
"cool idea for building state machines"
β
TASKS:
"todo: finish report by friday"
"remind me to code at 5pm"
π LISTS:
"add coffee to shopping list"
π RECALL:
"what did I save about react?"
"show my web development notes"
π¬ CHAT:
"tell me a joke"
"how is the weather?"π§ Configuration
After running 2nd-brain setup, edit .env to customize:
GROQ_API_KEY=gsk_... # Groq LLM API
TELEGRAM_BOT_TOKEN=... # Telegram bot token
TELEGRAM_CHAT_ID=... # Your Telegram chat ID
STORAGE_BACKEND=docs # docs or keep (Google storage)
BRIEFING_TIME=08:00 # Daily briefing timeGet API Keys:
- Groq: https://console.groq.com
- Telegram: Message @BotFather, create bot
- Google: Auto-configured during setup
π Dashboard Features
- Stats: Total captures, today's count, message history
- Recent Captures: Last 5 notes at a glance
- System Status: Configuration and database health
- Export Data: Download as JSON, CSV, or Markdown
- Settings: Reconfigure or reset database
π Deployment Options
Local Machine
2nd-brain start # Runs in background
# Server stays running until you stop itDocker
docker-compose up --buildCloud VPS ($5/month)
- DigitalOcean, Linode, AWS, Hetzner, Vultr
- SSH in, install Node.js, run
2nd-brain setup && 2nd-brain start - Server keeps running with PM2
Raspberry Pi
# SSH into Pi, then
2nd-brain setup && 2nd-brain startπ Privacy & Security
β
Zero Cloud β Everything runs on your machine
β
Encrypted β Telegram/WhatsApp are end-to-end encrypted by default
β
No Tracking β No analytics, telemetry, or ads
β
You Own Your Data β Export anytime as JSON, CSV, or Markdown
π§ How It Works
- Message arrives via Telegram/WhatsApp or CLI
- LLM analyzes intent (capture, task, conversation, etc.)
- Smart routing handles each type differently
- Semantic search finds related past captures
- Actions execute (save doc, create task, set reminder)
- History saved for future recall
π Storage Options
| | Google Docs | Google Keep | |--|---|---| | Recommended | β Yes | Optional | | Organization | One doc per category | Quick notes | | Format | Rich text, URLs | Simple notes |
π§ Storage Backends
Google Docs (Recommended)
- One document per category
- Entries appended chronologically
- Easy to share/export later
Google Keep
- Quick notes in Keep app
- Better for personal use
- Simpler setup
π Troubleshooting
| Problem | Solution |
|---------|----------|
| Setup crashes | 2nd-brain stop && rm .env && 2nd-brain setup |
| No Telegram messages | Verify TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID in .env |
| Groq API errors | Check rate limits (free tier: 30 req/min) or verify API key |
| Google Docs not created | Re-run 2nd-brain setup to refresh permissions |
| Database corrupted | 2nd-brain stop && rm memory.db* && 2nd-brain start |
β FAQ
Q: Is my data really private?
A: Yes! Everything stays on your machine. Open source β check the code yourself.
Q: Can I run this on my phone?
A: Not directly, but run on Raspberry Pi or cloud server and access via Telegram.
Q: What if I lose my laptop?
A: Captures are in Google Docs/Keep. Export regularly as backup.
Q: Can I share captures with others?
A: Yes! Export to Google Docs and share the link.
Q: Does it work offline?
A: LLM processing needs internet. Messages queue when offline.
π¦ Requirements
- Node.js 20+
- Internet connection (for LLM and APIs)
- Optional: Docker, Telegram account, Google account
π API References
- Groq LLM: https://console.groq.com (free API)
- Telegram Bot: https://t.me/botfather
- Google APIs: Drive, Docs, Tasks, Calendar (auto-setup)
π€ Contributing
Found a bug? Have an idea?
- Issues: https://github.com/thesaiprasadrao/second-brain/issues
- PRs: https://github.com/thesaiprasadrao/second-brain/pulls
π License
MIT β Use however you want!
π Support
Love Second Brain? Consider:
- β Star on GitHub
- π’ Share with friends
- π Report bugs
- π‘ Suggest features
Made with β€οΈ for people who think a lot
