map-codebase

A command that creates a written tour of an unfamiliar software project, including diagrams and an index page.

In plain words
What is it for?
It writes ten learning-oriented documents in `.codebase-map/`, with Mermaid diagrams showing how parts of the project relate.
Why use it?
It gives new contributors a way to understand the project's folders, entry points, data, and main workflows without reading everything first.

Command

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 commands/acaprino/daodan/map-codebase
Clone the repo
git clone --depth 1 https://github.com/acaprino/daodan
Per session 89 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,415 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.00089 $0.02415
Opus 5 $0.00044 $0.01208
Sonnet 5 $0.00018 $0.00483
Haiku 4.5 $0.00009 $0.00242

Measured yesterday against content hash c510a8786e38, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

map-codebase 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 yesterday.

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.

exports/claude/plugins/codebase-mapper/commands/map-codebase.md · 131 lines

How it starts

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

Map Codebase

Generate a human-readable guide for an unfamiliar codebase. Produces 10 narrative documents with inline Mermaid diagrams, organized for progressive learning.

Pre-flight

  1. Determine target path: Use the argument if provided, otherwise use the current working directory.

  2. Check for existing output:

    ls .codebase-map/ 2>/dev/null
    
    • If .codebase-map/ exists with content, ask the user: "A codebase map already exists. Overwrite it? (y/n)"
    • If user declines, stop here
  3. Create output directories:

    mkdir -p .codebase-map/_internal
    

Phase 1: Explore (sequential)

Spawn a single codebase-explorer agent:

Agent task:

Explore this project and write a context brief to .codebase-map/_internal/context-brief.md. Follow your exploration strategy to understand what the project does, its tech stack, directory structure, key entry points, data model, and main workflows. Read actual code - do not guess from file names. Include file paths for every claim.

Verify: Check that .codebase-map/_internal/context-brief.md exists and is non-empty.

If the context brief is missing or empty, stop and report the error.

Phase 1.5: Confirm Project Profile (sequential)

The codebase-explorer wrote a ## Project Profile section as the first section of .codebase-map/_internal/context-brief.md. Surface it for a quick confirmation before the writers run.

  1. Read the ## Project Profile section from .codebase-map/_internal/context-brief.md.
  2. Present a compact summary to the user: project type and domain, primary audience, register, scope, and any items the explorer marked low-confidence.
  3. Ask the user to confirm or adjust (use AskUserQuestion). The default is the inferred profile; the user only corrects.
  4. If the user adjusts anything, overwrite the ## Project Profile section in context-brief.md with the corrected values, so the writers read the confirmed profile.

This is the only interactive checkpoint. Profiling itself is autonomous; this step is a light safety net, not a questionnaire. Keep it to one question.

Read the full file on GitHub · 131 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. yesterday First seen · 131 lines · 89 tokens per session scan A c510a8786e38

Subscribe to this mod's changes

map-codebase is a command published in the GitHub repository acaprino/daodan (8 stars, last pushed 6d ago), licensed MIT. It adds 89 tokens to every session and 2,415 once invoked, about $0.0004 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-31.