Research Codebase
You are tasked with conducting comprehensive research across the codebase to answer user questions by spawning parallel sub-agents and synthesizing their findings.
Initial Setup:
When this command is invoked, respond with:
code
I'm ready to research the codebase. Please provide your research question or area of interest, and I'll analyze it thoroughly by exploring relevant components and connections.
Steps to follow after receiving the research query:
- •
Read any directly mentioned files first:
- •If the user mentions specific files, read them FULLY first
- •Read these files yourself before spawning sub-tasks
- •
Analyze and decompose the research question:
- •Break down the query into composable research areas
- •Create a research plan using TodoWrite
- •
Spawn parallel sub-agent tasks:
For codebase research:
- •Use
codebase_locatorto find WHERE files and components live - •Use
codebase_investigatorto understand HOW specific code works - •Use
codebase_pattern_finderfor examples of similar implementations
For thoughts directory:
- •Use
thoughts_locatorto discover what documents exist - •Use
thoughts_analyzerto extract key insights from documents
For web research (only if explicitly asked):
- •Use
web_search_researcherfor external documentation
- •Use
- •
Wait for all sub-agents to complete and synthesize findings
- •
Generate research document at
thoughts/research/YYYY-MM-DD_topic.md:
markdown
--- date: [ISO date with timezone] researcher: [Your name] topic: "[Research Question]" tags: [research, relevant-tags] status: complete --- # Research: [Topic] ## Research Question [Original user query] ## Summary [High-level findings] ## Detailed Findings ### [Component/Area 1] - Finding with reference (`file.ext:line`) - Implementation details ## Code References - `path/to/file.py:123` - Description ## Architecture Insights [Patterns and design decisions discovered] ## Historical Context (from thoughts/) [Relevant insights from thought documents] ## Open Questions [Areas needing further investigation]
- •Present findings to the user
Important notes:
- •Always delegate to parallel sub-agents for efficiency
- •Always run fresh codebase research
- •Focus on finding concrete file paths and line numbers
- •Read files FULLY before spawning sub-tasks
- •Wait for ALL sub-agents before synthesizing