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