maestro-flow-one 0.1.0

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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +173 -0
  3. package/bin/maestro-flow.js +730 -0
  4. package/claude/maestro-flow/SKILL.md +239 -0
  5. package/claude/maestro-flow/chains/templates.json +256 -0
  6. package/claude/maestro-flow/commands/learn/decompose.md +176 -0
  7. package/claude/maestro-flow/commands/learn/follow.md +167 -0
  8. package/claude/maestro-flow/commands/learn/investigate.md +221 -0
  9. package/claude/maestro-flow/commands/learn/retro.md +303 -0
  10. package/claude/maestro-flow/commands/learn/second-opinion.md +167 -0
  11. package/claude/maestro-flow/commands/lifecycle/amend.md +300 -0
  12. package/claude/maestro-flow/commands/lifecycle/analyze.md +126 -0
  13. package/claude/maestro-flow/commands/lifecycle/brainstorm.md +100 -0
  14. package/claude/maestro-flow/commands/lifecycle/composer.md +354 -0
  15. package/claude/maestro-flow/commands/lifecycle/execute.md +114 -0
  16. package/claude/maestro-flow/commands/lifecycle/fork.md +86 -0
  17. package/claude/maestro-flow/commands/lifecycle/init.md +78 -0
  18. package/claude/maestro-flow/commands/lifecycle/learn.md +140 -0
  19. package/claude/maestro-flow/commands/lifecycle/link-coordinate.md +71 -0
  20. package/claude/maestro-flow/commands/lifecycle/merge.md +61 -0
  21. package/claude/maestro-flow/commands/lifecycle/overlay.md +178 -0
  22. package/claude/maestro-flow/commands/lifecycle/plan.md +138 -0
  23. package/claude/maestro-flow/commands/lifecycle/player.md +404 -0
  24. package/claude/maestro-flow/commands/lifecycle/quick.md +56 -0
  25. package/claude/maestro-flow/commands/lifecycle/roadmap.md +164 -0
  26. package/claude/maestro-flow/commands/lifecycle/ui-design.md +93 -0
  27. package/claude/maestro-flow/commands/lifecycle/update.md +176 -0
  28. package/claude/maestro-flow/commands/lifecycle/verify.md +90 -0
  29. package/claude/maestro-flow/commands/manage/codebase-rebuild.md +75 -0
  30. package/claude/maestro-flow/commands/manage/codebase-refresh.md +57 -0
  31. package/claude/maestro-flow/commands/manage/harvest.md +94 -0
  32. package/claude/maestro-flow/commands/manage/issue-discover.md +77 -0
  33. package/claude/maestro-flow/commands/manage/issue.md +73 -0
  34. package/claude/maestro-flow/commands/manage/knowhow-capture.md +193 -0
  35. package/claude/maestro-flow/commands/manage/knowhow.md +77 -0
  36. package/claude/maestro-flow/commands/manage/learn.md +67 -0
  37. package/claude/maestro-flow/commands/manage/status.md +51 -0
  38. package/claude/maestro-flow/commands/manage/wiki.md +62 -0
  39. package/claude/maestro-flow/commands/milestone/audit.md +68 -0
  40. package/claude/maestro-flow/commands/milestone/complete.md +75 -0
  41. package/claude/maestro-flow/commands/milestone/release.md +96 -0
  42. package/claude/maestro-flow/commands/quality/auto-test.md +124 -0
  43. package/claude/maestro-flow/commands/quality/debug.md +115 -0
  44. package/claude/maestro-flow/commands/quality/refactor.md +55 -0
  45. package/claude/maestro-flow/commands/quality/retrospective.md +78 -0
  46. package/claude/maestro-flow/commands/quality/review.md +108 -0
  47. package/claude/maestro-flow/commands/quality/sync.md +51 -0
  48. package/claude/maestro-flow/commands/quality/test.md +103 -0
  49. package/claude/maestro-flow/commands/spec/add.md +49 -0
  50. package/claude/maestro-flow/commands/spec/load.md +51 -0
  51. package/claude/maestro-flow/commands/spec/remove.md +51 -0
  52. package/claude/maestro-flow/commands/spec/setup.md +51 -0
  53. package/claude/maestro-flow/commands/wiki/connect.md +62 -0
  54. package/claude/maestro-flow/commands/wiki/digest.md +69 -0
  55. package/codex/maestro-flow/SKILL.md +505 -0
  56. package/codex/maestro-flow/chains/templates.json +256 -0
  57. package/codex/maestro-flow/commands/learn/decompose.md +113 -0
  58. package/codex/maestro-flow/commands/learn/follow.md +83 -0
  59. package/codex/maestro-flow/commands/learn/investigate.md +83 -0
  60. package/codex/maestro-flow/commands/learn/retro.md +83 -0
  61. package/codex/maestro-flow/commands/learn/second-opinion.md +86 -0
  62. package/codex/maestro-flow/commands/lifecycle/amend.md +300 -0
  63. package/codex/maestro-flow/commands/lifecycle/analyze.md +483 -0
  64. package/codex/maestro-flow/commands/lifecycle/brainstorm.md +397 -0
  65. package/codex/maestro-flow/commands/lifecycle/composer.md +213 -0
  66. package/codex/maestro-flow/commands/lifecycle/execute.md +318 -0
  67. package/codex/maestro-flow/commands/lifecycle/fork.md +98 -0
  68. package/codex/maestro-flow/commands/lifecycle/init.md +134 -0
  69. package/codex/maestro-flow/commands/lifecycle/learn.md +80 -0
  70. package/codex/maestro-flow/commands/lifecycle/link-coordinate.md +257 -0
  71. package/codex/maestro-flow/commands/lifecycle/merge.md +69 -0
  72. package/codex/maestro-flow/commands/lifecycle/overlay.md +119 -0
  73. package/codex/maestro-flow/commands/lifecycle/plan.md +460 -0
  74. package/codex/maestro-flow/commands/lifecycle/player.md +323 -0
  75. package/codex/maestro-flow/commands/lifecycle/quick.md +124 -0
  76. package/codex/maestro-flow/commands/lifecycle/roadmap.md +468 -0
  77. package/codex/maestro-flow/commands/lifecycle/ui-design.md +135 -0
  78. package/codex/maestro-flow/commands/lifecycle/update.md +176 -0
  79. package/codex/maestro-flow/commands/lifecycle/verify.md +468 -0
  80. package/codex/maestro-flow/commands/manage/codebase-rebuild.md +347 -0
  81. package/codex/maestro-flow/commands/manage/codebase-refresh.md +66 -0
  82. package/codex/maestro-flow/commands/manage/harvest.md +91 -0
  83. package/codex/maestro-flow/commands/manage/issue-discover.md +431 -0
  84. package/codex/maestro-flow/commands/manage/issue.md +75 -0
  85. package/codex/maestro-flow/commands/manage/knowhow-capture.md +110 -0
  86. package/codex/maestro-flow/commands/manage/knowhow.md +95 -0
  87. package/codex/maestro-flow/commands/manage/learn.md +137 -0
  88. package/codex/maestro-flow/commands/manage/status.md +76 -0
  89. package/codex/maestro-flow/commands/manage/wiki.md +55 -0
  90. package/codex/maestro-flow/commands/milestone/audit.md +87 -0
  91. package/codex/maestro-flow/commands/milestone/complete.md +91 -0
  92. package/codex/maestro-flow/commands/milestone/release.md +70 -0
  93. package/codex/maestro-flow/commands/quality/auto-test.md +547 -0
  94. package/codex/maestro-flow/commands/quality/debug.md +334 -0
  95. package/codex/maestro-flow/commands/quality/refactor.md +151 -0
  96. package/codex/maestro-flow/commands/quality/retrospective.md +292 -0
  97. package/codex/maestro-flow/commands/quality/review.md +364 -0
  98. package/codex/maestro-flow/commands/quality/sync.md +111 -0
  99. package/codex/maestro-flow/commands/quality/test.md +498 -0
  100. package/codex/maestro-flow/commands/spec/add.md +101 -0
  101. package/codex/maestro-flow/commands/spec/load.md +77 -0
  102. package/codex/maestro-flow/commands/spec/remove.md +69 -0
  103. package/codex/maestro-flow/commands/spec/setup.md +75 -0
  104. package/codex/maestro-flow/commands/wiki/connect.md +73 -0
  105. package/codex/maestro-flow/commands/wiki/digest.md +87 -0
  106. package/package.json +24 -0
