robertsfeir/mybrain/mybrain-setup
Claude Code and agent skill by robertsfeir/mybrain
- community
Checking that the SKILL.md file is still in the repository.
Use when users want to install or set up MyBrain -- a personal knowledge base with semantic search. Install is always per-project (local MCP scope); the only user-facing choice is which database backend to connect to (Bundled, Docker, Native, or RDS). Detects and offers to remove deprecated user/project/plugin-scoped registrations before installing.
Install
npx vskill@latest install robertsfeir/mybrain/mybrain-setupSKILL.md
The same SKILL.md was published earlier as robertsfeir/mybrain/mybrain-setup.
MyBrain -- Setup
This skill installs MyBrain.
Install scope is always per-project (local). The MCP server is registered with claude mcp add using the default local scope — it lives in this user's Claude config for this project only. It is never registered with --scope user (that registration leaks to every project on the machine and causes port races and mis-attributed thoughts), never with --scope project (that ships the registration to teammates via .mcp.json), and never auto-registered by the plugin loader (v2.2.0 and earlier shipped a .mcp.json at the plugin root that Claude Code's plugin system would auto-register as plugin:mybrain:mybrain with a hard-coded BRAIN_SCOPE: "personal" — that file was removed in v2.2.1, but stale plugin caches may still carry it). Step 0 below detects any pre-existing non-local registration and offers to remove it.
The only user-facing choice during setup is where the brain's database lives. Four backends are supported:
- Bundled -- PostgreSQL, Ollama, and the MCP server all run inside a single container. No API key needed. One port. One volume. Recommended for personal use.
- Docker -- Multi-container: PostgreSQL + optional Ollama (compose profile) + MCP server. Uses OpenRouter or Ollama for embeddings.
- Native -- No Docker. Ollama runs directly on the host, Postgres is whatever the user already has installed (or any reachable PG), and the MCP server runs as a local process registered via
claude mcp add. - RDS -- Connect to a shared PostgreSQL database on AWS RDS or any reachable remote Postgres. Multiple repos can share one database — ltree scoping (
BRAIN_SCOPE) isolates each repo's thoughts.
Embedding dim and the schema
The schema ships with a {{EMBED_DIM}} placeholder that is substituted at scaffold time (default: 1536). The default Ollama model (gte-qwen2-1.5b-instruct) and the default OpenRouter model (openai/text-embedding-3-small) both produce 1536-dim vectors, so the default schema works against every default backend out of the box. Users who want a 1024-dim local model (e.g. mxbai-embed-large) substitute {{EMBED_DIM}}=1024 at scaffold time and override OLLAMA_MODEL=mxbai-embed-large in their .env.
Existing installs are never auto-migrated. On startup the MCP server reads the actual embedding column dimension from information_schema and logs it (e.g. embedding dim: 1536 (detected)). The log line is informational — pgvector itself raises a clear error on dimension mismatch at insert time.
Step 0: Pre-flight — Remove Deprecated Registrations
Run this before every install, even on a fresh machine. MyBrain previously had three non-local registration paths, all of which are now deprecated:
--scope usermakes onemybrainentry visible in every project on this machine. When two repos try to use it, one wins and the other silently mis-attributes thoughts (or fails to start, when their containers race for the same port).--scope projectwrites the registration to.mcp.jsonand ships it to teammates / other clones via git, leaking machine-local URLs and ports.- Plugin auto-registration (v2.2.0 and earlier) — the plugin shipped a
.mcp.jsonat its root, which Claude Code's plugin system auto-registered as `plugin:mybrain:mybrain` with a hard-codedBRAIN_SCOPE: "personal". This was the primary cause of "thoughts attributed to the wrong project," because every project on the machine that had the plugin enabled inherited the same registration with the same scope. v2.2.1 removed the file from the plugin source. Existing v2.2.0 installs may still have a cached copy until the plugin is re-installed or upgraded.
The new flow registers mybrain with local scope only — visible to this user, in this project, nowhere else. No plugin auto-registration.
0.1 — Detect
Run:
Inspect the output for any of the following:
- An entry whose name is
mybrain(or starts withmybrain-) and whose scope is shown asuserorproject. - An entry named
plugin:mybrain:mybrain(or anyplugin:mybrain:*variant). Theplugin:prefix is the scope indicator — this entry was auto-registered by Claude Code's plugin loader from the.mcp.jsonshipped in v2.2.0 or earlier.
If none of those are present, skip to Step 1.
0.2 — Explain and Ask
If a non-local registration exists, tell the user verbatim what you found and why it matters. Use whichever block matches:
For `--scope user` or `--scope project`:
"I found amybrainserver registered with {user|project} scope. That scope is deprecated — it caused brains to fail to start when multiple repos shared the same registration, and thoughts to be attributed to the wrong project. The new install is always per-project (local scope), so this old registration needs to come out before we continue."
Ask: "Remove the {user|project}-scoped `mybrain` registration now? (yes / no)"
For `plugin:mybrain:mybrain`:
"I found aplugin:mybrain:mybrainentry. This was auto-registered by Claude Code's plugin loader from a.mcp.jsonshipped in mybrain v2.2.0 or earlier — it carries a hard-codedBRAIN_SCOPE: \"personal\"and applies to every project on the machine. v2.2.1 removed that file, but your plugin cache still has it. Until it's cleared, every project sees the same brain with the same scope, which is the bug we're fixing. The cleanest fix is to upgrade or re-install the plugin so the cache picks up the v2.2.1 source (no.mcp.json). Then we can register a clean per-project install."
Ask: "Upgrade the mybrain plugin to v2.2.1+ and clear the auto-registration now? (yes / no)"
0.3 — Remove
For `--scope user` or `--scope project`:
If a mybrain-<name> variant is registered, repeat with that exact name.
For `plugin:mybrain:mybrain`:
The plugin: registrations cannot be removed with claude mcp remove — they are managed by the plugin loader. Two ways to clear it:
- Upgrade or re-install the plugin (recommended). When the plugin cache picks up v2.2.1+, there is no
.mcp.jsonto register, and theplugin:mybrain:mybrainentry disappears on the next Claude Code restart.
``bash claude plugin update mybrain@mybrain # or, if update isn't available: claude plugin uninstall mybrain claude plugin install mybrain@mybrain ``
- Manual fallback (not recommended unless 1 fails). Locate the cached plugin directory (typically
~/.claude/plugins/cache/mybrain.<hash>/or similar — checkclaude plugin path mybrainif available) and delete the.mcp.jsonat its root. Restart Claude Code. This is fragile because the next plugin update can re-create it (it won't, on v2.2.1+, but other tooling might).
After removal, warn the user:
"Any other project on this machine that was relying on the{user|project|plugin:mybrain:mybrain}registration will no longer see a brain when you open it. Each of those projects will need to re-run/mybrain-setuponce to register its own per-project install. Existing brain data (databases, containers, volumes) is untouched — only the Claude Code registration was removed."
If no: stop the install. Tell the user:
"I can't safely register a per-projectmybrainwhile a {user|project|plugin:mybrain:mybrain} registration still exists — they will collide. Re-run/mybrain-setupwhen you're ready to clear it."
0.4 — Continue
Once cleanup is complete (or there was nothing to clean), proceed to Step 1. After cleanup, re-run claude mcp list and confirm no mybrain* entries remain before continuing.
Step 1: Choose Database Backend
Ask the user: "Where should this repo's brain database live?"
1. Bundled — fresh PostgreSQL + Ollama in a single container, dedicated to this repo (recommended)2. Docker — multi-container PostgreSQL + optional Ollama, OpenRouter or local embeddings3. Native — no Docker; uses PostgreSQL and Ollama already installed on this host4. RDS — remote PostgreSQL (AWS RDS or any reachable Postgres); ltree-scoped so multiple repos can share one DB without leaking thoughts
Whichever the user picks, the MCP registration in the final step will be local-scoped (this repo only). The choice here determines only where the data lives.
- If Bundled → follow the Bundled Path below
- If Docker → follow the Docker Path below
- If Native → follow the Native Path below
- If RDS → follow the RDS Path below
Bundled Path
Everything (PostgreSQL + Ollama + MCP server) runs in one container. Ollama provides embeddings locally — no API key needed. The container exposes only the MCP HTTP port. Data is persisted in named Docker volumes.
B1: Prerequisites
| Dependency | Check | Install (macOS) | |
|---|---|---|---|
| Docker Desktop | docker --version | https://docker.com/products/docker-desktop | |
| Node.js (v18+) | node --version | brew install node (only needed if building from source) |
B2: Choose a Brain Name and Port
- Name (default:
default) — determines container name:mybrain_<name> - Port (default:
8787) — the only host port exposed
If .mybrain/ exists, check for port conflicts in existing compose.yml files.
B3: Scaffold Directory
Show the user what you're about to create and ask for confirmation.
Create .mybrain/<name>/:
compose.yml — copy from templates/compose.bundled.yml, substituting <name> and <port>:
.env:
The default OLLAMA_MODEL is gte-qwen2-1.5b-instruct (1536-dim native). To use a 1024-dim model instead (e.g. mxbai-embed-large), substitute {{EMBED_DIM}}=1024 in schema.sql at scaffold time AND set OLLAMA_MODEL=mxbai-embed-large here.
B4: Async Memory Storage (ask)
Before building, ask: "Enable async memory storage? `capture_thought` returns instantly (~3ms) and embeddings run in the background. Trade-off: a thought becomes searchable ~1s after capture. Recommended for Bundled mode since local Ollama is slower than cloud embeddings. (yes / no, default: yes)"
- Yes (default): set
MYBRAIN_ASYNC_STORAGE=truein.env. - No: set
MYBRAIN_ASYNC_STORAGE=falsein.env.
Either way, write the chosen value to .env before starting the container.
B5: Build and Start
The first build downloads the Ollama binary and installs Node.js into the image (~500 MB). First boot pulls the configured OLLAMA_MODEL (default gte-qwen2-1.5b-instruct, ~1.7 GB) into the volume — one-time. Watch logs: docker compose logs -f mybrain.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/mybrain-setup/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/robertsfeir/mybrain/mybrain-setup)