# What Are the 5 Specialized Agents in the /understand Command?

> Discover the 5 specialized agents in the /understand command Project-Scanner File-Analyzer Architecture-Analyzer Graph-Reviewer and Assemble-Reviewer to build a unified knowledge graph of your codebase.

- Repository: [Yuxiang Lin/Understand-Anything](https://github.com/Lum1104/Understand-Anything)
- Tags: how-to-guide
- Published: 2026-06-08

---

**The `/understand` command orchestrates five specialized agents—Project-Scanner, File-Analyzer, Architecture-Analyzer, Graph-Reviewer, and Assemble-Reviewer—that sequentially discover, parse, architect, validate, and assemble a unified knowledge graph of your codebase.**

In the `Lum1104/Understand-Anything` repository, the `/understand` slash command is the primary entry point for automated codebase analysis. The command delegates every stage of its workflow to one of five specialized agents defined in the `understand-anything-plugin/agents/` directory. This modular architecture keeps the pipeline testable and easy to extend.

## The 5 Specialized Agents in the Pipeline

The analysis workflow is divided into five distinct stages. Each stage is owned by a single agent with a narrowly defined responsibility.

### 1. Project-Scanner

The **Project-Scanner** agent initiates the pipeline by walking the file system, discovering the project root, and building an initial list of files to process. Its configuration and behavioral spec live in [`understand-anything-plugin/agents/project-scanner.md`](https://github.com/Lum1104/Understand-Anything/blob/main/understand-anything-plugin/agents/project-scanner.md).

### 2. File-Analyzer

The **File-Analyzer** agent consumes that file list and runs the bundled *tree-sitter* extraction script—or language-specific parsers—to produce deterministic, high-quality structural data for each source file. You can review its parsing rules in [`understand-anything-plugin/agents/file-analyzer.md`](https://github.com/Lum1104/Understand-Anything/blob/main/understand-anything-plugin/agents/file-analyzer.md).

### 3. Architecture-Analyzer

The **Architecture-Analyzer** agent ingests the structural data and, with LLM assistance, infers a high-level architecture diagram including components, dependencies, and data flows. Its logic is documented in [`understand-anything-plugin/agents/architecture-analyzer.md`](https://github.com/Lum1104/Understand-Anything/blob/main/understand-anything-plugin/agents/architecture-analyzer.md).

### 4. Graph-Reviewer

The **Graph-Reviewer** agent validates the generated knowledge graph against the schema, flags inconsistencies, and suggests fixes before the graph is finalized. Its validation criteria are stored in [`understand-anything-plugin/agents/graph-reviewer.md`](https://github.com/Lum1104/Understand-Anything/blob/main/understand-anything-plugin/agents/graph-reviewer.md).

### 5. Assemble-Reviewer

The **Assemble-Reviewer** agent—sometimes referred to as the "reviewer" in internal docs—pulls together the final human-readable report. It merges insights from the other agents and writes the output that the `/understand` command ultimately returns. Its assembly logic is defined in [`understand-anything-plugin/agents/assemble-reviewer.md`](https://github.com/Lum1104/Understand-Anything/blob/main/understand-anything-plugin/agents/assemble-reviewer.md).

## How the Agents Are Orchestrated

These agents are not executed in isolation. According to the `Understand-Anything` source code, the **command handler** in [`understand-anything-plugin/src/understand-chat.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/understand-anything-plugin/src/understand-chat.ts) sequentially dispatches each agent and aggregates the intermediate results into a single knowledge graph. This central orchestrator enforces ordering, passes context between stages, and surfaces the final report to the user.

## Extending the Pipeline: The /understand-domain Variant

The default pipeline uses the five agents above, but the repository supports an optional sixth agent called **Domain-Analyzer**. When you invoke the `/understand-domain` variant, this agent enriches the graph with domain-specific terminology and ontology, effectively turning the pipeline into a six-agent workflow.

## Practical Code Examples

Below are concise snippets showing how to invoke the command and customize the pipeline.

```typescript
// Example 1 – Basic usage (runs the default 5 agents)
await clerk.runCommand('/understand', {
  // No extra options – the command auto-discovers the project and
  // runs Project-Scanner → File-Analyzer → Architecture-Analyzer → Graph-Reviewer → Assemble-Reviewer
});

```

```typescript
// Example 2 – Adding the optional Domain-Analyzer
await clerk.runCommand('/understand-domain', {
  // The extra "domain-analyzer" agent enriches the graph with domain-specific
  // terminology and ontology.
});

```

```typescript
// Example 3 – Running a single agent manually (for debugging)
await clerk.runAgent('file-analyzer', {
  targetFiles: ['src/**/*.ts'],
});

```

## Summary

- The `/understand` command relies on **five specialized agents** to analyze a codebase end-to-end.
- **Project-Scanner** discovers files, **File-Analyzer** extracts structure, **Architecture-Analyzer** infers design, **Graph-Reviewer** validates the graph, and **Assemble-Reviewer** produces the final report.
- Orchestration is centralized in [`understand-anything-plugin/src/understand-chat.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/understand-anything-plugin/src/understand-chat.ts).
- Each agent spec lives in a dedicated markdown file under `understand-anything-plugin/agents/`.
- The pipeline can be extended to six agents via the `/understand-domain` variant and the **Domain-Analyzer**.

## Frequently Asked Questions

### What is the role of the Project-Scanner agent?

The Project-Scanner agent is responsible for the discovery phase. It walks the file system, identifies the project root, and compiles the initial list of source files that downstream agents will analyze.

### How does the File-Analyzer agent parse source files?

The File-Analyzer agent runs a bundled *tree-sitter* extraction script—or alternative language-specific parsers—against each discovered file to generate deterministic structural data that the Architecture-Analyzer consumes.

### What is the difference between Graph-Reviewer and Assemble-Reviewer?

The Graph-Reviewer agent validates the knowledge graph against its schema and flags logical inconsistencies, while the Assemble-Reviewer agent focuses on presentation: it merges all insights into the final human-readable report returned by the `/understand` command.

### Can I extend the /understand pipeline with additional agents?

Yes. The repository provides a `/understand-domain` variant that appends a sixth **Domain-Analyzer** agent to the default pipeline, enriching the output with domain-specific terminology and ontology.