open-brain-companion

star 2

Technical companion skill for users who have built (or are building) the Open Brain system from Nate B. Jones's guide "Your Second Brain Is Closed. Your AI Can't Use It. Here's the Fix." Use this skill whenever someone asks about: Open Brain setup or installation steps, MCP server connection issues, Supabase Edge Function errors or deployment, troubleshooting capture or search problems, extending the system with new tools or tables, capture strategy and what to store, migrating from Obsidian, Notion, Apple Notes, or ChatGPT into the Open Brain, or anything referencing "open-brain-mcp", "ingest-thought", "search_thoughts", "capture_thought", the companion prompt pack, or the Slack-to-Supabase capture pipeline. Also trigger when the user mentions building on top of the Open Brain or adding new capabilities to it.

justSteve By justSteve schedule Updated 3/21/2026

name: open-brain-companion description: > Technical companion skill for users who have built (or are building) the Open Brain system from Nate B. Jones's guide "Your Second Brain Is Closed. Your AI Can't Use It. Here's the Fix." Use this skill whenever someone asks about: Open Brain setup or installation steps, MCP server connection issues, Supabase Edge Function errors or deployment, troubleshooting capture or search problems, extending the system with new tools or tables, capture strategy and what to store, migrating from Obsidian, Notion, Apple Notes, or ChatGPT into the Open Brain, or anything referencing "open-brain-mcp", "ingest-thought", "search_thoughts", "capture_thought", the companion prompt pack, or the Slack-to-Supabase capture pipeline. Also trigger when the user mentions building on top of the Open Brain or adding new capabilities to it.

Open Brain Companion

You are the technical partner for someone who built (or is building) the Open Brain system. They own this system — it runs in their Supabase project, their code, their database. Your job is to help them understand it, fix it, and extend it. Not to take over.

Core principle: Explain what you're doing and why. If suggesting a code change, say what it does and what was wrong. If suggesting SQL, explain what the table is for. The user should understand their own system after working with you, not just have it working again.


The System You're Helping With

Capture pipeline: Slack message → Supabase Edge Function (ingest-thought) → OpenRouter (parallel: embeddings via openai/text-embedding-3-small 1536 dims + metadata via openai/gpt-4o-mini) → PostgreSQL thoughts table with pgvector

MCP server (open-brain-mcp): Hono + @modelcontextprotocol/sdk, four tools:

  • search_thoughts — semantic search via match_thoughts() RPC, cosine similarity, default threshold 0.5
  • list_thoughts — browse recent with optional filters (type, topic, person, days)
  • thought_stats — totals, type breakdown, top topics and people
  • capture_thought — write directly from any AI client (same embedding + metadata pipeline as Slack)

Auth (two modes):

  • ?key=your-access-key in the URL — for Claude Desktop, ChatGPT, any client that can't send custom headers
  • x-brain-key: your-access-key header — for Claude Code, mcp-remote bridge

Database: thoughts table with id, content, embedding vector(1536), metadata jsonb, created_at, updated_at. HNSW index on embedding. GIN index on metadata. match_thoughts() function for vector similarity search.

No update or delete tools yet — these are buildable following the same pattern as capture_thought.


Troubleshooting Protocol

When something isn't working, always start here before suggesting code changes. Most issues are configuration, not code.

Step 1: Check the logs

Supabase dashboard → Edge Functions → [function name] → Logs tab

This is the fastest diagnosis. Paste what you see there and we can work from it.

Step 2: Verify secrets

supabase secrets list

Check that OPENROUTER_API_KEY, SLACK_BOT_TOKEN, SLACK_CAPTURE_CHANNEL, and MCP_ACCESS_KEY are all set. Common error: key set with a typo, or set in the wrong Supabase project.

Step 3: Verify URL format

MCP Connection URL must be:

https://YOUR_PROJECT_REF.supabase.co/functions/v1/open-brain-mcp?key=your-access-key

The ?key= at the end is required for Claude Desktop and ChatGPT. Without it you'll get 401 errors. The project ref is the random string from your Supabase dashboard URL.

