maestro-flow 0.5.0 → 0.5.2

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 (95) hide show
  1. package/.agents/skills/codify-to-knowhow/phases/03-generate-specs.md +2 -1
  2. package/.agents/skills/manage-knowhow-capture/SKILL.md +4 -2
  3. package/.agy/skills/codify-to-knowhow/phases/03-generate-specs.md +2 -1
  4. package/.agy/skills/manage-knowhow-capture/SKILL.md +4 -2
  5. package/.claude/commands/manage-knowhow-capture.md +4 -2
  6. package/.claude/skills/codify-to-knowhow/phases/03-generate-specs.md +2 -1
  7. package/.codex/skills/codify-to-knowhow/SKILL.md +1 -1
  8. package/.codex/skills/learn-decompose/SKILL.md +144 -144
  9. package/.codex/skills/learn-follow/SKILL.md +83 -83
  10. package/.codex/skills/learn-investigate/SKILL.md +84 -84
  11. package/.codex/skills/learn-retro/SKILL.md +113 -113
  12. package/.codex/skills/learn-second-opinion/SKILL.md +116 -116
  13. package/.codex/skills/maestro/SKILL.md +11 -8
  14. package/.codex/skills/maestro-amend/SKILL.md +4 -4
  15. package/.codex/skills/maestro-analyze/SKILL.md +3 -3
  16. package/.codex/skills/maestro-blueprint/SKILL.md +4 -4
  17. package/.codex/skills/maestro-collab/SKILL.md +1 -1
  18. package/.codex/skills/maestro-companion/SKILL.md +4 -4
  19. package/.codex/skills/maestro-composer/SKILL.md +217 -217
  20. package/.codex/skills/maestro-grill/SKILL.md +1 -1
  21. package/.codex/skills/maestro-help/SKILL.md +30 -30
  22. package/.codex/skills/maestro-init/SKILL.md +1 -1
  23. package/.codex/skills/maestro-learn/SKILL.md +80 -80
  24. package/.codex/skills/maestro-merge/SKILL.md +76 -76
  25. package/.codex/skills/maestro-milestone-release/SKILL.md +74 -74
  26. package/.codex/skills/maestro-player/SKILL.md +3 -3
  27. package/.codex/skills/maestro-quick/SKILL.md +129 -129
  28. package/.codex/skills/maestro-ralph/SKILL.md +9 -9
  29. package/.codex/skills/maestro-ralph-beta/SKILL.md +34 -34
  30. package/.codex/skills/maestro-ralph-execute/SKILL.md +5 -5
  31. package/.codex/skills/maestro-tools-execute/SKILL.md +3 -3
  32. package/.codex/skills/maestro-tools-register/SKILL.md +3 -3
  33. package/.codex/skills/manage-codebase-rebuild/SKILL.md +412 -412
  34. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  35. package/.codex/skills/manage-harvest/SKILL.md +99 -99
  36. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  37. package/.codex/skills/manage-knowhow/SKILL.md +95 -95
  38. package/.codex/skills/manage-knowhow-capture/SKILL.md +137 -125
  39. package/.codex/skills/manage-status/SKILL.md +7 -7
  40. package/.codex/skills/manage-wiki/SKILL.md +55 -55
  41. package/.codex/skills/quality-auto-test/SKILL.md +1 -1
  42. package/.codex/skills/quality-debug/SKILL.md +8 -8
  43. package/.codex/skills/quality-refactor/SKILL.md +3 -3
  44. package/.codex/skills/quality-review/SKILL.md +1 -1
  45. package/.codex/skills/quality-sync/SKILL.md +111 -111
  46. package/.codex/skills/quality-test/SKILL.md +1 -1
  47. package/.codex/skills/spec-add/SKILL.md +2 -2
  48. package/.codex/skills/spec-load/SKILL.md +1 -1
  49. package/.codex/skills/spec-map/SKILL.md +204 -204
  50. package/.codex/skills/spec-remove/SKILL.md +75 -75
  51. package/.codex/skills/spec-setup/SKILL.md +2 -2
  52. package/.codex/skills/wiki-connect/SKILL.md +73 -73
  53. package/.codex/skills/wiki-digest/SKILL.md +87 -87
  54. package/dist/src/commands/install.d.ts.map +1 -1
  55. package/dist/src/commands/install.js +40 -10
  56. package/dist/src/commands/install.js.map +1 -1
  57. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  58. package/dist/src/i18n/locales/en.js +4 -0
  59. package/dist/src/i18n/locales/en.js.map +1 -1
  60. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  61. package/dist/src/i18n/locales/zh.js +4 -0
  62. package/dist/src/i18n/locales/zh.js.map +1 -1
  63. package/dist/src/i18n/types.d.ts +4 -0
  64. package/dist/src/i18n/types.d.ts.map +1 -1
  65. package/dist/src/ralph/skill-scanner.d.ts.map +1 -1
  66. package/dist/src/ralph/skill-scanner.js +9 -3
  67. package/dist/src/ralph/skill-scanner.js.map +1 -1
  68. package/dist/src/tui/install-ui/InstallConfirm.d.ts +1 -0
  69. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  70. package/dist/src/tui/install-ui/InstallConfirm.js +3 -1
  71. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  72. package/dist/src/tui/install-ui/InstallExecution.d.ts +2 -0
  73. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  74. package/dist/src/tui/install-ui/InstallExecution.js +20 -0
  75. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  76. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  77. package/dist/src/tui/install-ui/InstallFlow.js +13 -5
  78. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  79. package/dist/src/tui/install-ui/InstallHub.d.ts +2 -0
  80. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  81. package/dist/src/tui/install-ui/InstallHub.js +10 -0
  82. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  83. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  84. package/dist/src/tui/install-ui/InstallResult.js +5 -1
  85. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  86. package/dist/src/utils/update-notices.js +6 -0
  87. package/dist/src/utils/update-notices.js.map +1 -1
  88. package/package.json +1 -1
  89. package/workflows/agy-instructions.md +1 -1
  90. package/workflows/finish-work.md +1 -1
  91. package/workflows/impeccable/design.md +1 -0
  92. package/workflows/impeccable.md +1 -0
  93. package/workflows/knowhow.md +14 -8
  94. package/workflows/specs-add.md +1 -1
  95. package/workflows/specs-setup.md +2 -2
