You are tasked with conducting comprehensive research across the codebase to answer user questions by spawning parallel sub-agents and synthesizing their findings.
/plugin marketplace add mchowning/claude-code-plugins/plugin install workflow-tools@mchowning-marketplaceYou are tasked with conducting comprehensive research across the codebase to answer user questions by spawning parallel sub-agents and synthesizing their findings.
This command is for research and documentation only. You must NOT:
working-notes/Your only outputs are: questions to the user and the final research document.
When this command is invoked, if you already think you know what the user wants to research, confirm that with the user. If you do not know, respond with:
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.
Then wait for the user's research query.
If the user's research goal was not provided in the command arguments, ask about it before proceeding:
If the research goal was provided, proceed directly to research unless something in the goal statement is ambiguous or prompts clarifying questions about:
When you encounter an ambiguity, uncertainty, or decision point during research:
Examples of when to stop and ask:
The final document should have ZERO open questions - all ambiguities must be resolved through conversation before generating the document.
Read any directly mentioned files first:
Analyze and decompose the research question:
Spawn parallel sub-agent tasks for comprehensive research:
For codebase research:
workflow-tools:codebase-locator agent to find WHERE files and components liveworkflow-tools:codebase-analyzer agent to understand HOW specific code worksworkflow-tools:codebase-pattern-finder agent if you need examples of similar implementationsFor working-notes/ directory:
workflow-tools:notes-locator agent to discover what documents exist about the topicworkflow-tools:notes-analyzer agent to extract key insights from specific documents (only the most relevant ones)For web research:
workflow-tools:web-search-researcher agent for external documentation and resourcesFor historical context:
workflow-tools:jira agent to search for relevant Jira issues that may provide business contextworkflow-tools:git-history agent to search git history, PRs, and PR comments for implementation context and technical decisionsThe key is to use these agents intelligently:
Wait for all sub-agents to complete and synthesize findings:
working-notes/ findings, and web research)working-notes/ findings as supplementary historical contextGather metadata for the research document:
working-notes/{YYYY-MM-DD}_research_[descriptive-name].md. Use date '+%Y-%m-%d' for the timestamp in the filename.${CLAUDE_PLUGIN_ROOT}/skills/frontmatter/workflow-tools-frontmatter.shGenerate research document:
Use the metadata gathered in the previous step
Structure the document with YAML frontmatter followed by content:
---
date: [Current date and time with timezone in ISO format]
git_commit: [Current commit hash]
branch: [Current branch name]
repository: [Repository name]
topic: "[User's Question/Topic]"
tags: [research, codebase, relevant-component-names]
last_updated: [Current date in YYYY-MM-DD format]
---
# Research: [User's Question/Topic]
**Date**: [Current date and time with timezone from step 4]
**Git Commit**: [Current commit hash from step 4]
**Branch**: [Current branch name from step 4]
**Repository**: [Repository name]
## Research Question
[Original user query]
## Summary
[High-level findings answering the user's question]
## Detailed Findings
### [Component/Area 1]
- Finding with reference ([file.ext:line](link))
- Connection to other components
- Implementation details
### [Component/Area 2]
...
## Code References
- `path/to/file.py:123` - Description of what's there
- `another/file.ts:45-67` - Description of the code block
## Architecture Insights
[Patterns, conventions, and design decisions discovered]
## Historical Context
[Relevant insights from `working-notes/` directory and any relevant Jira issues. Include references for all insights.]
## Related Research
[Links to past research documents in `working-notes/`]
## Future Research Directions
[Optional: Areas outside the current scope that could be explored in follow-up research]
Finalize Document Quality:
This step must be completed before presenting findings to the user.
7.1: Check for External Review Configuration
Check if external review is configured:
echo "${CLAUDE_EXTERNAL_REVIEW_COMMAND:-NOT_SET}"
7.2: Run External Review (if configured)
If the variable shows NOT_SET or is empty:
If external review IS configured:
The environment variable contains one or more review commands separated by : (colon-space).
Examples:
opencode --model github-copilot/gpt-5 runopencode --model github-copilot/gpt-5 run: opencode --model deepseek/deepseek-v3 runFor each review command (process them sequentially):
a. Extract the command (split on : delimiter if multiple)
b. Run the external review: Execute the command with this review prompt:
${COMMAND} "Review the research document at [DOCUMENT_PATH] and provide detailed feedback on:
1. Factual accuracy and completeness of findings
2. Alignment with project architecture and patterns (check CLAUDE.md and codebase)
3. Missing connections or relationships between components
4. Missing important considerations or context
5. Incorrect interpretations of code or architecture
6. Missing references or citations (file paths, line numbers)
7. Gaps in answering the original research question
Be specific about what's missing or incorrect. Cite file paths and line numbers where relevant. Focus on actionable improvements."
c. Analyze feedback with extreme skepticism:
d. Silently address ONLY critical issues:
e. If multiple reviewers: Each subsequent reviewer sees the updated document from the previous review
Do NOT present reviews to the user - this is an internal quality check.
7.3: Document Ready for Presentation
The research document has been written and quality-checked. Ready to present to user.
Add GitHub permalinks (if applicable):
git branch --show-current and git statusgh repo view --json owner,namehttps://github.com/{}/{repo}/blob/{commit}/{file}#L{line}Present findings to user:
Present to the user:
Handle follow-up questions:
last_updated and last_updated_by to reflect the updatelast_updated_note: "Added follow-up research for [brief description]" to frontmatter## Follow-up Research [timestamp]working-notes/ directory provides historical context to supplement live findingsworking-notes/ directory, not just research subdirectorylast_updated, git_commit)working-notes/$ARGUMENTS