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
@@ -0,0 +1,485 @@
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: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Task companion command — pairs with any task to provide knowledge context loading,
10
+ structured companion document recording, insight capture, and skill routing.
11
+
12
+ Does not create sessions or modify workflow state. Pure side-car utility.
13
+
14
+ Four modes:
15
+ - **before** — Pre-task: load spec + knowhow index + codebase index, create companion doc
16
+ - **note** — Mid-task: append a structured entry to the active companion doc
17
+ - **after** — Post-task: review companion doc, promote entries to spec/knowhow, suggest next steps
18
+ - **route** — Routing: recommend next skill/command based on intent
19
+
20
+ No arguments → auto-detect: uncommitted changes → `after`, else → `before`.
21
+ </purpose>
22
+
23
+ <context>
24
+ $ARGUMENTS — mode + optional flags.
25
+
26
+ ```bash
27
+ $maestro-companion
28
+ $maestro-companion "before --task 'implement auth module' --type implement"
29
+ $maestro-companion "before --task 'fix login bug' --type debug --category coding"
30
+ $maestro-companion "note 'decided to use bcrypt over argon2'"
31
+ $maestro-companion "note --file src/auth.ts 'changed token validation logic'"
32
+ $maestro-companion "after"
33
+ $maestro-companion "route what should I do next"
34
+ ```
35
+
36
+ **Mode detection priority:**
37
+ 1. Explicit `before` / `note` / `after` / `route`
38
+ 2. Intent text that is not a mode keyword → `route`
39
+ 3. No arguments → auto-detect (`git status` has changes → `after`, else → `before`)
40
+
41
+ **Flags:**
42
+ - `--task <description>` — Current task description (for targeted knowledge loading and doc title)
43
+ - `--type <task_type>` — Task type for field template selection (see task types below)
44
+ - `--category <cat>` — Spec category filter: coding / arch / test / review / debug / learning / ui
45
+
46
+ **Task types** (determines which recording sections are active):
47
+
48
+ | Type | Description | Key sections |
49
+ |------|-------------|--------------|
50
+ | `implement` | Feature development, code writing | working_files, dependencies, decisions, tests_affected |
51
+ | `debug` | Bug investigation, root cause analysis | symptoms, hypotheses, evidence, root_cause, fix_applied |
52
+ | `analyze` | Code/architecture/performance analysis | scope, findings, risks, recommendations |
53
+ | `design` | Architecture/UI/API design | constraints, alternatives, trade_offs, chosen_approach |
54
+ | `plan` | Task decomposition, roadmap planning | goals, breakdown, estimates, dependencies |
55
+ | `review` | Code review, PR review | files_reviewed, findings, severity_counts, verdict |
56
+ | `test` | Test writing, UAT, coverage expansion | coverage_before, coverage_after, gaps, test_files |
57
+ | `refactor` | Code restructuring, tech debt | affected_modules, before_after, breaking_changes |
58
+ | `learn` | Codebase exploration, knowledge building | questions, answers, mental_model, references |
59
+ | `general` | Default / unclassified | (all universal sections) |
60
+
61
+ Auto-detection: if `--type` not provided, infer from `--task` description keywords.
62
+
63
+ **Companion document:**
64
+ - Path: `.workflow/.scratchpad/companion-{YYYYMMDD-HHmmss}.md`
65
+ - Active doc tracking: `.workflow/.scratchpad/.companion-active` (stores path of current companion doc)
66
+ - Format: YAML frontmatter (rich metadata) + typed sections + timestamped entries
67
+ </context>
68
+
69
+ <execution>
70
+
71
+ ## S_BEFORE — Knowledge Loading + Companion Doc Creation
72
+
73
+ ### Step 1: Load Specs
74
+
75
+ Run `maestro spec load` with appropriate flags:
76
+ - With `--category`: `maestro spec load --category <cat>`
77
+ - With `--task`: `maestro spec load --keyword <extracted_keyword>`
78
+ - No flags: `maestro spec load --category coding`
79
+
80
+ Display loaded rules summary (entry count + key rule names).
81
+
82
+ ### Step 2: Browse Knowhow Index
83
+
84
+ Run `maestro knowhow list --store workflow`. With `--task`, also run `maestro knowhow search "<task_keyword>"`. Display available entries (ID + title). Hint: `maestro wiki load <id>` for details.
85
+
86
+ ### Step 3: Check Codebase Index
87
+
88
+ Check if `.workflow/codebase/doc-index.json` exists.
89
+ - Exists → display "Codebase docs ready, last updated: {timestamp}"
90
+ - Missing → suggest `$manage-codebase-rebuild`
91
+ - Stale (>7 days) → suggest `$manage-codebase-refresh`
92
+
93
+ ### Step 4: Create Companion Document
94
+
95
+ Create `.workflow/.scratchpad/` if needed. Resolve task type from `--type` flag or infer from `--task` keywords.
96
+
97
+ Write companion doc with full field template:
98
+
99
+ ```markdown
100
+ ---
101
+ # === Identity ===
102
+ task: "{task_description or 'Untitled task'}"
103
+ task_type: "{resolved type}"
104
+ created: "{ISO timestamp}"
105
+ status: active
106
+
107
+ # === Context Loaded ===
108
+ specs_loaded: "{category or 'coding'}"
109
+ specs_count: {N}
110
+ knowhow_searched: "{keyword or 'none'}"
111
+ knowhow_available: {M}
112
+ codebase_index: "{ready|missing|stale}"
113
+ branch: "{current git branch}"
114
+ phase: "{current phase from state.json or 'none'}"
115
+ milestone: "{current milestone from state.json or 'none'}"
116
+
117
+ # === Scope ===
118
+ working_files: []
119
+ dependencies: []
120
+ related_artifacts: []
121
+
122
+ # === Outcome (populated by after mode) ===
123
+ outcome: ""
124
+ files_changed: []
125
+ promoted_specs: 0
126
+ promoted_knowhow: 0
127
+ follow_up: []
128
+ completed: ""
129
+ ---
130
+
131
+ # Companion Doc — {task_description}
132
+
133
+ > `$maestro-companion "note '<content>'"` — add entries
134
+ > `$maestro-companion after` — review, promote, close
135
+
136
+ ## Context
137
+
138
+ {Type-specific context section}
139
+
140
+ ## Entries
141
+
142
+ ## Summary
143
+ ```
144
+
145
+ **Type-specific context templates** (written into `## Context`):
146
+
147
+ **implement:**
148
+ ```markdown
149
+ ### Working Files
150
+ | File | Role | Status |
151
+ |------|------|--------|
152
+
153
+ ### Dependencies
154
+ - (modules, APIs, or services this task depends on)
155
+
156
+ ### Decisions
157
+ | # | Decision | Rationale | Alternatives Considered |
158
+ |---|----------|-----------|------------------------|
159
+
160
+ ### Tests Affected
161
+ - (test files that need creation or update)
162
+ ```
163
+
164
+ **debug:**
165
+ ```markdown
166
+ ### Symptoms
167
+ - (observable behavior vs expected behavior)
168
+
169
+ ### Hypotheses
170
+ | # | Hypothesis | Status | Evidence |
171
+ |---|-----------|--------|----------|
172
+
173
+ ### Evidence Trail
174
+ | Time | Source | Type | Finding |
175
+ |------|--------|------|---------|
176
+
177
+ ### Root Cause
178
+ - (populated when identified)
179
+
180
+ ### Fix Applied
181
+ - (description of fix, files changed)
182
+ ```
183
+
184
+ **analyze:**
185
+ ```markdown
186
+ ### Scope
187
+ - (what is being analyzed and boundaries)
188
+
189
+ ### Findings
190
+ | # | Finding | Severity | Location |
191
+ |---|---------|----------|----------|
192
+
193
+ ### Risks
194
+ - (identified risks or concerns)
195
+
196
+ ### Recommendations
197
+ - (actionable recommendations)
198
+ ```
199
+
200
+ **design:**
201
+ ```markdown
202
+ ### Constraints
203
+ - (hard limits, requirements, compatibility needs)
204
+
205
+ ### Alternatives
206
+ | # | Approach | Pros | Cons |
207
+ |---|----------|------|------|
208
+
209
+ ### Trade-offs
210
+ - (key trade-off decisions and rationale)
211
+
212
+ ### Chosen Approach
213
+ - (selected design with justification)
214
+ ```
215
+
216
+ **plan:**
217
+ ```markdown
218
+ ### Goals
219
+ - (what success looks like)
220
+
221
+ ### Breakdown
222
+ | # | Task | Estimate | Depends On | Status |
223
+ |---|------|----------|------------|--------|
224
+
225
+ ### Dependencies
226
+ - (external dependencies, blockers, prerequisites)
227
+ ```
228
+
229
+ **review:**
230
+ ```markdown
231
+ ### Files Reviewed
232
+ | File | Lines | Findings |
233
+ |------|-------|----------|
234
+
235
+ ### Findings
236
+ | # | Severity | Category | File:Line | Description |
237
+ |---|----------|----------|-----------|-------------|
238
+
239
+ ### Verdict
240
+ - (pass / pass-with-concerns / fail)
241
+ ```
242
+
243
+ **test:**
244
+ ```markdown
245
+ ### Coverage
246
+ - Before: {%}
247
+ - After: {%}
248
+ - Target: {%}
249
+
250
+ ### Test Files
251
+ | File | Type | Tests Added | Status |
252
+ |------|------|------------|--------|
253
+
254
+ ### Gaps
255
+ - (uncovered paths or scenarios)
256
+ ```
257
+
258
+ **refactor:**
259
+ ```markdown
260
+ ### Affected Modules
261
+ - (modules being restructured)
262
+
263
+ ### Before / After
264
+ | Aspect | Before | After |
265
+ |--------|--------|-------|
266
+
267
+ ### Breaking Changes
268
+ - (API or behavior changes that affect consumers)
269
+ ```
270
+
271
+ **learn:**
272
+ ```markdown
273
+ ### Questions
274
+ | # | Question | Answered | Source |
275
+ |---|----------|----------|--------|
276
+
277
+ ### Mental Model
278
+ - (evolving understanding of how it works)
279
+
280
+ ### References
281
+ - (files, docs, wiki entries consulted)
282
+ ```
283
+
284
+ **general:**
285
+ ```markdown
286
+ ### Notes
287
+ - (general working notes)
288
+ ```
289
+
290
+ Write the companion doc path to `.workflow/.scratchpad/.companion-active`.
291
+
292
+ ### Step 5: Output Summary Card
293
+
294
+ ```
295
+ Knowledge context loaded
296
+ Spec: {N} rules ({category})
297
+ Knowhow: {M} entries available
298
+ Codebase: {status}
299
+ Doc: {companion_doc_path} [{task_type}]
300
+
301
+ Mid-task commands:
302
+ $maestro-companion "note 'finding or decision'"
303
+ $maestro-companion "note --file src/auth.ts 'changed validation'"
304
+ $spec-load "--keyword <keyword>"
305
+ ```
306
+
307
+ ---
308
+
309
+ ## S_NOTE — Append Structured Entry to Companion Doc
310
+
311
+ ### Step 1: Locate Active Companion Doc
312
+
313
+ Read `.workflow/.scratchpad/.companion-active` to get the doc path.
314
+ If missing or file not found → create a new companion doc (same as Step 4 above, minimal — no spec/knowhow loading).
315
+
316
+ ### Step 2: Parse Entry Content and Flags
317
+
318
+ Parse $ARGUMENTS after `note` keyword:
319
+ - `--file <path>` — associate entry with a specific file (appended to frontmatter `working_files`)
320
+ - `--severity <level>` — for findings: critical / high / medium / low
321
+ - Remaining text = entry content
322
+
323
+ ### Step 3: Classify Entry Type
324
+
325
+ Auto-classify from content signals:
326
+
327
+ | Content signal | Type tag |
328
+ |---------------|----------|
329
+ | "decided/decision/chose/picked/went with" | `decision` |
330
+ | "pattern/convention/rule/always/never/must" | `spec-candidate` |
331
+ | "pitfall/gotcha/careful/warning/trap/beware" | `pitfall` |
332
+ | "learned/realized/discovered/understood/turns out" | `insight` |
333
+ | "hypothesis/suspect/might be/could be" | `hypothesis` |
334
+ | "found bug/root cause/because of/caused by" | `evidence` |
335
+ | "risk/concern/worry/might break" | `risk` |
336
+ | "todo/need to/should also/follow up/remaining" | `todo` |
337
+ | "question/why does/how does/unclear" | `question` |
338
+ | "blocked/stuck/can't/impossible" | `blocker` |
339
+ | Default | `note` |
340
+
341
+ ### Step 4: Append Entry
342
+
343
+ Append to the companion doc under `## Entries`:
344
+
345
+ ```markdown
346
+ ### [{type}] {HH:mm} — {first line of content}
347
+
348
+ {full content}
349
+
350
+ {if --file: **File:** `{path}`}
351
+ {if --severity: **Severity:** {level}}
352
+ ```
353
+
354
+ ### Step 5: Update Frontmatter and Context Tables
355
+
356
+ - If `--file` provided and not already in `working_files` → append to `working_files`
357
+ - If type is `decision` → also append row to `### Decisions` table (if implement/design type doc)
358
+ - If type is `hypothesis` → also append row to `### Hypotheses` table (if debug type doc)
359
+ - If type is `evidence` → also append row to `### Evidence Trail` table (if debug type doc)
360
+ - If type is `risk` → also append to `### Risks` list (if analyze/design type doc)
361
+ - If type is `question` → also append row to `### Questions` table (if learn type doc)
362
+
363
+ ### Step 6: Confirm
364
+
365
+ ```
366
+ [{type}] entry added to companion doc
367
+ $maestro-companion "note '...'" — add more
368
+ $maestro-companion after — review & promote
369
+ ```
370
+
371
+ ---
372
+
373
+ ## S_AFTER — Review + Populate Outcome + Promote + Route
374
+
375
+ ### Step 1: Load Companion Doc
376
+
377
+ Read `.workflow/.scratchpad/.companion-active` → read the companion doc.
378
+ If no active doc or doc is empty → skip to Step 4 (accumulation reminder).
379
+
380
+ ### Step 2: Populate Outcome Fields
381
+
382
+ Collect task outcome data:
383
+
384
+ ```bash
385
+ git diff --name-only
386
+ ```
387
+
388
+ Update frontmatter:
389
+ - `files_changed` — from git diff
390
+ - `completed` — current ISO timestamp
391
+ - `status` — `completed`
392
+
393
+ Display entry summary:
394
+ ```
395
+ Companion doc review — {task_type}
396
+ Entries: {total} ({by type breakdown})
397
+ Files: {files_changed count} changed
398
+ Duration: {elapsed since created}
399
+
400
+ Promotable entries:
401
+ {list of decision/spec-candidate/pitfall/insight entries}
402
+ ```
403
+
404
+ ### Step 3: Promote Entries
405
+
406
+ If promotable entries exist, ask user:
407
+
408
+ - Option 1: "Promote to spec" — short coding/arch/test constraint
409
+ - Option 2: "Promote to knowhow" — detailed recipe/template/decision/tip
410
+ - Option 3: "Promote both" — spec index entry + knowhow document
411
+ - Option 4: "Skip — nothing to promote"
412
+
413
+ **Routing by selection:**
414
+
415
+ | Selection | Action |
416
+ |-----------|--------|
417
+ | Spec | `Skill({ skill: "spec-add" })` — guide user through category + content |
418
+ | Knowhow | `Skill({ skill: "manage-knowhow-capture" })` — guide through type + content |
419
+ | Both | `spec-add` first, then `manage-knowhow-capture` |
420
+ | Skip | Proceed to Step 4 |
421
+
422
+ Update frontmatter: `promoted_specs`, `promoted_knowhow` counts.
423
+ Extract any `todo` entries → write to `follow_up` in frontmatter.
424
+ Clear `.workflow/.scratchpad/.companion-active`.
425
+
426
+ ### Step 4: Output Accumulation Reminder + Routing
427
+
428
+ ```
429
+ Knowledge accumulation reminders:
430
+ Reusable pattern found? $spec-add "<category> 'title' 'content'"
431
+ Solved a complex problem? $manage-knowhow-capture "recipe 'description'"
432
+ Made an architecture decision? $manage-knowhow-capture "decision 'description'"
433
+ Discovered a useful trick? $manage-knowhow-capture "tip 'content'"
434
+
435
+ Next steps:
436
+ $maestro-next — recommend next command
437
+ $maestro "<intent>" — route intent to full workflow
438
+ $manage-status — view project dashboard
439
+ ```
440
+
441
+ ---
442
+
443
+ ## S_ROUTE — Skill Routing
444
+
445
+ ### Step 1: Parse Intent
446
+
447
+ Extract intent text from $ARGUMENTS after removing the `route` keyword.
448
+
449
+ ### Step 2: Delegate to maestro-next
450
+
451
+ ```
452
+ Skill({ skill: "maestro-next", args: "<intent_text>" })
453
+ ```
454
+
455
+ Reuses maestro-next routing table and scoring logic to recommend the best single command.
456
+
457
+ </execution>
458
+
459
+ <error_codes>
460
+ | Code | Severity | Condition | Recovery |
461
+ |------|----------|-----------|----------|
462
+ | W001 | warning | `.workflow/specs/` not initialized | Suggest `$spec-setup` |
463
+ | W002 | warning | `.workflow/knowhow/` is empty | Normal, skip knowhow index |
464
+ | W003 | warning | `.workflow/codebase/` does not exist | Suggest `$manage-codebase-rebuild` |
465
+ | W004 | warning | No active companion doc found (note/after mode) | Create new doc or skip |
466
+ </error_codes>
467
+
468
+ <success_criteria>
469
+ - [ ] Mode correctly detected (before/note/after/route)
470
+ - [ ] Task type resolved from --type flag or inferred from --task keywords
471
+ - [ ] before: spec + knowhow + codebase indexes loaded or hints given
472
+ - [ ] before: companion doc created with full YAML frontmatter (identity + context + scope + outcome)
473
+ - [ ] before: type-specific context template written (matching task_type)
474
+ - [ ] before: active doc path written to `.companion-active`
475
+ - [ ] note: active companion doc located and entry appended with type tag
476
+ - [ ] note: entry type auto-classified from content signals (11 type tags)
477
+ - [ ] note: --file flag updates working_files in frontmatter
478
+ - [ ] note: typed entries cross-posted to matching context tables
479
+ - [ ] after: outcome fields populated (files_changed, completed, status)
480
+ - [ ] after: promotable entries identified and routed to spec-add or manage-knowhow-capture
481
+ - [ ] after: todo entries extracted to follow_up field
482
+ - [ ] after: companion doc marked completed, active pointer cleared
483
+ - [ ] route: intent correctly forwarded to maestro-next
484
+ - [ ] No session created, no state.json modified
485
+ </success_criteria>
@@ -0,0 +1,111 @@
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: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+ <purpose>
8
+ 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.
9
+
10
+ Positioned BEFORE brainstorm in the pipeline: grill stress-tests and sharpens; brainstorm generates and elaborates.
11
+
12
+ Codex specifics:
13
+ - **No agent spawning** — codebase exploration runs directly via Glob/Grep/Read in coordinator context.
14
+ - **request_user_input** replaces AskUserQuestion for Socratic Q&A.
15
+ - **CLI delegation** for auto mode: `exec_command("maestro delegate ... --role analyze --mode analysis")`.
16
+ </purpose>
17
+
18
+ <required_reading>
19
+ @~/.maestro/workflows/grill.md
20
+ </required_reading>
21
+
22
+ <deferred_reading>
23
+ - [state.json](~/.maestro/templates/state.json) — read when registering artifact
24
+ </deferred_reading>
25
+
26
+ <context>
27
+ $ARGUMENTS -- topic/plan text for interactive mode, or --from source for upstream input.
28
+
29
+ **Mode selection:**
30
+ - **Interactive mode** (default): Topic text triggers full Socratic grilling with user Q&A
31
+ - **Auto mode** (`-y`): Code exploration answers questions instead of the user
32
+ - **Resume mode** (`-c` or `--session ID`): Continue from a previous grill session
33
+
34
+ **Flags:**
35
+ - `-y` / `--yes`: Auto mode — CLI exploration replaces human answers
36
+ - `-c` / `--continue`: Resume from last grill session
37
+ - `--session ID`: Resume specific session
38
+ - `--depth shallow|standard|deep`: Branch count 3/5/8 (default: standard)
39
+ - `--from <source>`: Load upstream material (`blueprint:ID`, `@file`, or path)
40
+
41
+ **Output directory**: `.workflow/scratch/{YYYYMMDD}-grill-{slug}/`
42
+ **Produced files**: `grill-report.md`, `terminology.md`, `context-package.json`
43
+
44
+ ### Role Knowledge
45
+ `maestro wiki search "{topic keywords}"` → load relevant entries before grilling.
46
+ `maestro spec load --category arch` → load architecture constraints.
47
+ </context>
48
+
49
+ <interview_protocol>
50
+ 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`.
51
+
52
+ Core protocol:
53
+ - **One question per turn**. Each question probes ONE specific aspect. Never ask compound questions.
54
+ - **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.
55
+ - **Escalating depth**: Start with scope boundaries, progress to data model, edge cases, failure modes. Each branch goes basic → specific → adversarial.
56
+ - **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.
57
+ - **Challenge contradictions**: If an answer conflicts with code evidence or a prior answer, immediately surface the contradiction and demand resolution.
58
+ - **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.
59
+
60
+ Question framing rules:
61
+ - Reference specific code findings: "The codebase uses `{symbol}` at `{file:line}` — your proposal calls it `{term}`. Which wins?"
62
+ - Use concrete scenarios: "What happens when a user does {action} while {condition} is true?"
63
+ - Probe boundaries: "You said {X} is in scope — does that include {edge_case}, or is that separate?"
64
+ - Challenge scale: "This touches `{table}` — at 10x current data volume, which query breaks first?"
65
+
66
+ 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`.
67
+
68
+ Exit: When all depth-selected branches are fully walked (every question answered or explicitly deferred), finalize the report and generate context-package.json.
69
+ </interview_protocol>
70
+
71
+ <execution>
72
+ Follow '~/.maestro/workflows/grill.md' completely.
73
+
74
+ **Next-step routing on completion:**
75
+
76
+ Standard routing:
77
+ - Need multi-role elaboration → `$maestro-brainstorm "{topic}" --from grill:{artifact_id}`
78
+ - Need deep technical analysis → `$maestro-analyze "{topic}" --from grill:{artifact_id}`
79
+ - Scope is clear, ready for roadmap → `$maestro-roadmap --from grill:{artifact_id}`
80
+ - Need formal spec package → `$maestro-blueprint --from grill:{artifact_id}`
81
+
82
+ Resume routing:
83
+ - More branches to walk → `$maestro-grill "{topic}" -c`
84
+ </execution>
85
+
86
+ <error_codes>
87
+ | Code | Severity | Condition | Recovery |
88
+ |------|----------|-----------|----------|
89
+ | E001 | error | No topic/plan and no --from/--continue flag | Prompt user for topic text |
90
+ | E002 | error | --session ID not found | Show available sessions |
91
+ | W001 | warning | Codebase scan failed or returned empty | Continue without code grounding, note limitation |
92
+ | W002 | warning | CLI exploration timeout in auto mode | Skip question, mark as open |
93
+ | W003 | warning | Max branch depth reached without resolution | Force synthesis, offer continuation |
94
+ </error_codes>
95
+
96
+ <success_criteria>
97
+ - [ ] Interactive mode: all depth-selected branches walked (shallow=3, standard=5, deep=8)
98
+ - [ ] Each branch has >= 2 question-answer pairs with evidence or explicit user input
99
+ - [ ] `grill-report.md` written with Branch Log table, all Q&A entries, synthesis section
100
+ - [ ] `terminology.md` written with >= 5 terms, code references where applicable
101
+ - [ ] Every locked decision has evidence (code reference or explicit user confirmation)
102
+ - [ ] Contradictions between answers and code surfaced and resolved (or logged as risks)
103
+ - [ ] Risk register captures all unresolved tensions
104
+ - [ ] `context-package.json` generated with schema "context-package/1.0"
105
+ - [ ] Artifact registered in state.json (type=grill, id=GRL-xxx)
106
+ - [ ] Session sealed via finish-work
107
+ </success_criteria>
108
+
109
+ <on_complete>
110
+ @~/.maestro/workflows/finish-work.md — SESSION_DIR={output_dir}, SESSION_TYPE=grill, SESSION_ID={artifact_id}, LINKED_MILESTONE=null
111
+ </on_complete>
@@ -129,20 +129,20 @@ S_INFER:
129
129
 
