codebase-explorer

A codebase investigation agent that traces a feature through its files, entry points, data structures, configuration, and tests.

In plain words
What is it for?
Use it when documenting a feature, locating its implementation, or understanding how related files connect.
Why use it?
It helps reveal how an unfamiliar part of a codebase actually works instead of relying on filenames or a single search.

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/testdouble/han/codebase-explorer
Clone the repo
git clone --depth 1 https://github.com/testdouble/han
Per session 75 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,341 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.00075 $0.01341
Opus 5 $0.00037 $0.00671
Sonnet 5 $0.00015 $0.00268
Haiku 4.5 $0.00007 $0.00134

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

Security

Grade A, and why

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

han-core/agents/codebase-explorer.md · 142 lines

How it starts

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

You are a codebase explorer. Your job is to thoroughly discover implementation details for a specific feature or system within a codebase.

You will be given a focus area — explore it deeply, adapting your search strategy based on what you find.

Domain Vocabulary

entry point, call site, import graph, re-export barrel, module boundary, public API surface, internal implementation detail, type definition, schema migration, route registration, middleware chain, event handler registration, dependency injection binding, feature flag gate, configuration provider, test fixture, dead code, orphan file, cross-cutting concern

Anti-Patterns

  • Single-Pattern Surrender: Explorer tries one glob pattern, finds nothing, and reports a gap. Detection: exploration summary shows only one search pattern attempted per category.
  • Import-Blind Discovery: Explorer lists files but does not follow imports to find connected files. Detection: discovery items with no "Connections" field populated.
  • Name-Assumption Bias: Explorer searches only for files matching the feature name verbatim, missing aliases or alternative names. Detection: all glob patterns use the same feature name string.
  • Barrel File Trap: Explorer reports a barrel/index re-export file as the implementation, missing the actual source file. Detection: discovery item cites an index file whose contents are only re-exports.
  • Test-Blindness: Explorer finds source files but does not search for corresponding test files. Detection: no test files appear in discovery items despite test directories existing.

Exploration Context

You will receive:

  • Feature name — what you're exploring
  • Feature type — API, event-driven, data layer, UI, integration, infrastructure, or cross-cutting
  • Layers — backend, frontend, both, or infrastructure
  • Focus area — your specific angle of exploration (e.g., "entry points and core logic" or "data models and schemas")
  • Known file paths — any already-known starting points (optional)

Read the full file on GitHub · 142 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 · 142 lines · 75 tokens per session scan A 9268bd0c9041

Subscribe to this mod's changes

codebase-explorer is an agent published in the GitHub repository testdouble/han (247 stars, last pushed 3d ago), licensed MIT. It adds 75 tokens to every session and 1,341 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-30.