maestro-flow 0.5.0 → 0.5.2

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 (95) hide show
  1. package/.agents/skills/codify-to-knowhow/phases/03-generate-specs.md +2 -1
  2. package/.agents/skills/manage-knowhow-capture/SKILL.md +4 -2
  3. package/.agy/skills/codify-to-knowhow/phases/03-generate-specs.md +2 -1
  4. package/.agy/skills/manage-knowhow-capture/SKILL.md +4 -2
  5. package/.claude/commands/manage-knowhow-capture.md +4 -2
  6. package/.claude/skills/codify-to-knowhow/phases/03-generate-specs.md +2 -1
  7. package/.codex/skills/codify-to-knowhow/SKILL.md +1 -1
  8. package/.codex/skills/learn-decompose/SKILL.md +144 -144
  9. package/.codex/skills/learn-follow/SKILL.md +83 -83
  10. package/.codex/skills/learn-investigate/SKILL.md +84 -84
  11. package/.codex/skills/learn-retro/SKILL.md +113 -113
  12. package/.codex/skills/learn-second-opinion/SKILL.md +116 -116
  13. package/.codex/skills/maestro/SKILL.md +11 -8
  14. package/.codex/skills/maestro-amend/SKILL.md +4 -4
  15. package/.codex/skills/maestro-analyze/SKILL.md +3 -3
  16. package/.codex/skills/maestro-blueprint/SKILL.md +4 -4
  17. package/.codex/skills/maestro-collab/SKILL.md +1 -1
  18. package/.codex/skills/maestro-companion/SKILL.md +4 -4
  19. package/.codex/skills/maestro-composer/SKILL.md +217 -217
  20. package/.codex/skills/maestro-grill/SKILL.md +1 -1
  21. package/.codex/skills/maestro-help/SKILL.md +30 -30
  22. package/.codex/skills/maestro-init/SKILL.md +1 -1
  23. package/.codex/skills/maestro-learn/SKILL.md +80 -80
  24. package/.codex/skills/maestro-merge/SKILL.md +76 -76
  25. package/.codex/skills/maestro-milestone-release/SKILL.md +74 -74
  26. package/.codex/skills/maestro-player/SKILL.md +3 -3
  27. package/.codex/skills/maestro-quick/SKILL.md +129 -129
  28. package/.codex/skills/maestro-ralph/SKILL.md +9 -9
  29. package/.codex/skills/maestro-ralph-beta/SKILL.md +34 -34
  30. package/.codex/skills/maestro-ralph-execute/SKILL.md +5 -5
  31. package/.codex/skills/maestro-tools-execute/SKILL.md +3 -3
  32. package/.codex/skills/maestro-tools-register/SKILL.md +3 -3
  33. package/.codex/skills/manage-codebase-rebuild/SKILL.md +412 -412
  34. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  35. package/.codex/skills/manage-harvest/SKILL.md +99 -99
  36. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  37. package/.codex/skills/manage-knowhow/SKILL.md +95 -95
  38. package/.codex/skills/manage-knowhow-capture/SKILL.md +137 -125
  39. package/.codex/skills/manage-status/SKILL.md +7 -7
  40. package/.codex/skills/manage-wiki/SKILL.md +55 -55
  41. package/.codex/skills/quality-auto-test/SKILL.md +1 -1
  42. package/.codex/skills/quality-debug/SKILL.md +8 -8
  43. package/.codex/skills/quality-refactor/SKILL.md +3 -3
  44. package/.codex/skills/quality-review/SKILL.md +1 -1
  45. package/.codex/skills/quality-sync/SKILL.md +111 -111
  46. package/.codex/skills/quality-test/SKILL.md +1 -1
  47. package/.codex/skills/spec-add/SKILL.md +2 -2
  48. package/.codex/skills/spec-load/SKILL.md +1 -1
  49. package/.codex/skills/spec-map/SKILL.md +204 -204
  50. package/.codex/skills/spec-remove/SKILL.md +75 -75
  51. package/.codex/skills/spec-setup/SKILL.md +2 -2
  52. package/.codex/skills/wiki-connect/SKILL.md +73 -73
  53. package/.codex/skills/wiki-digest/SKILL.md +87 -87
  54. package/dist/src/commands/install.d.ts.map +1 -1
  55. package/dist/src/commands/install.js +40 -10
  56. package/dist/src/commands/install.js.map +1 -1
  57. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  58. package/dist/src/i18n/locales/en.js +4 -0
  59. package/dist/src/i18n/locales/en.js.map +1 -1
  60. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  61. package/dist/src/i18n/locales/zh.js +4 -0
  62. package/dist/src/i18n/locales/zh.js.map +1 -1
  63. package/dist/src/i18n/types.d.ts +4 -0
  64. package/dist/src/i18n/types.d.ts.map +1 -1
  65. package/dist/src/ralph/skill-scanner.d.ts.map +1 -1
  66. package/dist/src/ralph/skill-scanner.js +9 -3
  67. package/dist/src/ralph/skill-scanner.js.map +1 -1
  68. package/dist/src/tui/install-ui/InstallConfirm.d.ts +1 -0
  69. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  70. package/dist/src/tui/install-ui/InstallConfirm.js +3 -1
  71. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  72. package/dist/src/tui/install-ui/InstallExecution.d.ts +2 -0
  73. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  74. package/dist/src/tui/install-ui/InstallExecution.js +20 -0
  75. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  76. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  77. package/dist/src/tui/install-ui/InstallFlow.js +13 -5
  78. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  79. package/dist/src/tui/install-ui/InstallHub.d.ts +2 -0
  80. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  81. package/dist/src/tui/install-ui/InstallHub.js +10 -0
  82. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  83. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  84. package/dist/src/tui/install-ui/InstallResult.js +5 -1
  85. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  86. package/dist/src/utils/update-notices.js +6 -0
  87. package/dist/src/utils/update-notices.js.map +1 -1
  88. package/package.json +1 -1
  89. package/workflows/agy-instructions.md +1 -1
  90. package/workflows/finish-work.md +1 -1
  91. package/workflows/impeccable/design.md +1 -0
  92. package/workflows/impeccable.md +1 -0
  93. package/workflows/knowhow.md +14 -8
  94. package/workflows/specs-add.md +1 -1
  95. package/workflows/specs-setup.md +2 -2
@@ -68,7 +68,8 @@ ${spec.body}
68
68
 
69
69
  // 追加到目标文件
70
70
  // 优先使用 maestro spec add CLI
71
- const cliResult = shell(`maestro spec add ${spec.category} "${spec.title}" "${spec.body}" --keywords "${spec.keywords}" 2>/dev/null`);
71
+ const descFlag = spec.description ? ` --description "${spec.description}"` : '';
72
+ const cliResult = shell(`maestro spec add ${spec.category} "${spec.title}" "${spec.body}" --keywords "${spec.keywords}"${descFlag} 2>/dev/null`);
72
73
 
73
74
  if (cliResult.exitCode !== 0) {
74
75
  // 回退:直接追加到文件
@@ -25,7 +25,7 @@ Auto-indexed by WikiIndexer (type=knowhow), searchable via `maestro search --typ
25
25
  <context>
26
26
  $ARGUMENTS — type token + description + optional flags.
27
27
 
28
- **Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
28
+ **Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--description <desc>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
29
29
 
30
30
  **Type routing** (first token match):
31
31
 
@@ -44,12 +44,14 @@ $ARGUMENTS — type token + description + optional flags.
44
44
  | Short text + `--tag` | tip | TIP- | — |
45
45
  | No args | — | — | ask_user (10 options) |
46
46
 
47
- **Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{HHMM}.md` with YAML frontmatter (title, type, category, created, tags, source, lang, status)
47
+ **Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{slug}.md` with YAML frontmatter (title, description, type, category, created, tags, source, lang, status)
48
48
  </context>
49
49
 
50
50
  <execution>
51
51
  Follow '~/.maestro/workflows/knowhow.md' completely.
52
52
 
53
+ **Description rule**: Every entry MUST have a `description` field in frontmatter — a one-line summary (under 120 chars) for search results. WikiIndexer uses priority chain: `description > content[:240]`. Use `--description` flag value if provided; otherwise auto-generate from content.
54
+
53
55
  **Tags language rule**: Tags must match content language. Chinese content → Chinese tags (如 `认证,令牌,刷新`). English content → English tags. Mixed → bilingual.
54
56
 
55
57
  **Type-specific content rules**:
@@ -68,7 +68,8 @@ ${spec.body}
68
68
 
69
69
  // 追加到目标文件
70
70
  // 优先使用 maestro spec add CLI
71
- const cliResult = run_command(`maestro spec add ${spec.category} "${spec.title}" "${spec.body}" --keywords "${spec.keywords}" 2>/dev/null`);
71
+ const descFlag = spec.description ? ` --description "${spec.description}"` : '';
72
+ const cliResult = run_command(`maestro spec add ${spec.category} "${spec.title}" "${spec.body}" --keywords "${spec.keywords}"${descFlag} 2>/dev/null`);
72
73
 
73
74
  if (cliResult.exitCode !== 0) {
74
75
  // 回退:直接追加到文件
@@ -22,7 +22,7 @@ Auto-indexed by WikiIndexer (type=knowhow), searchable via `maestro search --typ
22
22
  <context>
23
23
  $ARGUMENTS — type token + description + optional flags.
24
24
 
25
- **Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
25
+ **Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--description <desc>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
26
26
 
27
27
  **Type routing** (first token match):
28
28
 
@@ -41,12 +41,14 @@ $ARGUMENTS — type token + description + optional flags.
41
41
  | Short text + `--tag` | tip | TIP- | — |
42
42
  | No args | — | — | ask_question (10 options) |
43
43
 
44
- **Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{HHMM}.md` with YAML frontmatter (title, type, category, created, tags, source, lang, status)
44
+ **Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{slug}.md` with YAML frontmatter (title, description, type, category, created, tags, source, lang, status)
45
45
  </context>
46
46
 
47
47
  <execution>
48
48
  Follow '~/.maestro/workflows/knowhow.md' completely.
49
49
 
50
+ **Description rule**: Every entry MUST have a `description` field in frontmatter — a one-line summary (under 120 chars) for search results. WikiIndexer uses priority chain: `description > content[:240]`. Use `--description` flag value if provided; otherwise auto-generate from content.
51
+
50
52
  **Tags language rule**: Tags must match content language. Chinese content → Chinese tags (如 `认证,令牌,刷新`). English content → English tags. Mixed → bilingual.
51
53
 
52
54
  **Type-specific content rules**:
@@ -23,7 +23,7 @@ Auto-indexed by WikiIndexer (type=knowhow), searchable via `maestro search --typ
23
23
  <context>
24
24
  $ARGUMENTS — type token + description + optional flags.
25
25
 
26
- **Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
26
+ **Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--description <desc>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
27
27
 
28
28
  **Type routing** (first token match):
29
29
 
@@ -42,12 +42,14 @@ $ARGUMENTS — type token + description + optional flags.
42
42
  | Short text + `--tag` | tip | TIP- | — |
43
43
  | No args | — | — | AskUserQuestion (10 options) |
44
44
 
45
- **Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{HHMM}.md` with YAML frontmatter (title, type, category, created, tags, source, lang, status)
45
+ **Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{slug}.md` with YAML frontmatter (title, description, type, category, created, tags, source, lang, status)
46
46
  </context>
47
47
 
48
48
  <execution>
49
49
  Follow '~/.maestro/workflows/knowhow.md' completely.
50
50
 
51
+ **Description rule**: Every entry MUST have a `description` field in frontmatter — a one-line summary (under 120 chars) for search results. WikiIndexer uses priority chain: `description > content[:240]`. Use `--description` flag value if provided; otherwise auto-generate from content.
52
+
51
53
  **Tags language rule**: Tags must match content language. Chinese content → Chinese tags (如 `认证,令牌,刷新`). English content → English tags. Mixed → bilingual.
52
54
 
53
55
  **Type-specific content rules**:
@@ -68,7 +68,8 @@ ${spec.body}
68
68
 
69
69
  // 追加到目标文件
70
70
  // 优先使用 maestro spec add CLI
71
- const cliResult = Bash(`maestro spec add ${spec.category} "${spec.title}" "${spec.body}" --keywords "${spec.keywords}" 2>/dev/null`);
71
+ const descFlag = spec.description ? ` --description "${spec.description}"` : '';
72
+ const cliResult = Bash(`maestro spec add ${spec.category} "${spec.title}" "${spec.body}" --keywords "${spec.keywords}"${descFlag} 2>/dev/null`);
72
73
 
73
74
  if (cliResult.exitCode !== 0) {
74
75
  // 回退:直接追加到文件
@@ -246,7 +246,7 @@ type: ${asset.category}`;
246
246
  for (let i = 0; i < asset.entries.length; i++) {
247
247
  const entry = asset.entries[i];
248
248
  const entryId = `${asset.prefix}-${manifest.slug}-${String(i + 1).padStart(3, '0')}`;
249
- body += `\n\n<knowhow-entry keywords="${entry.category},${entry.keywords}" date="${today}" id="${entryId}" roles="${manifest.roles.join(',')}" source="codify-to-knowhow">
249
+ body += `\n\n<knowhow-entry keywords="${entry.category},${entry.keywords}" date="${today}" title="${entry.title}" description="${entry.description || ''}" id="${entryId}" roles="${manifest.roles.join(',')}" source="codify-to-knowhow">
250
250
 
251
251
  ### ${entry.title}
252
252
 
@@ -1,144 +1,144 @@
1
- ---
2
- name: learn-decompose
3
- description: Extract design patterns from code into specs and wiki
4
- argument-hint: "[-y|--yes] [-c|--concurrency 4] [--continue] \"<path|module> [--patterns <list>] [--save-spec] [--save-wiki]\""
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Systematic pattern extraction from code via CSV wave pipeline. 4 parallel dimension agents
10
- scan a module, then a cross-reference agent deduplicates against existing patterns and
11
- produces a catalog. Discovered patterns persist to `.workflow/specs/learnings.md` and optionally to
12
- specs (via `spec-add`) and wiki.
13
-
14
- ```
15
- Resolve Target → Load Existing Patterns → Wave 1 (4 parallel dimension scans) → Wave 2 (cross-ref + catalog) → Persist
16
- ```
17
- </purpose>
18
-
19
- <context>
20
- $ARGUMENTS — target path/module and optional flags.
21
-
22
- **Target resolution:**
23
- - File path → analyze that file
24
- - Directory path → all source files in it
25
- - Module name → Glob `src/**/{module}*`
26
-
27
- **Flags:**
28
- - `-y, --yes`: Skip confirmations
29
- - `-c, --concurrency N`: Max concurrent agents (default: 4)
30
- - `--continue`: Resume existing session
31
- - `--patterns <list>`: Comma-separated pattern names to focus on
32
- - `--save-spec`: Invoke `spec-add` for each new pattern
33
- - `--save-wiki`: Create wiki note entries per dimension group
34
-
35
- **Output**: `.workflow/.csv-wave/{session-id}/` + `.workflow/knowhow/KNW-decompose-{slug}-{date}.md`
36
- </context>
37
-
38
- <invariants>
39
- 1. **4 dimensions always**: structural, behavioral, data, error — each a wave 1 task
40
- 2. **Evidence required**: Every finding must have file:line anchors
41
- 3. **Dedup before persist**: Cross-reference against existing specs + lessons
42
- 4. **Stable IDs**: INS-id from `hash("decompose" + target + pattern_name)`
43
- 5. **No files modified outside** `.workflow/knowhow/` (and optionally specs/wiki)
44
- </invariants>
45
-
46
- <execution>
47
-
48
- ### Phase 1: Session Init + Target Resolution
49
-
50
- Parse flags from `$ARGUMENTS`: `-y`/`--yes`, `--patterns <list>`, `--save-spec`, `--save-wiki`, `--continue`, `-c N`.
51
- Extract remaining text as target path/module.
52
-
53
- Resolve target to file list. Load coding specs: `maestro spec load --category coding` for documented patterns and conventions. Load existing patterns from `coding-conventions.md` + `.workflow/specs/learnings.md` for dedup set. Browse wiki: `maestro search --category coding`, load relevant entries.
54
-
55
- ### Phase 2: Wave 1 — Parallel Dimension Scans
56
-
57
- Generate `tasks.csv` with 4 dimension rows (wave 1) + 1 cross-ref row (wave 2). Initialize every row with `status="pending"`. Filter `wave==N AND status=="pending"` when writing each wave CSV.
58
-
59
- | id | dimension | focus |
60
- |----|-----------|-------|
61
- | 1 | structural | Class hierarchy, composition, DI, factories, exports |
62
- | 2 | behavioral | Events, middleware, observer, command, state machines |
63
- | 3 | data | Repository, DTO, caching, serialization, validation |
64
- | 4 | error | Boundaries, retry/backoff, fallbacks, guards, logging |
65
- | 5 | cross-ref | Dedup + catalog from wave 1 findings |
66
-
67
- **output_schema** (both waves):
68
-
69
- ```json
70
- {
71
- "type": "object",
72
- "properties": {
73
- "id": { "type": "string" },
74
- "result_status": { "type": "string", "enum": ["completed", "failed"] },
75
- "dimension": { "type": "string", "enum": ["structural", "behavioral", "data", "error", "cross-ref"] },
76
- "patterns": { "type": "string", "description": "JSON array string: [{name, dimension, confidence, anchors, description, rationale, tradeoffs}]" },
77
- "findings": { "type": "string", "maxLength": 500 },
78
- "error": { "type": "string" }
79
- },
80
- "required": ["id", "result_status", "findings"]
81
- }
82
- ```
83
-
84
- Merge: `result_status` → master `status`; copy `dimension`, `patterns`, `findings`, `error`.
85
-
86
- **Shared termination contract** (embed in every instruction):
87
- ```
88
- You MUST call report_agent_job_result EXACTLY ONCE before exiting.
89
- - Success → result_status=completed (patterns may be empty array if nothing found)
90
- - Failure → result_status=failed with error message
91
- - Timeout → near max_runtime_seconds → result_status=completed with partial patterns
92
- - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
93
- - Every finding MUST include file:line anchors. No speculation.
94
- - Read-only analysis. Do NOT modify source.
95
- Do NOT write to tasks.csv, wave-*.csv, results.csv. Do NOT call spawn_agents_on_csv (no recursion).
96
- ```
97
-
98
- Each dimension agent populates `patterns` as a JSON array string of:
99
- ```json
100
- [{
101
- "name": "pattern name",
102
- "dimension": "structural|behavioral|data|error",
103
- "confidence": "high|medium|low",
104
- "anchors": ["file:line"],
105
- "description": "what it does",
106
- "rationale": "why this approach",
107
- "tradeoffs": "what was given up"
108
- }]
109
- ```
110
-
111
- ### Phase 3: Wave 2 — Cross-Reference + Catalog
112
-
113
- Single agent receives all wave 1 findings via `prev_context`. Uses same `output_schema` + termination contract above. Tasks:
114
- - Match against dedup set → mark as `documented`, `known`, or `new`
115
- - Merge duplicates across dimensions (same pattern found by multiple agents)
116
- - Flag contradictions with documented conventions
117
- - Build pattern catalog grouped by dimension
118
-
119
- ### Phase 4: Persist
120
-
121
- 1. Write `KNW-decompose-{slug}-{date}.md` with full catalog
122
- 2. Append each **new** pattern to `.workflow/specs/learnings.md` (source: "decompose", category: "pattern")
123
- 3. If `--save-spec`: invoke `spec-add` per new pattern
124
- 4. If `--save-wiki`: create wiki note per dimension group
125
- </execution>
126
-
127
- <error_codes>
128
- | Code | Severity | Condition | Recovery |
129
- |------|----------|-----------|----------|
130
- | E001 | error | Target path not found | Check path or use module name |
131
- | E002 | error | No source files in target | Check target has .ts/.js files |
132
- | W001 | warning | Dimension agent failed — partial results | Proceed with available dimensions |
133
- | W002 | warning | coding-conventions.md not found | All patterns marked "new" |
134
- </error_codes>
135
-
136
- <success_criteria>
137
- - [ ] Target resolved to concrete file list
138
- - [ ] 4 dimension agents spawned in parallel via spawn_agents_on_csv
139
- - [ ] Each finding has: name, dimension, confidence, anchors, description
140
- - [ ] Cross-reference performed (documented / known / new)
141
- - [ ] Pattern catalog written to `KNW-decompose-{slug}-{date}.md`
142
- - [ ] New patterns appended to `.workflow/specs/learnings.md` with stable INS-ids
143
- - [ ] If --save-spec / --save-wiki: entries created
144
- </success_criteria>
1
+ ---
2
+ name: learn-decompose
3
+ description: Extract design patterns from code into specs and wiki
4
+ argument-hint: "[-y|--yes] [-c|--concurrency 4] [--continue] \"<path|module> [--patterns <list>] [--save-spec] [--save-wiki]\""
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Systematic pattern extraction from code via CSV wave pipeline. 4 parallel dimension agents
10
+ scan a module, then a cross-reference agent deduplicates against existing patterns and
11
+ produces a catalog. Discovered patterns persist to `.workflow/specs/learnings.md` and optionally to
12
+ specs (via `spec-add`) and wiki.
13
+
14
+ ```
15
+ Resolve Target → Load Existing Patterns → Wave 1 (4 parallel dimension scans) → Wave 2 (cross-ref + catalog) → Persist
16
+ ```
17
+ </purpose>
18
+
19
+ <context>
20
+ $ARGUMENTS — target path/module and optional flags.
21
+
22
+ **Target resolution:**
23
+ - File path → analyze that file
24
+ - Directory path → all source files in it
25
+ - Module name → Glob `src/**/{module}*`
26
+
27
+ **Flags:**
28
+ - `-y, --yes`: Skip confirmations
29
+ - `-c, --concurrency N`: Max concurrent agents (default: 4)
30
+ - `--continue`: Resume existing session
31
+ - `--patterns <list>`: Comma-separated pattern names to focus on
32
+ - `--save-spec`: Invoke `spec-add` for each new pattern
33
+ - `--save-wiki`: Create wiki note entries per dimension group
34
+
35
+ **Output**: `.workflow/.csv-wave/{session-id}/` + `.workflow/knowhow/KNW-decompose-{slug}-{date}.md`
36
+ </context>
37
+
38
+ <invariants>
39
+ 1. **4 dimensions always**: structural, behavioral, data, error — each a wave 1 task
40
+ 2. **Evidence required**: Every finding must have file:line anchors
41
+ 3. **Dedup before persist**: Cross-reference against existing specs + lessons
42
+ 4. **Stable IDs**: INS-id from `hash("decompose" + target + pattern_name)`
43
+ 5. **No files modified outside** `.workflow/knowhow/` (and optionally specs/wiki)
44
+ </invariants>
45
+
46
+ <execution>
47
+
48
+ ### Phase 1: Session Init + Target Resolution
49
+
50
+ Parse flags from `$ARGUMENTS`: `-y`/`--yes`, `--patterns <list>`, `--save-spec`, `--save-wiki`, `--continue`, `-c N`.
51
+ Extract remaining text as target path/module.
52
+
53
+ Resolve target to file list. Load coding specs: `maestro spec load --category coding` for documented patterns and conventions. Load existing patterns from `coding-conventions.md` + `.workflow/specs/learnings.md` for dedup set. Browse wiki: `maestro search --category coding`, load relevant entries.
54
+
55
+ ### Phase 2: Wave 1 — Parallel Dimension Scans
56
+
57
+ Generate `tasks.csv` with 4 dimension rows (wave 1) + 1 cross-ref row (wave 2). Initialize every row with `status="pending"`. Filter `wave==N AND status=="pending"` when writing each wave CSV.
58
+
59
+ | id | dimension | focus |
60
+ |----|-----------|-------|
61
+ | 1 | structural | Class hierarchy, composition, DI, factories, exports |
62
+ | 2 | behavioral | Events, middleware, observer, command, state machines |
63
+ | 3 | data | Repository, DTO, caching, serialization, validation |
64
+ | 4 | error | Boundaries, retry/backoff, fallbacks, guards, logging |
65
+ | 5 | cross-ref | Dedup + catalog from wave 1 findings |
66
+
67
+ **output_schema** (both waves):
68
+
69
+ ```json
70
+ {
71
+ "type": "object",
72
+ "properties": {
73
+ "id": { "type": "string" },
74
+ "result_status": { "type": "string", "enum": ["completed", "failed"] },
75
+ "dimension": { "type": "string", "enum": ["structural", "behavioral", "data", "error", "cross-ref"] },
76
+ "patterns": { "type": "string", "description": "JSON array string: [{name, dimension, confidence, anchors, description, rationale, tradeoffs}]" },
77
+ "findings": { "type": "string", "maxLength": 500 },
78
+ "error": { "type": "string" }
79
+ },
80
+ "required": ["id", "result_status", "findings"]
81
+ }
82
+ ```
83
+
84
+ Merge: `result_status` → master `status`; copy `dimension`, `patterns`, `findings`, `error`.
85
+
86
+ **Shared termination contract** (embed in every instruction):
87
+ ```
88
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting.
89
+ - Success → result_status=completed (patterns may be empty array if nothing found)
90
+ - Failure → result_status=failed with error message
91
+ - Timeout → near max_runtime_seconds → result_status=completed with partial patterns
92
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
93
+ - Every finding MUST include file:line anchors. No speculation.
94
+ - Read-only analysis. Do NOT modify source.
95
+ Do NOT write to tasks.csv, wave-*.csv, results.csv. Do NOT call spawn_agents_on_csv (no recursion).
96
+ ```
97
+
98
+ Each dimension agent populates `patterns` as a JSON array string of:
99
+ ```json
100
+ [{
101
+ "name": "pattern name",
102
+ "dimension": "structural|behavioral|data|error",
103
+ "confidence": "high|medium|low",
104
+ "anchors": ["file:line"],
105
+ "description": "what it does",
106
+ "rationale": "why this approach",
107
+ "tradeoffs": "what was given up"
108
+ }]
109
+ ```
110
+
111
+ ### Phase 3: Wave 2 — Cross-Reference + Catalog
112
+
113
+ Single agent receives all wave 1 findings via `prev_context`. Uses same `output_schema` + termination contract above. Tasks:
114
+ - Match against dedup set → mark as `documented`, `known`, or `new`
115
+ - Merge duplicates across dimensions (same pattern found by multiple agents)
116
+ - Flag contradictions with documented conventions
117
+ - Build pattern catalog grouped by dimension
118
+
119
+ ### Phase 4: Persist
120
+
121
+ 1. Write `KNW-decompose-{slug}-{date}.md` with full catalog
122
+ 2. Append each **new** pattern to `.workflow/specs/learnings.md` (source: "decompose", category: "pattern")
123
+ 3. If `--save-spec`: invoke `spec-add` per new pattern
124
+ 4. If `--save-wiki`: create wiki note per dimension group
125
+ </execution>
126
+
127
+ <error_codes>
128
+ | Code | Severity | Condition | Recovery |
129
+ |------|----------|-----------|----------|
130
+ | E001 | error | Target path not found | Check path or use module name |
131
+ | E002 | error | No source files in target | Check target has .ts/.js files |
132
+ | W001 | warning | Dimension agent failed — partial results | Proceed with available dimensions |
133
+ | W002 | warning | coding-conventions.md not found | All patterns marked "new" |
134
+ </error_codes>
135
+
136
+ <success_criteria>
137
+ - [ ] Target resolved to concrete file list
138
+ - [ ] 4 dimension agents spawned in parallel via spawn_agents_on_csv
139
+ - [ ] Each finding has: name, dimension, confidence, anchors, description
140
+ - [ ] Cross-reference performed (documented / known / new)
141
+ - [ ] Pattern catalog written to `KNW-decompose-{slug}-{date}.md`
142
+ - [ ] New patterns appended to `.workflow/specs/learnings.md` with stable INS-ids
143
+ - [ ] If --save-spec / --save-wiki: entries created
144
+ </success_criteria>
@@ -1,83 +1,83 @@
1
- ---
2
- name: learn-follow
3
- description: Guided reading of code or wiki to extract patterns
4
- argument-hint: "<path|wiki-id|topic> [--depth shallow|deep] [--save-wiki]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Guided reading experience for code files, wiki entries, or topics. Walks through content
10
- section by section using 4 forcing questions to extract patterns, identify assumptions,
11
- and build a structured understanding map. Insights persist to `.workflow/specs/learnings.md`.
12
-
13
- Unlike `learn-decompose` which is parallel pattern extraction, this is sequential
14
- deep reading that builds understanding incrementally.
15
- </purpose>
16
-
17
- <context>
18
- $ARGUMENTS — target and optional flags.
19
-
20
- **Target resolution (auto-detected):**
21
- - File path → Read source file
22
- - Wiki ID (`type-slug`) → Fetch via `maestro wiki get`
23
- - Topic string → Search via `maestro search`, use top result
24
-
25
- **Flags:**
26
- - `--depth shallow` — Key patterns and structure only (default)
27
- - `--depth deep` — Every function, branch, assumption
28
- - `--save-wiki` — Create wiki note with reading notes
29
-
30
- **Output**: `.workflow/knowhow/KNW-follow-{slug}-{date}.md`
31
- </context>
32
-
33
- <execution>
34
-
35
- ### Stage 1: Resolve Target + Load Context Web
36
- - File: verify exists, parse imports for dependency files
37
- - Wiki ID: fetch + load forward/backlinks
38
- - Topic: search wiki, take top result
39
- - Build 1-hop context neighborhood (imports/exports or wiki links)
40
-
41
- ### Stage 2: Build Reading Order
42
- - Single file: split into logical sections (function/class boundaries)
43
- - Directory: entry point → core modules → utilities → tests
44
- - `--depth shallow`: top-level structure only
45
- - `--depth deep`: every function body, every branch
46
-
47
- ### Stage 3: Guided Reading (4 Forcing Questions per Section)
48
- 1. **"What pattern is being used here?"** — design patterns, idioms, conventions
49
- 2. **"Why this approach instead of alternatives?"** — trade-offs made
50
- 3. **"What assumption does this depend on?"** — external state, input shape, ordering
51
- 4. **"What would break if this changed?"** — fragility, downstream effects
52
-
53
- ### Stage 4: Extract Patterns + Produce Understanding Map
54
- From forcing question answers, extract: design patterns (with file:line anchors), naming conventions, error handling approach, data flow, assumptions.
55
-
56
- Cross-reference against `coding-conventions.md`: documented vs undocumented patterns.
57
-
58
- ### Stage 5: Persist
59
- 1. Write `KNW-follow-{slug}-{date}.md` with understanding map
60
- 2. Append new patterns to `.workflow/specs/learnings.md` (source: "follow", stable INS-ids)
61
- 3. If `--save-wiki`: create wiki note entry
62
-
63
- **Next steps:** `/learn-decompose <path>`, `/spec-add coding ...`, `/learn-second-opinion <file>`
64
- </execution>
65
-
66
- <error_codes>
67
- | Code | Severity | Condition | Recovery |
68
- |------|----------|-----------|----------|
69
- | E001 | error | Target not resolvable | Check path/ID or rephrase topic |
70
- | W001 | warning | Wiki graph unavailable | Proceed with code-only context |
71
- | W002 | warning | coding-conventions.md not found | Patterns flagged "unknown status" |
72
- | W003 | warning | Large target (>1000 lines) | Auto-switch to shallow depth |
73
- </error_codes>
74
-
75
- <success_criteria>
76
- - [ ] Target resolved to concrete content
77
- - [ ] Context web loaded (imports/exports or wiki links)
78
- - [ ] All 4 forcing questions applied per section
79
- - [ ] Patterns extracted with file:line anchors
80
- - [ ] Understanding map produced with concepts, patterns, assumptions, questions
81
- - [ ] `KNW-follow-{slug}-{date}.md` written
82
- - [ ] `.workflow/specs/learnings.md` appended with stable INS-ids
83
- </success_criteria>
1
+ ---
2
+ name: learn-follow
3
+ description: Guided reading of code or wiki to extract patterns
4
+ argument-hint: "<path|wiki-id|topic> [--depth shallow|deep] [--save-wiki]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Guided reading experience for code files, wiki entries, or topics. Walks through content
10
+ section by section using 4 forcing questions to extract patterns, identify assumptions,
11
+ and build a structured understanding map. Insights persist to `.workflow/specs/learnings.md`.
12
+
13
+ Unlike `learn-decompose` which is parallel pattern extraction, this is sequential
14
+ deep reading that builds understanding incrementally.
15
+ </purpose>
16
+
17
+ <context>
18
+ $ARGUMENTS — target and optional flags.
19
+
20
+ **Target resolution (auto-detected):**
21
+ - File path → Read source file
22
+ - Wiki ID (`type-slug`) → Fetch via `maestro wiki get`
23
+ - Topic string → Search via `maestro search`, use top result
24
+
25
+ **Flags:**
26
+ - `--depth shallow` — Key patterns and structure only (default)
27
+ - `--depth deep` — Every function, branch, assumption
28
+ - `--save-wiki` — Create wiki note with reading notes
29
+
30
+ **Output**: `.workflow/knowhow/KNW-follow-{slug}-{date}.md`
31
+ </context>
32
+
33
+ <execution>
34
+
35
+ ### Stage 1: Resolve Target + Load Context Web
36
+ - File: verify exists, parse imports for dependency files
37
+ - Wiki ID: fetch + load forward/backlinks
38
+ - Topic: search wiki, take top result
39
+ - Build 1-hop context neighborhood (imports/exports or wiki links)
40
+
41
+ ### Stage 2: Build Reading Order
42
+ - Single file: split into logical sections (function/class boundaries)
43
+ - Directory: entry point → core modules → utilities → tests
44
+ - `--depth shallow`: top-level structure only
45
+ - `--depth deep`: every function body, every branch
46
+
47
+ ### Stage 3: Guided Reading (4 Forcing Questions per Section)
48
+ 1. **"What pattern is being used here?"** — design patterns, idioms, conventions
49
+ 2. **"Why this approach instead of alternatives?"** — trade-offs made
50
+ 3. **"What assumption does this depend on?"** — external state, input shape, ordering
51
+ 4. **"What would break if this changed?"** — fragility, downstream effects
52
+
53
+ ### Stage 4: Extract Patterns + Produce Understanding Map
54
+ From forcing question answers, extract: design patterns (with file:line anchors), naming conventions, error handling approach, data flow, assumptions.
55
+
56
+ Cross-reference against `coding-conventions.md`: documented vs undocumented patterns.
57
+
58
+ ### Stage 5: Persist
59
+ 1. Write `KNW-follow-{slug}-{date}.md` with understanding map
60
+ 2. Append new patterns to `.workflow/specs/learnings.md` (source: "follow", stable INS-ids)
61
+ 3. If `--save-wiki`: create wiki note entry
62
+
63
+ **Next steps:** `$learn-decompose <path>`, `$spec-add coding ...`, `$learn-second-opinion <file>`
64
+ </execution>
65
+
66
+ <error_codes>
67
+ | Code | Severity | Condition | Recovery |
68
+ |------|----------|-----------|----------|
69
+ | E001 | error | Target not resolvable | Check path/ID or rephrase topic |
70
+ | W001 | warning | Wiki graph unavailable | Proceed with code-only context |
71
+ | W002 | warning | coding-conventions.md not found | Patterns flagged "unknown status" |
72
+ | W003 | warning | Large target (>1000 lines) | Auto-switch to shallow depth |
73
+ </error_codes>
74
+
75
+ <success_criteria>
76
+ - [ ] Target resolved to concrete content
77
+ - [ ] Context web loaded (imports/exports or wiki links)
78
+ - [ ] All 4 forcing questions applied per section
79
+ - [ ] Patterns extracted with file:line anchors
80
+ - [ ] Understanding map produced with concepts, patterns, assumptions, questions
81
+ - [ ] `KNW-follow-{slug}-{date}.md` written
82
+ - [ ] `.workflow/specs/learnings.md` appended with stable INS-ids
83
+ </success_criteria>