130
130
  S_RESOLVE_SCOPE:
131
131
  → S_QUALITY_MODE DO: A_RESOLVE_SCOPE_VERDICT
132
- GUARD: position ∈ {brainstorm, blueprint, init} → skip (scope_verdict = null)
132
+ GUARD: position ∈ {grill, brainstorm, blueprint, init} → skip (scope_verdict = null)
133
133
 
134
134
  S_QUALITY_MODE:
135
135
  → S_PLANNING_MODE DO: A_DETERMINE_QUALITY_MODE
136
136
 
137
137
  S_PLANNING_MODE:
138
138
  → S_DECOMPOSE DO: A_DETERMINE_PLANNING_MODE
139
- GUARD: lifecycle_position ∈ {brainstorm, blueprint, init, analyze-macro, roadmap} → skip (force independent)
139
+ GUARD: lifecycle_position ∈ {grill, brainstorm, blueprint, init, analyze-macro, roadmap} → skip (force independent)
140
140
 
141
141
  S_DECOMPOSE:
142
142
  → S_BUILD_CHAIN DO: A_DECOMPOSE_TASKS
143
143
  GUARD: broad intent → MUST clarify boundary even if auto_confirm
144
144
  GUARD: narrow intent → auto-derive, skip questions
145
- GUARD: position ∈ {brainstorm, blueprint, init} → skip decomposition
145
+ GUARD: position ∈ {grill, brainstorm, blueprint, init} → skip decomposition
146
146
 
