discovery
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/discovery — Full Discovery Phase Orchestrator
/discovery — 全发现阶段编排器
Quick Ref: Brainstorm → search history → research → plan → pre-mortem. Produces an epic-id and execution-packet ready for./crank
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
快速参考: 头脑风暴 → 历史搜索 → 调研 → 规划 → 事前分析。生成可用于的epic-id和执行数据包。/crank
你必须执行此工作流,不能仅描述它。
Quick Start
快速开始
bash
/discovery "add user authentication" # full discovery
/discovery --interactive "refactor payment module" # human gates in research + plan
/discovery --skip-brainstorm "fix login bug" # skip brainstorm for specific goals
/discovery --complexity=full "migrate to v2 API" # force full council ceremonybash
/discovery "add user authentication" # 完整发现流程
/discovery --interactive "refactor payment module" # 在调研和规划阶段加入人工关卡
/discovery --skip-brainstorm "fix login bug" # 针对特定目标跳过头脑风暴
/discovery --complexity=full "migrate to v2 API" # 强制启用完整评审流程Architecture
架构
/discovery <goal> [--interactive] [--complexity=<fast|standard|full>] [--skip-brainstorm]
│
├── Step 1: Brainstorm (optional)
│ └── /brainstorm <goal> — clarify WHAT before HOW
│
├── Step 2: Search History
│ └── ao search "<goal keywords>" — surface prior learnings
│
├── Step 3: Research
│ └── /research <goal> — deep codebase exploration
│
├── Step 4: Plan
│ └── /plan <goal> — decompose into epic + issues
│
└── Step 5: Pre-mortem (gate)
└── /pre-mortem — council validates the plan
PASS/WARN → output epic-id + execution-packet
FAIL → re-plan with findings, max 3 attempts/discovery <goal> [--interactive] [--complexity=<fast|standard|full>] [--skip-brainstorm]
│
├── 步骤1:头脑风暴(可选)
│ └── /brainstorm <goal> — 先明确目标再考虑实现方式
│
├── 步骤2:历史搜索
│ └── ao search "<goal keywords>" — 挖掘过往经验
│
├── 步骤3:调研
│ └── /research <goal> — 深度探索代码库
│
├── 步骤4:规划
│ └── /plan <goal> — 分解为epic和任务
│
└── 步骤5:事前分析(关卡)
└── /pre-mortem — 评审团验证规划
通过/警告 → 输出epic-id + 执行数据包
失败 → 结合发现重新规划,最多3次尝试Execution Steps
执行步骤
Step 0: Setup
步骤0:设置
bash
mkdir -p .agents/rpiInitialize state:
discovery_state = {
goal: "<goal string>",
interactive: <true if --interactive>,
complexity: <fast|standard|full or null for auto-detect>,
skip_brainstorm: <true if --skip-brainstorm or goal is >50 chars and specific>,
epic_id: null,
attempt: 1,
verdict: null
}CLI dependency detection:
bash
undefinedbash
mkdir -p .agents/rpi初始化状态:
discovery_state = {
goal: "<goal string>",
interactive: <true if --interactive>,
complexity: <fast|standard|full or null for auto-detect>,
skip_brainstorm: <true if --skip-brainstorm or goal is >50 chars and specific>,
epic_id: null,
attempt: 1,
verdict: null
}CLI依赖检测:
bash
undefinedTracking mode
跟踪模式
if command -v bd &>/dev/null; then TRACKING_MODE="beads"; else TRACKING_MODE="tasklist"; fi
if command -v bd &>/dev/null; then TRACKING_MODE="beads"; else TRACKING_MODE="tasklist"; fi
Knowledge flywheel
知识飞轮
if command -v ao &>/dev/null; then AO_AVAILABLE=true; else AO_AVAILABLE=false; fi
undefinedif command -v ao &>/dev/null; then AO_AVAILABLE=true; else AO_AVAILABLE=false; fi
undefinedStep 1: Brainstorm (optional)
步骤1:头脑风暴(可选)
Skip if: flag, OR goal is >50 chars and contains no vague keywords (improve, better, something, somehow, maybe), OR a brainstorm artifact already exists for this goal in .
--skip-brainstorm.agents/brainstorm/Otherwise: Invoke to clarify WHAT before HOW:
/brainstormSkill(skill="brainstorm", args="<goal>")If brainstorm produces a refined goal, use the refined goal for subsequent steps.
跳过条件: 使用参数,或目标长度超过50字符且无模糊关键词(如improve、better、something、somehow、maybe),或中已存在该目标的头脑风暴产物。
--skip-brainstorm.agents/brainstorm/否则: 调用先明确目标再考虑实现方式:
/brainstormSkill(skill="brainstorm", args="<goal>")如果头脑风暴生成了优化后的目标,后续步骤将使用该优化目标。
Step 2: Search History
步骤2:历史搜索
Skip if: CLI is not available.
aoOtherwise: Search for prior session learnings relevant to the goal:
bash
ao search "<goal keywords>" 2>/dev/null || true
ao lookup --query "<goal keywords>" --limit 5 2>/dev/null || trueSummarize any relevant findings (prior attempts, related decisions, known constraints) and carry them forward as context for research.
Ranked packet requirement: Before leaving discovery, assemble a lightweight ranked packet for the current goal:
- matching compiled planning rules / pre-mortem checks
- matching active findings from
.agents/findings/*.md - matching unconsumed high-severity items from
.agents/rpi/next-work.jsonl
Rank by literal goal-text overlap first, then issue-type / work-shape overlap, then file-path or module overlap when known. Discovery does not need the final file list yet, but it MUST surface the best matching high-severity next-work items so planning can incorporate them instead of rediscovering them later.
跳过条件: CLI不可用。
ao否则: 搜索与目标相关的过往会话经验:
bash
ao search "<goal keywords>" 2>/dev/null || true
ao lookup --query "<goal keywords>" --limit 5 2>/dev/null || true总结所有相关发现(过往尝试、相关决策、已知约束),并作为调研阶段的上下文。
排序数据包要求: 在完成发现阶段前,需为当前目标整理一个轻量级排序数据包,包含:
- 匹配已编译的规划规则/事前分析检查项
- 匹配中的有效发现
.agents/findings/*.md - 匹配中未处理的高优先级事项
.agents/rpi/next-work.jsonl
排序规则:首先按目标文本字面匹配度排序,其次按任务类型/工作形态匹配度排序,已知文件路径或模块时按模块匹配度排序。发现阶段无需最终文件列表,但必须筛选出最匹配的高优先级待办事项,以便规划阶段直接纳入,避免后续重复发现。
Step 3: Research
步骤3:调研
Invoke for deep codebase exploration:
/researchSkill(skill="research", args="<goal> [--auto]")Pass unless was specified. Research output lands in .
--auto--interactive.agents/research/调用进行代码库深度探索:
/researchSkill(skill="research", args="<goal> [--auto]")除非指定,否则传递参数。调研结果将保存至。
--interactive--auto.agents/research/Step 3.1: Identify Applicable Test Levels
步骤3.1:确定适用的测试级别
After research completes, determine which test levels (L0–L3) the goal requires. Read the test pyramid standard ( in the standards skill) for the full pyramid and selection guide.
test-pyramid.mdAsk:
- Does the change touch external APIs or I/O? → L0 + L1 + L2 minimum
- Does it cross module boundaries? → Add L2
- Does it affect a full subsystem workflow? → Add L3
Record the applicable levels in for downstream consumption.
discovery_state.test_levels/plan调研完成后,确定目标所需的测试级别(L0–L3)。请阅读标准文档中的测试金字塔规范(standards skill中的)获取完整金字塔模型和选择指南。
test-pyramid.md思考:
- 变更是否涉及外部API或I/O?→ 至少需要L0 + L1 + L2
- 是否跨模块边界?→ 增加L2
- 是否影响完整子系统工作流?→ 增加L3
将适用的测试级别记录到,供下游使用。
discovery_state.test_levels/planStep 4: Plan
步骤4:规划
Invoke to decompose into an epic with trackable issues:
/planSkill(skill="plan", args="<goal> [--auto]")Pass unless was specified. Plan output lands in and creates issues via or TaskList.
--auto--interactive.agents/plans/bdAfter plan completes:
- Extract epic ID: (beads) or identify from TaskList.
bd list --type epic --status open - Store in .
discovery_state.epic_id - Carry forward the ranked packet summary (applied findings, known risks, high-severity next-work matches) into the execution packet and phase summary.
- Auto-detect complexity (if not overridden):
- Count issues:
bd children <epic-id> | wc -l - Low: 1-2 issues →
fast - Medium: 3-6 issues →
standard - High: 7+ issues or 3+ waves →
full
- Count issues:
调用将目标分解为包含可跟踪任务的epic:
/planSkill(skill="plan", args="<goal> [--auto]")除非指定,否则传递参数。规划结果将保存至,并通过或TaskList创建任务。
--interactive--auto.agents/plans/bd规划完成后:
- 提取epic ID:(beads模式)或从TaskList中识别。
bd list --type epic --status open - 保存至。
discovery_state.epic_id - 将排序数据包摘要(已应用的发现、已知风险、匹配的高优先级待办事项)纳入执行数据包和阶段总结。
- 自动检测复杂度(未指定时):
- 统计任务数量:
bd children <epic-id> | wc -l - 低复杂度:1-2个任务 →
fast - 中复杂度:3-6个任务 →
standard - 高复杂度:7个及以上任务或3个及以上阶段 →
full
- 统计任务数量:
Step 5: Pre-mortem (gate)
步骤5:事前分析(关卡)
Invoke to validate the plan:
/pre-mortemSkill(skill="pre-mortem", args="[--quick]")Use for fast/standard complexity. Use full council (no ) for full complexity or override.
--quick--quick--deepGate logic (max 3 attempts):
- PASS/WARN: Proceed. Store verdict in .
discovery_state.verdict - FAIL: Retry loop:
- Read pre-mortem report:
ls -t .agents/council/*pre-mortem*.md | head -1 - Extract structured findings (description, fix, ref)
- Log:
"Pre-mortem: FAIL (attempt N/3) -- retrying plan with feedback" - Re-invoke with findings context:
/planSkill(skill="plan", args="<goal> --auto --context 'Pre-mortem FAIL: <findings>'") - Re-invoke
/pre-mortem - If still FAIL after 3 total attempts, stop:
Output:
"Pre-mortem failed 3 times. Last report: <path>. Manual intervention needed."<promise>BLOCKED</promise>
- Read pre-mortem report:
调用验证规划:
/pre-mortemSkill(skill="pre-mortem", args="[--quick]")快速/标准复杂度使用参数,完整复杂度或覆盖时使用完整评审流程(不添加)。
--quick--deep--quick关卡逻辑(最多3次尝试):
- 通过/警告: 继续执行。将结果保存至。
discovery_state.verdict - 失败: 重试循环:
- 读取事前分析报告:
ls -t .agents/council/*pre-mortem*.md | head -1 - 提取结构化发现(描述、修复方案、参考)
- 记录日志:
"Pre-mortem: FAIL (attempt N/3) -- retrying plan with feedback" - 结合发现上下文重新调用:
/planSkill(skill="plan", args="<goal> --auto --context 'Pre-mortem FAIL: <findings>'") - 重新调用
/pre-mortem - 如果3次尝试均失败,停止执行:
输出:
"Pre-mortem failed 3 times. Last report: <path>. Manual intervention needed."<promise>BLOCKED</promise>
- 读取事前分析报告:
Step 6: Output
步骤6:输出
After successful gate (PASS/WARN): write execution packet and phase summary (read for formats), record ratchet, output , and report epic-id with suggested next step: . Include from Step 3.1 in the execution packet for consumption.
references/output-templates.md<promise>DONE</promise>/crank <epic-id>test_levels/crank关卡通过后(通过/警告):编写执行数据包和阶段总结(格式参考),记录进度,输出,并返回epic-id及建议下一步操作:。执行数据包中需包含步骤3.1的,供使用。
references/output-templates.md<promise>DONE</promise>/crank <epic-id>test_levels/crankFlags
参数
| Flag | Default | Description |
|---|---|---|
| off | Human gates in research and plan |
| auto | Skip brainstorm step |
| auto | Force complexity level (fast/standard/full) |
| off | Disable phase time budgets |
| 参数 | 默认值 | 描述 |
|---|---|---|
| 关闭 | 在调研和规划阶段加入人工关卡 |
| 自动 | 跳过头脑风暴步骤 |
| 自动 | 强制指定复杂度级别(fast/standard/full) |
| 关闭 | 禁用阶段时间预算 |
Completion Markers
完成标记
<promise>DONE</promise> # Discovery complete, epic-id + execution-packet ready
<promise>BLOCKED</promise> # Pre-mortem failed 3x, manual intervention needed<promise>DONE</promise> # 发现阶段完成,epic-id + 执行数据包已就绪
<promise>BLOCKED</promise> # 事前分析3次失败,需人工干预Examples
示例
bash
/discovery "add user authentication" # full discovery
/discovery --interactive "refactor payment module" # human gates
/discovery --skip-brainstorm "fix login bug" # skip brainstormbash
/discovery "add user authentication" # 完整发现流程
/discovery --interactive "refactor payment module" # 启用人工关卡
/discovery --skip-brainstorm "fix login bug" # 跳过头脑风暴Troubleshooting
故障排除
Read for common problems and solutions.
references/troubleshooting.md请阅读获取常见问题及解决方案。
references/troubleshooting.mdReference Documents
参考文档
- references/complexity-auto-detect.md — precedence contract for keyword vs issue-count classification
- references/idempotency-and-resume.md — re-run safety and resume behavior
- references/phase-budgets.md — time budgets per complexity level
- references/troubleshooting.md — common problems and solutions
- references/output-templates.md — execution packet and phase summary formats
See also: brainstorm, research, plan, pre-mortem, crank, rpi
- references/complexity-auto-detect.md — 关键词与任务数量分类的优先级约定
- references/idempotency-and-resume.md — 重入安全与恢复机制
- references/phase-budgets.md — 不同复杂度级别的时间预算
- references/troubleshooting.md — 常见问题及解决方案
- references/output-templates.md — 执行数据包与阶段总结格式
另请参阅: brainstorm, research, plan, pre-mortem, crank, rpi