maestro-flow 0.3.42 → 0.3.44

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 (172) hide show
  1. package/.claude/commands/learn-decompose.md +10 -15
  2. package/.claude/commands/learn-follow.md +11 -16
  3. package/.claude/commands/learn-investigate.md +18 -22
  4. package/.claude/commands/learn-retro.md +23 -26
  5. package/.claude/commands/learn-second-opinion.md +11 -16
  6. package/.claude/commands/maestro-analyze.md +8 -0
  7. package/.claude/commands/maestro-brainstorm.md +8 -0
  8. package/.claude/commands/maestro-execute.md +11 -3
  9. package/.claude/commands/maestro-learn.md +4 -4
  10. package/.claude/commands/maestro-milestone-complete.md +6 -6
  11. package/.claude/commands/maestro-plan.md +8 -0
  12. package/.claude/commands/maestro-ralph-execute.md +52 -80
  13. package/.claude/commands/maestro-ralph.md +2 -2
  14. package/.claude/commands/maestro-tools-execute.md +117 -0
  15. package/.claude/commands/maestro-tools-register.md +137 -0
  16. package/.claude/commands/maestro-ui-codify.md +67 -0
  17. package/.claude/commands/manage-harvest.md +1 -1
  18. package/.claude/commands/manage-learn.md +5 -7
  19. package/.claude/commands/manage-wiki.md +1 -1
  20. package/.claude/commands/quality-auto-test.md +1 -1
  21. package/.claude/commands/quality-debug.md +8 -0
  22. package/.claude/commands/quality-retrospective.md +4 -5
  23. package/.claude/commands/quality-review.md +8 -0
  24. package/.claude/commands/spec-add.md +25 -4
  25. package/.claude/commands/spec-load.md +26 -6
  26. package/.claude/commands/spec-setup.md +2 -2
  27. package/.claude/commands/wiki-connect.md +1 -1
  28. package/.claude/commands/wiki-digest.md +5 -6
  29. package/.claude/skills/codify-to-knowhow/SKILL.md +167 -0
  30. package/.claude/skills/codify-to-knowhow/phases/01-load-manifest.md +101 -0
  31. package/.claude/skills/codify-to-knowhow/phases/02-generate-knowhow.md +97 -0
  32. package/.claude/skills/codify-to-knowhow/phases/03-generate-specs.md +92 -0
  33. package/.claude/skills/codify-to-knowhow/phases/04-index-verify.md +119 -0
  34. package/.codex/skills/codify-to-knowhow/SKILL.md +427 -0
  35. package/.codex/skills/learn-decompose/SKILL.md +8 -8
  36. package/.codex/skills/learn-follow/SKILL.md +6 -6
  37. package/.codex/skills/learn-investigate/SKILL.md +4 -4
  38. package/.codex/skills/learn-retro/SKILL.md +7 -7
  39. package/.codex/skills/learn-second-opinion/SKILL.md +6 -6
  40. package/.codex/skills/maestro-analyze/SKILL.md +491 -491
  41. package/.codex/skills/maestro-collab/SKILL.md +1 -1
  42. package/.codex/skills/maestro-learn/SKILL.md +1 -1
  43. package/.codex/skills/maestro-milestone-complete/SKILL.md +122 -122
  44. package/.codex/skills/maestro-plan/SKILL.md +485 -485
  45. package/.codex/skills/maestro-tools-execute/SKILL.md +105 -0
  46. package/.codex/skills/maestro-tools-register/SKILL.md +144 -0
  47. package/.codex/skills/maestro-ui-codify/SKILL.md +398 -0
  48. package/.codex/skills/maestro-verify/SKILL.md +486 -486
  49. package/.codex/skills/manage-harvest/SKILL.md +3 -3
  50. package/.codex/skills/manage-issue-discover/SKILL.md +431 -431
  51. package/.codex/skills/manage-learn/SKILL.md +13 -13
  52. package/.codex/skills/manage-wiki/SKILL.md +1 -1
  53. package/.codex/skills/quality-auto-test/SKILL.md +553 -553
  54. package/.codex/skills/quality-refactor/SKILL.md +151 -151
  55. package/.codex/skills/quality-retrospective/SKILL.md +6 -6
  56. package/.codex/skills/spec-add/SKILL.md +17 -4
  57. package/.codex/skills/spec-load/SKILL.md +24 -28
  58. package/.codex/skills/team-quality-assurance/roles/executor/role.md +1 -1
  59. package/.codex/skills/team-review/roles/reviewer/role.md +1 -1
  60. package/.codex/skills/team-tech-debt/roles/scanner/role.md +1 -1
  61. package/.codex/skills/team-testing/roles/executor/role.md +1 -1
  62. package/.codex/skills/team-testing/roles/generator/role.md +1 -1
  63. package/.codex/skills/wiki-connect/SKILL.md +5 -5
  64. package/.codex/skills/wiki-digest/SKILL.md +8 -8
  65. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -2
  66. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  67. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +1 -1
  68. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  69. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +2 -1
  70. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  71. package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js +2 -2
  72. package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js.map +1 -1
  73. package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.d.ts +1 -1
  74. package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.js +1 -1
  75. package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.js.map +1 -1
  76. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +2 -2
  77. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  78. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.d.ts +7 -3
  79. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +47 -15
  80. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -1
  81. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +1 -1
  82. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  83. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +1 -2
  84. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +3 -52
  85. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  86. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +67 -21
  87. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  88. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +6 -1
  89. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +1 -11
  90. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
  91. package/dashboard/dist-server/dashboard/src/server/wiki/writer.d.ts +7 -4
  92. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +27 -12
  93. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
  94. package/dashboard/dist-server/src/tools/spec-entry-parser.d.ts +10 -2
  95. package/dashboard/dist-server/src/tools/spec-entry-parser.js +46 -12
  96. package/dashboard/dist-server/src/tools/spec-entry-parser.js.map +1 -1
  97. package/dashboard/dist-server/src/tools/spec-loader.d.ts +6 -2
  98. package/dashboard/dist-server/src/tools/spec-loader.js +119 -23
  99. package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
  100. package/dist/src/commands/knowhow.d.ts.map +1 -1
  101. package/dist/src/commands/knowhow.js +21 -2
  102. package/dist/src/commands/knowhow.js.map +1 -1
  103. package/dist/src/commands/spec.d.ts +1 -1
  104. package/dist/src/commands/spec.d.ts.map +1 -1
  105. package/dist/src/commands/spec.js +78 -4
  106. package/dist/src/commands/spec.js.map +1 -1
  107. package/dist/src/commands/wiki.d.ts.map +1 -1
  108. package/dist/src/commands/wiki.js +51 -3
  109. package/dist/src/commands/wiki.js.map +1 -1
  110. package/dist/src/hooks/keyword-spec-injector.js +1 -1
  111. package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
  112. package/dist/src/hooks/plugins/spec-injection-plugin.js +11 -11
  113. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  114. package/dist/src/hooks/spec-injector.d.ts +1 -0
  115. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  116. package/dist/src/hooks/spec-injector.js +55 -22
  117. package/dist/src/hooks/spec-injector.js.map +1 -1
  118. package/dist/src/hooks/wiki-role-loader.d.ts +18 -0
  119. package/dist/src/hooks/wiki-role-loader.d.ts.map +1 -0
  120. package/dist/src/hooks/wiki-role-loader.js +43 -0
  121. package/dist/src/hooks/wiki-role-loader.js.map +1 -0
  122. package/dist/src/tools/spec-entry-parser.d.ts +10 -2
  123. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
  124. package/dist/src/tools/spec-entry-parser.js +46 -12
  125. package/dist/src/tools/spec-entry-parser.js.map +1 -1
  126. package/dist/src/tools/spec-init.d.ts.map +1 -1
  127. package/dist/src/tools/spec-init.js +19 -0
  128. package/dist/src/tools/spec-init.js.map +1 -1
  129. package/dist/src/tools/spec-loader.d.ts +6 -2
  130. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  131. package/dist/src/tools/spec-loader.js +119 -23
  132. package/dist/src/tools/spec-loader.js.map +1 -1
  133. package/dist/src/tools/spec-writer.d.ts +6 -1
  134. package/dist/src/tools/spec-writer.d.ts.map +1 -1
  135. package/dist/src/tools/spec-writer.js +29 -2
  136. package/dist/src/tools/spec-writer.js.map +1 -1
  137. package/dist/src/tools/store-knowhow.d.ts.map +1 -1
  138. package/dist/src/tools/store-knowhow.js +56 -27
  139. package/dist/src/tools/store-knowhow.js.map +1 -1
  140. package/package.json +1 -1
  141. package/workflows/analyze.md +2 -2
  142. package/workflows/auto-test.md +2 -2
  143. package/workflows/brainstorm.md +1 -1
  144. package/workflows/codebase-rebuild.md +1 -1
  145. package/workflows/codebase-refresh.md +1 -1
  146. package/workflows/debug.md +1 -1
  147. package/workflows/execute.md +3 -3
  148. package/workflows/harvest.md +13 -13
  149. package/workflows/integration-test.md +2 -2
  150. package/workflows/issue-discover.md +1 -1
  151. package/workflows/knowhow.md +72 -11
  152. package/workflows/learn.md +70 -58
  153. package/workflows/map.md +1 -1
  154. package/workflows/milestone-complete.md +2 -2
  155. package/workflows/plan.md +1 -1
  156. package/workflows/quick.md +1 -1
  157. package/workflows/refactor.md +1 -1
  158. package/workflows/retrospective.md +51 -57
  159. package/workflows/review.md +1 -1
  160. package/workflows/roadmap-common.md +1 -1
  161. package/workflows/specs-add.md +11 -2
  162. package/workflows/specs-load.md +17 -15
  163. package/workflows/test-gen.md +1 -1
  164. package/workflows/tools-spec.md +98 -0
  165. package/workflows/ui-codify-extract.md +373 -0
  166. package/workflows/ui-codify-knowhow.md +258 -0
  167. package/workflows/ui-codify-package.md +161 -0
  168. package/workflows/ui-codify.md +225 -0
  169. package/workflows/verify.md +1 -1
  170. package/workflows/wiki-connect.md +7 -7
  171. package/workflows/wiki-digest.md +13 -13
  172. package/workflows/wiki-manage.md +1 -1
