index
Skill7 starsChanged 9 months agoMITView on GitHub
Build or refresh the codemunch symbol index for the current project. Walks every source file, extracts all symbols (functions, classes, methods, constants, types) with their exact file location and line range, and writes a fast-lookup index to .claude/codemunch/index.json. Uses LSP when available, falls back to ctags, then ripgrep patterns.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- criptogus/brainstacktheir own version, first seen Aug 6, 2026
- codeboehm/maximtheir own version, first seen Jul 5, 2026
- BostonOrange/claude-code-frameworktheir own version, first seen Jun 4, 2026
- sp-daewoon/chronicletheir own version, first seen Jun 3, 2026
- openai/pluginstheir own version, first seen May 13, 2026
- thoreinstein/obsidian-ragtheir own version, first seen Apr 11, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- openai/plugins★ 7.3ksame name
- criptogus/brainstack★ 4same name
- sp-daewoon/chronicle★ 4same name
- BostonOrange/claude-code-framework★ 2same name
- thoreinstein/obsidian-rag★ 2same name
- AnitChaudhry/10x-development-team★ 0same name
- chanhyeok-made/ccx★ 0same name
- codeboehm/maxim★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ctagsSkill
- detect-lspSkill
- fetchSkill
- lspSkill
- rg-fallbackSkill
- searchSkill
- staleness-gateSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 5 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Use Claude Code's built-in LSP tool (/lsp) to call textDocument/documentSymbol for each file.
- Distinctive: line 67
When LSP is unavailable for a language:
- Distinctive: line 103
When neither LSP nor ctags is available.
- Distinctive: line 211
When called with a list of changed files (from the staleness-gate skill), only re-index those files:
- Very specific: line 213
Remove all symbols where symbol.file is in the changed file list
- Distinctive: line 214
Run the engine pipeline (LSP → ctags → rg) on only the changed files
- Very specific: line 216
Update file_hashes for the changed files
- Very specific: line 217
Remove entries from file_hashes for deleted files
- Very specific: line 218
Update generated timestamp and stats
- Distinctive: line 222
If more than 50 files have changed, fall back to a full re-index — it's faster than incremental at that scale.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Index Skill
Build the symbol index. Run once before using fetch or search, and re-run when code changes significantly.
Pre-flight
# Check config exists
cat .claude/codemunch/config.json 2>/dev/null || echo "NOT_CONFIGURED"
# If missing, run detect-lsp skill first
# Create index directory
mkdir -p .claude/codemunch
# Add to gitignore
grep -q ".claude/codemunch" .gitignore 2>/dev/null || echo ".claude/codemunch" >> .gitignoreEngine A — LSP Indexing (primary, when available)
LSP doesn't have a batch "index all files" API, but we can use it for on-demand precise symbol lookup. For the index build, use textDocument/documentSymbol on each file.
For each source file in the project:
# Get list of source files (respects .gitignore)
rg --files --type [lang] 2>/dev/null || \
find . -name "*.[ext]" \
-not -path "*/node_modules/*" \
-not -path "*/.git/*" \
-not -path "*/target/*" \
-not -path "*/__pycache__/*" \
-not -path "*/.claude/codemunch/*"Use Claude Code's built-in LSP tool (/lsp) to call textDocument/documentSymbol for each file. This returns all symbols with:
- Name
- Kind (function, class, method, variable, constant, etc.)
- Range (start line, end line)
- Detail (type signature for typed languages)
Filter noise kinds: Skip noise kinds: constant, property, variable, enumerator. These inflate the index 15x without adding useful navigation value. Only keep symbols where kind is one of: function, method, class, interface, type, enum, namespace.
Store each kept symbol as:
{
"name": "validateToken",
"kind": "function",
"file": "src/auth/tokens.ts",
"start_line": 142,
"end_line": 163,
"signature": "validateToken(token: string): Promise<User | null>",
"container": "AuthService"
}Engine B — ctags Indexing (fallback)
When LSP is unavailable for a language:
# Universal ctags — generates precise symbol table
universal-ctags \
--recurse \
--output-format=json \
--fields=+n+e+K+S \
--extras=+q \
--exclude=node_modules \
--exclude=.git \
--exclude=target \
--exclude=__pycache__ \
--exclude=.claude/codemunch \
--languages=[detected_languages] \
-f .claude/codemunch/ctags.json \
. 2>/dev/null
# Parse ctags output into codemunch index format
# ctags JSON fields: name, path, pattern, kind, line, end, signature
# Filter: skip noise kinds (constant, property, variable, enumerator)
# Only keep: function, method, class, interface, type, enum, namespacectags supports 40+ languages natively: ActionScript, Ada, Ant, Bash, C, C++, C#, Clojure, CoffeeScript, D, Elixir, Erlang, Fortran, Go, Groovy, Haskell, HTML, Java, JavaScript, JSON, Julia, Kotlin, Lisp, Lua, Make, Matlab, ObjectiveC, OCaml, Perl, PHP, PowerShell, Python, R, Rake, Ruby, Rust, Scala, Scheme, Shell, SQL, Swift, Tcl, TypeScript, Verilog, VHDL, Vim, YAML, Zig
# Verify ctags found symbols
wc -l .claude/codemunch/ctags.jsonEngine C — Ripgrep Pattern Indexing (last resort)
When neither LSP nor ctags is available. Uses language-aware regex patterns to find symbol declarations:
# TypeScript/JavaScript
rg --json "^(export\s+)?(async\s+)?function\s+(\w+)|^(export\s+)?(abstract\s+)?class\s+(\w+)|^\s+(async\s+)?(\w+)\s*\([^)]*\)\s*[:{]" \
--type ts --type js \
--glob "!node_modules" \
--glob "!.git" \
> .claude/codemunch/rg-ts.jsonl
# Python
rg --json "^(async\s+)?def\s+(\w+)|^class\s+(\w+)" \
--type py \
> .claude/codemunch/rg-py.jsonl
# Go
rg --json "^func\s+(\(.*?\)\s+)?(\w+)|^type\s+(\w+)\s+(struct|interface)" \
--type go \
> .claude/codemunch/rg-go.jsonl
# Rust
rg --json "^(pub(\(.*?\))?\s+)?(async\s+)?fn\s+(\w+)|^(pub(\(.*?\))?\s+)?(struct|enum|trait|impl)\s+(\w+)" \
--type rust \
> .claude/codemunch/rg-rs.jsonl
# Ruby
rg --json "^\s*(def\s+(\w+)|class\s+(\w+)|module\s+(\w+))" \
--type ruby \
> .claude/codemunch/rg-rb.jsonl
# Java/Kotlin
rg --json "(public|private|protected|internal)?\s*(static\s+)?\w+\s+(\w+)\s*\(" \
--type java --type kotlin \
> .claude/codemunch/rg-jvm.jsonl
# C/C++
rg --json "^\w[\w\s\*]+\s+(\w+)\s*\([^;]*\)\s*\{|^(class|struct|enum)\s+(\w+)" \
--type c --type cpp \
> .claude/codemunch/rg-c.jsonl
# PHP
rg --json "^(public|private|protected)?\s*(static\s+)?function\s+(\w+)|^class\s+(\w+)" \
--type php \
> .claude/codemunch/rg-php.jsonlFilter noise kinds: Skip noise kinds: constant, property, variable, enumerator. These inflate the index 15x without adding useful navigation value. The rg patterns should only match function/class/interface/type declarations, not const/let/var assignments unless they are arrow functions. Only keep: function, method, class, interface, type, enum, namespace.
Parse the ripgrep JSONL output to extract symbol name, file, and line number. End line is estimated as start + average function length (20 lines) — this is the only imprecise step. LSP and ctags give exact end lines.
Step: Build unified index
Merge results from whichever engines ran into a single .claude/codemunch/index.json:
{
"version": "2.0",
"generated": "2026-03-11T02:14:00Z",
"engine": "lsp|ctags|rg",
"project_root": "/path/to/project",
"stats": {
"total_symbols": 1247,
"files_indexed": 89,
"languages": ["typescript", "python", "go"]
},
"file_hashes": {
"src/auth/tokens.ts": "a3f2b1c",
"src/lib/validation.ts": "e7d4f9a",
"convex/expenses.ts": "b1c3d5e"
},
"symbols": [
{
"name": "validateToken",
"kind": "function",
"file": "src/auth/tokens.ts",
"start_line": 142,
"end_line": 163,
"signature": "validateToken(token: string): Promise<User | null>",
"container": "AuthService",
"engine": "lsp"
}
]
}The file_hashes field maps each indexed file to its git blob hash (git hash-object <file>). This enables incremental re-indexing — only files whose hash changed need to be re-processed.
# Generate file hashes for all indexed files
for file in $(rg --files --type [lang]); do
echo "\"$file\": \"$(git hash-object "$file" 2>/dev/null || md5 -q "$file")\""
doneAlso build a fast name-lookup dictionary:
{
"validateToken": [0],
"AuthService": [1, 5, 23],
"getUserById": [2]
}(values are indexes into the symbols array)
Incremental mode
When called with a list of changed files (from the staleness-gate skill), only re-index those files:
- Remove all symbols where
symbol.fileis in the changed file list - Run the engine pipeline (LSP → ctags → rg) on only the changed files
- Append new symbols to the existing index
- Update
file_hashesfor the changed files - Remove entries from
file_hashesfor deleted files - Update
generatedtimestamp andstats
This is much faster than a full re-index for typical edits (1-5 files changed).
If more than 50 files have changed, fall back to a full re-index — it's faster than incremental at that scale.
Report
✅ codemunch index built
Files indexed: 89
Symbols found: 1,247
Engine used: LSP (TypeScript), ctags (Python, Go), rg (Bash)
Index size: 142 KB
Index written to: .claude/codemunch/index.json
Top files by symbol count:
src/api/invoices.ts — 34 symbols
src/lib/auth.ts — 28 symbols
convex/schema.ts — 19 symbols
Run /codemunch:find <name> to look up any symbol.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.

