map

A structural index of a codebase that records its files, exports, imports, dependencies, and file roles in a compact JSON map. It can be searched by keyword and refreshed when source files change.

In plain words
What is it for?
Use it when starting work in a new codebase, checking repository statistics, finding files related to a topic, preparing context for multiple agents, or detecting files that have become outdated in the index.
Why use it?
It helps an agent understand an unfamiliar repository without reading every file first. This makes it easier to find relevant files and provide focused context while using fewer tokens.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sethgammon/citadel/map
Any agent
npx skills add SethGammon/Citadel --skill map
Clone the repo
git clone --depth 1 https://github.com/SethGammon/Citadel

Made for: Claude Code, Codex.

Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,697 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00047 $0.01697
Opus 5 $0.00023 $0.00848
Sonnet 5 $0.00009 $0.00339
Haiku 4.5 $0.00005 $0.00170

Measured 2d ago against content hash 3cfa26f3c6de, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

map scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/map/SKILL.md · 218 lines

How it starts

The opening of the file, as written. The whole thing — 218 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/map -- Codebase Intelligence

Orientation

Use /map when:

  • Starting work on an unfamiliar codebase (build the index first)
  • A fleet or archon campaign needs agents to know "what files matter for X"
  • You want a quick structural overview (stats, roles, dependency graph)
  • You need to find files related to a keyword without exploratory reads

Do not use /map for:

  • Reading file contents (use Read)
  • Searching for string patterns inside files (use Grep)
  • Single-file edits where you already know the path

Commands

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

Protocol

Step 1: GENERATE INDEX

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:

  1. Walks the project tree (respects .gitignore, skips node_modules, dist, etc.)
  2. Extracts exports, imports, and symbols from each source file
  3. Infers a role for each file (component, hook, store, route, test, config, etc.)
  4. Builds a dependency graph from resolved import paths
  5. Records per-file SHA-256 hashes plus a whole-index source signature
  6. Extracts route-like paths and package verification scripts
  7. Writes the index to .planning/map/index.json

Supported 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.

Step 2: QUERY (when user provides search terms)

Read the full file on GitHub · 218 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 218 lines · 47 tokens per session scan A 3cfa26f3c6de

Subscribe to this mod's changes

map is a skill published in the GitHub repository SethGammon/Citadel (914 stars, last pushed 5d ago), licensed MIT. It adds 47 tokens to every session and 1,697 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.