@@ -1,151 +1,151 @@
1
- ---
2
- name: quality-refactor
3
- description: Reduce tech debt with reflection-driven iteration
4
- argument-hint: "<phase|--dir path> [--max-iterations N]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Iterative refactoring cycle: analyze scope for tech debt -> plan refactoring tasks -> execute each with test verification -> reflect on strategy per round -> repeat if needed. Every change is verified against existing tests. Failed changes are reverted and retried with adjusted strategy.
10
- </purpose>
11
-
12
- <context>
13
- $ARGUMENTS -- module path, feature area, or "all", plus optional flags.
14
-
15
- **Usage**:
16
-
17
- ```bash
18
- $quality-refactor "src/auth" # module path scope
19
- $quality-refactor "authentication" # feature area scope
20
- $quality-refactor "all" # full codebase scan
21
- $quality-refactor "src/api --max-iterations 5" # limit iteration rounds
22
- $quality-refactor "--dir .workflow/scratch/refactor-auth-2026-03-18" # resume existing
23
- ```
24
-
25
- **Flags**:
26
- - `<phase|scope>`: Module path, feature area, or "all"
27
- - `--dir path`: Resume existing refactor scratch directory
28
- - `--max-iterations N`: Max refactoring rounds (default: 3)
29
-
30
- **Output**: `.workflow/scratch/refactor-{slug}-{date}/` with index.json, plan.json, reflection-log.md, .task/, .summaries/
31
- </context>
32
-
33
- <invariants>
34
- 1. **Test after every change** -- zero regressions tolerated
35
- 2. **Revert on failure** -- never leave broken state
36
- 3. **Max 2 retries per task** with strategy adjustment
37
- 4. **Reflection-driven** -- every round records strategy, outcome, adjustment
38
- 5. **User approval required** before execution (Step 4)
39
- 6. **Quick wins first** -- order by risk (low first) and dependency
40
- 7. **Agent calls use `run_in_background: false`** for synchronous execution
41
- 8. **Incremental safety** -- each task is independently safe to apply or revert
42
- </invariants>
43
-
44
- <execution>
45
-
46
- ### Step 1: Parse Scope
47
-
48
- 1. Parse `$ARGUMENTS` for scope and flags
49
- 2. If `--dir` provided: resume existing scratch directory (skip to Step 5)
50
- 3. Scope types:
51
- - Module path (e.g., "src/auth") -> scan that directory
52
- - Feature area (e.g., "authentication") -> search for related files
53
- - "all" -> full codebase scan
54
- 4. If empty: prompt user via AskUserQuestion with options (Module path / Feature area / Full codebase)
55
- 5. Detect `--max-iterations N` (default: 3)
56
-
57
- ### Step 2: Create Scratch Directory
58
-
59
- Create `.workflow/scratch/refactor-{slug}-{date}/` with `.task/` and `.summaries/` subdirectories. Write `index.json` with type "refactor", scope, status "active", plan/execution/reflection counters.
60
-
61
- ### Step 3: Scope Analysis
62
-
63
- Load project specs if available (`maestro spec load --category coding`).
64
-
65
- Analyze scope for tech debt categories:
66
-
67
- | Category | What to Look For |
68
- |----------|-----------------|
69
- | Duplication | Repeated code blocks, copy-paste patterns |
70
- | Complexity | Long functions, deep nesting, high cyclomatic complexity |
71
- | Naming | Inconsistent naming, unclear identifiers |
72
- | Dependencies | Circular deps, tight coupling, god objects |
73
- | Dead code | Unused functions, unreachable branches |
74
- | Pattern violations | Inconsistent with project conventions |
75
-
76
- Present analysis summary table with category, count, severity.
77
- Confirm with user before proceeding.
78
-
79
- ### Step 4: Plan Refactoring
80
-
81
- 1. Write `plan.json` with scope, total_tasks, strategy ("incremental -- each task independently safe")
82
- 2. For each identified issue, create `.task/TASK-{NNN}.json`:
83
- - id, title, status (pending), type (refactor), category
84
- - description, read_first files, files with action/target/change
85
- - convergence.criteria (grep-verifiable), verification command
86
- - implementation steps, risk level
87
- 3. Order: high risk last, dependencies respected, quick wins first
88
- 4. Update `index.json` plan fields
89
- 5. Present plan to user via AskUserQuestion -- show affected files, risk areas, ask for approval
90
-
91
- ### Step 5: Execute with Reflection
92
-
93
- Initialize `reflection-log.md` if not exists.
94
-
95
- For each task in order:
96
-
97
- **5a. Execute refactoring:** Spawn Agent to implement the refactoring — read `read_first` files, apply changes to targets, follow convergence criteria exactly.
98
-
99
- **5b. Run test suite** (npm test / pytest / go test as appropriate).
100
-
101
- **5c. Record in reflection-log.md:** Round number, task title, strategy, result (pass/fail), test outcome, adjustment for next round, files changed.
102
-
103
- **5d. Handle test failures:**
104
- 1. Revert the change
105
- 2. Record failure + strategy adjustment in reflection-log.md
106
- 3. Retry with adjusted strategy (max 2 retries per task)
107
- 4. If still failing: mark task "blocked", continue to next
108
-
109
- **5e. Update state:**
110
- - `.task/TASK-{NNN}.json` status -> "completed" or "blocked"
111
- - `.summaries/TASK-{NNN}-summary.md` written
112
- - `index.json` execution and reflection fields updated
113
-
114
- ### Step 6: Final Verification
115
-
116
- Run full test suite. Record final state in reflection-log.md: test result, tasks completed/total, tasks blocked, key learnings.
117
-
118
- ### Step 7: Complete and Report
119
-
120
- Update `index.json`: status -> "completed", final execution/reflection counts.
121
-
122
- Display report: scope, tasks completed/blocked, reflection rounds, strategy adjustments, test status, key learnings from reflection-log.md, artifact paths (`{REFACTOR_DIR}/reflection-log.md`, `{REFACTOR_DIR}/.summaries/`).
123
-
124
- **Next-step routing:**
125
-
126
- | Result | Next Step |
127
- |--------|-----------|
128
- | All tests pass, refactoring complete | `$quality-sync` (update codebase docs) |
129
- | Test failures remain after refactor | `$quality-debug "{scope}"` |
130
- | No test suite available for scope | `$quality-auto-test "{phase}"` |
131
- | Partial completion (some blocked) | `$quality-debug "{scope}"` for blocked tasks |
132
- </execution>
133
-
134
- <error_codes>
135
- | Code | Severity | Condition | Recovery |
136
- |------|----------|-----------|----------|
137
- | E001 | error | Scope/description required | Prompt user for module path, feature area, or "all" |
138
- | E002 | error | Test suite not available | Suggest creating tests first, or proceed with manual verification |
139
- | W001 | warning | Partial test coverage | Note uncovered areas, proceed with extra caution |
140
- </error_codes>
141
-
142
- <success_criteria>
143
- - [ ] Scope resolved and scratch directory created
144
- - [ ] Tech debt analysis completed with categorized findings
145
- - [ ] Refactoring plan approved by user
146
- - [ ] Each task executed with test verification
147
- - [ ] Failed changes reverted, retried with adjusted strategy
148
- - [ ] Reflection log records every round's strategy and outcome
149
- - [ ] Final test suite passes with zero regressions
150
- - [ ] Completion report with key learnings displayed
151
- </success_criteria>
1
+ ---
2
+ name: quality-refactor
3
+ description: Reduce tech debt with reflection-driven iteration
4
+ argument-hint: "<phase|--dir path> [--max-iterations N]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Iterative refactoring cycle: analyze scope for tech debt -> plan refactoring tasks -> execute each with test verification -> reflect on strategy per round -> repeat if needed. Every change is verified against existing tests. Failed changes are reverted and retried with adjusted strategy.
10
+ </purpose>
11
+
12
+ <context>
13
+ $ARGUMENTS -- module path, feature area, or "all", plus optional flags.
14
+
15
+ **Usage**:
16
+
17
+ ```bash
18
+ $quality-refactor "src/auth" # module path scope
19
+ $quality-refactor "authentication" # feature area scope
20
+ $quality-refactor "all" # full codebase scan
21
+ $quality-refactor "src/api --max-iterations 5" # limit iteration rounds
22
+ $quality-refactor "--dir .workflow/scratch/refactor-auth-2026-03-18" # resume existing
23
+ ```
24
+
25
+ **Flags**:
26
+ - `<phase|scope>`: Module path, feature area, or "all"
27
+ - `--dir path`: Resume existing refactor scratch directory
28
+ - `--max-iterations N`: Max refactoring rounds (default: 3)
29
+
30
+ **Output**: `.workflow/scratch/refactor-{slug}-{date}/` with index.json, plan.json, reflection-log.md, .task/, .summaries/
31
+ </context>
32
+
33
+ <invariants>
34
+ 1. **Test after every change** -- zero regressions tolerated
35
+ 2. **Revert on failure** -- never leave broken state
36
+ 3. **Max 2 retries per task** with strategy adjustment
37
+ 4. **Reflection-driven** -- every round records strategy, outcome, adjustment
38
+ 5. **User approval required** before execution (Step 4)
39
+ 6. **Quick wins first** -- order by risk (low first) and dependency
40
+ 7. **Agent calls use `run_in_background: false`** for synchronous execution
41
+ 8. **Incremental safety** -- each task is independently safe to apply or revert
42
+ </invariants>
43
+
44
+ <execution>
45
+
46
+ ### Step 1: Parse Scope
47
+
48
+ 1. Parse `$ARGUMENTS` for scope and flags
49
+ 2. If `--dir` provided: resume existing scratch directory (skip to Step 5)
50
+ 3. Scope types:
51
+ - Module path (e.g., "src/auth") -> scan that directory
52
+ - Feature area (e.g., "authentication") -> search for related files
53
+ - "all" -> full codebase scan
54
+ 4. If empty: prompt user via AskUserQuestion with options (Module path / Feature area / Full codebase)
55
+ 5. Detect `--max-iterations N` (default: 3)
56
+
57
+ ### Step 2: Create Scratch Directory
58
+
59
+ Create `.workflow/scratch/refactor-{slug}-{date}/` with `.task/` and `.summaries/` subdirectories. Write `index.json` with type "refactor", scope, status "active", plan/execution/reflection counters.
60
+
61
+ ### Step 3: Scope Analysis
62
+
63
+ Load project specs if available (`maestro spec load --role implement`).
64
+
65
+ Analyze scope for tech debt categories:
66
+
67
+ | Category | What to Look For |
68
+ |----------|-----------------|
69
+ | Duplication | Repeated code blocks, copy-paste patterns |
70
+ | Complexity | Long functions, deep nesting, high cyclomatic complexity |
71
+ | Naming | Inconsistent naming, unclear identifiers |
72
+ | Dependencies | Circular deps, tight coupling, god objects |
73
+ | Dead code | Unused functions, unreachable branches |
74
+ | Pattern violations | Inconsistent with project conventions |
75
+
76
+ Present analysis summary table with category, count, severity.
77
+ Confirm with user before proceeding.
78
+
79
+ ### Step 4: Plan Refactoring
80
+
81
+ 1. Write `plan.json` with scope, total_tasks, strategy ("incremental -- each task independently safe")
82
+ 2. For each identified issue, create `.task/TASK-{NNN}.json`:
83
+ - id, title, status (pending), type (refactor), category
84
+ - description, read_first files, files with action/target/change
85
+ - convergence.criteria (grep-verifiable), verification command
86
+ - implementation steps, risk level
87
+ 3. Order: high risk last, dependencies respected, quick wins first
88
+ 4. Update `index.json` plan fields
89
+ 5. Present plan to user via AskUserQuestion -- show affected files, risk areas, ask for approval
90
+
91
+ ### Step 5: Execute with Reflection
92
+
93
+ Initialize `reflection-log.md` if not exists.
94
+
95
+ For each task in order:
96
+
97
+ **5a. Execute refactoring:** Spawn Agent to implement the refactoring — read `read_first` files, apply changes to targets, follow convergence criteria exactly.
98
+
99
+ **5b. Run test suite** (npm test / pytest / go test as appropriate).
100
+
101
+ **5c. Record in reflection-log.md:** Round number, task title, strategy, result (pass/fail), test outcome, adjustment for next round, files changed.
102
+
103
+ **5d. Handle test failures:**
104
+ 1. Revert the change
105
+ 2. Record failure + strategy adjustment in reflection-log.md
106
+ 3. Retry with adjusted strategy (max 2 retries per task)
107
+ 4. If still failing: mark task "blocked", continue to next
108
+
109
+ **5e. Update state:**
110
+ - `.task/TASK-{NNN}.json` status -> "completed" or "blocked"
111
+ - `.summaries/TASK-{NNN}-summary.md` written
112
+ - `index.json` execution and reflection fields updated
113
+
114
+ ### Step 6: Final Verification
115
+
116
+ Run full test suite. Record final state in reflection-log.md: test result, tasks completed/total, tasks blocked, key learnings.
117
+
118
+ ### Step 7: Complete and Report
119
+
120
+ Update `index.json`: status -> "completed", final execution/reflection counts.
121
+
122
+ Display report: scope, tasks completed/blocked, reflection rounds, strategy adjustments, test status, key learnings from reflection-log.md, artifact paths (`{REFACTOR_DIR}/reflection-log.md`, `{REFACTOR_DIR}/.summaries/`).
123
+
124
+ **Next-step routing:**
125
+
126
+ | Result | Next Step |
127
+ |--------|-----------|
128
+ | All tests pass, refactoring complete | `$quality-sync` (update codebase docs) |
129
+ | Test failures remain after refactor | `$quality-debug "{scope}"` |
130
+ | No test suite available for scope | `$quality-auto-test "{phase}"` |
131
+ | Partial completion (some blocked) | `$quality-debug "{scope}"` for blocked tasks |
132
+ </execution>
133
+
134
+ <error_codes>
135
+ | Code | Severity | Condition | Recovery |
136
+ |------|----------|-----------|----------|
137
+ | E001 | error | Scope/description required | Prompt user for module path, feature area, or "all" |
138
+ | E002 | error | Test suite not available | Suggest creating tests first, or proceed with manual verification |
139
+ | W001 | warning | Partial test coverage | Note uncovered areas, proceed with extra caution |
140
+ </error_codes>
141
+
142
+ <success_criteria>
143
+ - [ ] Scope resolved and scratch directory created
144
+ - [ ] Tech debt analysis completed with categorized findings
145
+ - [ ] Refactoring plan approved by user
146
+ - [ ] Each task executed with test verification
147
+ - [ ] Failed changes reverted, retried with adjusted strategy
148
+ - [ ] Reflection log records every round's strategy and outcome
149
+ - [ ] Final test suite passes with zero regressions
150
+ - [ ] Completion report with key learnings displayed
151
+ </success_criteria>
@@ -8,7 +8,7 @@ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
8
8
  <purpose>
