Open Brain: Your AI-Readable Memory Infrastructure
One database. One protocol. Every AI you use shares the same persistent memory of you. No middleware, no SaaS chains, no lock-in.
Every AI platform has built a walled garden of memory. Claude doesn't know what you told ChatGPT. ChatGPT doesn't follow you into Cursor. Your knowledge is a hostage to whichever platform you've spent the most time with. Open Brain breaks that: a Postgres database with vector embeddings, exposed via MCP, that any tool can read from and write to. Type a thought into Slack, Telegram, or WhatsApp - or tell Claude "save this thought" mid-conversation - it's embedded and classified in seconds. Then search it by meaning from any AI client or chat app. Total cost: about $0.10-0.30/month.
How Open Brain Works
One database at the center. Everything that can write to it can also read from it. Slack, Telegram, WhatsApp, Claude, ChatGPT, Cursor - they all go both ways. Everything connects through Supabase Edge Functions and MCP. Nothing running on your machine.
🗃 Open Brain DB
Postgres + pgvector on Supabase
Thoughts + Embeddings + Metadata
Capture Flow
Same pipeline whether you type in a chat app or say "save this" in an AI conversation
Retrieval Flow
Any AI or chat app can search your brain by meaning, not keywords
| Without Open Brain | With Open Brain |
|---|---|
| Re-explain context in every new chat | AI loads your context via MCP automatically |
| Locked into one platform's memory | Any AI tool reads the same brain |
| Insights lost in old conversations | Every thought searchable by meaning, forever |
| You own nothing, platform owns everything | Your database, your protocol, your data |
The Build Guide
45 minutes. Zero coding experience needed. Capture and query from Slack, Telegram, WhatsApp, or any AI client.
What You Need
| Service | Role | Cost |
|---|---|---|
| Supabase | Your database - stores everything (Postgres + pgvector + Edge Functions) | Free tier |
| OpenRouter | Your AI gateway - embeddings ($0.13/M tokens) + metadata extraction via gpt-4o-mini | ~$0.10-0.30/mo |
| Slack / Telegram / WhatsApp | Your capture and query interface - type thoughts in, search them out (pick one or more) | Free |
--- OPEN BRAIN CREDENTIALS (fill as you go) --- Supabase Project ref: [Step 1 - from dashboard URL] Supabase Database password: [Step 1 - generated during setup] Supabase Project URL: [Step 3 - Settings > API] Supabase Service role key: [Step 3 - Settings > API] OpenRouter API key: [Step 4 - openrouter.ai/keys] Capture Channel/Group ID: [Step 5 - platform-specific [if using Slack/Telegram/WhatsApp]] Bot Token / Bot API Key: [Step 6 - platform-specific [if using Slack/Telegram/WhatsApp]] Edge Function URL: [Step 7 - after deploy] MCP Access Key: [Step 10 - generated random hex] MCP Server URL: [Step 11 - after deploy]
Part 1: Capture
Steps 1-9: Your message goes to an Edge Function, which embeds, classifies, and stores it. Works with Slack, Telegram, or WhatsApp.
Supabase is your database. It stores raw text, vector embeddings, and structured metadata. It also gives you a REST API and Edge Functions runtime automatically.
- Go to supabase.com and sign up (GitHub login is fastest)
- Click New Project in the dashboard
- Pick your organization (default is fine)
- Project name:
open-brain - Generate a strong database password - paste into credential tracker NOW
- Pick the Region closest to you
- Click Create new project and wait 1-2 minutes
supabase.com/dashboard/project/THIS_PART. Paste it into the tracker.
Three SQL commands, pasted one at a time. Creates your storage table, search function, and security policy.
A. Enable the Vector Extension
In the left sidebar: Database → Extensions → search for "vector" → flip pgvector ON.
B. Create the Thoughts Table
Left sidebar: SQL Editor → New query → paste and Run:
create table thoughts ( id bigint generated always as identity primary key, content text not null, embedding vector(1536), metadata jsonb default '{}'::jsonb, created_at timestamptz default now(), updated_at timestamptz default now() );
C. Create the Search Function
New query → paste and Run:
create or replace function match_thoughts ( query_embedding vector(1536), match_threshold float default 0.5, match_count int default 10 ) returns table ( id bigint, content text, metadata jsonb, similarity float, created_at timestamptz ) language sql stable as $$ select thoughts.id, thoughts.content, thoughts.metadata, 1 - (thoughts.embedding <=> query_embedding) as similarity, thoughts.created_at from thoughts where 1 - (thoughts.embedding <=> query_embedding) > match_threshold order by thoughts.embedding <=> query_embedding limit match_count; $$;
D. Lock Down Security
One more new query:
-- Enable Row Level Security alter table thoughts enable row level security; -- Service role full access only create policy "Service role full access" on thoughts for all using (auth.role() = 'service_role');
thoughts table with columns: id, content, embedding, metadata, created_at, updated_at. Database → Functions should show match_thoughts.
In the left sidebar: Settings (gear icon) → API. Copy into your credential tracker:
- Project URL - listed at the top as "URL"
- Service role key - under "Project API keys" → click reveal
OpenRouter is a universal AI gateway. One key gives you access to every major model. We use it for embeddings (text-embedding-3-small at $0.13/M tokens) and metadata extraction (gpt-4o-mini).
- Go to openrouter.ai and sign up
- Go to openrouter.ai/keys
- Click Create Key, name it
open-brain - Copy the key into your credential tracker immediately
- Add $5 in credits under Credits (lasts months at this usage)
- If you don't have a Slack workspace, create one at slack.com (free tier works)
- Click + next to Channels → Create new channel
- Name it
capture(or brain, inbox, whatever feels natural) - Make it Private (recommended - this is personal)
- Get the Channel ID: right-click channel → View channel details → scroll to bottom (starts with
C) - Paste the Channel ID into your credential tracker
- Open Telegram and create a private group (not a channel)
- Name it
Brain Capture - To get the Chat ID, add @userinfobot or @RawDataBot to the group
- The bot will show you the Chat ID (starts with
-). Copy it to your credential tracker - Remove the bot from the group (the bot was only needed to get the ID)
- Go to developers.facebook.com and create a Meta Business account if you don't have one
- Create an App and choose Business type
- Add the WhatsApp product to your app
- In the WhatsApp section, click Get Started
- You'll need a phone number. Use your personal number or create a test number through Meta
- Note your Phone Number ID (displayed in the dashboard) - paste into credential tracker
This is the bridge between your platform and your database.
A. Create the App
- Go to api.slack.com/apps → Create New App → From scratch
- App Name:
Open Brain, select your workspace - Click Create App
B. Set Permissions
- Left sidebar → OAuth & Permissions
- Scroll to Scopes → Bot Token Scopes
- Add:
channels:history,groups:history,chat:write - Scroll up → Install to Workspace → Allow
- Copy the Bot User OAuth Token (starts with
xoxb-) into credential tracker
C. Add App to Channel
In Slack, open your capture channel and type: /invite @Open Brain
A. Create the Bot
- Open Telegram and search for @BotFather
- Send the command
/newbot - Choose a name (e.g., "Open Brain Bot") and username (must be unique, ends with "bot")
- BotFather will give you a bot token (starts with numbers). Copy it to your credential tracker
B. Add Bot to Your Group
- In your private group, add the bot: search for it by username and invite
- Send
/startto activate the bot (it will listen for messages)
A. Get Your Access Token
- In the Meta Developer Console, go to your app's WhatsApp settings
- Under API Access, create a System User or use your app token
- Generate a permanent access token with
whatsapp_business_messagingpermissions - Copy the access token to your credential tracker
B. Verify Your Phone Number
- In WhatsApp settings, add your phone number and verify via SMS or call
- The verified number becomes your capture point
This is the brains of the operation. One function receives messages from your platform, generates an embedding, extracts metadata, stores everything, and replies with a confirmation.
A. Install the Supabase CLI
brew install supabase/tap/supabase
npm install -g supabase
If you don't have npm, install Node.js from nodejs.org first - npm comes with it.
B. Log In and Link
supabase login
supabase link --project-ref YOUR_PROJECT_REF
C. Create the Function
supabase functions new ingest-thought
Open supabase/functions/ingest-thought/index.ts in any text editor and replace its entire contents with the Edge Function code from the companion Substack guide.
D. Set Your Secrets
supabase secrets set OPENROUTER_API_KEY=your-openrouter-key supabase secrets set SLACK_BOT_TOKEN=xoxb-your-slack-bot-token supabase secrets set SLACK_CAPTURE_CHANNEL=C0your-channel-id
supabase secrets set OPENROUTER_API_KEY=your-openrouter-key supabase secrets set TELEGRAM_BOT_TOKEN=your-bot-token-from-botfather supabase secrets set TELEGRAM_CHAT_ID=-your-chat-id
supabase secrets set OPENROUTER_API_KEY=your-openrouter-key supabase secrets set WHATSAPP_ACCESS_TOKEN=your-access-token supabase secrets set WHATSAPP_PHONE_ID=your-phone-id supabase secrets set WHATSAPP_VERIFY_TOKEN=random-verify-token
SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY are automatically available inside Edge Functions - you don't set them.
E. Deploy
supabase functions deploy ingest-thought --no-verify-jwt
https://YOUR_PROJECT_REF.supabase.co/functions/v1/ingest-thoughtPaste it into your credential tracker. You need it for Step 8.
- Go to api.slack.com/apps → select your Open Brain app
- Left sidebar → Event Subscriptions → toggle Enable Events ON
- Paste your Edge Function URL in the Request URL field
- Wait for the green checkmark: Verified
- Under Subscribe to bot events, add:
message.channelsandmessage.groups - Click Save Changes (reinstall if prompted)
- Set the webhook via Telegram Bot API. In your terminal, run:
curl -X POST https://api.telegram.org/botYOUR_BOT_TOKEN/setWebhook \
-H "Content-Type: application/json" \
-d '{"url": "https://YOUR_PROJECT_REF.supabase.co/functions/v1/ingest-thought"}'
- You should get a response:
{"ok":true,"result":true}
- Go to Meta Developer Console → your app's WhatsApp settings
- Under Webhooks, click Configure
- Paste your Edge Function URL as the Callback URL
- Enter your Verify Token (the random token you set in Step 7)
- Under Subscribe to webhook events, select:
messages - Click Verify and Save
Go to your capture channel / group and type:
Sarah mentioned she's thinking about leaving her job to start a consulting business
Wait 5-10 seconds. You should see a confirmation:
Captured as person_note -- career, consulting People: Sarah Action items: Check in with Sarah about consulting plans
Then open Supabase dashboard → Table Editor → thoughts. You should see one row with your message, an embedding, and metadata.
Part 2: Retrieval
Steps 10-13: A hosted MCP server that lets any AI or chat app search your brain and save thoughts by meaning.
Your MCP server will be a public URL. Generate a simple access key for authentication.
openssl rand -hex 32
-join ((1..32) | ForEach-Object { '{0:x2}' -f (Get-Random -Maximum 256) })
Copy the 64-character output into your credential tracker. Then set it as a Supabase secret:
supabase secrets set MCP_ACCESS_KEY=your-generated-key-here
One Edge Function. Four tools: semantic search, browse recent, remember frameworks, and stats.
A. Create the Function
supabase functions new open-brain-mcp
B. Add Dependencies
Create supabase/functions/open-brain-mcp/deno.json:
{
"imports": {
"@hono/mcp": "npm:@hono/mcp@0.1.1",
"@modelcontextprotocol/sdk": "npm:@modelcontextprotocol/sdk@1.24.3",
"hono": "npm:hono@4.9.2",
"zod": "npm:zod@4.1.13",
"@supabase/supabase-js": "npm:@supabase/supabase-js@2.47.10"
}
}
C. Write the Server
Open supabase/functions/open-brain-mcp/index.ts and replace with the MCP server code from the companion guide.
D. Deploy
supabase functions deploy open-brain-mcp --no-verify-jwt
Your MCP server is live at:
https://YOUR_PROJECT_REF.supabase.co/functions/v1/open-brain-mcp
Paste the full URL into your credential tracker as the MCP Server URL.
You need two things from your credential tracker: the MCP Server URL (Step 11) and the access key (Step 10).
Claude Desktop
Settings → Developer → Edit Config:
{
"mcpServers": {
"open-brain": {
"type": "http",
"url": "https://YOUR_PROJECT_REF.supabase.co/functions/v1/open-brain-mcp",
"headers": {
"x-brain-key": "your-access-key-from-step-10"
}
}
}
}
Restart Claude Desktop. "open-brain" should appear in the MCP tools indicator.
Claude Code
claude mcp add open-brain \ --transport http \ --url https://YOUR_PROJECT_REF.supabase.co/functions/v1/open-brain-mcp \ --header "x-brain-key: your-access-key-from-step-10"
Other Clients
Cursor, VS Code Copilot, ChatGPT Desktop, Windsurf - every MCP-compatible client follows the same pattern: point it at the URL with the x-brain-key header. Check their MCP docs for where to add remote HTTP servers with custom headers.
Use any connected platform naturally. Chat apps use slash commands, AI clients pick the right MCP tool automatically.
| Where | What You Say | What Happens |
|---|---|---|
| Slack / Telegram / WhatsApp | "Decision: moving launch to March 15..." | Captured, embedded, classified |
| Claude / ChatGPT / Cursor | "Save this thought: our onboarding assumes users understand permissions" | save_thought |
| Slack / Telegram / WhatsApp | "search: career changes" | Semantic search |
| Claude / ChatGPT / Cursor | "What did I capture about career changes?" | search_thoughts |
| Any AI client | "What did I capture this week?" | list_thoughts (recent) |
| Any AI client | "How many thoughts do I have?" | brain_stats |
| Slack / Telegram / WhatsApp | "list" | Browse recent thoughts |
Companion Prompts
Four prompts that cover the full lifecycle: migrate, discover, build the habit, review.
Making It Compound
The system is infrastructure. These prompts are the habits that make it compound. Use them in order the first week, then keep the weekly review as your Friday ritual.
1. Memory Migration
2. Open Brain Spark
3. Quick Capture Templates
4. The Weekly Review
Five Capture Templates
Type these into your chat apps or say them naturally in AI conversations. Each is structured to trigger the right classification in your processing pipeline.
Decision Capture
Decision: [what]. Context: [why]. Owner: [who].
Example: Decision: Moving the launch to March 15. Context: QA found three blockers in the payment flow. Owner: Rachel.
Person Note
[Name] - [what you learned]
Example: Marcus - mentioned he's overwhelmed since the reorg. Wants to move to the platform team.
Insight Capture
Insight: [realization]. Triggered by: [what].
Example: Insight: Our onboarding assumes users understand permissions. Triggered by: watching a new hire struggle for 20 minutes.
Meeting Debrief
Meeting with [who] about [topic]. Key points: [...]. Action items: [...].
Example: Meeting with design team about dashboard redesign. Key points: cutting three panels, keeping revenue chart. Action items: I send API spec by Thursday.
The AI Save
In chat apps: Saving from [AI tool]: [key takeaway].
In AI conversations: "Save this thought: [key takeaway]"
Example (Slack/Telegram/WhatsApp): Saving from Claude: Framework for evaluating vendor proposals - score on integration effort (40%), maintenance burden (30%), switching cost (30%).
Example (Claude/ChatGPT): "Remember this: the vendor evaluation framework we just built - integration effort 40%, maintenance burden 30%, switching cost 30%."
If Something Goes Wrong
The Supabase dashboard has a built-in AI assistant (chat icon, bottom-right). It has access to all Supabase docs and can help with every Supabase-specific step.
| Problem | Fix |
|---|---|
| Slack says "Request URL not verified" | Redeploy: supabase functions deploy ingest-thought --no-verify-jwt |
| Slack messages aren't triggering the function | Check Event Subscriptions for message.channels / message.groups. Verify app is invited to channel. |
| No confirmation reply in Slack | Bot token wrong or chat:write scope missing. Reinstall app if you added scope after install. |
| Telegram webhook not receiving messages | Verify webhook URL with getWebhookInfo. Make sure the bot was started with /start and you're messaging the bot directly (or added it to a group with privacy mode off). |
| WhatsApp messages not arriving | Check Meta webhook verification token matches your Edge Function. Confirm the phone number is registered and the webhook subscription includes messages. |
| Function runs but nothing in database | Check Edge Function logs (dashboard → Edge Functions → Logs). Likely wrong OpenRouter key or no credits. |
| AI client says "server disconnected" | Check URL is exact (including https://, no trailing slash). Open URL in browser - you should get an error response, not 404. |
| Getting 401 errors | Access key mismatch. Header must be x-brain-key (lowercase, with dash). |
| Search returns no results | Make sure you sent test messages first. Try threshold 0.3 for a wider net. |
| First query is slow | Cold start - Edge Function is waking up. Subsequent calls are faster. |