Open Brain Documentation

Persistent, searchable memory for every AI tool you use.

What is Open Brain?

Open Brain is a personal, database-backed AI knowledge system that gives every AI tool persistent memory. Based on Nate B Jones' architecture, it turns your scattered conversations across Copilot, Claude, ChatGPT, Cursor, and other tools into a single, searchable knowledge base.

Credit: Open Brain was originally created by Nate B Jones. This version by Scott Nichols extends the original with self-hosted Kubernetes deployment, Ollama local embeddings, Tailscale Funnel networking, Docker Compose quickstart, and multi-replica SSE support. See Nate's setup guide, prompt kit, and Substack post for the original vision.

The Problem

Every AI conversation starts from zero. Decisions, preferences, and context are lost across sessions and tools.

The Solution

A unified memory backend β€” capture once, recall everywhere. Semantic search finds thoughts by meaning, not keywords.

Philosophy

  • β†’ One row = one retrievable idea β€” Zettelkasten-style atomic notes
  • β†’ Vector search = associative retrieval β€” search by meaning, not keywords
  • β†’ Metadata extraction is automatic β€” LLM classifies and tags on ingest
  • β†’ Backend, not frontend β€” use with any UI or AI tool you prefer
  • β†’ Your memory is portable β€” self-hosted, open protocol, compounding

Cost

DeploymentTimeMonthly Cost
πŸ–₯️ Docker Desktop dev box (Win/Mac)~10 min$0
🐳 Docker Compose (Linux server / NAS / Pi)~10 min$0–5
☁️ Cheap hosted (Supabase / Neon + Fly.io)~30 min$0–5
☸️ Kubernetes homelab~1 hour$0 (own hardware)
πŸš€ Azure managed (Bicep)~20 min~$15–20

Architecture

Open Brain has a simple, layered architecture β€” AI clients talk to the MCP server via SSE, which handles tool dispatch, embedding generation, metadata extraction, and database operations.

AI Client (Copilot, Claude, ChatGPT, Cursor, etc.)
    ↓ MCP Protocol (SSE transport)
    ↓ Auth: x-brain-key header or ?key= param
    ↓
MCP Server (Node.js + Hono / Deno Edge Function)
    β”œβ”€ Tool dispatch (7 MCP tools)
    β”œβ”€ Embedding generation (OpenRouter or Ollama)
    β”œβ”€ Metadata extraction (LLM)
    └─ Database client
    ↓
PostgreSQL + pgvector
    β”œβ”€ thoughts table (content + embedding + metadata)
    β”œβ”€ HNSW index (vector search)
    β”œβ”€ GIN index (metadata filtering)
    └─ match_thoughts() RPC function

Data Flows

Capture Flow

Client β†’ capture_thought β†’ Embed (parallel) + Extract metadata (parallel) β†’ Insert row β†’ Return confirmation with metadata

Search Flow

Client β†’ search_thoughts β†’ Embed query β†’ match_thoughts() RPC β†’ Return ranked results with similarity scores

Scaling

ScaleThoughtsNotes
Personal1 – 10KSingle instance, no tuning needed
Power User10K – 100KHNSW index handles smoothly
Team100K+Consider dedicated Postgres, read replicas

Database Schema

Single table design on PostgreSQL with pgvector extension. Rich JSONB metadata enables flexible filtering without schema migrations.

The thoughts Table

ColumnTypePurpose
idUUIDPrimary key (auto-generated)
contentTEXTThe thought itself
embeddingVECTOR(768/1536)Semantic embedding vector
metadataJSONBType, topics, people, action items, source
created_atTIMESTAMPTZWhen captured
updated_atTIMESTAMPTZLast modified (auto-trigger)
created_byTEXTUser provenance for multi-dev teams

Metadata Fields

Extracted automatically by the LLM on capture:

type topics[] people[] action_items[] dates[] source project created_by supersedes provenance (v0.7.0+)

Indexes

IndexTypePurpose
thoughts_embedding_idxHNSWFast vector similarity search
thoughts_metadata_idxGINJSONB metadata containment queries
thoughts_created_at_idxB-treeDate range filtering

match_thoughts() Function

The core search RPC β€” combines vector similarity with a configurable threshold:

