← Blog
July 13, 2026 · Verified against MentisDB 0.10.4+ / unreleased 0.10.5 search behavior

How to Build an AI Second Brain With Claude and MentisDB

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.

What you are building

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).

Step 1 — Install MentisDB

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:

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).

Step 2 — Connect Claude

Pick the path that matches your product surface.

Claude Desktop (recommended: stdio)

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.

Claude Code (HTTP MCP)

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.

Step 3 — Bootstrap the chain and load yourself

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.

Step 4 — Projects without “vault switching”

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.

Step 5 — Skills in the registry

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.

Step 6 — Live data (optional)

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.

Step 7 — Checkpoints and daily hygiene

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.

Keep memory clean (search + invalidation)

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:

  1. Search-first writing — agents link corrections with typed relations.
  2. Auto-dedup (recommended for long-lived brains) — enable near-duplicate Supersedes:
# 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.

Why this beats a notes-folder second brain

Notes app + pluginMentisDB
Built forHumans editing filesAgents storing typed memory
ConnectionPlugins / keys / app must stay openNative MCP (stdio or HTTP daemon)
StorageEditable filesAppend-only, hash-chained
StructureUntyped linksThought types + relation kinds
RetrievalRe-read / keywordHybrid ranked search + thesaurus
Stale memoryManual cleanupInvalidation set + optional auto-dedup
IsolationCopy foldersTags, entity_type, branch chains
SkillsLoose markdownVersioned registry

Quick checklist

  1. cargo install mentisdbmentisdb
  2. mentisdb setup claude-desktop and/or claude-code / wizard
  3. Bootstrap chain + skill + agent identity
  4. Interview → typed appends + Checkpoint Summary
  5. Projects via tags / entity_type (branch only when you need isolation)
  6. Consider MENTISDB_DEDUP_THRESHOLD=0.85 for long-running use
  7. Search before write; Corrects/Supersedes when truth changes

Deeper material: docs.mentisdb.com (Invalidation & Dedup, Claude Desktop cookbook), Agent Memory Cookbook, and the embedded MentisDB skill after MCP connect.