maestro-flow-one 0.2.33 → 0.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/maestro-flow/commands/learn/investigate.md +151 -152
  2. package/maestro-flow/commands/learn/second-opinion.md +118 -122
  3. package/maestro-flow/commands/lifecycle/analyze.md +215 -266
  4. package/maestro-flow/commands/lifecycle/blueprint.md +189 -204
  5. package/maestro-flow/commands/lifecycle/brainstorm.md +209 -213
  6. package/maestro-flow/commands/lifecycle/companion.md +531 -531
  7. package/maestro-flow/commands/lifecycle/composer.md +188 -179
  8. package/maestro-flow/commands/lifecycle/execute.md +183 -184
  9. package/maestro-flow/commands/lifecycle/fork.md +111 -110
  10. package/maestro-flow/commands/lifecycle/grill.md +175 -176
  11. package/maestro-flow/commands/lifecycle/guard.md +103 -102
  12. package/maestro-flow/commands/lifecycle/impeccable.md +311 -268
  13. package/maestro-flow/commands/lifecycle/init.md +130 -131
  14. package/maestro-flow/commands/lifecycle/merge.md +87 -80
  15. package/maestro-flow/commands/lifecycle/next.md +253 -257
  16. package/maestro-flow/commands/lifecycle/overlay.md +188 -178
  17. package/maestro-flow/commands/lifecycle/plan.md +225 -211
  18. package/maestro-flow/commands/lifecycle/quick.md +83 -77
  19. package/maestro-flow/commands/lifecycle/roadmap.md +173 -186
  20. package/maestro-flow/commands/lifecycle/swarm-workflow.md +243 -264
  21. package/maestro-flow/commands/lifecycle/tools-execute.md +122 -117
  22. package/maestro-flow/commands/lifecycle/tools-register.md +162 -157
  23. package/maestro-flow/commands/lifecycle/ui-codify.md +117 -100
  24. package/maestro-flow/commands/lifecycle/universal-workflow.md +548 -561
  25. package/maestro-flow/commands/lifecycle/update.md +122 -119
  26. package/maestro-flow/commands/manage/codebase-rebuild.md +87 -85
  27. package/maestro-flow/commands/manage/harvest.md +97 -95
  28. package/maestro-flow/commands/manage/issue-discover.md +83 -81
  29. package/maestro-flow/commands/manage/issue.md +72 -73
  30. package/maestro-flow/commands/manage/kg-extractors.md +128 -0
  31. package/maestro-flow/commands/manage/knowhow-capture.md +92 -82
  32. package/maestro-flow/commands/manage/knowhow.md +83 -79
  33. package/maestro-flow/commands/manage/knowledge-audit.md +105 -88
  34. package/maestro-flow/commands/manage/status.md +62 -52
  35. package/maestro-flow/commands/manage/wiki.md +82 -71
  36. package/maestro-flow/commands/milestone/audit.md +4 -10
  37. package/maestro-flow/commands/milestone/complete.md +6 -7
  38. package/maestro-flow/commands/milestone/release.md +136 -145
  39. package/maestro-flow/commands/quality/auto-test.md +153 -136
  40. package/maestro-flow/commands/quality/debug.md +159 -120
  41. package/maestro-flow/commands/quality/refactor.md +105 -67
  42. package/maestro-flow/commands/quality/retrospective.md +123 -77
  43. package/maestro-flow/commands/quality/review.md +155 -128
  44. package/maestro-flow/commands/quality/sync.md +88 -52
  45. package/maestro-flow/commands/quality/test.md +147 -117
  46. package/maestro-flow/commands/spec/add.md +77 -70
  47. package/maestro-flow/commands/spec/setup.md +49 -52
  48. package/package.json +1 -1
