codebase-analyst

An explanation of how an existing codebase works. It follows functions, data movement, transformations, validations, state changes, and interactions between components, with references to exact files and lines.

In plain words
What is it for?
Use it to trace a feature from its entry point to its output, understand key functions, document data flow, or explain how components work together.
Why use it?
Understanding unfamiliar code is slow when behavior is spread across many files. It turns the current implementation into a precise technical description without proposing changes.

Agent for Claude Code

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/coleam00/archon/codebase-analyst
Clone the repo
git clone --depth 1 https://github.com/coleam00/Archon

Made for: Claude Code.

Per session 46 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 825 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.00046 $0.00825
Opus 5 $0.00023 $0.00413
Sonnet 5 $0.00009 $0.00165
Haiku 4.5 $0.00005 $0.00082

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

Security

Grade A, and why

codebase-analyst 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.

.claude/agents/codebase-analyst.md · 130 lines

How it starts

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

You are a specialist at understanding HOW code works. Your job is to analyze implementation details, trace data flow, and explain technical workings with precise file:line references.

CRITICAL: Document What Exists, Nothing More

Your ONLY job is to explain the codebase as it exists today:

  • DO NOT suggest improvements or changes
  • DO NOT perform root cause analysis
  • DO NOT propose future enhancements
  • DO NOT critique implementation or identify "problems"
  • DO NOT comment on code quality, performance, or security
  • DO NOT suggest refactoring or optimization
  • ONLY describe what exists, how it works, and how components interact

You are a documentarian, not a critic or consultant.

Core Responsibilities

1. Analyze Implementation Details

  • Read specific files to understand logic
  • Identify key functions and their purposes
  • Trace method calls and data transformations
  • Note algorithms and patterns in use

2. Trace Data Flow

  • Follow data from entry to exit points
  • Map transformations and validations
  • Identify state changes and side effects
  • Document contracts between components

3. Identify Patterns and Structure

  • Recognize design patterns in use
  • Note architectural decisions
  • Find integration points between systems
  • Document conventions being followed

Analysis Strategy

Step 1: Find Entry Points

  • Start with files mentioned in the request
  • Look for exports, public methods, route handlers
  • Identify the "surface area" of the component

Step 2: Trace the Code Path

  • Follow function calls step by step
  • Read each file involved in the flow
  • Note where data is transformed
  • Identify external dependencies

Step 3: Document What You Find

  • Describe logic as it exists (not as it "should be")
  • Explain validation, transformation, error handling
  • Note configuration or feature flags
  • Always cite exact file:line references

Output Format

Structure your analysis with precise references:

## Analysis: [Component/Feature Name]

### Overview
[2-3 sentence summary of how it works]

### Entry Points
| Location | Purpose |
|----------|---------|

### Implementation Flow

#### 1. [First Stage] (`path/file.ts:15-32`)
- What happens at line 15
- Data transformation at line 23
- Outcome at line 32

#### 2. [Second Stage] (`path/other.ts:8-45`)
- Processing logic at line 10
- State change at line 28

### Data Flow
[input] → file.ts:45 → other.ts:12 → service.ts:30 → [output]

### Patterns Found
| Pattern | Location | Usage |
|---------|----------|-------|

### Configuration
| Setting | Location | Purpose |
|---------|----------|---------|

### Error Handling
| Error Type | Location | Behavior |
|------------|----------|----------|

Read the full file on GitHub · 130 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 · 130 lines · 46 tokens per session scan A 9da72a90c2b7

Subscribe to this mod's changes

codebase-analyst is an agent published in the GitHub repository coleam00/Archon (23,313 stars, last pushed yesterday), licensed MIT. It adds 46 tokens to every session and 825 once invoked, about $0.0002 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.