maestro-flow 0.4.19 → 0.4.21

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 (163) hide show
  1. package/.agents/agents/workflow-collab-planner.md +4 -1
  2. package/.agents/agents/workflow-plan-checker.md +11 -1
  3. package/.agents/agents/workflow-planner.md +4 -1
  4. package/.agents/skills/maestro/SKILL.md +8 -5
  5. package/.agents/skills/maestro-analyze/SKILL.md +1 -1
  6. package/.agents/skills/maestro-brainstorm/SKILL.md +2 -1
  7. package/.agents/skills/maestro-companion/SKILL.md +533 -0
  8. package/.agents/skills/maestro-grill/SKILL.md +116 -0
  9. package/.agents/skills/maestro-plan/SKILL.md +4 -0
  10. package/.agents/skills/maestro-ralph/SKILL.md +11 -7
  11. package/.agents/skills/maestro-ralph-execute/SKILL.md +2 -1
  12. package/.agents/skills/maestro-swarm-workflow/SKILL.md +266 -0
  13. package/.agents/skills/maestro-universal-workflow/SKILL.md +563 -0
  14. package/.agents/skills/manage-codebase-rebuild/SKILL.md +13 -1
  15. package/.agents/skills/manage-codebase-refresh/SKILL.md +3 -0
  16. package/.agents/skills/spec-setup/SKILL.md +9 -5
  17. package/.agents/skills/team-adversarial-swarm/SKILL.md +235 -0
  18. package/.agents/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  19. package/.agents/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  20. package/.agents/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  21. package/.agents/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  22. package/.agents/skills/team-adversarial-swarm/specs/ant-output-schema.md +115 -0
  23. package/.agents/skills/team-adversarial-swarm/specs/convergence-criteria.md +75 -0
  24. package/.agents/skills/team-adversarial-swarm/specs/pheromone-schema.md +90 -0
  25. package/.agents/skills/team-adversarial-swarm/specs/swarm-config-template.json +66 -0
  26. package/.agents/skills/team-adversarial-swarm/specs/swarm-protocol.md +105 -0
  27. package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-converge.js +197 -0
  28. package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-explore.js +194 -0
  29. package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-score.js +188 -0
  30. package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-synthesize.js +248 -0
  31. package/.agy/agents/workflow-collab-planner.md +4 -1
  32. package/.agy/agents/workflow-plan-checker.md +11 -1
  33. package/.agy/agents/workflow-planner.md +4 -1
  34. package/.agy/skills/maestro/SKILL.md +8 -5
  35. package/.agy/skills/maestro-analyze/SKILL.md +1 -1
  36. package/.agy/skills/maestro-brainstorm/SKILL.md +2 -1
  37. package/.agy/skills/maestro-companion/SKILL.md +529 -0
  38. package/.agy/skills/maestro-grill/SKILL.md +116 -0
  39. package/.agy/skills/maestro-plan/SKILL.md +4 -0
  40. package/.agy/skills/maestro-ralph/SKILL.md +11 -7
  41. package/.agy/skills/maestro-ralph-execute/SKILL.md +2 -1
  42. package/.agy/skills/maestro-swarm-workflow/SKILL.md +263 -0
  43. package/.agy/skills/maestro-universal-workflow/SKILL.md +560 -0
  44. package/.agy/skills/manage-codebase-rebuild/SKILL.md +13 -1
  45. package/.agy/skills/manage-codebase-refresh/SKILL.md +3 -0
  46. package/.agy/skills/spec-setup/SKILL.md +9 -5
  47. package/.agy/skills/team-adversarial-swarm/SKILL.md +244 -0
  48. package/.agy/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  49. package/.agy/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  50. package/.agy/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  51. package/.agy/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  52. package/.agy/skills/team-adversarial-swarm/specs/ant-output-schema.md +115 -0
  53. package/.agy/skills/team-adversarial-swarm/specs/convergence-criteria.md +75 -0
  54. package/.agy/skills/team-adversarial-swarm/specs/pheromone-schema.md +90 -0
  55. package/.agy/skills/team-adversarial-swarm/specs/swarm-config-template.json +66 -0
  56. package/.agy/skills/team-adversarial-swarm/specs/swarm-protocol.md +105 -0
  57. package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-converge.js +197 -0
  58. package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-explore.js +194 -0
  59. package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-score.js +188 -0
  60. package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-synthesize.js +248 -0
  61. package/.claude/agents/workflow-collab-planner.md +4 -1
  62. package/.claude/agents/workflow-plan-checker.md +11 -1
  63. package/.claude/agents/workflow-planner.md +4 -1
  64. package/.claude/commands/maestro-analyze.md +1 -1
  65. package/.claude/commands/maestro-brainstorm.md +2 -1
  66. package/.claude/commands/maestro-companion.md +531 -0
  67. package/.claude/commands/maestro-grill.md +114 -0
  68. package/.claude/commands/maestro-plan.md +4 -0
  69. package/.claude/commands/maestro-ralph-execute.md +2 -1
  70. package/.claude/commands/maestro-ralph.md +11 -7
  71. package/.claude/commands/maestro-swarm-workflow.md +264 -0
  72. package/.claude/commands/maestro-universal-workflow.md +561 -0
  73. package/.claude/commands/maestro.md +8 -5
  74. package/.claude/commands/manage-codebase-rebuild.md +13 -1
  75. package/.claude/commands/manage-codebase-refresh.md +3 -0
  76. package/.claude/commands/spec-setup.md +9 -5
  77. package/.claude/skills/team-adversarial-swarm/SKILL.md +233 -0
  78. package/.claude/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  79. package/.claude/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  80. package/.claude/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  81. package/.claude/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  82. package/.claude/skills/team-adversarial-swarm/specs/ant-output-schema.md +115 -0
  83. package/.claude/skills/team-adversarial-swarm/specs/convergence-criteria.md +75 -0
  84. package/.claude/skills/team-adversarial-swarm/specs/pheromone-schema.md +90 -0
  85. package/.claude/skills/team-adversarial-swarm/specs/swarm-config-template.json +66 -0
  86. package/.claude/skills/team-adversarial-swarm/specs/swarm-protocol.md +105 -0
  87. package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-converge.js +197 -0
  88. package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-explore.js +194 -0
  89. package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-score.js +188 -0
  90. package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-synthesize.js +248 -0
  91. package/.codex/skills/maestro/SKILL.md +7 -2
  92. package/.codex/skills/maestro-companion/SKILL.md +485 -0
  93. package/.codex/skills/maestro-grill/SKILL.md +111 -0
  94. package/.codex/skills/maestro-ralph/SKILL.md +11 -7
  95. package/.codex/skills/manage-codebase-rebuild/SKILL.md +6 -0
  96. package/.codex/skills/manage-codebase-refresh/SKILL.md +6 -0
  97. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.d.ts +36 -0
  98. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +138 -2
  99. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
  100. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +13 -0
  101. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  102. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +11 -0
  103. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +178 -0
  104. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  105. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +1 -0
  106. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +39 -23
  107. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  108. package/dashboard/dist-server/src/graph/types.d.ts +111 -0
  109. package/dashboard/dist-server/src/graph/types.js +2 -0
  110. package/dashboard/dist-server/src/graph/types.js.map +1 -0
  111. package/dist/src/cli.js +1 -0
  112. package/dist/src/cli.js.map +1 -1
  113. package/dist/src/commands/kg.d.ts +11 -0
  114. package/dist/src/commands/kg.d.ts.map +1 -0
  115. package/dist/src/commands/kg.js +486 -0
  116. package/dist/src/commands/kg.js.map +1 -0
  117. package/dist/src/graph/analyzers/fs-analyzer.d.ts +10 -0
  118. package/dist/src/graph/analyzers/fs-analyzer.d.ts.map +1 -0
  119. package/dist/src/graph/analyzers/fs-analyzer.js +959 -0
  120. package/dist/src/graph/analyzers/fs-analyzer.js.map +1 -0
  121. package/dist/src/graph/index.d.ts +6 -0
  122. package/dist/src/graph/index.d.ts.map +1 -0
  123. package/dist/src/graph/index.js +6 -0
  124. package/dist/src/graph/index.js.map +1 -0
  125. package/dist/src/graph/loader.d.ts +3 -0
  126. package/dist/src/graph/loader.d.ts.map +1 -0
  127. package/dist/src/graph/loader.js +12 -0
  128. package/dist/src/graph/loader.js.map +1 -0
  129. package/dist/src/graph/merger.d.ts +56 -0
  130. package/dist/src/graph/merger.d.ts.map +1 -0
  131. package/dist/src/graph/merger.js +896 -0
  132. package/dist/src/graph/merger.js.map +1 -0
  133. package/dist/src/graph/query.d.ts +7 -0
  134. package/dist/src/graph/query.d.ts.map +1 -0
  135. package/dist/src/graph/query.js +126 -0
  136. package/dist/src/graph/query.js.map +1 -0
  137. package/dist/src/graph/types.d.ts +112 -0
  138. package/dist/src/graph/types.d.ts.map +1 -0
  139. package/dist/src/graph/types.js +2 -0
  140. package/dist/src/graph/types.js.map +1 -0
  141. package/dist/src/tui/install-ui/KgVendorConfig.d.ts +7 -0
  142. package/dist/src/tui/install-ui/KgVendorConfig.d.ts.map +1 -0
  143. package/dist/src/tui/install-ui/KgVendorConfig.js +9 -0
  144. package/dist/src/tui/install-ui/KgVendorConfig.js.map +1 -0
  145. package/dist/src/utils/update-notices.js +23 -0
  146. package/dist/src/utils/update-notices.js.map +1 -1
  147. package/package.json +1 -1
  148. package/workflows/analyze.md +2 -1
  149. package/workflows/brainstorm.md +24 -1
  150. package/workflows/codebase-rebuild.md +141 -1
  151. package/workflows/codebase-refresh.md +20 -0
  152. package/workflows/finish-work.md +7 -2
  153. package/workflows/grill.md +513 -0
  154. package/workflows/plan.md +7 -4
  155. package/workflows/specs-setup.md +99 -3
  156. package/workflows/swarm/wf-analyze.js +347 -0
  157. package/workflows/swarm/wf-brainstorm.js +456 -0
  158. package/workflows/swarm/wf-execute.js +379 -0
  159. package/workflows/swarm/wf-grill.js +359 -0
  160. package/workflows/swarm/wf-milestone-audit.js +385 -0
  161. package/workflows/swarm/wf-plan.js +468 -0
  162. package/workflows/swarm/wf-review.js +341 -0
  163. package/workflows/swarm/wf-verify.js +395 -0
