repo-map
Skill153 starsChanged 7 months agoMITView on GitHub
Ranked symbol map of a codebase within a token budget — a compact "what matters in this repo" before reading files. Use when starting work in an unfamiliar/large codebase, before a refactor or deep-review fan-out, when you need JIT context instead of dumping whole files, or asked "give me a map of this repo / where are the important functions / what's the structure". Zero-dependency (stdlib only); Aider-inspired regex extraction and PageRank ranking, not a tree-sitter parser. Do NOT use to find correctness/security defects in a change or to audit a diff; use deep-review for that (this only ranks and lists symbols, it does not evaluate code quality).
5 other projects use a version of this.
Adopted by
Most recently taken up by
- hanzhangzzz/agent-skills-zhtheir own version, first seen Oct 4, 2026
- ejboy/agent-scriptstheir own version, first seen Oct 2, 2026
- Tcuzzo/backs-aios-skillstheir own version, first seen Sep 14, 2026
- Filip-Podstavec/claude-leveragetheir own version, first seen Aug 3, 2026
- yeaight7/agent-powerupstheir own version, first seen Jul 27, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- ejboy/agent-scripts★ 147same name
- Filip-Podstavec/claude-leverage★ 68same name
- yeaight7/agent-powerups★ 6same name
- hanzhangzzz/agent-skills-zh★ 2same name
- Tcuzzo/backs-aios-skills★ 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 repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-harness-designSkill
- agents-best-practicesSkill
- diffusion-engineeringSkill
- flux2-klein-promptingSkill
- flux2-lora-trainingSkill
- forensic-prompt-compilerSkill
- ml-research-labSkill
- notebooklm-grounded-researchSkill
- vlm-segmentationSkill
- feature-newSkill
- harness-designSkill
- layer-newSkill
- plan-swarm-reviewSkill
- pixel-art-storyboardSkill
- pixel-art-studioSkill
- architecture-firstSkill
- architecture-qualitySkill
- bug-reproducerSkill
- code-complexitySkill
- control-cliSkill
- control-uiSkill
- deep-reviewSkill
- deslopSkill
- distill-feedbackSkill
- harness-feedbackSkill
- proof-verifySkill
- refactoring-safelySkill
- system-and-data-designSkill
- testing-strategySkill
- thermo-nuclear-code-quality-reviewSkill
- verify-thisSkill
- workflow-orchestrationSkill
- frontend-designSkill
- motion-framerSkill
- ui-designSkill
- ui-ux-pro-maxSkill
- ios-developmentSkill
- lean-codeSkill
- cross-harness-continuationSkill
- deepseek-provider-contractSkill
- desktop-sessions-discoverySkill
- epistemic-challengeSkill
- gemini-delegateSkill
- harness-auditSkill
- observability-monitoringSkill
- remote-compute-opsSkill
- plan-to-ticketsSkill
- product-meaning-extractorSkill
- remotion-production-guideSkill
- script-evaluatorSkill
- video-narrative-arcSkill
- video-post-productionSkill
- article-structure-reviewSkill
- cavemanSkill
- humanize-englishSkill
- humanize-russianSkill
- owner-voiceSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 63
Run PageRank over the file graph → structurally-central files float up (shared utilities, core models, base classes).
- Distinctive: line 84
If your build output lives somewhere unusual, it may get scanned — point ROOT at the source dir instead.
“Common” is measured: kept by at least 6 in 10 of the 4 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
repo-map
Produces a ranked list of the structurally-important symbol definitions in a codebase, capped to a token budget. The point: instead of dumping whole files (wasteful, blows the context window), get a cheap "skeleton" of the repo — the functions/classes everything else depends on — and read full files only where it matters.
This is our zero-dependency port of Aider's repo-map.
When to use
- Onboarding to an unfamiliar or large codebase — get the lay of the land first.
- Before a refactor /
deep-review/workflow-orchestrationfan-out — feed each subagent the map so it knows the important entry points without re-scanning. - JIT context (principle 07 /
practice_context_engineering) — load the map, not the files. - Anytime the instinct is "let me read 20 files to understand this" → run this first.
Usage
python scripts/repo_map.py [ROOT] [--budget-tokens N] [--top N] [--json] [--no-signature] [--max-files N]ROOT— repo root (default: cwd). If it's a git repo, only tracked files are scanned (honors.gitignore); otherwise a filtered directory walk is used.--budget-tokens(default 1024) — stop emitting once ~this many tokens are used (≈4 chars/token heuristic). Use 256–512 for a quick orientation, 2048+ for depth.--top N— hard cap on symbols before the budget applies.--json— machine-readable output (for piping into a workflow / another agent).--no-signature— emitpath:line: nameinstead of the full signature line.
JSON distinguishes symbols_extracted_total (before --top),
symbols_ranked_after_top (after that cap), and symbols_emitted (after the
token budget). The legacy symbols_total key retains its post---top meaning
for compatibility. None is a semantic coverage guarantee: extraction is regex-based
and --max-files can limit input. Never diagnose parser coverage from a capped map.
Typical recipes
# Quick orientation in a new repo
python scripts/repo_map.py . --budget-tokens 512
# Feed a fan-out: JSON map of the most important 40 symbols
python scripts/repo_map.py /path/to/repo --top 40 --json > repo_map.json
# Focus a subdirectory (a single layer/service)
python scripts/repo_map.py /path/to/repo/services/auth --budget-tokens 800How ranking works
- Extract definitions (functions/classes/types) and identifier references per file via per-language regexes (py/js/ts/tsx/go/rust/java/ruby/c/cpp/csharp/php/kotlin/swift).
- Build a directed graph: edge
F → Dwhen fileFreferences an identifier defined in fileD. Rare identifiers (defined in few files) weigh more. - Run PageRank over the file graph → structurally-central files float up (shared utilities, core models, base classes).
- Symbol score =
pagerank(def_file) × (1 + total_refs) × rarity. Emit highest first until the token budget is hit.
So the map surfaces the code everything else leans on, not just the first files alphabetically.
Gotchas
- Regex extraction, not tree-sitter. Fidelity is good for ranking but not a
parser. Exotic syntax, heavy macros, or unusual formatting can miss/misattribute a
def. This is a deliberate trade for zero-install + runs-anywhere. To upgrade
fidelity, replace
extract()withtree-sitter-language-packtags — the graph/ PageRank stages stay identical. (Don't install tree-sitter casually: it trips the 7-day supply-chain gate; gate it like any fresh dep.) - Token count is a heuristic (
chars/4), not a real tokenizer. Treat the budget as approximate; it errs slightly high on code with many short tokens. - Same name in many files (e.g.
get,handle) ranks each def site separately — expected, since each is a distinct definition. Use--topto trim noise. - Non-git dirs fall back to a denylist walk (
node_modules,dist,venv, …). If your build output lives somewhere unusual, it may get scanned — point ROOT at the source dir instead. - Generated code (protobuf,
src/gen/) can dominate ranks because it's referenced everywhere. Point ROOT at hand-written source, or filter after the fact.
Troubleshooting
| Symptom | Cause | Fix |
0 files scanned | ROOT has no recognized source extensions, or all gitignored | Check git ls-files; point ROOT at the source subdir |
| A key function is missing | Regex didn't match its signature style | Lower --budget-tokens pressure (raise budget) or accept the limitation; verify by grep |
--top 12 appears to find only 12 definitions | Post-cap count confused with extraction | Inspect symbols_extracted_total; remove caps before investigating actual extraction misses |
| Map dominated by one vendored file | A vendor//generated tree got scanned (non-git mode) | Run inside the git repo, or point ROOT at hand-written source |
| Wrong/old map | File moved; map is a point-in-time snapshot | Re-run — it's cheap and stateless |
Verification
scripts/repo_map.py is stdlib-only and was verified to run on real trees (it
correctly ranks shared-utility files to the top via PageRank). Re-run on any repo to
confirm; there is no state to corrupt.
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.

