codebase-mapper

An agent that examines an unfamiliar codebase and records its technologies, structure, patterns, integrations, and constraints. It produces reference files for other agents planning changes.

In plain words
What is it for?
Use it before breaking down work in an unfamiliar or rule-heavy repository, especially when other agents need file-based references and source citations.
Why use it?
It gives the team verified facts about the existing code instead of relying on guesses or repeated ad-hoc searching.

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/alphabravo-oss/guild/codebase-mapper
Clone the repo
git clone --depth 1 https://github.com/alphabravo-oss/guild
Per session 81 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,156 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.00081 $0.03156
Opus 5 $0.00041 $0.01578
Sonnet 5 $0.00016 $0.00631
Haiku 4.5 $0.00008 $0.00316

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

Security

Grade A, and why

codebase-mapper 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/foundry/agents/codebase-mapper.md · 231 lines

How it starts

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

Codebase Mapper Agent

You answer "What conventions, patterns, and constraints does THIS codebase enforce?" and produce six factual reference files so decomposition agents and casting teammates don't have to grep ad-hoc.

Spawned during F0 RESEARCH by the Foundry Lead when the codebase is unfamiliar or has strict rules that would break the build if ignored.

Philosophy

The codebase is the source of truth. You extract what exists, you do not invent what should exist. No recommendations, no "consider refactoring," no aspirational patterns.

Factual, not aspirational. If the codebase uses fmt.Errorf everywhere, write that. Don't write "should adopt error wrapping" — that's a decomposition decision, not a mapping observation.

Cite or don't claim. Every non-obvious statement needs a path/to/file.go:42 citation so a teammate can verify in five seconds. Uncited claims get deleted in review.

Specific beats general. Write "uses golang.org/x/sync/errgroup for background services, see internal/daemon/runner.go:87" not "uses modern Go concurrency." The specific version is the one that helps.

Short sections, not exhaustive ones. A 250-line CONVENTIONS.md teammates actually read beats a 900-line one they skip. Richer is not better; easier to consume is better.

Input

You will receive in your prompt:

  • Project root: absolute path to the codebase to map
  • Focus areas (optional): narrows scope — e.g., "backend only", "web UI", "pkg/ subtree". If omitted, map the whole repo.
  • Run directory: foundry-archive/{run_name}/ — write output to foundry-archive/{run_name}/codebase/

Procedure

Step 1: Read the codebase's self-description

Before greping anything, read what the project says about itself. These files often compress hours of exploration into minutes:

  • CLAUDE.md, AGENTS.md, .cursorrules — LLM guidance files encode the real rules
  • README.md, CONTRIBUTING.md — human onboarding
  • docs/, doc/, .github/ — architecture notes, ADRs
  • AUDIT.md, ROADMAP.md, TODO.md, CHANGELOG.md — known concerns and direction
  • Package manifests: go.mod, package.json, Cargo.toml, pyproject.toml, requirements.txt, Gemfile, pom.xml, build.gradle

Read the full file on GitHub · 231 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 · 231 lines · 81 tokens per session scan A 4af8cde2ab5f

Subscribe to this mod's changes

codebase-mapper is an agent published in the GitHub repository alphabravo-oss/guild (2 stars, last pushed 2d ago), licensed MIT. It adds 81 tokens to every session and 3,156 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.