Second Brain Agent

Your Second Brain,
Running Locally

Capture thoughts anywhere → find them by meaning → AI agent delivers daily briefings, surfaces stale tasks, and recognizes patterns. 100% private, runs on your Mac.

🔒 Privacy-first 🧠 Local Ollama embeddings ⚡ 7 automated jobs 🤖 Claude CLI synthesis
1024
vector dims
7
scheduled jobs
8
MCP tools
100%
local
#second-brainYour personal knowledge base
R
ram
/capture DECISION: use asyncpg over SQLAlchemy for raw SQL control #database #architecture
2B
2BAgent BOT
✅ Captured to your second brain
decision #database #architecture
ID: a3f2c1d0 · just now · discord
Feature 1

Capture & Auto-Classify

One slash command captures any thought. The system automatically extracts type, topics, people, and generates a 1024-dim embedding — all in under 200ms.

Try:
#second-brain
R
ram
/recent
2B
2BAgent BOT
📋 Last 3 thoughts
insight Users who capture daily retain 3x more…
decision Keep Ollama on host, not in Docker…
task Review asyncpg migration PR…
Capture Pipeline
📥
Text received
Discord → FastAPI :8900
🏷️
Metadata extracted
type · topics · people · followup
🧮
Embedding generated
Ollama mxbai-embed-large · 1024-dim
🗃️
Stored in PostgreSQL
pgvector + metadata jsonb
📄
Daily backup written
~/2bagent/backups/YYYY-MM-DD.md
Feature 3

Think-Act-Observe Cycle

The agent runs on a schedule or on demand. It fetches recent thoughts plus prior run history, synthesizes via Claude CLI, and writes insights back to working memory.

🔍
THINK
Fetch last 48h thoughts + prior 5 run summaries
🤖
ACT
Synthesize via Claude CLI → Gemini → raw fallback
📝
OBSERVE
Write to memory.md + Discord + agent_runs DB

7 Default Scheduled Jobs

2:00 ammemory_consolidationnightly
7:00 ammorning_briefingdaily
8:00 amtask_stalenessdaily
9:00 amrelationship_decayMonday
10:00 amidea_rouletteMonday
9:00 pmevening_reviewdaily
6:00 ampattern_recognitionSunday

Agent Output

Waiting for agent run… Click "Run Agent Now" to simulate the Think-Act-Observe cycle.
Thoughts: Model: Duration: Status:
Feature 4

Scheduled Jobs

APScheduler runs 7 default jobs. Add custom jobs via natural language from Discord or Claude Desktop — the agent interprets phrases like "every Friday 5pm" into cron expressions.

➕ Schedule a new job
Cron: 0 17 * * 5 Every Friday at 5pm
Select a job to see details
Feature 5

MCP / Claude Desktop

8 MCP tools connect Claude Desktop to your knowledge base via stdio transport. Search by meaning, create tasks, read/write working memory — all from a Claude conversation.

Claude Desktop 2bagent connected claude-sonnet-4-6
Try a prompt below or type your own ↓
semantic_search
create_task
get_stats
read_memory
System Design

Architecture

Fully local stack. Click any component to learn more.

Docker Compose Mac Host PostgreSQL pgvector · 1024-dim 127.0.0.1:5432 FastAPI (api) /capture /search /stats 127.0.0.1:8900 Discord Bot /capture /search /agent discord profile Agent Runner APScheduler · TAO cycle 127.0.0.1:8766 Ollama mxbai-embed-large localhost:11434 MCP Server stdio transport spawned by Claude Desktop Claude Desktop MCP client spawns MCP via stdio
Click a component
to see details
Setup

Get Started

Self-hosted on any machine with Docker and local Ollama. No cloud accounts required to run.

1
Prerequisites
Install Docker (OrbStack recommended on Mac)

Install Ollama and pull:
ollama pull mxbai-embed-large

Create a Discord bot at discord.com/developers
2
Configure & Launch
cp .env.example .env
Fill in POSTGRES_PASSWORD, TWOBAGENT_API_KEY, TWOBAGENT_DISCORD_TOKEN

docker compose --profile discord up -d

API runs at localhost:8900
3
Claude Desktop MCP
Add to claude_desktop_config.json:

{
  "mcpServers": {
    "2bagent": {
      "command": "/bin/bash",
      "args": [
        "~/2bagent/scripts/start-mcp.sh"
      ]
    }
  }
}
4
Agent Runner
Start the proactive agent:

docker compose --profile agent up -d

Runs on localhost:8766
Requires ~/.claude bind-mount for Claude CLI auth
5
Verify
Open localhost:8900/health — all cards green

Discord: /health in your server

Claude Desktop: ask "What did I capture this week?"

Agent: /agent run for first synthesis
6
Web Dashboards
:8900/ui — Capture & browse
:8900/data — Filter, sort, paginate
:8900/health — Service status
:8900/agent — Agent runs & jobs
:8900/help — Full documentation
🔒
100% Private by Design
All data stays on your machine. PostgreSQL, Ollama, and the agent runner are local. The only optional cloud component is the Gemini API fallback — leave it unset to run entirely offline.