maestro-flow 0.5.3 → 0.5.31

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 (259) hide show
  1. package/.agents/skills/learn-follow/SKILL.md +114 -114
  2. package/.agents/skills/learn-investigate/SKILL.md +138 -139
  3. package/.agents/skills/learn-second-opinion/SKILL.md +105 -109
  4. package/.agents/skills/maestro/SKILL.md +2 -10
  5. package/.agents/skills/maestro-amend/SKILL.md +152 -152
  6. package/.agents/skills/maestro-analyze/SKILL.md +201 -252
  7. package/.agents/skills/maestro-blueprint/SKILL.md +175 -190
  8. package/.agents/skills/maestro-brainstorm/SKILL.md +196 -200
  9. package/.agents/skills/maestro-collab/SKILL.md +159 -159
  10. package/.agents/skills/maestro-companion/SKILL.md +517 -517
  11. package/.agents/skills/maestro-composer/SKILL.md +173 -164
  12. package/.agents/skills/maestro-execute/SKILL.md +169 -170
  13. package/.agents/skills/maestro-fork/SKILL.md +97 -96
  14. package/.agents/skills/maestro-grill/SKILL.md +161 -162
  15. package/.agents/skills/maestro-guard/SKILL.md +93 -92
  16. package/.agents/skills/maestro-impeccable/SKILL.md +296 -253
  17. package/.agents/skills/maestro-init/SKILL.md +117 -118
  18. package/.agents/skills/maestro-merge/SKILL.md +73 -66
  19. package/.agents/skills/maestro-milestone-audit/SKILL.md +4 -10
  20. package/.agents/skills/maestro-milestone-complete/SKILL.md +6 -7
  21. package/.agents/skills/maestro-milestone-release/SKILL.md +122 -131
  22. package/.agents/skills/maestro-next/SKILL.md +241 -245
  23. package/.agents/skills/maestro-overlay/SKILL.md +176 -166
  24. package/.agents/skills/maestro-plan/SKILL.md +211 -197
  25. package/.agents/skills/maestro-player/SKILL.md +167 -167
  26. package/.agents/skills/maestro-quick/SKILL.md +69 -63
  27. package/.agents/skills/maestro-ralph/SKILL.md +2 -36
  28. package/.agents/skills/maestro-ralph-beta/SKILL.md +861 -872
  29. package/.agents/skills/maestro-ralph-execute/SKILL.md +234 -234
  30. package/.agents/skills/maestro-roadmap/SKILL.md +159 -172
  31. package/.agents/skills/maestro-swarm-workflow/SKILL.md +229 -250
  32. package/.agents/skills/maestro-tools-execute/SKILL.md +108 -103
  33. package/.agents/skills/maestro-tools-register/SKILL.md +148 -143
  34. package/.agents/skills/maestro-ui-codify/SKILL.md +103 -86
  35. package/.agents/skills/maestro-universal-workflow/SKILL.md +534 -547
  36. package/.agents/skills/maestro-update/SKILL.md +109 -106
  37. package/.agents/skills/manage-codebase-rebuild/SKILL.md +73 -71
  38. package/.agents/skills/manage-harvest/SKILL.md +83 -81
  39. package/.agents/skills/manage-issue/SKILL.md +59 -60
  40. package/.agents/skills/manage-issue-discover/SKILL.md +70 -68
  41. package/.agents/skills/manage-kg-extractors/SKILL.md +130 -0
  42. package/.agents/skills/manage-knowhow/SKILL.md +70 -66
  43. package/.agents/skills/manage-knowhow-capture/SKILL.md +79 -69
  44. package/.agents/skills/manage-knowledge-audit/SKILL.md +91 -74
  45. package/.agents/skills/manage-status/SKILL.md +52 -42
  46. package/.agents/skills/manage-wiki/SKILL.md +69 -58
  47. package/.agents/skills/odyssey-debug/SKILL.md +445 -459
  48. package/.agents/skills/odyssey-improve/SKILL.md +477 -491
  49. package/.agents/skills/odyssey-planex/SKILL.md +576 -587
  50. package/.agents/skills/odyssey-review-test-fix/SKILL.md +400 -413
  51. package/.agents/skills/odyssey-ui/SKILL.md +431 -448
  52. package/.agents/skills/quality-auto-test/SKILL.md +140 -123
  53. package/.agents/skills/quality-debug/SKILL.md +145 -106
  54. package/.agents/skills/quality-refactor/SKILL.md +91 -53
  55. package/.agents/skills/quality-retrospective/SKILL.md +109 -63
  56. package/.agents/skills/quality-review/SKILL.md +141 -114
  57. package/.agents/skills/quality-sync/SKILL.md +74 -38
  58. package/.agents/skills/quality-test/SKILL.md +133 -103
  59. package/.agents/skills/security-audit/SKILL.md +217 -166
  60. package/.agents/skills/spec-add/SKILL.md +66 -59
  61. package/.agents/skills/spec-load/SKILL.md +68 -68
  62. package/.agents/skills/spec-remove/SKILL.md +42 -42
  63. package/.agents/skills/spec-setup/SKILL.md +38 -41
  64. package/.agy/skills/learn-follow/SKILL.md +114 -114
  65. package/.agy/skills/learn-investigate/SKILL.md +138 -139
  66. package/.agy/skills/learn-second-opinion/SKILL.md +105 -109
  67. package/.agy/skills/maestro/SKILL.md +2 -10
  68. package/.agy/skills/maestro-amend/SKILL.md +152 -152
  69. package/.agy/skills/maestro-analyze/SKILL.md +201 -252
  70. package/.agy/skills/maestro-blueprint/SKILL.md +175 -190
  71. package/.agy/skills/maestro-brainstorm/SKILL.md +196 -200
  72. package/.agy/skills/maestro-collab/SKILL.md +159 -159
  73. package/.agy/skills/maestro-companion/SKILL.md +517 -517
  74. package/.agy/skills/maestro-composer/SKILL.md +173 -164
  75. package/.agy/skills/maestro-execute/SKILL.md +169 -170
  76. package/.agy/skills/maestro-fork/SKILL.md +97 -96
  77. package/.agy/skills/maestro-grill/SKILL.md +161 -162
  78. package/.agy/skills/maestro-guard/SKILL.md +93 -92
  79. package/.agy/skills/maestro-impeccable/SKILL.md +296 -253
  80. package/.agy/skills/maestro-init/SKILL.md +117 -118
  81. package/.agy/skills/maestro-merge/SKILL.md +73 -66
  82. package/.agy/skills/maestro-milestone-audit/SKILL.md +4 -10
  83. package/.agy/skills/maestro-milestone-complete/SKILL.md +6 -7
  84. package/.agy/skills/maestro-milestone-release/SKILL.md +122 -131
  85. package/.agy/skills/maestro-next/SKILL.md +241 -245
  86. package/.agy/skills/maestro-overlay/SKILL.md +176 -166
  87. package/.agy/skills/maestro-plan/SKILL.md +211 -197
  88. package/.agy/skills/maestro-player/SKILL.md +167 -167
  89. package/.agy/skills/maestro-quick/SKILL.md +69 -63
  90. package/.agy/skills/maestro-ralph/SKILL.md +2 -36
  91. package/.agy/skills/maestro-ralph-beta/SKILL.md +861 -872
  92. package/.agy/skills/maestro-ralph-execute/SKILL.md +234 -234
  93. package/.agy/skills/maestro-roadmap/SKILL.md +159 -172
  94. package/.agy/skills/maestro-swarm-workflow/SKILL.md +229 -250
  95. package/.agy/skills/maestro-tools-execute/SKILL.md +108 -103
  96. package/.agy/skills/maestro-tools-register/SKILL.md +148 -143
  97. package/.agy/skills/maestro-ui-codify/SKILL.md +103 -86
  98. package/.agy/skills/maestro-universal-workflow/SKILL.md +534 -547
  99. package/.agy/skills/maestro-update/SKILL.md +109 -106
  100. package/.agy/skills/manage-codebase-rebuild/SKILL.md +73 -71
  101. package/.agy/skills/manage-harvest/SKILL.md +83 -81
  102. package/.agy/skills/manage-issue/SKILL.md +59 -60
  103. package/.agy/skills/manage-issue-discover/SKILL.md +70 -68
  104. package/.agy/skills/manage-kg-extractors/SKILL.md +130 -0
  105. package/.agy/skills/manage-knowhow/SKILL.md +70 -66
  106. package/.agy/skills/manage-knowhow-capture/SKILL.md +79 -69
  107. package/.agy/skills/manage-knowledge-audit/SKILL.md +91 -74
  108. package/.agy/skills/manage-status/SKILL.md +52 -42
  109. package/.agy/skills/manage-wiki/SKILL.md +69 -58
  110. package/.agy/skills/odyssey-debug/SKILL.md +445 -459
  111. package/.agy/skills/odyssey-improve/SKILL.md +477 -491
  112. package/.agy/skills/odyssey-planex/SKILL.md +576 -587
  113. package/.agy/skills/odyssey-review-test-fix/SKILL.md +400 -413
  114. package/.agy/skills/odyssey-ui/SKILL.md +431 -448
  115. package/.agy/skills/quality-auto-test/SKILL.md +140 -123
  116. package/.agy/skills/quality-debug/SKILL.md +145 -106
  117. package/.agy/skills/quality-refactor/SKILL.md +91 -53
  118. package/.agy/skills/quality-retrospective/SKILL.md +109 -63
  119. package/.agy/skills/quality-review/SKILL.md +141 -114
  120. package/.agy/skills/quality-sync/SKILL.md +74 -38
  121. package/.agy/skills/quality-test/SKILL.md +133 -103
  122. package/.agy/skills/security-audit/SKILL.md +217 -166
  123. package/.agy/skills/spec-add/SKILL.md +66 -59
  124. package/.agy/skills/spec-load/SKILL.md +68 -68
  125. package/.agy/skills/spec-remove/SKILL.md +42 -42
  126. package/.agy/skills/spec-setup/SKILL.md +38 -41
  127. package/.claude/commands/learn-follow.md +127 -127
  128. package/.claude/commands/learn-investigate.md +151 -152
  129. package/.claude/commands/learn-second-opinion.md +118 -122
  130. package/.claude/commands/maestro-amend.md +164 -164
  131. package/.claude/commands/maestro-analyze.md +215 -266
  132. package/.claude/commands/maestro-blueprint.md +189 -204
  133. package/.claude/commands/maestro-brainstorm.md +209 -213
  134. package/.claude/commands/maestro-collab.md +172 -172
  135. package/.claude/commands/maestro-companion.md +531 -531
  136. package/.claude/commands/maestro-composer.md +188 -179
  137. package/.claude/commands/maestro-execute.md +183 -184
  138. package/.claude/commands/maestro-fork.md +111 -110
  139. package/.claude/commands/maestro-grill.md +175 -176
  140. package/.claude/commands/maestro-guard.md +103 -102
  141. package/.claude/commands/maestro-impeccable.md +311 -268
  142. package/.claude/commands/maestro-init.md +130 -131
  143. package/.claude/commands/maestro-merge.md +87 -80
  144. package/.claude/commands/maestro-milestone-audit.md +4 -10
  145. package/.claude/commands/maestro-milestone-complete.md +6 -7
  146. package/.claude/commands/maestro-milestone-release.md +136 -145
  147. package/.claude/commands/maestro-next.md +253 -257
  148. package/.claude/commands/maestro-overlay.md +188 -178
  149. package/.claude/commands/maestro-plan.md +225 -211
  150. package/.claude/commands/maestro-player.md +182 -182
  151. package/.claude/commands/maestro-quick.md +83 -77
  152. package/.claude/commands/maestro-ralph-beta.md +875 -886
  153. package/.claude/commands/maestro-ralph-execute.md +247 -247
  154. package/.claude/commands/maestro-ralph.md +2 -36
  155. package/.claude/commands/maestro-roadmap.md +173 -186
  156. package/.claude/commands/maestro-swarm-workflow.md +243 -264
  157. package/.claude/commands/maestro-tools-execute.md +122 -117
  158. package/.claude/commands/maestro-tools-register.md +162 -157
  159. package/.claude/commands/maestro-ui-codify.md +117 -100
  160. package/.claude/commands/maestro-universal-workflow.md +548 -561
  161. package/.claude/commands/maestro-update.md +122 -119
  162. package/.claude/commands/maestro.md +2 -10
  163. package/.claude/commands/manage-codebase-rebuild.md +87 -85
  164. package/.claude/commands/manage-harvest.md +97 -95
  165. package/.claude/commands/manage-issue-discover.md +83 -81
  166. package/.claude/commands/manage-issue.md +72 -73
  167. package/.claude/commands/manage-kg-extractors.md +128 -0
  168. package/.claude/commands/manage-knowhow-capture.md +92 -82
  169. package/.claude/commands/manage-knowhow.md +83 -79
  170. package/.claude/commands/manage-knowledge-audit.md +105 -88
  171. package/.claude/commands/manage-status.md +62 -52
  172. package/.claude/commands/manage-wiki.md +82 -71
  173. package/.claude/commands/odyssey-debug.md +459 -473
  174. package/.claude/commands/odyssey-improve.md +491 -505
  175. package/.claude/commands/odyssey-planex.md +590 -601
  176. package/.claude/commands/odyssey-review-test-fix.md +414 -427
  177. package/.claude/commands/odyssey-ui.md +445 -462
  178. package/.claude/commands/quality-auto-test.md +153 -136
  179. package/.claude/commands/quality-debug.md +159 -120
  180. package/.claude/commands/quality-refactor.md +105 -67
  181. package/.claude/commands/quality-retrospective.md +123 -77
  182. package/.claude/commands/quality-review.md +155 -128
  183. package/.claude/commands/quality-sync.md +88 -52
  184. package/.claude/commands/quality-test.md +147 -117
  185. package/.claude/commands/security-audit.md +230 -179
  186. package/.claude/commands/spec-add.md +77 -70
  187. package/.claude/commands/spec-load.md +78 -78
  188. package/.claude/commands/spec-remove.md +55 -55
  189. package/.claude/commands/spec-setup.md +49 -52
  190. package/dist/src/cli.js +1 -1
  191. package/dist/src/cli.js.map +1 -1
  192. package/dist/src/commands/kg.d.ts.map +1 -1
  193. package/dist/src/commands/kg.js +11 -5
  194. package/dist/src/commands/kg.js.map +1 -1
  195. package/dist/src/graph/kg/extraction/code/code-extractor.d.ts +2 -0
  196. package/dist/src/graph/kg/extraction/code/code-extractor.d.ts.map +1 -1
  197. package/dist/src/graph/kg/extraction/code/code-extractor.js +32 -3
  198. package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  199. package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts +35 -0
  200. package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts.map +1 -0
  201. package/dist/src/graph/kg/extraction/code/plugin-engine.js +573 -0
  202. package/dist/src/graph/kg/extraction/code/plugin-engine.js.map +1 -0
  203. package/dist/src/graph/kg/extraction/code/plugin-types.d.ts +95 -0
  204. package/dist/src/graph/kg/extraction/code/plugin-types.d.ts.map +1 -0
  205. package/dist/src/graph/kg/extraction/code/plugin-types.js +5 -0
  206. package/dist/src/graph/kg/extraction/code/plugin-types.js.map +1 -0
  207. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  208. package/dist/src/graph/kg/extraction/orchestrator.js +17 -5
  209. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  210. package/dist/src/graph/kg/schema.sql +16 -11
  211. package/dist/src/graph/kg/surface/cli.d.ts.map +1 -1
  212. package/dist/src/graph/kg/surface/cli.js +153 -56
  213. package/dist/src/graph/kg/surface/cli.js.map +1 -1
  214. package/dist/src/hooks/workspace.d.ts +4 -2
  215. package/dist/src/hooks/workspace.d.ts.map +1 -1
  216. package/dist/src/hooks/workspace.js +6 -2
  217. package/dist/src/hooks/workspace.js.map +1 -1
  218. package/package.json +91 -91
  219. package/workflows/analyze.md +25 -49
  220. package/workflows/auto-test.md +699 -699
  221. package/workflows/blueprint.md +403 -431
  222. package/workflows/brainstorm.md +54 -195
  223. package/workflows/business-test.md +570 -570
  224. package/workflows/claude-instructions.md +23 -51
  225. package/workflows/codex-instructions.md +27 -77
  226. package/workflows/coding-philosophy.md +69 -69
  227. package/workflows/command-authoring.md +823 -823
  228. package/workflows/debug.md +43 -98
  229. package/workflows/delegate-usage.md +39 -241
  230. package/workflows/execute.md +4 -53
  231. package/workflows/grill.md +12 -56
  232. package/workflows/harvest.md +22 -68
  233. package/workflows/init.md +148 -148
  234. package/workflows/instruction-authoring-guide.md +97 -0
  235. package/workflows/issue-execute.md +110 -110
  236. package/workflows/issue-gaps-analyze.codex.md +260 -260
  237. package/workflows/issue-gaps-analyze.md +216 -216
  238. package/workflows/issue-plan.md +110 -110
  239. package/workflows/issue.md +338 -346
  240. package/workflows/knowhow.md +0 -32
  241. package/workflows/learn.md +277 -277
  242. package/workflows/maestro-chain-execute.md +20 -20
  243. package/workflows/refactor.md +22 -44
  244. package/workflows/retrospective.md +16 -65
  245. package/workflows/review.md +446 -486
  246. package/workflows/roadmap.md +35 -132
  247. package/workflows/skill-authoring.md +265 -265
  248. package/workflows/spec-generate.md +470 -470
  249. package/workflows/specs-remove.md +104 -104
  250. package/workflows/sync.md +11 -41
  251. package/workflows/test-gen.md +226 -226
  252. package/workflows/test.md +385 -475
  253. package/workflows/ui-design.md +391 -391
  254. package/workflows/ui-style.md +199 -199
  255. package/workflows/wiki-connect.md +151 -151
  256. package/workflows/wiki-digest.md +178 -178
  257. package/workflows/wiki-manage.md +109 -109
  258. package/workflows/cli-tools-usage.md +0 -252
  259. package/workflows/delegate-protocol.codex.md +0 -65
@@ -14,520 +14,520 @@ allowed-tools:
14
14
  ---
15
15
  <!-- Open-standard mirror generated by scripts/build-agents-standard.mjs — do not edit; re-run after editing .claude/ source. -->
16
16
 
17
-
18
- <purpose>
19
- Task companion command — pairs with any task to provide knowledge context loading,
20
- structured companion document recording, insight capture, and skill routing.
21
-
22
- Does not create sessions or modify workflow state. Pure side-car utility.
23
-
24
- Four modes:
25
- - **before** — Pre-task: load spec + knowhow index + codebase index, create companion doc
26
- - **note** Mid-task: append a structured entry to the active companion doc
27
- - **after** Post-task: review companion doc, promote entries to spec/knowhow, suggest next steps
28
- - **route** Routing: recommend next skill/command based on intent
29
-
30
- No arguments → auto-detect: uncommitted changes → `after`, else → `before`.
31
- </purpose>
32
-
33
- <context>
34
- $ARGUMENTSmode + optional flags.
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
- <state_machine>
70
-
71
- <states>
72
- S_PARSE — Parse arguments, detect mode, resolve task type
73
- S_BEFORE — Load knowledge context, create companion doc with typed template
74
- S_NOTE — Append structured entry to active companion doc
75
- S_AFTER Review companion doc, populate outcome, promote entries, suggest next steps
76
- S_ROUTE — Skill routing via maestro-next
77
- </states>
78
-
79
- <transitions>
80
-
81
- S_PARSE:
82
- → S_BEFORE WHEN: mode == "before" OR (no args AND no uncommitted changes)
83
- S_NOTE WHEN: mode == "note"
84
- → S_AFTER WHEN: mode == "after" OR (no args AND has uncommitted changes)
85
- S_ROUTE WHEN: mode == "route" OR intent text present
86
-
87
- </transitions>
88
-
89
- </state_machine>
90
-
91
- <execution>
92
-
93
- ## S_BEFORE Knowledge Loading + Companion Doc Creation
94
-
95
- Execute in order, skip unavailable steps:
96
-
97
- ### 1. Load specs
98
-
99
- ```bash
100
- # With --category: load by category
101
- maestro spec load --category <cat>
102
-
103
- # With --task: load by keyword extracted from task description
104
- maestro spec load --keyword <extracted_keyword>
105
-
106
- # No flags: load coding (most universal)
107
- maestro spec load --category coding
108
- ```
109
-
110
- Display loaded rules summary (entry count + key rule names).
111
-
112
- ### 2. Browse knowhow index
113
-
114
- ```bash
115
- # List recent knowhow entries
116
- maestro knowhow list --store workflow
117
-
118
- # With --task: search relevant entries
119
- maestro search --type knowhow "<task_keyword>"
120
- ```
121
-
122
- Display available knowhow entries (ID + title). Hint: `maestro wiki load <id>` for details.
123
-
124
- ### 3. Check codebase index
125
-
126
- ```bash
127
- ls .workflow/codebase/doc-index.json
128
- ```
129
-
130
- - Exists → display "Codebase docs ready, last updated: {timestamp}"
131
- - Missing → suggest `/manage-codebase-rebuild`
132
- - Stale (>7 days) → suggest `/quality-sync`
133
-
134
- ### 4. Create companion document
135
-
136
- Create `.workflow/.scratchpad/` if needed. Resolve task type from `--type` flag or infer from `--task` keywords.
137
-
138
- Write companion doc with the full field template:
139
-
140
- ```markdown
141
- ---
142
- # === Identity ===
143
- task: "{task_description or 'Untitled task'}"
144
- task_type: "{resolved type: implement|debug|analyze|design|plan|review|test|refactor|learn|general}"
145
- created: "{ISO timestamp}"
146
- status: active
147
-
148
- # === Context Loaded ===
149
- specs_loaded: "{category or 'coding'}"
150
- specs_count: {N}
151
- knowhow_searched: "{keyword or 'none'}"
152
- knowhow_available: {M}
153
- codebase_index: "{ready|missing|stale}"
154
- branch: "{current git branch}"
155
- phase: "{current phase from state.json or 'none'}"
156
- milestone: "{current milestone from state.json or 'none'}"
157
-
158
- # === Scope ===
159
- working_files: []
160
- dependencies: []
161
- related_artifacts: []
162
-
163
- # === Outcome (populated by after mode) ===
164
- outcome: ""
165
- files_changed: []
166
- promoted_specs: 0
167
- promoted_knowhow: 0
168
- follow_up: []
169
- completed: ""
170
- ---
171
-
172
- # Companion Doc — {task_description}
173
-
174
- > `/maestro-companion note "<content>"` — add entries
175
- > `/maestro-companion after` — review, promote, close
176
-
177
- ## Context
178
-
179
- {Type-specific context section — see templates below}
180
-
181
- ## Entries
182
-
183
- ## Summary
184
- ```
185
-
186
- **Type-specific context templates** (written into `## Context`):
187
-
188
- **implement:**
189
- ```markdown
190
- ### Working Files
191
- | File | Role | Status |
192
- |------|------|--------|
193
-
194
- ### Dependencies
195
- - (modules, APIs, or services this task depends on)
196
-
197
- ### Decisions
198
- | # | Decision | Rationale | Alternatives Considered |
199
- |---|----------|-----------|------------------------|
200
-
201
- ### Tests Affected
202
- - (test files that need creation or update)
203
- ```
204
-
205
- **debug:**
206
- ```markdown
207
- ### Symptoms
208
- - (observable behavior vs expected behavior)
209
-
210
- ### Hypotheses
211
- | # | Hypothesis | Status | Evidence |
212
- |---|-----------|--------|----------|
213
-
214
- ### Evidence Trail
215
- | Time | Source | Type | Finding |
216
- |------|--------|------|---------|
217
-
218
- ### Root Cause
219
- - (populated when identified)
220
-
221
- ### Fix Applied
222
- - (description of fix, files changed)
223
- ```
224
-
225
- **analyze:**
226
- ```markdown
227
- ### Scope
228
- - (what is being analyzed and boundaries)
229
-
230
- ### Findings
231
- | # | Finding | Severity | Location |
232
- |---|---------|----------|----------|
233
-
234
- ### Risks
235
- - (identified risks or concerns)
236
-
237
- ### Recommendations
238
- - (actionable recommendations)
239
- ```
240
-
241
- **design:**
242
- ```markdown
243
- ### Constraints
244
- - (hard limits, requirements, compatibility needs)
245
-
246
- ### Alternatives
247
- | # | Approach | Pros | Cons |
248
- |---|----------|------|------|
249
-
250
- ### Trade-offs
251
- - (key trade-off decisions and rationale)
252
-
253
- ### Chosen Approach
254
- - (selected design with justification)
255
- ```
256
-
257
- **plan:**
258
- ```markdown
259
- ### Goals
260
- - (what success looks like)
261
-
262
- ### Breakdown
263
- | # | Task | Estimate | Depends On | Status |
264
- |---|------|----------|------------|--------|
265
-
266
- ### Dependencies
267
- - (external dependencies, blockers, prerequisites)
268
- ```
269
-
270
- **review:**
271
- ```markdown
272
- ### Files Reviewed
273
- | File | Lines | Findings |
274
- |------|-------|----------|
275
-
276
- ### Findings
277
- | # | Severity | Category | File:Line | Description |
278
- |---|----------|----------|-----------|-------------|
279
-
280
- ### Verdict
281
- - (pass / pass-with-concerns / fail)
282
- ```
283
-
284
- **test:**
285
- ```markdown
286
- ### Coverage
287
- - Before: {%}
288
- - After: {%}
289
- - Target: {%}
290
-
291
- ### Test Files
292
- | File | Type | Tests Added | Status |
293
- |------|------|------------|--------|
294
-
295
- ### Gaps
296
- - (uncovered paths or scenarios)
297
- ```
298
-
299
- **refactor:**
300
- ```markdown
301
- ### Affected Modules
302
- - (modules being restructured)
303
-
304
- ### Before / After
305
- | Aspect | Before | After |
306
- |--------|--------|-------|
307
-
308
- ### Breaking Changes
309
- - (API or behavior changes that affect consumers)
310
- ```
311
-
312
- **learn:**
313
- ```markdown
314
- ### Questions
315
- | # | Question | Answered | Source |
316
- |---|----------|----------|--------|
317
-
318
- ### Mental Model
319
- - (evolving understanding of how it works)
320
-
321
- ### References
322
- - (files, docs, wiki entries consulted)
323
- ```
324
-
325
- **general:**
326
- ```markdown
327
- ### Notes
328
- - (general working notes)
329
- ```
330
-
331
- Write the companion doc path to `.workflow/.scratchpad/.companion-active`.
332
-
333
- ### 5. Output summary card
334
-
335
- ```
336
- Knowledge context loaded
337
- Spec: {N} rules ({category})
338
- Knowhow: {M} entries available
339
- Codebase: {status}
340
- Doc: {companion_doc_path} [{task_type}]
341
-
342
- Mid-task commands:
343
- /maestro-companion note "finding or decision"
344
- /maestro-companion note --file src/auth.ts "changed token validation"
345
- /spec-load --keyword <keyword>
346
- maestro search "<query>"
347
- ```
348
-
349
- ---
350
-
351
- ## S_NOTEAppend Structured Entry to Companion Doc
352
-
353
- ### 1. Locate active companion doc
354
-
355
- Read `.workflow/.scratchpad/.companion-active` to get the doc path.
356
- If missing or file not found → create a new companion doc (same as S_BEFORE step 4, minimal — no spec/knowhow loading).
357
-
358
- ### 2. Parse entry content and flags
359
-
360
- Parse $ARGUMENTS after `note` keyword:
361
- - `--file <path>` — associate entry with a specific file (appended to frontmatter `working_files`)
362
- - `--severity <level>` — for findings: critical / high / medium / low
363
- - Remaining text = entry content
364
-
365
- ### 3. Classify entry type
366
-
367
- Auto-classify from content signals:
368
-
369
- | Content signal | Type tag |
370
- |---------------|----------|
371
- | "decided/decision/chose/picked/went with" | `decision` |
372
- | "pattern/convention/rule/always/never/must" | `spec-candidate` |
373
- | "pitfall/gotcha/careful/warning/trap/beware" | `pitfall` |
374
- | "learned/realized/discovered/understood/turns out" | `insight` |
375
- | "hypothesis/suspect/might be/could be" | `hypothesis` |
376
- | "found bug/root cause/because of/caused by" | `evidence` |
377
- | "risk/concern/worry/might break" | `risk` |
378
- | "todo/need to/should also/follow up/remaining" | `todo` |
379
- | "question/why does/how does/unclear" | `question` |
380
- | "blocked/stuck/can't/impossible" | `blocker` |
381
- | Default | `note` |
382
-
383
- ### 4. Append entry
384
-
385
- Append to the companion doc under `## Entries`:
386
-
387
- ```markdown
388
- ### [{type}] {HH:mm} {first line of content}
389
-
390
- {full content}
391
-
392
- {if --file: **File:** `{path}`}
393
- {if --severity: **Severity:** {level}}
394
- ```
395
-
396
- ### 5. Update frontmatter fields
397
-
398
- - If `--file` provided and not already in `working_files` → append to `working_files`
399
- - If type is `decision` → also append row to `### Decisions` table (if implement/design type doc)
400
- - If type is `hypothesis` → also append row to `### Hypotheses` table (if debug type doc)
401
- - If type is `evidence` → also append row to `### Evidence Trail` table (if debug type doc)
402
- - If type is `risk` → also append to `### Risks` list (if analyze/design type doc)
403
- - If type is `question` → also append row to `### Questions` table (if learn type doc)
404
-
405
- ### 6. Confirm
406
-
407
- ```
408
- [{type}] entry added to companion doc
409
- /maestro-companion note "..." — add more
410
- /maestro-companion after — review & promote
411
- ```
412
-
413
- ---
414
-
415
- ## S_AFTER — Review Companion Doc + Populate Outcome + Promote Entries + Route
416
-
417
- ### 1. Load companion doc
418
-
419
- Read `.workflow/.scratchpad/.companion-active` → read the companion doc.
420
- If no active doc or doc is empty → skip to step 4 (accumulation reminder).
421
-
422
- ### 2. Populate outcome fields
423
-
424
- Collect task outcome data:
425
-
426
- ```bash
427
- # Detect files changed since companion doc creation
428
- git diff --name-only --since="{companion_created_timestamp}"
429
- ```
430
-
431
- Update frontmatter:
432
- - `files_changed` — from git diff
433
- - `completed` — current ISO timestamp
434
- - `status` `completed`
435
-
436
- Display entry summary:
437
- ```
438
- Companion doc review — {task_type}
439
- Entries: {total} ({by type breakdown})
440
- Files: {files_changed count} changed
441
- Duration: {elapsed since created}
442
-
443
- Promotable entries:
444
- {list of decision/spec-candidate/pitfall/insight entries}
445
- ```
446
-
447
- ### 3. Promote entries
448
-
449
- If promotable entries exist, ask_user:
450
-
451
- - Option 1: "Promote to spec" short coding/arch/test constraint
452
- - Option 2: "Promote to knowhow" — detailed recipe/template/decision/tip
453
- - Option 3: "Promote both" spec index entry + knowhow document
454
- - Option 4: "Skip — nothing to promote"
455
-
456
- **Routing by selection:**
457
-
458
- | Selection | Action |
459
- |-----------|--------|
460
- | Spec | `invoke_skill("spec-add", args)` — guide user through category + content |
461
- | Knowhow | `invoke_skill("manage-knowhow-capture", args)` — guide through type + content |
462
- | Both | `invoke_skill("spec-add")` first, then `invoke_skill("manage-knowhow-capture")` |
463
- | Skip | Proceed to step 4 |
464
-
465
- Update frontmatter: `promoted_specs`, `promoted_knowhow` counts.
466
-
467
- Extract any `todo` entries write to `follow_up` in frontmatter.
468
-
469
- Clear `.workflow/.scratchpad/.companion-active`.
470
-
471
- ### 4. Output accumulation reminder + routing
472
-
473
- ```
474
- Knowledge accumulation reminders:
475
- Reusable pattern found? /spec-add <category> "title" "content" --description "summary"
476
- Solved a complex problem? /manage-knowhow-capture recipe "description"
477
- Made an architecture decision? /manage-knowhow-capture decision "description"
478
- Discovered a useful trick? /manage-knowhow-capture tip "content"
479
-
480
- Next steps:
481
- /maestro-next — recommend next command
482
- /maestro "<intent>" — route intent to full workflow
483
- /manage-status — view project dashboard
484
- ```
485
-
486
- ---
487
-
488
- ## S_ROUTE — Skill Routing
489
-
490
- ### 1. Parse intent
491
-
492
- Extract intent text from $ARGUMENTS after removing the `route` keyword.
493
-
494
- ### 2. Delegate to maestro-next
495
-
496
- ```
497
- invoke_skill("maestro-next", "<intent_text>")
498
- ```
499
-
500
- Reuses maestro-next routing table and scoring logic to recommend the best single command.
501
-
502
- </execution>
503
-
504
- <error_codes>
505
- | Code | Severity | Condition | Recovery |
506
- |------|----------|-----------|----------|
507
- | W001 | warning | `.workflow/specs/` not initialized | Suggest `/spec-setup` |
508
- | W002 | warning | `.workflow/knowhow/` is empty | Normal, skip knowhow index |
509
- | W003 | warning | `.workflow/codebase/` does not exist | Suggest `/manage-codebase-rebuild` |
510
- | W004 | warning | No active companion doc found (note/after mode) | Create new doc or skip |
511
- </error_codes>
512
-
513
- <success_criteria>
514
- - [ ] Mode correctly detected (before/note/after/route)
515
- - [ ] Task type resolved from --type flag or inferred from --task keywords
516
- - [ ] before: spec + knowhow + codebase indexes loaded or hints given
517
- - [ ] before: companion doc created with full YAML frontmatter (identity + context + scope + outcome placeholders)
518
- - [ ] before: type-specific context template written (matching task_type)
519
- - [ ] before: active doc path written to `.companion-active`
520
- - [ ] before: summary card output with mid-task command hints
521
- - [ ] note: active companion doc located and entry appended with type tag
522
- - [ ] note: entry type auto-classified from content signals (11 type tags)
523
- - [ ] note: --file flag updates working_files in frontmatter
524
- - [ ] note: typed entries cross-posted to matching context tables (decisions→Decisions, hypothesis→Hypotheses, etc.)
525
- - [ ] after: companion doc entries reviewed and promotable items identified
526
- - [ ] after: outcome fields populated (files_changed, completed, status)
527
- - [ ] after: ask_user routes to spec-add or manage-knowhow-capture
528
- - [ ] after: todo entries extracted to follow_up field
529
- - [ ] after: companion doc marked completed, active pointer cleared
530
- - [ ] after: accumulation reminder + next-step routing displayed
531
- - [ ] route: intent correctly forwarded to maestro-next
532
- - [ ] No session created, no state.json modified
533
- </success_criteria>
17
+
18
+ <purpose>
19
+ Side-car utility for any task: load knowledge context (before), record structured entries (note),
20
+ promote insights to spec/knowhow (after), or route to next command (route).
21
+ </purpose>
22
+
23
+ <context>
24
+ $ARGUMENTS — mode + optional flags.
25
+
26
+ **Mode detection priority:**
27
+ 1. Explicit `before` / `note` / `after` / `route`
28
+ 2. Intent text that is not a mode keyword → `route`
29
+ 3. No arguments → auto-detect (`git status` has changes → `after`, else → `before`)
30
+
31
+ **Flags:**
32
+ - `--task <description>` — Current task description (for targeted knowledge loading and doc title)
33
+ - `--type <task_type>` — Task type for field template selection (see task types below)
34
+ - `--category <cat>` Spec category filter: coding / arch / test / review / debug / learning / ui
35
+
36
+ **Task types** (determines which recording sections are active):
37
+
38
+ | Type | Description | Key sections |
39
+ |------|-------------|--------------|
40
+ | `implement` | Feature development, code writing | working_files, dependencies, decisions, tests_affected |
41
+ | `debug` | Bug investigation, root cause analysis | symptoms, hypotheses, evidence, root_cause, fix_applied |
42
+ | `analyze` | Code/architecture/performance analysis | scope, findings, risks, recommendations |
43
+ | `design` | Architecture/UI/API design | constraints, alternatives, trade_offs, chosen_approach |
44
+ | `plan` | Task decomposition, roadmap planning | goals, breakdown, estimates, dependencies |
45
+ | `review` | Code review, PR review | files_reviewed, findings, severity_counts, verdict |
46
+ | `test` | Test writing, UAT, coverage expansion | coverage_before, coverage_after, gaps, test_files |
47
+ | `refactor` | Code restructuring, tech debt | affected_modules, before_after, breaking_changes |
48
+ | `learn` | Codebase exploration, knowledge building | questions, answers, mental_model, references |
49
+ | `general` | Default / unclassified | (all universal sections) |
50
+
51
+ Auto-detection: if `--type` not provided, infer from `--task` description keywords.
52
+
53
+ **Companion document:**
54
+ - Path: `.workflow/.scratchpad/companion-{YYYYMMDD-HHmmss}.md`
55
+ - Active doc tracking: `.workflow/.scratchpad/.companion-active` (stores path of current companion doc)
56
+ - Format: YAML frontmatter (rich metadata) + typed sections + timestamped entries
57
+ </context>
58
+
59
+ <state_machine>
60
+
61
+ <states>
62
+ S_PARSE — Parse arguments, detect mode, resolve task type
63
+ S_BEFORE — Load knowledge context, create companion doc with typed template
64
+ S_NOTE — Append structured entry to active companion doc
65
+ S_AFTER — Review companion doc, populate outcome, promote entries, suggest next steps
66
+ S_ROUTE — Skill routing via maestro-next
67
+ </states>
68
+
69
+ <transitions>
70
+
71
+ S_PARSE:
72
+ S_BEFORE WHEN: mode == "before" OR (no args AND no uncommitted changes)
73
+ S_NOTE WHEN: mode == "note"
74
+ S_AFTER WHEN: mode == "after" OR (no args AND has uncommitted changes)
75
+ → S_ROUTE WHEN: mode == "route" OR intent text present
76
+
77
+ </transitions>
78
+
79
+ </state_machine>
80
+
81
+ <execution>
82
+
83
+ ## S_BEFORE Knowledge Loading + Companion Doc Creation
84
+
85
+ Execute in order, skip unavailable steps:
86
+
87
+ ### 1. Load specs
88
+
89
+ ```bash
90
+ # With --category: load by category
91
+ maestro spec load --category <cat>
92
+
93
+ # With --task: load by keyword extracted from task description
94
+ maestro spec load --keyword <extracted_keyword>
95
+
96
+ # No flags: load coding (most universal)
97
+ maestro spec load --category coding
98
+ ```
99
+
100
+ Display loaded rules summary (entry count + key rule names).
101
+
102
+ ### 2. Browse knowhow index
103
+
104
+ ```bash
105
+ # List recent knowhow entries
106
+ maestro knowhow list --store workflow
107
+
108
+ # With --task: search relevant entries
109
+ maestro search --type knowhow "<task_keyword>"
110
+ ```
111
+
112
+ Display available knowhow entries (ID + title). Hint: `maestro wiki load <id>` for details.
113
+
114
+ ### 3. Check codebase index
115
+
116
+ ```bash
117
+ ls .workflow/codebase/doc-index.json
118
+ ```
119
+
120
+ - Exists → display "Codebase docs ready, last updated: {timestamp}"
121
+ - Missing → suggest `/manage-codebase-rebuild`
122
+ - Stale (>7 days) suggest `/quality-sync`
123
+
124
+ ### 4. Create companion document
125
+
126
+ Create `.workflow/.scratchpad/` if needed. Resolve task type from `--type` flag or infer from `--task` keywords.
127
+
128
+ Write companion doc with the full field template:
129
+
130
+ ```markdown
131
+ ---
132
+ # === Identity ===
133
+ task: "{task_description or 'Untitled task'}"
134
+ task_type: "{resolved type: implement|debug|analyze|design|plan|review|test|refactor|learn|general}"
135
+ created: "{ISO timestamp}"
136
+ status: active
137
+
138
+ # === Context Loaded ===
139
+ specs_loaded: "{category or 'coding'}"
140
+ specs_count: {N}
141
+ knowhow_searched: "{keyword or 'none'}"
142
+ knowhow_available: {M}
143
+ codebase_index: "{ready|missing|stale}"
144
+ branch: "{current git branch}"
145
+ phase: "{current phase from state.json or 'none'}"
146
+ milestone: "{current milestone from state.json or 'none'}"
147
+
148
+ # === Scope ===
149
+ working_files: []
150
+ dependencies: []
151
+ related_artifacts: []
152
+
153
+ # === Outcome (populated by after mode) ===
154
+ outcome: ""
155
+ files_changed: []
156
+ promoted_specs: 0
157
+ promoted_knowhow: 0
158
+ follow_up: []
159
+ completed: ""
160
+ ---
161
+
162
+ # Companion Doc — {task_description}
163
+
164
+ > `/maestro-companion note "<content>"` — add entries
165
+ > `/maestro-companion after` — review, promote, close
166
+
167
+ ## Context
168
+
169
+ {Type-specific context section — see templates below}
170
+
171
+ ## Entries
172
+
173
+ ## Summary
174
+ ```
175
+
176
+ **Type-specific context templates** (written into `## Context`):
177
+
178
+ **implement:**
179
+ ```markdown
180
+ ### Working Files
181
+ | File | Role | Status |
182
+ |------|------|--------|
183
+
184
+ ### Dependencies
185
+ - (modules, APIs, or services this task depends on)
186
+
187
+ ### Decisions
188
+ | # | Decision | Rationale | Alternatives Considered |
189
+ |---|----------|-----------|------------------------|
190
+
191
+ ### Tests Affected
192
+ - (test files that need creation or update)
193
+ ```
194
+
195
+ **debug:**
196
+ ```markdown
197
+ ### Symptoms
198
+ - (observable behavior vs expected behavior)
199
+
200
+ ### Hypotheses
201
+ | # | Hypothesis | Status | Evidence |
202
+ |---|-----------|--------|----------|
203
+
204
+ ### Evidence Trail
205
+ | Time | Source | Type | Finding |
206
+ |------|--------|------|---------|
207
+
208
+ ### Root Cause
209
+ - (populated when identified)
210
+
211
+ ### Fix Applied
212
+ - (description of fix, files changed)
213
+ ```
214
+
215
+ **analyze:**
216
+ ```markdown
217
+ ### Scope
218
+ - (what is being analyzed and boundaries)
219
+
220
+ ### Findings
221
+ | # | Finding | Severity | Location |
222
+ |---|---------|----------|----------|
223
+
224
+ ### Risks
225
+ - (identified risks or concerns)
226
+
227
+ ### Recommendations
228
+ - (actionable recommendations)
229
+ ```
230
+
231
+ **design:**
232
+ ```markdown
233
+ ### Constraints
234
+ - (hard limits, requirements, compatibility needs)
235
+
236
+ ### Alternatives
237
+ | # | Approach | Pros | Cons |
238
+ |---|----------|------|------|
239
+
240
+ ### Trade-offs
241
+ - (key trade-off decisions and rationale)
242
+
243
+ ### Chosen Approach
244
+ - (selected design with justification)
245
+ ```
246
+
247
+ **plan:**
248
+ ```markdown
249
+ ### Goals
250
+ - (what success looks like)
251
+
252
+ ### Breakdown
253
+ | # | Task | Estimate | Depends On | Status |
254
+ |---|------|----------|------------|--------|
255
+
256
+ ### Dependencies
257
+ - (external dependencies, blockers, prerequisites)
258
+ ```
259
+
260
+ **review:**
261
+ ```markdown
262
+ ### Files Reviewed
263
+ | File | Lines | Findings |
264
+ |------|-------|----------|
265
+
266
+ ### Findings
267
+ | # | Severity | Category | File:Line | Description |
268
+ |---|----------|----------|-----------|-------------|
269
+
270
+ ### Verdict
271
+ - (pass / pass-with-concerns / fail)
272
+ ```
273
+
274
+ **test:**
275
+ ```markdown
276
+ ### Coverage
277
+ - Before: {%}
278
+ - After: {%}
279
+ - Target: {%}
280
+
281
+ ### Test Files
282
+ | File | Type | Tests Added | Status |
283
+ |------|------|------------|--------|
284
+
285
+ ### Gaps
286
+ - (uncovered paths or scenarios)
287
+ ```
288
+
289
+ **refactor:**
290
+ ```markdown
291
+ ### Affected Modules
292
+ - (modules being restructured)
293
+
294
+ ### Before / After
295
+ | Aspect | Before | After |
296
+ |--------|--------|-------|
297
+
298
+ ### Breaking Changes
299
+ - (API or behavior changes that affect consumers)
300
+ ```
301
+
302
+ **learn:**
303
+ ```markdown
304
+ ### Questions
305
+ | # | Question | Answered | Source |
306
+ |---|----------|----------|--------|
307
+
308
+ ### Mental Model
309
+ - (evolving understanding of how it works)
310
+
311
+ ### References
312
+ - (files, docs, wiki entries consulted)
313
+ ```
314
+
315
+ **general:**
316
+ ```markdown
317
+ ### Notes
318
+ - (general working notes)
319
+ ```
320
+
321
+ Write the companion doc path to `.workflow/.scratchpad/.companion-active`.
322
+
323
+ ### 5. Output summary card
324
+
325
+ ```
326
+ Knowledge context loaded
327
+ Spec: {N} rules ({category})
328
+ Knowhow: {M} entries available
329
+ Codebase: {status}
330
+ Doc: {companion_doc_path} [{task_type}]
331
+
332
+ Mid-task commands:
333
+ /maestro-companion note "finding or decision"
334
+ /maestro-companion note --file src/auth.ts "changed token validation"
335
+ /spec-load --keyword <keyword>
336
+ maestro search "<query>"
337
+ ```
338
+
339
+ ---
340
+
341
+ ## S_NOTE — Append Structured Entry to Companion Doc
342
+
343
+ ### 1. Locate active companion doc
344
+
345
+ Read `.workflow/.scratchpad/.companion-active` to get the doc path.
346
+ If missing or file not found → create a new companion doc (same as S_BEFORE step 4, minimal — no spec/knowhow loading).
347
+
348
+ ### 2. Parse entry content and flags
349
+
350
+ Parse $ARGUMENTS after `note` keyword:
351
+ - `--file <path>` associate entry with a specific file (appended to frontmatter `working_files`)
352
+ - `--severity <level>` — for findings: critical / high / medium / low
353
+ - Remaining text = entry content
354
+
355
+ ### 3. Classify entry type
356
+
357
+ Auto-classify from content signals:
358
+
359
+ | Content signal | Type tag |
360
+ |---------------|----------|
361
+ | "decided/decision/chose/picked/went with" | `decision` |
362
+ | "pattern/convention/rule/always/never/must" | `spec-candidate` |
363
+ | "pitfall/gotcha/careful/warning/trap/beware" | `pitfall` |
364
+ | "learned/realized/discovered/understood/turns out" | `insight` |
365
+ | "hypothesis/suspect/might be/could be" | `hypothesis` |
366
+ | "found bug/root cause/because of/caused by" | `evidence` |
367
+ | "risk/concern/worry/might break" | `risk` |
368
+ | "todo/need to/should also/follow up/remaining" | `todo` |
369
+ | "question/why does/how does/unclear" | `question` |
370
+ | "blocked/stuck/can't/impossible" | `blocker` |
371
+ | Default | `note` |
372
+
373
+ ### 4. Append entry
374
+
375
+ Append to the companion doc under `## Entries`:
376
+
377
+ ```markdown
378
+ ### [{type}] {HH:mm} {first line of content}
379
+
380
+ {full content}
381
+
382
+ {if --file: **File:** `{path}`}
383
+ {if --severity: **Severity:** {level}}
384
+ ```
385
+
386
+ ### 5. Update frontmatter fields
387
+
388
+ - If `--file` provided and not already in `working_files` → append to `working_files`
389
+ - If type is `decision` → also append row to `### Decisions` table (if implement/design type doc)
390
+ - If type is `hypothesis` → also append row to `### Hypotheses` table (if debug type doc)
391
+ - If type is `evidence` → also append row to `### Evidence Trail` table (if debug type doc)
392
+ - If type is `risk` → also append to `### Risks` list (if analyze/design type doc)
393
+ - If type is `question` → also append row to `### Questions` table (if learn type doc)
394
+
395
+ ### 6. Confirm
396
+
397
+ ```
398
+ [{type}] entry added to companion doc
399
+ /maestro-companion note "..." — add more
400
+ /maestro-companion after — review & promote
401
+ ```
402
+
403
+ ---
404
+
405
+ ## S_AFTER — Review Companion Doc + Populate Outcome + Promote Entries + Route
406
+
407
+ ### 1. Load companion doc
408
+
409
+ Read `.workflow/.scratchpad/.companion-active` read the companion doc.
410
+ If no active doc or doc is empty → skip to step 4 (accumulation reminder).
411
+
412
+ ### 2. Populate outcome fields
413
+
414
+ Collect task outcome data:
415
+
416
+ ```bash
417
+ # Detect files changed since companion doc creation
418
+ git diff --name-only --since="{companion_created_timestamp}"
419
+ ```
420
+
421
+ Update frontmatter:
422
+ - `files_changed` from git diff
423
+ - `completed` — current ISO timestamp
424
+ - `status` `completed`
425
+
426
+ Display entry summary:
427
+ ```
428
+ Companion doc review {task_type}
429
+ Entries: {total} ({by type breakdown})
430
+ Files: {files_changed count} changed
431
+ Duration: {elapsed since created}
432
+
433
+ Promotable entries:
434
+ {list of decision/spec-candidate/pitfall/insight entries}
435
+ ```
436
+
437
+ ### 3. Promote entries
438
+
439
+ If promotable entries exist, ask_user:
440
+
441
+ - Option 1: "Promote to spec" — short coding/arch/test constraint
442
+ - Option 2: "Promote to knowhow" — detailed recipe/template/decision/tip
443
+ - Option 3: "Promote both" — spec index entry + knowhow document
444
+ - Option 4: "Skip — nothing to promote"
445
+
446
+ **Routing by selection:**
447
+
448
+ | Selection | Action |
449
+ |-----------|--------|
450
+ | Spec | `invoke_skill("spec-add", args)` — guide user through category + content |
451
+ | Knowhow | `invoke_skill("manage-knowhow-capture", args)`guide through type + content |
452
+ | Both | `invoke_skill("spec-add")` first, then `invoke_skill("manage-knowhow-capture")` |
453
+ | Skip | Proceed to step 4 |
454
+
455
+ Update frontmatter: `promoted_specs`, `promoted_knowhow` counts.
456
+
457
+ Extract any `todo` entries → write to `follow_up` in frontmatter.
458
+
459
+ Clear `.workflow/.scratchpad/.companion-active`.
460
+
461
+ ### 4. Output accumulation reminder + routing
462
+
463
+ ```
464
+ Knowledge accumulation reminders:
465
+ Reusable pattern found? /spec-add <category> "title" "content" --description "summary"
466
+ Solved a complex problem? /manage-knowhow-capture recipe "description"
467
+ Made an architecture decision? /manage-knowhow-capture decision "description"
468
+ Discovered a useful trick? /manage-knowhow-capture tip "content"
469
+
470
+ Next steps:
471
+ /maestro-next — recommend next command
472
+ /maestro "<intent>" — route intent to full workflow
473
+ /manage-status — view project dashboard
474
+ ```
475
+
476
+ ---
477
+
478
+ ## S_ROUTE Skill Routing
479
+
480
+ ### 1. Parse intent
481
+
482
+ Extract intent text from $ARGUMENTS after removing the `route` keyword.
483
+
484
+ ### 2. Delegate to maestro-next
485
+
486
+ ```
487
+ invoke_skill("maestro-next", "<intent_text>")
488
+ ```
489
+
490
+ Reuses maestro-next routing table and scoring logic to recommend the best single command.
491
+
492
+ </execution>
493
+
494
+ <error_codes>
495
+ | Code | Severity | Condition | Recovery |
496
+ |------|----------|-----------|----------|
497
+ | W001 | warning | `.workflow/specs/` not initialized | Suggest `/spec-setup` |
498
+ | W002 | warning | `.workflow/knowhow/` is empty | Normal, skip knowhow index |
499
+ | W003 | warning | `.workflow/codebase/` does not exist | Suggest `/manage-codebase-rebuild` |
500
+ | W004 | warning | No active companion doc found (note/after mode) | Create new doc or skip |
501
+ </error_codes>
502
+
503
+ <success_criteria>
504
+ - [ ] Mode correctly detected (before/note/after/route)
505
+ - [ ] Task type resolved from --type flag or inferred from --task keywords
506
+ - [ ] before: spec + knowhow + codebase indexes loaded or hints given
507
+ - [ ] before: companion doc created with full YAML frontmatter (identity + context + scope + outcome placeholders)
508
+ - [ ] before: type-specific context template written (matching task_type)
509
+ - [ ] before: active doc path written to `.companion-active`
510
+ - [ ] before: summary card output with mid-task command hints
511
+ - [ ] note: active companion doc located and entry appended with type tag
512
+ - [ ] note: entry type auto-classified from content signals (11 type tags)
513
+ - [ ] note: --file flag updates working_files in frontmatter
514
+ - [ ] note: typed entries cross-posted to matching context tables (decisions→Decisions, hypothesis→Hypotheses, etc.)
515
+ - [ ] after: companion doc entries reviewed and promotable items identified
516
+ - [ ] after: outcome fields populated (files_changed, completed, status)
517
+ - [ ] after: ask_user routes to spec-add or manage-knowhow-capture
518
+ - [ ] after: todo entries extracted to follow_up field
519
+ - [ ] after: companion doc marked completed, active pointer cleared
520
+ - [ ] after: accumulation reminder + next-step routing displayed
521
+ - [ ] route: intent correctly forwarded to maestro-next
522
+ - [ ] No session created, no state.json modified
523
+ </success_criteria>
524
+
525
+ <completion>
526
+ ### Next-step routing
527
+ | Condition | Suggestion |
528
+ |-----------|-----------|
529
+ | Reusable pattern found | `/spec-add <category> "title" "content"` |
530
+ | Solved complex problem | `/manage-knowhow-capture recipe "description"` |
531
+ | Architecture decision made | `/manage-knowhow-capture decision "description"` |
532
+ | Want next command recommendation | `/maestro-next` |
533
+ </completion>