9
9
  Multi-lens retrospective for completed phases. Context-Agent Fork loads phase artifacts once;
10
10
  four parallel lens agents (technical, process, quality, decision) analyze independently;
11
- synthesizer distills insights; outputs are routed to spec stubs, knowhow tips, issues, and lessons.jsonl.
11
+ synthesizer distills insights; outputs are routed to spec stubs, knowhow tips, issues, and specs/learnings.md.
12
12
 
13
13
  ```
14
14
  +------------------------------------------------------------------+
@@ -71,8 +71,8 @@ When `-y`: Accept all routing recommendations without prompting. Route all insig
71
71
  - `.workflow/specs/{category-file}.md` -- `<spec-entry>` entries appended to matching category files (one per spec-routed insight)
72
72
  - `.workflow/issues/issues.jsonl` -- appended issue rows (`source: "retrospective"`)
73
73
  - `.workflow/knowhow/TIP-*.md` -- knowhow tips (via `manage-knowhow-capture` skill)
74
- - `.workflow/learning/lessons.jsonl` -- append-only insight log
75
- - `.workflow/learning/learning-index.json` -- updated searchable index
74
+ - `.workflow/specs/learnings.md` -- append-only insight log
75
+ - Index auto-maintained by WikiIndexer
76
76
 
77
77
  **Storage read (never modified)** — all resolved via `state.json.artifacts[]`:
78
78
  ```
