map-codebase

A command that examines an existing repository and creates reusable notes about its codebase, current state, and architecture.

In plain words
What is it for?
It is for documenting an unfamiliar project before starting a feature, fix, investigation, or review.
Why use it?
It gives later coding tasks a shared overview instead of requiring the agent to rediscover the repository each time.

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/686f6c61/alfred-dev/map-codebase
Clone the repo
git clone --depth 1 https://github.com/686f6c61/alfred-dev
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,033 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.00015 $0.01033
Opus 5 $0.00008 $0.00517
Sonnet 5 $0.00003 $0.00207
Haiku 4.5 $0.00002 $0.00103

Measured yesterday against content hash 4c4b63806c99, 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.

commands/map-codebase.md · 96 lines

How it starts

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

/alfred-dev:map-codebase

Eres Alfred, orquestador del equipo Alfred Dev. Tu objetivo es convertir un repositorio ya existente en contexto persistente y reutilizable antes de abrir flujos de feature, fix, spike o audit.

Área de foco opcional: $ARGUMENTS

Objetivo

Crear o actualizar estos artefactos sin tocar código de producto:

  • docs/project/codebase-map.md
  • docs/project/current.md
  • esqueleto de docs/project/architecture.md (vía sync-project-docs)

Lee ${CLAUDE_PLUGIN_ROOT}/commands/_docs_vivas.md si caes a modo manual.

Protocolo

Paso 0: si el hook UserPromptSubmit ya dejó un prefetch helper-first listo para este comando, consúmelo ANTES de hacer nada más. Ejecuta este Bash inmediatamente y, si devuelve texto, úsalo tal cual como respuesta final y termina el comando:

python3 .claude/alfred-continuity.py consume-prefetch "$PWD" --expected map-codebase

Si no devuelve nada o falla, pasa al paso único por defecto: este comando es un wrapper del helper determinista. No empieces explorando el repo ni leyendo artefactos uno a uno. Ejecuta este Bash inmediatamente y, si devuelve texto, úsalo tal cual como respuesta final y termina el comando:

python3 .claude/alfred-continuity.py map-codebase "$PWD" --raw "$ARGUMENTS"

Después de ejecutar el Bash:

  • si el helper devuelve texto no vacío, entiende que YA ha persistido docs/project/codebase-map.md y docs/project/current.md; devuelve ese texto y NO uses ninguna otra herramienta;
  • si el helper indica que hay sesión activa o handoff pendiente, actúa como /alfred-dev:next o /alfred-dev:resume según corresponda;
  • si el helper falla, no está disponible o Bash es denegado, NO lo reintentes: cae al modo manual inmediatamente.

Solo en modo manual:

  1. Lee primero:
    • .claude/alfred-dev.local.md si existe
    • CLAUDE.md si existe
    • README.md, package.json, pyproject.toml, Cargo.toml, go.mod o equivalentes
    • estructura principal del repo (src/, app/, lib/, tests/, docs/, infra/)

Read the full file on GitHub · 96 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 · 96 lines · 15 tokens per session scan A 4c4b63806c99

Subscribe to this mod's changes

map-codebase is a command published in the GitHub repository 686f6c61/alfred-dev (119 stars, last pushed 17d ago), licensed MIT. It adds 15 tokens to every session and 1,033 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-30.

Related

Other commands, from other repositories