Code Intelligence
basemind pre-indexes your codebase using tree-sitter, mapping symbols, calls, and imports across 300+ languages. Structural queries resolve in milliseconds and return paths, line numbers, and signatures — not file bodies — so they cost a fraction of the tokens of reading source.
Precise, scope- and import-aware resolution
Section titled “Precise, scope- and import-aware resolution”Navigation is scope- and import-aware for JavaScript/TypeScript (via oxc) and for
Python and Java — via an in-tree, tree-sitter-0.26 fork of GitHub’s stack-graphs engines
(vendored under crates/) executing .tsg name-binding rules, with no per-language LSP
server. Every other language still gets fast tree-sitter scope binding.
This resolves each use to the definition it actually binds to: a shadowed local isn’t
confused with an import, and code definition lands on the right target — including across
files, for Python dotted/relative imports and for JS/TS module resolution (Node resolution
plus tsconfig paths aliases via oxc_resolver).
Known limitation this release: Java cross-file resolution of a member call on an imported
type (Foo.greet()) is not yet resolved — the imported type itself resolves, the method call
on it does not.
Toggle with [code_intel] precise_resolution in basemind.toml (default true). Set it to
false to fall back to tree-sitter locals binding for every language.
Core tools
Section titled “Core tools”All of the following are modes of the code MCP tool (basemind code <mode> on the CLI).
code outline
Section titled “code outline”Get a file’s complete structure: symbols, signatures, line numbers, and doc comments. Add
l2: true to include call sites and embedded documentation.
{ "path": "src/scanner.rs", "l2": true}Returns a table of contents you can scan in seconds instead of reading a thousand-line file. Once you have the exact span, read only that range.
code symbols
Section titled “code symbols”Find symbols by substring across all indexed files. Optionally filter by kind
(function, class, type, etc.).
{ "needle": "process_file", "kind": "function"}Returns path:line:column and signature for each match. No scope resolution — a substring
match is exact.
code references
Section titled “code references”Find all call sites of any callee whose identifier matches name. No scope resolution
— Foo::bar() and bar() both match name="bar".
{ "name": "spawn", "limit": 50}Backed by an indexed call-site table, returns tens of thousands of hits capped by limit
(default 100, max 1000).
code callers
Section titled “code callers”Find callers of a specific definition (path + name + optional kind). First resolves the definition, then returns all callers of that exact symbol.
{ "path": "src/scanner.rs", "name": "process_file", "kind": "function"}Combines definition resolution with the same name-based scan as code references, so
results are disambiguated by location.
code definition
Section titled “code definition”Resolve a path:line:column reference to its actual definition. Intra-file resolution
via tree-sitter locals across 80+ languages; JavaScript/TypeScript, Python, and Java
additionally get precise, scope- and import-aware resolution — including cross-file — via
oxc (JS/TS) or the in-tree stack-graphs engine (Python/Java). See
Precise, scope- and import-aware resolution
above.
{ "path": "src/main.rs", "line": 42, "column": 10}graph calls
Section titled “graph calls”A mode of the graph MCP tool (basemind graph calls on the CLI), not code — it walks
the same indexed call edges but returns a chain, not a flat hit list.
Walk the call chain up or down from a function, bounded by max_depth and max_nodes.
BFS traversal over the indexed call edges.
{ "name": "query_symbol", "direction": "down", "max_depth": 3}graph map
Section titled “graph map”Also a mode of the graph MCP tool (basemind graph map on the CLI).
A deterministic, whole-repo overview built from the real call graph — no LLM. Ranks hub
modules, files, or symbols by centrality (fixed-iteration PageRank + fan-in/out) blended with
git churn, and surfaces circular-dependency clusters (strongly-connected components). Pick the
altitude with granularity (module default → file → symbol); pass a focus path-prefix
to scope the map to a subtree. Returns nodes (paths, lines, signatures, scores) and edges — never
prose.
{ "granularity": "module", "focus": "src/mcp", "include_churn": true}code implementations
Section titled “code implementations”Types that implement or inherit from a given name. Rust impl blocks, Python class
inheritance, TypeScript/JavaScript class declarations.
{ "name": "Iterator"}code grep
Section titled “code grep”Pattern search (regex) over file contents, backed by the in-RAM index. Returns capped, structured hits with path, line, and matching text.
{ "pattern": "TODO:.*urgent", "language": "rust", "path_contains": "src"}Faster than shelling out to ripgrep when you already have the index in memory.
Supporting tools
Section titled “Supporting tools”code expand
Section titled “code expand”Fetch a symbol’s raw source body (the inverse of an outline entry). Use this after an
outline tells you the exact function to fetch.
{ "path": "src/scanner.rs", "name": "process_file"}code files
Section titled “code files”Enumerate all indexed files. Filter by language or path_contains.
{ "language": "rust", "path_contains": "src/extract"}code dependents
Section titled “code dependents”What imports or references a given module. Heuristic reverse-lookup via import statements.
{ "module": "src/store"}admin status / admin repo
Section titled “admin status / admin repo”Overview of the indexed repo: file count by language, current branch, HEAD commit, origin URL, on-disk cache size, and index build time.
Discipline
Section titled “Discipline”code outlinea file before you open it. A 1000-line file becomes a 30-line table of contents. Then read only the exact span you need.code symbolsinstead of grep for a definition. Returns indexed symbol names and positions, skipping comment/string noise.code references/code callersinstead of grepping call sites. Indexed call edges, not text matches.code grepinstead of shelling out to ripgrep when you genuinely need regex — it runs over the in-RAM index and returns capped, structured results.- Do not re-read a file basemind already mapped. If the outline answered the question, stop.
admin rescanafter you edit code, not a server reconnect. Passpaths: [...]to limit it.