@@ -125,7 +125,7 @@ Each artifact's type determines its outputs at `.workflow/{a.path}/`:
125
125
  7. **Archive before overwrite**: Move existing retrospective.{md,json} to `.history/` with timestamp before writing new ones
126
126
  8. **Spec learnings.md backward-compat**: Append to it only if it already exists -- never create it
127
127
  9. **Route confirmation**: Unless `-y`, present routing table and ask per-group before writing spec/issue/knowhow
128
- 10. **Lessons always written**: Append to `lessons.jsonl` regardless of `--no-route` -- routing only controls spec/issue/knowhow creation
128
+ 10. **Lessons always written**: Append to `specs/learnings.md` regardless of `--no-route` -- routing only controls spec/issue/knowhow creation
129
129
  </invariants>
130
130
 
131
131
  <execution>
@@ -250,7 +250,7 @@ Write two files to `{target_dir}/`:
250
250
  - **retrospective.json**: phase, slug, timestamp, lenses_run, metrics, findings_by_lens, distilled_insights, routing_summary
251
251
  - **retrospective.md**: Header with phase/slug/timestamp, metrics table (tasks completed, test pass rate, review issues, UAT scenarios), findings by lens, distilled insights, routing summary
252
252
 
253
- Append each insight to `.workflow/learning/lessons.jsonl` and update `learning-index.json`.
253
+ Append each insight to `.workflow/specs/learnings.md`.
254
254
 
