codesearch
CLAUDE.md88 starsChanged 4 months agoApache-2.0View on GitHub
Before answering, planning, or running any tool: open and read AGENTS.md at the repo root. It contains the authoritative project goal, architecture, runtime layout (where codesearch.exe and helpers/csharp/scip-csharp.exe actually live), log locations, publish recipe, and current status. This file (.claude/CLAUDE.md) is supplemental — AGENTS.md is the source of truth. Add symbol-aware reference lookups to codesearch via find_impact MCP tool. Returns file/line-precise references so agents can plan refactors with IDE-level accuracy. MVP is C# only; architecture is language-agnostic through per-language SymbolIndexer…
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Add symbol-aware reference lookups to codesearch via find_impact MCP tool.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — codesearch (features/symbol-references)
‼️ IMPORTANT — READ AGENTS.md FIRST, BEFORE STARTING ANY WORK ‼️
Before answering, planning, or running any tool: open and read AGENTS.md at the repo root. It contains the authoritative project goal, architecture, runtime layout (where codesearch.exe and helpers/csharp/scip-csharp.exe actually live), log locations, publish recipe, and current status. This file (.claude/CLAUDE.md) is supplemental — AGENTS.md is the source of truth.
Goal
Add symbol-aware reference lookups to codesearch via find_impact MCP tool. Returns file/line-precise references so agents can plan refactors with IDE-level accuracy. MVP is C# only; architecture is language-agnostic through per-language SymbolIndexer adapters.
Implemented Features
find_impactMCP tool — returns transitive call-sites for a symbol (name-based or position-based), C# viascip-csharphelperscip-csharphelper — .NET 10 CLI wrapping RoslynSymbolFinder.FindReferencesAsync(), runs as subprocess- O(1) position lookup —
scip_positionsLMDB table maps(file:line)→[symbol_keys] - O(1) fuzzy lookup —
scip_simple_namesLMDB table maps last-segment identifier →[full_keys] - Bincode schema versioning — version byte prefix on all LMDB payloads, clear error on mismatch
- JSON version validation — rejects scip-csharp index versions other than
"1.0" - Helper failure cache —
detect_helper()caches both found and not-found results (Mutex<Option<Option<PathBuf>>>) - Shared
SymbolIndexerRegistry—ServeState,CodesearchService, andIndexManagereach own oneArc<Registry>; no per-request instantiation .cswatcher debounce — 60s quiet period triggers automatic symbol rebuild-with-csharprelease variants — 6 release archives (3 plain + 3 with helper)- Gated integration test —
csharp_helper_integrationcargo feature for full-pipeline testing - CI — separate
csharp-integration-testsjob in.github/workflows/ci.yml - Stale-path resilience + derived alias — moved/renamed indexed folders no longer crash serve:
git_remotecaptured at registration,reconcile_all_paths()best-effort relocates by matchingremote.origin.url(bounded depth,CODESEARCH_RELOCATE_MAX_DEPTH, default 3) else warn+skip;codesearch index prunefor manual cleanup. The--aliasflag was removed (alias always = directory name).ReposConfig::reconcile()hardens hand-editedrepos.jsonon load. See AGENTS.md for details.
Architecture
Per-language adapter pattern
src/symbols/ hosts the adapter layer:
mod.rs—SymbolIndexertrait +SymbolIndexerRegistrydispatchcsharp.rs— C# adapter (rebuild, find_references, find_references_by_position)scip_parse.rs— JSON parser for scip-csharp output
LMDB tables
| Table | Key | Value |
scip_symbols | full SCIP key | [v1, bincode(Vec<StoredReference>)] |
scip_positions | <file>:<line> (forward-slash) | [v1, bincode(Vec<String>)] |
scip_simple_names | last segment of canonical symbol | [v1, bincode(Vec<String>)] |
scip_meta | last_rebuild_ts, symbol_count | Str |
MCP tool: find_impact
Inputs:
{ "symbol_name": "FieldDefinition.Validate", "project": "alias" }{ "file": "src/X.cs", "line": 42, "project": "alias" }
Returns references with file, start_line, end_line, kind + index_age_seconds.
Helper detection lookup order
CODESEARCH_SCIP_CSHARPenv var<codesearch-exe-dir>/helpers/csharp/scip-csharp[.exe]$PATH
Missing helper disables find_impact for C# only — all other features keep working.
SymbolIndexerRegistry ownership
Exactly 4 Arc::new(SymbolIndexerRegistry::new()) sites:
IndexManager::new()(watcher path)IndexManager::new_for_path()(direct path)ServeState::new()(serve HTTP path)CodesearchService::new_with_stores()(standalone MCP/stdio path)
CodesearchService::new_for_serve() clones from ServeState.
Remaining post-merge work
- CI green on GitHub Actions for
csharp-integration-testsjob (first run after push) REVIEW_features-symbol-references.mdclosing section "Fixes applied" with commit SHAs- Manual end-test on real client repo: 2nd/3rd
find_impactcall < 100ms - 49 minors from review — separate in next iteration
- Follow-up majors: rebuild scope, sequential text+symbol rebuild, git rev-parse subprocess, per-repo mutex for parallel rebuilds
- LMDB
map_size— fixed: SCIP LMDB raised from 64 MB → 512 MB (virtual); env-var overrideCODESEARCH_SCIP_LMDB_MAP_MB
CI / Release
Release output: 6 archives (3 plain + 3 -with-csharp). Each -with-csharp job installs .NET 10, publishes helpers/csharp, stages helper alongside binary.
Quality gates: cargo check, cargo clippy, cargo test --lib --bins, dotnet test helpers/csharp/, CI green.
Tooling rules (IMPORTANT)
- Use codesearch MCP tools first for discovery on this repo. The MCP server is verified working and this repo is indexed (alias
codesearch-git) —search/find/exploreare the default for "where/what/how" questions, per the global codesearch-first rule. - Never use the bundled
codesearchCLI/exe to investigate this repo. It's the project under development and may be broken/locked; debugging it with its own shell binary is unreliable. MCP server tools only. grep/Glob/Readremain correct for: inspecting a specific git ref or fetched PR head (e.g.git show FETCH_HEAD:path— codesearch only indexes the on-disk working tree, not arbitrary refs), exact literal/regex matching, and any case where codesearch returns nothing useful.
Notes
- Rust + C# codebase;
cargoanddotnetdo not interfere scip-csharpis stateless, runs once per indexing request- Roslyn may yield partial output on compilation failures — acceptable
- Symbol resolution: exact match first, then fuzzy via
scip_simple_names - Position lookup matches
start_lineonly (not[start_line, end_line]range) copy-to-common.ps1builds helper viadotnet publishand copies to~/.local/bin/helpers/csharp/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

