Your best ideas are scattered across notes apps, browser tabs, and old chat threads you will never reopen. A second brain is one place that holds what you care about, with an agent that can search it, link it, and grow it. MentisDB is the durable store. Claude (or Claude Code) is the reader and writer on top.
This guide is a corrected, product-accurate rewrite of the informal “second brain” walkthrough. Install steps, CLI names, Claude Desktop vs Claude Code wiring, branching, and search/invalidation behavior match the current daemon and docs.
MentisDB is an append-only, hash-chained semantic memory engine. It stores typed thoughts (Decision, LessonLearned, Constraint, Correction, Summary, …) with optional typed relations (CausedBy, Corrects, Supersedes, DerivedFrom, …). Retrieval is hybrid ranked search (lexical + optional vectors + graph), not “re-read every file.”
Claude talks to MentisDB over MCP (Model Context Protocol).
It searches the chain, appends structured memories, and resumes from checkpoints via
mentisdb_recent_context.
Unlike a folder of editable notes, the chain is append-only: nothing is silently overwritten or deleted. Corrections and supersedes are new thoughts with edges back to the old ones. Default search hides those superseded targets so the agent sees current memory (see Keep memory clean).
Install Rust, then MentisDB:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
cargo install mentisdb
As of 0.10.4, local-embeddings is a default feature
(built-in ONNX MiniLM vectors, no API key). Plain cargo install mentisdb is enough.
On a headless server without audio, you can use
cargo install mentisdb --no-default-features --features server.
Start the daemon (HTTP MCP, REST, optional HTTPS, operator TUI):
mentisdb
Defaults you will care about:
http://127.0.0.1:9471http://127.0.0.1:9472~/.cloudllm/mentisdb (override with MENTISDB_DIR)borganism-brain (override with MENTISDB_DEFAULT_CHAIN_KEY)Wire installed AI tools in one shot:
mentisdb wizard
# or target one client:
mentisdb setup claude-desktop
mentisdb setup claude-code
mentisdb setup all --dry-run
There is no mentisdb setup claude shorthand. Use
claude-desktop or claude-code (also: codex, opencode, qwen, gemini, copilot, vscode-copilot).
Pick the path that matches your product surface.
Desktop works best with MentisDB as a stdio MCP subprocess. Prefer the setup command (writes the config for you):
mentisdb setup claude-desktop
That configures Claude Desktop to spawn:
{
"mcpServers": {
"mentisdb": {
"command": "mentisdb",
"args": ["--mode", "stdio"]
}
}
}
On macOS the config file is typically
~/Library/Application Support/Claude/claude_desktop_config.json.
Stdio mode auto-detects a running daemon on port 9471, or launches one in the background.
Restart Claude Desktop after setup.
With the daemon running, add the HTTP MCP server:
claude mcp add --transport http mentisdb http://127.0.0.1:9471
Or let MentisDB write the Claude Code config:
mentisdb setup claude-code
Smoke test in the agent: “Search my MentisDB memory for goals or decisions.” Empty results on a fresh chain are fine — the connection is what you are checking.
Paid plans: Claude Code / MCP tool use may require a paid Anthropic plan. Confirm against current Claude product docs; free-tier limits change over time.
MentisDB expects agents to bootstrap (list chains → bootstrap → skill → list agents → recent context), then reuse an existing agent identity instead of inventing a new one every session.
Have Claude interview you and store structured memories. Example prompt:
You are setting up my second brain in MentisDB. Follow MentisDB bootstrap: list_chains, bootstrap the chain I choose (or the project chain), load the MentisDB skill, list_agents and reuse an existing agent_id. Interview me one question at a time about: who I am, yearly goals, how you should talk to me, strengths/weaknesses, current projects. After each answer, search the chain first, then append the right thought type (Decision for goals, Constraint for interaction rules, Summary with role Checkpoint for the profile). Link new thoughts with DerivedFrom / References where useful. End with a Summary + Checkpoint I can reload via mentisdb_recent_context.
Typed memories beat a single giant markdown profile file: they are searchable, linkable, and filterable without reloading everything every turn.
Scope work with tags, entity_type, and/or a dedicated chain_key — not by reopening folders as separate vaults.
# Example agent instructions (via MCP tools, not a fake CLI):
# mentisdb_upsert_entity_type(entity_type: "youtube-channel")
# mentisdb_append(..., entity_type: "youtube-channel", tags: ["youtube-channel"], thought_type: "Decision")
# mentisdb_ranked_search(text: "...", tags_any: ["youtube-channel"], thought_types: ["Decision","Constraint"])
Optional isolation: fork a branch chain with the MCP tool
mentisdb_branch_from (or REST POST /v1/chains/branch).
There is no mentisdb chains branch CLI subcommand.
Branch searches can include ancestor-chain results; merge back with
mentisdb_merge_chains when ready.
MentisDB has a versioned skill registry (immutable versions, deprecate/revoke).
Upload with mentisdb_upload_skill using a registered
agent_id on that chain. Prefer searching and reading skills after bootstrap
before trusting unknown content.
You can attach other MCP servers (calendar, email, …) next to MentisDB. Example calendar wiring is product-specific; one common pattern with Claude Code is adding a third-party MCP and then asking Claude to extract commitments into MentisDB as typed thoughts. Keys and OAuth stay in the MCP client config — never paste secrets into the chain.
Append-only still applies: a bad extraction is fixed with a Correction / Supersedes edge, not by editing history.
Before context compaction or handoff, always write a Summary with role
Checkpoint. At session start, load mentisdb_recent_context
and run a ranked search for the current task.
If your host app supports scheduled prompts, a useful daily job is: search last 24h → Summary Checkpoint → list unresolved Question thoughts. MentisDB itself does not schedule jobs; scheduling is a Claude/host feature.
Default search (ranked search, context bundles, recent context, …) excludes
thoughts that later memory marked with Supersedes, Corrects, or
Invalidates. Pass include_invalidated: true only for audit.
That only works when edges exist:
# Recommended for multi-agent / long-lived local daemons
export MENTISDB_DEDUP_THRESHOLD=0.85
export MENTISDB_DEDUP_SCAN_WINDOW=64
mentisdb
Dedup is off when the threshold env var is unset. Without edges or dedup, large chains accumulate noise and “forgetting” returns even though search is hybrid.
| Notes app + plugin | MentisDB | |
|---|---|---|
| Built for | Humans editing files | Agents storing typed memory |
| Connection | Plugins / keys / app must stay open | Native MCP (stdio or HTTP daemon) |
| Storage | Editable files | Append-only, hash-chained |
| Structure | Untyped links | Thought types + relation kinds |
| Retrieval | Re-read / keyword | Hybrid ranked search + thesaurus |
| Stale memory | Manual cleanup | Invalidation set + optional auto-dedup |
| Isolation | Copy folders | Tags, entity_type, branch chains |
| Skills | Loose markdown | Versioned registry |
cargo install mentisdb → mentisdbmentisdb setup claude-desktop and/or claude-code / wizardMENTISDB_DEDUP_THRESHOLD=0.85 for long-running useDeeper material: docs.mentisdb.com (Invalidation & Dedup, Claude Desktop cookbook), Agent Memory Cookbook, and the embedded MentisDB skill after MCP connect.