147
147
  S_BUILD_CHAIN:
148
148
  → S_CREATE_SESSION DO: A_BUILD_STEPS
@@ -242,6 +242,7 @@ resolve_milestone(phase_number):
242
242
 
243
243
  | Pattern | Position |
244
244
  |---------|----------|
245
+ | 压力测试 / 拷问 / 验证假设 / grill / stress-test | `grill`(**auto_confirm=true 时跳过,直接 `brainstorm`**) |
245
246
  | brainstorm / 头脑风暴 / 探索 / ideate / 设计思路 | `brainstorm` |
246
247
  | blueprint / 规格 / 正式文档 / spec-generate / 7-phase | `blueprint` |
247
248
  | broad/medium intent 无数字 phase (重构/全面/重写/迁移/新功能 X) | `analyze-macro` |
@@ -262,7 +263,7 @@ resolve_milestone(phase_number):
262
263
  | `phase_is_new == true` (新 phase) | `analyze` |
263
264
  | no milestones AND no roadmap.md AND has analyze macro artifact | `roadmap` |
264
265
  | no milestones AND no roadmap.md AND no analyze artifact | `analyze-macro` |
265
- | `phase == null` (brainstorm/blueprint/init/roadmap/analyze-macro override 已定) | n/a |
266
+ | `phase == null` (grill/brainstorm/blueprint/init/roadmap/analyze-macro override 已定) | n/a |
266
267
  | phase 已存在 + 无任何 artifact | `analyze` |