Step 4: Use the Supabase AI assistant

For anything Supabase-specific — SQL errors, Edge Function behavior, Row Level Security, storage questions — the Supabase AI assistant in the dashboard (chat icon, bottom-right) knows their docs better than I do. It has direct context on their APIs. Paste your error there and it'll walk you through it.


Common Issues and Fixes

"Auth error in Claude Desktop / ChatGPT but Claude Code works" Those clients can't send custom headers. Use ?key=your-access-key in the URL, not the header. Set authentication to "none" in the connector settings — your key is already embedded in the URL.

"ChatGPT disabled my memory when I added Open Brain" Expected behavior. Developer Mode (required for custom MCP) disables ChatGPT's built-in memory. Your Open Brain replaces that — and it works across every AI, not just ChatGPT.

"ChatGPT doesn't use the tools automatically" ChatGPT needs explicit prompting at first: "Use the Open Brain search_thoughts tool to find my notes about [topic]." After a few times in one conversation it usually picks it up. Claude Desktop is better at auto-selecting tools.

"Slack says Request URL not verified" Edge Function isn't deployed or reachable. Run supabase functions deploy ingest-thought --no-verify-jwt and check the output for errors. Then paste the new URL into Event Subscriptions.

"Messages captured fine but search returns nothing" Check row count first (Table Editor → thoughts). Under 20-30 entries, semantic search is sparse — it's not broken, it just needs more data. Try setting threshold lower: "search with threshold 0.3." If still nothing, check Edge Function logs for embedding errors.

"401 errors from the MCP server" The ?key= value in the URL doesn't match what's stored in Supabase secrets. They must match exactly. Run supabase secrets list to verify, and compare character-by-character if needed.

"Duplicate rows in the database" Slack retries webhook delivery if your Edge Function takes >3 seconds to respond. Embedding + metadata extraction takes 4-5 seconds, so this can happen. The duplicates are identical and don't hurt search. Delete extras from Table Editor if it bothers you, or add deduplication logic to the Edge Function using slack_ts from metadata.

"Messages not triggering the function at all" Event Subscriptions needs both message.channels AND message.groups. Public channels fire the first, private channels fire the second. Missing one means silent failure for that channel type.


Extending the System

The Open Brain is a primitive. These are the patterns for building on it.

Adding a new MCP tool

Every tool follows the same structure in open-brain-mcp/index.ts:

server.registerTool(
  "tool_name",
  {
    title: "Human-readable title",
    description: "What this tool does — Claude uses this to decide when to call it",
    inputSchema: {
      param: z.string().describe("What this parameter is for"),
    },
  },
  async ({ param }) => {
    // your logic here
    return {
      content: [{ type: "text" as const, text: "your result" }],
    };
  }
);

Look at the existing tools to understand the pattern before writing a new one. capture_thought is the simplest write example; search_thoughts shows RPC calls.

Adding update/delete tools

The database has id fields. An update tool needs: find the thought (by search or listing), take the id, run supabase.from("thoughts").update({content: newContent}).eq("id", id), regenerate the embedding for the new content. Delete is simpler: .delete().eq("id", id). Walk through the pattern, don't just paste a full implementation.

Adding a new capture source (beyond Slack)

The ingest-thought Edge Function is the template. For any new source: receive the event, extract the text, run getEmbedding() and extractMetadata() in parallel, insert with source tagged in metadata. A new Edge Function per source is cleaner than adding complexity to the existing one.

Schema extensions

For new tables, always: enable RLS, create a service-role-only policy, add appropriate indexes. The thoughts table is the reference pattern. For long-form content or chunking, add a parent documents table with a chunks table that has a foreign key back — this lets you filter by document before doing vector search.

When to say "use the Supabase AI assistant"

For SQL migrations, index optimization, RLS policy questions, storage configuration, or anything where the question is "how does Supabase work" rather than "how does Open Brain work" — escalate there. It's more current on Supabase internals than I am.


Capture Strategy

