basemind — the indexed context layer
basemind is the full context layer for this repository, served over MCP. It pre-indexes the
repo into a content-addressed blob store + Fjall inverted index (and, when enabled, a LanceDB
vector store) so structural, historical, and semantic questions resolve in milliseconds —
without you reading whole files.
Capabilities
- Code map across 300+ languages — tree-sitter outlines, symbol search, references,
callers, call graphs, implementations, dependents.
- Full-text + symbol search —
code modes grep and symbols.
- Git intelligence — history, blame, and structural diffs at symbol resolution, plus churn.
- Document RAG over 90+ file formats — PDFs, Office, HTML, email, images (OCR) → semantic
search with cross-encoder reranking (
memory mode documents).
- Shared memory — per-repo, scope-keyed key-value + semantic memory across sessions.
- Web crawl — scrape / follow-link crawl into the same searchable document store.
Dedicated per-capability skills
This umbrella skill covers the whole surface. For focused workflows, reach for the dedicated skills:
basemind-code-search — outlines, symbol search, references, callers, call graphs.
basemind-git-history — history, blame, structural diffs, churn.
basemind-documents — document RAG (memory mode documents), web ingestion, memory.
basemind-comms — coordinating with other agents in the same repo over the broker.
basemind-cli — the same surface driven headlessly from the CLI.
When to reach for it (instead of grep / read_file)
Use basemind for:
- Locating a symbol: "where is
Foo defined?", "find the constructor for Bar", "show me every type ending in Service".
- Following call graphs: "what calls
process_file?", "who depends on this module?".
- Mapping a file's shape before reading it: which symbols, in what order, with what signatures.
- Walking recent history: "what changed in this file in the last 20 commits?", "when did this symbol last change?".
- Blame and ownership: "who last touched this function?", "what commit introduced this line?".
- Diffing across revisions: "what symbols did this branch add?", "show the hunks for
foo.rs between HEAD~5 and HEAD".
If you are about to open more than two or three files just to learn structure, stop
and use basemind first. The tools return paths + line numbers; you only read_file
once you know exactly which span you need.
Context economy — the operating discipline
basemind tools return paths, line numbers, and signatures — not file bodies, so a
structural answer costs a fraction of the tokens of reading source. Treat that as the
default workflow, not an optimization:
- Use
code mode outline before you open a file. Read the whole file only when you have already
identified the exact span you need from the outline; then read_file that range, not the file.
- Use
code mode symbols instead of grep/rg for a definition. It matches indexed symbol
names and returns path:line, skipping the comment/string/test-name noise grep drowns you in.
- Use
code modes references / callers instead of grepping call sites. Indexed call edges,
not text matches.
- Use
code mode grep instead of shelling out to ripgrep when you genuinely need regex over
content — it runs over the in-RAM index and returns capped, structured hits.
- Use
admin mode rescan after you edit code, not a server reconnect. Pass paths: [...] to limit it to
the files you touched.
- Do not re-read a file basemind already mapped. If the outline answered the question, stop.
Rule of thumb: if a question is about where, what calls, what shape, who changed, or
what's indexed, a basemind tool answers it cheaper than reading files. Reach for read_file
only to see the actual implementation of a span you have already located.
basemind first, shell/grep/git fallback. Prefer basemind over reading files, over grep/rg,
and over naked git: use it for code parsing (outlines, references, callers), git history / blame /
diffs, document extraction / RAG / keyword + entity (NER) / summary (memory mode documents), and
web modes scrape / crawl / map. Drop to raw shell, grep, or
git only when no basemind tool covers the question.
Tool routing (copy this into your mental model)
| Question |
Tool |
| "Where is X defined?" |
code { mode: "symbols", name: X } (substring; optional kind) |
| "Jump to the definition of X used here?" |
code { mode: "definition", path, line, column? } |
| "What's the high-level architecture / module map?" |
graph { mode: "map" } |
| "What's the shape of file F?" |
code { mode: "outline", path: F, l2?: true } |
| "What calls X?" (any name) |
code { mode: "references", name: X } |
| "What calls this specific definition?" |
code { mode: "callers", path: F, name: X } |
| "Trace the call graph from a function?" |
graph { mode: "calls", name: X } |
| "What implements / extends / inherits from X?" |
code { mode: "implementations", trait_name: X } |
| "What imports module M?" |
code { mode: "dependents", module: M } |
| "What files are indexed?" |
code { mode: "files" } |
| "What changed recently?" |
git modes recent, touching, or by_path |
| "When did symbol X last change?" |
git { mode: "symbol_history", path: F, name: X } |
| "Who wrote this line / symbol?" |
git mode blame or blame_symbol |
| "Where's the churn?" |
git { mode: "churn" } |
| "What's dirty in the working tree?" |
git { mode: "status" } |
| "What's HEAD / branch?" |
admin { mode: "repo" } |
| "Show diff between revs for file F" |
git mode diff or diff_outline |
| "What's indexed?" |
admin { mode: "status" } |
| "Semantic search over PDFs / Office docs?" |
memory { mode: "documents", query } |
| "Recall something the agent stored earlier?" |
memory mode get, list, or search |
| "Remember this for future sessions?" |
memory { mode: "put", key, value } |
| "Refresh the index after editing code?" |
admin { mode: "rescan", paths?: […] } |
| "Fetch next page of results?" |
Pass next_cursor from prior response as cursor |
| "Pull this URL into RAG?" |
web { mode: "scrape", url } — single page, robots-aware |
| "Ingest a docs site section?" |
web { mode: "crawl", url } — link-following from a seed |
| "What URLs exist on this site?" |
web { mode: "map", url } — discovery without bodies |
| "How much has basemind helped today?" |
admin { mode: "telemetry", window: "today" } |
Setup (one-time per repo)
basemind needs an index before it can answer queries. The index lives in a machine-global cache
(Linux ~/.local/share/basemind/, macOS ~/Library/Application Support/basemind/; override
BASEMIND_DATA_HOME), keyed by workspace — never inside your repo. From the repo root:
basemind scan
This walks the tree, parses with tree-sitter, and writes a content-addressed blob
store + Fjall inverted index into the machine-global cache. A few seconds for small repos,
~22 s for an ~80k-file TypeScript monorepo.
The MCP server is launched by the host (basemind serve — wired up in
.claude-plugin/plugin.json for you). You do not start it manually.
Re-run basemind scan after large changes, or run basemind watch to keep the index fresh on file save.
If a tool returns "no indexed files", that means basemind scan hasn't been run in this repo yet.
Examples
Locating a symbol
code { mode: "symbols", name: "MapCache" }
→ src/mcp/mod.rs:79:1 MapCache (struct)
src/mcp/mod.rs:88:1 MapCache (impl)
Now you know exactly where to read.
Following references
code { mode: "references", name: "process_file" }
→ src/scanner.rs:142:9 process_file
src/scanner.rs:201:13 process_file
...
No need to grep — the index already knows.
Outline a file before reading
code { mode: "outline", path: "src/mcp/tools.rs" }
→ 21 code router (function)
112 code helper (function)
...
A 1000-line file becomes a 30-line table of contents.
Notes
- All paths are repository-relative with forward-slash separators.
- Lists are capped (
limit, default 100, max 1000). Index scanners use
scan_cap = limit * 8 to bound work on common names.
- Matching is substring on names —
code mode references with name: "bar" matches
Foo::bar() and bar() alike. There is no scope resolution; cross-check with mode outline if
disambiguation matters.
- Git tools require
basemind serve to be running inside a git repository. Outside a git repo they return a clear error.
memory modes require basemind to be built with
--features full (or the individual documents / memory flags). Without them the
tools dispatch but return an MCP error.
Memory is scoped by the normalised origin remote URL (git@github.com:Foo/bar.git and
https://github.com/Foo/bar/ collapse to the same scope key) — clones of the same repo
share memory; unrelated repos do not see each other's entries.
web modes scrape, crawl, and map require --features crawl.
When that feature is off they are NOT registered on the server at all — agents will simply
not see them in the tool list. Crawled pages land in the documents LanceDB table tagged
with scope web:<host>; memory mode documents finds them alongside every other ingested
document. It searches across ALL documents and has no scope parameter — you cannot
filter results to a single host at query time.
robots.txt is honoured by default; only [crawl].respect_robots_txt = false in
the repo-root basemind.toml (config-file-only) disables it.
1---2name: basemind-23description: Navigate large or unfamiliar codebases via the basemind MCP server — outlines, symbol search, reference/caller lookups, commit history, blame, and diffs without reading source files. Reach for it whenever the user asks "where is X defined", "what calls Y", "what changed recently in Z", or whenever you're about to grep or open many files to find structural information.4---56<!--7AI-RULEZ :: GENERATED FILE — DO NOT EDIT8Content-Hash: blake3:197b16796000588b0af439044dd27f61fd7eab65ab3348c6af1bbd0a63405e899Source-Hash: blake3:85ad00af4214850487da665406023114ffe204d5194afab7f5ee823c398a421810Schema-Version: v111-->1213# basemind — the indexed context layer1415basemind is the full context layer for this repository, served over MCP. It pre-indexes the16repo into a content-addressed blob store + Fjall inverted index (and, when enabled, a LanceDB17vector store) so structural, historical, and semantic questions resolve in milliseconds —18without you reading whole files.1920## Capabilities2122- **Code map across 300+ languages** — tree-sitter outlines, symbol search, references,23 callers, call graphs, implementations, dependents.24- **Full-text + symbol search** — `code` modes `grep` and `symbols`.25- **Git intelligence** — history, blame, and structural diffs at symbol resolution, plus churn.26- **Document RAG over 90+ file formats** — PDFs, Office, HTML, email, images (OCR) → semantic27 search with cross-encoder reranking (`memory` mode `documents`).28- **Shared memory** — per-repo, scope-keyed key-value + semantic memory across sessions.29- **Web crawl** — scrape / follow-link crawl into the same searchable document store.3031## Dedicated per-capability skills3233This umbrella skill covers the whole surface. For focused workflows, reach for the dedicated skills:3435- **`basemind-code-search`** — outlines, symbol search, references, callers, call graphs.36- **`basemind-git-history`** — history, blame, structural diffs, churn.37- **`basemind-documents`** — document RAG (`memory` mode `documents`), web ingestion, memory.38- **`basemind-comms`** — coordinating with other agents in the same repo over the broker.39- **`basemind-cli`** — the same surface driven headlessly from the CLI.4041## When to reach for it (instead of `grep` / `read_file`)4243Use basemind for:4445- **Locating a symbol**: "where is `Foo` defined?", "find the constructor for `Bar`", "show me every type ending in `Service`".46- **Following call graphs**: "what calls `process_file`?", "who depends on this module?".47- **Mapping a file's shape** before reading it: which symbols, in what order, with what signatures.48- **Walking recent history**: "what changed in this file in the last 20 commits?", "when did this symbol last change?".49- **Blame and ownership**: "who last touched this function?", "what commit introduced this line?".50- **Diffing across revisions**: "what symbols did this branch add?", "show the hunks for `foo.rs` between HEAD~5 and HEAD".5152If you are about to open more than two or three files just to learn structure, stop53and use basemind first. The tools return paths + line numbers; you only `read_file`54once you know exactly which span you need.5556## Context economy — the operating discipline5758basemind tools return **paths, line numbers, and signatures — not file bodies**, so a59structural answer costs a fraction of the tokens of reading source. Treat that as the60default workflow, not an optimization:6162- **Use `code` mode `outline` before you open a file.** Read the whole file only when you have already63 identified the exact span you need from the outline; then `read_file` that range, not the file.64- **Use `code` mode `symbols` instead of `grep`/`rg` for a definition.** It matches indexed symbol65 names and returns `path:line`, skipping the comment/string/test-name noise grep drowns you in.66- **Use `code` modes `references` / `callers` instead of grepping call sites.** Indexed call edges,67 not text matches.68- **Use `code` mode `grep` instead of shelling out to ripgrep** when you genuinely need regex over69 content — it runs over the in-RAM index and returns capped, structured hits.70- **Use `admin` mode `rescan` after you edit code**, not a server reconnect. Pass `paths: [...]` to limit it to71 the files you touched.72- **Do not re-read a file basemind already mapped.** If the outline answered the question, stop.7374Rule of thumb: if a question is about _where_, _what calls_, _what shape_, _who changed_, or75_what's indexed_, a basemind tool answers it cheaper than reading files. Reach for `read_file`76only to see the actual implementation of a span you have already located.7778**basemind first, shell/grep/git fallback.** Prefer basemind over reading files, over `grep`/`rg`,79and over naked `git`: use it for code parsing (outlines, references, callers), git history / blame /80diffs, document extraction / RAG / keyword + entity (NER) / summary (`memory` mode `documents`), and81`web` modes `scrape` / `crawl` / `map`. Drop to raw shell, grep, or82git only when no basemind tool covers the question.8384## Tool routing (copy this into your mental model)8586| Question | Tool |87|---|---|88| "Where is X defined?" | `code { mode: "symbols", name: X }` (substring; optional `kind`) |89| "Jump to the definition of X used here?" | `code { mode: "definition", path, line, column? }` |90| "What's the high-level architecture / module map?" | `graph { mode: "map" }` |91| "What's the shape of file F?" | `code { mode: "outline", path: F, l2?: true }` |92| "What calls X?" (any name) | `code { mode: "references", name: X }` |93| "What calls this specific definition?" | `code { mode: "callers", path: F, name: X }` |94| "Trace the call graph from a function?" | `graph { mode: "calls", name: X }` |95| "What implements / extends / inherits from X?" | `code { mode: "implementations", trait_name: X }` |96| "What imports module M?" | `code { mode: "dependents", module: M }` |97| "What files are indexed?" | `code { mode: "files" }` |98| "What changed recently?" | `git` modes `recent`, `touching`, or `by_path` |99| "When did symbol X last change?" | `git { mode: "symbol_history", path: F, name: X }` |100| "Who wrote this line / symbol?" | `git` mode `blame` or `blame_symbol` |101| "Where's the churn?" | `git { mode: "churn" }` |102| "What's dirty in the working tree?" | `git { mode: "status" }` |103| "What's HEAD / branch?" | `admin { mode: "repo" }` |104| "Show diff between revs for file F" | `git` mode `diff` or `diff_outline` |105| "What's indexed?" | `admin { mode: "status" }` |106| "Semantic search over PDFs / Office docs?" | `memory { mode: "documents", query }` |107| "Recall something the agent stored earlier?" | `memory` mode `get`, `list`, or `search` |108| "Remember this for future sessions?" | `memory { mode: "put", key, value }` |109| "Refresh the index after editing code?" | `admin { mode: "rescan", paths?: […] }` |110| "Fetch next page of results?" | Pass `next_cursor` from prior response as `cursor` |111| "Pull this URL into RAG?" | `web { mode: "scrape", url }` — single page, robots-aware |112| "Ingest a docs site section?" | `web { mode: "crawl", url }` — link-following from a seed |113| "What URLs exist on this site?" | `web { mode: "map", url }` — discovery without bodies |114| "How much has basemind helped today?" | `admin { mode: "telemetry", window: "today" }` |115116## Setup (one-time per repo)117118basemind needs an index before it can answer queries. The index lives in a machine-global cache119(Linux `~/.local/share/basemind/`, macOS `~/Library/Application Support/basemind/`; override120`BASEMIND_DATA_HOME`), keyed by workspace — never inside your repo. From the repo root:121122```sh123basemind scan124```125126This walks the tree, parses with tree-sitter, and writes a content-addressed blob127store + Fjall inverted index into the machine-global cache. A few seconds for small repos,128~22 s for an ~80k-file TypeScript monorepo.129130The MCP server is launched by the host (`basemind serve` — wired up in131`.claude-plugin/plugin.json` for you). You do not start it manually.132133Re-run `basemind scan` after large changes, or run `basemind watch` to keep the index fresh on file save.134135If a tool returns "no indexed files", that means `basemind scan` hasn't been run in this repo yet.136137## Examples138139### Locating a symbol140141```text142code { mode: "symbols", name: "MapCache" }143→ src/mcp/mod.rs:79:1 MapCache (struct)144 src/mcp/mod.rs:88:1 MapCache (impl)145```146147Now you know exactly where to read.148149### Following references150151```text152code { mode: "references", name: "process_file" }153→ src/scanner.rs:142:9 process_file154 src/scanner.rs:201:13 process_file155 ...156```157158No need to grep — the index already knows.159160### Outline a file before reading161162```text163code { mode: "outline", path: "src/mcp/tools.rs" }164→ 21 code router (function)165 112 code helper (function)166 ...167```168169A 1000-line file becomes a 30-line table of contents.170171## Notes172173- All paths are repository-relative with forward-slash separators.174- Lists are capped (`limit`, default 100, max 1000). Index scanners use175 `scan_cap = limit * 8` to bound work on common names.176- Matching is substring on names — `code` mode `references` with `name: "bar"` matches177 `Foo::bar()` and `bar()` alike. There is no scope resolution; cross-check with mode `outline` if178 disambiguation matters.179- Git tools require `basemind serve` to be running inside a git repository. Outside a git repo they return a clear error.180- `memory` modes require basemind to be built with181 `--features full` (or the individual `documents` / `memory` flags). Without them the182 tools dispatch but return an MCP error.183 Memory is scoped by the normalised `origin` remote URL (`git@github.com:Foo/bar.git` and184 `https://github.com/Foo/bar/` collapse to the same scope key) — clones of the same repo185 share memory; unrelated repos do not see each other's entries.186- `web` modes `scrape`, `crawl`, and `map` require `--features crawl`.187 When that feature is off they are NOT registered on the server at all — agents will simply188 not see them in the tool list. Crawled pages land in the `documents` LanceDB table tagged189 with scope `web:<host>`; `memory` mode `documents` finds them alongside every other ingested190 document. It searches across ALL documents and has **no `scope` parameter** — you cannot191 filter results to a single host at query time.192 robots.txt is honoured by default; only `[crawl].respect_robots_txt = false` in193 the repo-root `basemind.toml` (config-file-only) disables it.