SELECT * FROM match_thoughts(
    query_embedding := '[0.1, 0.2, ...]'::vector,
    match_count := 10,
    match_threshold := 0.5
);

Provenance Helpers v0.7.0+

Migration 003-add-provenance-helpers.sql adds two generated columns projected from metadata->'provenance' (the Hallmark v1 envelope written by Plan Forge), two partial indexes, and a sibling RPC for source-hash lookups. Existing rows are untouched β€” provenance stays optional.

Generated ColumnProjectionIndex
source_file_hashmetadata->'provenance'->>'contentHash'idx_thoughts_source_file_hash (partial, WHERE NOT NULL)
code_hashmetadata->'provenance'->>'codeHash'idx_thoughts_code_hash (partial, WHERE NOT NULL)

New sibling RPC β€” match_thoughts() is unchanged:

SELECT * FROM match_thoughts_by_source(
    source_hash      := 'sha256:abcd...',
    max_count        := 25,
    project_filter   := NULL,
    include_archived := false
);

MCP Server

Open Brain's MCP server exposes 7 tools via the Model Context Protocol, an open standard for AI-to-tool integration. Uses SSE transport over HTTP.

Tools

search_thoughts query, limit?, threshold?

Semantic vector search β€” finds thoughts by meaning, ranked by similarity score.

capture_thought content, metadata?

Store a thought. Auto-generates embedding and extracts metadata (type, topics, people, action items) in parallel. v0.7.0+: consumers may pass metadata.provenance (Hallmark envelope) for source-hash traceability.

capture_thoughts thoughts[]

Batch capture β€” store multiple thoughts in one call.

list_thoughts type?, topic?, person?, days?

Filtered listing β€” browse by type, topic, person mentioned, or date range.

update_thought id, content

Edit a thought's content and regenerate its embedding.

delete_thought id

Remove a thought by ID.

thought_stats

Aggregate stats β€” total count, type distribution, top topics, top people mentioned.

Authentication

API key sent via x-brain-key header (preferred) or ?key= URL parameter.

# Auth is enforced on /sse connection only.
# /messages endpoint uses sessionId for implicit auth.
GET /sse?key=YOUR_64_CHAR_HEX_KEY     β†’ SSE stream
POST /messages?sessionId=xxx           β†’ JSON-RPC calls (no key needed)

Capture Pipeline

Multiple ways to feed thoughts into Open Brain β€” from AI tool conversations to Slack messages to bulk imports.

Capture Methods

MethodHowBest For
MCP Toolcapture_thought from any AI clientDaily workflow captures
REST APIPOST /memoriesScripts, automations, webhooks
Slack WebhookDM the Slack botQuick captures, mobile
Bulk ImportMigration scriptsNotion, Obsidian, Apple Notes, ChatGPT exports

Quick Capture Templates

Decision: "Decision: Using PostgreSQL with pgvector instead of Pinecone. Reason: self-hosted, lower cost."
Person Note: "Mike prefers async communication, Slack over email. Timezone: PST."
Insight: "Vector search with 768-dim nomic-embed-text is nearly as good as 1536-dim for short content."

Prompt Kit

Five core prompts covering the full lifecycle β€” from migration to daily capture to weekly review.

Prompt 1: Memory Migration

Import memories from Copilot, Claude, ChatGPT, or other AI platforms into Open Brain.

Prompt 2: Second Brain Migration

Migrate from Notion, Obsidian, Apple Notes, Google Keep, or Evernote.

Prompt 3: Open Brain Spark

System prompt that teaches your AI to proactively capture and search thoughts.

Prompt 4: Quick Capture Templates

Structured templates for decisions, meetings, person notes, and insights.

Prompt 5: The Weekly Review

Review your week's captures β€” surface patterns, stale tasks, and connections.

Daily Rhythm

β˜€οΈ Morning β€” Quick review of recent captures

πŸ’» During work β€” Capture decisions and insights as they happen

🀝 After meetings β€” Debrief with capture templates

πŸŒ™ End of day β€” Save key takeaways

πŸ“Š Friday β€” Run the weekly review prompt

πŸ”¨ Plan Forge integration

v0.7.0+