255
255
  If `.workflow/specs/learnings.md` already exists, append each insight as `<spec-entry>` (category=`learning`, auto-extract keywords, date=today, source=`retrospective`). Never create the file -- only append if it exists.
256
256
 
@@ -287,6 +287,6 @@ Next steps: `$manage-status`, `$manage-issue "list --source retrospective"`, `$m
287
287
  - [ ] Synthesizer produces deduplicated insights with stable INS-ids
288
288
  - [ ] Routing applied per insight (spec/issue/knowhow/none) with confirmation
289
289
  - [ ] retrospective.{md,json} written to phase directory
290
- - [ ] Lessons appended to lessons.jsonl regardless of --no-route flag
290
+ - [ ] Lessons appended to specs/learnings.md regardless of --no-route flag
291
291
  - [ ] Existing retrospective archived before overwrite
292
292
  </success_criteria>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: spec-add
3
- description: Add spec entry by category
4
- argument-hint: "<category> <content>"
3
+ description: Add spec entry by category with role tagging
4
+ argument-hint: "<category> <content> [--roles <csv>]"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep
6
6
  ---
7
7
 
@@ -15,9 +15,9 @@ $spec-add "arch Use Zod for runtime validation over io-ts"
15
15
  $spec-add "quality All API endpoints must return structured error objects"
16
16
  ```