@@ -0,0 +1,347 @@
1
+ ---
2
+ name: manage-codebase-rebuild
3
+ description: Full codebase documentation rebuild via CSV wave pipeline. Spawns 5 parallel doc generator agents to scan project and produce complete .workflow/codebase/ documentation set. Replaces manage-codebase-rebuild command.
4
+ argument-hint: "[-y|--yes] [-c|--concurrency 5] [--continue] \"[--force] [--skip-commit]\""
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Single-wave parallel execution -- 5 independent doc generator agents each analyze a different documentation dimension of the codebase. All agents run concurrently with no dependencies. This is a destructive operation that rebuilds the entire `.workflow/codebase/` directory from scratch.
10
+
11
+ **Core workflow**: Prepare Directory -> Decompose Doc Dimensions -> Parallel Generation -> Assemble doc-index.json
12
+
13
+ **Topology**: Independent Parallel (single wave)
14
+
15
+ ```
16
+ +---------------------------------------------------------------------------+
17
+ | CODEBASE REBUILD CSV WAVE WORKFLOW |
18
+ +---------------------------------------------------------------------------+
19
+ | |
20
+ | Phase 1: Setup -> CSV |
21
+ | +-- Validate .workflow/ exists |
22
+ | +-- Confirm rebuild (or --force / -y) |
23
+ | +-- Clear .workflow/codebase/ directory |
24
+ | +-- Detect source directories (src/, lib/, app/, packages/) |
25
+ | +-- Generate tasks.csv with 5 doc generator tasks |
26
+ | +-- All tasks wave 1 (no dependencies) |
27
+ | |
28
+ | Phase 2: Wave Execution (Single Wave) |
29
+ | +-- Wave 1: All 5 generators run concurrently |
30
+ | | +-- Component Scanner (TC-* entries) |
31
+ | | +-- Feature Mapper (FT-* entries) |
32
+ | | +-- Requirement Linker (REQ-* entries, if specs exist) |
33
+ | | +-- Tech Registry Writer (tech-registry/*.md) |
34
+ | | +-- Feature Map Writer (feature-maps/*.md) |
35
+ | +-- discoveries.ndjson shared (append-only) |
36
+ | |
37
+ | Phase 3: Results -> .workflow/codebase/ |
38
+ | +-- Assemble doc-index.json from agent findings |
39
+ | +-- Validate all output files exist |
40
+ | +-- Update state.json with rebuild timestamp |
41
+ | +-- Generate context.md summary |
42
+ | +-- Auto-commit (unless --skip-commit) |
43
+ | +-- Display completion report |
44
+ | |
45
+ +---------------------------------------------------------------------------+
46
+ ```
47
+ </purpose>
48
+
49
+ <context>
50
+ $ARGUMENTS -- optional flags for rebuild control.
51
+
52
+ **Usage**:
53
+
54
+ ```bash
55
+ $manage-codebase-rebuild ""
56
+ $manage-codebase-rebuild -y "--force"
57
+ $manage-codebase-rebuild -c 5 "--force --skip-commit"
58
+ $manage-codebase-rebuild --continue "20260318-rebuild-full"
59
+ ```
60
+
61
+ **Flags**:
62
+ - `-y, --yes`: Skip all confirmations (auto mode, implies --force)
63
+ - `-c, --concurrency N`: Max concurrent agents (default: 5)
64
+ - `--continue`: Resume existing session
65
+
66
+ **Inner flags** (passed inside quotes):
67
+ - `--force`: Clear existing .workflow/codebase/ and rebuild from scratch
68
+ - `--skip-commit`: Do not auto-commit after rebuild
69
+
70
+ When `--yes` or `-y`: Auto-confirm rebuild (implies --force), skip all prompts.
71
+
72
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
73
+ **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
74
+ **Target**: `.workflow/codebase/` (doc-index.json, tech-registry/, feature-maps/)
75
+ </context>
76
+
77
+ <csv_schema>
78
+
79
+ ### tasks.csv (Master State)
80
+
81
+ ```csv
82
+ id,title,description,doc_dimension,output_path,deps,context_from,wave,status,findings,error
83
+ "1","Component Scanner","Scan all source directories for components: models, services, controllers, utils, types, config, middleware, core modules. For each component extract exported symbols, determine type, record code locations. Output JSON array of component entries with id (TC-NNN), name, type, code_locations, symbols.","components",".workflow/codebase/doc-index.json#components","","","1","","",""
84
+ "2","Feature Mapper","Group discovered components by domain/functional area using directory proximity, naming patterns, and import relationships. Map features to requirements if .workflow/.spec/ exists. Output JSON array of feature entries with id (FT-NNN), name, status, component_ids, requirement_ids, phase.","features",".workflow/codebase/doc-index.json#features","","","1","","",""
85
+ "3","Requirement Linker","If .workflow/.spec/ exists, scan SPEC-*/requirements/REQ-*.md files. Parse requirement metadata (title, priority, acceptance_criteria). Match requirements to features by keyword analysis. Also scan for ADR-*.md architecture decisions. Output JSON arrays for requirements and architecture_decisions.","requirements",".workflow/codebase/doc-index.json#requirements","","","1","","",""
86
+ "4","Tech Registry Writer","For each component discovered, generate a markdown documentation file in .workflow/codebase/tech-registry/{slug}.md with: ID, type, features, code locations, exported symbols, dependencies. Generate _index.md with component table. Output file count and paths.","tech-registry",".workflow/codebase/tech-registry/","","","1","","",""
87
+ "5","Feature Map Writer","For each feature discovered, generate a markdown documentation file in .workflow/codebase/feature-maps/{slug}.md with: ID, status, phase, requirements, component table. Generate _index.md with feature table. Output file count and paths.","feature-maps",".workflow/codebase/feature-maps/","","","1","","",""
88
+ ```
89
+
90
+ **Columns**:
91
+
92
+ | Column | Phase | Description |
93
+ |--------|-------|-------------|
94
+ | `id` | Input | Generator identifier |
95
+ | `title` | Input | Doc generator dimension title |
96
+ | `description` | Input | Detailed generation instructions |
97
+ | `doc_dimension` | Input | Documentation dimension: components/features/requirements/tech-registry/feature-maps |
98
+ | `output_path` | Input | Target output path in .workflow/codebase/ |
99
+ | `deps` | Input | Empty (all independent) |
100
+ | `context_from` | Input | Empty (no cross-task context needed) |
101
+ | `wave` | Computed | Always 1 (single wave, independent parallel) |
102
+ | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
103
+ | `findings` | Output | Generation summary -- counts, paths, notes (max 500 chars) |
104
+ | `error` | Output | Error message if failed |
105
+
106
+ ### Per-Wave CSV (Temporary)
107
+
108
+ Single wave generates `wave-1.csv`. No `prev_context` needed (all tasks independent).
109
+ </csv_schema>
110
+
111
+ <invariants>
112
+ 1. **Start Immediately**: First action is session initialization, then Phase 1
113
+ 2. **CSV is Source of Truth**: tasks.csv holds all generator state
114
+ 3. **Discovery Board is Append-Only**: Generators share findings via NDJSON
115
+ 4. **Partial Results OK**: If 3/5 generators succeed, still assemble available docs
116
+ 5. **Destructive by Design**: This is a full rebuild -- existing codebase/ is cleared
117
+ 6. **Single Wave**: All generators are independent, no wave ordering needed
118
+ 7. **Cleanup Temp Files**: Remove wave-1.csv after results are merged
119
+ 8. **DO NOT STOP**: Execute until all generators complete or fail
120
+ </invariants>
121
+
122
+ <execution>
123
+
124
+ ### Output Artifacts
125
+
126
+ | File | Purpose | Lifecycle |
127
+ |------|---------|-----------|
128
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after wave |
129
+ | `wave-1.csv` | Wave input (temporary) | Created before wave, deleted after |
130
+ | `wave-1-results.csv` | Wave output | Created by spawn_agents_on_csv |
131
+ | `results.csv` | Final export of all task results | Created in Phase 3 |
132
+ | `discoveries.ndjson` | Shared exploration board | Append-only during wave |
133
+ | `context.md` | Human-readable rebuild report | Created in Phase 3 |
134
+
135
+ ### Target Output (in .workflow/codebase/)
136
+
137
+ | File | Description |
138
+ |------|-------------|
139
+ | `doc-index.json` | Single source of truth: components, features, requirements, ADRs |
140
+ | `tech-registry/_index.md` | Component index table |
141
+ | `tech-registry/{slug}.md` | Per-component documentation |
142
+ | `feature-maps/_index.md` | Feature index table |
143
+ | `feature-maps/{slug}.md` | Per-feature documentation |
144
+
145
+ ### Session Structure
146
+
147
+ ```
148
+ .workflow/.csv-wave/{YYYYMMDD}-rebuild-{scope}/
149
+ +-- tasks.csv
150
+ +-- results.csv
151
+ +-- discoveries.ndjson
152
+ +-- context.md
153
+ +-- config.json
154
+ +-- wave-1.csv (temporary)
155
+ +-- wave-1-results.csv (temporary)
156
+ ```
157
+
158
+ ### Session Initialization
159
+
160
+ Parse `$ARGUMENTS` to extract:
161
+ - `AUTO_YES` from `--yes` / `-y`
162
+ - `continueMode` from `--continue`
163
+ - `maxConcurrency` from `--concurrency N` / `-c N` (default: 5)
164
+ - `forceMode` from `--force` (or implied by AUTO_YES)
165
+ - `skipCommit` from `--skip-commit`
166
+
167
+ Session ID: `{YYYYMMDD}-rebuild-full`
168
+ Session folder: `.workflow/.csv-wave/{sessionId}/` — create via `mkdir -p`
169
+
170
+ ### Phase 1: Setup -> CSV
171
+
172
+ **Objective**: Validate prerequisites, prepare directory, detect source dirs, generate tasks.csv.
173
+
174
+ **Steps**:
175
+
176
+ 1. **Validate** `.workflow/state.json` exists — abort with "Run init first" if missing
177
+ 2. **Confirm rebuild**: If `.workflow/codebase/` exists AND NOT forceMode, prompt user. If forceMode or confirmed, clear `.workflow/codebase/`
178
+ 3. **Prepare directories**:
179
+ ```bash
180
+ mkdir -p .workflow/codebase/tech-registry
181
+ mkdir -p .workflow/codebase/feature-maps
182
+ mkdir -p .workflow/codebase/action-logs
183
+ ```
184
+ 4. **Detect source directories**: `src/`, `lib/`, `app/`, `packages/` — abort if none found
185
+ 5. **Load project specs** from `.workflow/specs/` if available
186
+ 6. **Generate tasks.csv**: 5 rows, all wave 1, no dependencies
187
+ 7. **User validation**: Display doc generator breakdown (skip if AUTO_YES)
188
+
189
+ ### Phase 2: Wave Execution (Single Wave)
190
+
191
+ **Objective**: Run all 5 doc generators concurrently via spawn_agents_on_csv.
192
+
193
+ #### Wave 1: All Generators (Parallel)
194
+
195
+ Filter master `tasks.csv` for `wave == 1 AND status == pending` → write `wave-1.csv` (no prev_context needed, all independent).
196
+
197
+ ```javascript
198
+ spawn_agents_on_csv({
199
+ csv_path: `${sessionFolder}/wave-1.csv`,
200
+ id_column: "id",
201
+ instruction: buildRebuildInstruction(sessionFolder, sourceDirs),
202
+ max_concurrency: maxConcurrency,
203
+ max_runtime_seconds: 3600,
204
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
205
+ output_schema: {
206
+ type: "object",
207
+ properties: {
208
+ id: { type: "string" },
209
+ status: { type: "string", enum: ["completed", "failed"] },
210
+ findings: { type: "string" },
211
+ error: { type: "string" }
212
+ },
213
+ required: ["id", "status", "findings"]
214
+ }
215
+ })
216
+ ```
217
+
218
+ Merge `wave-1-results.csv` into master `tasks.csv`, delete `wave-1.csv`.
219
+
220
+ ### Phase 3: Results -> .workflow/codebase/
221
+
222
+ **Objective**: Assemble doc-index.json from agent findings, validate, update state.
223
+
224
+ Export master `tasks.csv` as `results.csv`.
225
+
226
+ **Assemble doc-index.json** by merging findings from tasks 1-3 (Component Scanner, Feature Mapper, Requirement Linker):
227
+ ```json
228
+ {
229
+ "version": "1.0",
230
+ "schema_version": "1.0",
231
+ "project": "<project name>",
232
+ "last_updated": "<ISO>",
233
+ "features": [],
234
+ "components": [],
235
+ "requirements": [],
236
+ "architecture_decisions": [],
237
+ "actions": []
238
+ }
239
+ ```
240
+ - Write to `.workflow/codebase/doc-index.json`
241
+
242
+ **Validate output files**: doc-index.json (valid JSON), tech-registry/_index.md, feature-maps/_index.md — log warnings for missing.
243
+
244
+ **Update state.json**: Set `codebase.last_rebuild` timestamp.
245
+
246
+ **Generate context.md**:
247
+
248
+ ```markdown
249
+ # Codebase Rebuild Report
250
+
251
+ ## Summary
252
+ - Components discovered: {count}
253
+ - Features mapped: {count}
254
+ - Requirements linked: {count}
255
+ - ADRs recorded: {count}
256
+ - Files generated: {count}
257
+ - Generators: {completed}/{total} succeeded
258
+
259
+ ## Generator Results
260
+ | Generator | Status | Output | Findings |
261
+ |-----------|--------|--------|----------|
262
+ | Component Scanner | {status} | {count} components | {summary} |
263
+ | Feature Mapper | {status} | {count} features | {summary} |
264
+ | Requirement Linker | {status} | {count} requirements | {summary} |
265
+ | Tech Registry Writer | {status} | {count} files | {summary} |
266
+ | Feature Map Writer | {status} | {count} files | {summary} |
267
+
268
+ ## Discovery Board Summary
269
+ {aggregated discovery findings}
270
+
271
+ ## Next Steps
272
+ - Run manage-status to review
273
+ - Run manage-codebase-refresh for future incremental updates
274
+ ```
275
+
276
+ **Auto-commit** (unless --skip-commit): Stage `.workflow/codebase/` files, commit "docs(codebase): full rebuild of codebase documentation".
277
+
278
+ **Display completion report**:
279
+
280
+ ```
281
+ === CODEBASE REBUILD COMPLETE ===
282
+ Components: {count}
283
+ Features: {count}
284
+ Requirements: {count}
285
+ ADRs: {count}
286
+ Files: {count} generated in .workflow/codebase/
287
+
288
+ Generators: {completed}/{total} succeeded
289
+ {if failures: "W001: {failed_generator} failed -- partial results available"}
290
+
291
+ Next steps:
292
+ Skill({ skill: "maestro-flow", args: "--cmd manage-status" })
293
+ Skill({ skill: "maestro-flow", args: "--cmd manage-codebase-refresh" })
294
+ ```
295
+
296
+ ### Shared Discovery Board Protocol
297
+
298
+ #### Standard Discovery Types
299
+
300
+ | Type | Dedup Key | Data Schema | Description |
301
+ |------|-----------|-------------|-------------|
302
+ | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack identified |
303
+ | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
304
+ | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
305
+ | `convention` | singleton | `{naming, imports, formatting}` | Project coding conventions |
306
+
307
+ #### Domain Discovery Types
308
+
309
+ | Type | Dedup Key | Data Schema | Description |
310
+ |------|-----------|-------------|-------------|
311
+ | `component` | `data.id` | `{id, name, type, code_locations[]}` | Component discovered by scanner |
312
+ | `feature_group` | `data.name` | `{name, component_ids[], directory}` | Feature grouping identified |
313
+
314
+ #### Protocol
315
+
316
+ Read `{session_folder}/discoveries.ndjson` before own analysis. Deduplicate by type + dedup key before writing. Append-only — never modify or delete. Generators share discoveries to skip redundant scanning.
317
+
318
+ ```bash
319
+ echo '{"ts":"<ISO>","worker":"1","type":"tech_stack","data":{"framework":"Express","language":"TypeScript","tools":["jest","eslint","prettier"]}}' >> {session_folder}/discoveries.ndjson
320
+ ```
321
+ </execution>
322
+
323
+ <error_codes>
324
+ | Error | Resolution |
325
+ |-------|------------|
326
+ | .workflow/ not initialized | Abort: "Run init first" (E001) |
327
+ | No source directories found | Abort: "No source files in project" |
328
+ | .workflow/codebase/ exists without --force | Prompt user for confirmation |
329
+ | Generator agent timeout | Mark as failed, continue with other generators |
330
+ | Generator agent failed | Mark as failed, log W001, output partial results |
331
+ | doc-index.json assembly fails | Use available generator outputs, log missing sections |
332
+ | CSV parse error | Validate format, show line number |
333
+ | discoveries.ndjson corrupt | Ignore malformed lines |
334
+ | Continue mode: no session found | List available sessions |
335
+ </error_codes>
336
+
337
+ <success_criteria>
338
+ - [ ] Session initialized with tasks.csv
339
+ - [ ] .workflow/codebase/ cleared (if --force or confirmed)
340
+ - [ ] All 5 doc generators executed via spawn_agents_on_csv
341
+ - [ ] doc-index.json assembled from generator findings
342
+ - [ ] tech-registry/ and feature-maps/ populated with markdown docs
343
+ - [ ] state.json updated with rebuild timestamp
344
+ - [ ] context.md generated with rebuild report
345
+ - [ ] Auto-commit performed (unless --skip-commit)
346
+ - [ ] Completion report displayed with counts and next steps
347
+ </success_criteria>
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: manage-codebase-refresh
3
+ description: Incremental refresh of codebase docs based on recent git changes
4
+ argument-hint: "[--since <date>] [--deep]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
+ ---
7
+
8
+ <purpose>
9
+ Incremental refresh of codebase documentation based on recent git changes. Detects changed files, maps them to existing doc entries, and updates only affected sections. Use `--deep` for broader context re-scanning.
10
+ </purpose>
11
+
12
+ <context>
13
+ $ARGUMENTS — optional flags.
14
+
15
+ ```bash
16
+ $manage-codebase-refresh
17
+ $manage-codebase-refresh "--since 2026-03-15"
18
+ $manage-codebase-refresh "--deep"
19
+ $manage-codebase-refresh "--since 3d --deep"
20
+ ```
21
+
22
+ **Flags**:
23
+ - `--since <date>` -- Override change detection window (ISO date or relative like `3d`)
24
+ - `--deep` -- Force deeper re-scan even for minor changes
25
+ </context>
26
+
27
+ <execution>
28
+
29
+ ### Step 1: Validate Preconditions
30
+
31
+ Verify `.workflow/` exists (E001) and `.workflow/codebase/` exists (E002 -- use codebase-rebuild instead).
32
+
33
+ ### Step 2: Detect Changes
34
+
35
+ Resolve baseline: `--since` flag > `state.json.codebase_last_refreshed` > `codebase_last_rebuilt` > 7-day fallback. Run `git diff --name-only --since="{baseline}" HEAD`. If no changes: W001, exit.
36
+
37
+ ### Step 3: Map Changes to Docs
38
+
39
+ Read `.workflow/codebase/doc-index.json` to find doc entries covering changed files. Build affected entry list.
40
+
41
+ ### Step 4: Refresh Affected Docs
42
+
43
+ For each affected entry: re-read changed source files, update corresponding doc in `.workflow/codebase/`, update timestamp in `doc-index.json`. With `--deep`: also re-scan adjacent files.
44
+
45
+ ### Step 5: Update State
46
+
47
+ Update `doc-index.json` timestamps and `state.json.codebase_last_refreshed`. Display summary with change/refresh/skip counts.
48
+ </execution>
49
+
50
+ <error_codes>
51
+ | Code | Severity | Description |
52
+ |------|----------|-------------|
53
+ | E001 | fatal | `.workflow/` not initialized |
54
+ | E002 | fatal | No codebase docs exist -- use `Skill({ skill: "maestro-flow", args: "--cmd codebase-rebuild" })` instead |
55
+ | W001 | warning | No changes detected since last refresh |
56
+ </error_codes>
57
+
58
+ <success_criteria>
59
+ - [ ] Preconditions validated (.workflow/ and .workflow/codebase/ exist)
60
+ - [ ] Change detection baseline resolved (--since flag, state.json, or 7-day fallback)
61
+ - [ ] Git changes detected and mapped to doc entries via doc-index.json
62
+ - [ ] Affected docs refreshed with updated source content
63
+ - [ ] --deep flag triggers adjacent file re-scan
64
+ - [ ] doc-index.json timestamps and state.json codebase_last_refreshed updated
65
+ - [ ] Summary displayed with change/refresh/skip counts
66
+ </success_criteria>
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: manage-harvest
3
+ description: Extract knowledge fragments from workflow artifacts (analysis, brainstorm, debug, lite-plan, scratchpad, sessions) and route to wiki / spec / issue stores. Dedup via stable fragment IDs. Closed-loop with downstream consumers.
4
+ argument-hint: "[<session-id|path>] [--to wiki|spec|issue|auto] [--source <type>] [--recent N] [--dry-run] [-y]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Knowledge extraction from workflow artifacts, routed into three stores: wiki entries,
10
+ spec conventions, and trackable issues. Prevents knowledge loss from completed sessions.
11
+
12
+ **Closed-loop**: harvest extracts → stores → downstream consumers (wiki-digest, spec-load, maestro-plan --gaps).
13
+ </purpose>
14
+
15
+ <required_reading>
16
+ @~/.maestro/workflows/harvest.md
17
+ </required_reading>
18
+
19
+ <context>
20
+ $ARGUMENTS — session-id, path, or empty for scan mode.
21
+
22
+ **Modes:**
23
+ - No args → `scan`: discover all harvestable artifacts, interactive selection
24
+ - `<session-id>` → `session`: harvest specific session
25
+ - `<path>` → `path`: harvest from explicit directory
26
+
27
+ **Flags:**
28
+ - `--to <target>` — Force routing: wiki, spec, issue, auto (default: auto)
29
+ - `--source <type>` — Filter: analysis, brainstorm, debug, lite-plan, lite-fix, scratchpad, session, learning, all
30
+ - `--recent N` — Artifacts within last N days (default: 30)
31
+ - `--dry-run` — Preview without writing
32
+ - `-y` — Skip confirmations
33
+ - `--min-confidence N` — Minimum 0.0-1.0 (default: 0.5)
34
+
35
+ **Source registry:**
36
+ | Source | Scan Path | Key Files |
37
+ |--------|-----------|-----------|
38
+ | analysis | `.workflow/.analysis/ANL-*/` | conclusions.json |
39
+ | brainstorm | `.workflow/scratch/brainstorm-*/` | guidance-specification.md |
40
+ | lite-plan | `.workflow/.lite-plan/*/` | plan.json |
41
+ | lite-fix | `.workflow/.lite-fix/*/` | fix-plan.json |
42
+ | debug | `.workflow/.debug/*/` | debug-log.md |
43
+ | scratchpad | `.workflow/.scratchpad/` | *.md |
44
+ | session | `.workflow/active/WFS-*/` | workflow-session.json |
45
+ | learning | `.workflow/learning/` | lessons.jsonl |
46
+ </context>
47
+
48
+ <execution>
49
+ Follow '~/.maestro/workflows/harvest.md' Stages 1–8.
50
+
51
+ **Key invariants:**
52
+ 1. **Read-only until Stage 6** — extraction/classification in-memory only
53
+ 2. **Dedup before write** — check harvest-log.jsonl + existing stores
54
+ 3. **Stable fragment IDs** — `HRV-{8 hex}` from `hash(source_id + content_hash)`
55
+ 4. **Never modify source artifacts** — purely extractive
56
+ 5. **Confidence filtering** — below threshold logged but not routed
57
+ 6. **Spec format enforcement** — all spec routing must use `<spec-entry>` closed-tag format with `category`, `keywords`, `date`, `source="harvest"` attributes
58
+
59
+ **Routing rules:**
60
+ - Universal design patterns → `coding` or `arch` category
61
+ - Component-level pitfalls → `learning` category
62
+ - Quality enforcement rules → `quality` category
63
+ - Wiki: `maestro wiki create --type <type> --slug harvest-<source_type>-<short_id>`
64
+ - Spec: `maestro wiki append spec-<file> --category <category> --body "<content>" --keywords "<kws>"` (unified write path) or `Skill({ skill: "maestro-flow", args: "--cmd spec-add <category> <content>" })`
65
+ - Issue: append to `issues.jsonl` matching canonical schema
66
+
67
+ **Next steps:** `/manage-wiki health`, `maestro wiki list --type note`, `/wiki-connect --fix`, `/wiki-digest`, `/manage-issue list --source harvest`
68
+ </execution>
69
+
70
+ <error_codes>
71
+ | Code | Severity | Condition | Recovery |
72
+ |------|----------|-----------|----------|
73
+ | E001 | error | .workflow/ not initialized | Run $maestro-init |
74
+ | E002 | error | Invalid --to target | Valid: wiki, spec, issue, auto |
75
+ | E003 | error | Invalid --source type | Display valid types |
76
+ | E004 | error | Session ID not found | Show available sessions |
77
+ | W001 | warning | No harvestable artifacts in window | Widen --recent |
78
+ | W003 | warning | Fragments below threshold | Lower --min-confidence |
79
+ | W004 | warning | Duplicate fragments skipped | Review harvest-log.jsonl |
80
+ </error_codes>
81
+
82
+ <success_criteria>
83
+ - [ ] Mode resolved (scan / session / path)
84
+ - [ ] Artifacts discovered and parsed
85
+ - [ ] Fragments extracted with category, confidence, tags
86
+ - [ ] Dedup check passed against harvest-log.jsonl and stores
87
+ - [ ] If not dry-run: routed items written to target stores
88
+ - [ ] harvest-log.jsonl updated with provenance
89
+ - [ ] harvest-report-{date}.md written
90
+ - [ ] No source artifacts modified
91
+ </success_criteria>