Multi-specialist collaborative analysis to understand how features, functions, or components work
Execute multi-specialist analysis using independent subagents to comprehensively understand codebase features.
Usage: /understand-agent [the thing to understand]
Arguments: Feature, function, component, or system to analyze (e.g., "authentication system", "User model", "PDF generation")
Execute using Task tool to create independent subagents:
Analyze target scope and launch 4-7 parallel subagents:
Example Implementation:
Task 1: "Code Structure Analyst"
- Prompt: "Analyze [target] structure by finding definitions, tracing implementation paths, identifying file locations, dependencies, and imports. Use Grep/Glob extensively to map the codebase."
Task 2: "Data Flow Analyst"
- Prompt: "Examine [target] data flow, input/output patterns, state management, transformations, and side effects. Trace data from entry to exit points."
Task 3: "Usage Pattern Analyst"
- Prompt: "Find where [target] is used/called, identify integration points, common usage patterns, configuration options, and calling contexts throughout codebase."
Task 4: "UX/UI Analyst"
- Prompt: "Analyze [target] user interface and experience aspects including React components, Phoenix LiveView, Astro components, HTML templates, styling, user interactions, and accessibility patterns."
Task 5: "Database Analyst"
- Prompt: "Investigate [target] database interactions, schema relationships, queries, constraints, indexes. Use Tidewave MCP for Ecto analysis and PostgreSQL CLI for direct schema examination."
Task 6: "API Analyst"
- Prompt: "Examine [target] API interactions, endpoints, request/response patterns, GraphQL queries/mutations, REST calls, and external service integrations."
Task 7: "Test Coverage Analyst"
- Prompt: "Locate tests for [target], analyze test coverage, key test scenarios, edge cases, and testing strategies. Map test files to implementation."
Task 8: "Codex Fresh Eyes Understanding" (PARALLEL)
- MCP: codex
- Prompt: "Analyze [target] from scratch with fresh eyes. What is this component/feature actually doing at a high level? How would you explain its purpose and implementation approach to someone unfamiliar with this codebase? What design decisions and architectural choices do you recognize? Focus on the 'what' and 'how' without getting into evaluation."
Selection Criteria (agents are optional based on relevance):
Launch second round connecting specialist findings, identifying interaction patterns, validating conclusions across domains.
Task: "Codex Integration Analyst"
Collect outputs, synthesize comprehensive understanding, organize findings into structured documentation format.
Each specialist should examine:
=== MULTI-AGENT UNDERSTANDING: [Target] ===
Scope: [Function/Component/Feature/System] | Specialists: [Dynamic assignment]
--- ROUND 1 ---
🔍 SPECIALIST ANALYSIS
[Each specialist's domain findings and discoveries]
🧠 CODEX FRESH EYES
[Independent Codex perspective on component purpose and implementation approach]
🎯 CROSS-VALIDATION
[Specialists engage with and validate each other's findings]
🔄 CODEX INTEGRATION SYNTHESIS
[Codex analysis of how specialist findings connect to broader architectural patterns]
⚖️ INTEGRATION ASSESSMENT
[Overall system coherence and interaction analysis]
--- COMPREHENSIVE UNDERSTANDING ---
### Overview
[Purpose, functionality, and role in system]
### Location & Structure
- Main files: [paths:line numbers from Code Structure Analyst]
- Related files: [connected modules and dependencies]
### How It Works
[Step-by-step flow from Data Flow Analyst]
1. [Entry points and initialization]
2. [Key logic and processing steps]
3. [Output and side effects]
### Dependencies
- Internal: [project dependencies from Code Structure]
- External: [libraries, APIs, services]
### Usage Examples
[Common patterns from Usage Pattern Analyst]
- [Where called/used with examples]
- [Configuration options and contexts]
### UI/UX Integration (if UI-related)
[From UX/UI Analyst when applicable]
- Components: [React/LiveView/Astro structure]
- Interactions: [user flows and state changes]
- Styling: [CSS/styling approaches]
### Database Integration (if data-related)
[From Database Analyst when applicable]
- Tables/schemas: [Tidewave + psql analysis]
- Queries: [key database operations]
- Constraints: [indexes and relationships]
### API Integration (if service-related)
[From API Analyst when applicable]
- Endpoints: [REST/GraphQL operations]
- Data flow: [request/response patterns]
- Services: [external integrations]
### Testing
[From Test Coverage Analyst]
- Test files: [paths and coverage]
- Key scenarios: [test cases and edge cases]
### Notes & Considerations
- Performance: [implications and bottlenecks]
- Security: [considerations and risks]
- Limitations: [known constraints]
- Improvements: [optimization opportunities]
Specialists use systematic approach:
Execute multi-agent understanding analysis starting with scope identification and dynamic specialist assignment.
$ARGUMENTS
Begin comprehensive analysis now, identifying scope and launching appropriate specialists.