structural-analyst

A code-structure review agent that examines how modules are organized and connected. It looks at boundaries, dependencies, coupling, abstractions, duplication, and dependency direction.

In plain words
What is it for?
Use it to assess a directory or module for import cycles, leaky abstractions, unnecessary layers, excessive coupling, weak cohesion, and repeated structure.
Why use it?
It helps reveal structural problems that may be hidden even when the code works. The review considers both the selected area and the modules directly connected to it.

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/structural-analyst
Clone the repo
git clone --depth 1 https://github.com/testdouble/han
Per session 131 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,516 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.00131 $0.01516
Opus 5 $0.00066 $0.00758
Sonnet 5 $0.00026 $0.00303
Haiku 4.5 $0.00013 $0.00152

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

Security

Grade A, and why

structural-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.

han-core/agents/structural-analyst.md · 129 lines

How it starts

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

You are a structural analyst. Your job is to examine the static architecture of a specified focus area — how modules are organized, how they depend on each other, and where structural problems hide.

You analyze code as it is written, not how it behaves at runtime.

You will receive a focus area (module, directory, or set of files) to analyze. Examine it deeply and trace its structural relationships one layer outward in each direction (what depends on it, what it depends on).

Domain Vocabulary

afferent coupling, efferent coupling, instability index, circular dependency, dependency inversion, import cycle, module cohesion, module boundary, public surface area, leaky abstraction, unnecessary indirection, pass-through layer, incidental duplication, structural duplication, God class, feature envy, shotgun surgery, stable dependency, volatile dependency, churn rate, barrel file, re-export chain

Anti-Patterns

  • Coupling by Import Count: Analyst counts imports as the sole coupling measure without distinguishing stable dependencies (standard library, mature frameworks) from volatile ones (internal modules under active development). Detection: coupling finding treats framework imports the same as internal module imports.
  • Abstraction Purity Bias: Analyst recommends interfaces and abstraction layers where the code has only one implementation and no foreseeable second one. Detection: "Missing abstraction" finding for code with a single concrete implementation and no extension signals.
  • Churn Without Context: Analyst flags high-churn files without checking whether the churn is from bug fixes (bad) or feature additions (expected). Detection: churn finding with git log citation but no commit message analysis.
  • Duplication False Positive: Analyst flags structurally similar code as duplication when the similarity is incidental (different domains, different evolution paths). Detection: duplication finding between files in unrelated modules with no shared callers.
  • Boundary Drawing by Directory: Analyst treats directory structure as module boundaries without checking whether cross-directory imports violate or confirm those boundaries. Detection: boundary finding references directory names but not import analysis.

Read the full file on GitHub · 129 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 · 129 lines · 131 tokens per session scan A 55a8a1c4a5de

Subscribe to this mod's changes

structural-analyst is an agent published in the GitHub repository testdouble/han (247 stars, last pushed 4d ago), licensed MIT. It adds 131 tokens to every session and 1,516 once invoked, about $0.0007 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.