maestro-flow-one 0.2.2 → 0.2.4

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 (27) hide show
  1. package/maestro-flow/commands/learn/decompose.md +10 -15
  2. package/maestro-flow/commands/learn/follow.md +11 -16
  3. package/maestro-flow/commands/learn/investigate.md +18 -22
  4. package/maestro-flow/commands/learn/retro.md +23 -26
  5. package/maestro-flow/commands/learn/second-opinion.md +11 -16
  6. package/maestro-flow/commands/lifecycle/analyze.md +8 -0
  7. package/maestro-flow/commands/lifecycle/brainstorm.md +8 -0
  8. package/maestro-flow/commands/lifecycle/execute.md +11 -3
  9. package/maestro-flow/commands/lifecycle/learn.md +4 -4
  10. package/maestro-flow/commands/lifecycle/plan.md +8 -0
  11. package/maestro-flow/commands/lifecycle/tools-execute.md +117 -0
  12. package/maestro-flow/commands/lifecycle/tools-register.md +136 -0
  13. package/maestro-flow/commands/lifecycle/ui-codify.md +67 -0
  14. package/maestro-flow/commands/manage/harvest.md +1 -1
  15. package/maestro-flow/commands/manage/learn.md +5 -7
  16. package/maestro-flow/commands/manage/wiki.md +1 -1
  17. package/maestro-flow/commands/milestone/complete.md +6 -6
  18. package/maestro-flow/commands/quality/auto-test.md +1 -1
  19. package/maestro-flow/commands/quality/debug.md +8 -0
  20. package/maestro-flow/commands/quality/retrospective.md +4 -5
  21. package/maestro-flow/commands/quality/review.md +8 -0
  22. package/maestro-flow/commands/spec/add.md +18 -2
  23. package/maestro-flow/commands/spec/load.md +25 -6
  24. package/maestro-flow/commands/spec/setup.md +2 -2
  25. package/maestro-flow/commands/wiki/connect.md +1 -1
  26. package/maestro-flow/commands/wiki/digest.md +5 -6
  27. package/package.json +1 -1
@@ -31,16 +31,15 @@ Arguments: $ARGUMENTS
31
31
  - `--save-wiki` — Create wiki note entries per pattern group via `maestro wiki create --type note`
32
32
 
33
33
  **Storage written:**
34
- - `.workflow/learning/decompose-{slug}-{YYYY-MM-DD}.md` — Pattern decomposition report
35
- - `.workflow/learning/lessons.jsonl` — One insight per discovered pattern (source: "decompose")
36
- - `.workflow/learning/learning-index.json` — Updated index
34
+ - `.workflow/knowhow/KNW-decompose-{slug}-{YYYY-MM-DD}.md` — Pattern decomposition report
35
+ - `.workflow/specs/learnings.md` — One `<spec-entry>` per discovered pattern (source: "decompose")
37
36
  - If `--save-spec`: entries appended to `.workflow/specs/coding-conventions.md`
38
37
  - If `--save-wiki`: new wiki note entries
39
38
 
40
39
  **Storage read:**
41
40
  - Source files at target path
42
41
  - `.workflow/specs/coding-conventions.md` — Existing documented patterns (for dedup)
43
- - `.workflow/learning/lessons.jsonl` — Previously identified patterns (for dedup)
42
+ - `.workflow/specs/learnings.md` — Previously identified patterns (for dedup)
44
43
  </context>
45
44
 
46
45
  <execution>
@@ -53,7 +52,7 @@ Arguments: $ARGUMENTS
53
52
 
54
53
  ### Stage 2: Load Existing Patterns
55
54
  - Read `.workflow/specs/coding-conventions.md` — extract documented patterns
56
- - Search `lessons.jsonl` for entries with `category: "pattern"` — previously discovered
55
+ - Search `specs/learnings.md` for `<spec-entry>` blocks with `roles="implement"` — previously discovered
57
56
  - Build dedup set: pattern names already known
58
57
 
59
58
  ### Stage 3: Parallel Agent Analysis (4 dimensions)
@@ -104,7 +103,7 @@ If `--patterns` specified, instruct agents to focus only on named patterns.
104
103
 
105
104
  ### Stage 4: Cross-Reference & Dedup
106
105
  - Match agent findings against existing pattern set from Stage 2
107
- - Mark each finding: `documented` (already in specs), `known` (in lessons), or `new`
106
+ - Mark each finding: `documented` (already in specs), `known` (in knowhow), or `new`
108
107
  - Flag contradictions: finding conflicts with documented convention
109
108
  - Merge duplicate findings across agents (same pattern found by multiple dimensions)
110
109
 
@@ -134,12 +133,9 @@ Build the decomposition report grouped by dimension:
134
133
  ```
135
134
 
136
135
  ### Stage 6: Persist
137
- 1. Write `.workflow/learning/decompose-{slug}-{date}.md`
138
- 2. Append each **new** pattern to `lessons.jsonl`:
139
- - `source: "decompose"`, `category: "pattern"`, `confidence: <level>`
140
- - Tags: `["decompose", "{dimension}", "{target-slug}"]`
136
+ 1. Write `.workflow/knowhow/KNW-decompose-{slug}-{date}.md`
137
+ 2. Append each **new** pattern as a `<spec-entry>` block to `specs/learnings.md` via `maestro spec add learning --body "<content>" --keywords "decompose,pattern,{dimension},{target-slug}"`:
141
138
  - Stable INS-id from `hash("decompose" + target + pattern_name)`
142
- 3. Update `learning-index.json`
143
139
  4. If `--save-spec`: for each new pattern, invoke `Skill({ skill: "spec-add", args: "pattern {description}" })`
144
140
  5. If `--save-wiki`: create wiki note per dimension group via `maestro wiki create --type note --slug decompose-{dimension}-{slug}`
145
141
  6. Display summary with counts and next steps
@@ -166,11 +162,10 @@ Build the decomposition report grouped by dimension:
166
162
  - [ ] All 4 dimension agents spawned in parallel
167
163
  - [ ] Each finding has: name, dimension, confidence, anchors, description, tradeoffs
168
164
  - [ ] Cross-reference performed (documented / known / new status assigned)
169
- - [ ] Pattern catalog written to `decompose-{slug}-{date}.md`
170
- - [ ] New patterns appended to `lessons.jsonl` with stable INS-ids
171
- - [ ] `learning-index.json` updated
165
+ - [ ] Pattern catalog written to `KNW-decompose-{slug}-{date}.md`
166
+ - [ ] New patterns appended to `specs/learnings.md` as `<spec-entry>` blocks with stable INS-ids
172
167
  - [ ] If --save-spec: spec entries created for new patterns
173
168
  - [ ] If --save-wiki: wiki notes created per dimension group
174
- - [ ] No files modified outside `.workflow/learning/` (and optionally specs/wiki)
169
+ - [ ] No files modified outside `.workflow/knowhow/` (and optionally specs/wiki)
175
170
  - [ ] Summary displayed with pattern counts and next-step routing
176
171
  </success_criteria>
@@ -14,7 +14,7 @@ allowed-tools:
14
14
  <purpose>
15
15
  Guided reading experience for code files, wiki entries, or topics. Instead of just reading code, this command walks through content section by section using forcing questions (inspired by gstack `/office-hours` brainstorming) to extract patterns, identify assumptions, and build a structured understanding map.
16
16
 
17
- Outputs reading notes with extracted patterns, open questions, and connection points. Insights persist to `lessons.jsonl` and optionally become wiki note entries for the knowledge graph.
17
+ Outputs reading notes with extracted patterns, open questions, and connection points. Insights persist to `specs/learnings.md` as `<spec-entry>` blocks and optionally become wiki note entries for the knowledge graph.
18
18
  </purpose>
19
19
 
20
20
  <context>
@@ -31,16 +31,15 @@ Arguments: $ARGUMENTS
31
31
  - `--save-wiki` — Create a wiki note entry with the reading notes via `maestro wiki create --type note`
32
32
 
33
33
  **Storage written:**
34
- - `.workflow/learning/follow-{slug}-{YYYY-MM-DD}.md` — Reading notes with understanding map
35
- - `.workflow/learning/lessons.jsonl` — Appended pattern/technique insights
36
- - `.workflow/learning/learning-index.json` — Updated index
34
+ - `.workflow/knowhow/KNW-follow-{slug}-{YYYY-MM-DD}.md` — Reading notes with understanding map
35
+ - `.workflow/knowhow/specs/learnings.md` — Appended pattern/technique `<spec-entry>` blocks
37
36
  - If `--save-wiki`: new wiki note entry
38
37
 
39
38
  **Storage read:**
40
39
  - Target source file or wiki entry
41
40
  - `maestro wiki backlinks <id>` / `maestro wiki forward <id>` — Relationship context
42
41
  - `.workflow/specs/coding-conventions.md` — Convention reference for pattern matching
43
- - `.workflow/learning/lessons.jsonl` — Prior insights for dedup and cross-reference
42
+ - `.workflow/knowhow/specs/learnings.md` — Prior insights for dedup and cross-reference
44
43
  </context>
45
44
 
46
45
  <execution>
@@ -120,17 +119,14 @@ Build a structured summary document:
120
119
  ## Connections
121
120
  - Links to: {forward link entries}
122
121
  - Referenced by: {backlink entries}
123
- - Related lessons: {matching lessons.jsonl entries}
122
+ - Related insights: {matching specs/learnings.md entries}
124
123
  ```