Plan Forge is an agentic project execution system. In Plan Forge's unified memory architecture, Open Brain is the L3 layer — permanent, cross-project, semantic memory. Skills run search_thoughts before acting, and capture_thought after, so architecture decisions, patterns, and postmortems are preserved across runs and tools.

Memory layers (Plan Forge's view)

LayerBackingLifetimeWhat lives there
L1process stateper-calltool inputs / outputs in flight
L2.forge/*.jsonlper-projectqueues, dead-letter, run trajectories
L3Open Brain (Postgres + pgvector)permanent, cross-projectdecisions, patterns, conventions, postmortems

Hallmark provenance envelope

Plan Forge wraps every L3 write in a Hallmark v1 envelope under metadata.provenance. Open Brain projects two fields out as generated columns (source_file_hash, code_hash) with partial indexes, plus a sibling RPC (match_thoughts_by_source) and a REST endpoint (GET /memories/by-source) for exact-source deduplication.

{
  "content": "Decision: pgvector over pinecone for OSS-friendliness",
  "metadata": {
    "provenance": {
      "schemaVersion": "hallmark-provenance.v1",
      "contentHash":   "sha256:abcd...",
      "codeHash":      "sha256:ef01...",
      "phase":         "Phase-3-Slice-2",
      "tool":          "forge_step3_execute_slice"
    }
  }
}

Capability negotiation

Before stamping provenance, Plan Forge checks Open Brain's /health response. The presence of "by-source" in capabilities[] means the server understands the Hallmark envelope and the by-source lookup path. Older servers get bare thoughts (no Hallmark) — everything degrades transparently.

curl https://openbrain.example.com/health
# {
#   "status": "healthy",
#   "service": "open-brain-api",
#   "capabilities": ["capture","search","list","batch","update","delete","stats","by-source"]
# }

Resilience: the OpenBrain queue

When Open Brain is unreachable, Plan Forge does not drop the thought. It writes it to .forge/openbrain-queue.jsonl (L2) and drains the queue back to Open Brain later via forge_anvil_dlq_drain. Failed writes that Open Brain rejects (e.g. a malformed Hallmark envelope) land in the Slag-Heap DLQ for inspection. This means Plan Forge can keep working offline, on a flight, or during a brief outage — no thought is lost.

Recommended Plan Forge tools

ToolPurpose
captureMemory() SDKL3 write — auto-wraps in Hallmark envelope
forge_sync_memoriesMirror L3 hot thoughts into Copilot's .github/instructions/
forge_hallmark_show Β· forge_hallmark_verifyInspect / verify a thought's provenance envelope
forge_anvil_dlq_drainReplay queued / DLQ writes against a live Open Brain
You don't need Plan Forge. Open Brain works standalone with any MCP client. Provenance is purely opt-in — bare thoughts (no Hallmark envelope) are still accepted, indexed and searchable. Plan Forge just gets you exact-source deduplication and traceability for free if you're already using it.

Full integration spec in Plan Forge Β· MEMORY-ARCHITECTURE.md and UNIFIED-SYSTEM-ARCHITECTURE.md.

\n\n

Deployment β€” pick a path

Open Brain runs anywhere PostgreSQL + Node can run. There are five canonical paths, all using the same MCP tools and AI clients. Pick the one that matches how you want to use it.

PathBest forTimeCostSkill
πŸ–₯️ Docker Desktop dev boxSolo dev, Win/Mac laptop, fully local~10 min$0Beginner
🐳 Docker Compose (Linux)Headless server / NAS / Pi / VPS~10 min$0–5Beginner
☁️ Cheap hostedAlways-on, accessible anywhere~30 min$0–5Beginner
☸️ KubernetesHomelab / on-prem / privacy~1 hour$0 hwIntermediate
πŸš€ AzureTeams / production / managed~20 min~$15–20Intermediate
Using AWS or GCP? Open Brain is provider-agnostic β€” only Azure ships ready-made IaC. See the AWS & GCP equivalents table for service mapping (Container Apps β†’ ECS / Cloud Run, Azure PostgreSQL Flex β†’ RDS / Cloud SQL, Azure OpenAI β†’ Bedrock / Vertex AI).

πŸ–₯️ Docker Desktop dev box

The friendliest path for Windows / macOS laptops. ~10 minutes, $0, fully private. Recommended starting point for most people.

git clone https://github.com/srnichols/OpenBrain.git
cd OpenBrain

# Wizard (PowerShell on Windows, bash on Mac)
.\setup.ps1   # or:  ./setup.sh

# Verify
.\scripts\verify.ps1 http://localhost:8000

Ollama runs natively on your host; everything else lives in Docker. Full walkthrough in 11-DOCKER-DESKTOP-DEVBOX.md.

☁️ Cheap hosted (Supabase / Neon + Fly.io)

Always-on, accessible from any device, ~$0–5/month. The closest match to Nate B Jones' original Open Brain spirit β€” hosted Postgres + a tiny serverless MCP runtime.

Pick Postgres

ProviderFree tierBest for
Supabase500 MB, pauses when idleMost people β€” nice UI, closest to Nate's original
Neon0.5 GB, serverless, ~1 sec cold startDevs who want git-style DB branches
Railway$5 trial, then ~$5/moOne-stop deploy with the MCP server
Render1 GB free, expires after 90 daysShort-term testing

Pick MCP runtime

Recommended: Fly.io with the ready-made deploy/hosted/fly/fly.toml. Free tier covers a personal install with ~1 sec wake from suspend.

cd deploy/hosted/fly
fly launch --copy-config --no-deploy --name openbrain-<handle>
fly secrets set \
  DATABASE_URL='postgresql://...' \
  MCP_ACCESS_KEY="$(openssl rand -hex 32)" \
  EMBEDDER_PROVIDER=openrouter \
  OPENROUTER_API_KEY='sk-or-...' \
  EMBEDDING_DIMENSIONS=1536
fly deploy

Render and Railway templates are also included. Full walkthrough in 12-HOSTED-CHEAP.md.

🐳 Docker Compose (Linux servers)

For headless Linux hosts β€” a NAS, Raspberry Pi, VPS, or any always-on server. Same compose stack the dev box uses, just without Docker Desktop's host helpers.

# Clone the repo
git clone https://github.com/srnichols/OpenBrain.git
cd OpenBrain

# Configure
cp .env.example .env
# Edit .env with your settings (MCP_ACCESS_KEY, embedder, etc.)

# Start everything
docker compose up -d

# Verify (universal smoke test)
./scripts/verify.sh http://localhost:8000

The Docker Compose stack includes PostgreSQL with pgvector pre-configured, the Open Brain API + MCP server, and reaches Ollama either on the host or via OpenRouter / Azure OpenAI based on your .env.

☸️ Kubernetes Deployment

Full homelab deployment with Tailscale networking, MetalLB, Ollama GPU, and monitoring integration.

Stack

ComponentTechnology
Container RuntimeK8s + containerd
DatabasePostgreSQL + pgvector (StatefulSet)
EmbeddingsOllama (nomic-embed-text, local GPU)
NetworkingMetalLB (LAN) + Tailscale (VPN + Funnel)
MonitoringPrometheus + Grafana + Loki
Cost$0/month (uses existing cluster resources)

Networking Options

OptionAccessURL Pattern
Tailscale MagicDNSTailnet onlyhttp://openbrain.your-tailnet.ts.net:8080
MetalLBLAN onlyhttp://192.168.x.x:8080
Tailscale FunnelPublic internethttps://openbrain.your-tailnet.ts.net
Cloudflare TunnelPublic (custom domain)https://brain.yourdomain.com

Important Notes

  • β€’ Session Affinity β€” Required for multi-replica SSE. Set sessionAffinity: ClientIP on the ClusterIP service.
  • β€’ Tailscale Funnel β€” The K8s Operator (v1.92.4) doesn't auto-configure Funnel serve. Manual tailscale funnel command needed inside the proxy pod.
  • β€’ Auth β€” API key is checked on /sse only. /messages uses sessionId for implicit auth.

Full guide in docs/09-SELF-HOSTED-K8S.md.

πŸš€ Azure (managed)

One-command Bicep deploy: Azure Container Apps + Azure PostgreSQL Flexible Server + Azure OpenAI + Key Vault. Fully managed, scale-to-zero, ~$15–20/month for personal use.

git clone https://github.com/srnichols/OpenBrain.git
cd OpenBrain

.\deploy\azure\deploy.ps1 -ResourceGroup rg-openbrain -Location eastus2

The script generates secrets, deploys Bicep, seeds the database, and prints the MCP endpoint + key. Embeddings via Azure OpenAI text-embedding-3-small (1536 dim).

AWS & GCP equivalents

Open Brain itself is provider-agnostic; only the Bicep is Azure-specific. The same architecture maps to:

ConcernAzureAWSGCP
Container runtimeContainer AppsECS Fargate / App RunnerCloud Run
Managed PostgresPostgreSQL Flex (pgvector)RDS / Aurora PostgreSQLCloud SQL / AlloyDB
Embeddings + LLMAzure OpenAIAmazon BedrockVertex AI
SecretsKey VaultSecrets ManagerSecret Manager

Full mapping & cost-parity table in 10-AZURE-DEPLOYMENT.md β†’ Equivalents. PRs welcome for AWS / GCP IaC.

Full guide in docs/10-AZURE-DEPLOYMENT.md.

πŸ€– AI-prompted setup (EASY-SETUP.md)

Don't want to run the commands yourself? Paste a prompt into any AI agent (VS Code Copilot, Claude Code, Cursor, Claude Desktop with terminal) and it'll do the install for you.

EASY-SETUP.md has one prompt per deployment path, plus a "Help me decide" prompt that asks 3 questions and routes you to the right one:

  • β€’ πŸ–₯️ Docker Desktop dev box prompt
  • β€’ 🐳 Docker Compose (Linux) prompt
  • β€’ ☁️ Cheap hosted (Fly + Supabase) prompt
  • β€’ ☸️ Kubernetes prompt
  • β€’ πŸš€ Azure prompt
  • β€’ πŸ€” Help me decide prompt

Full prompts in EASY-SETUP.md. The repo also ships an AGENTS.md so any AI agent helping a user follows the canonical install procedure.

βœ… verify script β€” universal smoke test

A single script that confirms any Open Brain deployment is healthy. Captures a marker thought, semantically searches for it, then deletes it. Exit 0 = all good.

# Linux / macOS
./scripts/verify.sh http://localhost:8000

# Windows
.\scripts\verify.ps1 http://localhost:8000

# Hosted
./scripts/verify.sh https://openbrain-<handle>.fly.dev

If anything fails, see docs/TROUBLESHOOTING.md β€” a cross-cutting troubleshooting guide organized by symptom (API won't start, capture / embedder failures, search returns nothing, client config, Azure-specific, hosted-specific).

⏱️ Your first hour

Server's running. Now what? 13-FIRST-HOUR.md walks through the first 60 minutes of actually using Open Brain:

  • β€’ Minutes 0–5 β€” confirm it works with the verify script + a thought_stats probe
  • β€’ Minutes 5–20 β€” your first 5 captures (small, varied, real)
  • β€’ Minutes 20–40 β€” search the way you'd actually think; semantic recall in practice
  • β€’ Minutes 40–60 β€” bake it into your real workflow (after-bug captures, project-start captures, cross-tool handoffs)

The piece that turns "it's running" into "I'm using it."

Implementation Roadmap

Four phases, each independently functional. Total time: 2-4 hours.

Phase 1

Foundation (45 min)

Database β†’ Edge functions β†’ MCP server β†’ CLI test

Phase 2

Capture Pipeline (30 min)

Slack app β†’ Ingest webhook β†’ Confirmation replies

Phase 3

Knowledge Migration (30-60 min)

Memory migration from AI platforms + Second brain migration (Notion, Obsidian)

Phase 4

Optimization & Habits (30 min)

Multi-client setup + Daily habits + Weekly review

Success Criteria

πŸ“… Week 1 β€” Deployed, 20+ thoughts captured

πŸ“… Month 1 β€” 100+ thoughts, 2+ weekly reviews, established daily habit

πŸ“… Month 3 β€” Full compounding, knowledge graph effect, AI tools feel contextual

Client Configuration

Copy-paste configs for every supported AI client.

Claude Desktop

Requires mcp-remote bridge (Claude Desktop doesn't support SSE natively).

File: %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)

{
  "mcpServers": {
    "openbrain": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://YOUR_HOST/sse?key=YOUR_KEY"]
    }
  }
}

Claude Code / VS Code Copilot

File: ~/.claude/settings.json

{
  "mcpServers": {
    "openbrain": {
      "type": "sse",
      "url": "http://YOUR_HOST:8080/sse?key=YOUR_KEY"
    }
  }
}

Cursor

File: .cursor/mcp.json

{
  "mcpServers": {
    "openbrain": {
      "url": "http://YOUR_HOST:8080/sse?key=YOUR_KEY",
      "transport": "sse"
    }
  }
}

ChatGPT

Enable Developer Mode β†’ Add MCP connector with your Funnel/public URL. Set auth to "none" (key in URL).

REST API

Every MCP tool has a REST equivalent on port 8000. Useful for scripts, testing, and non-MCP integrations.

MethodEndpointPurpose
GET/healthHealth check — response includes capabilities[]. Presence of "by-source" signals provenance / Hallmark support (v0.7.0+)
POST/memoriesCapture a thought (validates metadata.provenance when present, v0.7.0+)
POST/memories/searchSemantic search
POST/memories/listFiltered listing
POST/memories/batchTransactional batch capture (rejects all-or-nothing on bad provenance)
GET/memories/by-source (v0.7.0+)Look up thoughts by source/content hash
GET/statsAggregate statistics

Example: Capture

curl -X POST http://localhost:8000/memories \
  -H "Content-Type: application/json" \
  -d '{"content": "Decision: Using pgvector for embeddings"}'

Example: Search

curl -X POST http://localhost:8000/memories/search \
  -H "Content-Type: application/json" \
  -d '{"query": "database decisions", "limit": 5}'

Example: Capability Probe v0.7.0+

Single round trip β€” clients learn which optional features the server speaks:

curl http://localhost:8000/health
# { "status": "healthy", "service": "open-brain-api",
#   "capabilities": ["provenance"] }

Example: Capture with Provenance v0.7.0+

curl -X POST http://localhost:8000/memories \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Phase-PROVENANCE Slice 3 shipped: by-source RPC live",
    "metadata": {
      "provenance": {
        "schemaVersion": "hallmark/v1",
        "toolName": "forge_memory_capture",
        "capturedAt": "2026-05-16T20:00:00Z",
        "contentHash": "sha256:abcd...",
        "codeHash":    "sha256:efgh..."
      }
    }
  }'

Example: Look up by Source Hash v0.7.0+

curl 'http://localhost:8000/memories/by-source?hash=sha256:abcd...&limit=10'
# Returns thoughts whose metadata.provenance.contentHash matches,
# ordered by created_at DESC. limit defaults to 25, max 100.

Troubleshooting

Start here: run ./scripts/verify.sh <your-api-url> first β€” it pinpoints which layer is broken. Then jump to docs/TROUBLESHOOTING.md for the full cross-cutting guide organized by symptom (API won't start, capture / embedder failures, search returns nothing, client config, Azure-specific, hosted-specific).

Common gotchas

"No active session. Connect to /sse first."

Cause: SSE connection and /messages POST hitting different pods (multi-replica without session affinity).

Fix: kubectl patch svc openbrain-api -n openbrain -p '{"spec":{"sessionAffinity":"ClientIP"}}'

mcp-remote ServerError / OAuth errors

Cause: /messages endpoint returning 401, triggering mcp-remote's OAuth flow.

Fix: Auth must only be enforced on /sse, not on /messages. The sessionId proves authentication.

Claude Desktop doesn't show OpenBrain tools

Check: Verify %APPDATA%\Claude\claude_desktop_config.json has the mcpServers entry. Claude Desktop may overwrite on launch.

Fix: Fully quit (system tray β†’ Quit) and relaunch. Check logs at %APPDATA%\Claude\logs\mcp-server-openbrain.log.

Search returns no results

Check: Run thought_stats. Under 20-30 entries = sparse data, not broken.

Fix: Lower similarity threshold (try 0.3 instead of 0.5). Test with exact captured terminology.

Tailscale Funnel not serving

Cause: K8s Operator v1.92.4 doesn't auto-configure Funnel serve from the annotation.

Fix: Run tailscale funnel --bg --https=443 http://openbrain-api.openbrain.svc.cluster.local:8080 inside the proxy pod. Re-run after pod restarts.