@@ -1,152 +1,151 @@
1
- ---
2
- name: learn-investigate
3
- description: Investigate questions with hypothesis testing and evidence logging
4
- argument-hint: "<question> [--scope <path>] [--max-hypotheses N]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Bash
9
- - Glob
10
- - Grep
11
- - Agent
12
- - AskUserQuestion
13
- ---
14
- <purpose>
15
- Systematic investigation for understanding questions (not bug-fixing). 4-phase scientific method with scope lock and 3-strike escalation. Produces evidence trails and understanding docs that persist to the learning system.
16
-
17
- Unlike `quality-debug` (fix bugs during execution), this answers "how does X work?", "why does Y happen?", "what if Z?".
18
- </purpose>
19
-
20
- <context>
21
- $ARGUMENTS — question text and optional flags.
22
-
23
- **Flags**:
24
- - `--scope <path>`: Restrict to files under this dir (default: entire project)
25
- - `--max-hypotheses N`: Max hypotheses before escalation (default: 3)
26
-
27
- **Storage write**:
28
- - `.workflow/knowhow/KNW-investigate-{slug}/evidence.ndjson` — structured evidence (one JSON line per item)
29
- - `.workflow/knowhow/KNW-investigate-{slug}/understanding.md` — evolving understanding
30
- - `.workflow/knowhow/KNW-investigate-{slug}/report.md` — final report
31
- - `.workflow/specs/learnings.md` — appended `<spec-entry>` blocks
32
-
33
- **Storage read**: source files in scope + `maestro search` + `.workflow/specs/learnings.md` + `debug-notes.md` + `codebase/architecture.md`
34
- </context>
35
-
36
- <state_machine>
37
-
38
- <states>
39
- S_FRAME 解析问题、确定 scope、搜索先验知识 PERSIST: understanding.md (initial)
40
- S_EVIDENCE 系统收集证据 PERSIST: evidence.ndjson
41
- S_PATTERN 比对已知模式 PERSIST: understanding.md (patterns)
42
- S_HYPOTHESIZE生成假设列表 PERSIST: understanding.md (hypotheses)
43
- S_CLI_EXPLORE CLI 辅助探索(可选) PERSIST: evidence.ndjson (append)
44
- S_TEST 逐假设测试 PERSIST: evidence.ndjson + understanding.md
45
- S_ESCALATE 3-strike 升级 PERSIST:
46
- S_REPORT — 综合报告 + persist PERSIST: report.md + .workflow/specs/learnings.md
47
- </states>
48
-
49
- <transitions>
50
-
51
- S_FRAME:
52
- → S_EVIDENCE DO: A_FRAME_QUESTION
53
-
54
- S_EVIDENCE:
55
- → S_PATTERN DO: A_COLLECT_EVIDENCE
56
-
57
- S_PATTERN:
58
- → S_HYPOTHESIZE DO: match evidence against debug-notes.md + .workflow/specs/learnings.md patterns
59
-
60
- S_HYPOTHESIZE:
61
- S_CLI_EXPLORE WHEN: CLI tools enabled AND hypotheses non-trivial DO: A_FORM_HYPOTHESES
62
- → S_TEST WHEN: no CLI tools OR trivial hypotheses DO: A_FORM_HYPOTHESES
63
-
64
- S_CLI_EXPLORE:
65
- → S_TEST DO: A_CLI_SUPPLEMENT (maestro delegate --role explore --mode analysis, run_in_background, STOP)
66
-
67
- S_TEST:
68
- → S_REPORT WHEN: hypothesis confirmed DO: A_TEST_HYPOTHESIS
69
- S_REPORT WHEN: all hypotheses tested (some confirmed) DO: A_TEST_HYPOTHESIS
70
- → S_ESCALATE WHEN: max_hypotheses all failed DO: A_TEST_HYPOTHESIS
71
-
72
- S_ESCALATE:
73
- S_HYPOTHESIZE WHEN: user broadens scope or provides new hypothesis DO: AskUserQuestion
74
- → S_REPORT WHEN: user selects "Escalate" or still stuck DO: mark INCONCLUSIVE
75
-
76
- S_REPORT:
77
- → END DO: A_SYNTHESIZE_REPORT
78
-
79
- </transitions>
80
-
81
- <actions>
82
-
83
- ### A_FRAME_QUESTION
84
-
85
- 1. Parse question, generate slug, create KNW-investigate-{slug}/
86
- 2. Search prior knowledge: `maestro search "<question>"` + search .workflow/specs/learnings.md + read debug-notes.md
87
- 3. Write initial understanding.md (question, prior knowledge summary, scope, timestamp)
88
-
89
- ### A_COLLECT_EVIDENCE
90
-
91
- Parallel evidence gathering:
92
- 1. Code search: Grep keywords from question
93
- 2. File inspection: Read most relevant files
94
- 3. Import tracing: follow dependency chain
95
- 4. Git history: `git log --oneline -10 -- <relevant-files>`
96
-
97
- Each item → append evidence.ndjson: `{ts, type (code|git|search|doc), source (file:line), relevance (high|medium|low), content, note}`
98
-
99
- ### A_FORM_HYPOTHESES
100
-
101
- Generate ranked hypotheses: each is specific, testable claim about "how/why".
102
- Rank by plausibility (evidence strength). Write to understanding.md:
103
- - `[HIGH]` hypothesis — Evidence: {refs}
104
- - `[MEDIUM]` hypothesis — Evidence: {refs}
105
-
106
- ### A_CLI_SUPPLEMENT
107
-
108
- ```
109
- maestro delegate "PURPOSE: Gather evidence for hypotheses
110
- TASK: Trace call chains and data flows per hypothesis | Find corroborating/contradicting patterns
111
- EXPECTED: JSON [{hypothesis_rank, evidence: [{file, line, supports: bool, explanation}]}]
112
- " --role explore --mode analysis
113
- ```
114
- Run_in_background, STOP, wait. On callback: append to evidence.ndjson.
115
-
116
- ### A_TEST_HYPOTHESIS
117
-
118
- For each hypothesis (rank order):
119
- 1. Design test: what evidence would confirm/disprove?
120
- 2. Execute: code trace, targeted search, data inspection
121
- 3. Record: append evidence.ndjson with type: "test"
122
- 4. Update: mark hypothesis confirmed / disproved / inconclusive
123
-
124
- ### A_SYNTHESIZE_REPORT
125
-
126
- Write report.md: Answer (or INCONCLUSIVE), Evidence Trail table, Hypotheses Tested table, Key Learnings, Open Questions.
127
- Append to .workflow/specs/learnings.md: confirmed → roles="implement", disproved → roles="analyze" (gotcha).
128
-
129
- </actions>
130
-
131
- </state_machine>
132
-
133
- <error_codes>
134
- | Code | Condition | Recovery |
135
- |------|-----------|----------|
136
- | E002 | --scope path not found | Check path |
137
- | W002 | Very few evidence matches (<3) | Broaden search terms or expand scope |
138
- | W003 | All hypotheses inconclusive | Investigation marked INCONCLUSIVE |
139
- </error_codes>
140
-
141
- <success_criteria>
142
- - [ ] Evidence collected and logged to evidence.ndjson (structured NDJSON)
143
- - [ ] At least 1 hypothesis formed and tested
144
- - [ ] 3-strike escalation triggered if all fail
145
- - [ ] Report + spec-entry blocks written
146
- </success_criteria>
147
-
148
- <next_step_routing>
149
- - Save to specs → `/spec-add debug <finding>`
150
- - Follow code → `/learn-follow <path>`
151
- - Decompose patterns → `/learn-decompose <module>`
152
- </next_step_routing>
1
+ ---
2
+ name: learn-investigate
3
+ description: Investigate questions with hypothesis testing and evidence logging
4
+ argument-hint: "<question> [--scope <path>] [--max-hypotheses N]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Agent
12
+ - AskUserQuestion
13
+ ---
14
+ <purpose>
15
+ Systematic investigation for understanding questions (not bug-fixing).
16
+ 4-phase scientific method with scope lock, 3-strike escalation, and evidence persistence.
17
+ </purpose>
18
+
19
+ <context>
20
+ $ARGUMENTS — question text and optional flags.
21
+
22
+ **Flags**:
23
+ - `--scope <path>`: Restrict to files under this dir (default: entire project)
24
+ - `--max-hypotheses N`: Max hypotheses before escalation (default: 3)
25
+
26
+ **Storage write**:
27
+ - `.workflow/knowhow/KNW-investigate-{slug}/evidence.ndjson` — structured evidence (one JSON line per item)
28
+ - `.workflow/knowhow/KNW-investigate-{slug}/understanding.md` — evolving understanding
29
+ - `.workflow/knowhow/KNW-investigate-{slug}/report.md` — final report
30
+ - `.workflow/specs/learnings.md` — appended `<spec-entry>` blocks
31
+
32
+ **Storage read**: source files in scope + `maestro search` + `.workflow/specs/learnings.md` + `debug-notes.md` + `codebase/architecture.md`
33
+ </context>
34
+
35
+ <state_machine>
36
+
37
+ <states>
38
+ S_FRAME — 解析问题、确定 scope、搜索先验知识 PERSIST: understanding.md (initial)
39
+ S_EVIDENCE 系统收集证据 PERSIST: evidence.ndjson
40
+ S_PATTERN 比对已知模式 PERSIST: understanding.md (patterns)
41
+ S_HYPOTHESIZE 生成假设列表 PERSIST: understanding.md (hypotheses)
42
+ S_CLI_EXPLORECLI 辅助探索(可选) PERSIST: evidence.ndjson (append)
43
+ S_TEST 逐假设测试 PERSIST: evidence.ndjson + understanding.md
44
+ S_ESCALATE 3-strike 升级 PERSIST:
45
+ S_REPORT 综合报告 + persist PERSIST: report.md + .workflow/specs/learnings.md
46
+ </states>
47
+
48
+ <transitions>
49
+
50
+ S_FRAME:
51
+ → S_EVIDENCE DO: A_FRAME_QUESTION
52
+
53
+ S_EVIDENCE:
54
+ → S_PATTERN DO: A_COLLECT_EVIDENCE
55
+
56
+ S_PATTERN:
57
+ → S_HYPOTHESIZE DO: match evidence against debug-notes.md + .workflow/specs/learnings.md patterns
58
+
59
+ S_HYPOTHESIZE:
60
+ → S_CLI_EXPLORE WHEN: CLI tools enabled AND hypotheses non-trivial DO: A_FORM_HYPOTHESES
61
+ S_TEST WHEN: no CLI tools OR trivial hypotheses DO: A_FORM_HYPOTHESES
62
+
63
+ S_CLI_EXPLORE:
64
+ → S_TEST DO: A_CLI_SUPPLEMENT (maestro delegate --role explore --mode analysis, run_in_background, STOP)
65
+
66
+ S_TEST:
67
+ → S_REPORT WHEN: hypothesis confirmed DO: A_TEST_HYPOTHESIS
68
+ → S_REPORT WHEN: all hypotheses tested (some confirmed) DO: A_TEST_HYPOTHESIS
69
+ S_ESCALATE WHEN: max_hypotheses all failed DO: A_TEST_HYPOTHESIS
70
+
71
+ S_ESCALATE:
72
+ → S_HYPOTHESIZE WHEN: user broadens scope or provides new hypothesis DO: AskUserQuestion
73
+ S_REPORT WHEN: user selects "Escalate" or still stuck DO: mark INCONCLUSIVE
74
+
75
+ S_REPORT:
76
+ → END DO: A_SYNTHESIZE_REPORT
77
+
78
+ </transitions>
79
+
80
+ <actions>
81
+
82
+ ### A_FRAME_QUESTION
83
+
84
+ 1. Parse question, generate slug, create KNW-investigate-{slug}/
85
+ 2. Search prior knowledge: `maestro search "<question>"` + search .workflow/specs/learnings.md + read debug-notes.md
86
+ 3. Write initial understanding.md (question, prior knowledge summary, scope, timestamp)
87
+
88
+ ### A_COLLECT_EVIDENCE
89
+
90
+ Parallel evidence gathering:
91
+ 1. Code search: Grep keywords from question
92
+ 2. File inspection: Read most relevant files
93
+ 3. Import tracing: follow dependency chain
94
+ 4. Git history: `git log --oneline -10 -- <relevant-files>`
95
+
96
+ Each item → append evidence.ndjson: `{ts, type (code|git|search|doc), source (file:line), relevance (high|medium|low), content, note}`
97
+
98
+ ### A_FORM_HYPOTHESES
99
+
100
+ Generate ranked hypotheses: each is specific, testable claim about "how/why".
101
+ Rank by plausibility (evidence strength). Write to understanding.md:
102
+ - `[HIGH]` hypothesis Evidence: {refs}
103
+ - `[MEDIUM]` hypothesis — Evidence: {refs}
104
+
105
+ ### A_CLI_SUPPLEMENT
106
+
107
+ ```
108
+ maestro delegate "PURPOSE: Gather evidence for hypotheses
109
+ TASK: Trace call chains and data flows per hypothesis | Find corroborating/contradicting patterns
110
+ EXPECTED: JSON [{hypothesis_rank, evidence: [{file, line, supports: bool, explanation}]}]
111
+ " --role explore --mode analysis
112
+ ```
113
+ Run_in_background, STOP, wait. On callback: append to evidence.ndjson.
114
+
115
+ ### A_TEST_HYPOTHESIS
116
+
117
+ For each hypothesis (rank order):
118
+ 1. Design test: what evidence would confirm/disprove?
119
+ 2. Execute: code trace, targeted search, data inspection
120
+ 3. Record: append evidence.ndjson with type: "test"
121
+ 4. Update: mark hypothesis confirmed / disproved / inconclusive
122
+
123
+ ### A_SYNTHESIZE_REPORT
124
+
125
+ Write report.md: Answer (or INCONCLUSIVE), Evidence Trail table, Hypotheses Tested table, Key Learnings, Open Questions.
126
+ Append to .workflow/specs/learnings.md: confirmed roles="implement", disproved roles="analyze" (gotcha).
127
+
128
+ </actions>
129
+
130
+ </state_machine>
131
+
132
+ <error_codes>
133
+ | Code | Condition | Recovery |
134
+ |------|-----------|----------|
135
+ | E002 | --scope path not found | Check path |
136
+ | W002 | Very few evidence matches (<3) | Broaden search terms or expand scope |
137
+ | W003 | All hypotheses inconclusive | Investigation marked INCONCLUSIVE |
138
+ </error_codes>
139
+
140
+ <success_criteria>
141
+ - [ ] Evidence collected and logged to evidence.ndjson (structured NDJSON)
142
+ - [ ] At least 1 hypothesis formed and tested
143
+ - [ ] 3-strike escalation triggered if all fail
144
+ - [ ] Report + spec-entry blocks written
145
+ </success_criteria>
146
+
147
+ <next_step_routing>
148
+ - Save to specs → `/spec-add debug <finding>`
149
+ - Follow code → `/learn-follow <path>`
150
+ - Decompose patterns → `/learn-decompose <module>`
151
+ </next_step_routing>
@@ -1,122 +1,118 @@
1
- ---
2
- name: learn-second-opinion
3
- description: Get alternative perspectives — review, challenge, or consult
4
- argument-hint: "<target> [--mode review|challenge|consult]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Bash
9
- - Glob
10
- - Grep
11
- - Agent
12
- - AskUserQuestion
13
- ---
14
- <purpose>
15
- Structured second-opinion on code, decisions, or plans. Three modes:
16
- - **review** (default): 3 parallel agents (pragmatist, purist, strategist)
17
- - **challenge**: single adversarial agent — break assumptions, propose alternatives
18
- - **consult**: interactive Q&A — agent studies target, answers your questions
19
-
20
- Findings persist to `.workflow/specs/learnings.md` as `<spec-entry>` blocks.
21
- </purpose>
22
-
23
- <context>
24
- $ARGUMENTS — target and optional mode flag.
25
-
26
- **Target resolution** (auto-detected):
27
- | Input | Resolution |
28
- |-------|-----------|
29
- | File path | Read file content |
30
- | Wiki ID (`<type>-<slug>`) | `maestro wiki get <id>` |
31
- | `HEAD` / `staged` | `git diff HEAD` / `git diff --staged` |
32
- | Phase number | Resolve via state.json.artifacts[] plan.json |
33
-
34
- **Flags**: `--mode review|challenge|consult` (default: review)
35
-
36
- **Pre-load** (optional): `Skill("spec-load")` for conventions + `maestro search "<target topic>"` for related entries.
37
-
38
- **Output**: `.workflow/knowhow/KNW-opinion-{slug}-{YYYY-MM-DD}.md`
39
- </context>
40
-
41
- <state_machine>
42
-
43
- <states>
44
- S_RESOLVE解析 target PERSIST:
45
- S_CONTEXT — 加载 specs/wiki 上下文 PERSIST: —
46
- S_EXECUTE — 按 mode 执行分析 PERSIST: —
47
- S_SYNTHESIZE — 综合观点、生成报告 PERSIST: outputs
48
- S_PERSIST — 写文件、append .workflow/specs/learnings.md PERSIST: knowhow files
49
- </states>
50
-
51
- <transitions>
52
-
53
- S_RESOLVE:
54
- S_CONTEXT WHEN: target resolved DO: read target content
55
- → S_RESOLVE WHEN: unresolvable DO: AskUserQuestion for clarification
56
-
57
- S_CONTEXT:
58
- S_EXECUTE DO: load specs + wiki search (optional, proceed without)
59
-
60
- S_EXECUTE:
61
- S_SYNTHESIZE WHEN: mode == review DO: A_REVIEW
62
- S_SYNTHESIZE WHEN: mode == challenge DO: A_CHALLENGE
63
- → S_SYNTHESIZE WHEN: mode == consult DO: A_CONSULT
64
-
65
- S_SYNTHESIZE:
66
- → S_PERSIST DO: merge perspectives → agreements, disagreements, verdict, top 3 recommendations
67
-
68
- S_PERSIST:
69
- → END DO: write KNW-opinion + append <spec-entry> blocks to .workflow/specs/learnings.md
70
-
71
- </transitions>
72
-
73
- <actions>
74
-
75
- ### A_REVIEW
76
- Spawn 3 Agents in single message:
77
-
78
- | Agent | Focus | Question |
79
- |-------|-------|----------|
80
- | Pragmatist | simplicity, YAGNI, maintenance | "Simplest thing that works? Maintenance burden?" |
81
- | Purist | correctness, edge cases, type safety | "What assumptions can be violated?" |
82
- | Strategist | scalability, architecture alignment | "Supports future growth? Fits architecture?" |
83
-
84
- Each returns: persona, verdict (approve/concern/reject), confidence, findings[{severity, description, location, suggestion}], summary.
85
-
86
- ### A_CHALLENGE
87
- Spawn 1 adversarial Agent:
88
- - Find weakest assumption
89
- - Propose concrete breaking scenario
90
- - Identify single biggest risk
91
- - Suggest alternative approach
92
- - Apply forcing questions: "What invalidates this?", "Simplest thing that breaks this?", "What would you regret in 6 months?", "What implicit contract isn't enforced?"
93
-
94
- ### A_CONSULT
95
- Interactive loop:
96
- 1. Agent studies target
97
- 2. Display "Target loaded. What would you like to know?"
98
- 3. AskUserQuestion → Agent answers with code refs → repeat until "done"
99
- 4. Compile Q&A into report
100
-
101
- </actions>
102
-
103
- </state_machine>
104
-
105
- <error_codes>
106
- | Code | Condition | Recovery |
107
- |------|-----------|----------|
108
- | E002 | Unknown --mode value | Use: review, challenge, or consult |
109
- | W001 | One review agent failed | Proceed with available perspectives |
110
- </error_codes>
111
-
112
- <success_criteria>
113
- - [ ] Mode executed: review (3 parallel agents) / challenge (adversarial) / consult (interactive Q&A)
114
- - [ ] Synthesis with agreements, disagreements, verdict
115
- - [ ] Report written + findings appended to .workflow/specs/learnings.md
116
- </success_criteria>
117
-
118
- <next_step_routing>
119
- - Create issue → `/manage-issue create <description>`
120
- - Decompose patterns → `/learn-decompose <path>`
121
- - Follow code → `/learn-follow <path>`
122
- </next_step_routing>
1
+ ---
2
+ name: learn-second-opinion
3
+ description: Get alternative perspectives — review, challenge, or consult
4
+ argument-hint: "<target> [--mode review|challenge|consult]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Agent
12
+ - AskUserQuestion
13
+ ---
14
+ <purpose>
15
+ Structured second-opinion on code, decisions, or plans via three modes: review (3 parallel agents),
16
+ challenge (adversarial), or consult (interactive Q&A). Findings persist to learnings.md.
17
+ </purpose>
18
+
19
+ <context>
20
+ $ARGUMENTS target and optional mode flag.
21
+
22
+ **Target resolution** (auto-detected):
23
+ | Input | Resolution |
24
+ |-------|-----------|
25
+ | File path | Read file content |
26
+ | Wiki ID (`<type>-<slug>`) | `maestro wiki get <id>` |
27
+ | `HEAD` / `staged` | `git diff HEAD` / `git diff --staged` |
28
+ | Phase number | Resolve via state.json.artifacts[] → plan.json |
29
+
30
+ **Flags**: `--mode review|challenge|consult` (default: review)
31
+
32
+ **Pre-load** (optional): `Skill("spec-load")` for conventions + `maestro search "<target topic>"` for related entries.
33
+
34
+ **Output**: `.workflow/knowhow/KNW-opinion-{slug}-{YYYY-MM-DD}.md`
35
+ </context>
36
+
37
+ <state_machine>
38
+
39
+ <states>
40
+ S_RESOLVE — 解析 target PERSIST: —
41
+ S_CONTEXT — 加载 specs/wiki 上下文 PERSIST: —
42
+ S_EXECUTE — 按 mode 执行分析 PERSIST: —
43
+ S_SYNTHESIZE — 综合观点、生成报告 PERSIST: outputs
44
+ S_PERSIST写文件、append .workflow/specs/learnings.md PERSIST: knowhow files
45
+ </states>
46
+
47
+ <transitions>
48
+
49
+ S_RESOLVE:
50
+ → S_CONTEXT WHEN: target resolved DO: read target content
51
+ → S_RESOLVE WHEN: unresolvable DO: AskUserQuestion for clarification
52
+
53
+ S_CONTEXT:
54
+ S_EXECUTE DO: load specs + wiki search (optional, proceed without)
55
+
56
+ S_EXECUTE:
57
+ → S_SYNTHESIZE WHEN: mode == review DO: A_REVIEW
58
+ S_SYNTHESIZE WHEN: mode == challenge DO: A_CHALLENGE
59
+ → S_SYNTHESIZE WHEN: mode == consult DO: A_CONSULT
60
+
61
+ S_SYNTHESIZE:
62
+ S_PERSIST DO: merge perspectives agreements, disagreements, verdict, top 3 recommendations
63
+
64
+ S_PERSIST:
65
+ → END DO: write KNW-opinion + append <spec-entry> blocks to .workflow/specs/learnings.md
66
+
67
+ </transitions>
68
+
69
+ <actions>
70
+
71
+ ### A_REVIEW
72
+ Spawn 3 Agents in single message:
73
+
74
+ | Agent | Focus | Question |
75
+ |-------|-------|----------|
76
+ | Pragmatist | simplicity, YAGNI, maintenance | "Simplest thing that works? Maintenance burden?" |
77
+ | Purist | correctness, edge cases, type safety | "What assumptions can be violated?" |
78
+ | Strategist | scalability, architecture alignment | "Supports future growth? Fits architecture?" |
79
+
80
+ Each returns: persona, verdict (approve/concern/reject), confidence, findings[{severity, description, location, suggestion}], summary.
81
+
82
+ ### A_CHALLENGE
83
+ Spawn 1 adversarial Agent:
84
+ - Find weakest assumption
85
+ - Propose concrete breaking scenario
86
+ - Identify single biggest risk
87
+ - Suggest alternative approach
88
+ - Apply forcing questions: "What invalidates this?", "Simplest thing that breaks this?", "What would you regret in 6 months?", "What implicit contract isn't enforced?"
89
+
90
+ ### A_CONSULT
91
+ Interactive loop:
92
+ 1. Agent studies target
93
+ 2. Display "Target loaded. What would you like to know?"
94
+ 3. AskUserQuestion → Agent answers with code refs → repeat until "done"
95
+ 4. Compile Q&A into report
96
+
97
+ </actions>
98
+
99
+ </state_machine>
100
+
101
+ <error_codes>
102
+ | Code | Condition | Recovery |
103
+ |------|-----------|----------|
104
+ | E002 | Unknown --mode value | Use: review, challenge, or consult |
105
+ | W001 | One review agent failed | Proceed with available perspectives |
106
+ </error_codes>
107
+
108
+ <success_criteria>
109
+ - [ ] Mode executed: review (3 parallel agents) / challenge (adversarial) / consult (interactive Q&A)
110
+ - [ ] Synthesis with agreements, disagreements, verdict
111
+ - [ ] Report written + findings appended to .workflow/specs/learnings.md
112
+ </success_criteria>
113
+
114
+ <next_step_routing>
115
+ - Create issue `/manage-issue create <description>`
116
+ - Decompose patterns → `/learn-decompose <path>`
117
+ - Follow code → `/learn-follow <path>`
118
+ </next_step_routing>