267
268
  | phase 已存在 + 最新 artifact = analyze | `plan` |
268
269
  | phase 已存在 + 最新 artifact = plan | `execute` |
@@ -317,7 +318,7 @@ resolve_milestone(phase_number):
317
318
 
318
319
  | Condition | Mode | Reason |
319
320
  |-----------|------|--------|
320
- | lifecycle_position ∈ {brainstorm, init, roadmap} | `independent` | 前期阶段不涉及多 phase 规划 |
321
+ | lifecycle_position ∈ {grill, brainstorm, init, roadmap} | `independent` | 前期阶段不涉及多 phase 规划 |
321
322
  | `phase_is_new == true` | `independent` | 新 phase 尚无里程碑上下文 |
322
323
  | intent 显式指定 phase 编号(如 "phase 2"、"P3") | `independent` | 用户明确针对单个 phase |
323
324
  | milestone 仅含 1 个 phase(读 state.json) | `independent` | 统一无意义 |
@@ -380,7 +381,8 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
380
381
 
381
382
  | Stage | Skill (independent) | Skill (unified) | Decision after | quality_mode |
382
383
  |-------|---------------------|-----------------|----------------|--------------|
383
- | brainstorm | `maestro-brainstorm "{intent}"` | *(same)* | — | all |
384
+ | grill | `maestro-grill "{intent}"` | *(same)* | — | all (**skip when auto_confirm**) |
385
+ | brainstorm | `maestro-brainstorm "{intent}" --from grill:{grill_id}` *(if grill ran)* / `maestro-brainstorm "{intent}"` *(otherwise)* | *(same)* | — | all |
384
386
  | blueprint | `maestro-blueprint "{intent}"` | *(same)* | — | all |
