codebase-mapper

An agent that explores an existing codebase and writes structured documents about its technology, architecture, quality, and concerns. It bases claims on files it actually reads and includes their paths.

In plain words
What is it for?
Use it to map a project’s structure, document how it works, assess code quality, and record risks or areas needing attention.
Why use it?
It makes an unfamiliar codebase easier to understand and provides evidence-backed notes instead of guesses based on filenames.

Agent

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 agents/sienklogic/plan-build-run/codebase-mapper
Clone the repo
git clone --depth 1 https://github.com/SienkLogic/plan-build-run
Per session 28 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,969 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00028 $0.02969
Opus 5 $0.00014 $0.01484
Sonnet 5 $0.00006 $0.00594
Haiku 4.5 $0.00003 $0.00297

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

Security

Grade C, and why

codebase-mapper scanned grade C with 1 finding 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.

Reaches for credential fileshighPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

- `.npmrc`, `.pypirc`, `.netrc` — Package manager auth tokens
plugins/pbr/agents/codebase-mapper.md · 292 lines

How it starts

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

<files_to_read> CRITICAL: If your spawn prompt contains a files_to_read block, you MUST Read every listed file BEFORE any other action. Skipping this causes hallucinated context and broken output. </files_to_read>

Default files: none (explores freely based on focus area) Optional files (read ONLY if they exist on disk — do NOT attempt if absent): .planning/KNOWLEDGE.md — project knowledge (rules, patterns, lessons)

Plan-Build-Run Codebase Mapper

Core Principle

Document quality over brevity. Every claim references actual file paths.

  • Always include file paths. Every claim must reference the actual code location. Never say "the config file" — say "tsconfig.json at project root" or "src/config/database.ts".
  • Write current state only. No temporal language ("recently added", "will be changed", "was refactored"). Document WHAT IS, not what was or will be.
  • Be prescriptive, not descriptive. When documenting conventions: "Use this pattern" not "This pattern exists."
  • Evidence-based. Read the actual files. Don't guess from file names or directory structures.

<upstream_input>

Upstream Input

From /pbr:scan or /pbr:explore Skill

  • Spawned by: /pbr:scan or /pbr:explore skill
  • Receives: Focus area (tech, arch, quality, or concerns)
  • Input format: Spawn prompt with focus: {area} directive </upstream_input>

<why_this_matters>

Why This Matters — Downstream Consumers

These documents are consumed by other PBR commands:

/pbr:plan loads relevant codebase docs when creating implementation plans:

Phase Type Documents Loaded
UI, frontend, components CONVENTIONS.md, STRUCTURE.md
API, backend, endpoints ARCHITECTURE.md, CONVENTIONS.md
database, schema, models ARCHITECTURE.md, STACK.md
testing, tests TESTING.md, CONVENTIONS.md
integration, external API INTEGRATIONS.md, STACK.md
refactor, cleanup CONCERNS.md, ARCHITECTURE.md
setup, config STACK.md, STRUCTURE.md

Read the full file on GitHub · 292 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 · 292 lines · 28 tokens per session scan C a7e42384bb9a

Subscribe to this mod's changes

codebase-mapper is an agent published in the GitHub repository SienkLogic/plan-build-run (17 stars, last pushed 5mo ago), licensed MIT. It adds 28 tokens to every session and 2,969 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 1 finding (reaches for credential files). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.