@@ -1,84 +1,84 @@
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: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Systematic investigation for understanding questions (not bug-fixing). 4-phase approach
10
- with scope lock and 3-strike escalation. Produces structured evidence trails and
11
- understanding documents that persist to the learning system.
12
-
13
- Unlike `quality-debug` (fixing bugs during execution), this answers "how does X work?",
14
- "why does Y happen?", "what would happen if Z?" questions.
15
- </purpose>
16
-
17
- <context>
18
- $ARGUMENTS — question text and optional flags.
19
-
20
- **Flags:**
21
- - `--scope <path>` — Restrict to files under this directory (default: entire project)
22
- - `--max-hypotheses N` — Max hypotheses before escalating (default: 3)
23
-
24
- **Output**: `.workflow/knowhow/KNW-investigate-{slug}/` (evidence.ndjson, understanding.md, report.md)
25
- </context>
26
-
27
- <execution>
28
-
29
- ### Stage 1: Frame the Question
30
- - Parse question, generate slug, create investigation directory
31
- - Load debug specs: `maestro spec load --category debug` for known issues and patterns
32
- - Search prior knowledge: `maestro search --category debug`, wiki search, grep .workflow/specs/learnings.md
33
- - Write initial `understanding.md`
34
-
35
- ### Stage 2: Evidence Collection
36
- 1. **Code search**: Grep keywords across scoped files
37
- 2. **File inspection**: Read most relevant files
38
- 3. **Import tracing**: Follow dependency chain
39
- 4. **Git history**: `git log --oneline -10 -- <relevant-files>`
40
-
41
- Each evidence item → `evidence.ndjson`:
42
- ```json
43
- {"ts":"ISO","type":"code|git|search|doc","source":"file:line","relevance":"high|medium|low","content":"...","note":"..."}
44
- ```
45
-
46
- ### Stage 3: Hypothesis Formation + Testing
47
- Generate ranked hypotheses from evidence. For each (in rank order):
48
- 1. Design test: what evidence would confirm/disprove?
49
- 2. Execute test: code trace, targeted search, experiment
50
- 3. Record result in `evidence.ndjson` (type: "test")
51
- 4. Update `understanding.md`: confirmed / disproved / inconclusive
52
-
53
- ### Stage 4: 3-Strike Escalation
54
- If all hypotheses fail: broaden scope, search wiki with alt keywords, or mark INCONCLUSIVE.
55
-
56
- ### Stage 5: Synthesize + Persist
57
- 1. Write `report.md` with answer, evidence trail, hypothesis results
58
- 2. Append to `.workflow/specs/learnings.md`:
59
- - Confirmed → category: "technique" / "pattern"
60
- - Disproved → category: "gotcha"
61
- 3. Display summary with next-step routing
62
-
63
- **Next steps:** `/spec-add debug <finding>`, `/learn-follow <path>`, `/learn-decompose <module>`
64
- </execution>
65
-
66
- <error_codes>
67
- | Code | Severity | Condition | Recovery |
68
- |------|----------|-----------|----------|
69
- | E001 | error | No question provided | Provide question as first argument |
70
- | E002 | error | Scope path does not exist | Check --scope path |
71
- | W001 | warning | No prior knowledge found | Proceed with fresh investigation |
72
- | W002 | warning | Very few evidence matches (<3) | Broaden search terms |
73
- | W003 | warning | All hypotheses inconclusive | Marked INCONCLUSIVE |
74
- </error_codes>
75
-
76
- <success_criteria>
77
- - [ ] Question parsed and investigation directory created
78
- - [ ] Evidence collected and logged to evidence.ndjson
79
- - [ ] At least 1 hypothesis formed and tested
80
- - [ ] understanding.md tracks evolving understanding
81
- - [ ] report.md written with answer and evidence trail
82
- - [ ] Findings appended to .workflow/specs/learnings.md with stable INS-ids
83
- - [ ] 3-strike escalation triggered if all hypotheses fail
84
- </success_criteria>
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: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Systematic investigation for understanding questions (not bug-fixing). 4-phase approach
10
+ with scope lock and 3-strike escalation. Produces structured evidence trails and
11
+ understanding documents that persist to the learning system.
12
+
13
+ Unlike `quality-debug` (fixing bugs during execution), this answers "how does X work?",
14
+ "why does Y happen?", "what would happen if Z?" questions.
15
+ </purpose>
16
+
17
+ <context>
18
+ $ARGUMENTS — question text and optional flags.
19
+
20
+ **Flags:**
21
+ - `--scope <path>` — Restrict to files under this directory (default: entire project)
22
+ - `--max-hypotheses N` — Max hypotheses before escalating (default: 3)
23
+
24
+ **Output**: `.workflow/knowhow/KNW-investigate-{slug}/` (evidence.ndjson, understanding.md, report.md)
25
+ </context>
26
+
27
+ <execution>
28
+
29
+ ### Stage 1: Frame the Question
30
+ - Parse question, generate slug, create investigation directory
31
+ - Load debug specs: `maestro spec load --category debug` for known issues and patterns
32
+ - Search prior knowledge: `maestro search --category debug`, wiki search, grep .workflow/specs/learnings.md
33
+ - Write initial `understanding.md`
34
+
35
+ ### Stage 2: Evidence Collection
36
+ 1. **Code search**: Grep keywords across scoped files
37
+ 2. **File inspection**: Read most relevant files
38
+ 3. **Import tracing**: Follow dependency chain
39
+ 4. **Git history**: `git log --oneline -10 -- <relevant-files>`
40
+
41
+ Each evidence item → `evidence.ndjson`:
42
+ ```json
43
+ {"ts":"ISO","type":"code|git|search|doc","source":"file:line","relevance":"high|medium|low","content":"...","note":"..."}
44
+ ```
45
+
46
+ ### Stage 3: Hypothesis Formation + Testing
47
+ Generate ranked hypotheses from evidence. For each (in rank order):
48
+ 1. Design test: what evidence would confirm/disprove?
49
+ 2. Execute test: code trace, targeted search, experiment
50
+ 3. Record result in `evidence.ndjson` (type: "test")
51
+ 4. Update `understanding.md`: confirmed / disproved / inconclusive
52
+
53
+ ### Stage 4: 3-Strike Escalation
54
+ If all hypotheses fail: broaden scope, search wiki with alt keywords, or mark INCONCLUSIVE.
55
+
56
+ ### Stage 5: Synthesize + Persist
57
+ 1. Write `report.md` with answer, evidence trail, hypothesis results
58
+ 2. Append to `.workflow/specs/learnings.md`:
59
+ - Confirmed → category: "technique" / "pattern"
60
+ - Disproved → category: "gotcha"
61
+ 3. Display summary with next-step routing
62
+
63
+ **Next steps:** `$spec-add debug <finding>`, `$learn-follow <path>`, `$learn-decompose <module>`
64
+ </execution>
65
+
66
+ <error_codes>
67
+ | Code | Severity | Condition | Recovery |
68
+ |------|----------|-----------|----------|
69
+ | E001 | error | No question provided | Provide question as first argument |
70
+ | E002 | error | Scope path does not exist | Check --scope path |
71
+ | W001 | warning | No prior knowledge found | Proceed with fresh investigation |
72
+ | W002 | warning | Very few evidence matches (<3) | Broaden search terms |
73
+ | W003 | warning | All hypotheses inconclusive | Marked INCONCLUSIVE |
74
+ </error_codes>
75
+
76
+ <success_criteria>
77
+ - [ ] Question parsed and investigation directory created
78
+ - [ ] Evidence collected and logged to evidence.ndjson
79
+ - [ ] At least 1 hypothesis formed and tested
80
+ - [ ] understanding.md tracks evolving understanding
81
+ - [ ] report.md written with answer and evidence trail
82
+ - [ ] Findings appended to .workflow/specs/learnings.md with stable INS-ids
83
+ - [ ] 3-strike escalation triggered if all hypotheses fail
84
+ </success_criteria>
@@ -1,113 +1,113 @@
1
- ---
2
- name: learn-retro
3
- description: Retrospective of git activity and decision quality
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"[--lens git|decision|all] [--days N] [--author <name>] [--area <path>] [--phase N] [--compare]\""
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Unified retrospective combining git activity analysis and decision quality evaluation.
10
- Two lenses, usable independently or together:
11
- - **git**: Commit metrics, session detection, per-author breakdown, file hotspots, trends
12
- - **decision**: Decision tracing across wiki/specs/git, multi-perspective evaluation via 3 parallel agents
13
-
14
- Works on raw git history and wiki/spec data — does not require completed phase artifacts.
15
- </purpose>
16
-
17
- <context>
18
- $ARGUMENTS — lens selection and scope flags.
19
-
20
- **Lens:** `--lens git` | `--lens decision` | `--lens all` (default)
21
-
22
- **Git flags:** `--days N` (default: 7), `--author <name>`, `--area <path>`, `--compare`
23
- **Decision flags:** `--phase N`, `--tag <tag>`, `--id <id>`
24
-
25
- **Output**: `.workflow/knowhow/KNW-retro-{date}.md` + `KNW-retro-{date}.json`
26
- </context>
27
-
28
- <execution>
29
-
30
- ### Phase 1: Parse + Select Lenses
31
-
32
- ### Phase 2: Git Lens (skip if --lens decision)
33
- **Sequential data gathering** (parallel git commands):
34
- - Commit stats with shortstat
35
- - Per-commit numstat for test/production LOC split
36
- - Timestamps for session detection (>2hr gap clustering)
37
- - File hotspots (most frequently changed)
38
- - Per-author commit counts
39
-
40
- **Compute**: commits, LOC, test ratio, churn rate, active days, sessions, per-author breakdown.
41
- **Trend comparison** if prior `retro-*.json` exists.
42
-
43
- ### Phase 3: Decision Lens (skip if --lens git)
44
- **3a: Collect decisions** from wiki, specs, git log, phase context, .workflow/specs/learnings.md.
45
- **3b: Build decision registry** per decision (id, title, source, rationale, alternatives, evidence).
46
-
47
- **3c: Multi-perspective evaluation** via spawn_agents_on_csv (3 parallel agents; filter `wave==1 AND status=="pending"`):
48
-
49
- | id | perspective | focus |
50
- |----|------------|-------|
51
- | 1 | technical | Implementation vs intent, context drift. Grade: sound/degraded/violated |
52
- | 2 | cost | Complexity added, coupling, tech debt. Grade: low-cost/acceptable/expensive |
53
- | 3 | hindsight | Right call with current knowledge? Grade: confirmed/questionable/should-revisit |
54
-
55
- **output_schema**:
56
-
57
- ```json
58
- {
59
- "type": "object",
60
- "properties": {
61
- "id": { "type": "string" },
62
- "result_status": { "type": "string", "enum": ["completed", "failed"] },
63
- "perspective": { "type": "string", "enum": ["technical", "cost", "hindsight"] },
64
- "grade": { "type": "string" },
65
- "findings": { "type": "string", "maxLength": 500 },
66
- "error": { "type": "string" }
67
- },
68
- "required": ["id", "result_status", "grade", "findings"]
69
- }
70
- ```
71
-
72
- Merge: `result_status` → master `status`; copy `perspective`, `grade`, `findings`, `error`.
73
-
74
- **Shared termination contract** (embed in every instruction):
75
- ```
76
- You MUST call report_agent_job_result EXACTLY ONCE before exiting.
77
- - Success → result_status=completed with concrete grade
78
- - Failure → result_status=failed with error message
79
- - Timeout → near max_runtime_seconds → result_status=failed, error="timeout (partial)"
80
- - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
81
- - Read-only analysis. Do NOT modify source files.
82
- Do NOT write to tasks.csv, wave-*.csv, results.csv. Do NOT call spawn_agents_on_csv (no recursion).
83
- ```
84
-
85
- **3d: Classify lifecycle**: Validated / Aging / Questionable / Stale / Reversed.
86
-
87
- ### Phase 4: Unified Report
88
- Write `KNW-retro-{date}.md` + `KNW-retro-{date}.json` with metrics, sessions, hotspots, decision health, combined insights, recommended actions.
89
-
90
- ### Phase 5: Persist
91
- Append insights to `.workflow/specs/learnings.md` (source: "retro-git" or "retro-decision"). Display summary.
92
-
93
- **Next steps:** `/learn-follow <path>`, `/quality-auto-test <area>`, `/learn-investigate <question>`
94
- </execution>
95
-
96
- <error_codes>
97
- | Code | Severity | Condition | Recovery |
98
- |------|----------|-----------|----------|
99
- | E001 | error | Not inside git repo (git lens) | Navigate to git repo |
100
- | E002 | error | No commits in time window | Increase --days |
101
- | E003 | error | No decisions found (decision lens) | Check wiki/specs content |
102
- | W001 | warning | .workflow/knowhow/ not found | Auto-bootstrap |
103
- | W002 | warning | No prior retro for comparison | First retro establishes baseline |
104
- | W003 | warning | Decision perspective agent failed | Proceed with partial evaluation |
105
- </error_codes>
106
-
107
- <success_criteria>
108
- - [ ] Lens selection parsed correctly
109
- - [ ] Git lens: metrics computed, sessions detected, hotspots identified
110
- - [ ] Decision lens: decisions collected, 3 agents spawned in parallel, lifecycle classified
111
- - [ ] Unified report written to KNW-retro-{date}.md + KNW-retro-{date}.json
112
- - [ ] .workflow/specs/learnings.md appended with insights (stable INS-ids)
113
- </success_criteria>
1
+ ---
2
+ name: learn-retro
3
+ description: Retrospective of git activity and decision quality
4
+ argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"[--lens git|decision|all] [--days N] [--author <name>] [--area <path>] [--phase N] [--compare]\""
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Unified retrospective combining git activity analysis and decision quality evaluation.
10
+ Two lenses, usable independently or together:
11
+ - **git**: Commit metrics, session detection, per-author breakdown, file hotspots, trends
12
+ - **decision**: Decision tracing across wiki/specs/git, multi-perspective evaluation via 3 parallel agents
13
+
14
+ Works on raw git history and wiki/spec data — does not require completed phase artifacts.
15
+ </purpose>
16
+
17
+ <context>
18
+ $ARGUMENTS — lens selection and scope flags.
19
+
20
+ **Lens:** `--lens git` | `--lens decision` | `--lens all` (default)
21
+
22
+ **Git flags:** `--days N` (default: 7), `--author <name>`, `--area <path>`, `--compare`
23
+ **Decision flags:** `--phase N`, `--tag <tag>`, `--id <id>`
24
+
25
+ **Output**: `.workflow/knowhow/KNW-retro-{date}.md` + `KNW-retro-{date}.json`
26
+ </context>
27
+
28
+ <execution>
29
+
30
+ ### Phase 1: Parse + Select Lenses
31
+
32
+ ### Phase 2: Git Lens (skip if --lens decision)
33
+ **Sequential data gathering** (parallel git commands):
34
+ - Commit stats with shortstat
35
+ - Per-commit numstat for test/production LOC split
36
+ - Timestamps for session detection (>2hr gap clustering)
37
+ - File hotspots (most frequently changed)
38
+ - Per-author commit counts
39
+
40
+ **Compute**: commits, LOC, test ratio, churn rate, active days, sessions, per-author breakdown.
41
+ **Trend comparison** if prior `retro-*.json` exists.
42
+
43
+ ### Phase 3: Decision Lens (skip if --lens git)
44
+ **3a: Collect decisions** from wiki, specs, git log, phase context, .workflow/specs/learnings.md.
45
+ **3b: Build decision registry** per decision (id, title, source, rationale, alternatives, evidence).
46
+
47
+ **3c: Multi-perspective evaluation** via spawn_agents_on_csv (3 parallel agents; filter `wave==1 AND status=="pending"`):
48
+
49
+ | id | perspective | focus |
50
+ |----|------------|-------|
51
+ | 1 | technical | Implementation vs intent, context drift. Grade: sound/degraded/violated |
52
+ | 2 | cost | Complexity added, coupling, tech debt. Grade: low-cost/acceptable/expensive |
53
+ | 3 | hindsight | Right call with current knowledge? Grade: confirmed/questionable/should-revisit |
54
+
55
+ **output_schema**:
56
+
57
+ ```json
58
+ {
59
+ "type": "object",
60
+ "properties": {
61
+ "id": { "type": "string" },
62
+ "result_status": { "type": "string", "enum": ["completed", "failed"] },
63
+ "perspective": { "type": "string", "enum": ["technical", "cost", "hindsight"] },
64
+ "grade": { "type": "string" },
65
+ "findings": { "type": "string", "maxLength": 500 },
66
+ "error": { "type": "string" }
67
+ },
68
+ "required": ["id", "result_status", "grade", "findings"]
69
+ }
70
+ ```
71
+
72
+ Merge: `result_status` → master `status`; copy `perspective`, `grade`, `findings`, `error`.
73
+
74
+ **Shared termination contract** (embed in every instruction):
75
+ ```
76
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting.
77
+ - Success → result_status=completed with concrete grade
78
+ - Failure → result_status=failed with error message
79
+ - Timeout → near max_runtime_seconds → result_status=failed, error="timeout (partial)"
80
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
81
+ - Read-only analysis. Do NOT modify source files.
82
+ Do NOT write to tasks.csv, wave-*.csv, results.csv. Do NOT call spawn_agents_on_csv (no recursion).
83
+ ```
84
+
85
+ **3d: Classify lifecycle**: Validated / Aging / Questionable / Stale / Reversed.
86
+
87
+ ### Phase 4: Unified Report
88
+ Write `KNW-retro-{date}.md` + `KNW-retro-{date}.json` with metrics, sessions, hotspots, decision health, combined insights, recommended actions.
89
+
90
+ ### Phase 5: Persist
91
+ Append insights to `.workflow/specs/learnings.md` (source: "retro-git" or "retro-decision"). Display summary.
92
+
93
+ **Next steps:** `$learn-follow <path>`, `$quality-auto-test <area>`, `$learn-investigate <question>`
94
+ </execution>
95
+
96
+ <error_codes>
97
+ | Code | Severity | Condition | Recovery |
98
+ |------|----------|-----------|----------|
99
+ | E001 | error | Not inside git repo (git lens) | Navigate to git repo |
100
+ | E002 | error | No commits in time window | Increase --days |
101
+ | E003 | error | No decisions found (decision lens) | Check wiki/specs content |
102
+ | W001 | warning | .workflow/knowhow/ not found | Auto-bootstrap |
103
+ | W002 | warning | No prior retro for comparison | First retro establishes baseline |
104
+ | W003 | warning | Decision perspective agent failed | Proceed with partial evaluation |
105
+ </error_codes>
106
+
107
+ <success_criteria>
108
+ - [ ] Lens selection parsed correctly
109
+ - [ ] Git lens: metrics computed, sessions detected, hotspots identified
110
+ - [ ] Decision lens: decisions collected, 3 agents spawned in parallel, lifecycle classified
111
+ - [ ] Unified report written to KNW-retro-{date}.md + KNW-retro-{date}.json
112
+ - [ ] .workflow/specs/learnings.md appended with insights (stable INS-ids)
113
+ </success_criteria>
@@ -1,116 +1,116 @@
1
- ---
2
- name: learn-second-opinion
3
- description: Get alternative perspectives -- review, challenge, or consult
4
- argument-hint: "[-y|--yes] [-c|--concurrency 3] [--continue] \"<target> [--mode review|challenge|consult]\""
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Structured second-opinion for code, decisions, or plans. Three modes:
10
- - **review** (default): 3 parallel persona agents independently assess target via spawn_agents_on_csv
11
- - **challenge**: single adversarial agent via spawn_agents_on_csv (1 worker)
12
- - **consult**: interactive Q&A (no CSV wave — direct orchestration)
13
-
14
- Findings persist to `.workflow/specs/learnings.md`. Decoupled from phase lifecycle.
15
- </purpose>
16
-
17
- <context>
18
- $ARGUMENTS — target and optional flags.
19
-
20
- **Target resolution (auto-detected):**
21
- - File path → analyze file content
22
- - Wiki ID (`type-slug`) → fetch via `maestro wiki get`
23
- - `HEAD` / `staged` → analyze git diff
24
- - Phase number → analyze phase plan
25
-
26
- **Flags:**
27
- - `--mode review` — 3-persona parallel review (default)
28
- - `--mode challenge` — Adversarial single-agent analysis
29
- - `--mode consult` — Interactive Q&A session
30
-
31
- **Output**: `.workflow/knowhow/KNW-opinion-{slug}-{date}.md`
32
- </context>
33
-
34
- <execution>
35
-
36
- ### Phase 1: Resolve Target + Load Context
37
- Resolve target to content. Load specs, `maestro search`, prior lessons for context brief.
38
-
39
- ### Phase 2: Execute Mode
40
-
41
- #### Review Mode (spawn_agents_on_csv)
42
-
43
- | id | persona | focus | grading |
44
- |----|---------|-------|---------|
45
- | 1 | pragmatist | Simplicity, YAGNI, maintenance cost, readability | complexity score, abstraction depth |
46
- | 2 | purist | Correctness, type safety, edge cases, error handling | error paths, type completeness |
47
- | 3 | strategist | Scalability, extensibility, architecture alignment | coupling, cohesion |
48
- | 4 | synthesis | Merge verdicts → agreements, disagreements, top 3 recommendations | combined verdict |
49
-
50
- Wave 1: 3 persona agents in parallel (filter `wave==1 AND status=="pending"`). Wave 2: synthesis agent with wave 1 findings as prev_context.
51
-
52
- **output_schema** (both waves):
53
-
54
- ```json
55
- {
56
- "type": "object",
57
- "properties": {
58
- "id": { "type": "string" },
59
- "result_status": { "type": "string", "enum": ["completed", "failed"] },
60
- "persona": { "type": "string" },
61
- "verdict": { "type": "string", "enum": ["approve", "concern", "reject", ""] },
62
- "confidence": { "type": "string", "description": "0-100" },
63
- "findings": { "type": "string", "description": "JSON array of {severity, description, location, suggestion}, max 500 chars summary" },
64
- "summary": { "type": "string", "maxLength": 500 },
65
- "error": { "type": "string" }
66
- },
67
- "required": ["id", "result_status", "findings", "summary"]
68
- }
69
- ```
70
-
71
- Merge: `result_status` → master `status`; copy `persona`, `verdict`, `confidence`, `findings`, `summary`, `error`.
72
-
73
- **Shared termination contract** (embed in every instruction):
74
- ```
75
- You MUST call report_agent_job_result EXACTLY ONCE before exiting.
76
- - Success → result_status=completed with concrete verdict
77
- - Failure → result_status=failed with error message
78
- - Timeout → near max_runtime_seconds → result_status=failed, error="timeout (partial)"
79
- - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
80
- - Read-only analysis. Do NOT modify source files.
81
- Do NOT write to tasks.csv, wave-*.csv, results.csv. Do NOT call spawn_agents_on_csv (no recursion).
82
- ```
83
-
84
- #### Challenge Mode
85
- Single agent via spawn_agents_on_csv (max_concurrency: 1) with the same `output_schema` + termination contract above. Adversarial analysis with forcing questions:
86
- - "What assumption would invalidate this entire approach?"
87
- - "What's the simplest thing that breaks this?"
88
- - "What's the implicit contract that isn't enforced?"
89
-
90
- #### Consult Mode
91
- Interactive loop via AskUserQuestion. Agent studies target, answers questions with code references. Compile Q&A into report on exit.
92
-
93
- ### Phase 3: Persist
94
- 1. Write `KNW-opinion-{slug}-{date}.md` with per-persona findings + synthesis
95
- 2. Append non-trivial findings to `.workflow/specs/learnings.md` (source: "second-opinion")
96
- 3. Display summary with verdict and next steps
97
-
98
- **Next steps:** `/manage-issue create`, `/learn-decompose <path>`, `/learn-follow <path>`
99
- </execution>
100
-
101
- <error_codes>
102
- | Code | Severity | Condition | Recovery |
103
- |------|----------|-----------|----------|
104
- | E001 | error | Target not resolvable | Verify path/ID |
105
- | E002 | error | Unknown --mode value | Use: review, challenge, consult |
106
- | W001 | warning | Persona agent failed — partial perspectives | Proceed with available agents |
107
- | W003 | warning | Git diff empty for HEAD/staged | Use file path instead |
108
- </error_codes>
109
-
110
- <success_criteria>
111
- - [ ] Target resolved and context loaded
112
- - [ ] Mode executed: review (3 parallel agents), challenge (adversarial), or consult (interactive)
113
- - [ ] Synthesis produced with agreements, disagreements, verdict
114
- - [ ] Report written to `KNW-opinion-{slug}-{date}.md`
115
- - [ ] Non-trivial findings appended to `.workflow/specs/learnings.md`
116
- </success_criteria>
1
+ ---
2
+ name: learn-second-opinion
3
+ description: Get alternative perspectives -- review, challenge, or consult
4
+ argument-hint: "[-y|--yes] [-c|--concurrency 3] [--continue] \"<target> [--mode review|challenge|consult]\""
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Structured second-opinion for code, decisions, or plans. Three modes:
10
+ - **review** (default): 3 parallel persona agents independently assess target via spawn_agents_on_csv
11
+ - **challenge**: single adversarial agent via spawn_agents_on_csv (1 worker)
12
+ - **consult**: interactive Q&A (no CSV wave — direct orchestration)
13
+
14
+ Findings persist to `.workflow/specs/learnings.md`. Decoupled from phase lifecycle.
15
+ </purpose>
16
+
17
+ <context>
18
+ $ARGUMENTS — target and optional flags.
19
+
20
+ **Target resolution (auto-detected):**
21
+ - File path → analyze file content
22
+ - Wiki ID (`type-slug`) → fetch via `maestro wiki get`
23
+ - `HEAD` / `staged` → analyze git diff
24
+ - Phase number → analyze phase plan
25
+
26
+ **Flags:**
27
+ - `--mode review` — 3-persona parallel review (default)
28
+ - `--mode challenge` — Adversarial single-agent analysis
29
+ - `--mode consult` — Interactive Q&A session
30
+
31
+ **Output**: `.workflow/knowhow/KNW-opinion-{slug}-{date}.md`
32
+ </context>
33
+
34
+ <execution>
35
+
36
+ ### Phase 1: Resolve Target + Load Context
37
+ Resolve target to content. Load specs, `maestro search`, prior lessons for context brief.
38
+
39
+ ### Phase 2: Execute Mode
40
+
41
+ #### Review Mode (spawn_agents_on_csv)
42
+
43
+ | id | persona | focus | grading |
44
+ |----|---------|-------|---------|
45
+ | 1 | pragmatist | Simplicity, YAGNI, maintenance cost, readability | complexity score, abstraction depth |
46
+ | 2 | purist | Correctness, type safety, edge cases, error handling | error paths, type completeness |
47
+ | 3 | strategist | Scalability, extensibility, architecture alignment | coupling, cohesion |
48
+ | 4 | synthesis | Merge verdicts → agreements, disagreements, top 3 recommendations | combined verdict |
49
+
50
+ Wave 1: 3 persona agents in parallel (filter `wave==1 AND status=="pending"`). Wave 2: synthesis agent with wave 1 findings as prev_context.
51
+
52
+ **output_schema** (both waves):
53
+
54
+ ```json
55
+ {
56
+ "type": "object",
57
+ "properties": {
58
+ "id": { "type": "string" },
59
+ "result_status": { "type": "string", "enum": ["completed", "failed"] },
60
+ "persona": { "type": "string" },
61
+ "verdict": { "type": "string", "enum": ["approve", "concern", "reject", ""] },
62
+ "confidence": { "type": "string", "description": "0-100" },
63
+ "findings": { "type": "string", "description": "JSON array of {severity, description, location, suggestion}, max 500 chars summary" },
64
+ "summary": { "type": "string", "maxLength": 500 },
65
+ "error": { "type": "string" }
66
+ },
67
+ "required": ["id", "result_status", "findings", "summary"]
68
+ }
69
+ ```
70
+
71
+ Merge: `result_status` → master `status`; copy `persona`, `verdict`, `confidence`, `findings`, `summary`, `error`.
72
+
73
+ **Shared termination contract** (embed in every instruction):
74
+ ```
75
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting.
76
+ - Success → result_status=completed with concrete verdict
77
+ - Failure → result_status=failed with error message
78
+ - Timeout → near max_runtime_seconds → result_status=failed, error="timeout (partial)"
79
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
80
+ - Read-only analysis. Do NOT modify source files.
81
+ Do NOT write to tasks.csv, wave-*.csv, results.csv. Do NOT call spawn_agents_on_csv (no recursion).
82
+ ```
83
+
84
+ #### Challenge Mode
85
+ Single agent via spawn_agents_on_csv (max_concurrency: 1) with the same `output_schema` + termination contract above. Adversarial analysis with forcing questions:
86
+ - "What assumption would invalidate this entire approach?"
87
+ - "What's the simplest thing that breaks this?"
88
+ - "What's the implicit contract that isn't enforced?"
89
+
90
+ #### Consult Mode
91
+ Interactive loop via request_user_input. Agent studies target, answers questions with code references. Compile Q&A into report on exit.
92
+
93
+ ### Phase 3: Persist
94
+ 1. Write `KNW-opinion-{slug}-{date}.md` with per-persona findings + synthesis
95
+ 2. Append non-trivial findings to `.workflow/specs/learnings.md` (source: "second-opinion")
96
+ 3. Display summary with verdict and next steps
97
+
98
+ **Next steps:** `$manage-issue create`, `$learn-decompose <path>`, `$learn-follow <path>`
99
+ </execution>
100
+
101
+ <error_codes>
102
+ | Code | Severity | Condition | Recovery |
103
+ |------|----------|-----------|----------|
104
+ | E001 | error | Target not resolvable | Verify path/ID |
105
+ | E002 | error | Unknown --mode value | Use: review, challenge, consult |
106
+ | W001 | warning | Persona agent failed — partial perspectives | Proceed with available agents |
107
+ | W003 | warning | Git diff empty for HEAD/staged | Use file path instead |
108
+ </error_codes>
109
+
110
+ <success_criteria>
111
+ - [ ] Target resolved and context loaded
112
+ - [ ] Mode executed: review (3 parallel agents), challenge (adversarial), or consult (interactive)
113
+ - [ ] Synthesis produced with agreements, disagreements, verdict
114
+ - [ ] Report written to `KNW-opinion-{slug}-{date}.md`
115
+ - [ ] Non-trivial findings appended to `.workflow/specs/learnings.md`
116
+ </success_criteria>