17
17
 
18
- **Valid categories**: coding, arch, quality, debug, test, review, learning, bug, pattern, decision, rule, validation.
18
+ **Valid categories**: coding, arch, quality, debug, test, review, learning, tools, bug, pattern, decision, rule, validation.
19
19
 
20
- **CLI alternative**: `maestro spec add <category> "<title>" "<content>" --keywords kw1,kw2 --source <src>`. Used by workflow agents (analyze, plan, execute) for programmatic spec enrichment.
20
+ **CLI alternative**: `maestro spec add <category> "<title>" "<content>" --keywords kw1,kw2 --roles implement,test --source <src>`. Used by workflow agents (analyze, plan, execute) for programmatic spec enrichment.
21
21
  </purpose>
22
22
 
23
23
  <context>
@@ -33,6 +33,7 @@ $ARGUMENTS — `<category> <content>` where category selects the target file.
33
33
  | `test` | `test-conventions.md` |
34
34
  | `review` | `review-standards.md` |
35
35
  | `learning` | `learnings.md` |
36
+ | `tools` | `tools.md` |
36
37
  | `bug` | `learnings.md` |
37
38
  | `pattern` | `coding-conventions.md` |
38
39
  | `decision` | `architecture-constraints.md` |
@@ -40,6 +41,8 @@ $ARGUMENTS — `<category> <content>` where category selects the target file.
40
41
  | `validation` | `quality-rules.md` |
41
42
 
42
43
  Extended types (`bug`, `pattern`, `decision`, `rule`, `validation`) are stored in the file of their closest core category but retain their specific category in the `<spec-entry>` tag.
44
+
45
+ **--roles option**: When `--roles` is provided, the entry uses `roles` attr instead of `category` attr. This declares which agent roles should load this entry via `spec load --role`.
43
46
  </context>
44
47
 
45
48
  <execution>
@@ -70,6 +73,16 @@ Auto-extract 3-5 relevant keywords from the content. Keywords should be:
70
73
  Append `<spec-entry>` closed-tag block to target file:
71
74
 
72
75
  ```markdown
76
+ <!-- With --roles (new format): -->
77
+ <spec-entry roles="{role1},{role2}" keywords="{kw1},{kw2},{kw3}" date="{YYYY-MM-DD}">
78
+
79
+ ### {title extracted from content}
80
+
81
+ {content}
82
+
83
+ </spec-entry>
84
+
85
+ <!-- Without --roles (legacy format): -->
73
86
  <spec-entry category="{category}" keywords="{kw1},{kw2},{kw3}" date="{YYYY-MM-DD}">
74
87
 
75
88
  ### {title extracted from content}
@@ -1,45 +1,41 @@
1
1
  ---
2
2
  name: spec-load
3
3
  description: Load specs and lessons for current context
4
- argument-hint: "[--category <type>] [--keyword <word>]"
4
+ argument-hint: "[--role <role>] [--keyword <word>]"
5
5
  allowed-tools: Read, Bash, Glob, Grep
6
6
  ---
7
7
 
8
8
  <purpose>
9
- Load relevant specs filtered by category (file-level) and/or keyword (entry-level via `<spec-entry>` tags).
9
+ Load relevant specs filtered by role (primary), category (file-level), and/or keyword (entry-level).
10
+ Role-based loading: loads role's primary doc in full + matching entries from other files.
10
11
  </purpose>
11
12
 
12
13
  <context>
13
- $ARGUMENTS — optional category filter and keyword.
14
+ $ARGUMENTS — optional role, category filter, and keyword.
14
15
 
15
16
  ```bash
16
17
  $spec-load
17
- $spec-load "--category coding"
18
+ $spec-load "--role implement"
18
19
  $spec-load "--keyword auth"
