research
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseResearch Skill
研究Skill
Orchestrate parallel scientist agents for comprehensive research workflows with optional AUTO mode for fully autonomous execution.
编排并行Scientist Agent以实现全面的研究工作流,可选AUTO模式支持完全自主执行。
Overview
概述
Research is a multi-stage workflow that decomposes complex research goals into parallel investigations:
- Decomposition - Break research goal into independent stages/hypotheses
- Execution - Run parallel scientist agents on each stage
- Verification - Cross-validate findings, check consistency
- Synthesis - Aggregate results into comprehensive report
研究是一个多阶段工作流,将复杂研究目标分解为并行研究任务:
- 分解 - 将研究目标拆分为独立的阶段/假设
- 执行 - 为每个阶段运行并行Scientist Agent
- 验证 - 交叉验证研究结果,检查一致性
- 合成 - 将结果汇总为全面报告
Usage Examples
使用示例
/oh-my-claudecode:research <goal> # Standard research with user checkpoints
/oh-my-claudecode:research AUTO: <goal> # Fully autonomous until complete
/oh-my-claudecode:research status # Check current research session status
/oh-my-claudecode:research resume # Resume interrupted research session
/oh-my-claudecode:research list # List all research sessions
/oh-my-claudecode:research report <session-id> # Generate report for session/oh-my-claudecode:research <goal> # 带用户检查点的标准研究
/oh-my-claudecode:research AUTO: <goal> # 完全自主执行直至完成
/oh-my-claudecode:research status # 查看当前研究会话状态
/oh-my-claudecode:research resume # 恢复中断的研究会话
/oh-my-claudecode:research list # 列出所有研究会话
/oh-my-claudecode:research report <session-id> # 为指定会话生成报告Quick Examples
快速示例
/oh-my-claudecode:research What are the performance characteristics of different sorting algorithms?
/oh-my-claudecode:research AUTO: Analyze authentication patterns in this codebase
/oh-my-claudecode:research How does the error handling work across the API layer?/oh-my-claudecode:research What are the performance characteristics of different sorting algorithms?
/oh-my-claudecode:research AUTO: Analyze authentication patterns in this codebase
/oh-my-claudecode:research How does the error handling work across the API layer?Research Protocol
研究协议
Stage Decomposition Pattern
阶段分解模式
When given a research goal, decompose into 3-7 independent stages:
markdown
undefined给定研究目标后,将其分解为3-7个独立阶段:
markdown
undefinedResearch Decomposition
研究分解
Goal: <original research goal>
目标: <原始研究目标>
Stage 1: <stage-name>
阶段1: <阶段名称>
- Focus: What this stage investigates
- Hypothesis: Expected finding (if applicable)
- Scope: Files/areas to examine
- Tier: LOW | MEDIUM | HIGH
- 重点: 本阶段研究内容
- 假设: 预期发现(如适用)
- 范围: 需检查的文件/领域
- 等级: LOW | MEDIUM | HIGH
Stage 2: <stage-name>
阶段2: <阶段名称>
...
undefined...
undefinedParallel Scientist Invocation
并行Scientist调用
Fire independent stages in parallel via Task tool:
// Stage 1 - Simple data gathering
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[RESEARCH_STAGE:1] Investigate...")
// Stage 2 - Standard analysis
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[RESEARCH_STAGE:2] Analyze...")
// Stage 3 - Complex reasoning
Task(subagent_type="oh-my-claudecode:scientist-high", model="opus", prompt="[RESEARCH_STAGE:3] Deep analysis of...")通过Task工具并行触发独立阶段:
// 阶段1 - 简单数据收集
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[RESEARCH_STAGE:1] Investigate...")
// 阶段2 - 标准分析
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[RESEARCH_STAGE:2] Analyze...")
// 阶段3 - 复杂推理
Task(subagent_type="oh-my-claudecode:scientist-high", model="opus", prompt="[RESEARCH_STAGE:3] Deep analysis of...")Smart Model Routing
智能模型路由
CRITICAL: Always pass parameter explicitly!
model| Task Complexity | Agent | Model | Use For |
|---|---|---|---|
| Data gathering | | haiku | File enumeration, pattern counting, simple lookups |
| Standard analysis | | sonnet | Code analysis, pattern detection, documentation review |
| Complex reasoning | | opus | Architecture analysis, cross-cutting concerns, hypothesis validation |
重要提示:务必显式传递参数!
model| 任务复杂度 | Agent | 模型 | 适用场景 |
|---|---|---|---|
| 数据收集 | | haiku | 文件枚举、模式统计、简单查询 |
| 标准分析 | | sonnet | 代码分析、模式检测、文档审阅 |
| 复杂推理 | | opus | 架构分析、横切关注点研究、假设验证 |
Routing Decision Guide
路由决策指南
| Research Task | Tier | Example Prompt |
|---|---|---|
| "Count occurrences of X" | LOW | "Count all usages of useState hook" |
| "Find all files matching Y" | LOW | "List all test files in the project" |
| "Analyze pattern Z" | MEDIUM | "Analyze error handling patterns in API routes" |
| "Document how W works" | MEDIUM | "Document the authentication flow" |
| "Explain why X happens" | HIGH | "Explain why race conditions occur in the cache layer" |
| "Compare approaches A vs B" | HIGH | "Compare Redux vs Context for state management here" |
| 研究任务 | 等级 | 示例提示 |
|---|---|---|
| "统计X的出现次数" | LOW | "统计useState钩子的所有用法" |
| "查找所有匹配Y的文件" | LOW | "列出项目中的所有测试文件" |
| "分析模式Z" | MEDIUM | "分析API路由中的错误处理模式" |
| "记录W的工作原理" | MEDIUM | "记录认证流程" |
| "解释X发生的原因" | HIGH | "解释缓存层中竞态条件发生的原因" |
| "比较方法A与B" | HIGH | "比较Redux与Context在此处的状态管理效果" |
Verification Loop
验证循环
After parallel execution completes, verify findings:
// Cross-validation stage
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="
[RESEARCH_VERIFICATION]
Cross-validate these findings for consistency:
Stage 1 findings: <summary>
Stage 2 findings: <summary>
Stage 3 findings: <summary>
Check for:
1. Contradictions between stages
2. Missing connections
3. Gaps in coverage
4. Evidence quality
Output: [VERIFIED] or [CONFLICTS:<list>]
")并行执行完成后,验证研究结果:
// 交叉验证阶段
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="
[RESEARCH_VERIFICATION]
交叉验证以下结果的一致性:
阶段1结果: <摘要>
阶段2结果: <摘要>
阶段3结果: <摘要>
检查内容:
1. 各阶段之间的矛盾
2. 缺失的关联
3. 覆盖缺口
4. 证据质量
输出: [VERIFIED] 或 [CONFLICTS:<列表>]
")AUTO Mode
AUTO模式
AUTO mode runs the complete research workflow autonomously with loop control.
AUTO模式通过循环控制自主运行完整的研究工作流。
Loop Control Protocol
循环控制协议
[RESEARCH + AUTO - ITERATION {{ITERATION}}/{{MAX}}]
Your previous attempt did not output the completion promise. Continue working.
Current state: {{STATE}}
Completed stages: {{COMPLETED_STAGES}}
Pending stages: {{PENDING_STAGES}}[RESEARCH + AUTO - 迭代 {{ITERATION}}/{{MAX}}]
您上一次尝试未输出完成标记,请继续执行。
当前状态: {{STATE}}
已完成阶段: {{COMPLETED_STAGES}}
待处理阶段: {{PENDING_STAGES}}Promise Tags
标记说明
| Tag | Meaning | When to Use |
|---|---|---|
| Research finished successfully | All stages done, verified, report generated |
| Cannot proceed | Missing data, access issues, circular dependency |
| 标记 | 含义 | 使用场景 |
|---|---|---|
| 研究成功完成 | 所有阶段完成、验证通过、报告生成完毕 |
| 无法继续执行 | 数据缺失、访问问题、循环依赖 |
AUTO Mode Rules
AUTO模式规则
- Max Iterations: 10 (configurable)
- Continue until: Promise tag emitted OR max iterations
- State tracking: Persist after each stage completion
- Cancellation: or "stop", "cancel"
/oh-my-claudecode:cancel
- 最大迭代次数: 10次(可配置)
- 终止条件: 输出标记 或 达到最大迭代次数
- 状态跟踪: 每个阶段完成后持久化状态
- 取消方式: 或输入 "stop"、"cancel"
/oh-my-claudecode:cancel
AUTO Mode Example
AUTO模式示例
/oh-my-claudecode:research AUTO: Comprehensive security analysis of the authentication system
[Decomposition]
- Stage 1 (LOW): Enumerate auth-related files
- Stage 2 (MEDIUM): Analyze token handling
- Stage 3 (MEDIUM): Review session management
- Stage 4 (HIGH): Identify vulnerability patterns
- Stage 5 (MEDIUM): Document security controls
[Execution - Parallel]
Firing stages 1-3 in parallel...
Firing stages 4-5 after dependencies complete...
[Verification]
Cross-validating findings...
[Synthesis]
Generating report...
[PROMISE:RESEARCH_COMPLETE]/oh-my-claudecode:research AUTO: Comprehensive security analysis of the authentication system
[分解]
- 阶段1 (LOW): 枚举认证相关文件
- 阶段2 (MEDIUM): 分析令牌处理逻辑
- 阶段3 (MEDIUM): 审阅会话管理机制
- 阶段4 (HIGH): 识别漏洞模式
- 阶段5 (MEDIUM): 记录安全控制措施
[执行 - 并行]
并行触发阶段1-3...
依赖完成后触发阶段4-5...
[验证]
交叉验证结果...
[合成]
生成报告...
[PROMISE:RESEARCH_COMPLETE]Parallel Execution Patterns
并行执行模式
Independent Dataset Analysis (Parallel)
独立数据集分析(并行)
When stages analyze different data sources:
// All fire simultaneously
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[STAGE:1] Analyze src/api/...")
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[STAGE:2] Analyze src/utils/...")
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[STAGE:3] Analyze src/components/...")当各阶段分析不同数据源时:
// 同时触发所有任务
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[STAGE:1] Analyze src/api/...")
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[STAGE:2] Analyze src/utils/...")
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[STAGE:3] Analyze src/components/...")Hypothesis Battery (Parallel)
假设验证组(并行)
When testing multiple hypotheses:
// Test hypotheses simultaneously
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[HYPOTHESIS:A] Test if caching improves...")
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[HYPOTHESIS:B] Test if batching reduces...")
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[HYPOTHESIS:C] Test if lazy loading helps...")当测试多个假设时:
// 同时测试多个假设
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[HYPOTHESIS:A] Test if caching improves...")
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[HYPOTHESIS:B] Test if batching reduces...")
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[HYPOTHESIS:C] Test if lazy loading helps...")Cross-Validation (Sequential)
交叉验证(串行)
When verification depends on all findings:
// Wait for all parallel stages
[stages complete]
// Then sequential verification
Task(subagent_type="oh-my-claudecode:scientist-high", model="opus", prompt="
[CROSS_VALIDATION]
Validate consistency across all findings:
- Finding 1: ...
- Finding 2: ...
- Finding 3: ...
")当验证依赖所有研究结果时:
// 等待所有并行阶段完成
[stages complete]
// 然后执行串行验证
Task(subagent_type="oh-my-claudecode:scientist-high", model="opus", prompt="
[CROSS_VALIDATION]
验证所有结果的一致性:
- 结果1: ...
- 结果2: ...
- 结果3: ...
")Concurrency Limit
并发限制
Maximum 20 concurrent scientist agents to prevent resource exhaustion.
If more than 20 stages, batch them:
Batch 1: Stages 1-5 (parallel)
[wait for completion]
Batch 2: Stages 6-7 (parallel)最多允许20个并发Scientist Agent,以防止资源耗尽。
如果阶段超过20个,需分批处理:
批次1: 阶段1-5(并行)
[等待完成]
批次2: 阶段6-7(并行)Session Management
会话管理
Directory Structure
目录结构
.omc/research/{session-id}/
state.json # Session state and progress
stages/
stage-1.md # Stage 1 findings
stage-2.md # Stage 2 findings
...
findings/
raw/ # Raw findings from scientists
verified/ # Post-verification findings
figures/
figure-1.png # Generated visualizations
...
report.md # Final synthesized report.omc/research/{session-id}/
state.json # 会话状态与进度
stages/
stage-1.md # 阶段1结果
stage-2.md # 阶段2结果
...
findings/
raw/ # Scientist返回的原始结果
verified/ # 验证后的结果
figures/
figure-1.png # 生成的可视化图表
...
report.md # 最终合成报告State File Format
状态文件格式
json
{
"id": "research-20240115-abc123",
"goal": "Original research goal",
"status": "in_progress | complete | blocked | cancelled",
"mode": "standard | auto",
"iteration": 3,
"maxIterations": 10,
"stages": [
{
"id": 1,
"name": "Stage name",
"tier": "LOW | MEDIUM | HIGH",
"status": "pending | running | complete | failed",
"startedAt": "ISO timestamp",
"completedAt": "ISO timestamp",
"findingsFile": "stages/stage-1.md"
}
],
"verification": {
"status": "pending | passed | failed",
"conflicts": [],
"completedAt": "ISO timestamp"
},
"createdAt": "ISO timestamp",
"updatedAt": "ISO timestamp"
}json
{
"id": "research-20240115-abc123",
"goal": "原始研究目标",
"status": "in_progress | complete | blocked | cancelled",
"mode": "standard | auto",
"iteration": 3,
"maxIterations": 10,
"stages": [
{
"id": 1,
"name": "Stage name",
"tier": "LOW | MEDIUM | HIGH",
"status": "pending | running | complete | failed",
"startedAt": "ISO timestamp",
"completedAt": "ISO timestamp",
"findingsFile": "stages/stage-1.md"
}
],
"verification": {
"status": "pending | passed | failed",
"conflicts": [],
"completedAt": "ISO timestamp"
},
"createdAt": "ISO timestamp",
"updatedAt": "ISO timestamp"
}Session Commands
会话命令
| Command | Action |
|---|---|
| Show current session progress |
| Resume most recent interrupted session |
| Resume specific session |
| List all sessions with status |
| Generate/regenerate report |
| Cancel current session (preserves state) |
| 命令 | 操作 |
|---|---|
| 显示当前会话进度 |
| 恢复最近中断的会话 |
| 恢复指定会话 |
| 列出所有会话及其状态 |
| 生成/重新生成报告 |
| 取消当前会话(保留状态) |
Tag Extraction
标签提取
Scientists use structured tags for findings. Extract them with these patterns:
Scientist会为结果添加结构化标签,可通过以下模式提取:
Finding Tags
结果标签
[FINDING:<id>] <title>
<evidence and analysis>
[/FINDING]
[EVIDENCE:<finding-id>]
- File: <path>
- Lines: <range>
- Content: <relevant code/text>
[/EVIDENCE]
[CONFIDENCE:<level>] # HIGH | MEDIUM | LOW
<reasoning for confidence level>[FINDING:<id>] <标题>
<证据与分析>
[/FINDING]
[EVIDENCE:<finding-id>]
- 文件: <路径>
- 行号: <范围>
- 内容: <相关代码/文本>
[/EVIDENCE]
[CONFIDENCE:<level>] # HIGH | MEDIUM | LOW
<置信度等级的推理依据>Extraction Regex Patterns
提取正则表达式
javascript
// Finding extraction
const findingPattern = /\[FINDING:(\w+)\]\s*(.*?)\n([\s\S]*?)\[\/FINDING\]/g;
// Evidence extraction
const evidencePattern = /\[EVIDENCE:(\w+)\]([\s\S]*?)\[\/EVIDENCE\]/g;
// Confidence extraction
const confidencePattern = /\[CONFIDENCE:(HIGH|MEDIUM|LOW)\]\s*(.*)/g;
// Stage completion
const stageCompletePattern = /\[STAGE_COMPLETE:(\d+)\]/;
// Verification result
const verificationPattern = /\[(VERIFIED|CONFLICTS):?(.*?)\]/;javascript
// 结果提取
const findingPattern = /\[FINDING:(\w+)\]\s*(.*?)\n([\s\S]*?)\[\/FINDING\]/g;
// 证据提取
const evidencePattern = /\[EVIDENCE:(\w+)\]([\s\S]*?)\[\/EVIDENCE\]/g;
// 置信度提取
const confidencePattern = /\[CONFIDENCE:(HIGH|MEDIUM|LOW)\]\s*(.*)/g;
// 阶段完成标记
const stageCompletePattern = /\[STAGE_COMPLETE:(\d+)\]/;
// 验证结果标记
const verificationPattern = /\[(VERIFIED|CONFLICTS):?(.*?)\]/;Evidence Window
证据上下文范围
When extracting evidence, include context window:
[EVIDENCE:F1]
- File: /src/auth/login.ts
- Lines: 45-52 (context: 40-57)
- Content:
```typescript
// Lines 45-52 with 5 lines context above/below[/EVIDENCE]
undefined提取证据时需包含上下文范围:
[EVIDENCE:F1]
- 文件: /src/auth/login.ts
- 行号: 45-52(上下文: 40-57)
- 内容:
```typescript
// 包含上下5行的45-52行代码[/EVIDENCE]
undefinedQuality Validation
质量验证
Findings must meet quality threshold:
| Quality Check | Requirement |
|---|---|
| Evidence present | At least 1 [EVIDENCE] per [FINDING] |
| Confidence stated | Each finding has [CONFIDENCE] |
| Source cited | File paths are absolute and valid |
| Reproducible | Another agent could verify |
结果必须满足以下质量阈值:
| 质量检查 | 要求 |
|---|---|
| 存在证据 | 每个[FINDING]至少对应1个[EVIDENCE] |
| 声明置信度 | 每个结果都有[CONFIDENCE]标记 |
| 引用来源 | 文件路径为绝对路径且有效 |
| 可复现 | 其他Agent可验证结果 |
Report Generation
报告生成
Report Template
报告模板
markdown
undefinedmarkdown
undefinedResearch Report: {{GOAL}}
研究报告: {{GOAL}}
Session ID: {{SESSION_ID}}
Date: {{DATE}}
Status: {{STATUS}}
会话ID: {{SESSION_ID}}
日期: {{DATE}}
状态: {{STATUS}}
Executive Summary
执行摘要
{{2-3 paragraph summary of key findings}}
{{2-3段关键结果摘要}}
Methodology
研究方法
Research Stages
研究阶段
| Stage | Focus | Tier | Status |
|---|---|---|---|
| {{STAGES_TABLE}} |
| 阶段 | 重点 | 等级 | 状态 |
|---|---|---|---|
| {{STAGES_TABLE}} |
Approach
研究思路
{{Description of decomposition rationale and execution strategy}}
{{分解依据与执行策略说明}}
Key Findings
关键结果
Finding 1: {{TITLE}}
结果1: {{标题}}
Confidence: {{HIGH|MEDIUM|LOW}}
{{Detailed finding with evidence}}
置信度: {{HIGH|MEDIUM|LOW}}
{{带证据的详细结果}}
Evidence
证据
{{Embedded evidence blocks}}
{{嵌入的证据块}}
Finding 2: {{TITLE}}
结果2: {{标题}}
...
...
Visualizations
可视化图表
{{FIGURES}}
{{FIGURES}}
Cross-Validation Results
交叉验证结果
{{Verification summary, any conflicts resolved}}
{{验证摘要及已解决的冲突}}
Limitations
局限性
- {{Limitation 1}}
- {{Limitation 2}}
- {{Areas not covered and why}}
- {{局限性1}}
- {{局限性2}}
- {{未覆盖领域及原因}}
Recommendations
建议
- {{Actionable recommendation}}
- {{Actionable recommendation}}
- {{可执行建议}}
- {{可执行建议}}
Appendix
附录
Raw Data
原始数据
{{Links to raw findings files}}
{{原始结果文件链接}}
Session State
会话状态
{{Link to state.json}}
undefined{{state.json链接}}
undefinedFigure Embedding Protocol
图表嵌入协议
Scientists generate visualizations using this marker:
[FIGURE:path/to/figure.png]
Caption: Description of what the figure shows
Alt: Accessibility description
[/FIGURE]Report generator embeds figures:
markdown
undefinedScientist使用以下标记生成可视化图表:
[FIGURE:path/to/figure.png]
Caption: 图表说明
Alt: 无障碍描述
[/FIGURE]报告生成器会嵌入图表:
markdown
undefinedVisualizations
可视化图表
Caption: Description of what the figure shows
Caption: Description of what the figure showsundefined
说明: 图表展示内容
说明: 图表展示内容undefinedFigure Types
图表类型
| Type | Use For | Generated By |
|---|---|---|
| Architecture diagram | System structure | scientist-high |
| Flow chart | Process flows | scientist |
| Dependency graph | Module relationships | scientist |
| Timeline | Sequence of events | scientist |
| Comparison table | A vs B analysis | scientist |
| 类型 | 适用场景 | 生成Agent |
|---|---|---|
| 架构图 | 系统结构展示 | scientist-high |
| 流程图 | 流程展示 | scientist |
| 依赖图 | 模块关系展示 | scientist |
| 时间线 | 事件序列展示 | scientist |
| 对比表 | A与B分析对比 | scientist |
Configuration
配置
Optional settings in :
.claude/settings.jsonjson
{
"omc": {
"research": {
"maxIterations": 10,
"maxConcurrentScientists": 5,
"defaultTier": "MEDIUM",
"autoVerify": true,
"generateFigures": true,
"evidenceContextLines": 5
}
}
}可在中设置可选参数:
.claude/settings.jsonjson
{
"omc": {
"research": {
"maxIterations": 10,
"maxConcurrentScientists": 5,
"defaultTier": "MEDIUM",
"autoVerify": true,
"generateFigures": true,
"evidenceContextLines": 5
}
}
}Cancellation
取消操作
/oh-my-claudecode:cancelOr say: "stop research", "cancel research", "abort"
Progress is preserved in for resume.
.omc/research/{session-id}//oh-my-claudecode:cancel或输入:"stop research"、"cancel research"、"abort"
进度会保存在中,以便后续恢复。
.omc/research/{session-id}/Troubleshooting
故障排除
Stuck in verification loop?
- Check for conflicting findings between stages
- Review state.json for specific conflicts
- May need to re-run specific stages with different approach
Scientists returning low-quality findings?
- Check tier assignment - complex analysis needs HIGH tier
- Ensure prompts include clear scope and expected output format
- Review if research goal is too broad
AUTO mode exhausted iterations?
- Review state to see where it's stuck
- Check if goal is achievable with available data
- Consider breaking into smaller research sessions
Missing figures in report?
- Verify figures/ directory exists
- Check [FIGURE:] tags in findings
- Ensure paths are relative to session directory
验证循环卡住?
- 检查各阶段结果之间是否存在冲突
- 查看state.json中的具体冲突
- 可能需要以不同方法重新运行特定阶段
Scientist返回低质量结果?
- 检查等级分配 - 复杂分析需要HIGH等级
- 确保提示包含明确的范围和预期输出格式
- 检查研究目标是否过于宽泛
AUTO模式耗尽迭代次数?
- 查看状态以确定卡住的位置
- 检查目标是否可通过现有数据实现
- 考虑拆分为更小的研究会话
报告中缺少图表?
- 验证figures/目录是否存在
- 检查结果中的[FIGURE:]标记
- 确保路径相对于会话目录