You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shared code-intelligence index per repo, injected into every thread #377
From the code-intelligence research (Sourcegraph CodeScaleBench, 1,281 agent runs): agents overwhelmingly prefer the simplest tool (7,993 keyword searches vs 57 deep-search calls across 602 MCP runs) — powerful tools are NOT invoked organically; the harness must steer. Indexed agents were 30% cheaper and 38% faster, and ~400K LOC is the crossover below which indexing adds overhead.
Maintain one local-first symbol index per repo (CodeGraph pattern: tree-sitter into SQLite, file-watcher incremental), shared across all worktrees instead of each thread re-deriving context via grep. Inject it into every thread with explicit when-to-use-which-tool instructions, gated on repo size. Extends #274 (repo-map) and feeds #249 (blast radius via find-references).
Contract landed on main (electron/codeindex.js, commit 051535d): JSON index per repo keyed on the project's main checkout, line-based symbol extraction, incremental refresh off the dispatch path.
Two grok workers forked against it:
A — implements the indexer (scan/extract/rank/persist/incremental) + tests.
B — services.codeIndexNoteFor + runner dispatch wiring + tests: the injected code map with explicit when-to-use-which-tool steering.
Deliberate deviations from the issue text, to be revisited if they bite:
Line-based extractor, not tree-sitter — the app ships zero native deps today; tree-sitter bindings would be a packaging/signing cost for a map that only needs top-level definition names.
Debounced refresh from the dispatch path, not a file watcher — staleness ceiling is one refresh interval.
No new MCP tool — the research finding (7,993 keyword searches vs 57 deep-search calls) says a tool nobody invokes is worthless; the steering lives in the injected note.
Repo-size gate is the note's char cap, not an LOC threshold: a 400K-LOC repo yields the same ~3.5KB note as a small one, and repos under 20 indexed files get no note at all.
Both workers landed and are merged into coder/shared-code-intelligence-index-per-repo--73cf1e.
Measured on this repo (398 indexed source files, 1,680 symbols, 134K LOC): full build 170ms, incremental refresh 40ms, readIndex on the dispatch path 1ms, index file 69KB, injected note 3.4KB.
Tests: 1076 pass / 1 fail — the fail is the pre-existing web-integration reconnect flake that is baseline on main.
Two defects found in review and fixed on top:
churn rank was systematically wrong — git log --format=%h --name-only puts a hash and a blank line before each file list, and the parser's off-by-one read the first file of every commit as a hash, so alphabetically-first paths never scored. Empty --format= makes every non-blank line a path. Regression test added.
symbol-less files ate the note budget — test fixtures and config files were listed with no symbols after them, which tells an agent nothing.
Still open, deliberately: the map is orientation-only (no find-references query surface), it maps the main checkout so branch-new files are missing, and refresh is debounced off the dispatch path rather than watched.
Activity
Code index: contract for the shared per-repo symbol index (#377)
currentbits commentedon Aug 17, 2026
Contract landed on main (
electron/codeindex.js, commit 051535d): JSON index per repo keyed on the project's main checkout, line-based symbol extraction, incremental refresh off the dispatch path.Two grok workers forked against it:
services.codeIndexNoteFor+ runner dispatch wiring + tests: the injected code map with explicit when-to-use-which-tool steering.Deliberate deviations from the issue text, to be revisited if they bite:
node:sqlitewhen find-references (Conflict forecast: predict merge conflicts between parallel worktrees before they happen #249 blast radius) actually needs per-symbol queries.currentbits commentedon Aug 17, 2026
Both workers landed and are merged into
coder/shared-code-intelligence-index-per-repo--73cf1e.Measured on this repo (398 indexed source files, 1,680 symbols, 134K LOC): full build 170ms, incremental refresh 40ms,
readIndexon the dispatch path 1ms, index file 69KB, injected note 3.4KB.Tests: 1076 pass / 1 fail — the fail is the pre-existing web-integration reconnect flake that is baseline on main.
Two defects found in review and fixed on top:
git log --format=%h --name-onlyputs a hash and a blank line before each file list, and the parser's off-by-one read the first file of every commit as a hash, so alphabetically-first paths never scored. Empty--format=makes every non-blank line a path. Regression test added.Still open, deliberately: the map is orientation-only (no find-references query surface), it maps the main checkout so branch-new files are missing, and refresh is debounced off the dispatch path rather than watched.