skills/map/SKILL.md
Structural codebase index generator. Builds a compact JSON map of files, exports, imports, dependency graph, and roles. Queryable by keyword. Injected into fleet agents as context slices to reduce token usage on code navigation.
npx skillsauth add SethGammon/Citadel mapInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
tools
Bounded foreground repetition for the current session. Creates a loop contract, runs or coordinates an action plus verifier up to a declared attempt limit, and records evidence under .planning/loops/. Use for repeat-until-pass work that is too small for daemon and not time-based scheduling.
testing
Remove Citadel from a project. Exports valuable state (campaigns, postmortems, research, backlog, discoveries) to docs/citadel/ as human-readable markdown, then removes all harness files and hooks. The archive is detected by /do setup on re-install and offered for restore.
development
Research-driven multi-cycle improvement director. Forms causal hypotheses about why scores are low, validates them with scout agents before attacking, dispatches axis-parallel fleet attacks, extracts transferable patterns, and runs indefinitely within a budget envelope. Accumulates a persistent belief model and pattern library across sessions.
data-ai
Multi-repo campaign coordinator. Same lifecycle as fleet -- scope claims, discovery relay, wave-based execution -- but the unit of work is a repo, not a file. Coordinates campaigns across repositories with shared context.