125
124
 
126
125
  ### Stage 7: Persist
127
- 1. Write `.workflow/learning/follow-{slug}-{date}.md` with the understanding map
128
- 2. Append each new pattern/technique as an insight to `lessons.jsonl`:
129
- - `source: "follow"`, `category: "pattern"` or `"technique"`
130
- - Tags: `["follow", "{target-slug}"]`
126
+ 1. Write `.workflow/knowhow/KNW-follow-{slug}-{date}.md` with the understanding map
127
+ 2. Append each new pattern/technique as a `<spec-entry>` block to `specs/learnings.md` via `maestro spec add learning --body "<content>" --keywords "follow,{target-slug}"`:
131
128
  - Stable INS-id from `hash("follow" + target + pattern_name)`
132
- 3. Update `learning-index.json`
133
- 4. If `--save-wiki`: run `maestro wiki create --type note --slug follow-{slug} --title "Follow-Along: {target}" --body-file .workflow/learning/follow-{slug}-{date}.md`
129
+ 3. If `--save-wiki`: run `maestro wiki create --type note --slug follow-{slug} --title "Follow-Along: {target}" --body-file .workflow/knowhow/KNW-follow-{slug}-{date}.md`
134
130
  5. Display summary with key findings and next steps
135
131
 
136
132
  **Next-step routing:**
@@ -158,10 +154,9 @@ Build a structured summary document:
158
154
  - [ ] Patterns extracted with file:line anchors
159
155
  - [ ] Convention comparison performed against coding-conventions.md
160
156
  - [ ] Understanding map produced with: concepts, patterns, assumptions, questions, connections
161
- - [ ] `follow-{slug}-{date}.md` written
162
- - [ ] `lessons.jsonl` appended with discovered patterns (stable INS-ids)
163
- - [ ] `learning-index.json` updated
157
+ - [ ] `KNW-follow-{slug}-{date}.md` written
158
+ - [ ] `specs/learnings.md` appended with discovered patterns as `<spec-entry>` blocks (stable INS-ids)
164
159
  - [ ] If --save-wiki: wiki note entry created
165
- - [ ] No files modified outside `.workflow/learning/` (and optionally wiki)
160
+ - [ ] No files modified outside `.workflow/knowhow/` (and optionally wiki)
166
161
  - [ ] Summary displayed with next-step routing
167
162
  </success_criteria>
@@ -27,16 +27,15 @@ Arguments: $ARGUMENTS
27
27
  - `--max-hypotheses N` — Maximum hypotheses to test before escalating (default: 3)
28
28
 
29
29
  **Storage written:**
30
- - `.workflow/learning/investigate-{slug}/evidence.ndjson` — Structured evidence log (one JSON line per evidence)
31
- - `.workflow/learning/investigate-{slug}/understanding.md` — Evolving understanding document
32
- - `.workflow/learning/investigate-{slug}/report.md` — Final investigation report
33
- - `.workflow/learning/lessons.jsonl` — Investigation findings as insights (source: "investigate")
34
- - `.workflow/learning/learning-index.json` — Updated index
30
+ - `.workflow/knowhow/KNW-investigate-{slug}/evidence.ndjson` — Structured evidence log (one JSON line per evidence)
31
+ - `.workflow/knowhow/KNW-investigate-{slug}/understanding.md` — Evolving understanding document
32
+ - `.workflow/knowhow/KNW-investigate-{slug}/report.md` — Final investigation report
33
+ - `.workflow/knowhow/specs/learnings.md` — Investigation findings as `<spec-entry>` blocks (source: "investigate")
35
34
 
36
35
  **Storage read:**
37
36
  - Source files within scope
38
37
  - `maestro wiki search "<question>"` — Prior knowledge about the topic
39
- - `.workflow/learning/lessons.jsonl` — Prior related investigations
38
+ - `.workflow/knowhow/specs/learnings.md` — Prior related investigations
40
39
  - `.workflow/specs/debug-notes.md` — Known gotchas and patterns
41
40
  - `.workflow/codebase/architecture.md` — Structural context (if exists)
42
41
  </context>
@@ -47,17 +46,17 @@ Arguments: $ARGUMENTS
47
46
  - Parse question from arguments
48
47
  - Determine scope (--scope or full project)
49
48
  - Generate investigation slug from question keywords
50
- - Create `.workflow/learning/investigate-{slug}/` directory
49
+ - Create `.workflow/knowhow/KNW-investigate-{slug}/` directory
51
50
  - Search prior knowledge:
52
51
  - `maestro wiki search "<question>"` for related entries
53
- - Grep `lessons.jsonl` for related insights
52
+ - Search `specs/learnings.md` for related insights
54
53
  - Read `debug-notes.md` for known gotchas
55
54
 
56
55
  Write initial `understanding.md`:
57
56
  ```markdown
58
57
  # Investigation: {question}
59
58
  ## Initial Understanding
60
- - Prior knowledge: {summary of wiki/lessons findings}
59
+ - Prior knowledge: {summary of wiki/knowhow findings}
61
60
  - Scope: {path or "full project"}
62
61
  - Started: {timestamp}
63
62
  ```
@@ -78,7 +77,7 @@ For each piece of evidence, append to `evidence.ndjson`:
78
77
  ### Stage 3: Pattern Matching
79
78
  Compare collected evidence against known patterns:
80
79
  - Check `debug-notes.md` entries for matching situations
81
- - Check `lessons.jsonl` for related technique/pattern/gotcha entries
80
+ - Check `specs/learnings.md` for related technique/pattern/gotcha entries
82
81
  - Identify: does this match a documented pattern, or is it novel?
83
82
 
84
83
  Update `understanding.md` with pattern analysis section.
@@ -179,12 +178,10 @@ Write final `report.md`:
179
178
  ```
180
179
 
181
180
  ### Stage 8: Persist
182
- 1. Append findings to `lessons.jsonl`:
183
- - Confirmed hypotheses → `category: "technique"` or `"pattern"`
184
- - Disproved hypotheses → `category: "gotcha"` (what looked true but wasn't)
185
- - `source: "investigate"`, tags: `["investigate", "{question-slug}"]`
181
+ 1. Append findings as `<spec-entry>` blocks to `specs/learnings.md` via `maestro spec add learning --body "<content>" --keywords "investigate,{question-slug}"`:
182
+ - Confirmed hypotheses → `roles="implement"` (merge "technique"/"pattern" into keywords)
183
+ - Disproved hypotheses → `roles="analyze"` (merge "gotcha" into keywords)
186
184
  - Stable INS-id from `hash("investigate" + question + finding_title)`
187
- 2. Update `learning-index.json`
188
185
  3. Display summary with answer and next steps
189
186
 
190
187
  **Next-step routing:**
@@ -199,23 +196,22 @@ Write final `report.md`:
199
196
  |------|----------|-----------|----------|
200
197
  | E001 | error | No question provided | Provide a question as the first argument |
201
198
  | E002 | error | Scope path does not exist | Check --scope path is valid |
202
- | W001 | warning | No prior knowledge found in wiki/lessons | Proceed with fresh investigation |
199
+ | W001 | warning | No prior knowledge found in wiki/knowhow | Proceed with fresh investigation |
203
200
  | W002 | warning | Evidence collection found very few matches (<3) | Broaden search terms or expand scope |
204
201
  | W003 | warning | All hypotheses inconclusive — escalating | Investigation marked INCONCLUSIVE |
205
202
  </error_codes>
206
203
 
207
204
  <success_criteria>
208
205
  - [ ] Question parsed and investigation slug generated
209
- - [ ] Investigation directory created under `.workflow/learning/`
210
- - [ ] Prior knowledge loaded from wiki and lessons
206
+ - [ ] Investigation directory created under `.workflow/knowhow/`
207
+ - [ ] Prior knowledge loaded from wiki and knowhow
211
208
  - [ ] Evidence collected and logged to `evidence.ndjson` (structured NDJSON)
212
- - [ ] Pattern matching performed against debug-notes and lessons
209
+ - [ ] Pattern matching performed against debug-notes and knowhow insights
213
210
  - [ ] At least 1 hypothesis formed and tested
214
211
  - [ ] `understanding.md` tracks evolving understanding with timestamps
215
212
  - [ ] `report.md` written with answer, evidence trail, hypothesis results
216
- - [ ] Findings appended to `lessons.jsonl` with stable INS-ids
217
- - [ ] `learning-index.json` updated
213
+ - [ ] Findings appended to `specs/learnings.md` as `<spec-entry>` blocks with stable INS-ids
218
214
  - [ ] 3-strike escalation triggered if all hypotheses fail
219
- - [ ] No files modified outside `.workflow/learning/`
215
+ - [ ] No files modified outside `.workflow/knowhow/`
220
216
  - [ ] Summary displayed with answer and next-step routing
221
217
  </success_criteria>
@@ -18,7 +18,7 @@ Two lenses, usable independently or together:
18
18
  - **git**: Commit metrics, session detection, per-author breakdown, file hotspots, trend tracking
19
19
  - **decision**: Decision tracing across wiki/specs/git, multi-perspective evaluation, lifecycle classification
20
20
 
21
- All insights persist to `.workflow/learning/lessons.jsonl` for cross-session queryability via `manage-learn`.
21
+ All insights persist to `.workflow/knowhow/specs/learnings.md` as `<spec-entry>` blocks for cross-session queryability via `manage-learn`.
22
22
  </purpose>
23
23
 
24
24
  <context>
@@ -38,18 +38,17 @@ Arguments: $ARGUMENTS
38
38
  **Decision lens flags:**
39
39
  - `--phase N` — Decisions from phase N's context and related specs
40
40
  - `--tag <tag>` — Decisions tagged with specific tag in wiki/specs
41
- - `--id <id>` — Single decision by wiki ID or lessons.jsonl INS-id
41
+ - `--id <id>` — Single decision by wiki ID or specs/learnings.md INS-id
42
42
 
43
43
  **Storage written:**
44
- - `.workflow/learning/retro-{YYYY-MM-DD}.md` — Unified human-readable report
45
- - `.workflow/learning/retro-{YYYY-MM-DD}.json` — Structured metrics (machine-readable)
46
- - `.workflow/learning/lessons.jsonl` — Appended insights (source: "retro-git" or "retro-decision")
47
- - `.workflow/learning/learning-index.json` — Updated index
44
+ - `.workflow/knowhow/KNW-retro-{YYYY-MM-DD}.md` — Unified human-readable report
45
+ - `.workflow/knowhow/KNW-retro-{YYYY-MM-DD}.json` — Structured metrics (machine-readable)
46
+ - `.workflow/knowhow/specs/learnings.md` — Appended `<spec-entry>` blocks (source: "retro-git" or "retro-decision")
48
47
 
49
48
  **Storage read:**
50
49
  - `.workflow/state.json` — Current phase context (optional)
51
- - `.workflow/learning/retro-*.json` — Prior retro for trend comparison
52
- - `.workflow/learning/lessons.jsonl` — Existing insights for dedup
50
+ - `.workflow/knowhow/KNW-retro-*.json` — Prior retro for trend comparison
51
+ - `.workflow/knowhow/specs/learnings.md` — Existing insights for dedup
53
52
  - `maestro wiki list --type spec --json` — Spec entries (decision lens)
54
53
  - `.workflow/specs/architecture-constraints.md` — Documented architectural decisions (decision lens)
55
54
  - Phase context with Locked/Free/Deferred decisions (decision lens) — resolve via `state.json.artifacts[]` scratch paths
@@ -60,7 +59,7 @@ Arguments: $ARGUMENTS
60
59
  ### Stage 1: Parse Arguments & Select Lenses
61
60
  - Parse `--lens` flag: `git`, `decision`, or `all` (default: `all`)
62
61
  - Extract lens-specific flags
63
- - Check `.workflow/learning/` exists; bootstrap if missing
62
+ - Check `.workflow/knowhow/` exists; bootstrap if missing
64
63
 
65
64
  Display banner:
66
65
  ```
@@ -121,7 +120,7 @@ For each author:
121
120
  - Session count and patterns
122
121
 
123
122
  #### 2e: Trend Comparison (if --compare or prior report exists)
124
- - Find most recent `.workflow/learning/retro-*.json`
123
+ - Find most recent `.workflow/knowhow/KNW-retro-*.json`
125
124
  - Compute deltas: commits, LOC, test ratio, churn rate, session count
126
125
  - Flag significant changes (>20% delta) as trend highlights
127
126
 
@@ -145,9 +144,9 @@ git log --oneline --all --grep="decision\|chose\|decided\|architecture" -20
145
144
  ```
146
145
 
147
146
  Also read:
148
- - `.workflow/specs/architecture-constraints.md` — grep for `<spec-entry category="arch"` blocks
147
+ - `.workflow/specs/architecture-constraints.md` — grep for `<spec-entry` blocks with `roles="plan"`
149
148
  - Phase context files — resolve via `state.json.artifacts[]` scratch paths — scan for "Locked:", "Deferred:" sections
150
- - `.workflow/learning/lessons.jsonl` — filter `category == "decision"`
149
+ - `.workflow/knowhow/specs/learnings.md` — filter entries with `keywords` containing "decision"
151
150
 
152
151
  Apply scope filter (--phase, --tag, --id).
153
152
 
@@ -157,7 +156,7 @@ Per decision:
157
156
  {
158
157
  "id": "source id",
159
158
  "title": "what was decided",
160
- "source": "wiki|spec|phase-context|lesson|git",
159
+ "source": "wiki|spec|phase-context|knowhow|git",
161
160
  "date": "when decided",
162
161
  "rationale": "why",
163
162
  "alternatives": "what was considered",
@@ -203,7 +202,7 @@ Spawn 3 Agents in a single message:
203
202
 
204
203
  ### Stage 4: Unified Report
205
204
 
206
- Write `.workflow/learning/retro-{date}.md`:
205
+ Write `.workflow/knowhow/KNW-retro-{date}.md`:
207
206
 
208
207
  ```markdown
209
208
  # Retrospective: {date}
@@ -243,17 +242,16 @@ Write `.workflow/learning/retro-{date}.md`:
243
242
  1. {action}: {reason}
244
243
  ```
245
244
 
246
- Write `.workflow/learning/retro-{date}.json` with structured data.
245
+ Write `.workflow/knowhow/KNW-retro-{date}.json` with structured data.
247
246
 
248
247
  ---
249
248
 
250
249
  ### Stage 5: Persist
251
250
  1. Write report files
252
- 2. Append insights to `lessons.jsonl`:
253
- - Git insights: `source: "retro-git"`, `category` per insight type
254
- - Decision insights: `source: "retro-decision"`, `category: "decision"`
251
+ 2. Append insights as `<spec-entry>` blocks to `specs/learnings.md` via `maestro spec add learning --body "<content>" --keywords "<kw>"`:
252
+ - Git insights: source="retro-git", roles per insight type
253
+ - Decision insights: source="retro-decision", roles="plan" (merge "decision" into keywords)
255
254
  - Stable INS-id from `hash(lens + metric_or_decision + date)`
256
- 3. Update `learning-index.json`
257
255
  4. Display summary
258
256
 
259
257
  **Next-step routing:**
@@ -271,8 +269,8 @@ Write `.workflow/learning/retro-{date}.json` with structured data.
271
269
  | E001 | error | Not inside a git repository (git lens) | Navigate to a git repo directory |
272
270
  | E002 | error | No commits found in time window (git lens) | Increase --days or check filters |
273
271
  | E003 | error | No decisions found in any source (decision lens) | Check wiki/specs content, or provide --id |
274
- | E004 | error | --id not found in wiki or lessons (decision lens) | Verify the decision ID exists |
275
- | W001 | warning | `.workflow/learning/` not found, bootstrapping | Auto-created; proceed normally |
272
+ | E004 | error | --id not found in wiki or knowhow (decision lens) | Verify the decision ID exists |
273
+ | W001 | warning | `.workflow/knowhow/` not found, bootstrapping | Auto-created; proceed normally |
276
274
  | W002 | warning | No prior retro report for comparison | Skip trend section; first retro establishes baseline |
277
275
  | W003 | warning | One perspective agent failed — partial evaluation (decision lens) | Proceed with available perspectives |
278
276
  | W004 | warning | No git implementation evidence for a decision | Evaluation is theoretical only |
@@ -294,10 +292,9 @@ Write `.workflow/learning/retro-{date}.json` with structured data.
294
292
  - [ ] 3 perspective agents spawned in parallel
295
293
  - [ ] Each decision classified by lifecycle status
296
294
  - [ ] Recommendations generated for non-Validated decisions
297
- - [ ] Unified report written to `retro-{date}.md`
298
- - [ ] Structured data written to `retro-{date}.json`
299
- - [ ] `lessons.jsonl` appended with insights (stable INS-ids)
300
- - [ ] `learning-index.json` updated
301
- - [ ] No files modified outside `.workflow/learning/`
295
+ - [ ] Unified report written to `KNW-retro-{date}.md`
296
+ - [ ] Structured data written to `KNW-retro-{date}.json`
297
+ - [ ] `specs/learnings.md` appended with `<spec-entry>` blocks (stable INS-ids)
298
+ - [ ] No files modified outside `.workflow/knowhow/`
302
299
  - [ ] Summary displayed with next-step routing
303
300
  </success_criteria>
@@ -18,7 +18,7 @@ Structured second-opinion workflow for code, decisions, or plans. Three modes in
18
18
  - **challenge**: single adversarial agent that tries to break the approach, find hidden assumptions, and propose alternatives
19
19
  - **consult**: interactive Q&A mode where the agent studies the target and answers your questions
20
20
 
21
- Decoupled from the phase/execution lifecycle — can be invoked on any piece of code or knowledge at any time. Findings persist to `lessons.jsonl`.
21
+ Decoupled from the phase/execution lifecycle — can be invoked on any piece of code or knowledge at any time. Findings persist to `specs/learnings.md` as `<spec-entry>` blocks.
22
22
  </purpose>
23
23
 
24
24
  <context>
@@ -36,15 +36,14 @@ Arguments: $ARGUMENTS
36
36
  - `--mode consult` — Interactive Q&A session
37
37
 
38
38
  **Storage written:**
39
- - `.workflow/learning/opinion-{slug}-{YYYY-MM-DD}.md` — Opinion report
40
- - `.workflow/learning/lessons.jsonl` — New insights from analysis (source: "second-opinion")
41
- - `.workflow/learning/learning-index.json` — Updated index
39
+ - `.workflow/knowhow/KNW-opinion-{slug}-{YYYY-MM-DD}.md` — Opinion report
40
+ - `.workflow/knowhow/specs/learnings.md` — New `<spec-entry>` blocks from analysis (source: "second-opinion")
42
41
 
43
42
  **Storage read:**
44
43
  - Target content (file, wiki entry, diff, or plan)
45
44
  - `.workflow/specs/` — Project conventions for context
46
45
  - `maestro wiki search` — Related knowledge entries
47
- - `.workflow/learning/lessons.jsonl` — Prior insights about the topic
46
+ - `.workflow/knowhow/specs/learnings.md` — Prior insights about the topic
48
47
  </context>
49
48
 
50
49
  <execution>
@@ -60,7 +59,7 @@ Arguments: $ARGUMENTS
60
59
  ### Stage 2: Load Context
61
60
  - Read relevant specs: `Skill({ skill: "spec-load" })` silently to get project conventions
62
61
  - Search wiki: `maestro wiki search "<target topic>"` for related entries (top 5)
63
- - Search lessons: grep `lessons.jsonl` for entries related to the target area
62
+ - Search insights: search `specs/learnings.md` for entries related to the target area
64
63
  - Build context brief: target content + conventions + related knowledge
65
64
 
66
65
  ### Stage 3: Execute Mode
@@ -124,15 +123,12 @@ Across all perspectives (or from single agent in challenge/consult):
124
123
  - **Top 3 recommendations**: prioritized by impact
125
124
 
126
125
  ### Stage 5: Persist & Report
127
- 1. Write `.workflow/learning/opinion-{slug}-{date}.md`:
126
+ 1. Write `.workflow/knowhow/KNW-opinion-{slug}-{date}.md`:
128
127
  - Target summary
129
128
  - Per-persona findings (review) / adversarial analysis (challenge) / Q&A transcript (consult)
130
129
  - Synthesis: agreements, disagreements, verdict
131
130
  - Recommendations
132
- 2. Append non-trivial findings to `lessons.jsonl`:
133
- - `source: "second-opinion"`, `category: "pattern"` or `"antipattern"` or `"decision"`
134
- - Tags: `["second-opinion", "{mode}", "{target-slug}"]`
135
- 3. Update `learning-index.json`
131
+ 2. Append non-trivial findings as `<spec-entry>` blocks to `specs/learnings.md` via `maestro spec add learning --body "<content>" --keywords "second-opinion,{mode},{target-slug}"`
136
132
  4. Display summary with verdict and recommendations
137
133
 
138
134
  **Next-step routing:**
@@ -153,15 +149,14 @@ Across all perspectives (or from single agent in challenge/consult):
153
149
 
154
150
  <success_criteria>
155
151
  - [ ] Target resolved and content loaded
156
- - [ ] Context gathered (specs, wiki, lessons)
152
+ - [ ] Context gathered (specs, wiki, knowhow)
157
153
  - [ ] Mode executed correctly:
158
154
  - review: 3 agents spawned in parallel, all returned findings
159
155
  - challenge: adversarial analysis completed with forcing questions
160
156
  - consult: interactive Q&A loop completed
161
157
  - [ ] Synthesis produced with agreements, disagreements, verdict
162
- - [ ] Report written to `opinion-{slug}-{date}.md`
163
- - [ ] Non-trivial findings appended to `lessons.jsonl`
164
- - [ ] `learning-index.json` updated
165
- - [ ] No files modified outside `.workflow/learning/`
158
+ - [ ] Report written to `KNW-opinion-{slug}-{date}.md`
159
+ - [ ] Non-trivial findings appended to `specs/learnings.md` as `<spec-entry>` blocks
160
+ - [ ] No files modified outside `.workflow/knowhow/`
166
161
  - [ ] Summary displayed with verdict and next-step routing
167
162
  </success_criteria>
@@ -41,6 +41,14 @@ $ARGUMENTS -- phase number for milestone-scoped, topic text for adhoc/standalone
41
41
  - `--gaps [ISS-ID]`: Issue root cause analysis mode. If ISS-ID provided, analyze single issue. If omitted, analyze all open/registered issues from issues.jsonl.
42
42
 
43
43
  Scope routing, output directory format, artifact registration schema, and output artifact listing are defined in workflow analyze.md (Scope Routing and Output Structure sections).
44
+
45
+ ### Role Knowledge
46
+ 1. Browse accumulated knowledge for this role:
47
+ `maestro wiki list --category debug`
48
+ 2. Analyze the index, identify entries relevant to the current task
49
+ 3. Load selected documents:
50
+ `maestro wiki load <id1> [id2] [id3...]`
51
+ 4. Review loaded knowledge before proceeding
44
52
  </context>
45
53
 
46
54
  <execution>
@@ -44,6 +44,14 @@ $ARGUMENTS -- topic text for auto mode, or role name for single role mode.
44
44
  - `--skip-questions`: Skip context gathering questions
45
45
  - `--include-questions`: Force context gathering even if analysis exists
46
46
  - `--style-skill PKG`: Style package for ui-designer role
47
+
48
+ ### Role Knowledge
49
+ 1. Browse accumulated knowledge for this role:
50
+ `maestro wiki list --category arch`
51
+ 2. Analyze the index, identify entries relevant to the current task
52
+ 3. Load selected documents:
53
+ `maestro wiki load <id1> [id2] [id3...]`
54
+ 4. Review loaded knowledge before proceeding
47
55
  </context>
48
56
 
49
57
  <execution>
@@ -30,13 +30,21 @@ Invoked after /maestro-plan produces a confirmed plan. When called without args
30
30
  <context>
31
31
  $ARGUMENTS — phase number, or no args for milestone-wide execution, with optional flags.
32
32
 
33
- Scope routing, flags, resolution logic, output directory format, artifact registration schema, and incremental learning extraction are defined in workflow `execute.md`.
33
+ Scope routing, flags, resolution logic, output directory format, artifact registration schema, and incremental knowhow extraction are defined in workflow `execute.md`.
34
34
 
35
35
  ### Pre-load context (before task execution)
36
36
 
37
37
  1. **Codebase docs**: If `.workflow/codebase/doc-index.json` exists, read `ARCHITECTURE.md` for module boundaries. Pass as shared context to executor agents.
38
38
  2. **Wiki knowledge**: Run `maestro wiki search "<phase keywords>" --json 2>/dev/null`. If results found, extract top 5 entries as prior knowledge context for agents.
39
39
  3. Both are optional — proceed without if unavailable (log warning).
40
+
41
+ ### Role Knowledge
42
+ 1. Browse accumulated knowledge for this role:
43
+ `maestro wiki list --category coding`
44
+ 2. Analyze the index, identify entries relevant to the current task
45
+ 3. Load selected documents:
46
+ `maestro wiki load <id1> [id2] [id3...]`
47
+ 4. Review loaded knowledge before proceeding
40
48
  </context>
41
49
 
42
50
  <execution>
@@ -61,7 +69,7 @@ After each task completes, evaluate inquiry triggers:
61
69
  → Ask: "TASK-{NNN} succeeded after {N} retries. Should this fix pattern be documented? (`/spec-add debug`)"
62
70
 
63
71
  3. **Implicit knowledge**: If task summary contains design rationale ("chose X because", "rejected Y due to"):
64
- → Ask: "Design decision detected. Should it be recorded as a learning? (`/spec-add learning`)"
72
+ → Ask: "Design decision detected. Should it be recorded as knowhow? (`/spec-add learning`)"
65
73
 
66
74
  If user confirms, invoke `Skill({ skill: "spec-add", args: "<category> <content>" })` with extracted content.
67
75
 
@@ -115,6 +123,6 @@ If failed tasks exist, suggest /quality-debug for investigation.
115
123
  - [ ] `.summaries/TASK-{NNN}-summary.md` written for each completed task
116
124
  - [ ] `.task/TASK-{NNN}.json` statuses updated (completed|blocked)
117
125
  - [ ] EXC artifact registered in state.json for each plan executed
118
- - [ ] Incremental learnings extracted to specs/learnings.md
126
+ - [ ] Incremental knowhow extracted to specs/learnings.md
119
127
  - [ ] state.json updated with execution progress
120
128
  </success_criteria>
@@ -46,8 +46,8 @@ $ARGUMENTS — user learning intent text, or flags.
46
46
  | `pattern-catalog` | decompose --save-spec --save-wiki → second-opinion --mode review | Full pattern extraction + review |
47
47
 
48
48
  **Storage:**
49
- - `.workflow/learning/.maestro-learn/{session_id}/status.json` — Session tracking
50
- - All learn command outputs go to `.workflow/learning/`
49
+ - `.workflow/knowhow/.maestro-learn/{session_id}/status.json` — Session tracking
50
+ - All learn command outputs go to `.workflow/knowhow/`
51
51
  </context>
52
52
 
53
53
  <execution>
@@ -108,7 +108,7 @@ pattern-catalog → [learn-decompose --save-spec --save-wiki, learn-second-opini
108
108
  **If not `-y`:** show plan, ask for confirmation.
109
109
 
110
110
  **Execute:**
111
- 1. Create session dir: `.workflow/learning/.maestro-learn/learn-{timestamp}/`
111
+ 1. Create session dir: `.workflow/knowhow/.maestro-learn/learn-{timestamp}/`
112
112
  2. Write `status.json` with chain steps
113
113
  3. Execute each step via `Skill()`:
114
114
  - On success: mark completed, continue
@@ -136,5 +136,5 @@ pattern-catalog → [learn-decompose --save-spec --save-wiki, learn-second-opini
136
136
  - [ ] All chain steps executed via Skill()
137
137
  - [ ] Error handling: retry/skip/abort per step
138
138
  - [ ] Session summary displayed with next-step routing
139
- - [ ] No files modified outside `.workflow/learning/`
139
+ - [ ] No files modified outside `.workflow/knowhow/`
140
140
  </success_criteria>
@@ -45,6 +45,14 @@ Scope routing, base flags (`--collab`, `--spec`, `-y`, `--gaps`, `--dir`), outpu
45
45
  **Upstream context:**
46
46
  - Reads `context.md` from prior analyze artifact (auto-discovered from state.json or via --dir)
47
47
  - Reads `conclusions.json` if available (implementation_scope seeds task generation)
48
+
49
+ ### Role Knowledge
50
+ 1. Browse accumulated knowledge for this role:
51
+ `maestro wiki list --category arch`
52
+ 2. Analyze the index, identify entries relevant to the current task
53
+ 3. Load selected documents:
54
+ `maestro wiki load <id1> [id2] [id3...]`
55
+ 4. Review loaded knowledge before proceeding
48
56
  </context>
49
57
 
50
58
  <execution>
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: maestro-tools-execute
3
+ description: Load and execute tool specs by category or name
4
+ argument-hint: "[tool-name | --category <category>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - AskUserQuestion
13
+ - Agent
14
+ ---
15
+ <purpose>
16
+ Load registered tool documents and execute them step-by-step. Two invocation modes:
17
+
18
+ 1. **Direct** — Specify tool name, load full steps, execute sequentially
19
+ 2. **Category-based** — List available tools for a category, user selects, then execute
20
+
21
+ Execution follows the tool definition steps in order, reporting progress per step and asking user on blockers.
22
+ </purpose>
23
+
24
+ <required_reading>
25
+ @~/.maestro/workflows/tools-spec.md
26
+ </required_reading>
27
+
28
+ <context>
29
+ $ARGUMENTS — Tool name, keyword, or --category filter
30
+
31
+ **Examples**:
32
+ ```
33
+ /maestro-tools-execute integration-test
34
+ /maestro-tools-execute --category coding
35
+ /maestro-tools-execute --category review --keyword api
36
+ /maestro-tools-execute
37
+ ```
38
+
39
+ Empty arguments enters interactive mode: list all tools for user selection.
40
+ </context>
41
+
42
+ <execution>
43
+
44
+ ### Step 1: Load Tool
45
+
46
+ **By name**:
47
+ ```bash
48
+ maestro spec load --category coding --keyword <name>
49
+ ```
50
+ Match knowhow documents with `tool: true` whose title or keywords contain the name.
51
+
52
+ **By category**:
53
+ ```bash
54
+ maestro spec load --category <category>
55
+ ```
56
+ Extract tool entries from the "Available Tools" section in output.
57
+
58
+ **Empty args**:
59
+ Load all categories, collect tool entries, present to user with AskUserQuestion for selection.
60
+
61
+ ### Step 2: Display Tool
62
+
63
+ Show tool information:
64
+ - Name, category, keywords
65
+ - Steps overview (for ref entries, expand knowhow detail first)
66
+
67
+ Expand ref entries:
68
+ ```bash
69
+ maestro wiki load <knowhow-id>
70
+ ```
71
+
72
+ ### Step 3: Confirm Execution
73
+
74
+ Ask user:
75
+ - Execute steps as-is?
76
+ - Adjust parameters/scope?
77
+ - View only, do not execute?
78
+
79
+ ### Step 4: Step-by-Step Execution
80
+
81
+ Follow the tool definition steps in order:
82
+ 1. Read current step description
83
+ 2. Execute step action (file ops, commands, code changes, etc.)
84
+ 3. Verify step completion
85
+ 4. Report progress: `[Step N/M] done — <step_name>`
86
+ 5. Proceed to next step
87
+
88
+ **Blocker handling**:
89
+ - Step fails → report error, ask user: retry / skip / abort
90
+ - Needs user input → AskUserQuestion for parameters
91
+ - Prerequisites unmet → show missing items, ask how to proceed
92
+
93
+ ### Step 5: Report Results
94
+
95
+ After completion, output:
96
+ - Completed steps list
97
+ - Skipped/failed steps (if any)
98
+ - Artifacts produced (generated files, test results, etc.)
99
+ - Suggested next actions
100
+
101
+ </execution>
102
+
103
+ <error_codes>
104
+ | Code | Severity | Description |
105
+ |------|----------|-------------|
106
+ | E001 | fatal | No matching tool found — check name/keyword |
107
+ | E002 | warning | Multiple tools match — list options for user selection |
108
+ | E003 | warning | Step execution failed — ask user how to proceed |
109
+ </error_codes>
110
+
111
+ <success_criteria>
112
+ - [ ] Tool correctly loaded (ref expanded if applicable)
113
+ - [ ] User confirmed before execution starts
114
+ - [ ] Each step has progress feedback
115
+ - [ ] Blockers handled interactively
116
+ - [ ] Results reported clearly
117
+ </success_criteria>
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: maestro-tools-register
3
+ description: Register tool specs - extract, generate, or optimize
4
+ argument-hint: "[description]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - AskUserQuestion
13
+ - Agent
14
+ ---
15
+ <purpose>
16
+ Codify reusable business processes as knowhow documents with `tool: true` in `.workflow/knowhow/`. Once registered, tools are auto-discovered by `spec load --category` and spec-injector — plan agents pick up design/architecture flows, test agents pick up verification methods, implement agents pick up execution steps.
17
+
18
+ When to register: during planning to standardize a business process (e.g. payment reconciliation, OAuth integration steps); after execution to capture a validated procedure (e.g. database migration rollback); before testing to register verification methods for test agents (e.g. E2E checkout flow, API idempotency verification); during retrospective/harvest to extract reusable process knowledge from artifacts.
19
+
20
+ Three modes: Extract (from code/docs), Generate (from description), Optimize (improve existing).
21
+ Short processes (<10 steps) inline; long processes (>=10 steps) use ref mode with knowhow detail doc.
22
+ </purpose>
23
+
24
+ <required_reading>
25
+ @~/.maestro/workflows/tools-spec.md
26
+ </required_reading>
27
+
28
+ <context>
29
+ $ARGUMENTS — Intent description
30
+
31
+ **Examples**:
32
+ ```
33
+ /maestro-tools-register extract OAuth PKCE token exchange flow from src/auth/
34
+ /maestro-tools-register generate Stripe webhook idempotency verification
35
+ /maestro-tools-register generate E2E checkout flow with payment gateway mock setup
36
+ /maestro-tools-register optimize e2e-checkout tool
37
+ ```
38
+ </context>
39
+
40
+ <execution>
41
+
42
+ ### Step 1: Intent Detection
43
+
44
+ Parse $ARGUMENTS to determine mode:
45
+ - Contains "extract" → extract mode
46
+ - Contains "optimize/improve" → optimize mode
47
+ - Other → generate mode
48
+ - Empty → ask user with AskUserQuestion
49
+
50
+ ### Step 2: Gather Information
51
+
52
+ **Extract mode**:
53
+ - Identify source (current conversation, specified files, codebase scan)
54
+ - Extract step sequence, prerequisites, expected outputs
55
+
56
+ **Generate mode**:
57
+ - Confirm tool name, applicable roles, target scenario
58
+ - If unclear, ask user with AskUserQuestion
59
+
60
+ **Optimize mode**:
61
+ - Load existing tool: `maestro spec load --category coding --keyword <name>`
62
+ - Analyze improvement points (step splitting, prerequisites, error handling)
63
+
64
+ **For all modes** — identify the usage timing: when should an agent or user invoke this tool? This becomes the first line of the entry description (see Step 5).
65
+
66
+ ### Step 3: Determine Category
67
+
68
+ Infer applicable category from context, or ask user:
69
+ - coding — execution tools (build, deploy, integrate)
70
+ - test — testing tools (test flows, verification steps)
71
+ - review — review tools (checklists, audit standards)
72
+ - arch — planning tools (design flows, analysis steps)
73
+ - debug — analysis tools (diagnostic flows, investigation steps)
74
+
75
+ ### Step 4: Decide Inline vs Ref
76
+
77
+ - Steps <10 and no code blocks → **inline mode**
78
+ - Steps >=10 or contains code examples/config → **ref mode**
79
+
80
+ ### Step 5: Write
81
+
82
+ **Description format**: First line after `### Title` must state **when to use** this tool (the usage timing from Step 2). This is critical for ref entries — `spec load` only shows the first 200 chars after the heading as the summary.
83
+
84
+ ```
85
+ ### {Title}
86
+
87
+ Use when {timing/trigger condition}.
88
+
89
+ 1. Step one ...
90
+ ```
91
+
92
+ **Create knowhow tool document** in `.workflow/knowhow/` with `tool: true` in YAML frontmatter:
93
+ ```yaml
94
+ ---
95
+ title: <Title>
96
+ type: recipe
97
+ category: <category>
98
+ keywords: [<keywords>]
99
+ tool: true
100
+ summary: "Use when <timing>. <scope description>"
101
+ ---
102
+
103
+ ## Steps
104
+ 1. Step one ...
105
+ ```
106
+
107
+ **Optionally register spec ref entry** for index discoverability:
108
+ ```bash
109
+ maestro spec add <category> "<title>" "Use when <timing>. <scope summary>" --keywords "<csv>" \
110
+ --ref "knowhow/RCP-<slug>.md" --knowhow-type recipe
111
+ ```
112
+
113
+ ### Step 6: Verify
114
+
115
+ - `maestro spec load --category <category> --keyword <keyword>` to confirm loadable
116
+ - Display result: title, category, keywords, storage location
117
+
118
+ </execution>
119
+
120
+ <error_codes>
121
+ | Code | Severity | Description |
122
+ |------|----------|-------------|
123
+ | E001 | fatal | `.workflow/specs/` does not exist — run `maestro spec init` |
124
+ | E002 | warning | Duplicate tool name detected — confirm overwrite/optimize |
125
+ | E003 | fatal | category parameter empty — tools must declare a category |
126
+ </error_codes>
127
+
128
+ <success_criteria>
129
+ - [ ] Tool registered as knowhow document with `tool: true` frontmatter
130
+ - [ ] category correctly set
131
+ - [ ] keywords auto-extracted (3-5 terms)
132
+ - [ ] Description starts with "Use when ..." (usage timing)
133
+ - [ ] Loadable via `spec load --category <category>`
134
+ - [ ] Long processes use ref mode with knowhow file created
135
+ - [ ] Ref knowhow YAML includes `summary` with usage timing
136
+ </success_criteria>
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: maestro-ui-codify
3
+ description: Extract design system from code, generate reference package, persist as knowledge assets
4
+ argument-hint: "<source-path> [--package-name <name>] [--output-dir <path>] [--overwrite]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - Skill
14
+ ---
15
+ <purpose>
16
+ Codify UI design system from existing source code. 4-phase pipeline:
17
+
18
+ 1. **Validate** (inline): Parameter validation, workspace setup, file discovery
19
+ 2. **Extract** (3 parallel agents): Style Agent + Animation Agent + Layout Agent produce design-tokens.json, animation-tokens.json, layout-templates.json
20
+ 3. **Package** (agent): Copy tokens to package directory, generate preview.html + preview.css
21
+ 4. **Knowhow** (manifest + skill): Build knowhow-manifest.json, call codify-to-knowhow to persist as knowledge assets
22
+
23
+ Position in pipeline: code -> **ui-codify** -> knowhow + specs
24
+ </purpose>
25
+
26
+ <deferred_reading>
27
+ - [ui-codify.md](~/.maestro/workflows/ui-codify.md) — read always (main workflow orchestrator)
28
+ - [ui-codify-extract.md](~/.maestro/workflows/ui-codify-extract.md) — read when Phase 2 starts (style extraction with 3 agents)
29
+ - [ui-codify-package.md](~/.maestro/workflows/ui-codify-package.md) — read when Phase 3 starts (reference package generation)
30
+ - [ui-codify-knowhow.md](~/.maestro/workflows/ui-codify-knowhow.md) — read when Phase 4 starts (knowledge asset generation)
31
+ </deferred_reading>
32
+
33
+ <context>
34
+ $ARGUMENTS — source path (required) with optional flags.
35
+
36
+ Flags:
37
+ - `<source-path>` (positional, required): Directory containing CSS/SCSS/JS/TS/HTML source files
38
+ - `--package-name <name>`: Package name for reference output (default: auto-generated from source directory)
39
+ - `--output-dir <path>`: Output directory for reference package (default: `.workflow/reference_style`)
40
+ - `--overwrite`: Allow overwriting existing package directory
41
+ </context>
42
+
43
+ <execution>
44
+ Route to `~/.maestro/workflows/ui-codify.md` and follow completely.
45
+
46
+ The workflow orchestrates 4 phases with deferred loading of phase-specific workflow files. Each phase reads its workflow file only when execution reaches that phase.
47
+ </execution>
48
+
49
+ <error_codes>
50
+ | Code | Severity | Description | Stage |
51
+ |------|----------|-------------|-------|
52
+ | E001 | error | Source path argument required | parse_input |
53
+ | E002 | error | Source path not found or not a directory | validate |
54
+ | E003 | error | Package directory exists without --overwrite flag | validate |
55
+ | W001 | warning | animation-tokens.json not found (optional, extraction continues) | extract |
56
+ </error_codes>
57
+
58
+ <success_criteria>
59
+ - [ ] Source path validated and file discovery completed
60
+ - [ ] design-tokens.json generated with color, typography, spacing tokens
61
+ - [ ] layout-templates.json generated with component patterns (universal/specialized)
62
+ - [ ] animation-tokens.json generated (optional, W001 if missing)
63
+ - [ ] preview.html + preview.css generated as interactive showcase
64
+ - [ ] knowhow-manifest.json created with AST/DCS assets and spec entries
65
+ - [ ] codify-to-knowhow called and completed successfully
66
+ - [ ] Temporary workspace cleaned up
67
+ </success_criteria>
@@ -54,7 +54,7 @@ Extraction patterns, classification rules, routing infrastructure, and fragment
54
54
  - Review wiki entries → `maestro wiki list --type note`
55
55
  - Connect wiki graph → `/wiki-connect --fix`
56
56
  - Triage issues → `/manage-issue list --source harvest`
57
- - View specs → `/spec-load --category learning`
57
+ - View specs → `/spec-load --role implement`
58
58
  - Full retrospective → `/quality-retrospective`
59
59
  </execution>
60
60
 
@@ -16,7 +16,7 @@ Unified atomic knowledge capture for the workflow learning library. Captures two
16
16
  - **Insights**: Timeless "eureka moment" entries (patterns, gotchas, techniques) — the default mode
17
17
  - **Tips**: Quick contextual notes for cross-session recovery (formerly in `manage-knowhow-capture tip`)
18
18
 
19
- Both types are stored in `.workflow/learning/lessons.jsonl` with auto-detected phase linkage and keyword-based category inference. Tips are distinguished by `source: "tip"` and implicitly tagged `tip`. Same store as retrospective output, so search and list see the entire knowledge corpus.
19
+ Both types are stored in `.workflow/specs/learnings.md` as `<spec-entry>` blocks with auto-detected phase linkage and keyword-based category inference. Tips are distinguished by `source: "tip"` and implicitly tagged `tip`. Same store as retrospective output, so search and list see the entire knowledge corpus.
20
20
  </purpose>
21
21
 
22
22
  <required_reading>
@@ -30,7 +30,7 @@ Arguments: $ARGUMENTS
30
30
  - `"<insight text>"` (or any non-keyword text) → insight capture mode
31
31
  - `tip <text>` → tip capture mode (quick contextual note, auto-tagged `tip`)
32
32
  - `list` → list recent entries (default 20)
33
- - `search <query>` → text search across lessons.jsonl
33
+ - `search <query>` → `maestro spec load --category learning` or text search across `specs/learnings.md`
34
34
  - `show <INS-id>` → full detail with phase context
35
35
  - empty → AskUserQuestion to prompt for text
36
36
 
@@ -47,21 +47,19 @@ Follow `~/.maestro/workflows/learn.md` Stages 1–5 in order.
47
47
  | E001 | error | `.workflow/` not initialized — run `/maestro-init` first | parse_input |
48
48
  | E002 | error | Unknown `--category` value (allowed: pattern, antipattern, decision, tool, gotcha, technique, tip) | parse_input |
49
49
  | E003 | error | `show` mode requires an INS-id argument | show |
50
- | E004 | error | Insight id not found in lessons.jsonl | show |
50
+ | E004 | error | Insight id not found in `specs/learnings.md` | show |
51
51
  | W001 | warning | Auto-phase detection found a current_phase but no matching artifact in registry; phase set to null | capture |
52
- | W002 | warning | learning-index.json out of sync with lessons.jsonl (different row count); offer to rebuild | list/search |
53
52
  </error_codes>
54
53
 
55
54
  <success_criteria>
56
55
  - [ ] Mode correctly routed (capture / list / search / show)
57
- - [ ] Capture: `lessons.jsonl` row appended with valid JSON and all required fields
58
- - [ ] Capture: `learning-index.json` updated with matching entry
56
+ - [ ] Capture: `<spec-entry>` block appended to `specs/learnings.md` with all required fields
59
57
  - [ ] Capture: phase auto-link resolves correctly via artifact registry when `state.json` has `current_phase`
60
58
  - [ ] Capture: category inference produces a sensible default when `--category` absent
61
59
  - [ ] List: filters apply, output sorted newest-first, default limit 20
62
60
  - [ ] Search: results ranked by title (3) > tags (2) > summary (1) match
63
61
  - [ ] Show: full insight displayed with phase context and routed-artifact link if any
64
- - [ ] No file modifications outside `.workflow/learning/`
62
+ - [ ] No file modifications outside `.workflow/knowhow/`
65
63
  - [ ] Confirmation banner displayed with INS-id and next-step hints
66
64
  - [ ] Next step: `/manage-learn list` to browse, or `/manage-learn search <query>` to find related insights
67
65
  </success_criteria>
@@ -34,7 +34,7 @@ $ARGUMENTS — subcommand and optional flags.
34
34
  | No args | Same as `health` |
35
35
 
36
36
  **Flags:**
37
- - `--type <type>` — Filter by wiki type: spec, knowhow, note, lesson, issue
37
+ - `--type <type>` — Filter by wiki type: spec, knowhow, note, issue
38
38
  - `--fix` — Auto-fix issues found during cleanup (remove broken links, suggest connections)
39
39
  - `--json` — Output in JSON format
40
40
  </context>
@@ -13,7 +13,7 @@ allowed-tools:
13
13
  ---
14
14
 
15
15
  <purpose>
16
- Mark a milestone as complete after its audit has passed. Archives all scratch artifacts to `milestones/{M}/artifacts/`, moves artifact entries from `state.json.artifacts[]` to `milestone_history`, extracts final learnings, and advances to the next milestone.
16
+ Mark a milestone as complete after its audit has passed. Archives all scratch artifacts to `milestones/{M}/artifacts/`, moves artifact entries from `state.json.artifacts[]` to `milestone_history`, extracts final knowhow, and advances to the next milestone.
17
17
  </purpose>
18
18
 
19
19
  <required_reading>
@@ -34,14 +34,14 @@ Milestone: $ARGUMENTS (optional -- defaults to current_milestone from state.json
34
34
  <execution>
35
35
  Follow '~/.maestro/workflows/milestone-complete.md' completely.
36
36
 
37
- Archive flow steps (validation, directory archival, artifact history, learning extraction, state advancement, cleanup) are defined in workflow `milestone-complete.md`.
37
+ Archive flow steps (validation, directory archival, artifact history, knowhow extraction, state advancement, cleanup) are defined in workflow `milestone-complete.md`.
38
38
 
39
39
  ### Knowledge Promotion Inquiry
40
40
 
41
- After learning extraction (step 4), scan `learnings.md` for promotion candidates:
41
+ After knowhow extraction (step 4), scan `learnings.md` for promotion candidates:
42
42
 
43
- 1. **High-frequency pattern detection**: Scan all `<spec-entry category="learning">` entries for keyword overlap (≥2 entries sharing keywords):
44
- → Ask: "Keyword '{keyword}' appears in {N} learning entries. Should this be promoted to a formal coding convention? (`/spec-add coding`)"
43
+ 1. **High-frequency pattern detection**: Scan all `<spec-entry>` entries with `roles="implement"` for keyword overlap (≥2 entries sharing keywords):
44
+ → Ask: "Keyword '{keyword}' appears in {N} knowhow entries. Should this be promoted to a formal coding convention? (`/spec-add coding`)"
45
45
 
46
46
  2. **Convention drift detection**: Compare executed task summaries against `coding-conventions.md` and `architecture-constraints.md`:
47
47
  → Ask: "Were any established conventions bypassed during this milestone? Should conventions be updated?"
@@ -68,7 +68,7 @@ If user confirms promotion, invoke `Skill({ skill: "spec-add", args: "<category>
68
68
  - [ ] Audit report verified as PASS
69
69
  - [ ] Scratch artifacts moved to milestones/{M}/artifacts/
70
70
  - [ ] Artifact entries archived to milestone_history
71
- - [ ] Learnings extracted to specs/learnings.md
71
+ - [ ] Knowhow extracted to specs/learnings.md
72
72
  - [ ] state.json updated: next milestone as current, artifacts[] cleared
73
73
  - [ ] Roadmap snapshot saved
74
74
  - [ ] project.md Context updated with milestone summary
@@ -85,7 +85,7 @@ Append to state.json.artifacts[]:
85
85
  **Next-step routing on completion:**
86
86
  - Converged (>=95%) → `/maestro-verify {phase}`
87
87
  - All requirements verified (spec source) → `/maestro-milestone-audit`
88
- - Bugs discovered → `/quality-debug --from-auto-test {phase}`
88
+ - Bugs discovered → `/quality-debug --from-uat {phase}`
89
89
  - Max iter, >80% → `/quality-test {phase}` for manual UAT
90
90
  - Max iter, <80% → `/quality-debug {phase}`
91
91
  - Coverage still low → `/quality-auto-test {phase} --layer {missing}`
@@ -49,6 +49,14 @@ Extract conclusions from related artifacts that may affect this debug session
49
49
  2. **Wiki prior knowledge**: Run `maestro wiki search "<symptom keywords>" --json 2>/dev/null`. If results found, check for prior investigations on similar issues to avoid re-investigation.
50
50
  3. Both are optional — proceed without if unavailable.
51
51
 
52
+ ### Role Knowledge
53
+ 1. Browse accumulated knowledge for this role:
54
+ `maestro wiki list --category debug`
55
+ 2. Analyze the index, identify entries relevant to the current task
56
+ 3. Load selected documents:
57
+ `maestro wiki load <id1> [id2] [id3...]`
58
+ 4. Review loaded knowledge before proceeding
59
+
52
60
  **Output**: `DEBUG_DIR = .workflow/scratch/{YYYYMMDD}-debug-P{N}-{slug}/` (P{N} = phase number when phase-scoped; omit for standalone). Output directory rules defined in workflow debug.md Step 4.
53
61
  </context>
54
62
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: quality-retrospective
3
- description: Phase retrospective with insight routing to specs and lessons
3
+ description: Phase retrospective with insight routing to specs and knowhow
4
4
  argument-hint: "[phase|N..M] [--lens technical|process|quality|decision] [--all] [--no-route] [--compare N] [-y]"
5
5
  allowed-tools:
6
6
  - Read
@@ -13,7 +13,7 @@ allowed-tools:
13
13
  - AskUserQuestion
14
14
  ---
15
15
  <purpose>
16
- Post-execution multi-perspective retrospective (复盘) for completed phases. Consumes existing execution artifacts (verification.json, review.json, issues.jsonl, plan.json, .summaries/, uat.md, state.json) and runs four parallel lenses — technical, process, quality, decision — to distill reusable insights. Routes each insight into the appropriate store: spec stub for reusable patterns, memory tip for process notes, issue for recurring gaps. Auto-scans for unreviewed completed phases and reports the backlog. Every insight is also persisted to `.workflow/learning/lessons.jsonl` for cross-phase queryability.
16
+ Post-execution multi-perspective retrospective (复盘) for completed phases. Consumes existing execution artifacts (verification.json, review.json, issues.jsonl, plan.json, .summaries/, uat.md, state.json) and runs four parallel lenses — technical, process, quality, decision — to distill reusable insights. Routes each insight into the appropriate store: spec stub for reusable patterns, memory tip for process notes, issue for recurring gaps. Auto-scans for unreviewed completed phases and reports the backlog. Every insight is also persisted to `.workflow/knowhow/specs/learnings.md` as `<spec-entry>` blocks for cross-phase queryability.
17
17
  </purpose>
18
18
 
19
19
  <required_reading>
@@ -70,9 +70,8 @@ Follow `~/.maestro/workflows/retrospective.md` Stages 1–8 in order. Key invari
70
70
  - [ ] Spec entries (if any) appended as `<spec-entry>` to matching `.workflow/specs/{category-file}.md`
71
71
  - [ ] Issue rows (if any) match canonical issues.jsonl schema (status "open", full issue_history, all required fields)
72
72
  - [ ] Note tips (if any) created via `Skill({ skill: "manage-learn", args: "tip ..." })`
73
- - [ ] `lessons.jsonl` appended with one row per insight regardless of routing target
74
- - [ ] `learning-index.json` updated and parseable
73
+ - [ ] `specs/learnings.md` appended with one `<spec-entry>` per insight regardless of routing target
75
74
  - [ ] No existing phase artifacts modified (verification.json, review.json, plan.json untouched)
76
75
  - [ ] Confirmation banner displays routing counts and next-step suggestions
77
- - [ ] Next step: `/manage-status` to review state, or `/manage-issue list --source retrospective` to triage created issues, or `/manage-learn list` to browse the lessons library
76
+ - [ ] Next step: `/manage-status` to review state, or `/manage-issue list --source retrospective` to triage created issues, or `/manage-learn list` to browse the knowhow library
78
77
  </success_criteria>
@@ -54,6 +54,14 @@ Extract conclusions from related artifacts that may affect this review. Pass as
54
54
  2. **Wiki constraints**: Run `maestro wiki search "architecture constraint" --json 2>/dev/null`. If results found, pass as `wiki_context` to reviewer agents for evaluating code against documented decisions.
55
55
  3. Both are optional — proceed without if unavailable.
56
56
 
57
+ ### Role Knowledge
58
+ 1. Browse accumulated knowledge for this role:
59
+ `maestro wiki list --category review`
60
+ 2. Analyze the index, identify entries relevant to the current task
61
+ 3. Load selected documents:
62
+ `maestro wiki load <id1> [id2] [id3...]`
63
+ 4. Review loaded knowledge before proceeding
64
+
57
65
  **Output**: `REVIEW_DIR = .workflow/scratch/{YYYYMMDD}-review-P{N}-{slug}/` (P{N} = phase number, enables directory-level identification as state.json fallback)
58
66
  </context>
59
67
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: spec-add
3
- description: Add spec entry by category
3
+ description: Add spec entry by category with role tagging
4
4
  argument-hint: "[--scope project|global|team|personal] <category> <content>"
5
5
  allowed-tools:
6
6
  - Read
@@ -13,6 +13,7 @@ allowed-tools:
13
13
  Add a knowledge entry to the specs system using `<spec-entry>` closed-tag format.
14
14
  Each category maps 1:1 to a single target file — no dual-write.
15
15
  Supports 4 scopes: project (default), global, team, personal.
16
+ Entries use `category` attribute to declare which category they belong to.
16
17
  </purpose>
17
18
 
18
19
  <required_reading>
@@ -22,7 +23,22 @@ Supports 4 scopes: project (default), global, team, personal.
22
23
  <context>
23
24
  $ARGUMENTS -- expects `[--scope <scope>] [--uid <uid>] <category> <content>`
24
25
 
26
+ **Options:**
27
+ - `--ref <path>` — Create as index entry referencing a knowhow document. If the path exists, only creates the spec index entry. If path doesn't exist, also creates the knowhow file.
28
+ - `--knowhow-type <type>` — Knowhow document type when creating with --ref (asset, blueprint, document, template, recipe, reference, decision)
29
+
25
30
  Scope-to-directory mapping, category-to-file mapping, and entry format defined in workflow specs-add.md.
31
+
32
+ **Examples:**
33
+ ```bash
34
+ # Standard spec entry
35
+ /spec-add coding "Named exports" "Always use named exports" --keywords "exports,naming"
36
+
37
+ # Spec with ref to detailed knowhow
38
+ /spec-add coding "OAuth PKCE Flow" "完整 PKCE 集成流程" --ref knowhow/RCP-oauth-pkce.md --keywords "oauth,pkce"
39
+
40
+ /spec-add arch "OAuth PKCE 集成" "完整流程设计" --ref knowhow/AST-oauth-flow.md
41
+ ```
26
42
  </context>
27
43
 
28
44
  <execution>
@@ -34,7 +50,7 @@ Follow '~/.maestro/workflows/specs-add.md' completely.
34
50
  |------|----------|-------------|-------|
35
51
  | E001 | fatal | Category and content are both required | parse_input |
36
52
  | E002 | fatal | Specs directory not initialized -- run `maestro spec init --scope <scope>` | validate_entry |
37
- | E003 | fatal | Invalid category -- must be one of: coding, arch, quality, debug, test, review, learning | parse_input |
53
+ | E003 | fatal | Invalid category -- must be one of: coding, arch, quality, debug, test, review, learning, tools | parse_input |
38
54
  | E004 | fatal | Invalid scope -- must be one of: project, global, team, personal | parse_input |
39
55
  | E005 | fatal | Personal scope requires uid -- use `--uid` or run `maestro collab join` first | parse_input |
40
56
  </error_codes>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: spec-load
3
3
  description: Load specs and lessons for current context
4
- argument-hint: "[--category <type>] [--keyword <word>] [--with-lessons]"
4
+ argument-hint: "[--category <category>] [--keyword <word>]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Bash
@@ -9,8 +9,8 @@ allowed-tools:
9
9
  - Grep
10
10
  ---
11
11
  <purpose>
12
- Load and display relevant spec files for the current working context.
13
- Supports filtering by category (file-level) and keyword (entry-level via `<spec-entry>` tags).
12
+ Load relevant specs filtered by category (file-level) and/or keyword (entry-level).
13
+ Category-based loading: loads the category's primary doc in full + matching entries from other files.
14
14
  </purpose>
15
15
 
16
16
  <required_reading>
@@ -20,14 +20,33 @@ Supports filtering by category (file-level) and keyword (entry-level via `<spec-
20
20
  <context>
21
21
  $ARGUMENTS -- optional flags and keyword
22
22
 
23
- Category-to-file mapping (1:1) and flag details defined in workflow specs-load.md.
23
+ **Flags:**
24
+ - `--category <category>` — Load by category: primary category doc (full) + cross-file entries with matching category attr. Categories: coding, arch, test, review, debug, quality, learning.
25
+ - `--keyword <word>` — Filter by keyword within entries
26
+
27
+ **File → Primary Category mapping:**
28
+ | File | Category |
29
+ |------|----------|
30
+ | coding-conventions.md | coding |
31
+ | architecture-constraints.md | arch |
32
+ | test-conventions.md | test |
33
+ | review-standards.md | review |
34
+ | debug-notes.md | debug |
35
+ | quality-rules.md | quality |
36
+ | learnings.md | learning |
24
37
 
25
38
  **Examples:**
26
39
  ```
40
+ /spec-load --category coding # coding全文 + 跨文件coding条目
41
+ /spec-load --category review # review-standards + quality-rules + 跨文件review条目
42
+ /spec-load --category coding --keyword auth
27
43
  /spec-load --keyword auth
28
- /spec-load --category coding --keyword naming
29
- /spec-load --category arch
30
44
  ```
45
+
46
+ **Ref entries:**
47
+ When loading entries with `ref` attribute, only the summary is shown with a load command:
48
+ → Detail: maestro wiki load <knowhow-id>
49
+ Use the load command to read the full referenced document.
31
50
  </context>
32
51
 
33
52
  <execution>
@@ -11,7 +11,7 @@ allowed-tools:
11
11
  ---
12
12
  <purpose>
13
13
  Initialize the project-level specs directory by scanning the codebase for conventions, patterns, and tech stack.
14
- Core files (coding, arch, learning) are always created. Optional files (quality, debug, test, review) are created only when relevant signals are detected.
14
+ Core files (coding, arch, knowhow) are always created. Optional files (quality, debug, test, review) are created only when relevant signals are detected.
15
15
  All output lands in `.workflow/specs/`.
16
16
  </purpose>
17
17
 
@@ -44,7 +44,7 @@ Follow '~/.maestro/workflows/specs-setup.md' completely.
44
44
 
45
45
  <success_criteria>
46
46
  - [ ] `.workflow/specs/` directory created
47
- - [ ] Core files always created: `coding-conventions.md`, `architecture-constraints.md`, `learnings.md`
47
+ - [ ] Core files always created: `coding-conventions.md`, `architecture-constraints.md`, `knowhow.md`
48
48
  - [ ] Optional files created when detected: `quality-rules.md` (linter/CI), `test-conventions.md` (test framework), `debug-notes.md` (on demand), `review-standards.md` (on demand)
49
49
  - [ ] Report displayed with summary and next steps
50
50
  </success_criteria>
@@ -56,7 +56,7 @@ Follow '~/.maestro/workflows/wiki-connect.md' completely (Stages 1-6).
56
56
  - [ ] If --fix: entries updated with new `related` links
57
57
  - [ ] If --fix: new health score computed and delta reported
58
58
  - [ ] Report written to `wiki-connections-{date}.md`
59
- - [ ] Graph insights appended to `lessons.jsonl`
59
+ - [ ] Graph insights appended to `specs/learnings.md` as `<spec-entry>` blocks
60
60
  - [ ] No unintended entry modifications (only `related` field changed)
61
61
  - [ ] Summary displayed with next-step routing
62
62
  </success_criteria>
@@ -48,7 +48,7 @@ Follow '~/.maestro/workflows/wiki-digest.md' completely (Stages 1-8).
48
48
  | E001 | error | No wiki entries found (empty index) | Initialize wiki content first |
49
49
  | E002 | error | Topic search returned 0 results | Broaden topic or check wiki content |
50
50
  | W001 | warning | Too few entries (<5) for meaningful theme clustering | Digest produced but themes may be trivial |
51
- | W002 | warning | lessons.jsonl not found — skipping cross-reference | Proceed without lesson context |
51
+ | W002 | warning | specs/learnings.md not found — skipping cross-reference | Proceed without knowhow context |
52
52
  | W003 | warning | Some entry bodies failed to load — partial summaries | Note incomplete entries in digest |
53
53
  </error_codes>
54
54
 
@@ -57,13 +57,12 @@ Follow '~/.maestro/workflows/wiki-digest.md' completely (Stages 1-8).
57
57
  - [ ] Baseline health score recorded
58
58
  - [ ] Entries clustered into 3-5 semantic themes
59
59
  - [ ] Per-theme analysis: summary, key entries, gaps, health
60
- - [ ] Cross-reference with lessons.jsonl completed
60
+ - [ ] Cross-reference with specs/learnings.md completed
61
61
  - [ ] Coverage heatmap generated (type × theme matrix)
62
62
  - [ ] Knowledge gaps identified with suggested actions
63
63
  - [ ] If `--create-issues`: gap issues created in `issues.jsonl` (deduped)
64
- - [ ] Digest written to `digest-{slug}-{date}.md`
65
- - [ ] Meta-insights appended to `lessons.jsonl`
66
- - [ ] `learning-index.json` updated
67
- - [ ] No files modified outside `.workflow/learning/` and `.workflow/issues/` (issues only when `--create-issues`)
64
+ - [ ] Digest written to `KNW-digest-{slug}-{date}.md`
65
+ - [ ] Meta-insights appended to `specs/learnings.md` as `<spec-entry>` blocks
66
+ - [ ] No files modified outside `.workflow/knowhow/` and `.workflow/issues/` (issues only when `--create-issues`)
68
67
  - [ ] Summary displayed with key findings and next-step routing
69
68
  </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow-one",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "All Maestro workflow commands as a single Claude Code skill — intent routing, decision gates, minimal closed-loop chains",
5
5
  "bin": {
6
6
  "maestro-flow": "bin/maestro-flow.js"