@@ -181,9 +181,143 @@ b. Update project.md Tech Stack (if exists):
181
181
 
182
182
  ```
183
183
  Display summary: component/feature/requirement/ADR/file counts.
184
+ If KG pipeline ran: include KG node/edge/layer/tour counts.
184
185
  If mapper agents failed: log W001.
185
186
  If not --skip-commit: suggest committing generated docs.
186
- Suggest next: manage-status (review) or manage-codebase-refresh (incremental updates).
187
+ Suggest next:
188
+ - manage-status (review)
189
+ - manage-codebase-refresh (incremental updates)
190
+ - maestro kg stats (verify KG)
191
+ - maestro wiki list --keyword kg (verify wiki integration)
192
+ - maestro kg diff-wiki (future change impact analysis)
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Knowledge Graph Pipeline (Steps 10–17)
198
+
199
+ > **Optional.** Only runs when UA vendor is installed at
200
+ > `~/.maestro/vendor/ua/understand-anything-plugin/packages/core/dist/index.js`.
201
+ > If not found, skip Steps 10–17 with warning:
202
+ > *"KG pipeline skipped: run `scripts/ua-vendor-setup.sh` first"*
203
+
204
+ All intermediate artifacts are written to `.workflow/codebase/.kg-tmp/`.
205
+
206
+ ### Step 10: KG Pipeline — Project Scan
207
+
208
+ ```
209
+ node ~/.maestro/vendor/ua/understand-anything-plugin/skills/understand/scan-project.mjs \
210
+ "$PROJECT_ROOT" \
211
+ "$PROJECT_ROOT/.workflow/codebase/.kg-tmp/scan-result.json"
212
+ ```
213
+
214
+ Output: `.workflow/codebase/.kg-tmp/scan-result.json`
215
+
216
+ ### Step 11: KG Pipeline — Compute Batches
217
+
218
+ ```
219
+ node ~/.maestro/vendor/ua/understand-anything-plugin/skills/understand/compute-batches.mjs \
220
+ "$PROJECT_ROOT"
221
+ ```
222
+
223
+ Output: `.workflow/codebase/.kg-tmp/batches.json`
224
+
225
+ ### Step 12: KG Pipeline — File Analysis (Parallel Delegates)
226
+
227
+ ```
228
+ For each batch in batches.json, dispatch a delegate:
229
+
230
+ maestro delegate "<prompt from kg-file-analyze template>" \
231
+ --rule kg-file-analyze --mode analysis --cd "$PROJECT_ROOT"
232
+
233
+ Run up to 5 delegates concurrently (run_in_background: true).
234
+ Each produces batch-N.json in .kg-tmp/
235
+ ```
236
+
237
+ ### Step 13: KG Pipeline — Merge Batch Graphs
238
+
239
+ ```
240
+ node scripts/merge-batch-graphs.mjs "$PROJECT_ROOT" \
241
+ --intermediate-dir "$PROJECT_ROOT/.workflow/codebase/.kg-tmp"
242
+ ```
243
+
244
+ Output: `.workflow/codebase/.kg-tmp/assembled-graph.json`
245
+
246
+ ### Step 14: KG Pipeline — Architecture Analysis
247
+
248
+ ```
249
+ maestro delegate "<prompt>" --rule kg-architecture --mode analysis
250
+ ```
251
+
252
+ This **replaces** the original Architecture mapper (Mapper 2).
253
+ Mapper 2 no longer runs independently — its output is produced here instead.
254
+
255
+ Output: `.workflow/codebase/.kg-tmp/layers.json`
256
+
257
+ ### Step 15: KG Pipeline — Tour Generation
258
+
259
+ ```
260
+ maestro delegate "<prompt>" --rule kg-tour-build --mode analysis
261
+ ```
262
+
263
+ Output: `.workflow/codebase/.kg-tmp/tour.json`
264
+
265
+ ### Step 16: KG Pipeline — Validation
266
+
267
+ ```
268
+ Run inline validation (Node.js script from UA, adapted):
269
+ - Check all nodes have required fields (id, type, name, filePath)
270
+ - Check referential integrity (all edge source/target refs exist as node ids)
271
+ - Check layer coverage (every file-type node appears in exactly 1 layer)
272
+ - Check tour structure (all tour step refs resolve to valid nodes)
273
+
274
+ If validation fails: log errors but still write the graph (with "valid": false flag).
275
+ ```
276
+
277
+ ### Step 17: KG Pipeline — Save Knowledge Graph
278
+
279
+ ```
280
+ Assemble final KnowledgeGraph JSON:
281
+
282
+ {
283
+ "version": "1.0.0",
284
+ "valid": true|false,
285
+ "project": {
286
+ "name": "<from state.json or package.json>",
287
+ "languages": [<detected>],
288
+ "frameworks": [<detected>],
289
+ "description": "<from project.md>",
290
+ "analyzedAt": "<ISO timestamp>",
291
+ "gitCommitHash": "<current HEAD>"
292
+ },
293
+ "nodes": [<from assembled-graph.json>],
294
+ "edges": [<from assembled-graph.json>],
295
+ "layers": [<from Step 14 layers.json>],
296
+ "tour": [<from Step 15 tour.json>]
297
+ }
298
+
299
+ Write to: .workflow/codebase/knowledge-graph.json
300
+ Clean up: remove .workflow/codebase/.kg-tmp/ directory
301
+ ```
302
+
303
+ ### Step 18: KG → Wiki Index Integration
304
+
305
+ ```
306
+ When knowledge-graph.json is successfully written:
307
+ The WikiIndexer will automatically index KG nodes as virtual wiki entries
308
+ on next wiki access (via adaptUaKgGraph virtual adapter).
309
+
310
+ Generated virtual entries:
311
+ - uakg-{node-id} for each GraphNode (type: knowhow, virtualKind: ua-kg-node)
312
+ - uakg-layer-{id} for each Layer (virtualKind: ua-kg-layer)
313
+ - uakg-tour-{order} for each TourStep (virtualKind: ua-kg-tour-step)
314
+
315
+ Cross-referencing:
316
+ - KG nodes are linked to existing codebase-comp-* entries via filePath matching
317
+ - Edge semantics preserved in ext.kgEdges for downstream semantic traversal
318
+
319
+ No manual action required — indexing is lazy and triggered on first wiki access.
320
+ To verify: run `maestro wiki list --keyword kg` after rebuild.
187
321
  ```
188
322
 
189
323
  ---
@@ -196,6 +330,10 @@ Suggest next: manage-status (review) or manage-codebase-refresh (incremental upd
196
330
  | .workflow/ missing | Fail: "Run /workflow:init first" |
197
331
  | File read errors | Log warning, skip file, continue scan |
198
332
  | Existing codebase/ without --force | Prompt user for confirmation |
333
+ | UA vendor not installed | Skip Steps 10–18 with warning, continue normally |
334
+ | KG batch delegate failed | Log warning, continue with remaining batches |
335
+ | KG validation failed | Write knowledge-graph.json with `"valid": false`, log errors |
336
+ | Wiki index rebuild failed | Non-fatal — KG data still written, wiki indexing retries on next access |
199
337
 
200
338
  ## Output Files
201
339
 
@@ -206,5 +344,7 @@ Suggest next: manage-status (review) or manage-codebase-refresh (incremental upd
206
344
  | `.workflow/codebase/tech-registry/{slug}.md` | Per-component documentation |
207
345
  | `.workflow/codebase/feature-maps/_index.md` | Feature index |
208
346
  | `.workflow/codebase/feature-maps/{slug}.md` | Per-feature documentation |
347
+ | `.workflow/codebase/knowledge-graph.json` | Knowledge Graph with nodes, edges, layers, and tour (if UA vendor installed) |
348
+ | `.workflow/wiki-index.json` | Updated on next wiki access: KG nodes indexed as virtual entries (automatic) |
209
349
  | `.workflow/state.json` | Updated: last_codebase_rebuild timestamp |
210
350
  | `.workflow/project.md` | Updated: Tech Stack section refreshed |
@@ -57,6 +57,26 @@ specs_content = maestro spec load --category arch
57
57
 
58
58
  Used in Step 4-5 to validate refreshed docs against architectural expectations.
59
59
 
60
+ ### Step 3.6: KG Impact Analysis (if KG exists)
61
+
62
+ ```
63
+ If .workflow/codebase/knowledge-graph.json exists:
64
+ Run: maestro kg diff-wiki --json
65
+ Parse output for affectedWiki entries.
66
+
67
+ If affectedWiki is non-empty:
68
+ Log WARNING for each affected wiki entry:
69
+ "KG impact: code changes affect [entry.id] — [entry.title] (via [reason])"
70
+
71
+ Add affected entry IDs to the refresh queue for human review.
72
+
73
+ Log summary: "KG analysis: {directNodes} direct, {impactedNodes} impacted KG nodes,
74
+ {affectedWiki.length} wiki entries flagged"
75
+
76
+ If .workflow/codebase/knowledge-graph.json does not exist:
77
+ Skip silently (KG not generated).
78
+ ```
79
+
60
80
  ---
61
81
 
62
82
  ### Step 4: Re-scan Affected Components
@@ -4,7 +4,7 @@ Last step of session commands. Inline-extracts spec/knowhow from this single ses
4
4
 
5
5
  ## Inputs
6
6
 
7
- Caller passes: `SESSION_DIR`, `SESSION_TYPE` (brainstorm | analyze | blueprint | plan | execute | verify), `SESSION_ID`, `LINKED_MILESTONE` (optional).
7
+ Caller passes: `SESSION_DIR`, `SESSION_TYPE` (grill | brainstorm | analyze | blueprint | plan | execute | verify), `SESSION_ID`, `LINKED_MILESTONE` (optional).
8
8
 
9
9
  ## Steps
10
10
 
@@ -14,7 +14,9 @@ Scan `SESSION_DIR` for any of these files (any absent → skip silently):
14
14
 
15
15
  | File | Source | Used for |
16
16
  |------|--------|----------|
17
- | `context-package.json` | brainstorm/analyze/blueprint | constraints + insights |
17
+ | `context-package.json` | grill/brainstorm/analyze/blueprint | constraints + insights |
18
+ | `terminology.md` | grill | domain terms with code references |
19
+ | `grill-report.md` | grill | stress-test decisions + risk register |
18
20
  | `conclusions.json` | analyze | decisions |
19
21
  | `reflection-log.md` | execute | lessons + pitfalls |
20
22
  | `{role}/analysis.md` | brainstorm | role decisions |
@@ -33,6 +35,9 @@ Iterate detected files; build a `fragments[]` array. Each fragment: `{ kind, cat
33
35
  | `conclusions.json#recommendations[]` (priority ≥ medium) | knowhow | knowhow (`REF`) | derived from area |
34
36
  | `reflection-log.md` "## Lessons" / "## Pitfalls" sections | learning | spec (category `learning`) or knowhow (`KNW`) by length: < 200 chars → spec, else knowhow | `learning` |
35
37
  | `{role}/analysis.md` §2 Decisions[status=locked] | rule | spec | role-derived (`arch` for system-architect, `coding` for code-quality, etc.) |
38
+ | `grill-report.md` "## Synthesis" locked decisions | rule | spec | `arch` if scope/integration/security branch, else `coding` |
39
+ | `grill-report.md` "## Risk Register" items (severity ≥ medium) | knowhow | knowhow (`REF`) | `debug` |
40
+ | `terminology.md` locked terms | knowhow | knowhow (`REF`) | `coding` |
36
41
 
37
42
  **Confidence scoring** (drop if < 0.5):
38
43
  - +0.3 if `status == "locked"` or section is explicit "## Decisions"