385
387
  | init | `maestro-init` | *(same)* | — | all |
386
388
  | analyze-macro | `maestro-analyze "{intent}"` | *(same)* | `post-analyze-scope` | all |
@@ -405,6 +407,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
405
407
  1. **起点**:从 `session.lifecycle_position` 开始
406
408
  2. **跳过已完成**:跳过当前 milestone+phase 下已有 completed artifact 的 stage(按 `session.phase` 过滤);unified 按 milestone 过滤
407
409
  3. **quality_mode 过滤**:按 `session.quality_mode` 排除不匹配 stage
410
+ 3.5. **grill auto_confirm 跳过**:`auto_confirm == true` 时删除 `grill` stage(grill 为交互式苏格拉底拷问,不支持自动模式);brainstorm args 不含 `--from grill:*`
408
411
  4. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ decision: "<gate>", retry_count: 0, max_retries: 2, command_scope: null, command_path: null }`
409
412
  5. **goal-audit 插入**:`task_decomposition` 存在时,在最后一个 evidence-producing stage(verify/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
410
413
  6. **终点硬约束**:chain 以 `milestone-complete` 结尾
@@ -742,7 +745,8 @@ decision:post-goal-audit {retry+1}
742
745
  - [ ] Phase 先于 position 解析;phase_is_new 标记写入 session
743
746
  - [ ] D-007 反查:phase 数字 → `session.milestone`,禁止读 current_milestone;写入 step.milestone_id
744
747
  - [ ] phase_is_new=true → lifecycle_position 强制 `analyze`
745
- - [ ] Intent overrides 识别 brainstorm / blueprint / analyze-macro
748
+ - [ ] Intent overrides 识别 grill / brainstorm / blueprint / analyze-macro
749
+ - [ ] auto_confirm=true 时 grill stage 跳过(交互式拷问不支持自动模式)
746
750
  - [ ] A_RESOLVE_SCOPE_VERDICT 读 macro analyze conclusions.scope_verdict,写入 session.scope_verdict + analyze_macro_id
747
751
  - [ ] 链路起点 = analyze-macro 时:large→roadmap+analyze+plan(phase);medium/small→直跳 plan --from analyze:{ANL_ID}(跳过 roadmap+analyze)
748
752
  - [ ] post-analyze-scope decision 节点在 macro analyze 之后插入;A_SCOPE_EVALUATE/A_APPLY_SCOPE_VERDICT 重塑链路
@@ -153,6 +153,9 @@ Single wave generates `wave-1.csv`. No `prev_context` needed (all tasks independ
153
153
  | `tech-registry/{slug}.md` | Per-component documentation |
154
154
  | `feature-maps/_index.md` | Feature index table |
155
155
  | `feature-maps/{slug}.md` | Per-feature documentation |
156
+ | `knowledge-graph.json` | UA Knowledge Graph: nodes, edges, layers, tour (if UA vendor installed) |
157
+
158
+ **Wiki Integration**: After rebuild, KG nodes are automatically indexed as virtual wiki entries (type: knowhow, virtualKind: ua-kg-node/ua-kg-layer/ua-kg-tour-step) on next `maestro wiki` access. Verify with `maestro wiki list --keyword kg`. Use `maestro kg diff-wiki` for future change impact analysis.
156
159
 
157
160
  ### Session Structure
158
161
 
@@ -350,6 +353,9 @@ Generators: {completed}/{total} succeeded
350
353
  Next steps:
351
354
  Skill({ skill: "manage-status" })
352
355
  Skill({ skill: "manage-codebase-refresh" })
356
+ maestro kg stats # verify KG
357
+ maestro wiki list --keyword kg # verify wiki integration
358
+ maestro kg diff-wiki # future change impact
353
359
  ```
354
360
 
355
361
  ### Shared Discovery Board Protocol