maestro-flow-one 0.2.24 → 0.2.25

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.
@@ -42,9 +42,10 @@ You are a collaborative planner that works within a pre-allocated task ID range.
42
42
  "type": "feature",
43
43
  "priority": "medium",
44
44
  "effort": "medium",
45
- "action": "Implement",
45
+ "action": "<concrete action with exact values: function signatures, config keys, import paths>",
46
46
  "scope": "<module path>",
47
47
  "focus_paths": [],
48
+ "read_first": ["src/module/existing.ts", "src/types/shared.ts"],
48
49
  "depends_on": [],
49
50
  "parallel_group": null,
50
51
  "convergence": {
@@ -116,6 +117,8 @@ You are a collaborative planner that works within a pre-allocated task ID range.
116
117
  - Task files must use `convergence.criteria` (array of testable strings), not `done_when`
117
118
  - files must use `[{path, action, target, change}]` format, not `["path"]`
118
119
  - Each task must have convergence.criteria with min 2 testable conditions
120
+ - Each task must have `read_first[]` — files the executor MUST read before implementation
121
+ - `action` must contain concrete values (function signatures, config keys, import paths), not just a verb
119
122
  - Task definitions follow the same schema as workflow-planner output
120
123
  - If you discover scope that belongs to another planner's range, note it in plan-note.md
121
124
  - Do not modify other planners' task files
@@ -30,7 +30,9 @@ You validate the quality of execution plans before they proceed to implementatio
30
30
  - Each criterion must reference a concrete artifact, output, or behavior
31
31
  - Criteria should be sufficient to prove the task is complete
32
32
  7. **Check files array** -- Verify each task's `files[]` array is consistent with its description
33
- 8. **Report** -- Write check report with issues or approval
33
+ 8. **Check read_first** -- Verify each task has `read_first[]` containing: the file being modified + source-of-truth files. Missing or empty `read_first` is a critical issue.
34
+ 9. **Check action concreteness** -- Verify each task's `action` contains concrete values (function signatures, config keys, import paths), not vague verbs like "Implement" or references like "align X with Y"
35
+ 10. **Report** -- Write check report with issues or approval
34
36
 
35
37
  ### Revision Loop (max 3 rounds)
36
38
  - If issues found: write report with specific issues and suggested fixes
@@ -72,6 +74,14 @@ Check report written to the output location above:
72
74
  ## Files Array Consistency
73
75
  - TASK-006: description mentions "update config" but files[] does not include any config file
74
76
 
77
+ ## Read First Completeness
78
+ - TASK-001 read_first: Missing — must include src/auth.ts (file being modified) + src/types/auth.ts (type definitions)
79
+ - TASK-003 read_first: Has target file but missing source-of-truth reference
80
+
81
+ ## Action Concreteness
82
+ - TASK-002 action: Too vague ("Implement auth") — should include: "Add verifyToken(token: string): Promise<AuthPayload> to src/auth.ts, import from jsonwebtoken"
83
+ - TASK-005 action: Contains "align with existing pattern" — must specify the exact target state
84
+
75
85
  ## Summary
76
86
  <Overall assessment>
77
87
  ```
@@ -92,9 +92,10 @@ When invoked with `quick` flag:
92
92
  "type": "feature",
93
93
  "priority": "medium",
94
94
  "effort": "medium",
95
- "action": "Implement",
95
+ "action": "<concrete action with exact values: function signatures, config keys, import paths>",
96
96
  "scope": "<module path>",
97
97
  "focus_paths": ["src/tools/"],
98
+ "read_first": ["src/tools/existing-tool.ts", "src/types/tool.ts"],
98
99
  "depends_on": [],
99
100
  "parallel_group": null,
100
101
  "convergence": {
@@ -164,6 +165,8 @@ These rules prevent over-splitting that wastes tokens on unnecessary agent spawn
164
165
  - Each task must be substantial (15-60 min of work); group related changes, avoid file-per-task
165
166
  - Each task must have convergence.criteria (min 2 testable conditions)
166
167
  - convergence.criteria must be specific and testable (not "works correctly")
168
+ - Each task must have `read_first[]` — files the executor MUST read before implementation (the file being modified + source-of-truth files)
169
+ - `action` must contain concrete values (function signatures, config keys, import paths), not just a verb like "Implement"
167
170
  - files must use array format `[{path, action, target, change}]`
168
171
  - Wave ordering must respect dependencies (no task before its dependency)
169
172
  - Task descriptions must be clear enough for the executor to implement without ambiguity
@@ -48,7 +48,7 @@ $ARGUMENTS -- phase number for micro mode, topic text for macro/adhoc mode, no a
48
48
  - `-y` / `--yes`: Auto mode — skip interactive scoping, use recommended defaults, auto-deepen
49
49
  - `-c` / `--continue`: Resume from existing session (auto-detect session folder + discussion.md)
50
50
  - `-q` / `--quick`: Quick mode — skip exploration + scoring, go straight to decision extraction (context.md only)
51
- - `--from <source>`: Load upstream context package (brainstorm:ID, blueprint:BLP-xxx, @file, or path)
51
+ - `--from <source>`: Load upstream context package (grill:ID, brainstorm:ID, blueprint:BLP-xxx, @file, or path)
52
52
  - `--gaps [ISS-ID]`: Issue root cause analysis mode. If ISS-ID provided, analyze single issue. If omitted, analyze all open/registered issues from issues.jsonl.
53
53
 
54
54
  Scope routing, output directory format, artifact registration schema, and output artifact listing are defined in workflow analyze.md (Scope Routing and Output Structure sections).
@@ -68,7 +68,7 @@ Interview the user relentlessly until shared understanding is reached. Active on
68
68
  - Branch jumps allowed: the user may switch freely between mode / role / upstream / sub-pipeline branches; sequence is not enforced, but every decision point must end with a definite answer.
69
69
  - Scope guard: only ask about decisions owned by `brainstorm`. Do not pre-resolve roadmap/plan choices.
70
70
 
71
- Decision points: mode (auto / single-role / review-only) / role selection and `--count` / `--from` upstream source / whether to enable design-research and the DESIGN.md sub-pipeline.
71
+ Decision points: mode (auto / single-role / review-only) / role selection and `--count` / `--from` upstream source (grill:ID, blueprint:ID, @file, path) / whether to enable design-research and the DESIGN.md sub-pipeline.
72
72
 
73
73
  Exit: on consensus or explicit user signal to proceed, finalize session metadata. The §11 table (already populated incrementally) uses this schema:
74
74
  `| # | Decision | Choice | Source (user / code / default) |`
@@ -84,6 +84,7 @@ Auto mode:
84
84
  - Project initialized, need formal spec package → Skill({ skill: "maestro-blueprint", args: "--from brainstorm:{artifact_id}" })
85
85
  - Project initialized, quick roadmap → Skill({ skill: "maestro-roadmap", args: "--from brainstorm:{artifact_id}" })
86
86
  - Need deeper analysis first → Skill({ skill: "maestro-analyze", args: "{topic} --from brainstorm:{artifact_id}" })
87
+ - Need stress-testing first → Skill({ skill: "maestro-grill", args: "{topic}" })
87
88
  - `html-prototypes/` produced with 2+ files and user wants to browse → load `~/.maestro/workflows/brainstorm-visualize.md` and launch visualizer server (optional, user-triggered)
88
89
  - DESIGN.md established during Step 3.5 → suggest: "Run `/maestro-impeccable build <feature-description>` to build with the established design system"
89
90
 
@@ -0,0 +1,531 @@
1
+ ---
2
+ name: maestro-companion
3
+ description: Knowledge companion — load context, record companion doc, capture insights, route to skills
4
+ argument-hint: "[before|note|after|route] [--task <description>] [--type <task_type>] [--category <cat>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Skill
13
+ - AskUserQuestion
14
+ ---
15
+
16
+ <purpose>
17
+ Task companion command — pairs with any task to provide knowledge context loading,
18
+ structured companion document recording, insight capture, and skill routing.
19
+
20
+ Does not create sessions or modify workflow state. Pure side-car utility.
21
+
22
+ Four modes:
23
+ - **before** — Pre-task: load spec + knowhow index + codebase index, create companion doc
24
+ - **note** — Mid-task: append a structured entry to the active companion doc
25
+ - **after** — Post-task: review companion doc, promote entries to spec/knowhow, suggest next steps
26
+ - **route** — Routing: recommend next skill/command based on intent
27
+
28
+ No arguments → auto-detect: uncommitted changes → `after`, else → `before`.
29
+ </purpose>
30
+
31
+ <context>
32
+ $ARGUMENTS — mode + optional flags.
33
+
34
+ **Mode detection priority:**
35
+ 1. Explicit `before` / `note` / `after` / `route`
36
+ 2. Intent text that is not a mode keyword → `route`
37
+ 3. No arguments → auto-detect (`git status` has changes → `after`, else → `before`)
38
+
39
+ **Flags:**
40
+ - `--task <description>` — Current task description (for targeted knowledge loading and doc title)
41
+ - `--type <task_type>` — Task type for field template selection (see task types below)
42
+ - `--category <cat>` — Spec category filter: coding / arch / test / review / debug / learning / ui
43
+
44
+ **Task types** (determines which recording sections are active):
45
+
46
+ | Type | Description | Key sections |
47
+ |------|-------------|--------------|
48
+ | `implement` | Feature development, code writing | working_files, dependencies, decisions, tests_affected |
49
+ | `debug` | Bug investigation, root cause analysis | symptoms, hypotheses, evidence, root_cause, fix_applied |
50
+ | `analyze` | Code/architecture/performance analysis | scope, findings, risks, recommendations |
51
+ | `design` | Architecture/UI/API design | constraints, alternatives, trade_offs, chosen_approach |
52
+ | `plan` | Task decomposition, roadmap planning | goals, breakdown, estimates, dependencies |
53
+ | `review` | Code review, PR review | files_reviewed, findings, severity_counts, verdict |
54
+ | `test` | Test writing, UAT, coverage expansion | coverage_before, coverage_after, gaps, test_files |
55
+ | `refactor` | Code restructuring, tech debt | affected_modules, before_after, breaking_changes |
56
+ | `learn` | Codebase exploration, knowledge building | questions, answers, mental_model, references |
57
+ | `general` | Default / unclassified | (all universal sections) |
58
+
59
+ Auto-detection: if `--type` not provided, infer from `--task` description keywords.
60
+
61
+ **Companion document:**
62
+ - Path: `.workflow/.scratchpad/companion-{YYYYMMDD-HHmmss}.md`
63
+ - Active doc tracking: `.workflow/.scratchpad/.companion-active` (stores path of current companion doc)
64
+ - Format: YAML frontmatter (rich metadata) + typed sections + timestamped entries
65
+ </context>
66
+
67
+ <state_machine>
68
+
69
+ <states>
70
+ S_PARSE — Parse arguments, detect mode, resolve task type
71
+ S_BEFORE — Load knowledge context, create companion doc with typed template
72
+ S_NOTE — Append structured entry to active companion doc
73
+ S_AFTER — Review companion doc, populate outcome, promote entries, suggest next steps
74
+ S_ROUTE — Skill routing via maestro-next
75
+ </states>
76
+
77
+ <transitions>
78
+
79
+ S_PARSE:
80
+ → S_BEFORE WHEN: mode == "before" OR (no args AND no uncommitted changes)
81
+ → S_NOTE WHEN: mode == "note"
82
+ → S_AFTER WHEN: mode == "after" OR (no args AND has uncommitted changes)
83
+ → S_ROUTE WHEN: mode == "route" OR intent text present
84
+
85
+ </transitions>
86
+
87
+ </state_machine>
88
+
89
+ <execution>
90
+
91
+ ## S_BEFORE — Knowledge Loading + Companion Doc Creation
92
+
93
+ Execute in order, skip unavailable steps:
94
+
95
+ ### 1. Load specs
96
+
97
+ ```bash
98
+ # With --category: load by category
99
+ maestro spec load --category <cat>
100
+
101
+ # With --task: load by keyword extracted from task description
102
+ maestro spec load --keyword <extracted_keyword>
103
+
104
+ # No flags: load coding (most universal)
105
+ maestro spec load --category coding
106
+ ```
107
+
108
+ Display loaded rules summary (entry count + key rule names).
109
+
110
+ ### 2. Browse knowhow index
111
+
112
+ ```bash
113
+ # List recent knowhow entries
114
+ maestro knowhow list --store workflow
115
+
116
+ # With --task: search relevant entries
117
+ maestro knowhow search "<task_keyword>"
118
+ ```
119
+
120
+ Display available knowhow entries (ID + title). Hint: `maestro wiki load <id>` for details.
121
+
122
+ ### 3. Check codebase index
123
+
124
+ ```bash
125
+ ls .workflow/codebase/doc-index.json
126
+ ```
127
+
128
+ - Exists → display "Codebase docs ready, last updated: {timestamp}"
129
+ - Missing → suggest `/manage-codebase-rebuild`
130
+ - Stale (>7 days) → suggest `/manage-codebase-refresh`
131
+
132
+ ### 4. Create companion document
133
+
134
+ Create `.workflow/.scratchpad/` if needed. Resolve task type from `--type` flag or infer from `--task` keywords.
135
+
136
+ Write companion doc with the full field template:
137
+
138
+ ```markdown
139
+ ---
140
+ # === Identity ===
141
+ task: "{task_description or 'Untitled task'}"
142
+ task_type: "{resolved type: implement|debug|analyze|design|plan|review|test|refactor|learn|general}"
143
+ created: "{ISO timestamp}"
144
+ status: active
145
+
146
+ # === Context Loaded ===
147
+ specs_loaded: "{category or 'coding'}"
148
+ specs_count: {N}
149
+ knowhow_searched: "{keyword or 'none'}"
150
+ knowhow_available: {M}
151
+ codebase_index: "{ready|missing|stale}"
152
+ branch: "{current git branch}"
153
+ phase: "{current phase from state.json or 'none'}"
154
+ milestone: "{current milestone from state.json or 'none'}"
155
+
156
+ # === Scope ===
157
+ working_files: []
158
+ dependencies: []
159
+ related_artifacts: []
160
+
161
+ # === Outcome (populated by after mode) ===
162
+ outcome: ""
163
+ files_changed: []
164
+ promoted_specs: 0
165
+ promoted_knowhow: 0
166
+ follow_up: []
167
+ completed: ""
168
+ ---
169
+
170
+ # Companion Doc — {task_description}
171
+
172
+ > `/maestro-companion note "<content>"` — add entries
173
+ > `/maestro-companion after` — review, promote, close
174
+
175
+ ## Context
176
+
177
+ {Type-specific context section — see templates below}
178
+
179
+ ## Entries
180
+
181
+ ## Summary
182
+ ```
183
+
184
+ **Type-specific context templates** (written into `## Context`):
185
+
186
+ **implement:**
187
+ ```markdown
188
+ ### Working Files
189
+ | File | Role | Status |
190
+ |------|------|--------|
191
+
192
+ ### Dependencies
193
+ - (modules, APIs, or services this task depends on)
194
+
195
+ ### Decisions
196
+ | # | Decision | Rationale | Alternatives Considered |
197
+ |---|----------|-----------|------------------------|
198
+
199
+ ### Tests Affected
200
+ - (test files that need creation or update)
201
+ ```
202
+
203
+ **debug:**
204
+ ```markdown
205
+ ### Symptoms
206
+ - (observable behavior vs expected behavior)
207
+
208
+ ### Hypotheses
209
+ | # | Hypothesis | Status | Evidence |
210
+ |---|-----------|--------|----------|
211
+
212
+ ### Evidence Trail
213
+ | Time | Source | Type | Finding |
214
+ |------|--------|------|---------|
215
+
216
+ ### Root Cause
217
+ - (populated when identified)
218
+
219
+ ### Fix Applied
220
+ - (description of fix, files changed)
221
+ ```
222
+
223
+ **analyze:**
224
+ ```markdown
225
+ ### Scope
226
+ - (what is being analyzed and boundaries)
227
+
228
+ ### Findings
229
+ | # | Finding | Severity | Location |
230
+ |---|---------|----------|----------|
231
+
232
+ ### Risks
233
+ - (identified risks or concerns)
234
+
235
+ ### Recommendations
236
+ - (actionable recommendations)
237
+ ```
238
+
239
+ **design:**
240
+ ```markdown
241
+ ### Constraints
242
+ - (hard limits, requirements, compatibility needs)
243
+
244
+ ### Alternatives
245
+ | # | Approach | Pros | Cons |
246
+ |---|----------|------|------|
247
+
248
+ ### Trade-offs
249
+ - (key trade-off decisions and rationale)
250
+
251
+ ### Chosen Approach
252
+ - (selected design with justification)
253
+ ```
254
+
255
+ **plan:**
256
+ ```markdown
257
+ ### Goals
258
+ - (what success looks like)
259
+
260
+ ### Breakdown
261
+ | # | Task | Estimate | Depends On | Status |
262
+ |---|------|----------|------------|--------|
263
+
264
+ ### Dependencies
265
+ - (external dependencies, blockers, prerequisites)
266
+ ```
267
+
268
+ **review:**
269
+ ```markdown
270
+ ### Files Reviewed
271
+ | File | Lines | Findings |
272
+ |------|-------|----------|
273
+
274
+ ### Findings
275
+ | # | Severity | Category | File:Line | Description |
276
+ |---|----------|----------|-----------|-------------|
277
+
278
+ ### Verdict
279
+ - (pass / pass-with-concerns / fail)
280
+ ```
281
+
282
+ **test:**
283
+ ```markdown
284
+ ### Coverage
285
+ - Before: {%}
286
+ - After: {%}
287
+ - Target: {%}
288
+
289
+ ### Test Files
290
+ | File | Type | Tests Added | Status |
291
+ |------|------|------------|--------|
292
+
293
+ ### Gaps
294
+ - (uncovered paths or scenarios)
295
+ ```
296
+
297
+ **refactor:**
298
+ ```markdown
299
+ ### Affected Modules
300
+ - (modules being restructured)
301
+
302
+ ### Before / After
303
+ | Aspect | Before | After |
304
+ |--------|--------|-------|
305
+
306
+ ### Breaking Changes
307
+ - (API or behavior changes that affect consumers)
308
+ ```
309
+
310
+ **learn:**
311
+ ```markdown
312
+ ### Questions
313
+ | # | Question | Answered | Source |
314
+ |---|----------|----------|--------|
315
+
316
+ ### Mental Model
317
+ - (evolving understanding of how it works)
318
+
319
+ ### References
320
+ - (files, docs, wiki entries consulted)
321
+ ```
322
+
323
+ **general:**
324
+ ```markdown
325
+ ### Notes
326
+ - (general working notes)
327
+ ```
328
+
329
+ Write the companion doc path to `.workflow/.scratchpad/.companion-active`.
330
+
331
+ ### 5. Output summary card
332
+
333
+ ```
334
+ Knowledge context loaded
335
+ Spec: {N} rules ({category})
336
+ Knowhow: {M} entries available
337
+ Codebase: {status}
338
+ Doc: {companion_doc_path} [{task_type}]
339
+
340
+ Mid-task commands:
341
+ /maestro-companion note "finding or decision"
342
+ /maestro-companion note --file src/auth.ts "changed token validation"
343
+ /spec-load --keyword <keyword>
344
+ maestro wiki search "<query>"
345
+ ```
346
+
347
+ ---
348
+
349
+ ## S_NOTE — Append Structured Entry to Companion Doc
350
+
351
+ ### 1. Locate active companion doc
352
+
353
+ Read `.workflow/.scratchpad/.companion-active` to get the doc path.
354
+ If missing or file not found → create a new companion doc (same as S_BEFORE step 4, minimal — no spec/knowhow loading).
355
+
356
+ ### 2. Parse entry content and flags
357
+
358
+ Parse $ARGUMENTS after `note` keyword:
359
+ - `--file <path>` — associate entry with a specific file (appended to frontmatter `working_files`)
360
+ - `--severity <level>` — for findings: critical / high / medium / low
361
+ - Remaining text = entry content
362
+
363
+ ### 3. Classify entry type
364
+
365
+ Auto-classify from content signals:
366
+
367
+ | Content signal | Type tag |
368
+ |---------------|----------|
369
+ | "decided/decision/chose/picked/went with" | `decision` |
370
+ | "pattern/convention/rule/always/never/must" | `spec-candidate` |
371
+ | "pitfall/gotcha/careful/warning/trap/beware" | `pitfall` |
372
+ | "learned/realized/discovered/understood/turns out" | `insight` |
373
+ | "hypothesis/suspect/might be/could be" | `hypothesis` |
374
+ | "found bug/root cause/because of/caused by" | `evidence` |
375
+ | "risk/concern/worry/might break" | `risk` |
376
+ | "todo/need to/should also/follow up/remaining" | `todo` |
377
+ | "question/why does/how does/unclear" | `question` |
378
+ | "blocked/stuck/can't/impossible" | `blocker` |
379
+ | Default | `note` |
380
+
381
+ ### 4. Append entry
382
+
383
+ Append to the companion doc under `## Entries`:
384
+
385
+ ```markdown
386
+ ### [{type}] {HH:mm} — {first line of content}
387
+
388
+ {full content}
389
+
390
+ {if --file: **File:** `{path}`}
391
+ {if --severity: **Severity:** {level}}
392
+ ```
393
+
394
+ ### 5. Update frontmatter fields
395
+
396
+ - If `--file` provided and not already in `working_files` → append to `working_files`
397
+ - If type is `decision` → also append row to `### Decisions` table (if implement/design type doc)
398
+ - If type is `hypothesis` → also append row to `### Hypotheses` table (if debug type doc)
399
+ - If type is `evidence` → also append row to `### Evidence Trail` table (if debug type doc)
400
+ - If type is `risk` → also append to `### Risks` list (if analyze/design type doc)
401
+ - If type is `question` → also append row to `### Questions` table (if learn type doc)
402
+
403
+ ### 6. Confirm
404
+
405
+ ```
406
+ [{type}] entry added to companion doc
407
+ /maestro-companion note "..." — add more
408
+ /maestro-companion after — review & promote
409
+ ```
410
+
411
+ ---
412
+
413
+ ## S_AFTER — Review Companion Doc + Populate Outcome + Promote Entries + Route
414
+
415
+ ### 1. Load companion doc
416
+
417
+ Read `.workflow/.scratchpad/.companion-active` → read the companion doc.
418
+ If no active doc or doc is empty → skip to step 4 (accumulation reminder).
419
+
420
+ ### 2. Populate outcome fields
421
+
422
+ Collect task outcome data:
423
+
424
+ ```bash
425
+ # Detect files changed since companion doc creation
426
+ git diff --name-only --since="{companion_created_timestamp}"
427
+ ```
428
+
429
+ Update frontmatter:
430
+ - `files_changed` — from git diff
431
+ - `completed` — current ISO timestamp
432
+ - `status` — `completed`
433
+
434
+ Display entry summary:
435
+ ```
436
+ Companion doc review — {task_type}
437
+ Entries: {total} ({by type breakdown})
438
+ Files: {files_changed count} changed
439
+ Duration: {elapsed since created}
440
+
441
+ Promotable entries:
442
+ {list of decision/spec-candidate/pitfall/insight entries}
443
+ ```
444
+
445
+ ### 3. Promote entries
446
+
447
+ If promotable entries exist, AskUserQuestion:
448
+
449
+ - Option 1: "Promote to spec" — short coding/arch/test constraint
450
+ - Option 2: "Promote to knowhow" — detailed recipe/template/decision/tip
451
+ - Option 3: "Promote both" — spec index entry + knowhow document
452
+ - Option 4: "Skip — nothing to promote"
453
+
454
+ **Routing by selection:**
455
+
456
+ | Selection | Action |
457
+ |-----------|--------|
458
+ | Spec | `Skill("spec-add", args)` — guide user through category + content |
459
+ | Knowhow | `Skill("manage-knowhow-capture", args)` — guide through type + content |
460
+ | Both | `Skill("spec-add")` first, then `Skill("manage-knowhow-capture")` |
461
+ | Skip | Proceed to step 4 |
462
+
463
+ Update frontmatter: `promoted_specs`, `promoted_knowhow` counts.
464
+
465
+ Extract any `todo` entries → write to `follow_up` in frontmatter.
466
+
467
+ Clear `.workflow/.scratchpad/.companion-active`.
468
+
469
+ ### 4. Output accumulation reminder + routing
470
+
471
+ ```
472
+ Knowledge accumulation reminders:
473
+ Reusable pattern found? /spec-add <category> "title" "content"
474
+ Solved a complex problem? /manage-knowhow-capture recipe "description"
475
+ Made an architecture decision? /manage-knowhow-capture decision "description"
476
+ Discovered a useful trick? /manage-knowhow-capture tip "content"
477
+
478
+ Next steps:
479
+ /maestro-next — recommend next command
480
+ /maestro "<intent>" — route intent to full workflow
481
+ /manage-status — view project dashboard
482
+ ```
483
+
484
+ ---
485
+
486
+ ## S_ROUTE — Skill Routing
487
+
488
+ ### 1. Parse intent
489
+
490
+ Extract intent text from $ARGUMENTS after removing the `route` keyword.
491
+
492
+ ### 2. Delegate to maestro-next
493
+
494
+ ```
495
+ Skill("maestro-next", "<intent_text>")
496
+ ```
497
+
498
+ Reuses maestro-next routing table and scoring logic to recommend the best single command.
499
+
500
+ </execution>
501
+
502
+ <error_codes>
503
+ | Code | Severity | Condition | Recovery |
504
+ |------|----------|-----------|----------|
505
+ | W001 | warning | `.workflow/specs/` not initialized | Suggest `/spec-setup` |
506
+ | W002 | warning | `.workflow/knowhow/` is empty | Normal, skip knowhow index |
507
+ | W003 | warning | `.workflow/codebase/` does not exist | Suggest `/manage-codebase-rebuild` |
508
+ | W004 | warning | No active companion doc found (note/after mode) | Create new doc or skip |
509
+ </error_codes>
510
+
511
+ <success_criteria>
512
+ - [ ] Mode correctly detected (before/note/after/route)
513
+ - [ ] Task type resolved from --type flag or inferred from --task keywords
514
+ - [ ] before: spec + knowhow + codebase indexes loaded or hints given
515
+ - [ ] before: companion doc created with full YAML frontmatter (identity + context + scope + outcome placeholders)
516
+ - [ ] before: type-specific context template written (matching task_type)
517
+ - [ ] before: active doc path written to `.companion-active`
518
+ - [ ] before: summary card output with mid-task command hints
519
+ - [ ] note: active companion doc located and entry appended with type tag
520
+ - [ ] note: entry type auto-classified from content signals (11 type tags)
521
+ - [ ] note: --file flag updates working_files in frontmatter
522
+ - [ ] note: typed entries cross-posted to matching context tables (decisions→Decisions, hypothesis→Hypotheses, etc.)
523
+ - [ ] after: companion doc entries reviewed and promotable items identified
524
+ - [ ] after: outcome fields populated (files_changed, completed, status)
525
+ - [ ] after: AskUserQuestion routes to spec-add or manage-knowhow-capture
526
+ - [ ] after: todo entries extracted to follow_up field
527
+ - [ ] after: companion doc marked completed, active pointer cleared
528
+ - [ ] after: accumulation reminder + next-step routing displayed
529
+ - [ ] route: intent correctly forwarded to maestro-next
530
+ - [ ] No session created, no state.json modified
531
+ </success_criteria>
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: maestro-grill
3
+ description: Use when stress-testing a plan, idea, or requirement against codebase reality before brainstorming
4
+ argument-hint: "<topic|plan> [-y] [-c] [--from <source>] [--depth shallow|standard|deep]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Socratic stress-testing of a plan, idea, or requirement against codebase reality. Walks every branch of the decision tree one question at a time — challenging vague terminology against existing code, probing edge cases with concrete scenarios, and verifying assumptions with code evidence. Produces a verified context package (grill-report.md + terminology.md + context-package.json) for downstream brainstorm/analyze/roadmap consumption.
17
+
18
+ Positioned BEFORE brainstorm in the pipeline: grill stress-tests and sharpens; brainstorm generates and elaborates.
19
+ </purpose>
20
+
21
+ <required_reading>
22
+ @~/.maestro/workflows/grill.md
23
+ </required_reading>
24
+
25
+ <deferred_reading>
26
+ - [state.json](~/.maestro/templates/state.json) — read when registering artifact
27
+ </deferred_reading>
28
+
29
+ <context>
30
+ $ARGUMENTS -- topic/plan text for interactive mode, or --from source for upstream input.
31
+
32
+ **Mode selection:**
33
+ - **Interactive mode** (default): Topic text triggers full Socratic grilling with user Q&A
34
+ - **Auto mode** (`-y`): Code exploration answers questions instead of the user
35
+ - **Resume mode** (`-c` or `--session ID`): Continue from a previous grill session
36
+
37
+ **Flags:**
38
+ - `-y` / `--yes`: Auto mode — CLI exploration replaces human answers
39
+ - `-c` / `--continue`: Resume from last grill session
40
+ - `--session ID`: Resume specific session
41
+ - `--depth shallow|standard|deep`: Branch count 3/5/8 (default: standard)
42
+ - `--from <source>`: Load upstream material (`blueprint:ID`, `@file`, or path)
43
+
44
+ **Output directory**: `.workflow/scratch/{YYYYMMDD}-grill-{slug}/`
45
+ **Produced files**: `grill-report.md`, `terminology.md`, `context-package.json`
46
+
47
+ ### Role Knowledge
48
+ `maestro wiki search "{topic keywords}"` → load relevant entries before grilling.
49
+ `maestro spec load --category arch` → load architecture constraints.
50
+ </context>
51
+
52
+ <interview_protocol>
53
+ Grill the user relentlessly until every branch of the decision tree is walked. This is NOT a menu-driven interview — it is adversarial Socratic questioning. Active only in interactive mode; skip when `-y/--yes` or `-c/--continue`.
54
+
55
+ Core protocol:
56
+ - **One question per turn**. Each question probes ONE specific aspect. Never ask compound questions.
57
+ - **Code-grounded**: Before asking, search the codebase for evidence. Use findings to sharpen the question or challenge the user's answer. Never ask what code can verify — search first, then confront.
58
+ - **Escalating depth**: Start with scope boundaries, progress to data model, edge cases, failure modes. Each branch goes basic → specific → adversarial.
59
+ - **Immediate writeback**: After each answered question, immediately append the Q&A + decision to `grill-report.md`. Do NOT batch — partial progress must be on disk before the next question.
60
+ - **Challenge contradictions**: If an answer conflicts with code evidence or a prior answer, immediately surface the contradiction and demand resolution.
61
+ - **Terminology enforcement**: When the user uses a term that conflicts with codebase naming, challenge it immediately. Propose the code-consistent alternative. Update `terminology.md` as terms crystallize.
62
+
63
+ Question framing rules:
64
+ - Reference specific code findings: "The codebase uses `{symbol}` at `{file:line}` — your proposal calls it `{term}`. Which wins?"
65
+ - Use concrete scenarios: "What happens when a user does {action} while {condition} is true?"
66
+ - Probe boundaries: "You said {X} is in scope — does that include {edge_case}, or is that separate?"
67
+ - Challenge scale: "This touches `{table}` — at 10x current data volume, which query breaks first?"
68
+
69
+ Branch walking order: Scope & Boundaries → Data Model & State → Edge Cases & Failure Modes → Integration & Dependencies → Scale & Performance → Security & Access Control → Observability & Operations → Migration & Rollback. Number of branches determined by `--depth`.
70
+
71
+ Exit: When all depth-selected branches are fully walked (every question answered or explicitly deferred), finalize the report and generate context-package.json.
72
+ </interview_protocol>
73
+
74
+ <execution>
75
+ Follow '~/.maestro/workflows/grill.md' completely.
76
+
77
+ **Next-step routing on completion:**
78
+
79
+ Standard routing:
80
+ - Need multi-role elaboration → Skill({ skill: "maestro-brainstorm", args: "{topic} --from grill:{artifact_id}" })
81
+ - Need deep technical analysis → Skill({ skill: "maestro-analyze", args: "{topic} --from grill:{artifact_id}" })
82
+ - Scope is clear, ready for roadmap → Skill({ skill: "maestro-roadmap", args: "--from grill:{artifact_id}" })
83
+ - Need formal spec package → Skill({ skill: "maestro-blueprint", args: "--from grill:{artifact_id}" })
84
+
85
+ Resume routing:
86
+ - More branches to walk → Skill({ skill: "maestro-grill", args: "{topic} -c" })
87
+ </execution>
88
+
89
+ <error_codes>
90
+ | Code | Severity | Condition | Recovery |
91
+ |------|----------|-----------|----------|
92
+ | E001 | error | No topic/plan and no --from/--continue flag | Prompt user for topic text |
93
+ | E002 | error | --session ID not found | Show available sessions |
94
+ | W001 | warning | Codebase scan failed or returned empty | Continue without code grounding, note limitation |
95
+ | W002 | warning | CLI exploration timeout in auto mode | Skip question, mark as open |
96
+ | W003 | warning | Max branch depth reached without resolution | Force synthesis, offer continuation |
97
+ </error_codes>
98
+
99
+ <success_criteria>
100
+ - [ ] Interactive mode: all depth-selected branches walked (shallow=3, standard=5, deep=8)
101
+ - [ ] Each branch has >= 2 question-answer pairs with evidence or explicit user input
102
+ - [ ] `grill-report.md` written with Branch Log table, all Q&A entries, synthesis section
103
+ - [ ] `terminology.md` written with >= 5 terms, code references where applicable
104
+ - [ ] Every locked decision has evidence (code reference or explicit user confirmation)
105
+ - [ ] Contradictions between answers and code surfaced and resolved (or logged as risks)
106
+ - [ ] Risk register captures all unresolved tensions
107
+ - [ ] `context-package.json` generated with schema "context-package/1.0"
108
+ - [ ] Artifact registered in state.json (type=grill, id=GRL-xxx)
109
+ - [ ] Session sealed via finish-work
110
+ </success_criteria>
111
+
112
+ <on_complete>
113
+ @~/.maestro/workflows/finish-work.md — SESSION_DIR={output_dir}, SESSION_TYPE=grill, SESSION_ID={artifact_id}, LINKED_MILESTONE=null
114
+ </on_complete>
@@ -73,6 +73,10 @@ If exit code is 1, present warnings and ask whether to proceed.
73
73
 
74
74
  Follow '~/.maestro/workflows/plan.md' completely.
75
75
 
76
+ ### P3 Agent Constraint (MANDATORY)
77
+
78
+ Main flow **MUST** spawn a planner agent (Agent tool) for P3 planning — inline planning by main flow is FORBIDDEN. The agent produces both `plan.json` and `.task/TASK-*.json` files. Main flow only passes context and validates output.
79
+
76
80
  ### Codebase Docs Loading (P1 addition)
77
81
 
78
82
  During P1 Context Collection, after loading context files, load codebase documentation if available:
@@ -0,0 +1,256 @@
1
+ ---
2
+ name: maestro-swarm-workflow
3
+ description: Parallel workflow accelerator — route intent to fixed Workflow scripts for multi-agent concurrent execution
4
+ argument-hint: "<intent> [--script <name>] [--dims <d1,d2>] [--roles <r1,r2>] [--count N] [--tier quick|standard] [--resume <runId>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Workflow
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Parallel accelerator layer for maestro commands. Routes user intent to pre-built Workflow scripts
17
+ that leverage `parallel()` / `pipeline()` for multi-agent concurrent execution.
18
+
19
+ Complements maestro-ralph (sequential decision chain) — ralph manages state + decisions,
20
+ swarm-workflow provides parallel compute bursts within individual steps.
21
+
22
+ Scripts: `~/.maestro/workflows/swarm/wf-*.js`
23
+
24
+ | Script | Accelerates | Pattern |
25
+ |--------|-------------|---------|
26
+ | `wf-analyze` | maestro-analyze | cli-explore-agent → 6-dimension parallel scoring → synthesis |
27
+ | `wf-brainstorm` | maestro-brainstorm | multi-role parallel analysis → cross-role-reviewer → guidance |
28
+ | `wf-review` | quality-review | 6-dimension workflow-reviewer → adversarial verify → report |
29
+ | `wf-verify` | maestro-verify | 3-layer workflow-verifier + convergence + antipattern → aggregate |
30
+ | `wf-grill` | maestro-grill | cli-explore-agent → parallel branch stress-testing → contradiction synthesis |
31
+ | `wf-plan` | maestro-plan | parallel context exploration → workflow-planner → plan-checker |
32
+ | `wf-execute` | maestro-execute | wave-based parallel workflow-executor (worktree isolation) |
33
+ | `wf-milestone-audit` | maestro-milestone-audit | parallel coverage + execution + integration-checker |
34
+
35
+ Integration modes:
36
+ - **Standalone**: `/maestro-swarm-workflow "analyze auth module"` — direct invocation
37
+ - **Ralph step**: ralph chain 中某个 step 可指定 `swarm-workflow` 作为加速执行器
38
+ - **Chained**: 输出 JSON 可被下游命令通过 `--from` 消费
39
+ </purpose>
40
+
41
+ <context>
42
+ $ARGUMENTS — intent text with optional flags.
43
+
44
+ **Parse:**
45
+ ```
46
+ --script <name> → 强制指定脚本(wf-analyze, wf-brainstorm, wf-review, wf-verify)
47
+ --dims <d1,d2> → 限定分析维度(analyze: architecture,complexity,patterns,risk,testability,performance)
48
+ --roles <r1,r2> → 限定角色(brainstorm: system-architect,product-manager,test-strategist,ux-expert,security-analyst,data-architect)
49
+ --count N → 角色数量(brainstorm 默认 3)
50
+ --tier <level> → review 层级(quick=2 维度, standard=4 维度)
51
+ --resume <runId> → 从之前的 workflow 运行恢复(增量重跑)
52
+ Remaining → intent
53
+ ```
54
+
55
+ **Script inventory** (`~/.maestro/workflows/swarm/`):
56
+
57
+ | Script | args 接口 |
58
+ |--------|-----------|
59
+ | `wf-analyze` | `{ target, scope, context, phase?, dimensions? }` |
60
+ | `wf-brainstorm` | `{ topic, context, count?, roles? }` |
61
+ | `wf-review` | `{ target, scope, specs?, tier?, dimensions? }` |
62
+ | `wf-verify` | `{ goals, plan_dir?, scope?, task_files?, must_haves?, skip_antipattern? }` |
63
+ | `wf-grill` | `{ topic, context?, depth?: "shallow"\|"standard"\|"deep" }` |
64
+ | `wf-plan` | `{ context_dir?, from?, phase?, scope?, specs?, gaps?, quick? }` |
65
+ | `wf-execute` | `{ plan_dir, specs?, codebase_context?, wiki_context?, auto_commit? }` |
66
+ | `wf-milestone-audit` | `{ milestone?, is_adhoc? }` |
67
+ </context>
68
+
69
+ <state_machine>
70
+
71
+ <states>
72
+ S_PARSE — 解析参数和意图 PERSIST: —
73
+ S_ROUTE — 路由到目标脚本 PERSIST: —
74
+ S_CONTEXT — 组装 context payload PERSIST: —
75
+ S_DISPATCH — 调用 Workflow 工具 PERSIST: —
76
+ S_INGEST — 处理返回结果 PERSIST: —
77
+ S_FALLBACK — 无法路由 PERSIST: —
78
+ </states>
79
+
80
+ <transitions>
81
+
82
+ S_PARSE:
83
+ → S_ROUTE WHEN: intent parsed DO: A_PARSE_ARGS
84
+ → S_FALLBACK WHEN: no intent
85
+
86
+ S_ROUTE:
87
+ → S_CONTEXT WHEN: script resolved DO: A_ROUTE_SCRIPT
88
+ → S_FALLBACK WHEN: ambiguous intent DO: AskUserQuestion
89
+
90
+ S_CONTEXT:
91
+ → S_DISPATCH DO: A_ASSEMBLE_CONTEXT
92
+
93
+ S_DISPATCH:
94
+ → S_INGEST WHEN: workflow completed DO: A_DISPATCH_WORKFLOW
95
+ → S_FALLBACK WHEN: workflow failed
96
+
97
+ S_INGEST:
98
+ → END DO: A_INGEST_RESULTS
99
+
100
+ S_FALLBACK:
101
+ → S_PARSE WHEN: user provides input
102
+ → END WHEN: user cancels
103
+
104
+ </transitions>
105
+
106
+ <actions>
107
+
108
+ ### A_PARSE_ARGS
109
+
110
+ 1. 提取 flags(--script, --dims, --roles, --count, --tier, --resume)
111
+ 2. 剩余文本作为 intent
112
+ 3. 若有 --resume,记录 resumeRunId
113
+
114
+ ### A_ROUTE_SCRIPT
115
+
116
+ Intent-to-script routing(按关键词匹配,--script 优先级最高):
117
+
118
+ | Keywords | Script |
119
+ |----------|--------|
120
+ | 分析 / analyze / 探索 / explore / 架构 / architecture / 复杂度 / 风险 | `wf-analyze` |
121
+ | 头脑风暴 / brainstorm / 方案 / 设计 / 评估 / evaluate / 多角度 | `wf-brainstorm` |
122
+ | 审查 / review / 代码审查 / code review / 质量 / quality | `wf-review` |
123
+ | 验证 / verify / 检查 / check / 反模式 / antipattern | `wf-verify` |
124
+ | 拷问 / grill / 压力测试 / stress-test / 挑战 / challenge | `wf-grill` |
125
+ | 规划 / plan / 任务分解 / decompose / 分波 / wave | `wf-plan` |
126
+ | 执行 / execute / 实现 / implement / 开发 / develop | `wf-execute` |
127
+ | 里程碑审计 / milestone-audit / 集成检查 / integration | `wf-milestone-audit` |
128
+
129
+ 多命中 → AskUserQuestion 让用户选择。
130
+
131
+ ### A_ASSEMBLE_CONTEXT
132
+
133
+ 根据目标脚本组装 args payload:
134
+
135
+ **wf-analyze:**
136
+ 1. Read `.workflow/state.json` 获取当前 phase/milestone 信息
137
+ 2. `target` = intent 中的目标描述
138
+ 3. `scope` = 从 intent 推断文件范围,或读 roadmap 获取 phase scope
139
+ 4. `context` = 拼接相关上下文(上游 artifact 摘要、specs)
140
+ 5. `dimensions` = --dims 解析结果(可选)
141
+
142
+ **wf-brainstorm:**
143
+ 1. `topic` = intent 文本
144
+ 2. `context` = 读取相关代码文件摘要 + 已有 specs
145
+ 3. `count` = --count 或默认 3
146
+ 4. `roles` = --roles 解析结果(可选)
147
+
148
+ **wf-review:**
149
+ 1. `target` = 读 git diff 描述变更范围
150
+ 2. `scope` = 变更文件列表
151
+ 3. `tier` = --tier 或 "standard"
152
+ 4. `dimensions` = --dims 解析结果(可选)
153
+
154
+ **wf-verify:**
155
+ 1. `goals` = 读最近的 plan artifact 提取目标列表
156
+ 2. `plan_dir` = 定位最近的 plan scratch 目录
157
+ 3. `scope` = plan 涉及的文件范围
158
+ 4. `skip_tests` / `skip_antipattern` = 从 flags 提取
159
+
160
+ ### A_DISPATCH_WORKFLOW
161
+
162
+ 1. 确定 scriptPath = `~/.maestro/workflows/swarm/{script}.js`(展开为绝对路径)
163
+ 2. 构建 Workflow 调用:
164
+ ```
165
+ Workflow({
166
+ scriptPath: absoluteScriptPath,
167
+ args: assembledArgs,
168
+ resumeFromRunId: resumeRunId // 若有
169
+ })
170
+ ```
171
+ 3. 等待 Workflow 返回结果
172
+ 4. 记录 runId 用于潜在的后续 resume
173
+
174
+ ### A_INGEST_RESULTS
175
+
176
+ Workflow 返回 JSON 后:
177
+
178
+ 1. **摘要输出**:按脚本类型格式化关键指标
179
+ - analyze: overall_score, scope_verdict, go_no_go, critical findings count
180
+ - brainstorm: role count, conflict/synergy count, top guidance items
181
+ - review: verdict (APPROVE/REQUEST_CHANGES/BLOCK), confirmed vs false-positive count
182
+ - verify: overall_passed, confidence, gap count, antipattern blocker count
183
+
184
+ 2. **Artifact 写入**(可选):
185
+ - 若当前在 ralph session 中(检测 `.workflow/.maestro/ralph-*/status.json` 状态为 running):
186
+ 将结果写入对应 step 的 scratch 目录,格式兼容命令产出
187
+ - 否则写入 `.workflow/scratch/{YYYYMMDD}-swarm-{script}-{slug}/results.json`
188
+
189
+ 3. **Ralph 兼容产出**:
190
+ - analyze → `analysis.md` + `context.md`(decisions)+ `conclusions.json`
191
+ - brainstorm → `guidance-specification.md`
192
+ - review → `review.json`
193
+ - verify → `verification.json`
194
+
195
+ 4. **RunId 提示**:显示 `Resume: /maestro-swarm-workflow --resume {runId}` 用于增量重跑
196
+
197
+ </actions>
198
+
199
+ </state_machine>
200
+
201
+ <invariants>
202
+ 1. **只做并行加速,不做状态决策** — 不修改 ralph status.json,不推进 step
203
+ 2. **args 预编译** — 所有 FS 读取在 A_ASSEMBLE_CONTEXT 完成,脚本内 agent 通过工具自行读取补充
204
+ 3. **产出格式兼容** — 写入的 artifact 格式必须与对应命令(analyze/brainstorm/review/verify)的产出一致
205
+ 4. **resume 透传** — resumeFromRunId 直接透传给 Workflow 工具,利用内置缓存机制
206
+ 5. **脚本只读** — 路由命令不修改 `~/.maestro/workflows/swarm/wf-*.js` 脚本文件
207
+ 6. **结果必须展示** — Workflow 返回后必须向用户展示格式化摘要,不得静默完成
208
+ </invariants>
209
+
210
+ <appendix>
211
+
212
+ ### 与 Ralph 集成
213
+
214
+ Ralph 可以在 A_BUILD_STEPS 中将某些 step 的执行方式标记为 `swarm-workflow`:
215
+
216
+ ```json
217
+ {
218
+ "index": 2,
219
+ "skill": "maestro-swarm-workflow",
220
+ "args": "--script wf-analyze {phase}",
221
+ "stage": "analyze",
222
+ "command_scope": "project",
223
+ "command_path": "<resolved by maestro ralph skills>"
224
+ }
225
+ ```
226
+
227
+ ralph-execute 正常通过 `maestro ralph next` 加载并执行,swarm-workflow 内部再调 Workflow 工具。
228
+
229
+ ### 输出示例
230
+
231
+ ```
232
+ ┌─ wf-analyze ──────────────────────────────────────┐
233
+ │ Explore [████████████████████] 6/6 dimensions │
234
+ │ Synthesize [████████████████] done │
235
+ ├────────────────────────────────────────────────────┤
236
+ │ Score: 7.2/10 Scope: medium Verdict: go │
237
+ │ Findings: 23 total (2 critical, 5 high) │
238
+ │ Cross-cutting: 3 themes │
239
+ │ Decisions: 4 locked, 2 free, 1 deferred │
240
+ ├────────────────────────────────────────────────────┤
241
+ │ Output: .workflow/scratch/20260530-swarm-analyze/ │
242
+ │ Resume: /maestro-swarm-workflow --resume wf_abc123 │
243
+ └────────────────────────────────────────────────────┘
244
+ ```
245
+
246
+ ### Error Codes
247
+
248
+ | Code | Description | Recovery |
249
+ |------|-------------|----------|
250
+ | E001 | No intent and no --script | Prompt for intent |
251
+ | E002 | Ambiguous routing | AskUserQuestion |
252
+ | E003 | Script file not found | Check .claude/workflows/ |
253
+ | E004 | Workflow execution failed | Show error, suggest --resume |
254
+ | E005 | Result ingestion failed | Write raw JSON to scratch |
255
+
256
+ </appendix>
@@ -35,7 +35,7 @@ $ARGUMENTS -- optional flags.
35
35
  | Agent | Focus | Output file |
36
36
  |-------|-------|-------------|
37
37
  | Mapper 1 | **Tech stack** -- languages, frameworks, dependencies, build system | `tech-stack.md` |
38
- | Mapper 2 | **Architecture** -- layers, module boundaries, data flow, entry points | `architecture.md` |
38
+ | Mapper 2 | **Architecture** -- produced by KG pipeline Step 14 (UA architecture-analyzer delegate); layers, module boundaries, data flow, entry points | `architecture.md` |
39
39
  | Mapper 3 | **Features** -- capabilities, API surface, user-facing functionality | `features.md` |
40
40
  | Mapper 4 | **Cross-cutting concerns** -- error handling, logging, auth, config, testing | `concerns.md` |
41
41
 
@@ -43,6 +43,9 @@ $ARGUMENTS -- optional flags.
43
43
  - `.workflow/` -- must be initialized (project.md, state.json exist)
44
44
  - `.workflow/codebase/` -- target directory (will be cleared and rebuilt)
45
45
  - `.workflow/codebase/doc-index.json` -- generated documentation index
46
+ - `.workflow/codebase/knowledge-graph.json` -- Knowledge Graph with nodes, edges, layers, and tour (generated by KG pipeline Steps 10–17 if UA vendor is installed)
47
+
48
+ **UA vendor requirement:** The KG pipeline (Steps 10–17) requires the UA vendor at `~/.maestro/vendor/ua/understand-anything-plugin/`. If not installed, these steps are skipped automatically. Run `scripts/ua-vendor-setup.sh` to install.
46
49
  </context>
47
50
 
48
51
  <execution>
@@ -53,6 +56,9 @@ Follow '~/.maestro/workflows/codebase-rebuild.md' completely.
53
56
  **Next-step routing on completion:**
54
57
  - View updated project state → `/manage-status`
55
58
  - Incremental updates later → `/manage-codebase-refresh`
59
+ - Verify KG stats → `maestro kg stats`
60
+ - Verify wiki integration → `maestro wiki list --keyword kg`
61
+ - Future change impact → `maestro kg diff-wiki`
56
62
  </execution>
57
63
 
58
64
  <error_codes>
@@ -61,6 +67,8 @@ Follow '~/.maestro/workflows/codebase-rebuild.md' completely.
61
67
  | E001 | error | .workflow/ not initialized | Run maestro-init first to create .workflow/ |
62
68
  | W001 | warning | A mapper agent failed (partial results) | Retry failed mapper or accept partial results |
63
69
  | W002 | warning | `.workflow/codebase/` already exists -- user prompted for rebuild/skip | check_existing |
70
+ | W003 | warning | KG validation failed (graph written with valid=false) | Review .kg-tmp/ artifacts, re-run KG pipeline |
71
+ | W004 | warning | Wiki index rebuild failed after KG generation | Non-fatal, retries on next wiki access |
64
72
  </error_codes>
65
73
 
66
74
  <success_criteria>
@@ -71,5 +79,9 @@ Follow '~/.maestro/workflows/codebase-rebuild.md' completely.
71
79
  - [ ] All documentation files regenerated
72
80
  - [ ] state.json updated with rebuild timestamp
73
81
  - [ ] project.md Tech Stack section updated if changes detected
82
+ - [ ] KG pipeline executed (if UA vendor installed)
83
+ - [ ] knowledge-graph.json generated in .workflow/codebase/ (if UA vendor installed)
84
+ - [ ] KG nodes indexed as virtual wiki entries (automatic via WikiIndexer on next wiki access)
74
85
  - [ ] Next step routing: `/manage-status` or `/manage-codebase-refresh` for incremental updates later
86
+ - [ ] KG impact check available: `maestro kg diff-wiki` for future change impact analysis
75
87
  </success_criteria>
@@ -32,6 +32,7 @@ $ARGUMENTS -- optional flags.
32
32
  - `.workflow/` -- must be initialized
33
33
  - `.workflow/codebase/` -- must contain existing docs (from prior rebuild)
34
34
  - `.workflow/codebase/doc-index.json` -- documentation index with timestamps
35
+ - `.workflow/codebase/knowledge-graph.json` -- Knowledge Graph (optional, for KG impact analysis)
35
36
  - `.workflow/state.json` -- contains `codebase_last_rebuilt` timestamp
36
37
  </context>
37
38
 
@@ -50,6 +51,8 @@ Follow '~/.maestro/workflows/codebase-refresh.md' completely.
50
51
  <success_criteria>
51
52
  - [ ] Changed files detected via git diff since last refresh
52
53
  - [ ] Affected documentation entries identified from doc-index.json
54
+ - [ ] KG impact analysis run (if knowledge-graph.json exists): `maestro kg diff-wiki --json`
55
+ - [ ] Affected wiki entries flagged with warnings (if any)
53
56
  - [ ] Only affected docs refreshed (selective mapper re-run)
54
57
  - [ ] doc-index.json timestamps updated per affected entry
55
58
  - [ ] state.json updated with codebase_last_refreshed timestamp
@@ -11,8 +11,9 @@ allowed-tools:
11
11
  ---
12
12
  <purpose>
13
13
  Initialize the project-level specs directory by scanning the codebase for conventions, patterns, and tech stack.
14
- Core files (coding, arch, knowhow) are always created. Optional files (quality, debug, test, review) are created only when relevant signals are detected.
15
- All output lands in `.workflow/specs/`.
14
+ Core files (coding, arch, learnings) are always created. Optional spec files (quality, test, ui) are created only when relevant signals are detected.
15
+ Additionally, generates recipe-type knowhow docs in `.workflow/knowhow/` for detected operational workflows (test / debug / build / dev / lint) — capturing "how to do X in this project" so future agents can find them via `maestro wiki search`.
16
+ Spec output lands in `.workflow/specs/`; recipe output lands in `.workflow/knowhow/`.
16
17
  </purpose>
17
18
 
18
19
  <required_reading>
@@ -37,12 +38,15 @@ Follow '~/.maestro/workflows/specs-setup.md' completely.
37
38
  | E001 | fatal | `.workflow/` directory not initialized -- run `/maestro-init` first | parse_input |
38
39
  | E002 | fatal | No source files found in project -- nothing to scan | scan_codebase |
39
40
  | W001 | warning | Convention detection uncertain for one or more categories -- marked `[UNCERTAIN]` | generate_specs |
41
+ | W002 | warning | Workflow recipe signals detected but commands ambiguous -- recipe skipped | generate_recipes |
42
+ | W003 | warning | Existing recipe slug found -- new content written as `.proposed.md` for manual diff | generate_recipes |
40
43
  </error_codes>
41
44
 
42
45
  <success_criteria>
43
46
  - [ ] `.workflow/specs/` directory created
44
- - [ ] Core files always created: `coding-conventions.md`, `architecture-constraints.md`, `knowhow.md`
45
- - [ ] Optional files created when detected: `quality-rules.md` (linter/CI), `test-conventions.md` (test framework), `debug-notes.md` (on demand), `review-standards.md` (on demand)
46
- - [ ] Report displayed with summary and next steps
47
+ - [ ] Core spec files always created: `coding-conventions.md`, `architecture-constraints.md`, `learnings.md`
48
+ - [ ] Optional spec files created when detected: `quality-rules.md` (linter/CI), `test-conventions.md` (test framework), `ui-conventions.md` (frontend framework). `debug-notes.md` / `review-standards.md` deferred (on demand via `/spec-add`).
49
+ - [ ] Workflow recipe knowhow created in `.workflow/knowhow/` for each detected operational workflow (test / debug / build / dev / lint). Each recipe matches the `recipe` schema in `~/.maestro/workflows/knowhow.md` Part B and contains at least one runnable command.
50
+ - [ ] Report displayed grouped by destination (specs / recipes / skipped / deferred), with `.proposed.md` files surfaced when an existing recipe slug was preserved.
47
51
  </success_criteria>
48
52
  </output>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow-one",
3
- "version": "0.2.24",
3
+ "version": "0.2.25",
4
4
  "description": "All Maestro workflow commands as a single Claude Code skill — intent routing, decision gates, minimal closed-loop chains",
5
5
  "bin": {
6
6
  "maestro-flow": "bin/maestro-flow.js"