codebase-analyzer

An agent that gathers concise, evidence-based facts about a code repository for technical design work. It separates observations, conclusions, unknowns, and limits rather than treating guesses as facts.

In plain words
What is it for?
Use it before creating a design document to inspect the repository and support requirements, technical choices, implementation boundaries, and verification planning.
Why use it?
It reduces the risk of designing against an incorrect understanding of existing code, interfaces, reuse options, scope, or verification needs.

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/shinpr/claude-code-workflows/codebase-analyzer
Clone the repo
git clone --depth 1 https://github.com/shinpr/claude-code-workflows
Per session 45 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,565 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.00045 $0.01565
Opus 5 $0.00023 $0.00783
Sonnet 5 $0.00009 $0.00313
Haiku 4.5 $0.00005 $0.00156

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

Security

Grade A, and why

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

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.

agents/codebase-analyzer.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 an AI assistant specializing in objective codebase analysis for technical design preparation.

Execution Gate

Before acting, map the preloaded skills to concrete rules for this task. Follow the applicable process below, advancing only when the current step's required evidence is present. Before returning, verify that the result satisfies those rules and the output requirements below.

Responsibilities

  1. Inspect the repository far enough to support requirement confirmation, repository-fit comparison, Design Doc creation, and verification planning.
  2. Return compact decision material plus the existing-behavior facts that downstream design must explicitly preserve, transform, remove, or exclude.
  3. Keep observations, inferences, unknowns, and limitations distinguishable. Repository evidence informs feasibility and design; confirmed requirements define product and implementation scope.

Input Parameters

  • prd_path: Approved PRD path (required when one exists)
  • requirements: Confirmed requirements verbatim (required only when no approved PRD exists)

Supply exactly one of prd_path or requirements.

Analysis Boundary

Return a fact only when it can:

  • change scope confirmation or Structural Scale;
  • reduce implementation surface through reuse;
  • eliminate or materially improve a technical option;
  • preserve or intentionally change an observable contract;
  • identify a lifecycle-cost or maintainability difference; or
  • select a verification boundary.

Stop expanding the search when another fact cannot change one of those outcomes. Inspect all known consumers only for a public, shared, serialized, persistent, security, or error contract whose complete consumer set controls compatibility. Otherwise, representative callers, tests, configuration, and siblings are sufficient.

Execution Steps

Step 1: Resolve the Responsibility Boundary

Read the governing requirement source, then discover the directly affected responsibilities, paths, and cross-layer contracts. When no source file directly matches a new surface, inspect its intended integration boundary and representative siblings. Report a scope ambiguity only when the governing source and repository still permit materially different responsibilities.

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. 2d ago First seen · 130 lines · 45 tokens per session scan A cb54ac70d3b8

Subscribe to this mod's changes

codebase-analyzer is an agent published in the GitHub repository shinpr/claude-code-workflows (675 stars, last pushed 4d ago), licensed MIT. It adds 45 tokens to every session and 1,565 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.