Token economy
basemind saves tokens by answering with file paths, line numbers, and signatures — not whole files. A question about your code costs a small fraction of the tokens it takes to read the source.
Why pointers beat file reads
Section titled “Why pointers beat file reads”When you ask “where is the User class defined?”, basemind returns:
src/models/user.ts:42Reading the entire user.ts file would cost 200–2000 tokens, depending on size. The answer costs
just a few tokens.
When you ask “what calls processFile?”, basemind returns 10 call sites with their paths and
line numbers — enough for an agent to decide whether to open each one. Re-reading the whole
calling files would explode your context.
The same discipline applies to every tool: outline gives you a file’s structure (signatures,
imports) before you open it, so you read only the span you need. find_references returns
pointers, not source. recent_changes shows what happened (commits + file list), not diffs.
See How it works to understand how basemind builds the map that makes this possible.
Good habits the plugin sets up
Section titled “Good habits the plugin sets up”The plugin nudges agents toward the cheap path by default:
- Get a file’s outline before opening it — then read only the part you need.
- Search for a definition instead of grepping for it —
search_symbolsvsgrep. - Look up who calls a function instead of grepping for call sites —
find_referencesvsgrep. - Refresh the index after edits —
rescaninstead of restarting the server. - Don’t re-read a file basemind already mapped — use the outline instead.
Optional guardrails
Section titled “Optional guardrails”Three environment variables enforce token discipline at the moment a tool is used:
Guard: redirect wasteful searches
Section titled “Guard: redirect wasteful searches”BASEMIND_GUARD=off # disable (default: on)BASEMIND_GUARD=redirect # block instead of nudgeWhen an agent reaches for a built-in Grep/Glob-style search, Guard gently redirects it to
the matching basemind tool (workspace_grep for patterns, search_symbols for names,
find_references for call sites). Set redirect to block the command instead of nudging.
Output compressor: shrink large results
Section titled “Output compressor: shrink large results”BASEMIND_COMPRESS_OUTPUT=1When a tool returns a long result (e.g., 100 matching files), the compressor shrinks the output by keeping only the essential shape — file paths, signatures, keywords — and dropping verbose details. It never touches anything that looks like a credential and leaves output alone if it can’t help.
Re-read shortcut: show only what changed
Section titled “Re-read shortcut: show only what changed”BASEMIND_DELTA_READS=1When an agent re-reads a file it already read earlier in the session, BASEMIND_DELTA_READS shows
just the changed lines instead of resending the whole file.
Compression that understands code
Section titled “Compression that understands code”basemind shrinks code by keeping the shape and dropping the bodies — function signatures and imports stay, implementations go — because a signature is useless without its shape:
// Original (2,400 tokens)pub fn process_file(path: &str) -> Result<Vec<Symbol>> { let file = std::fs::read_to_string(path)?; let mut tokens = vec![]; let mut depth = 0; // 100 lines of parsing logic... Ok(tokens)}
// Compressed (240 tokens)pub fn process_file(path: &str) -> Result<Vec<Symbol>>;For prose, compression does a light cleanup: extra whitespace, filler paragraphs, repeated content. It reports honest before/after token counts, and the code version is exact — nothing is lost, just set aside.
The expand tool brings any one symbol’s full body back when an agent actually needs it:
compress to an outline, expand only what you read.