Which Agents Power Intelligent Research in Litho (deepwiki-rs)?
Litho employs seven specialized agents orchestrated by ResearchOrchestrator to perform intelligent codebase research: SystemContextResearcher, DomainModulesDetector, ArchitectureResearcher, WorkflowResearcher, KeyModulesInsight, BoundaryAnalyzer, and the conditional DatabaseOverviewAnalyzer.
The sopaco/deepwiki-rs repository implements Litho, a Rust-based documentation generator that automatically explores and documents software architectures through a multi-agent research system. At the heart of this system lies a coordinated set of intelligent agents, each implementing the StepForwardAgent trait to analyze distinct architectural facets of target repositories.
The Multi-Agent Architecture
Litho’s research stage operates as a multi-agent orchestration system that automatically explores a codebase, extracts architectural knowledge, and produces rich documentation. The system processes information through three logical layers: macro (system-wide context), meso (domain modules and architecture), and micro (detailed implementation and boundaries).
ResearchOrchestrator Coordination
The ResearchOrchestrator struct defined in src/generator/research/orchestrator.rs coordinates all agent execution. It runs agents sequentially, feeding outputs from earlier stages as inputs to later ones. The orchestrator prints status messages during execution:
🚀 Starting Litho Studies Research investigation pipeline...
🤖 Executing System Context Researcher agent analysis...
✓ System Context Researcher analysis completed
…
✓ Litho Studies Research pipeline execution completed
The StepForwardAgent Trait
Every research agent implements the StepForwardAgent trait, which standardizes how agents receive context, process data, and return findings. This trait ensures consistent behavior across all seven specialized agents while allowing each to focus on specific research domains.
The Seven Core Research Agents
Litho’s intelligent research capability derives from seven specialized agents, each targeting a specific architectural dimension.
SystemContextResearcher
The SystemContextResearcher agent provides the macro-level "what is this project" overview. It consumes PROJECT_STRUCTURE and the top 50 CODE_INSIGHTS to generate a concise functional summary. According to the source in src/generator/research/agents/system_context_researcher.rs, this agent uses a system prompt defining it as a "professional software system analyst."
DomainModulesDetector
The DomainModulesDetector identifies high-level domain modules and their responsibilities. Operating on project structure, code insights, and relationship graphs, this agent maps the conceptual boundaries of the system before deeper architectural analysis begins.
ArchitectureResearcher
The ArchitectureResearcher builds comprehensive architecture descriptions and generates Mermaid diagrams. Located in src/generator/research/agents/architecture_researcher.rs, this agent consumes outputs from the SystemContextResearcher and DomainModulesDetector, plus optional documentation files (architecture, deployment, or ADR documents). Its system prompt identifies it as a "professional software architecture analyst."
WorkflowResearcher
The WorkflowResearcher extracts end-to-end workflows and interaction patterns from the same inputs used by the ArchitectureResearcher. This agent focuses on dynamic behavior rather than static structure, documenting how components interact across the system.
KeyModulesInsight
The KeyModulesInsight agent performs deep technical dives into each identified module. It consumes module-specific code insights and relationship data to provide implementation details, code excerpts, and relationship mappings for individual components.
BoundaryAnalyzer
The BoundaryAnalyzer analyzes external interfaces including CLI commands, API endpoints, routers, and configuration files. Implemented in src/generator/research/agents/boundary_analyzer.rs, this agent produces structured JSON reports. It consumes project structure, dependency graphs, SystemContextResearcher results, and optional API or deployment documentation.
DatabaseOverviewAnalyzer
The DatabaseOverviewAnalyzer operates conditionally when .sql or .sqlproj files are present. Guarded by the has_database_files() check in the orchestrator, this agent summarizes database schemas, migrations, and related code by consuming insights flagged with CodePurpose::Database.
Executing the Research Pipeline
You can run the full research pipeline programmatically using the ResearchOrchestrator:
use deepwiki_rs::generator::research::orchestrator::ResearchOrchestrator;
use deepwiki_rs::generator::context::GeneratorContext;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Build a generator context (configuration, caches, etc.)
let context = GeneratorContext::new().await?;
// Execute every research agent in the correct order
ResearchOrchestrator::default()
.execute_research_pipeline(&context)
.await?;
Ok(())
}
To inspect a single agent’s configuration, such as the BoundaryAnalyzer:
use deepwiki_rs::generator::research::agents::boundary_analyzer::BoundaryAnalyzer;
fn main() {
let cfg = BoundaryAnalyzer::default().data_config();
println!("{:#?}", cfg);
}
You can also access agent-specific prompt templates:
let prompt = ArchitectureResearcher::default().prompt_template();
println!("{}", prompt.system_prompt);
Summary
- Seven core agents power Litho’s intelligent research:
SystemContextResearcher,DomainModulesDetector,ArchitectureResearcher,WorkflowResearcher,KeyModulesInsight,BoundaryAnalyzer, andDatabaseOverviewAnalyzer. - Multi-layer processing occurs in macro (system context), meso (architecture and domains), and micro (modules and boundaries) phases.
- ResearchOrchestrator in
src/generator/research/orchestrator.rscoordinates execution, feeding outputs from earlier agents as inputs to later ones. - Conditional analysis allows the
DatabaseOverviewAnalyzerto run only when SQL files are detected viahas_database_files(). - Structured outputs include Mermaid diagrams from the
ArchitectureResearcherand JSON reports from theBoundaryAnalyzer.
Frequently Asked Questions
What is the StepForwardAgent trait in Litho?
The StepForwardAgent trait is the core abstraction that every research agent in Litho implements. It standardizes how agents receive research context, process codebase data, and return findings to the ResearchOrchestrator. This trait ensures consistent behavior across all seven specialized agents while allowing each to focus on specific architectural dimensions such as system context, workflows, or boundary analysis.
How does ResearchOrchestrator decide when to run the DatabaseOverviewAnalyzer?
The ResearchOrchestrator conditionally executes the DatabaseOverviewAnalyzer based on the presence of database-related files in the target repository. Before running this agent, the orchestrator calls has_database_files() to check for .sql or .sqlproj files. Only if these files exist does the orchestrator include the database analysis step in the research pipeline, ensuring the agent only runs when relevant database schema information is available.
What inputs does the ArchitectureResearcher agent consume?
The ArchitectureResearcher consumes outputs from upstream agents including the SystemContextResearcher and DomainModulesDetector, along with optional documentation files such as architecture guides, deployment documentation, or Architecture Decision Records (ADRs). Located in src/generator/research/agents/architecture_researcher.rs, this agent synthesizes these inputs to generate comprehensive architecture descriptions and Mermaid diagrams representing the system's structural design.
Can I run a single research agent instead of the full pipeline?
Yes, you can instantiate and inspect individual agents without executing the full ResearchOrchestrator pipeline. Each agent exposes its configuration and prompt templates through methods like data_config() and prompt_template(). For example, you can create a BoundaryAnalyzer::default() instance to examine its data configuration or view the system prompt used by the ArchitectureResearcher without triggering the complete multi-agent research workflow.
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 →