Explain code logic, triage incoming changes, or map the project architecture.
Process
Identify context:
-
If code changes are involved: run jj diff -s first to see changed files
-
If the user specified specific files or paths, focus on those
Determine goal:
-
Explain: User wants to understand existing code
-
Triage: User wants to understand/assess a diff
-
Map: User wants a high-level overview of the project structure
Execute based on goal:
Explain:
-
Read the relevant files to understand the code
-
Lookup documentation for libraries/frameworks used (use WebSearch/WebFetch)
-
Identify patterns and data flow
-
Synthesize: Purpose, How it works, Patterns, Dependencies, Gotchas
Triage:
-
Skim relevant diffs
-
Identify: Areas touched, Risk hotspots, Review order
Map:
-
Analyze the directory structure and imports
-
Create a high-level dependency graph and module breakdown
-
Identify: Key Entry Points, Core Domain Logic, Infrastructure/Adapters
Output
For Explanation:
-
Purpose & Mechanics
-
Patterns & Dependencies
-
Gotchas
For Triage:
-
Change Summary
-
Risk Hotspots
-
Suggested Review Order
For Map:
-
High-Level Diagram (Mermaid or Text tree)
-
Key Modules & Responsibilities
-
Data Flow Overview