Sandbox
@Goldziher/basemind

MCP server for code, docs, git, and memory

basemind turns a repository into a shared context service for agents. It indexes code structure, documents, git history, memory, web pages, and multi-agent messages, then serves that data through MCP, a CLI, and editor plugins.

98 stars21 forksRustUpdated 7d ago
Who it's for

Builders who want their agent to search code, read documents, check git history, and coordinate with other agents from one local service.

What it delivers

You can ask your agent for precise project answers and coordinated agent work without burning context on repeated file reads.

What it does

Code map and navigation

Indexes structure across 300+ languages and exposes outline, symbols, references, callers, implementations, dependents, expand, and semantic search.

Git intelligence

Find recent changes, blame lines or symbols, inspect churn, diff outlines, and search commit history.

Documents and OCR search

Search PDFs, Office files, HTML, email, and images by meaning, with OCR included.

Shared memory

Store, search, audit, accept, and reject repo-scoped memory entries that persist across sessions.

Web crawl

Scrape pages or crawl linked pages and add them to the document search index.

Agent comms and shells

Start threads, post messages, manage inboxes, and run headless shell sessions for background work.

Editor and agent packaging

Ships as MCP config, plugins, skills, slash commands, and hooks for multiple agent tools.

How to get it

  1. 1In the session (not your shell), run in order
    /plugin marketplace add Goldziher/basemind
    /plugin install basemind@basemind
  2. 2Restart, then run /bm-statusline once to turn on the live statusline (a one-time step —…
    codex plugin marketplace add Goldziher/basemind
    codex plugin add basemind@basemind
  3. 3In Agent chat: /add-plugin basemind (once listed), or go to Dashboard → Settings →…
    gemini extensions install https://github.com/Goldziher/basemind
  4. 4Update later with gemini extensions update basemind.
    droid plugin marketplace add https://github.com/Goldziher/basemind
    droid plugin install basemind@basemind
  5. 5Run
    copilot plugin marketplace add Goldziher/basemind
    copilot plugin install basemind@basemind
  6. 6Run
    /plugins install https://github.com/Goldziher/basemind

README

basemind — cybernetic core

The context and communication layer for coding agents.

basemind turns any repo into an always-current map of its code, documents, history, and memory — so agents answer from structure and search instead of burning their context window on grep and file reads — and gives a team of agents a shared channel to coordinate while they work. One server does both.

Code map across 300+ languages · documents in 90+ formats · semantic + full-text search · git history & blame · shared memory · web crawl · agent-to-agent comms

Docs crates.io npm PyPI CI License: MIT

Docs · Install · Features · How it works · Performance · CLI


An agent answering from a file outline and its call sites in a live Claude Code session

An agent reasoning from structure — code modes outline and references in a live session, statusline tracking tokens saved.


What you get

basemind answers with file paths, line numbers, and signatures — not whole files — so a question about your code costs a small fraction of the tokens it takes to read the source.

CapabilityWhat it doesKey tools
Code intelligenceRead the code map instead of opening files: a file's structure (outline), find a definition by name (symbols), regex content search (grep), enumerate or fuzzy-find files (files · find), resolve a reference position to the definition it binds to (definitionscope- and import-aware, JS/TS via oxc, Python & Java via in-tree stack-graphs), every call site of a name (references, name-only) or of one specific definition (callers), implementors of a trait / interface / base class (implementations), the reverse import lookup (dependents), one symbol's raw body (expand), and search by meaning over indexed chunks (semanticchunk, needs --features code-search). Layered over 300+ languages.code (outline · symbols · grep · files · find · definition · references · callers · implementations · dependents · expand · semantic · chunk)
Code graphWalk the typed code-graph: who calls what and what a function reaches (calls), a symbol's n-hop blast radius (neighbors), the confidence-weighted shortest route between two symbols (path), a readable centrality-cut neighborhood (subgraph), the repo's de-facto modules (communities), and the whole-repo architecture ranked by PageRank + git churn with its dependency cycles (map). Render it as node-link JSON / DOT / Mermaid / GraphML / Cypher / offline interactive HTML / static SVG (export), show it to a human in their desktop viewer (display), or open the interactive UI at a live http://…/ui URL (open, which needs the daemon's opt-in HTTP front-end and otherwise falls back to a file:// export) — both take open: false to return the path or URL without launching anything. Every edge carries provenance + confidence; every result is deterministic and bounded.graph (calls · neighbors · path · subgraph · communities · map · export · display · open)
Git intelligenceAsk what changed recently, who last touched a function or a line, where the churn is, when a symbol's body actually changed, how a file's structure differs across commits, and full-text search commit authors + messages at full branch depth.git (status · recent · touching · by_path · churn · diff · diff_outline · blame · blame_symbol · symbol_history · search)
Memory & documentsA per-repo memory agents write to and search by meaning — clones of the same repo share it, unrelated repos stay separate — plus semantic search over PDFs, Office files, HTML, email, and images (OCR included, no extra setup), and a review queue of notes mined from files that change together, which you approve before anything is kept.memory (put · get · list · search · delete · audit · documents · mine · proposals · accept · reject)
Web crawlFetch a page or follow links from a starting URL; results join the document search above.web (scrape · crawl · map)
Agent commsThreads addressed by subject, path-glob, and members; scope discovery; inbox delivery; lifecycle status; and dry-run/apply retention cleanup.agents (register · list · thread_start · thread_list · join · leave · members · add_member · remove_member · archive · post · history · message · inbox · ack · wait · cleanup · status)
Agent shellsRun headless terminal sessions in the background, capture recent retained output after commands exit, and explicitly stop sessions when their work is done. Visual terminal attachment is opt-in through [shells].visual.shell (spawn · send · capture · kill · list · broadcast)
AdminRefresh the index after edits, check index health and repo identity, see what's been queried and how many tokens were saved, inspect or clean the on-disk cache, and shrink what an agent carries: a file's outline instead of its text, a diff instead of a re-read, a checkpoint instead of a transcript, plus a wasteful-tool-use report.admin (status · repo · rescan · cache_stats · gc · cache_clear · telemetry · compress · delta · checkpoint · waste)
Machine registryMachine-wide repo/worktree/branch coordination, backed by the daemon's always-on registry. Advisory claims let agent sessions avoid colliding on the same worktree.workspace (workspaces · worktrees · branches · claim · release)

Installation

Three ways to run basemind, easiest first. All three share the same local index and are safe to run side by side.

The plugin downloads the basemind program for you on first use. The MCP-server and CLI paths need it installed yourself — see Install the program.

1. As a plugin (recommended)

The plugin sets up everything for you — the server, the helper skills, the agent-comms features, and the slash commands. Pick your coding tool.

Claude Code

In the session (not your shell), run in order:

/plugin marketplace add Goldziher/basemind
/plugin install basemind@basemind

Restart, then run /bm-statusline once to turn on the live statusline (a one-time step — see Statusline). Turn on auto-update for the basemind marketplace (Claude Code's plugin manager): the plugin then tracks each new release automatically, and the launcher resolves the latest published release, so you always get the current index format and tool set and startup stays reliable even during a release. Prefer to control timing? Update the marketplace regularly by hand instead.

Codex
codex plugin marketplace add Goldziher/basemind
codex plugin add basemind@basemind

In the app: open the Plugins sidebar and add basemind. The CLI and IDE share one config file. The plugin starts the latest published GitHub release from the project workspace; it never runs from the installed plugin cache or races a shared npx install.

Cursor

In Agent chat: /add-plugin basemind (once listed), or go to Dashboard → Settings → Plugins → Team Marketplaces → Import from Repo and point it at https://github.com/Goldziher/basemind.

Gemini CLI
gemini extensions install https://github.com/Goldziher/basemind

Update later with gemini extensions update basemind.

Factory Droid
droid plugin marketplace add https://github.com/Goldziher/basemind
droid plugin install basemind@basemind
GitHub Copilot CLI
copilot plugin marketplace add Goldziher/basemind
copilot plugin install basemind@basemind
OpenCode

Add to opencode.json (project) or ~/.config/opencode/opencode.json (global):

{ "plugin": ["basemind-opencode@latest"] }
Kimi Code
/plugins install https://github.com/Goldziher/basemind

Kimi doesn't support the comms auto-notifications, but the chat tools still work.

Hermes

Hermes exposes MCP servers through config, so basemind's tools are wired there. Two steps — the binary + MCP wiring gives you the tools; a small standalone plugin package adds the helper skills, slash commands, and comms notifications.

First install the program (Homebrew / npm / cargo / release — not pip), then add the server to ~/.hermes/config.yaml (this is what gives you the nine domain tools):

mcp_servers:
  basemind:
    command: basemind
    args: [serve]

For the helper skills, slash commands, and agent-comms notifications, install the standalone plugin into the same Python environment Hermes runs in, then enable it (general plugins are opt-in):

pip install basemind-hermes-plugin
hermes plugins enable basemind

The plugin is pure-Python and ships no binary — it shells out to the basemind you installed above. Comms auto-notifications are best-effort; the chat tools work regardless.

Antigravity & pi

Antigravity uses a shared MCP config — install the program, then add the generic MCP block. If you already use the Gemini extension, agy plugin import gemini brings it across.

pi: pi install git:github.com/Goldziher/basemind. pi has no MCP support, so basemind runs through its CLI here.

2. As an MCP server

If your tool speaks MCP but you're not using the plugin, install the program, then register it:

{
  "mcpServers": {
    "basemind": { "command": "basemind", "args": ["serve"] }
  }
}

Each tool says whether it only reads or can change things, so your client can auto-approve the safe ones and ask before the rest. If basemind isn't found, use the full path from which basemind.

Per-tool specifics (Claude Code · Cursor · Windsurf · Codex · Gemini · Copilot · Droid · Cline · Continue · OpenCode · Hermes)
  • Claude Codeclaude mcp add basemind -- basemind serve (add --scope user for all projects; the -- is required). Or commit a .mcp.json at the repo root with the block above.
  • Cursor — put the block above in .cursor/mcp.json (project) or ~/.cursor/mcp.json (global).
  • Windsurf~/.codeium/windsurf/mcp_config.json (or Cascade → MCP servers → manage), then Refresh.
  • Codexcodex mcp add basemind -- basemind serve, shared by the CLI and IDE.
  • Gemini CLIgemini mcp add basemind basemind serve, or the block above in ~/.gemini/settings.json.
  • GitHub Copilot CLI/mcp add in-session, or ~/.copilot/mcp-config.json with "type": "local" and "tools": ["*"].
  • Factory Droiddroid mcp add basemind "basemind serve", or ~/.factory/mcp.json.
  • Cline — MCP Servers icon → Configure → add the block above.
  • Continue.continue/mcpServers/basemind.yaml with command: basemind, args: [serve].
  • OpenCode (without the plugin)opencode.json under key mcp, with command as an array ["basemind", "serve"].
  • Hermesmcp_servers.basemind in ~/.hermes/config.yaml (YAML: command: basemind, args: [serve]). For helper skills + comms notifications, pip install basemind-hermes-plugin (a standalone pure-Python plugin, no binary), then hermes plugins enable basemind — see the Hermes plugin section above.
  • Any other tool — point it at the command basemind with the argument serve.

3. As a CLI

The standalone program, for scripts, headless runs, and CI. Install it, then:

basemind scan                          # index the project once
basemind code symbols "parseQuery"     # find a definition by name
basemind code references "processFile" # find everywhere it's called
basemind git blame src/main.rs         # who last changed each line
basemind watch                         # keep the index fresh as files change

Full command list in the CLI reference.

Install the program

The MCP and CLI paths need basemind available on your system. (The plugin does this for you.)

ChannelCommandIncludes
Homebrewbrew install Goldziher/tap/basemindeverything
npmnpm install -g basemindeverything
pippip install basemindeverything
cargocargo install basemind --lockedcode + git only
cargo (full)cargo install basemind --features full --lockedeverything
GitHub releasesDownload a binaryeverything

The Homebrew / npm / pip / GitHub downloads include the full feature set — documents, OCR, search, web crawl, shared memory, agent comms, and agent shells — so the first run downloads the models it needs. The plain cargo install builds the code-map and git tools only.

Get started

After installing, run basemind init (CLI) — or /bm-init if your tool supports slash commands — from the repo root. It's re-runnable and safe to call again later:

  • Writes a commented basemind.toml scaffold at the repo root, if one doesn't already exist.
  • Lets you pick which capabilities to advertise (interactive prompt in a TTY, or non-interactive with --yes, --with <capability>, --without <capability>). Capability slugs: code-search-navigation, code-mapping-architecture, git-history, agent-comms, documents-rag, semantic-search.
  • Injects a "prefer basemind over grep/read/git" rules block into your repo's agent-instructions file — .ai-rulez/rules/basemind-usage.md if .ai-rulez/config.toml is present (run ai-rulez generate afterward), else CLAUDE.md, else AGENTS.md, else a new CLAUDE.md. The block is delimited (<!-- BEGIN basemind ... --> / <!-- END basemind -->) so re-running replaces it in place instead of duplicating it.

Preview changes without writing with --print; skip the rules step with --no-rules; steer the target explicitly with --rules-target <auto|claude|agents|ai-rulez|none>.

Statusline (Claude Code)

Run /bm-statusline once. This is a one-time step because Claude Code doesn't let plugins set the main statusline themselves — so basemind asks the assistant to make the one-line settings change on your behalf, and it sticks from then on.

It shows two lines:

Opus · basemind · ⎇ main · 12% ctx
◆ basemind  ●  1,247 files · 23m ago  │  312 calls · 180 srch · 44 git · 12 docs  │  1.4M saved  │  ✉ 3 @reviewer

The dot is green when basemind is live and fresh, amber when idle, red when stale. The middle shows activity by type, then tokens saved, then unread messages. Adjust with BASEMIND_STATUSLINE=full|compact|minimal, or hide the top line with BASEMIND_STATUSLINE_CONTEXT=0.


Demos

basemind CLI: scan, then symbol / reference / call-graph / blame queries

The same engine from the CLI — scan, then symbol / reference / call-graph / blame queries.

Semantic search over the documents store

Searching documents by meaning, not keywords, across 90+ formats.

Three named reviewer agents posting findings to a shared repo-scoped thread, replying to each other, and an orchestrator synthesizing a verdict over the comms CLI

Multi-agent code-review panel: named reviewers coordinate in a repo-scoped thread (post, reply, synthesize) — entirely over basemind agents.


How it works

From one scan to instant answers

basemind scan reads your project once, in parallel. It maps your code with [tree-sitter] (across [300+ languages][tslp]) and pulls text out of your documents with [xberg], then saves the result to a global cache under the XDG data directory, keyed by workspace — nothing is written into your repo. After that, basemind serve keeps the map in memory and answers questions instantly — no re-reading the project for each one. When files change, it updates only what changed. A single background daemon on the machine is the sole writer to that cache, so multiple serve sessions on the same repo (or on different worktrees of it) all read and write concurrently instead of one falling back read-only. See Global cache & the daemon below.

Navigation is scope- and import-aware for JavaScript/TypeScript, Python, and Java: basemind resolves each use to the definition it actually binds to, so a shadowed local isn't confused with an import and code mode definition lands on the right target (including across files for imports). Every other language still gets fast tree-sitter scope binding. Precise Python/Java resolution runs GitHub stack-graphs-style .tsg name-binding rules via an in-tree engine (crates/), with no per-language LSP server.

Resolution refines, but never shrinks, a result set. code mode callers reports every call site whose callee matches the name — the same sound floor mode references uses — and marks each hit resolved when resolution proved it binds to that definition (resolved_total counts them). It deliberately does not return only the resolved subset: resolution cannot see through a module-object import (from pkg import mod then mod.f()) or an unresolvable path alias, so filtering to it would drop real callers and report the remainder as complete. Filter on resolved when you want precision; trust total when you need completeness.

Markdown and Obsidian vaults are first-class: headings become navigable symbols (so code modes outline and symbols work over a notes vault); [[wikilinks]], ![[embeds]], and standard [text](Note.md) links all become references — so mode references on "Note" returns that note's backlinks regardless of link style; and #tags (inline or in YAML frontmatter) become references too, so mode references on "#project" lists every note carrying that tag.

flowchart LR
  A(["Coding agent"])
  R["Your project<br/>code · documents · git"]
  S["basemind scan<br/>map code & read documents"]
  D[("Global cache<br/>per-OS data dir")]
  V["basemind serve<br/>answers questions"]
  R --> S --> D --> V
  A <-->|asks questions| V
  classDef accent fill:#2563eb,stroke:#1e40af,color:#fff
  class S,V accent

Search and memory are powered by a vector store ([LanceDB]).

Index lifecycle & freshness

basemind serve answers the MCP handshake immediately and warms the code map into memory in the background, so a client never blocks waiting for a large repo to load. The status tool reports warming (still loading) and, once done, warm_ms; a first-time index build similarly reports indexing / index_build_ms.

While the server isn't fully ready, status and every code-map read tool may carry a notice object — { state, message, retry } — instead of (or alongside) their normal result:

stateMeaningretry
warming_upLoading an existing index into memory.true
building_indexIndexing from scratch (no cache entry for this workspace yet).true
rescanningIncremental rescan after a file change; current results are usable but may be stale.false

Treat an empty or partial result carrying a notice as "retry shortly," not "no matches" — poll status (or just retry the call) until the notice clears.

Global cache & the daemon

Index state lives under a single global cache — ~/.local/share/basemind/ on Linux, ~/Library/Application Support/basemind/ on macOS (override with BASEMIND_DATA_HOME) — keyed by workspace, never inside your repo. The content-addressed blob store is machine-wide too: identical file content scanned from different repos or worktrees is extracted and stored once.

A workspace root must be a project: a git repository, or a directory containing basemind.toml. Anything else is refused, because basemind opens a root read-write and indexes every file beneath it — so an accidentally inherited root (/, your home directory, or wherever an MCP host happened to start) would become a whole-filesystem scan. Run basemind init to mark a directory you do want indexed, or set BASEMIND_ALLOW_ANY_ROOT=1 to skip the check. A filesystem or volume root is refused unconditionally and cannot be overridden.

A single background daemon per machine is the sole writer to that cache. basemind serve opens its store read-only and forwards writes (scan / rescan) to the daemon over a local socket, so N serve sessions on the same repo — or on different worktrees of it — all read and write concurrently instead of a second session silently falling back to a stale, read-only view. The daemon also keeps a cheap, always-on registry of repos, worktrees, and branches (workspaces / worktrees / branches), and worktree_claim / worktree_release give agent sessions an advisory way to avoid colliding on the same worktree.

basemind statusline queries the daemon for the workspaces currently active and prints a compact line for your shell prompt; it prints nothing when no daemon is running.

The daemon is started on demand, detached with setsid(2). That changes the session and the process group but not the cgroup, so on Linux an auto-spawned daemon lives in the cgroup of whatever shell or editor happened to start it — outside any MemoryMax you configured for basemind. No code in basemind can change th

Files in the repo

Repository payload45 top-level entries
  • .ai-rulez
  • .claude-plugin
  • .codex-plugin
  • .cursor-plugin
  • .github
  • .hermes
  • .pi
  • benches
  • commands
  • crates
  • docs
  • hooks
  • npm-package
  • opencode-plugin
  • pip-package
  • pip-package-hermes
  • schema
  • scripts
  • skills
  • src
  • tests
  • website
  • .ai-rulez-generated.json
  • .gitignore
  • .mcp.json
  • ATTRIBUTIONS.md
  • basemind.toml
  • buf.lock
  • build.rs
  • Cargo.lock
  • Cargo.toml
  • CHANGELOG.md
  • CONTRIBUTING.md
  • deny.toml
  • gemini-extension.json
  • kimi.plugin.json
  • LICENSE
  • llms.txt
  • package.json
  • poly-hooks.lock
  • poly.toml
  • README.md
  • rustfmt.toml
  • settings.json
  • Taskfile.yaml

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k