From grimoire
Explores and documents code flows by tracing entry points, components, and sequences, then creates cartography files for quick context rebuilding on future visits.
npx claudepluginhub joranhonig/grimoireThis skill uses the workspace's default tool permissions.
Explore a code flow, document which parts of the codebase are relevant, and create a cartography
Verifies and refines cartography files documenting code flows against the actual codebase, filling gaps, fixing inaccuracies, adding cross-references, and introducing conditional sections.
Maintains persistent codebase maps (map.md, conventions.md, modules/) to record exploration learnings, consult structure before tasks, and load module context for subagents.
Produces a one-screen map of unfamiliar codebase areas: entry points, core modules, data flow, callers, hidden coupling. Readable in 15 seconds for quick orientation.
Share bugs, ideas, or general feedback.
Explore a code flow, document which parts of the codebase are relevant, and create a cartography file so context can be rebuilt quickly on future visits.
Context is expensive to build and cheap to store. Security researchers repeatedly need to understand the same flows — authentication, data pipelines, permission checks. Building this context from scratch each time wastes tokens and time. Cartography files are lightweight pointers that document where to look, not what the code does. They enable any agent to rebuild flow context in seconds instead of minutes.
When this skill is activated, create a todo list from the following steps. Mark each task in_progress before starting it and completed when done.
- [ ] 1. Verify infrastructure — confirm grimoire/cartography/ exists
- [ ] 2. Check index for existing flows — run index script, present matches
- [ ] 3. Explore the flow — discover entry points, components, sequence, security notes
- [ ] 4. Document the flow — create cartography file following format spec
- [ ] 5. Update index — re-run index script, verify new flow appears
- [ ] 6. Present to user — summary and suggest follow-up skills
Check that the grimoire/ directory and grimoire/cartography/ subdirectory exist.
grimoire/cartography/ exists, proceed.grimoire/ exists but cartography/ does not, create grimoire/cartography/.grimoire/ does not exist, warn the user that Grimoire has not been summoned on this
codebase. Suggest running [[summon]] first to set up the workspace. If the user wants to
proceed anyway, create both grimoire/ and grimoire/cartography/.Run the indexing script to see what flows already exist:
bash skills/cartography/scripts/index-cartography.sh grimoire/cartography/
If the index returns results:
If the index is empty or the user's flow is new, proceed to exploration.
There are two exploration modes depending on what the user provides:
Seeded exploration — the user provides starting files or hints (e.g., "trace how
authentication works starting from gateway/src/middleware/auth.ts"). Use these as entry points
and trace the flow by following the callgraph:
Use path/to/file:symbol notation to track each hop. This directly becomes the Flow Sequence
and Key Components in the cartography file.
Unseeded exploration — the user describes a flow but doesn't point to specific files (e.g., "map how secrets are retrieved"). Deploy a swarm of subagents to explore the codebase:
The swarm casts a wide net; the callgraph pass refines it into a coherent flow. Don't skip step 5 — a bag of search results is not a flow map.
In both modes, gather:
Use subagents to parallelize exploration. Keep the main context focused on assembling the map rather than reading every file in detail.
Consult references/cartography-format.md for the exact format specification and the examples:
examples/cartography-example.md — single-service flow, one conditional sectionexamples/cross-service-auth-example.md — cross-service flow, multiple conditionalsCreate a cartography file at grimoire/cartography/<slug>.md where <slug> is a URL-friendly
version of the flow name (lowercase, hyphens, no spaces).
The file must follow the format defined in references/cartography-format.md:
name, description, created, updated, tags, relatedpath/to/file:symbol notation<!-- condition: ... --> comment as a
concrete, matchable topic description — an agent reads this comment and decides whether to
load the section based on the user's current question. Load when the user's question
directly matches the condition topic. Skip when the user is focused on the main flow and
the conditional topic hasn't been mentioned.Key constraint: the file documents where to look, not what the code does. If you find yourself writing detailed code explanations, stop. Add the file path and a one-line role description instead.
Set created and updated to today's date.
Re-run the indexing script:
bash skills/cartography/scripts/index-cartography.sh grimoire/cartography/
Verify the new flow appears in the output. If it doesn't, check that the frontmatter has
valid name and description fields on single lines.
Show the user:
Suggest follow-up actions:
Cartography files exist so that agents don't repeat expensive exploration. When an agent needs to understand a flow that has already been mapped, it should rebuild context from the cartography file rather than re-exploring from scratch:
<!-- condition: ... --> comment. If the
user's current question matches the condition topic, load that section. If not, skip it.
When in doubt, skip — loading unnecessary conditionals wastes context.updated date is old or the referenced files have changed
significantly since the cartography file was written, the map may be stale. Consider running
[[review-cartography]] to update it before relying on it.An agent that follows this process gets to a working understanding of the flow in seconds, using tokens only on reading source files rather than searching for them.
related field and
[[cartography/...]] links to connect them.