19
- $spec-load "--category coding --keyword naming"
20
+ $spec-load "--role implement --keyword auth"
21
+ $spec-load "--role review"
20
22
  ```
21
23
 
22
- **Category-to-file mapping (1:1, same as spec-add):**
23
-
24
- | Category | File loaded |
25
- |----------|------------|
26
- | `coding` | `coding-conventions.md` |
27
- | `arch` | `architecture-constraints.md` |
28
- | `quality` | `quality-rules.md` |
29
- | `debug` | `debug-notes.md` |
30
- | `test` | `test-conventions.md` |
31
- | `review` | `review-standards.md` |
32
- | `learning` | `learnings.md` |
33
- | `bug` | `learnings.md` |
34
- | `pattern` | `coding-conventions.md` |
35
- | `decision` | `architecture-constraints.md` |
36
- | `rule` | `quality-rules.md` |
37
- | `validation` | `quality-rules.md` |
38
- | `all` (default) | All spec files |
39
-
40
- Extended types (`bug`, `pattern`, `decision`, `rule`, `validation`) are stored in their closest core category's file but retain their specific category in the `<spec-entry>` tag.
41
-
42
- **Keyword filtering**: When `--keyword` is provided, only entries with matching keyword in their `<spec-entry keywords="...">` attribute are returned. Legacy entries (heading format) are filtered by text grep.
24
+ **File Primary Role mapping:**
25
+ | File | Primary Role |
26
+ |------|-------------|
27
+ | `coding-conventions.md` | implement |
28
+ | `architecture-constraints.md` | plan |
29
+ | `test-conventions.md` | test |
30
+ | `review-standards.md` | review |
31
+ | `debug-notes.md` | analyze |
32
+ | `quality-rules.md` | review |
33
+ | `learnings.md` | implement |
34
+ | `tools.md` | _(per-entry roles)_ |
35
+
36
+ **--role loading**: Loads primary role doc in full + entries from other files that have matching `roles` attr.
37
+
38
+ **Keyword filtering**: When `--keyword` is provided, only entries with matching keyword in their `<spec-entry keywords="...">` attribute are returned.
43
39
  </context>
44
40
 
45
41
  <execution>
@@ -50,11 +46,11 @@ Verify `.workflow/specs/` exists (E001).
50
46
 
51
47
  ### Step 2: Parse Arguments
52
48
 
53
- Extract optional `--category` and `--keyword` flags.
49
+ Extract optional `--role` and `--keyword` flags.
54
50
 
55
51
  ### Step 3: Load via CLI
56
52
 
57
- Run `maestro spec load [--category <cat>] [--keyword <word>]`. If CLI unavailable, read files directly and apply keyword filter.
53
+ Run `maestro spec load [--role <role>] [--keyword <word>]`. If CLI unavailable, read files directly and apply keyword/role filter.
58
54
 
59
55
  ### Step 4: Display Results
60
56
 
@@ -26,7 +26,7 @@ Run test suites, collect coverage data, and perform automatic fix cycles when te
26
26
  | Target layer | task description `layer: L1/L2/L3` | Yes |
27
27
 
28
28
  1. Extract session path and target layer from task description
29
- 2. Load validation specs: Run `maestro spec load --category quality` for verification rules and acceptance criteria
29
+ 2. Load validation specs: Run `maestro spec load --role review` for verification rules and acceptance criteria
30
30
  3. Read .msg/meta.json for strategy and generated test file list
31
31
  3. Detect test command by framework:
32
32
 
@@ -21,7 +21,7 @@ Deep analysis on scan findings: triage, root cause / impact / optimization enric
21
21
  | .msg/meta.json | <session>/.msg/meta.json | No |
22
22
 
23
23
  1. Extract session path, input path, dimensions from task description
24
- 2. Load review specs: Run `maestro spec load --category review` for review standards, checklists, and approval gates
24
+ 2. Load review specs: Run `maestro spec load --role review` for review standards, checklists, and approval gates
25
25
  3. Load scan results. If missing or empty -> report clean, complete immediately
26
26
  3. Load wisdom files from `<session>/wisdom/`
27
27
  4. Triage findings into two buckets:
@@ -18,7 +18,7 @@ Multi-dimension tech debt scanner. Scan codebase across 5 dimensions (code, arch
18
18
  | .msg/meta.json | <session>/.msg/meta.json | Yes |
19
19
 
20
20
  1. Extract session path and scan scope from task description
21
- 2. Load debug specs: Run `maestro spec load --category debug` for known issues, workarounds, and root-cause notes
21
+ 2. Load debug specs: Run `maestro spec load --role analyze` for known issues, workarounds, and root-cause notes
22
22
  3. Read .msg/meta.json for team context
23
23
  3. Detect project type and framework:
24
24
 
@@ -24,7 +24,7 @@ Execute tests, collect coverage, attempt auto-fix for failures. Acts as the Crit
24
24
  | .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
25
25
 
26
26
  1. Extract session path and test directory from task description
27
- 2. Load test specs: Run `maestro spec load --category test` for test framework conventions and coverage targets
27
+ 2. Load test specs: Run `maestro spec load --role test` for test framework conventions and coverage targets
28
28
  3. Extract coverage target (default: 80%)
29
29
  3. Read .msg/meta.json for framework info (from strategist namespace)
30
30
  4. Determine test framework:
@@ -22,7 +22,7 @@ Generate test code by layer (L1 unit / L2 integration / L3 E2E). Acts as the Gen
22
22
  | .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
23
23
 
24
24
  1. Extract session path and layer from task description
25
- 2. Load test specs: Run `maestro spec load --category test` for test framework conventions and coverage targets
25
+ 2. Load test specs: Run `maestro spec load --role test` for test framework conventions and coverage targets
26
26
  3. Read test strategy:
27
27
 
28
28
  ```
@@ -15,12 +15,12 @@ optionally auto-applies new `related` links to improve graph connectivity.
15
15
  $ARGUMENTS — optional flags.
16
16
 
17
17
  **Flags:**
18
- - `--scope <type>` — Limit to wiki type (spec, knowhow, note, lesson, issue). Default: all.
18
+ - `--scope <type>` — Limit to wiki type (spec, knowhow, note, issue). Default: all.
19
19
  - `--min-similarity N` — Threshold 0.0-1.0 (default: 0.3)
20
20
  - `--fix` — Auto-apply top suggestions
21
21
  - `--max N` — Max suggestions (default: 20)
22
22
 
23
- **Output**: `.workflow/learning/wiki-connections-{date}.md`
23
+ **Output**: `.workflow/knowhow/KNW-wiki-connections-{date}.md`
24
24
  </context>
25
25
 
26
26
  <execution>
@@ -47,7 +47,7 @@ For each suggestion: get entry → append target to `related` → update via `ma
47
47
  Re-run `maestro wiki health` for delta.
48
48
 
49
49
  ### Stage 6: Persist
50
- Write `wiki-connections-{date}.md`. Append graph insights to `lessons.jsonl` (source: "wiki-connect").
50
+ Write `KNW-wiki-connections-{date}.md`. Append graph insights to `specs/learnings.md` (source: "wiki-connect").
51
51
 
52
52
  **Next steps:** `/wiki-digest <topic>`, `/manage-wiki health`, `/learn-follow <wiki-id>`, `maestro wiki graph`
53
53
  </execution>
@@ -68,6 +68,6 @@ Write `wiki-connections-{date}.md`. Append graph insights to `lessons.jsonl` (so
68
68
  - [ ] Candidates scored and ranked
69
69
  - [ ] Suggestions displayed with scores and reasons
70
70
  - [ ] If --fix: entries updated, new health score reported
71
- - [ ] Report written to `wiki-connections-{date}.md`
72
- - [ ] Graph insights appended to `lessons.jsonl`
71
+ - [ ] Report written to `KNW-wiki-connections-{date}.md`
72
+ - [ ] Graph insights appended to `specs/learnings.md`
73
73
  </success_criteria>
@@ -26,7 +26,7 @@ $ARGUMENTS — scope and optional flags.
26
26
  - `--format full` — Detailed with per-entry summaries
27
27
  - `--create-issues` — Auto-create knowledge-gap issues in issues.jsonl
28
28
 
29
- **Output**: `.workflow/learning/digest-{slug}-{date}.md`
29
+ **Output**: `.workflow/knowhow/KNW-digest-{slug}-{date}.md`
30
30
  </context>
31
31
 
32
32
  <execution>
@@ -41,7 +41,7 @@ Group entries into 3-5 themes via: tag co-occurrence, title BM25 similarity, rel
41
41
  Per theme: summary paragraph, key entries (by hub score), gap detection (broken links, orphans, TODO markers, missing perspectives), health score.
42
42
 
43
43
  ### Stage 4: Cross-Reference with Lessons
44
- Search `lessons.jsonl` for related insights. Flag unlinked insights (lessons matching theme but not referenced by wiki entries).
44
+ Search `specs/learnings.md` for related insights. Flag unlinked insights (knowhow entries matching theme but not referenced by wiki entries).
45
45
 
46
46
  ### Stage 5: Coverage Heatmap
47
47
  Type × theme matrix showing knowledge density:
@@ -49,7 +49,7 @@ Type × theme matrix showing knowledge density:
49
49
  Theme 1 Theme 2 Theme 3
50
50
  spec ███░░ ░░░░░ █████
51
51
  memory ████░ ███░░ ░░░░░
52
- lesson █░░░░ ██░░░ ████░
52
+ knowhow █░░░░ ██░░░ ████░
53
53
  ```
54
54
  Empty cells = knowledge gaps.
55
55
 
@@ -60,7 +60,7 @@ Produce `digest-{slug}-{date}.md` with themes, heatmap, gaps, unlinked insights,
60
60
  For each gap: dedup against issues.jsonl, append with `type: "knowledge-gap"`, `source: "wiki-digest"`.
61
61
 
62
62
  ### Stage 8: Persist
63
- Append meta-insights to `lessons.jsonl` (source: "wiki-digest"). Display summary.
63
+ Append meta-insights to `specs/learnings.md` (source: "wiki-digest"). Display summary.
64
64
 
65
65
  **Next steps:** `/learn-follow <wiki-id>`, `/wiki-connect --fix`, `/manage-wiki cleanup`, `/learn-decompose <path>`
66
66
  </execution>
@@ -71,7 +71,7 @@ Append meta-insights to `lessons.jsonl` (source: "wiki-digest"). Display summary
71
71
  | E001 | error | No wiki entries found | Initialize wiki content |
72
72
  | E002 | error | Topic search returned 0 | Broaden topic |
73
73
  | W001 | warning | Too few entries (<5) | Themes may be trivial |
74
- | W002 | warning | lessons.jsonl not found | Skip cross-reference |
74
+ | W002 | warning | learnings.md not found | Skip cross-reference |
75
75
  | W003 | warning | Some entry bodies failed to load | Partial summaries |
76
76
  </error_codes>
77
77
 
@@ -79,9 +79,9 @@ Append meta-insights to `lessons.jsonl` (source: "wiki-digest"). Display summary
79
79
  - [ ] Scope parsed and entries loaded
80
80
  - [ ] Entries clustered into 3-5 semantic themes
81
81
  - [ ] Per-theme analysis with gaps identified
82
- - [ ] Cross-reference with lessons.jsonl completed
82
+ - [ ] Cross-reference with specs/learnings.md completed
83
83
  - [ ] Coverage heatmap generated
84
84
  - [ ] If --create-issues: gap issues created (deduped)
85
- - [ ] Digest written to `digest-{slug}-{date}.md`
86
- - [ ] Meta-insights appended to lessons.jsonl
85
+ - [ ] Digest written to `KNW-digest-{slug}-{date}.md`
86
+ - [ ] Meta-insights appended to specs/learnings.md
87
87
  </success_criteria>
@@ -341,8 +341,10 @@ export class ClaudeCodeAdapter extends BaseAgentAdapter {
341
341
  this.handlePermissionRequest(msg, processId);
342
342
  break;
343
343
  }
344
- case 'system': {
345
- // System messages are informational; skip silently
344
+ case 'system':
345
+ case 'user': {
346
+ // System and user messages are informational; skip silently.
347
+ // 'user' messages are echoes of stdin input in stream-json mode.
346
348
  break;
347
349
  }
348
350
  default: