A voice-first AI assistant that turns your Telegram messages into an organized knowledge base. Send voice notes, text, photos, or forwarded messages β the agent classifies everything, creates tasks in Todoist, saves thoughts to an Obsidian vault, tracks your goals, and sends you a daily report. Your personal second brain that runs 24/7 on a $5 VPS.
π·πΊ Π§ΠΈΡΠ°ΡΡ Π½Π° ΡΡΡΡΠΊΠΎΠΌ
- Conversational Agent β Talk to the bot like a real assistant. No need to press buttons β just send a voice note or text message and have a natural dialogue. Ask follow-up questions, clarify, change your mind. The agent remembers context within the session and has full access to your vault, goals, and Todoist.
- Agent Memory β Ebbinghaus forgetting curve with tiered decay. Memory cards move through tiers (core / active / warm / cold / archive) based on access patterns and time.
- Vault Health β Automated health scoring, Map of Content (MOC) generation, broken link repair, and orphan detection across your entire vault.
- 3-Phase Pipeline β Processing is now split into CAPTURE, EXECUTE, and REFLECT phases with structured JSON handoff between each stage.
- Processing Rules β Configurable formatting rules for Obsidian markdown and weekly reflections.
- Memory Config β
.memory-config.jsonfile for fine-tuning decay rates, tier thresholds, and type inference rules.
Telegram (voice / text / photo / forwarded messages)
|
v
Telegram Bot (Node.js) --> Deepgram (voice-to-text)
|
v
Gemini CLI (--approval-mode yolo --sandbox false)
|
v
+-- CAPTURE: classify entries --> JSON
+-- EXECUTE: Todoist tasks + vault writes --> JSON
+-- REFLECT: HTML report + MEMORY update
|
v
+-- Todoist (tasks)
+-- Obsidian vault (thoughts, CRM, goals)
+-- Telegram (HTML report)
+-- GitHub (git push)
The bot runs as a systemd service on a VPS. A daily timer (21:00 UTC) triggers the 3-phase processing pipeline via scripts/process.sh. Each phase receives the previous phase's output as structured JSON, ensuring reliable handoff and auditability.
| Skill | Purpose |
|---|---|
| dbrain-processor | Core pipeline: classify voice/text entries, create tasks, save thoughts |
| agent-memory | Ebbinghaus decay engine: tiered search, creative recall, memory stats |
| vault-health | Health scoring, MOC generation, link repair, orphan detection |
| graph-builder | Knowledge graph analysis, entity relationships, domain mapping |
| todoist-ai | Task management via mcp-cli (Todoist MCP integration) |
Skills live in vault/.gemini/skills/ and are invoked automatically by Gemini CLI during processing.
Want just the memory engine? See agent-memory-skill β standalone, zero dependencies.
Go to github.com/imitry/second-brain-gemini and click Fork. Make the fork private β it will contain your personal data.
git clone https://github.com/YOUR_USERNAME/second-brain-gemini.git
cd second-brain-geminiOpen the following files and replace the placeholders with your information:
vault/goals/0-vision-3y.mdβ 3-year visionvault/goals/1-yearly.mdβ yearly goalsvault/goals/2-monthly.mdβ monthly prioritiesvault/goals/3-weekly.mdβ weekly focus (ONE Big Thing)vault/.gemini/skills/dbrain-processor/references/about.mdβ your profilevault/.gemini/skills/dbrain-processor/references/classification.mdβ entry categories
| Token | Where to get it |
|---|---|
| Telegram Bot Token | @BotFather in Telegram |
| Your Telegram ID | @userinfobot in Telegram |
| Deepgram API Key | console.deepgram.com |
| Todoist API Token | todoist.com β Settings β Integrations β Developer |
We recommend deploying using Docker or Coolify for a fast and reproducible setup.
All detailed options, including manual VPS setup and Coolify deployment, can be found in the docs:
- docs/vps-setup.md for manual VPS
- docs/coolify-deployment.ru.md for Coolify (RU)
Short version (Docker):
- Create a
docker-compose.ymlbased on the repository structure. - Provide your
.envfile credentials. - Run
docker-compose up -d.
| File | Purpose |
|---|---|
.env |
API tokens for Telegram, Deepgram, Todoist (copy from .env.example) |
.memory-config.json |
Decay rates, tier thresholds, type inference rules for agent memory |
mcp-config.json |
MCP server configuration (Todoist and other integrations) |
vault/.gemini/GEMINI.md |
Agent instructions, session bootstrap sequence, navigation rules |
vault/.gemini/skills/dbrain-processor/references/about.md |
Your personal profile β helps the agent understand context |
All secrets go into .env which is gitignored. Never commit API tokens to the repository.
vault/
βββ daily/ # Daily entries (voice transcripts, notes)
βββ goals/ # Vision, yearly, monthly, weekly goals
βββ business/
β βββ crm/ # Client cards
β βββ network/ # Professional contacts
βββ projects/
β βββ clients/ # Client project notes
β βββ leads/ # Sales pipeline
βββ thoughts/
β βββ ideas/ # Ideas and brainstorms
β βββ learnings/ # Lessons learned
β βββ reflections/ # Personal reflections
βββ templates/ # Card templates (CRM, daily)
βββ MOC/ # Maps of Content (auto-generated)
βββ MEMORY.md # Long-term memory (hot context)
βββ .gemini/ # Agent configuration
βββ skills/ # 5 skills (processor, memory, health, graph, todoist)
βββ rules/ # Formatting rules (obsidian-markdown, weekly-reflection)
βββ docs/ # Reference documentation
The vault follows a Zettelkasten-inspired structure. Each domain has an _index.md hub file. Navigation starts from hubs and follows wiki-links.
The daily processing pipeline runs in three isolated phases:
- CAPTURE β Reads
daily/YYYY-MM-DD.md, classifies each entry (task, thought, idea, CRM update, goal progress), and outputs structured JSON. - EXECUTE β Takes the classification JSON, creates Todoist tasks, writes vault files, updates CRM cards, and outputs an execution report as JSON.
- REFLECT β Generates an HTML summary report, updates
MEMORY.mdwith key decisions, and sends the report to Telegram.
Each phase runs as a separate Gemini CLI invocation. JSON is passed between phases via files, ensuring clean boundaries and debuggability.
Agent memory follows the Ebbinghaus forgetting curve with linear decay:
- Decay rate: 0.015 per day
- Floor: 0.1 (memories never fully disappear)
- Formula:
strength = max(floor, initial - rate * days_since_access)
Memory cards move through five tiers based on their current strength:
| Tier | Strength Range | Behavior |
|---|---|---|
| core | 0.9 - 1.0 | Always loaded into context |
| active | 0.7 - 0.9 | Included in heartbeat searches |
| warm | 0.4 - 0.7 | Included in normal searches |
| cold | 0.1 - 0.4 | Only in deep searches |
| archive | 0.0 - 0.1 | Candidates for creative recall |
Different search depths retrieve different tiers:
- heartbeat β core + active (fast, low-cost)
- normal β core + active + warm (default)
- deep β all tiers (thorough)
- creative β random sampling from cold/archive (serendipity)
Vault health is scored on a 100-point scale:
health = 100 - orphan_penalty - broken_penalty - density_penalty - desc_penalty
- orphan_penalty β files with no incoming or outgoing links
- broken_penalty β wiki-links pointing to non-existent files
- density_penalty β low average link count per file
- desc_penalty β files missing retrieval filter descriptions in frontmatter
The vault-health skill auto-generates MOCs, repairs broken links, and suggests connections for orphans.
| Service | Cost | Purpose |
|---|---|---|
| Gemini API | ~$1-5/mo | AI processing (Gemini 2.5 Pro/Flash) |
| VPS | ~$5/mo | 24/7 bot hosting |
| Deepgram | Free ($200 credit) | Voice transcription |
| Todoist | Free / $4/mo Pro | Task management |
| Total | ~$25/mo |
The Telegram bot presents an inline keyboard with the following buttons:
| Button | Action |
|---|---|
| π Status | Show today's entry count and processing status |
| βοΈ Process | Run the 3-phase processing pipeline on demand |
| π Week | Generate and send a weekly digest |
| β¨ Query | Ask the agent anything β it reads your vault and Todoist |
| β Help | Show available commands and usage tips |
Buttons are just shortcuts. You can message the bot directly β voice or text β and have a full conversation. Ask follow-up questions, clarify, argue, brainstorm. It remembers context within the session and has access to your entire vault, goals, and Todoist.
What you can send:
- Voice notes β transcribed via Deepgram, saved to daily file
- Text β links, quotes, quick thoughts
- Photos β saved with AI-generated descriptions
- Forwarded messages β saved with source attribution
Example conversation:
You: "What did I write about the marketing project last week?" Bot: finds and shows relevant entries You: "Turn the second idea into a Todoist task for Monday" Bot: creates the task You: "Actually make it high priority and add a subtask for the presentation" Bot: updates the task
