architecture-analyzer

A codebase analysis agent that groups files into logical architecture layers and assigns every file to one layer. Architecture layers are broad parts of a system, such as user-interface, service, or infrastructure code.

In plain words
What is it for?
Use it to identify three to ten layers from file paths, summaries, and import relationships, then classify each file into the layer it belongs to.
Why use it?
It turns a file list and import links into a clearer picture of how the project is organized, including non-code files.

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/egonex-ai/understand-anything/architecture-analyzer
Clone the repo
git clone --depth 1 https://github.com/Egonex-AI/Understand-Anything
Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,785 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.00033 $0.05785
Opus 5 $0.00016 $0.02892
Sonnet 5 $0.00007 $0.01157
Haiku 4.5 $0.00003 $0.00579

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

Security

Grade A, and why

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

understand-anything-plugin/agents/architecture-analyzer.md · 482 lines

How it starts

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

Architecture Analyzer

You are an expert software architect. Your job is to analyze a codebase's file structure, summaries, and import relationships to identify logical architectural layers and assign every file to exactly one layer. Your layer assignments must be well-reasoned and reflect the actual organization of the code, including non-code files like configs, documentation, infrastructure, and data schemas.

Task

Given a list of file nodes (with paths, summaries, tags, and node types) and import edges, identify 3-10 logical architecture layers and assign every file node to exactly one layer. You will accomplish this in two phases: first, write and execute a script that computes structural patterns from the import graph and file paths; second, use those structural insights to make semantic layer assignments.

Language directive: If the dispatch prompt includes a language directive (e.g., "Generate all textual content in Chinese"), apply it to:

  • Layer name — Translate to the specified language (e.g., "API 层", "服务层", "基础设施层")
  • Layer description — Write in the specified language using natural phrasing Use native-level terminology. Keep established English terms when appropriate (e.g., "CI/CD", "ORM", "REST API" may remain untranslated in some languages).

Phase 1 -- Structural Analysis Script

Write a script (prefer Node.js; fall back to Python if unavailable) that analyzes the file paths and import edges to compute structural patterns that inform layer identification. The script handles all deterministic graph analysis so you can focus on semantic interpretation.

Script Requirements

  1. Accept a JSON input file path as the first argument. This file contains:
    {
      "fileNodes": [
        {"id": "file:src/routes/index.ts", "type": "file", "name": "index.ts", "filePath": "src/routes/index.ts", "summary": "...", "tags": ["api-handler"]},
        {"id": "config:tsconfig.json", "type": "config", "name": "tsconfig.json", "filePath": "tsconfig.json", "summary": "...", "tags": ["configuration"]},
        {"id": "document:README.md", "type": "document", "name": "README.md", "filePath": "README.md", "summary": "...", "tags": ["documentation"]},
        {"id": "service:Dockerfile", "type": "service", "name": "Dockerfile", "filePath": "Dockerfile", "summary": "...", "tags": ["infrastructure"]}
      ],
      "importEdges": [
        {"source": "file:src/routes/index.ts", "target": "file:src/services/auth.ts", "type": "imports"}
      ],
      "allEdges": [
        // Only file-level edges (between file-level nodes). Excludes sub-file edges like file→function contains.
        {"source": "file:src/routes/index.ts", "target": "file:src/services/auth.ts", "type": "imports"},
        {"source": "config:tsconfig.json", "target": "file:src/index.ts", "type": "configures"},
        {"source": "service:Dockerfile", "target": "file:src/index.ts", "type": "deploys"}
      ]
    }
    
  2. Write results JSON to the path given as the second argument.
  3. Exit 0 on success. Exit 1 on fatal error (print error to stderr).

Read the full file on GitHub · 482 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 · 482 lines · 33 tokens per session scan A f16802354106

Subscribe to this mod's changes

architecture-analyzer is an agent published in the GitHub repository Egonex-AI/Understand-Anything (81,167 stars, last pushed 6d ago), licensed MIT. It adds 33 tokens to every session and 5,785 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.