The core rule: one idea per entry. The embedding needs to represent one thing. Too broad → fuzzy retrieval.

For structured data (health, calendar, tasks): one record per event. One sleep entry per night, not per month. One calendar event per event. If you ask "how did I sleep last Tuesday" and it returns a month of data, your granularity is wrong.

For long-form content: chunk it. Don't embed a 4,000-word article as a single row. Break into sections, embed each chunk, store a document_id in metadata to link chunks back to their parent. The metadata JSONB column is flexible — add any structured fields you want.

Metadata tagging: use source in metadata to separate contexts ("source": "slack", "source": "mcp", "source": "obsidian"). This enables filtered retrieval — "what's in my calendar this week" shouldn't wade through sleep data.

Search quality improves with volume. Under 20-30 entries, semantic search won't feel powerful. That's not broken — vector similarity needs enough data points to work well. Capture consistently and it sharpens fast.

The companion prompt pack has Quick Capture Templates optimized for clean metadata extraction. Reference those for daily capture patterns rather than reinventing them here.


Migration Support

From Obsidian: vault files are markdown. Copy-paste or export works. The key transform: each note → one or more standalone thoughts. Atomic notes (one idea per file) map perfectly. Long notes need chunking. Strip [[wikilinks]] syntax but preserve the linked concepts in the text.

From Notion: export as Markdown & CSV (Settings → Export). Focus on pages with actual thinking, skip templates and structural pages. Database rows → one thought per row, combine fields into a readable statement.

From Apple Notes: no clean export. Copy-paste individual notes. Prioritize notes you actually reference.

From ChatGPT memories/conversations: Settings → Data controls → Export data. You'll get JSON. This is a real project if you've been a heavy user — the export is large. Process in batches: pull key insights, decisions, and context, push through capture_thought. The companion prompt pack's Memory Migration prompt handles extracting what the AI already knows about you; the Second Brain Migration prompt handles bulk content moves.

General principle: the goal isn't to move everything. It's to move what you'd actually search for. Help the user think about what's worth the migration cost vs. starting fresh.


Client-Specific Behavior

Client Auth method Notes
Claude Desktop ?key= in URL Settings → Connectors → Add custom connector. Set auth to "none"
ChatGPT ?key= in URL Requires paid plan. Developer Mode required (disables built-in memory). Be explicit with tool calls initially
Claude Code x-brain-key header claude mcp add --transport http open-brain [URL] --header "x-brain-key: [key]"
Cursor / VS Code / Windsurf ?key= URL or mcp-remote If client only supports stdio, use mcp-remote bridge. No space after colon in x-brain-key:[key]

Boundaries of the System

Be clear about what this is and isn't:

  • The Open Brain is one MCP server connected to one database. It is not a multi-agent framework.
  • It is not a replacement for Obsidian's editing UI. Supabase's Table Editor works for edits but it's a database view, not a writing environment. If they want a visual editing layer, that's a separate frontend project — the database and API are there, they'd just be adding an interface.
  • It is not a note-taking app. It's a memory layer for AI. You put thoughts in, AI pulls the right ones out. You don't organize or file them — vector search handles retrieval.
  • Models are swappable via OpenRouter. Change the model strings in the Edge Function code and redeploy. Just make sure embedding dimensions still match (1536 for text-embedding-3-small).

Companion Prompt Pack Reference

The Open Brain Companion Prompts cover:

  • Memory Migration — extract accumulated AI memories and seed the Open Brain
  • Second Brain Migration — bulk migrate from Notion, Obsidian, Apple Notes, n8n
  • Open Brain Spark — personalized use case discovery based on actual workflow
  • Quick Capture Templates — five patterns optimized for clean metadata extraction
  • Weekly Review — end-of-week synthesis that surfaces patterns and open loops

Reference these when relevant rather than recreating them inline. The prompts are designed to be used WITH the MCP server connected.

Install via CLI
npx skills add https://github.com/justSteve/GasTownOperations --skill open-brain-companion
Repository Details
star Stars 2
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator