maestro-flow 0.3.43 → 0.3.45

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 (149) 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 +1 -2
  13. package/.claude/commands/maestro-tools-execute.md +117 -0
  14. package/.claude/commands/maestro-tools-register.md +136 -0
  15. package/.claude/commands/maestro-ui-codify.md +67 -0
  16. package/.claude/commands/manage-harvest.md +1 -1
  17. package/.claude/commands/manage-learn.md +5 -7
  18. package/.claude/commands/manage-wiki.md +1 -1
  19. package/.claude/commands/quality-auto-test.md +1 -1
  20. package/.claude/commands/quality-debug.md +8 -0
  21. package/.claude/commands/quality-retrospective.md +4 -5
  22. package/.claude/commands/quality-review.md +8 -0
  23. package/.claude/commands/spec-add.md +18 -2
  24. package/.claude/commands/spec-load.md +25 -6
  25. package/.claude/commands/spec-setup.md +2 -2
  26. package/.claude/commands/wiki-connect.md +1 -1
  27. package/.claude/commands/wiki-digest.md +5 -6
  28. package/.claude/skills/codify-to-knowhow/SKILL.md +167 -0
  29. package/.claude/skills/codify-to-knowhow/phases/01-load-manifest.md +101 -0
  30. package/.claude/skills/codify-to-knowhow/phases/02-generate-knowhow.md +97 -0
  31. package/.claude/skills/codify-to-knowhow/phases/03-generate-specs.md +92 -0
  32. package/.claude/skills/codify-to-knowhow/phases/04-index-verify.md +119 -0
  33. package/.codex/skills/codify-to-knowhow/SKILL.md +427 -0
  34. package/.codex/skills/learn-decompose/SKILL.md +8 -8
  35. package/.codex/skills/learn-follow/SKILL.md +6 -6
  36. package/.codex/skills/learn-investigate/SKILL.md +4 -4
  37. package/.codex/skills/learn-retro/SKILL.md +7 -7
  38. package/.codex/skills/learn-second-opinion/SKILL.md +6 -6
  39. package/.codex/skills/maestro-analyze/SKILL.md +491 -491
  40. package/.codex/skills/maestro-collab/SKILL.md +1 -1
  41. package/.codex/skills/maestro-learn/SKILL.md +1 -1
  42. package/.codex/skills/maestro-milestone-complete/SKILL.md +122 -122
  43. package/.codex/skills/maestro-plan/SKILL.md +485 -485
  44. package/.codex/skills/maestro-tools-execute/SKILL.md +105 -0
  45. package/.codex/skills/maestro-tools-register/SKILL.md +149 -0
  46. package/.codex/skills/maestro-ui-codify/SKILL.md +398 -0
  47. package/.codex/skills/maestro-verify/SKILL.md +486 -486
  48. package/.codex/skills/manage-harvest/SKILL.md +3 -3
  49. package/.codex/skills/manage-issue-discover/SKILL.md +431 -431
  50. package/.codex/skills/manage-learn/SKILL.md +13 -13
  51. package/.codex/skills/manage-wiki/SKILL.md +1 -1
  52. package/.codex/skills/quality-auto-test/SKILL.md +553 -553
  53. package/.codex/skills/quality-refactor/SKILL.md +151 -151
  54. package/.codex/skills/quality-retrospective/SKILL.md +6 -6
  55. package/.codex/skills/spec-add/SKILL.md +104 -101
  56. package/.codex/skills/spec-load/SKILL.md +73 -77
  57. package/.codex/skills/team-quality-assurance/roles/executor/role.md +1 -1
  58. package/.codex/skills/wiki-connect/SKILL.md +5 -5
  59. package/.codex/skills/wiki-digest/SKILL.md +8 -8
  60. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +0 -1
  61. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  62. package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js +2 -2
  63. package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js.map +1 -1
  64. package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.d.ts +1 -1
  65. package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.js +1 -1
  66. package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.js.map +1 -1
  67. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +2 -2
  68. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  69. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.d.ts +6 -3
  70. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +29 -14
  71. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -1
  72. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +0 -1
  73. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  74. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +1 -2
  75. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +2 -52
  76. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  77. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +68 -33
  78. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  79. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +1 -1
  80. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +1 -11
  81. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
  82. package/dashboard/dist-server/dashboard/src/server/wiki/writer.d.ts +5 -4
  83. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +26 -12
  84. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
  85. package/dashboard/dist-server/src/agents/cli-agent-runner.js +5 -5
  86. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  87. package/dashboard/dist-server/src/tools/spec-entry-parser.d.ts +4 -2
  88. package/dashboard/dist-server/src/tools/spec-entry-parser.js +19 -7
  89. package/dashboard/dist-server/src/tools/spec-entry-parser.js.map +1 -1
  90. package/dashboard/dist-server/src/tools/spec-loader.d.ts +4 -4
  91. package/dashboard/dist-server/src/tools/spec-loader.js +166 -23
  92. package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
  93. package/dist/src/agents/cli-agent-runner.js +5 -5
  94. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  95. package/dist/src/commands/knowhow.d.ts.map +1 -1
  96. package/dist/src/commands/knowhow.js +25 -6
  97. package/dist/src/commands/knowhow.js.map +1 -1
  98. package/dist/src/commands/spec.d.ts +1 -1
  99. package/dist/src/commands/spec.d.ts.map +1 -1
  100. package/dist/src/commands/spec.js +70 -3
  101. package/dist/src/commands/spec.js.map +1 -1
  102. package/dist/src/commands/wiki.d.ts.map +1 -1
  103. package/dist/src/commands/wiki.js +45 -6
  104. package/dist/src/commands/wiki.js.map +1 -1
  105. package/dist/src/hooks/keyword-spec-injector.js +1 -1
  106. package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
  107. package/dist/src/hooks/plugins/spec-injection-plugin.js +2 -2
  108. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  109. package/dist/src/hooks/spec-injector.d.ts +0 -6
  110. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  111. package/dist/src/hooks/spec-injector.js +36 -43
  112. package/dist/src/hooks/spec-injector.js.map +1 -1
  113. package/dist/src/hooks/wiki-role-loader.d.ts +18 -0
  114. package/dist/src/hooks/wiki-role-loader.d.ts.map +1 -0
  115. package/dist/src/hooks/wiki-role-loader.js +43 -0
  116. package/dist/src/hooks/wiki-role-loader.js.map +1 -0
  117. package/dist/src/tools/spec-entry-parser.d.ts +4 -2
  118. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
  119. package/dist/src/tools/spec-entry-parser.js +19 -7
  120. package/dist/src/tools/spec-entry-parser.js.map +1 -1
  121. package/dist/src/tools/spec-init.js +54 -54
  122. package/dist/src/tools/spec-loader.d.ts +4 -4
  123. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  124. package/dist/src/tools/spec-loader.js +166 -23
  125. package/dist/src/tools/spec-loader.js.map +1 -1
  126. package/dist/src/tools/spec-writer.d.ts +5 -0
  127. package/dist/src/tools/spec-writer.d.ts.map +1 -1
  128. package/dist/src/tools/spec-writer.js +27 -0
  129. package/dist/src/tools/spec-writer.js.map +1 -1
  130. package/dist/src/tools/store-knowhow.d.ts.map +1 -1
  131. package/dist/src/tools/store-knowhow.js +56 -27
  132. package/dist/src/tools/store-knowhow.js.map +1 -1
  133. package/package.json +1 -1
  134. package/workflows/execute.md +1 -1
  135. package/workflows/harvest.md +13 -13
  136. package/workflows/knowhow.md +72 -11
  137. package/workflows/learn.md +70 -58
  138. package/workflows/milestone-complete.md +1 -1
  139. package/workflows/retrospective.md +50 -56
  140. package/workflows/specs-load.md +15 -14
  141. package/workflows/tools-spec.md +65 -0
  142. package/workflows/ui-codify-extract.md +373 -0
  143. package/workflows/ui-codify-knowhow.md +258 -0
  144. package/workflows/ui-codify-package.md +161 -0
  145. package/workflows/ui-codify.md +225 -0
  146. package/workflows/verify.md +1 -1
  147. package/workflows/wiki-connect.md +7 -7
  148. package/workflows/wiki-digest.md +13 -13
  149. package/workflows/wiki-manage.md +1 -1
@@ -208,7 +208,7 @@ Mark each eligible tool as `recommended: true/false` based on auto-selection.
208
208
 
209
209
  **3. Context loading**:
210
210
  - Read `.workflow/project.md` if exists
211
- - Load project specs: `maestro spec load --category arch,coding` (if available)
211
+ - Load project specs: `maestro spec load --category coding` (if available)
212
212
  - Grep for relevant codebase files based on requirement keywords
213
213
 
214
214
  **4. Build delegate prompt** (shared across all tools):
@@ -33,7 +33,7 @@ $ARGUMENTS — learning intent text, or flags.
33
33
  | `deep-understand` | follow → decompose → second-opinion | Thorough module analysis |
34
34
  | `pattern-catalog` | decompose --save-spec --save-wiki → second-opinion --mode review | Full pattern extraction + review |
35
35
 
36
- **Session state:** `.workflow/learning/.maestro-learn/{session_id}/status.json`
36
+ **Session state:** `.workflow/knowhow/.maestro-learn/{session_id}/status.json`
37
37
  </context>
38
38
 
39
39
  <execution>
@@ -1,122 +1,122 @@
1
- ---
2
- name: maestro-milestone-complete
3
- description: Archive completed milestone and prepare for next
4
- argument-hint: "[milestone] [--force] [-y]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
- ---
7
-
8
- <purpose>
9
- Sequential milestone archival: validate audit → archive scratch dirs → extract learnings → move artifact entries to milestone_history → advance state → clean scratch.
10
- </purpose>
11
-
12
- <context>
13
-
14
- ```bash
15
- $maestro-milestone-complete "M1"
16
- $maestro-milestone-complete # uses current_milestone from state.json
17
- $maestro-milestone-complete --force "M1" # skip audit check
18
- ```
19
-
20
- **Output**: `.workflow/milestones/{milestone}/` archive directory
21
-
22
- </context>
23
-
24
- <invariants>
25
- 1. **Audit before archive** — refuse without passing audit (unless --force)
26
- 2. **Atomic state update** — write state.json via tmp+rename
27
- 3. **Learnings are mandatory** — always extract before archiving
28
- 4. **Clean after archive** — remove scratch dirs only after successful copy
29
- 5. **Advance state** — always set next milestone or mark project complete
30
- </invariants>
31
-
32
- <execution>
33
-
34
- ### Step 1: Parse & Validate
35
-
36
- Read `.workflow/state.json` for `current_milestone`, `artifacts[]`, `milestones[]`. Determine target from args or current_milestone (E001 if none).
37
-
38
- Validate audit report at `.workflow/milestones/{milestone}/audit-report.md`:
39
- - Parse for `## Verdict` section (or `**Verdict:**` inline)
40
- - PASS condition: verdict line contains the word `PASS` (case-insensitive)
41
- - Any other verdict (FAIL, PARTIAL, missing section) → E002 unless `--force`
42
-
43
- Verify all milestone artifacts completed (E003 unless `--force`).
44
-
45
- ### Step 2: Archive Scratch Dirs
46
-
47
- Copy each milestone artifact's directory to `.workflow/milestones/{milestone}/artifacts/`.
48
-
49
- **Source path resolution**: For each entry in `state.json.artifacts[]`, resolve the source directory from `artifact.path`:
50
- - If `artifact.path` is relative (e.g. `scratch/M1-auth`), resolve from `.workflow/` (→ `.workflow/scratch/M1-auth`)
51
- - If `artifact.path` is absolute, use as-is
52
- - Copy the entire resolved directory to `.workflow/milestones/{milestone}/artifacts/{artifact.name}/`
53
-
54
- Snapshot `roadmap.md` as `roadmap-snapshot.md` in the milestone archive.
55
-
56
- ### Step 3: Extract Learnings
57
-
58
- **Source files** (read in order):
59
- 1. `.workflow/milestones/{milestone}/artifacts/**/.summaries/*.md` — task completion summaries
60
- 2. `.workflow/milestones/{milestone}/artifacts/**/reflection-log.md` — retrospective entries
61
-
62
- **Extraction**: Parse each source for patterns, pitfalls, strategy adjustments. Look for recurring themes across summaries and explicit lessons in reflection logs.
63
-
64
- **Dedup**: Run `maestro spec load --category learning` to load existing entries. Skip any extracted learning whose keywords fully overlap with an existing entry.
65
-
66
- **Write**: Append to `.workflow/specs/learnings.md` using `<spec-entry>` closed-tag format:
67
- ```
68
- <spec-entry category="learning" keywords="kw1, kw2" date="YYYY-MM-DD" source="milestone-complete:{milestone}">
69
- Learning content here.
70
- </spec-entry>
71
- ```
72
-
73
- ### Step 3b: Knowledge Promotion Inquiry
74
-
75
- 1. **High-frequency patterns**: Scan all `<spec-entry category="learning">` entries for keyword overlap. Trigger threshold: **>=2 entries sharing the same keyword**. For each triggered keyword, ask: "Keyword '{keyword}' appears in {N} learning entries. Promote to formal coding convention?"
76
- 2. **Convention drift**: Compare executed task summaries against `coding-conventions.md` and `architecture-constraints.md`. Trigger threshold: **any deviation found** (technique used but not documented, or documented convention not followed). Ask: "Convention '{convention}' was bypassed during this milestone. Update conventions?"
77
- 3. **Wiki island check**: Auto-trigger `wiki-connect --fix` to link new knowledge. Trigger threshold: **always runs** (no user confirmation needed).
78
-
79
- If `-y`: auto-accept all promotions without asking.
80
- If not `-y`: ask user for confirmation via `request_user_input`:
81
- ```json
82
- { "questions": [{ "id": "promote_learning", "header": "Knowledge Promotion", "question": "Keyword '{keyword}' appears in {N} learning entries. Promote to coding convention?", "options": [{ "label": "Yes, promote (Recommended)", "description": "Add as formal coding convention via spec-add" }, { "label": "No, keep as learning", "description": "Leave in learnings.md without promotion" }] }] }
83
- ```
84
- If user confirms, append `<spec-entry>` to target category file preserving original date and source.
85
-
86
- ### Step 4: Archive Artifact Entries
87
-
88
- Move milestone artifacts from `state.json.artifacts[]` to `milestone_history[]` with completion metadata (id, name, status, completed_at, archive_path, archived_artifacts). Remove from active `artifacts[]`.
89
-
90
- ### Step 5: Advance State
91
-
92
- Set `current_milestone` to next pending milestone (mark it active), or set project `status: "completed"` if none remain. Atomic write to `state.json`.
93
-
94
- ### Step 6: Clean Scratch
95
-
96
- Remove archived artifact directories from `.workflow/`.
97
-
98
- ### Step 7: Generate Summary & Report
99
-
100
- Write `.workflow/milestones/{milestone}/summary.md` with outcomes and learnings. Update `.workflow/project.md` Context section. Display completion report with next steps: `$maestro-milestone-release`, `$maestro-analyze`, `$manage-status`, `$manage-wiki health`, `$wiki-digest`.
101
-
102
- </execution>
103
-
104
- <error_codes>
105
-
106
- | Code | Severity | Description | Recovery |
107
- |------|----------|-------------|----------|
108
- | E001 | error | Milestone identifier required | Specify milestone |
109
- | E002 | error | Audit not passed | Run milestone-audit first |
110
- | E003 | error | Incomplete artifacts remain | Complete work first |
111
-
112
- </error_codes>
113
-
114
- <success_criteria>
115
- - [ ] Audit report validated (or --force used)
116
- - [ ] Scratch directories archived to milestones/
117
- - [ ] Learnings extracted and appended to specs/learnings.md
118
- - [ ] Artifact entries moved to milestone_history in state.json
119
- - [ ] State advanced to next milestone (or project marked complete)
120
- - [ ] Scratch directories cleaned
121
- - [ ] Summary and completion report generated
122
- </success_criteria>
1
+ ---
2
+ name: maestro-milestone-complete
3
+ description: Archive completed milestone and prepare for next
4
+ argument-hint: "[milestone] [--force] [-y]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Sequential milestone archival: validate audit → archive scratch dirs → extract learnings → move artifact entries to milestone_history → advance state → clean scratch.
10
+ </purpose>
11
+
12
+ <context>
13
+
14
+ ```bash
15
+ $maestro-milestone-complete "M1"
16
+ $maestro-milestone-complete # uses current_milestone from state.json
17
+ $maestro-milestone-complete --force "M1" # skip audit check
18
+ ```
19
+
20
+ **Output**: `.workflow/milestones/{milestone}/` archive directory
21
+
22
+ </context>
23
+
24
+ <invariants>
25
+ 1. **Audit before archive** — refuse without passing audit (unless --force)
26
+ 2. **Atomic state update** — write state.json via tmp+rename
27
+ 3. **Learnings are mandatory** — always extract before archiving
28
+ 4. **Clean after archive** — remove scratch dirs only after successful copy
29
+ 5. **Advance state** — always set next milestone or mark project complete
30
+ </invariants>
31
+
32
+ <execution>
33
+
34
+ ### Step 1: Parse & Validate
35
+
36
+ Read `.workflow/state.json` for `current_milestone`, `artifacts[]`, `milestones[]`. Determine target from args or current_milestone (E001 if none).
37
+
38
+ Validate audit report at `.workflow/milestones/{milestone}/audit-report.md`:
39
+ - Parse for `## Verdict` section (or `**Verdict:**` inline)
40
+ - PASS condition: verdict line contains the word `PASS` (case-insensitive)
41
+ - Any other verdict (FAIL, PARTIAL, missing section) → E002 unless `--force`
42
+
43
+ Verify all milestone artifacts completed (E003 unless `--force`).
44
+
45
+ ### Step 2: Archive Scratch Dirs
46
+
47
+ Copy each milestone artifact's directory to `.workflow/milestones/{milestone}/artifacts/`.
48
+
49
+ **Source path resolution**: For each entry in `state.json.artifacts[]`, resolve the source directory from `artifact.path`:
50
+ - If `artifact.path` is relative (e.g. `scratch/M1-auth`), resolve from `.workflow/` (→ `.workflow/scratch/M1-auth`)
51
+ - If `artifact.path` is absolute, use as-is
52
+ - Copy the entire resolved directory to `.workflow/milestones/{milestone}/artifacts/{artifact.name}/`
53
+
54
+ Snapshot `roadmap.md` as `roadmap-snapshot.md` in the milestone archive.
55
+
56
+ ### Step 3: Extract Learnings
57
+
58
+ **Source files** (read in order):
59
+ 1. `.workflow/milestones/{milestone}/artifacts/**/.summaries/*.md` — task completion summaries
60
+ 2. `.workflow/milestones/{milestone}/artifacts/**/reflection-log.md` — retrospective entries
61
+
62
+ **Extraction**: Parse each source for patterns, pitfalls, strategy adjustments. Look for recurring themes across summaries and explicit lessons in reflection logs.
63
+
64
+ **Dedup**: Run `maestro spec load --category coding` to load existing entries. Skip any extracted learning whose keywords fully overlap with an existing entry.
65
+
66
+ **Write**: Append to `.workflow/specs/learnings.md` using `<spec-entry>` closed-tag format:
67
+ ```
68
+ <spec-entry category="learning" keywords="kw1, kw2" date="YYYY-MM-DD" source="milestone-complete:{milestone}">
69
+ Learning content here.
70
+ </spec-entry>
71
+ ```
72
+
73
+ ### Step 3b: Knowledge Promotion Inquiry
74
+
75
+ 1. **High-frequency patterns**: Scan all `<spec-entry category="learning">` entries for keyword overlap. Trigger threshold: **>=2 entries sharing the same keyword**. For each triggered keyword, ask: "Keyword '{keyword}' appears in {N} learning entries. Promote to formal coding convention?"
76
+ 2. **Convention drift**: Compare executed task summaries against `coding-conventions.md` and `architecture-constraints.md`. Trigger threshold: **any deviation found** (technique used but not documented, or documented convention not followed). Ask: "Convention '{convention}' was bypassed during this milestone. Update conventions?"
77
+ 3. **Wiki island check**: Auto-trigger `wiki-connect --fix` to link new knowledge. Trigger threshold: **always runs** (no user confirmation needed).
78
+
79
+ If `-y`: auto-accept all promotions without asking.
80
+ If not `-y`: ask user for confirmation via `request_user_input`:
81
+ ```json
82
+ { "questions": [{ "id": "promote_learning", "header": "Knowledge Promotion", "question": "Keyword '{keyword}' appears in {N} learning entries. Promote to coding convention?", "options": [{ "label": "Yes, promote (Recommended)", "description": "Add as formal coding convention via spec-add" }, { "label": "No, keep as learning", "description": "Leave in learnings.md without promotion" }] }] }
83
+ ```
84
+ If user confirms, append `<spec-entry>` to target category file preserving original date and source.
85
+
86
+ ### Step 4: Archive Artifact Entries
87
+
88
+ Move milestone artifacts from `state.json.artifacts[]` to `milestone_history[]` with completion metadata (id, name, status, completed_at, archive_path, archived_artifacts). Remove from active `artifacts[]`.
89
+
90
+ ### Step 5: Advance State
91
+
92
+ Set `current_milestone` to next pending milestone (mark it active), or set project `status: "completed"` if none remain. Atomic write to `state.json`.
93
+
94
+ ### Step 6: Clean Scratch
95
+
96
+ Remove archived artifact directories from `.workflow/`.
97
+
98
+ ### Step 7: Generate Summary & Report
99
+
100
+ Write `.workflow/milestones/{milestone}/summary.md` with outcomes and learnings. Update `.workflow/project.md` Context section. Display completion report with next steps: `$maestro-milestone-release`, `$maestro-analyze`, `$manage-status`, `$manage-wiki health`, `$wiki-digest`.
101
+
102
+ </execution>
103
+
104
+ <error_codes>
105
+
106
+ | Code | Severity | Description | Recovery |
107
+ |------|----------|-------------|----------|
108
+ | E001 | error | Milestone identifier required | Specify milestone |
109
+ | E002 | error | Audit not passed | Run milestone-audit first |
110
+ | E003 | error | Incomplete artifacts remain | Complete work first |
111
+
112
+ </error_codes>
113
+
114
+ <success_criteria>
115
+ - [ ] Audit report validated (or --force used)
116
+ - [ ] Scratch directories archived to milestones/
117
+ - [ ] Learnings extracted and appended to specs/learnings.md
118
+ - [ ] Artifact entries moved to milestone_history in state.json
119
+ - [ ] State advanced to next milestone (or project marked complete)
120
+ - [ ] Scratch directories cleaned
121
+ - [ ] Summary and completion report generated
122
+ </success_criteria>