From citadel
Generates compact JSON index of codebase structure: files, exports, imports, dependency graph, roles. Queryable by keyword for navigation in unfamiliar repos or agent context injection.
npx claudepluginhub sethgammon/citadel --plugin citadelThis skill uses the workspace's default tool permissions.
Use `/map` when:
Orchestrates parallel subagents to map any codebase, creating docs/CODEBASE_MAP.md with architecture, file roles, dependencies, and navigation. Updates incrementally via git or scans.
Maps codebase structure, patterns, symbols, and dependencies using ast-grep and bash scripts. Outputs factual maps with paths/line numbers to .artifacts/research/.
Navigates codebases using .codemap/ structural indexes to find symbol definitions (classes, functions, methods), explore file structures, and locate code by name. Enables targeted line-range reads to reduce token consumption.
Share bugs, ideas, or general feedback.
Use /map when:
Do not use /map for:
| Command | Behavior |
|---|---|
/map | Generate or refresh the index (skips if cache is fresh) |
/map --force | Rebuild the index even if cache is fresh |
/map query <terms> | Search the index for files matching keywords |
/map stats | Print summary statistics (files, lines, languages, roles) |
/map slice <terms> | Output a compact context slice for agent injection |
Run the index generator:
node scripts/map-index.js --generate --root .
Add --force if the user requested a fresh rebuild or if the index is stale.
The generator:
.gitignore, skips node_modules, dist, etc.).planning/map/index.jsonSupported languages: TypeScript, JavaScript, Python, Go, Rust.
Cache behavior: The index is cached for 5 minutes. Subsequent runs within
that window exit immediately unless --force is passed.
If .planning/map/ does not exist, the generator creates it automatically.
node scripts/map-index.js --query "<terms>"
The query engine scores files by:
Results are sorted by score and capped at 20 files (configurable with --max-files).
Output is budget-capped at 8000 characters to stay injection-safe.
node scripts/map-index.js --stats
Outputs: file count, line count, export count, dependency edge count, breakdown by language and by role.
When another skill or orchestrator needs a map slice for agent injection:
node scripts/map-index.js --query "<scope terms>" --max-files 15=== MAP SLICE: <terms> ===
<score> <role> <path> [<top exports>] (<lines>L)
...
=== END MAP SLICE ===
Token budget: A 15-file slice is typically 800-1200 tokens. This replaces 2000-5000 tokens of exploratory Glob/Grep results that agents would otherwise spend finding relevant files.
Fleet agents receive map slices automatically when /map index exists:
.planning/map/index.json existsContext injection order:
.claude/agent-context/rules-summary.mdDisclosure: "Generating codebase map. Creates .planning/map/index.json."
Reversibility: green — creates .planning/map/index.json only; undo by deleting .planning/map/.
Trust gates:
fileCount: 0). Query returns no results. Not an error..planning/ does not exist: Generator creates .planning/map/ automatically via mkdirSync({ recursive: true }).node scripts/map-index.js --generate first."After generation:
Map index generated: <file count> files, <edge count> dependency links
Languages: <breakdown>
Roles: <breakdown>
After query:
Results for "<terms>" (<count> matches):
Score Role Path
-----------------------------------------------
<results>
After stats: print the full statistics block.
After slice: output the formatted slice block ready for injection.
Reversibility: green — delete .planning/map/ to remove all generated artifacts; no source files modified.