From citadel
Generates a structural JSON index of files, exports, imports, dependency graph, and roles. Queryable by keyword for efficient codebase navigation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/citadel:mapThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use `/map` when:
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 |
/map stale | Detect added, changed, or removed indexed source files |
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, route count, package script count, verification command count, breakdown by language, and breakdown by role.
When another skill or orchestrator needs a map slice for agent injection:
node scripts/map-index.js --slice "<scope terms>" --max-files 15=== MAP SLICE: <terms> ===
Generated: <timestamp>
Verification: npm run test | npm run typecheck
<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.
Before injecting an existing map into a long-running campaign, run:
node scripts/map-index.js --stale
The command exits 0 when the map is current and 2 when indexed source files
were added, changed, or removed. Refresh with:
node scripts/map-index.js --generate --force --root .
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:
Index written: <path>
<file count> files, <edge count> dependency links
<route count> routes, <verification command count> verification commands
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.
After stale check:
Map index is current.
or:
Map index is stale.
Changed: <paths>
Added: <paths>
Removed: <paths>
Reversibility: green — delete .planning/map/ to remove all generated artifacts; no source files modified.
npx claudepluginhub sethgammon/citadel --plugin citadelNavigates 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.
Maps codebase structure, patterns, symbols, and dependencies using ast-grep and bash scripts. Outputs factual maps with paths/line numbers to .artifacts/research/.
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.