map-codebase

A codebase-mapping command that uses mapper agents to analyse an existing project and write structured documents into `.planning/codebase/`. A codebase map is a documented overview of a project’s technology, structure, quality, and concerns.

In plain words
What is it for?
Mapping a project before substantial changes, producing a full or faster focused scan, and documenting its technology, architecture, quality, and concerns.
Why use it?
It creates reusable project context, so later work does not have to rediscover how the codebase is built and where its main risks are.

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/yeaight7/agent-powerups/map-codebase
Clone the repo
git clone --depth 1 https://github.com/yeaight7/agent-powerups
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 787 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.00019 $0.00787
Opus 5 $0.00010 $0.00394
Sonnet 5 $0.00004 $0.00157
Haiku 4.5 $0.00002 $0.00079

Measured yesterday against content hash 54dc2ec19fe9, 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.

plugins/codebase-intelligence/commands/map-codebase.md · 83 lines

How it starts

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

Objective

Analyze existing codebase using parallel codebase-mapper agents to produce structured codebase documents.

Each mapper agent explores a focus area and writes documents directly to .planning/codebase/. The orchestrator only receives confirmations, keeping context usage minimal.

Output: .planning/codebase/ folder with up to 7 structured documents about the codebase state.

Flags

  • --fast: Lightweight scan mode — spawns one mapper agent instead of four. Accepts an optional --focus value: tech, arch, quality, concerns, or tech+arch (default). Faster and lower-context than the full map.
  • (no flag): Full parallel map — spawns 4 mapper agents to produce all 7 codebase documents.

Context

Arguments: $ARGUMENTS

Parse the first token of $ARGUMENTS:

  • If it is --fast: strip the flag, run lightweight scan (passing remaining args including optional --focus).
  • Otherwise: pass all of $ARGUMENTS as focus area hint to the full map workflow.

Load project state if exists: Check for .planning/STATE.md — loads context if project is already initialized.

This command can run:

  • Before /new-project (brownfield codebases) — create codebase map first
  • After /new-project (greenfield codebases) — update codebase map as code evolves
  • Anytime to refresh codebase understanding

When to Use

Use map-codebase for:

  • Brownfield projects before initialization (understand existing code first)
  • Refreshing codebase map after significant changes
  • Onboarding to an unfamiliar codebase
  • Before major refactoring (understand current state)

Skip map-codebase for:

  • Greenfield projects with no code yet (nothing to map)
  • Trivial codebases (fewer than 5 files)

Process

Full map (no flags):

  1. Check if .planning/codebase/ already exists — if yes, offer to refresh or skip.
  2. Create .planning/codebase/ directory if it doesn't exist.
  3. Spawn 4 parallel codebase-mapper agents:
    • Agent 1: tech focus → writes STACK.md, INTEGRATIONS.md
    • Agent 2: arch focus → writes ARCHITECTURE.md, STRUCTURE.md
    • Agent 3: quality focus → writes CONVENTIONS.md, TESTING.md
    • Agent 4: concerns focus → writes CONCERNS.md
  4. Wait for all agents to complete, collect confirmations (NOT document contents).
  5. Verify all 7 documents exist with line counts.
  6. Present summary and suggest next steps (typically: /new-project or /plan-phase).

Read the full file on GitHub · 83 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 · 83 lines · 19 tokens per session scan A 54dc2ec19fe9

Subscribe to this mod's changes

map-codebase is a command published in the GitHub repository yeaight7/agent-powerups (6 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 19 tokens to every session and 787 once invoked, about $0.0001 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.