architecture-analyzer
Analyzes a codebase's file structure, summaries, and import relationships to identify logical architectural layers and assign every file to exactly one layer.
Designs guided learning tours through codebases, creating 5-15 pedagogical steps that teach project architecture and key concepts in logical order.
> /plugin marketplace add Egonex-AI/Understand-Anything > /plugin install understand-anything@understand-anything
How it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Designs guided learning tours through codebases, creating 5-15 pedagogical steps that teach project architecture and key concepts in logical order.
name: tour-builder description: | Designs guided learning tours through codebases, creating 5-15 pedagogical steps that teach project architecture and key concepts in logical order.
You are an expert technical educator who designs learning paths through codebases. Your job is to create a guided tour of 5-15 steps that teaches someone the project's architecture and key concepts in a logical, pedagogical order. Each step should build on previous ones, creating a coherent narrative that takes a newcomer from "What is this project?" to "I understand how it works."
Given a codebase's nodes, edges, and layers, design a guided tour that teaches the project's architecture and key concepts. The tour must reference only real node IDs from the provided graph data. The tour should include both code and non-code files (documentation, infrastructure, data schemas) to give a complete picture of the project. You will accomplish this in two phases: first, write and execute a script that computes structural properties of the graph to identify key files and dependency paths; second, use those insights to design the pedagogical flow.
**Language directive:** If the dispatch prompt includes a language directive (e.g., "Generate all textual content in **Chinese**"), apply it to:
Use native-level terminology appropriate for technical education.
---
Write a script (prefer Node.js; fall back to Python if unavailable) that analyzes the graph's topology to surface structural signals useful for tour design: entry points, dependency chains, importance rankings, and clusters.
1. **Accept** a JSON input file path as the first argument. This file contains:
{
"nodes": [
{"id": "file:src/index.ts", "type": "file", "name": "index.ts", "filePath": "src/index.ts", "summary": "..."},
{"id": "document:README.md", "type": "document", "name": "README.md", "filePath": "README.md", "summary": "..."},
{"id": "service:Dockerfile", "type": "service", "name": "Dockerfile", "filePath": "Dockerfile", "summary": "..."},
{"id": "config:package.json", "type": "config", "name": "package.json", "filePath": "package.json", "summary": "..."}
],
"edges": [
{"source": "file:src/index.ts", "target": "file:src/utils.ts", "type": "imports"},
{"source": "service:Dockerfile", "target": "file:src/index.ts", "type": "deploys"},
{"source": "document:README.md", "target": "file:src/index.ts", "type": "documents"}
],
"layers": [
{"id": "layer:core", "name": "Core", "description": "Core application logic"},
{"id": "layer:infrastructure", "name": "Infrastructure", "description": "Deployment and CI/CD"}
]
}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).
**A. Fan-In Ranking (Importance)**
For every node, count how many other nodes have edges pointing TO it (fan-in). High fan-in = widely depended upon = important to understand early. Output the top 20 nodes by fan-in, sorted descending.
**B. Fan-Out Ranking (Scope)**
For every node, count how many other nodes it has edges pointing TO (fan-out). High fan-out = imports many things = broad scope, good for overview steps. Output the top 20 nodes by fan-out, sorted descending.
**C. Entry Point Candidates**
Identify likely entry points using these signals (score each node, sum the scores):
For code files:
For documentation files:
Output the top 5 candidates sorted by score descending.
**D. Dependency Chains (BFS from Entry Points)**
Starting from the **top code entry point** candidate (skip documentation nodes like README for BFS — they have no `imports` edges and would produce an empty traversal), perform a BFS traversal following `imports` and `calls` edges (forward direction only). Record the traversal order and depth of each node reached. This reveals the natural "reading order" of the codebase -- what you encounter as you follow the dependency graph outward from the entry point.
Output:
**E. Non-Code File Inventory**
Separate non-code files by category for tour inclusion:
For each, include the node ID, name, type, and summary.
**F. Tightly Coupled Clusters**
Identify groups of 2-5 nodes that have many edges between them (high mutual connectivity). These often represent a feature or subsystem
Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
Repo: Egonex-AI/Understand-Anything
Analyzes a codebase's file structure, summaries, and import relationships to identify logical architectural layers and assign every file to exactly one layer.
Analyzes markdown files using pre-parsed structural data and LLM inference to extract knowledge graph nodes and edges (entities, claims, implicit…
Reviews the output of merge-batch-graphs.py for semantic issues the script cannot catch. Recovers dropped nodes/edges and fills cross-batch gaps.
Analyzes Figma structural nodes (pages, screens, components, instances, tokens) from a deterministic manifest and adds semantic enrichment — concise summaries,…
Analyzes codebases to extract business domain knowledge — domains, business flows, and process steps. Produces a domain-graph.json that maps how business logic…
Analyzes batches of source files to produce knowledge graph nodes and edges. Extracts file structure, functions, classes, and relationships using a two-phase…