The 6 Specialized Agents in Understand Anything: Functions and Architecture
Understand Anything uses six specialized agents—project-scanner, file-analyzer, architecture-analyzer, tour-builder, graph-reviewer, and domain-analyzer—to transform raw source code into a navigable knowledge graph.
The Egonex-AI/Understand-Anything repository implements a multi-agent pipeline that breaks codebase analysis into discrete, focused responsibilities. When you execute the /understand command, five core agents collaborate to build a structural knowledge graph, while the optional /understand-domain command activates a sixth agent to extract business-domain concepts.
The Multi-Agent Pipeline Architecture
Understand Anything orchestrates its agents sequentially to convert repository files into a richly annotated graph stored at .understand-anything/knowledge-graph.json. Each agent consumes the output of the previous stage, adding metadata, relationships, or validations until the graph is complete. This design ensures that file discovery, parsing, architectural classification, and validation remain modular and debuggable.
Core Agents in the Standard Pipeline
The standard /understand command activates five agents that handle structural and navigational analysis.
1. Project Scanner (File Discovery)
The project-scanner agent recursively traverses the repository to discover every file, detect the programming language or framework of each file, and build an initial import map. This foundational step creates the inventory that subsequent agents analyze. According to the source code in agents/project-scanner.md, this agent handles the initial file system exploration and language detection logic.
2. File Analyzer (Structural Parsing)
The file-analyzer agent parses each discovered file using Tree-sitter to extract functions, classes, imports, and other structural elements. It creates graph nodes and edges that represent the code's structural relationships, transforming raw syntax into a queryable graph format. The implementation details in agents/file-analyzer.md document the Tree-sitter integration and node/edge creation rules.
3. Architecture Analyzer (Layer Classification)
The architecture-analyzer agent consumes the structural graph and classifies each node into an architectural layer such as API, Service, Data, UI, or Utility. This classification enables high-level architectural queries and visualization. The logic for layer detection resides in agents/architecture-analyzer.md.
4. Tour Builder (Guided Onboarding)
The tour-builder agent generates guided learning tours that walk users through the codebase in dependency order. It provides plain-English explanations for each step, making the codebase accessible to new contributors. The tour generation algorithms are documented in agents/tour-builder.md.
5. Graph Reviewer (Validation)
The graph-reviewer agent validates the knowledge graph for completeness and referential integrity. By default, it runs a lightweight inline review, but you can trigger a full LLM-based review using the --review flag. This validation step ensures the graph is coherent before it powers the dashboard or chat features. See agents/graph-reviewer.md for validation specifics.
The Sixth Agent: Domain Analysis
The /understand-domain command adds a sixth specialized agent to the pipeline.
Domain Analyzer (Business Context)
The domain-analyzer extracts business-domain concepts—including domains, flows, and process steps—and links code artifacts to real-world functionality. This agent bridges the gap between technical structure and business logic, enabling queries about "what the code does" rather than just "how it is structured." The extraction logic is implemented in agents/domain-analyzer.md.
Running the Agents: CLI Commands
You can execute the full pipeline or run individual agents for debugging purposes. The following commands demonstrate how to invoke each agent:
# Run the full standard pipeline (5 agents)
understand
# Run only the project-scanner to see discovered files
understand --agent project-scanner
# Run only the file-analyzer on a specific path
understand --agent file-analyzer src/
# Run only the architecture-analyzer (adds layer tags)
understand --agent architecture-analyzer
# Generate a guided tour without the full graph build
understand --agent tour-builder
# Validate the graph (default inline, full LLM review optional)
understand --agent graph-reviewer
understand --agent graph-reviewer --review
# Extract business domains (activates the 6th agent)
understand-domain
Each command writes output to .understand-anything/knowledge-graph.json and prints a status log. In normal usage, you simply run /understand or /understand-domain and the pipeline orchestrates the agents automatically.
Summary
- Six specialized agents power Understand Anything: project-scanner, file-analyzer, architecture-analyzer, tour-builder, graph-reviewer, and domain-analyzer.
- Standard pipeline (
/understand) runs the first five agents to build a structural knowledge graph. - Domain analysis (
/understand-domain) adds the sixth agent to extract business concepts and link code to real-world functionality. - Validation occurs via the graph-reviewer, which supports both lightweight inline checks and full LLM reviews.
- Output is stored in
.understand-anything/knowledge-graph.jsonand powers the dashboard, chat, and diff-analysis features.
Frequently Asked Questions
What is the difference between /understand and /understand-domain?
The /understand command runs the five core agents (project-scanner through graph-reviewer) to create a structural knowledge graph of your codebase. The /understand-domain command runs the same five agents plus the domain-analyzer, which extracts business-domain concepts like processes and flows to map code artifacts to real-world business functionality.
How does the graph-reviewer validate the knowledge graph?
The graph-reviewer checks the graph for completeness and referential integrity, ensuring all nodes and edges are properly connected and no orphaned references exist. By default, it performs a lightweight inline validation, but you can activate a comprehensive LLM review by passing the --review flag to catch semantic inconsistencies.
Can I run individual agents without executing the full pipeline?
Yes. Use the --agent flag followed by the agent name to run a specific agent in isolation. For example, understand --agent project-scanner runs only the file discovery phase, while understand --agent file-analyzer src/ parses only the specified directory. This is useful for debugging specific pipeline stages.
What file format does Understand Anything use to store the knowledge graph?
Understand Anything persists the knowledge graph as a JSON file located at .understand-anything/knowledge-graph.json. This file contains the complete graph structure including nodes, edges, architectural classifications, and domain annotations generated by the agents.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →