maestro-flow 0.3.12 → 0.3.13

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 (235) hide show
  1. package/.claude/CLAUDE.md +7 -0
  2. package/.claude/agents/workflow-analyzer.md +0 -1
  3. package/.claude/agents/workflow-collab-planner.md +0 -1
  4. package/.claude/agents/workflow-debugger.md +0 -1
  5. package/.claude/agents/workflow-integration-checker.md +2 -2
  6. package/.claude/agents/workflow-nyquist-auditor.md +0 -1
  7. package/.claude/agents/workflow-phase-researcher.md +2 -2
  8. package/.claude/agents/workflow-plan-checker.md +1 -1
  9. package/.claude/agents/workflow-planner.md +1 -2
  10. package/.claude/agents/workflow-roadmapper.md +1 -1
  11. package/.claude/agents/workflow-verifier.md +0 -1
  12. package/.claude/commands/learn-retro.md +2 -2
  13. package/.claude/commands/learn-second-opinion.md +2 -2
  14. package/.claude/commands/maestro-analyze.md +10 -2
  15. package/.claude/commands/maestro-brainstorm.md +1 -1
  16. package/.claude/commands/maestro-execute.md +21 -4
  17. package/.claude/commands/maestro-milestone-complete.md +14 -0
  18. package/.claude/commands/maestro-plan.md +12 -6
  19. package/.claude/commands/maestro-roadmap.md +1 -1
  20. package/.claude/commands/maestro-ui-design.md +7 -7
  21. package/.claude/commands/maestro-update.md +176 -0
  22. package/.claude/commands/maestro-verify.md +18 -3
  23. package/.claude/commands/manage-codebase-rebuild.md +0 -1
  24. package/.claude/commands/manage-harvest.md +1 -1
  25. package/.claude/commands/manage-learn.md +5 -5
  26. package/.claude/commands/manage-memory-capture.md +4 -4
  27. package/.claude/commands/manage-memory.md +1 -1
  28. package/.claude/commands/manage-wiki.md +62 -0
  29. package/.claude/commands/quality-business-test.md +2 -2
  30. package/.claude/commands/quality-debug.md +53 -7
  31. package/.claude/commands/quality-retrospective.md +5 -5
  32. package/.claude/commands/quality-review.md +39 -7
  33. package/.claude/commands/quality-sync.md +1 -1
  34. package/.claude/commands/quality-test-gen.md +1 -1
  35. package/.claude/commands/quality-test.md +45 -12
  36. package/.claude/commands/spec-remove.md +51 -0
  37. package/.claude/commands/spec-setup.md +1 -3
  38. package/.claude/commands/wiki-connect.md +9 -5
  39. package/.claude/commands/wiki-digest.md +6 -3
  40. package/.codex/skills/maestro/SKILL.md +2 -2
  41. package/.codex/skills/maestro-analyze/SKILL.md +4 -4
  42. package/.codex/skills/maestro-brainstorm/SKILL.md +4 -4
  43. package/.codex/skills/maestro-coordinate/SKILL.md +2 -2
  44. package/.codex/skills/maestro-execute/SKILL.md +15 -5
  45. package/.codex/skills/maestro-init/SKILL.md +1 -1
  46. package/.codex/skills/maestro-milestone-complete/SKILL.md +18 -1
  47. package/.codex/skills/maestro-plan/SKILL.md +6 -6
  48. package/.codex/skills/maestro-roadmap/SKILL.md +3 -4
  49. package/.codex/skills/maestro-spec-generate/SKILL.md +2 -2
  50. package/.codex/skills/maestro-ui-design/SKILL.md +6 -6
  51. package/.codex/skills/maestro-verify/SKILL.md +20 -11
  52. package/.codex/skills/manage-codebase-rebuild/SKILL.md +4 -4
  53. package/.codex/skills/manage-harvest/SKILL.md +10 -1
  54. package/.codex/skills/manage-issue-discover/SKILL.md +3 -3
  55. package/.codex/skills/manage-learn/SKILL.md +3 -2
  56. package/.codex/skills/manage-memory/SKILL.md +3 -3
  57. package/.codex/skills/manage-memory-capture/SKILL.md +8 -14
  58. package/.codex/skills/manage-status/SKILL.md +9 -4
  59. package/.codex/skills/manage-wiki/SKILL.md +55 -0
  60. package/.codex/skills/quality-business-test/SKILL.md +8 -6
  61. package/.codex/skills/quality-debug/SKILL.md +22 -9
  62. package/.codex/skills/quality-integration-test/SKILL.md +11 -7
  63. package/.codex/skills/quality-retrospective/SKILL.md +45 -26
  64. package/.codex/skills/quality-review/SKILL.md +10 -7
  65. package/.codex/skills/quality-test/SKILL.md +9 -4
  66. package/.codex/skills/quality-test-gen/SKILL.md +13 -9
  67. package/.codex/skills/spec-add/SKILL.md +11 -3
  68. package/.codex/skills/spec-load/SKILL.md +7 -0
  69. package/.codex/skills/spec-map/SKILL.md +2 -2
  70. package/.codex/skills/spec-remove/SKILL.md +101 -0
  71. package/.codex/skills/spec-setup/SKILL.md +4 -8
  72. package/.codex/skills/wiki-connect/SKILL.md +6 -5
  73. package/.codex/skills/wiki-digest/SKILL.md +2 -2
  74. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.d.ts +9 -0
  75. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +109 -9
  76. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  77. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js +49 -0
  78. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js.map +1 -1
  79. package/dashboard/dist-server/dashboard/src/server/routes/index.js +5 -4
  80. package/dashboard/dist-server/dashboard/src/server/routes/index.js.map +1 -1
  81. package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +5 -13
  82. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +97 -155
  83. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  84. package/dashboard/dist-server/dashboard/src/server/routes/wiki.d.ts +11 -1
  85. package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js +27 -6
  86. package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +25 -7
  88. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  89. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +8 -0
  90. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
  91. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +1 -0
  92. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  93. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.d.ts +29 -0
  94. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +148 -0
  95. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -0
  96. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +4 -2
  97. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  98. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +8 -2
  99. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  100. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +5 -0
  101. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +80 -38
  102. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  103. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +8 -6
  104. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  105. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +40 -5
  106. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +21 -23
  107. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
  108. package/dashboard/dist-server/dashboard/src/server/wiki/writer.d.ts +33 -3
  109. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +184 -12
  110. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
  111. package/dashboard/dist-server/src/commands/delegate.js +26 -0
  112. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  113. package/dashboard/dist-server/src/coordinator/graph-types.d.ts +11 -1
  114. package/dashboard/dist-server/src/coordinator/graph-walker.js +29 -2
  115. package/dashboard/dist-server/src/coordinator/graph-walker.js.map +1 -1
  116. package/dashboard/dist-server/src/coordinator/prompt-assembler.js +3 -2
  117. package/dashboard/dist-server/src/coordinator/prompt-assembler.js.map +1 -1
  118. package/dashboard/dist-server/src/hooks/constants.d.ts +29 -60
  119. package/dashboard/dist-server/src/hooks/constants.js +105 -82
  120. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  121. package/dashboard/dist-server/src/types/index.d.ts +2 -1
  122. package/dist/src/commands/delegate.d.ts.map +1 -1
  123. package/dist/src/commands/delegate.js +26 -0
  124. package/dist/src/commands/delegate.js.map +1 -1
  125. package/dist/src/commands/hooks.d.ts +2 -4
  126. package/dist/src/commands/hooks.d.ts.map +1 -1
  127. package/dist/src/commands/hooks.js +4 -7
  128. package/dist/src/commands/hooks.js.map +1 -1
  129. package/dist/src/commands/install-ui/InstallConfirm.d.ts +2 -3
  130. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  131. package/dist/src/commands/install-ui/InstallConfirm.js +1 -1
  132. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  133. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  134. package/dist/src/commands/install-ui/InstallExecution.js +1 -2
  135. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  136. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  137. package/dist/src/commands/install-ui/InstallFlow.js +5 -7
  138. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  139. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +3 -6
  140. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  141. package/dist/src/commands/install-ui/StatuslineConfig.js +21 -17
  142. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  143. package/dist/src/commands/update.d.ts.map +1 -1
  144. package/dist/src/commands/update.js +95 -0
  145. package/dist/src/commands/update.js.map +1 -1
  146. package/dist/src/commands/wiki.d.ts.map +1 -1
  147. package/dist/src/commands/wiki.js +75 -11
  148. package/dist/src/commands/wiki.js.map +1 -1
  149. package/dist/src/coordinator/graph-types.d.ts +11 -1
  150. package/dist/src/coordinator/graph-types.d.ts.map +1 -1
  151. package/dist/src/coordinator/graph-walker.d.ts.map +1 -1
  152. package/dist/src/coordinator/graph-walker.js +29 -2
  153. package/dist/src/coordinator/graph-walker.js.map +1 -1
  154. package/dist/src/coordinator/prompt-assembler.d.ts.map +1 -1
  155. package/dist/src/coordinator/prompt-assembler.js +3 -2
  156. package/dist/src/coordinator/prompt-assembler.js.map +1 -1
  157. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +4 -1
  158. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -1
  159. package/dist/src/hooks/__tests__/statusline-visual-test.js +55 -174
  160. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
  161. package/dist/src/hooks/constants.d.ts +29 -60
  162. package/dist/src/hooks/constants.d.ts.map +1 -1
  163. package/dist/src/hooks/constants.js +105 -82
  164. package/dist/src/hooks/constants.js.map +1 -1
  165. package/dist/src/hooks/skill-context.d.ts.map +1 -1
  166. package/dist/src/hooks/skill-context.js +54 -6
  167. package/dist/src/hooks/skill-context.js.map +1 -1
  168. package/dist/src/hooks/statusline.d.ts +11 -8
  169. package/dist/src/hooks/statusline.d.ts.map +1 -1
  170. package/dist/src/hooks/statusline.js +284 -182
  171. package/dist/src/hooks/statusline.js.map +1 -1
  172. package/dist/src/hooks/workspace.d.ts.map +1 -1
  173. package/dist/src/hooks/workspace.js +2 -1
  174. package/dist/src/hooks/workspace.js.map +1 -1
  175. package/dist/src/migrations/_template.d.ts +12 -0
  176. package/dist/src/migrations/_template.d.ts.map +1 -0
  177. package/dist/src/migrations/_template.js +55 -0
  178. package/dist/src/migrations/_template.js.map +1 -0
  179. package/dist/src/migrations/index.d.ts +14 -0
  180. package/dist/src/migrations/index.d.ts.map +1 -0
  181. package/dist/src/migrations/index.js +20 -0
  182. package/dist/src/migrations/index.js.map +1 -0
  183. package/dist/src/migrations/run.d.ts +12 -0
  184. package/dist/src/migrations/run.d.ts.map +1 -0
  185. package/dist/src/migrations/run.js +119 -0
  186. package/dist/src/migrations/run.js.map +1 -0
  187. package/dist/src/migrations/v1-to-v2.d.ts +10 -0
  188. package/dist/src/migrations/v1-to-v2.d.ts.map +1 -0
  189. package/dist/src/migrations/v1-to-v2.js +71 -0
  190. package/dist/src/migrations/v1-to-v2.js.map +1 -0
  191. package/dist/src/tools/team-activity.d.ts.map +1 -1
  192. package/dist/src/tools/team-activity.js +22 -0
  193. package/dist/src/tools/team-activity.js.map +1 -1
  194. package/dist/src/tools/transition-recorder.d.ts +2 -17
  195. package/dist/src/tools/transition-recorder.d.ts.map +1 -1
  196. package/dist/src/tools/transition-recorder.js +6 -3
  197. package/dist/src/tools/transition-recorder.js.map +1 -1
  198. package/dist/src/types/index.d.ts +2 -1
  199. package/dist/src/types/index.d.ts.map +1 -1
  200. package/dist/src/utils/migration-registry.d.ts +65 -0
  201. package/dist/src/utils/migration-registry.d.ts.map +1 -0
  202. package/dist/src/utils/migration-registry.js +117 -0
  203. package/dist/src/utils/migration-registry.js.map +1 -0
  204. package/dist/src/utils/state-schema.d.ts +153 -0
  205. package/dist/src/utils/state-schema.d.ts.map +1 -0
  206. package/dist/src/utils/state-schema.js +329 -0
  207. package/dist/src/utils/state-schema.js.map +1 -0
  208. package/package.json +1 -1
  209. package/templates/state.json +17 -39
  210. package/workflows/brainstorm.md +3 -3
  211. package/workflows/codebase-rebuild.md +2 -12
  212. package/workflows/debug.md +7 -8
  213. package/workflows/execute.md +18 -4
  214. package/workflows/fork.md +37 -86
  215. package/workflows/init.md +1 -4
  216. package/workflows/integration-test.md +4 -5
  217. package/workflows/issue.md +3 -9
  218. package/workflows/learn.md +20 -19
  219. package/workflows/maestro.codex.md +8 -1
  220. package/workflows/maestro.md +12 -3
  221. package/workflows/memory.md +26 -71
  222. package/workflows/merge.md +45 -107
  223. package/workflows/milestone-complete.md +24 -7
  224. package/workflows/retrospective.md +77 -109
  225. package/workflows/review.md +5 -12
  226. package/workflows/specs-remove.md +115 -0
  227. package/workflows/specs-setup.md +10 -32
  228. package/workflows/status.md +291 -290
  229. package/workflows/sync.md +5 -5
  230. package/workflows/test.md +4 -5
  231. package/workflows/ui-style.md +3 -4
  232. package/workflows/verify.md +2 -2
  233. package/workflows/wiki-connect.md +188 -0
  234. package/workflows/wiki-digest.md +221 -0
  235. package/workflows/wiki-manage.md +204 -0
@@ -23,12 +23,11 @@ Input: <phase> argument (number or slug) OR topic text
23
23
  IF argument is a number or matches phase pattern:
24
24
  Read .workflow/state.json → state
25
25
  artifacts = state.artifacts ?? []
26
- IF artifacts.length > 0:
27
- art = artifacts.find(a => a.phase === phaseNum)
26
+ art = artifacts.find(a => a.phase === phaseNum)
27
+ IF art:
28
28
  PHASE_DIR = ".workflow/" + art.path
29
29
  ELSE:
30
- Find .workflow/phases/{NN}-*/index.json
31
- PHASE_DIR = resolved path
30
+ ERROR "Phase {phaseNum} not found in artifact registry"
32
31
  Set SCRATCH_MODE = false
33
32
 
34
33
  ELSE (topic text — scratch mode):
@@ -633,8 +633,8 @@ Fix Plans: {fix_plan_count} generated
633
633
  Human Verification: {human_items} items
634
634
 
635
635
  Files:
636
- {phase_dir}/verification.json
637
- {phase_dir}/validation.json (if generated)
636
+ {artifact_dir}/verification.json
637
+ {artifact_dir}/validation.json (if generated)
638
638
 
639
639
  Next steps:
640
640
  {suggested_next_command}
@@ -0,0 +1,188 @@
1
+ # Wiki Connect Workflow
2
+
3
+ Knowledge graph link discovery and health improvement. Analyzes the unified wiki index to find orphaned entries, missing connections, and transitive link gaps, then suggests or auto-applies new `related` links.
4
+
5
+ **Closed-loop**: wiki-connect improves graph → wiki-digest produces better clusters → learn-follow surfaces richer trails.
6
+
7
+ ---
8
+
9
+ ## Prerequisites
10
+
11
+ - `.workflow/` initialized (`.workflow/state.json` exists)
12
+ - Wiki entries exist (at least 5 for meaningful analysis)
13
+ - `maestro wiki` CLI available
14
+
15
+ ---
16
+
17
+ ## Argument Shape
18
+
19
+ ```
20
+ /wiki-connect → full graph analysis, all types
21
+ /wiki-connect --scope spec → limit to spec entries only
22
+ /wiki-connect --scope memory → limit to memory entries only
23
+ /wiki-connect --min-similarity 0.5 → raise threshold (default: 0.3)
24
+ /wiki-connect --fix → auto-apply top suggestions
25
+ /wiki-connect --max 10 → limit suggestion count (default: 20)
26
+ /wiki-connect --scope spec --fix --max 5 → combined: fix top 5 spec connections
27
+ ```
28
+
29
+ | Flag | Effect |
30
+ |------|--------|
31
+ | `--scope <type>` | Limit to wiki type: spec, memory, note, lesson, issue. Default: all |
32
+ | `--min-similarity N` | Minimum similarity score 0.0-1.0 (default: 0.3) |
33
+ | `--fix` | Auto-apply top suggestions via `maestro wiki update` |
34
+ | `--max N` | Maximum suggestions to generate (default: 20) |
35
+
36
+ ---
37
+
38
+ ## Stage 1: Load Wiki State
39
+
40
+ Run these `maestro wiki` commands in parallel to gather baseline:
41
+
42
+ ```bash
43
+ maestro wiki list --json # all entries with metadata
44
+ maestro wiki health # composite health score
45
+ maestro wiki orphans # entries with 0 in/out links
46
+ maestro wiki hubs --top 10 # most-referenced entries
47
+ ```
48
+
49
+ Parse into working state:
50
+ - Entry count and type distribution (spec, memory, note, lesson, issue)
51
+ - Baseline health score (numeric, from health command)
52
+ - Orphan list with entry IDs and titles
53
+ - Hub list with in-degree counts
54
+
55
+ Apply `--scope` filter if provided — restrict all subsequent analysis to matching type.
56
+
57
+ ---
58
+
59
+ ## Stage 2: Identify Connection Candidates
60
+
61
+ For each entry, compute potential connections across four dimensions:
62
+
63
+ ### 2a. Orphan Rescue
64
+ For each orphan entry:
65
+ 1. `maestro wiki search "<orphan title>"` — BM25 title match
66
+ 2. Tag overlap: entries sharing 2+ tags with the orphan
67
+ 3. Same category: entries with matching `category` field
68
+ 4. Same parent: entries sharing the same `parent` field
69
+
70
+ ### 2b. Missing Bidirectional Links
71
+ Scan forward links (from `maestro wiki graph`):
72
+ - If A → B exists but B → A is missing, suggest adding reverse link
73
+ - Priority: entries where B has low in-degree (would benefit most)
74
+
75
+ ### 2c. Transitive Closure
76
+ For connected pairs A → B and B → C:
77
+ - If A has no link to C, AND A and C share tags or category, suggest A → C
78
+ - Skip if distance >2 hops (avoid over-connecting)
79
+
80
+ ### 2d. Type Bridge
81
+ Detect entries of different types referencing the same concept:
82
+ - e.g., `spec-auth` and `lesson-auth-gotcha` — same domain, different perspectives
83
+ - Use tag overlap + title keyword match to detect shared concepts
84
+ - Only suggest if entries are currently unlinked
85
+
86
+ ---
87
+
88
+ ## Stage 3: Score Candidates
89
+
90
+ For each candidate connection (source → target):
91
+
92
+ ```
93
+ score = 0.4 × tag_overlap_ratio
94
+ + 0.3 × title_bm25_similarity
95
+ + 0.2 × same_category_bonus
96
+ + 0.1 × type_bridge_bonus
97
+ ```
98
+
99
+ - `tag_overlap_ratio`: shared_tags / max(source_tags, target_tags)
100
+ - `title_bm25_similarity`: normalized BM25 score from `maestro wiki search`
101
+ - `same_category_bonus`: 1.0 if same category, else 0.0
102
+ - `type_bridge_bonus`: 1.0 if different types, else 0.0
103
+
104
+ Filter: score >= `--min-similarity`
105
+ Sort: descending by score
106
+ Limit: top `--max` entries
107
+
108
+ ---
109
+
110
+ ## Stage 4: Present Suggestions
111
+
112
+ Display ranked suggestions:
113
+
114
+ ```
115
+ == Wiki Connection Suggestions ==
116
+ Baseline health: 72/100 | Orphans: 8 | Broken links: 3
117
+
118
+ # Score Source → Target Reason
119
+ 1 0.85 memory-auth-flow → spec-auth tag overlap (auth, security) + type bridge
120
+ 2 0.71 note-cache-pattern → spec-performance title BM25 match + type bridge
121
+ 3 0.65 lesson-retry-fix → spec-error-handling tag overlap (error, retry)
122
+ ...
123
+
124
+ Projected health after fix: 81/100 (+9)
125
+ ```
126
+
127
+ If NOT `--fix`: display and exit with next-step hints.
128
+ If `--fix`: proceed to Stage 5.
129
+
130
+ ---
131
+
132
+ ## Stage 5: Apply Connections (--fix only)
133
+
134
+ For each accepted suggestion:
135
+ 1. `maestro wiki get <source-id> --json` — get current entry
136
+ 2. Extract existing `related` list from frontmatter
137
+ 3. Append target-id to `related` if not already present
138
+ 4. `maestro wiki update <source-id> --frontmatter '{"related": ["existing...", "new-target"]}'`
139
+ 5. Log success/failure per entry
140
+
141
+ After all updates:
142
+ - Re-run `maestro wiki health` → compute delta
143
+ - Report applied count, skipped count, and health improvement
144
+
145
+ ---
146
+
147
+ ## Stage 6: Persist & Report
148
+
149
+ 1. Write `.workflow/learning/wiki-connections-{YYYY-MM-DD}.md`:
150
+ - Baseline vs final health scores
151
+ - All suggestions (applied and unapplied) with scores
152
+ - Orphan rescue results
153
+ - Graph structure observations (hub concentration, type distribution)
154
+
155
+ 2. Append graph insights to `.workflow/learning/lessons.jsonl`:
156
+ - `source: "wiki-connect"`, `category: "technique"`
157
+ - e.g., "Auth entries poorly cross-referenced", "Memory entries have highest orphan rate"
158
+
159
+ 3. Display summary:
160
+ ```
161
+ == Wiki Connect Complete ==
162
+ Suggestions: {total} ({applied} applied, {skipped} skipped)
163
+ Health: {baseline} → {new} ({delta})
164
+ Report: .workflow/learning/wiki-connections-{date}.md
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Next Steps
170
+
171
+ | Action | Command |
172
+ |--------|---------|
173
+ | Generate knowledge digest | `/wiki-digest <topic>` |
174
+ | Follow-along on orphan | `/learn-follow <wiki-id>` |
175
+ | View full graph | `maestro wiki graph` |
176
+ | Run harvest for new content | `/manage-harvest --recent 7` |
177
+
178
+ ---
179
+
180
+ ## Error Codes
181
+
182
+ | Code | Severity | Condition | Recovery |
183
+ |------|----------|-----------|----------|
184
+ | E001 | error | No wiki entries found (empty index) | Run `/maestro-init` or create wiki content |
185
+ | E002 | error | `maestro wiki` CLI not available | Check maestro installation |
186
+ | W001 | warning | No candidates above threshold | Lower `--min-similarity` or verify graph connectivity |
187
+ | W002 | warning | Some wiki updates failed during `--fix` | Retry failed entries manually |
188
+ | W003 | warning | Health score unchanged after fix | Connections may not affect specific health metrics |
@@ -0,0 +1,221 @@
1
+ # Wiki Digest Workflow
2
+
3
+ Knowledge synthesis from the wiki knowledge graph. Clusters entries by semantic theme, identifies knowledge gaps, produces coverage heatmaps, and optionally creates knowledge-gap issues.
4
+
5
+ Unlike `maestro wiki list` which shows raw entries, this workflow synthesizes and interprets the knowledge base — producing curated summaries with gap analysis and recommended actions.
6
+
7
+ **Closed-loop**: harvest extracts → wiki stores → wiki-digest synthesizes → gap issues → issue pipeline.
8
+
9
+ ---
10
+
11
+ ## Prerequisites
12
+
13
+ - `.workflow/` initialized
14
+ - Wiki entries exist (at least 5 for meaningful clustering)
15
+ - `maestro wiki` CLI available
16
+ - `.workflow/learning/lessons.jsonl` exists (optional, for cross-reference)
17
+
18
+ ---
19
+
20
+ ## Argument Shape
21
+
22
+ ```
23
+ /wiki-digest → digest entire wiki
24
+ /wiki-digest auth → topic-scoped digest
25
+ /wiki-digest --recent 14 → entries updated in last 14 days
26
+ /wiki-digest --type spec → spec entries only
27
+ /wiki-digest --format full → detailed per-entry summaries
28
+ /wiki-digest auth --create-issues → digest + auto-create gap issues
29
+ ```
30
+
31
+ | Flag | Effect |
32
+ |------|--------|
33
+ | `<topic>` | Search wiki for matching entries via BM25 |
34
+ | `--recent N` | Entries updated within last N days |
35
+ | `--type <type>` | Filter by wiki type: spec, memory, note, lesson, issue |
36
+ | `--format brief\|full` | `brief` = compact (default), `full` = detailed per-entry |
37
+ | `--create-issues` | Auto-create knowledge-gap issues in `issues.jsonl` |
38
+
39
+ ---
40
+
41
+ ## Stage 1: Scope & Load
42
+
43
+ Determine scope from arguments:
44
+
45
+ | Input | Resolution |
46
+ |-------|-----------|
47
+ | `<topic>` | `maestro wiki search "<topic>" --json` |
48
+ | `--recent N` | `maestro wiki list --json` → filter by updated date |
49
+ | `--type <type>` | `maestro wiki list --type <type> --json` |
50
+ | No args | `maestro wiki list --json` (all entries) |
51
+
52
+ Load entry metadata: id, title, tags, status, type, related, summary, category.
53
+
54
+ For `--format full`: also fetch entry bodies via `maestro wiki get <id>` for top entries (by hub score).
55
+
56
+ Run `maestro wiki health` for baseline health metrics.
57
+
58
+ ---
59
+
60
+ ## Stage 2: Theme Clustering
61
+
62
+ Group entries into 3-5 semantic themes using:
63
+
64
+ 1. **Tag co-occurrence**: entries sharing 2+ tags → same cluster
65
+ 2. **Title BM25 similarity**: entries whose titles match each other's keywords
66
+ 3. **Relationship proximity**: entries connected by `related` links → same cluster
67
+ 4. **Type sub-clustering**: if all same type, sub-cluster by content/category
68
+
69
+ Per theme, record:
70
+ - Theme name: dominant tag or keyword
71
+ - Entry count and IDs
72
+ - Type distribution within theme
73
+ - Status distribution (draft/active/completed/archived)
74
+
75
+ ---
76
+
77
+ ## Stage 3: Per-Theme Analysis
78
+
79
+ For each theme, produce:
80
+
81
+ ### Summary Paragraph
82
+ Synthesize what these entries collectively teach. Focus on the knowledge pattern, not individual details.
83
+
84
+ ### Key Entries
85
+ Top 3-5 most important entries by:
86
+ - Hub score (in-degree from `maestro wiki hubs`)
87
+ - Backlink count (from `maestro wiki backlinks <id>`)
88
+ - Recency (recently updated entries weigh more)
89
+
90
+ ### Gap Detection
91
+ - **Broken links**: `[[references]]` that don't resolve within the theme
92
+ - **Orphans**: entries in this theme with no connections
93
+ - **TODO markers**: entries with `?`, "TODO", "TBD" in title or body
94
+ - **Missing perspectives**: theme has specs but no lessons? Issues but no decisions?
95
+
96
+ ### Health Score
97
+ Per-theme health adapted from wiki health formula (entries, connectivity, completeness).
98
+
99
+ ---
100
+
101
+ ## Stage 4: Cross-Reference with Lessons
102
+
103
+ 1. Read `.workflow/learning/lessons.jsonl`
104
+ 2. For each theme, search lessons by keyword match
105
+ 3. Identify **unlinked insights**: lessons that match a theme's keywords but are not referenced by any wiki entry in that theme
106
+ 4. Flag as "knowledge not yet connected to the graph"
107
+
108
+ If `lessons.jsonl` not found, skip with W002 warning.
109
+
110
+ ---
111
+
112
+ ## Stage 5: Coverage Heatmap
113
+
114
+ Build a type × theme matrix showing knowledge density:
115
+
116
+ ```
117
+ Theme 1 Theme 2 Theme 3 Theme 4 Theme 5
118
+ spec ███░░ ░░░░░ █████ ██░░░ ░░░░░
119
+ memory ░░░░░ ████░ ██░░░ ░░░░░ ███░░
120
+ lesson █░░░░ ██░░░ ████░ █░░░░ ░░░░░
121
+ issue ██░░░ ░░░░░ █░░░░ ███░░ ░░░░░
122
+
123
+ Legend: █ = entries exist, ░ = sparse/missing
124
+ ```
125
+
126
+ Empty cells = knowledge gaps. Each gap becomes a candidate for Stage 7.
127
+
128
+ ---
129
+
130
+ ## Stage 6: Write Digest
131
+
132
+ Produce `.workflow/learning/digest-{slug}-{YYYY-MM-DD}.md`:
133
+
134
+ ```markdown
135
+ # Knowledge Digest: {scope description}
136
+ **Generated:** {date} | **Entries:** {count} | **Health:** {score}/100
137
+
138
+ ## Themes
139
+
140
+ ### 1. {Theme Name} ({N} entries)
141
+ {summary paragraph}
142
+
143
+ **Key entries:** {linked entry IDs}
144
+ **Gaps:** {list of missing knowledge}
145
+ **Health:** {score}/100
146
+
147
+ ### 2. {Theme Name} ...
148
+
149
+ ## Coverage Heatmap
150
+ {type × theme matrix}
151
+
152
+ ## Knowledge Gaps
153
+ | Gap | Theme | Type Missing | Suggested Action |
154
+ |-----|-------|-------------|-----------------|
155
+ | No lessons for auth patterns | Security | lesson | /learn-decompose src/auth/ |
156
+
157
+ ## Unlinked Insights
158
+ {lessons.jsonl entries not connected to wiki graph}
159
+
160
+ ## Recommended Actions
161
+ 1. {action}: {reason}
162
+ 2. ...
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Stage 7: Gap → Issue Routing (if --create-issues)
168
+
169
+ For each knowledge gap from Stage 5:
170
+ 1. Dedup: check `.workflow/issues/issues.jsonl` for existing gap with same theme + type
171
+ 2. If new, append to `issues.jsonl` using canonical schema (see `~/.maestro/workflows/issue.md` Step 4):
172
+ - `type`: "knowledge-gap"
173
+ - `status`: "open"
174
+ - `severity`: "low"
175
+ - `source`: "wiki-digest"
176
+ - `tags`: ["knowledge-gap", "{theme-slug}"]
177
+ 3. Report created issue count
178
+
179
+ ---
180
+
181
+ ## Stage 8: Persist
182
+
183
+ 1. Write digest file to `.workflow/learning/`
184
+ 2. Append meta-insights to `.workflow/learning/lessons.jsonl`:
185
+ - `source: "wiki-digest"`, `category: "technique"`
186
+ - e.g., "Auth knowledge concentrated in specs, lacks lessons"
187
+ 3. Display summary:
188
+
189
+ ```
190
+ == Wiki Digest Complete ==
191
+ Scope: {topic or "all"}
192
+ Entries: {count}
193
+ Themes: {theme_count}
194
+ Gaps: {gap_count} identified
195
+ Issues: {created_count} created (if --create-issues)
196
+ Report: .workflow/learning/digest-{slug}-{date}.md
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Next Steps
202
+
203
+ | Action | Command |
204
+ |--------|---------|
205
+ | Deep dive on a theme | `/learn-follow <wiki-id>` |
206
+ | Fix graph connectivity | `/wiki-connect --fix` |
207
+ | Decompose for patterns | `/learn-decompose <path>` |
208
+ | Create missing entries | `maestro wiki create --type <type> --slug <slug>` |
209
+ | Triage gap issues | `/manage-issue list --source wiki-digest` |
210
+
211
+ ---
212
+
213
+ ## Error Codes
214
+
215
+ | Code | Severity | Condition | Recovery |
216
+ |------|----------|-----------|----------|
217
+ | E001 | error | No wiki entries found (empty index) | Initialize wiki content |
218
+ | E002 | error | Topic search returned 0 results | Broaden topic or check wiki |
219
+ | W001 | warning | Too few entries (<5) for meaningful clustering | Themes may be trivial |
220
+ | W002 | warning | `lessons.jsonl` not found | Skip cross-reference |
221
+ | W003 | warning | Some entry bodies failed to load | Partial summaries |
@@ -0,0 +1,204 @@
1
+ # Wiki Manage Workflow
2
+
3
+ Unified wiki knowledge graph management — health monitoring, interactive search, orphan cleanup, and graph statistics.
4
+
5
+ Complements `wiki-connect.md` (link discovery) and `wiki-digest.md` (synthesis) with day-to-day operational tooling.
6
+
7
+ ---
8
+
9
+ ## Prerequisites
10
+
11
+ - `.workflow/` initialized
12
+ - Wiki entries exist
13
+ - `maestro wiki` CLI available
14
+
15
+ ---
16
+
17
+ ## Argument Shape
18
+
19
+ ```
20
+ /manage-wiki → health dashboard (default)
21
+ /manage-wiki health → health dashboard
22
+ /manage-wiki search auth → search for "auth" with follow-up actions
23
+ /manage-wiki cleanup → find orphans, broken links, stale entries
24
+ /manage-wiki cleanup --fix → auto-fix issues
25
+ /manage-wiki stats → graph statistics
26
+ /manage-wiki stats --type spec → spec-only statistics
27
+ ```
28
+
29
+ | Flag | Effect |
30
+ |------|--------|
31
+ | `--type <type>` | Filter: spec, memory, note, lesson, issue |
32
+ | `--fix` | Auto-fix issues during cleanup |
33
+ | `--json` | JSON output |
34
+
35
+ ---
36
+
37
+ ## Subcommand: health (default)
38
+
39
+ ### Step 1: Gather Data
40
+
41
+ Run in parallel:
42
+ ```bash
43
+ maestro wiki health
44
+ maestro wiki list --json
45
+ maestro wiki orphans
46
+ maestro wiki hubs --top 5
47
+ ```
48
+
49
+ ### Step 2: Render Dashboard
50
+
51
+ ```
52
+ == Wiki Health Dashboard ==
53
+ Score: {score}/100
54
+ Entries: {total} ({spec} spec, {memory} memory, {note} note, {lesson} lesson, {issue} issue)
55
+ Broken: {broken_count} broken links
56
+ Orphans: {orphan_count} entries with no connections
57
+ Top Hubs: {hub1} ({degree}), {hub2} ({degree}), ...
58
+
59
+ {score < 50 ? "⚠ Graph needs attention" : score < 75 ? "Graph is fair" : "Graph is healthy"}
60
+
61
+ Quick actions:
62
+ Fix connections: /wiki-connect --fix
63
+ Generate digest: /wiki-digest
64
+ Cleanup orphans: /manage-wiki cleanup --fix
65
+ View full graph: maestro wiki graph
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Subcommand: search <query>
71
+
72
+ ### Step 1: Execute Search
73
+
74
+ ```bash
75
+ maestro wiki search "<query>" --json
76
+ ```
77
+
78
+ ### Step 2: Display Results
79
+
80
+ ```
81
+ == Wiki Search: "{query}" ({count} results) ==
82
+
83
+ # ID Type Title Tags
84
+ 1 spec-auth-001 spec JWT token rotation auth, security, jwt
85
+ 2 memory-auth-flow memory Auth module implementation auth, session
86
+ 3 note-auth-review note Auth code review findings auth, review
87
+
88
+ Actions:
89
+ View: maestro wiki get <id>
90
+ Links: maestro wiki backlinks <id>
91
+ Follow: /learn-follow <id>
92
+ Connect: /wiki-connect --scope <type>
93
+ ```
94
+
95
+ ### Step 3: Interactive Follow-up
96
+
97
+ If not `--json`: offer to view an entry by number selection.
98
+
99
+ ---
100
+
101
+ ## Subcommand: cleanup
102
+
103
+ ### Step 1: Scan Issues
104
+
105
+ Gather:
106
+ ```bash
107
+ maestro wiki health # baseline
108
+ maestro wiki orphans --json # orphaned entries
109
+ maestro wiki graph # broken links from graph structure
110
+ ```
111
+
112
+ ### Step 2: Categorize Issues
113
+
114
+ | Issue Type | Detection | Auto-fix Action |
115
+ |-----------|-----------|----------------|
116
+ | Broken links | Forward link target doesn't exist | Remove broken link from frontmatter |
117
+ | Orphans | No in/out links | Suggest connections via BM25 title match |
118
+ | Stale entries | No updates in 90+ days, status=draft | Flag for review |
119
+ | Empty body | Entry exists but body is empty/placeholder | Flag for review |
120
+
121
+ ### Step 3: Display Issues
122
+
123
+ ```
124
+ == Wiki Cleanup Scan ==
125
+ Baseline health: {score}/100
126
+
127
+ Issues found:
128
+ Broken links: {count}
129
+ Orphans: {count}
130
+ Stale drafts: {count}
131
+ Empty bodies: {count}
132
+
133
+ {list of issues with entry IDs and descriptions}
134
+ ```
135
+
136
+ ### Step 4: Apply Fixes (--fix only)
137
+
138
+ For each fixable issue:
139
+ 1. Broken links: `maestro wiki update <id> --frontmatter '{"related": [filtered_list]}'`
140
+ 2. Orphans: run mini wiki-connect for each orphan (BM25 search + tag match)
141
+ 3. Stale/empty: flag but don't auto-delete (too destructive)
142
+
143
+ Report delta:
144
+ ```
145
+ == Cleanup Complete ==
146
+ Fixed: {fixed_count} issues
147
+ Remaining: {remaining_count} (manual review needed)
148
+ Health: {old_score} → {new_score} ({delta})
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Subcommand: stats
154
+
155
+ ### Step 1: Gather Data
156
+
157
+ ```bash
158
+ maestro wiki list --json
159
+ ```
160
+
161
+ ### Step 2: Compute Statistics
162
+
163
+ - **Type distribution**: count per type (spec, memory, note, lesson, issue)
164
+ - **Tag frequency**: top 20 most-used tags
165
+ - **Category distribution**: entries per category (for specs)
166
+ - **Connectivity**: average in-degree, average out-degree, max hub size
167
+ - **Growth**: entries created per week (from timestamps)
168
+
169
+ ### Step 3: Display
170
+
171
+ ```
172
+ == Wiki Statistics ==
173
+
174
+ Type Distribution:
175
+ spec ████████████████ 32 (40%)
176
+ memory ████████ 16 (20%)
177
+ note ██████████ 20 (25%)
178
+ lesson ████ 8 (10%)
179
+ issue ██ 4 (5%)
180
+ Total: 80
181
+
182
+ Top Tags:
183
+ auth (12), performance (8), error-handling (7), testing (6), ...
184
+
185
+ Connectivity:
186
+ Avg in-degree: 2.3
187
+ Avg out-degree: 1.8
188
+ Hub: spec-auth (in=12)
189
+
190
+ Growth (last 4 weeks):
191
+ Week 1: +5 | Week 2: +8 | Week 3: +3 | Week 4: +12
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Error Codes
197
+
198
+ | Code | Severity | Condition | Recovery |
199
+ |------|----------|-----------|----------|
200
+ | E001 | fatal | `.workflow/` not initialized | Run `/maestro-init` |
201
+ | E002 | fatal | No wiki entries found | Create wiki content first |
202
+ | E003 | error | Invalid subcommand | Valid: health, search, cleanup, stats |
203
+ | W001 | warning | Health score below 50 | Run `/wiki-connect --fix` |
204
+ | W002 | warning | Cleanup had partial failures | Retry manually |