pi-maestro-flow 0.2.0 → 0.3.1

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/README.md +44 -72
  2. package/agents/cross-role-reviewer.md +1 -1
  3. package/agents/impeccable-agent.md +1 -1
  4. package/agents/ralph-executor.md +1 -1
  5. package/agents/team-worker.md +1 -1
  6. package/agents/workflow-analyzer.md +1 -1
  7. package/agents/workflow-codebase-mapper.md +1 -1
  8. package/agents/workflow-collab-planner.md +1 -1
  9. package/agents/workflow-debugger.md +1 -1
  10. package/agents/workflow-executor.md +1 -1
  11. package/agents/workflow-integration-checker.md +1 -1
  12. package/agents/workflow-nyquist-auditor.md +1 -1
  13. package/agents/workflow-phase-researcher.md +1 -1
  14. package/agents/workflow-planner.md +1 -1
  15. package/agents/workflow-project-researcher.md +1 -1
  16. package/agents/workflow-reviewer.md +1 -1
  17. package/agents/workflow-verifier.md +1 -1
  18. package/package.json +18 -4
  19. package/skills/codify-to-knowhow/SKILL.md +1 -1
  20. package/skills/delegation-check/SKILL.md +1 -1
  21. package/skills/domain-add/SKILL.md +5 -5
  22. package/skills/insight-challenge/SKILL.md +1 -1
  23. package/skills/learn-decompose/SKILL.md +4 -4
  24. package/skills/learn-follow/SKILL.md +5 -5
  25. package/skills/learn-investigate/SKILL.md +5 -5
  26. package/skills/learn-second-opinion/SKILL.md +5 -5
  27. package/skills/maestro/SKILL.md +8 -8
  28. package/skills/maestro-amend/SKILL.md +4 -4
  29. package/skills/maestro-analyze/SKILL.md +9 -9
  30. package/skills/maestro-blueprint/SKILL.md +7 -7
  31. package/skills/maestro-brainstorm/SKILL.md +10 -10
  32. package/skills/maestro-collab/SKILL.md +4 -4
  33. package/skills/maestro-companion/SKILL.md +3 -3
  34. package/skills/maestro-composer/SKILL.md +10 -10
  35. package/skills/maestro-execute/SKILL.md +8 -8
  36. package/skills/maestro-fork/SKILL.md +7 -7
  37. package/skills/maestro-grill/SKILL.md +12 -12
  38. package/skills/maestro-guard/SKILL.md +5 -5
  39. package/skills/maestro-help/SKILL.md +3 -3
  40. package/skills/maestro-impeccable/SKILL.md +7 -7
  41. package/skills/maestro-init/SKILL.md +8 -8
  42. package/skills/maestro-merge/SKILL.md +6 -6
  43. package/skills/maestro-milestone-audit/SKILL.md +3 -3
  44. package/skills/maestro-milestone-complete/SKILL.md +8 -8
  45. package/skills/maestro-milestone-release/SKILL.md +9 -9
  46. package/skills/maestro-next/SKILL.md +5 -5
  47. package/skills/maestro-overlay/SKILL.md +19 -19
  48. package/skills/maestro-plan/SKILL.md +8 -8
  49. package/skills/maestro-player/SKILL.md +5 -5
  50. package/skills/maestro-quick/SKILL.md +5 -5
  51. package/skills/maestro-ralph/SKILL.md +15 -15
  52. package/skills/maestro-ralph-cli/SKILL.md +6 -6
  53. package/skills/maestro-ralph-cli-execute/SKILL.md +2 -2
  54. package/skills/maestro-ralph-execute/SKILL.md +4 -4
  55. package/skills/maestro-ralph-v2/SKILL.md +17 -17
  56. package/skills/maestro-roadmap/SKILL.md +7 -7
  57. package/skills/maestro-swarm-workflow/SKILL.md +9 -9
  58. package/skills/maestro-tools-execute/SKILL.md +5 -5
  59. package/skills/maestro-tools-register/SKILL.md +7 -7
  60. package/skills/maestro-ui-codify/SKILL.md +8 -8
  61. package/skills/maestro-universal-workflow/SKILL.md +15 -15
  62. package/skills/maestro-update/SKILL.md +10 -10
  63. package/skills/manage-codebase-rebuild/SKILL.md +4 -4
  64. package/skills/manage-drift-realign/SKILL.md +7 -7
  65. package/skills/manage-harvest/SKILL.md +5 -5
  66. package/skills/manage-issue/SKILL.md +4 -4
  67. package/skills/manage-issue-discover/SKILL.md +7 -7
  68. package/skills/manage-kg-extractors/SKILL.md +3 -3
  69. package/skills/manage-knowhow/SKILL.md +3 -3
  70. package/skills/manage-knowhow-capture/SKILL.md +4 -4
  71. package/skills/manage-knowledge-audit/SKILL.md +5 -5
  72. package/skills/manage-status/SKILL.md +3 -3
  73. package/skills/manage-wiki/SKILL.md +5 -5
  74. package/skills/odyssey-debug/SKILL.md +13 -13
  75. package/skills/odyssey-improve/SKILL.md +15 -15
  76. package/skills/odyssey-planex/SKILL.md +16 -16
  77. package/skills/odyssey-review-test-fix/SKILL.md +11 -11
  78. package/skills/odyssey-ui/SKILL.md +10 -10
  79. package/skills/prompt-generator/SKILL.md +5 -5
  80. package/skills/quality-auto-test/SKILL.md +3 -3
  81. package/skills/quality-debug/SKILL.md +3 -3
  82. package/skills/quality-refactor/SKILL.md +3 -3
  83. package/skills/quality-retrospective/SKILL.md +9 -9
  84. package/skills/quality-review/SKILL.md +4 -4
  85. package/skills/quality-sync/SKILL.md +3 -3
  86. package/skills/quality-test/SKILL.md +4 -4
  87. package/skills/scholar-anti-ai-writing/SKILL.md +1 -1
  88. package/skills/scholar-citation-verify/SKILL.md +1 -1
  89. package/skills/scholar-experiment/SKILL.md +2 -2
  90. package/skills/scholar-ideation/SKILL.md +7 -7
  91. package/skills/scholar-latex-organizer/SKILL.md +1 -1
  92. package/skills/scholar-publish/SKILL.md +3 -3
  93. package/skills/scholar-rebuttal-pro/SKILL.md +3 -3
  94. package/skills/scholar-review/SKILL.md +1 -1
  95. package/skills/scholar-writing/SKILL.md +1 -1
  96. package/skills/security-audit/SKILL.md +2 -2
  97. package/skills/skill-generator/SKILL.md +3 -3
  98. package/skills/skill-iter-tune/SKILL.md +3 -3
  99. package/skills/skill-simplify/SKILL.md +1 -1
  100. package/skills/skill-tuning/SKILL.md +1 -1
  101. package/skills/spec-add/SKILL.md +5 -5
  102. package/skills/spec-load/SKILL.md +3 -3
  103. package/skills/spec-remove/SKILL.md +4 -4
  104. package/skills/spec-setup/SKILL.md +6 -6
  105. package/skills/team-adversarial-swarm/SKILL.md +5 -5
  106. package/skills/team-arch-opt/SKILL.md +2 -2
  107. package/skills/team-brainstorm/SKILL.md +3 -3
  108. package/skills/team-coordinate/SKILL.md +4 -4
  109. package/skills/team-designer/SKILL.md +1 -1
  110. package/skills/team-executor/SKILL.md +3 -3
  111. package/skills/team-frontend/SKILL.md +2 -2
  112. package/skills/team-frontend-debug/SKILL.md +3 -3
  113. package/skills/team-interactive-craft/SKILL.md +2 -2
  114. package/skills/team-issue/SKILL.md +3 -3
  115. package/skills/team-lifecycle-v4/SKILL.md +4 -4
  116. package/skills/team-motion-design/SKILL.md +2 -2
  117. package/skills/team-perf-opt/SKILL.md +3 -3
  118. package/skills/team-planex/SKILL.md +2 -2
  119. package/skills/team-quality-assurance/SKILL.md +3 -3
  120. package/skills/team-review/SKILL.md +3 -3
  121. package/skills/team-roadmap-dev/SKILL.md +3 -3
  122. package/skills/team-swarm/SKILL.md +4 -4
  123. package/skills/team-tech-debt/SKILL.md +2 -2
  124. package/skills/team-testing/SKILL.md +3 -3
  125. package/skills/team-ui-polish/SKILL.md +2 -2
  126. package/skills/team-uidesign/SKILL.md +2 -2
  127. package/skills/team-ultra-analyze/SKILL.md +4 -4
  128. package/skills/team-ux-improve/SKILL.md +3 -3
  129. package/skills/team-visual-a11y/SKILL.md +2 -2
  130. package/skills/workflow-skill-designer/SKILL.md +8 -8
  131. package/templates/business-test-report.json +68 -0
  132. package/templates/config.json +48 -0
  133. package/templates/context.md +16 -0
  134. package/templates/doc-index.json +11 -0
  135. package/templates/index.json +68 -0
  136. package/templates/issue.json +36 -0
  137. package/templates/plan.json +38 -0
  138. package/templates/project.md +60 -0
  139. package/templates/reflection-log.md +20 -0
  140. package/templates/roadmap.md +45 -0
  141. package/templates/scratch-index.json +19 -0
  142. package/templates/search-tool.json +1 -0
  143. package/templates/search-tools.md +47 -0
  144. package/templates/state.json +18 -0
  145. package/templates/task-summary.md +21 -0
  146. package/templates/task.json +89 -0
  147. package/templates/terminology-template.json +22 -0
  148. package/templates/uat.md +21 -0
  149. package/templates/validation.json +31 -0
  150. package/templates/verification.json +37 -0
  151. package/templates/workflow.md +14 -0
  152. package/templates/worktree-scope.json +9 -0
  153. package/templates/worktrees.json +26 -0
  154. package/workflows/agy-instructions.md +156 -0
  155. package/workflows/analyze.md +768 -0
  156. package/workflows/auto-test.md +705 -0
  157. package/workflows/blueprint.md +406 -0
  158. package/workflows/boundary-grill.md +50 -0
  159. package/workflows/brainstorm.md +508 -0
  160. package/workflows/business-test.md +574 -0
  161. package/workflows/chinese-response.md +25 -0
  162. package/workflows/claude-instructions.md +167 -0
  163. package/workflows/codebase-rebuild.md +267 -0
  164. package/workflows/codebase-refresh.md +168 -0
  165. package/workflows/codex-instructions.md +156 -0
  166. package/workflows/coding-philosophy.md +70 -0
  167. package/workflows/command-authoring.md +823 -0
  168. package/workflows/debug.md +409 -0
  169. package/workflows/delegate-usage.md +99 -0
  170. package/workflows/domain-add.md +121 -0
  171. package/workflows/drift-realign.md +396 -0
  172. package/workflows/execute.md +631 -0
  173. package/workflows/explore-usage.md +93 -0
  174. package/workflows/finish-work.md +124 -0
  175. package/workflows/fork.md +162 -0
  176. package/workflows/grill.md +494 -0
  177. package/workflows/harvest.md +478 -0
  178. package/workflows/impeccable.md +168 -0
  179. package/workflows/init.md +157 -0
  180. package/workflows/instruction-authoring-guide.md +97 -0
  181. package/workflows/integration-test.md +186 -0
  182. package/workflows/interview-mechanics.md +8 -0
  183. package/workflows/issue-analyze.md +20 -0
  184. package/workflows/issue-discover.md +238 -0
  185. package/workflows/issue-execute.md +110 -0
  186. package/workflows/issue-gaps-analyze.codex.md +256 -0
  187. package/workflows/issue-gaps-analyze.md +215 -0
  188. package/workflows/issue-plan.md +110 -0
  189. package/workflows/issue.md +338 -0
  190. package/workflows/knowhow.md +429 -0
  191. package/workflows/knowledge-audit.md +355 -0
  192. package/workflows/learn.md +271 -0
  193. package/workflows/maestro-chain-execute.md +20 -0
  194. package/workflows/maestro-link-coordinate.md +114 -0
  195. package/workflows/maestro-super.md +120 -0
  196. package/workflows/maestro.md +501 -0
  197. package/workflows/map.md +74 -0
  198. package/workflows/merge.md +122 -0
  199. package/workflows/milestone-audit.md +155 -0
  200. package/workflows/milestone-complete.md +167 -0
  201. package/workflows/milestone-release.md +82 -0
  202. package/workflows/odyssey-base-codex.md +305 -0
  203. package/workflows/odyssey-base.md +256 -0
  204. package/workflows/overlays.md +109 -0
  205. package/workflows/plan.md +520 -0
  206. package/workflows/quick.md +350 -0
  207. package/workflows/ralph-amend-goal.md +177 -0
  208. package/workflows/refactor.md +87 -0
  209. package/workflows/retrospective.md +471 -0
  210. package/workflows/review.md +448 -0
  211. package/workflows/roadmap-common.md +193 -0
  212. package/workflows/roadmap.md +106 -0
  213. package/workflows/shell-exec-protocol.md +30 -0
  214. package/workflows/skill-authoring.md +265 -0
  215. package/workflows/spec-generate.md +475 -0
  216. package/workflows/specs-add.md +123 -0
  217. package/workflows/specs-load.md +76 -0
  218. package/workflows/specs-remove.md +104 -0
  219. package/workflows/specs-setup.md +316 -0
  220. package/workflows/status.md +149 -0
  221. package/workflows/sync.md +116 -0
  222. package/workflows/tdd.md +255 -0
  223. package/workflows/test-gen.md +226 -0
  224. package/workflows/test.md +385 -0
  225. package/workflows/tools-spec.md +70 -0
  226. package/workflows/ui-codify-extract.md +372 -0
  227. package/workflows/ui-codify-knowhow.md +258 -0
  228. package/workflows/ui-codify-package.md +159 -0
  229. package/workflows/ui-codify.md +227 -0
  230. package/workflows/ui-design.md +393 -0
  231. package/workflows/ui-style.md +201 -0
  232. package/workflows/verify.md +557 -0
  233. package/workflows/wiki-connect.md +153 -0
  234. package/workflows/wiki-digest.md +180 -0
  235. package/workflows/wiki-manage.md +113 -0
@@ -0,0 +1,153 @@
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, knowhow, note, 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
+ Gather baseline in parallel via `maestro wiki list --json`, `health`, `orphans`, `hubs --top 10`.
41
+
42
+ MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: graph operations (`orphans`, `hubs --top 10`) — use the `maestro wiki` CLI to compute in-degree and orphan sets.
43
+
44
+ Working state: entry count by type, baseline health score, orphan IDs, hub in-degree counts.
45
+
46
+ Apply `--scope` filter if provided — restrict all subsequent analysis to matching type.
47
+
48
+ ---
49
+
50
+ ## Stage 2: Identify Connection Candidates
51
+
52
+ For each entry, compute potential connections across four dimensions:
53
+
54
+ ### 2a. Orphan Rescue
55
+ For each orphan entry:
56
+ 1. `maestro wiki search "<orphan title>"` — BM25 title match
57
+ 2. Tag overlap: entries sharing 2+ tags with the orphan
58
+ 3. Same category: entries with matching `category` field
59
+ 4. Same parent: entries sharing the same `parent` field
60
+
61
+ ### 2b. Missing Bidirectional Links
62
+ Scan forward links (from `maestro wiki graph`):
63
+ - If A → B exists but B → A is missing, suggest adding reverse link
64
+ - Priority: entries where B has low in-degree (would benefit most)
65
+
66
+ ### 2c. Transitive Closure
67
+ For connected pairs A → B and B → C:
68
+ - If A has no link to C, AND A and C share tags or category, suggest A → C
69
+ - Skip if distance >2 hops (avoid over-connecting)
70
+
71
+ ### 2d. Type Bridge
72
+ Detect entries of different types referencing the same concept:
73
+ - e.g., `spec-auth` and `knowhow-auth-gotcha` — same domain, different perspectives
74
+ - Use tag overlap + title keyword match to detect shared concepts
75
+ - Only suggest if entries are currently unlinked
76
+
77
+ ---
78
+
79
+ ## Stage 3: Score Candidates
80
+
81
+ Score each candidate connection (source → target):
82
+
83
+ ```
84
+ score = 0.4 × tag_overlap_ratio + 0.3 × title_bm25_similarity + 0.2 × same_category_bonus + 0.1 × type_bridge_bonus
85
+ ```
86
+
87
+ Ratios: tag_overlap = shared/max(source,target) tags, BM25 = normalized wiki search, category/type bonuses = 1.0 if match/bridge.
88
+
89
+ Filter: score >= `--min-similarity`, sort descending, limit to `--max`.
90
+
91
+ ---
92
+
93
+ ## Stage 4: Present Suggestions
94
+
95
+ Display ranked suggestions:
96
+
97
+ ```
98
+ == Wiki Connection Suggestions ==
99
+ Baseline health: 72/100 | Orphans: 8 | Broken links: 3
100
+
101
+ # Score Source → Target Reason
102
+ 1 0.85 memory-auth-flow → spec-auth tag overlap (auth, security) + type bridge
103
+ 2 0.71 note-cache-pattern → spec-performance title BM25 match + type bridge
104
+ 3 0.65 knowhow-retry-fix → spec-error-handling tag overlap (error, retry)
105
+ ...
106
+
107
+ Projected health after fix: 81/100 (+9)
108
+ ```
109
+
110
+ If NOT `--fix`: display and exit with next-step hints.
111
+ If `--fix`: proceed to Stage 5.
112
+
113
+ ---
114
+
115
+ ## Stage 5: Apply Connections (--fix only)
116
+
117
+ For each accepted suggestion: fetch entry, append target-id to `related` list (dedup), update via `maestro wiki update <source-id> --frontmatter`.
118
+
119
+ After all updates: re-run `maestro wiki health`, report applied/skipped counts and health delta.
120
+
121
+ ---
122
+
123
+ ## Stage 6: Persist & Report
124
+
125
+ 1. Write `.workflow/knowhow/KNW-wiki-connections-{YYYY-MM-DD}.md`:
126
+ - Baseline vs final health scores
127
+ - All suggestions (applied and unapplied) with scores
128
+ - Orphan rescue results
129
+ - Graph structure observations (hub concentration, type distribution)
130
+
131
+ 2. Append graph insights as `<spec-entry>` to `.workflow/specs/learnings.md`:
132
+ - `source="wiki-connect"`, `category="technique"`
133
+ - e.g., "Auth entries poorly cross-referenced", "Memory entries have highest orphan rate"
134
+
135
+ 3. Display summary:
136
+ ```
137
+ == Wiki Connect Complete ==
138
+ Suggestions: {total} ({applied} applied, {skipped} skipped)
139
+ Health: {baseline} → {new} ({delta})
140
+ Report: .workflow/knowhow/KNW-wiki-connections-{date}.md
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Next Steps
146
+
147
+ | Action | Command |
148
+ |--------|---------|
149
+ | Generate knowledge digest | `/wiki-digest <topic>` |
150
+ | Follow-along on orphan | `/learn-follow <wiki-id>` |
151
+ | View full graph | `maestro wiki graph` |
152
+ | Run harvest for new content | `/manage-harvest --recent 7` |
153
+
@@ -0,0 +1,180 @@
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/specs/learnings.md` 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, knowhow, note, 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 by: tag co-occurrence (2+ shared tags), title BM25 similarity, relationship proximity (`related` links), and type sub-clustering.
63
+
64
+ Per theme: name (dominant tag), entry count/IDs, type distribution, status distribution.
65
+
66
+ ---
67
+
68
+ ## Stage 3: Per-Theme Analysis
69
+
70
+ For each theme, produce:
71
+
72
+ ### Summary Paragraph
73
+ Synthesize what these entries collectively teach. Focus on the knowledge pattern, not individual details.
74
+
75
+ ### Key Entries
76
+ Top 3-5 most important entries by:
77
+ - MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: Hub score (in-degree from `maestro wiki hubs`)
78
+ - MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: Backlink count (from `maestro wiki backlinks <id>`)
79
+ - Recency (recently updated entries weigh more)
80
+
81
+ ### Gap Detection
82
+ - **Broken links**: `[[references]]` that don't resolve within the theme
83
+ - **Orphans**: entries in this theme with no connections
84
+ - **TODO markers**: entries with `?`, "TODO", "TBD" in title or body
85
+ - **Missing perspectives**: theme has specs but no knowhow? Issues but no decisions?
86
+
87
+ ### Health Score
88
+ Per-theme health adapted from wiki health formula (entries, connectivity, completeness).
89
+
90
+ ---
91
+
92
+ ## Stage 4: Cross-Reference with Knowhow Insights
93
+
94
+ Search via `maestro wiki search` or parse `.workflow/specs/learnings.md` for keyword matches against each theme. Flag **unlinked insights** — learning entries matching a theme but not referenced by any wiki entry in that theme.
95
+
96
+ If `learnings.md` not found, skip with W002 warning; mark digest cross-reference as [LOW CONFIDENCE] (learnings.md missing).
97
+
98
+ ---
99
+
100
+ ## Stage 5: Coverage Heatmap
101
+
102
+ Build a type × theme matrix showing knowledge density:
103
+
104
+ ```
105
+ Theme 1 Theme 2 Theme 3 Theme 4 Theme 5
106
+ spec ███░░ ░░░░░ █████ ██░░░ ░░░░░
107
+ knowhow ░░░░░ ████░ ██░░░ ░░░░░ ███░░
108
+ note █░░░░ ██░░░ ████░ █░░░░ ░░░░░
109
+ issue ██░░░ ░░░░░ █░░░░ ███░░ ░░░░░
110
+
111
+ Legend: █ = entries exist, ░ = sparse/missing
112
+ ```
113
+
114
+ Empty cells = knowledge gaps. Each gap becomes a candidate for Stage 7.
115
+
116
+ ---
117
+
118
+ ## Stage 6: Write Digest
119
+
120
+ Produce `.workflow/knowhow/KNW-digest-{slug}-{YYYY-MM-DD}.md`:
121
+
122
+ ```markdown
123
+ # Knowledge Digest: {scope description}
124
+ **Generated:** {date} | **Entries:** {count} | **Health:** {score}/100
125
+
126
+ ## Themes
127
+
128
+ ### 1. {Theme Name} ({N} entries)
129
+ {summary paragraph}
130
+
131
+ **Key entries:** {linked entry IDs}
132
+ **Gaps:** {list of missing knowledge}
133
+ **Health:** {score}/100
134
+
135
+ ### 2. {Theme Name} ...
136
+
137
+ ## Coverage Heatmap
138
+ {type × theme matrix}
139
+
140
+ ## Knowledge Gaps
141
+ | Gap | Theme | Type Missing | Suggested Action |
142
+ |-----|-------|-------------|-----------------|
143
+ | No knowhow for auth patterns | Security | knowhow | /learn-decompose src/auth/ |
144
+
145
+ ## Unlinked Insights
146
+ {knowhow entries not connected to wiki graph}
147
+
148
+ ## Recommended Actions
149
+ 1. {action}: {reason}
150
+ 2. ...
151
+ ```
152
+
153
+ ---
154
+
155
+ GATE Stage 6→7: gaps identified BEFORE issue routing; BLOCKED if no gaps identified in Stage 5
156
+
157
+ ## Stage 7: Gap → Issue Routing (if --create-issues)
158
+
159
+ For each knowledge gap from Stage 5: dedup against `.workflow/issues/issues.jsonl` (same theme + type). If new, append with `type: "knowledge-gap"`, `status: "open"`, `severity: "low"`, `source: "wiki-digest"`, `tags: ["knowledge-gap", "{theme-slug}"]`. Report created count.
160
+
161
+ ---
162
+
163
+ ## Stage 8: Persist
164
+
165
+ 1. Write digest file to `.workflow/knowhow/`
166
+ 2. Append meta-insights as `<spec-entry>` to `.workflow/specs/learnings.md` (`source="wiki-digest"`, `category="technique"`)
167
+ 3. Display summary: scope, entry count, theme count, gap count, created issues (if applicable), report path.
168
+
169
+ ---
170
+
171
+ ## Next Steps
172
+
173
+ | Action | Command |
174
+ |--------|---------|
175
+ | Deep dive on a theme | `/learn-follow <wiki-id>` |
176
+ | Fix graph connectivity | `/wiki-connect --fix` |
177
+ | Decompose for patterns | `/learn-decompose <path>` |
178
+ | Create missing entries | `maestro wiki create --type <type> --slug <slug>` |
179
+ | Triage gap issues | `/manage-issue list --source wiki-digest` |
180
+
@@ -0,0 +1,113 @@
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, knowhow, note, 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: `maestro wiki health`, `list --json`, `orphans`, `hubs --top 5`.
42
+
43
+ MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: graph operations (`orphans`, `hubs --top 5`) — use the `maestro wiki` CLI to compute orphan sets and hub in-degree.
44
+
45
+ ### Step 2: Render Dashboard
46
+
47
+ Display: health score, entry counts by type, broken links, orphan count, top hubs. Include health status message and quick-action commands (`/wiki-connect --fix`, `/wiki-digest`, `/manage-wiki cleanup --fix`, `maestro wiki graph`).
48
+
49
+ > **Scope split (complementary, not conflicting):** `/wiki-connect --fix` repairs/augments `related` links between existing entries (no deletion). `/manage-wiki cleanup --fix` deletes/flags orphans and removes broken-link entries from frontmatter. Run `wiki-connect` first to maximize link recovery, then `cleanup` to handle the true residual orphans.
50
+
51
+ ---
52
+
53
+ ## Subcommand: search <query>
54
+
55
+ ### Step 1: Execute Search
56
+
57
+ ```bash
58
+ maestro wiki search "<query>" --json
59
+ ```
60
+
61
+ ### Step 2: Display Results
62
+
63
+ Show table of results (ID, type, title, tags) with action hints: `maestro wiki get <id>`, `backlinks <id>`, `/learn-follow <id>`, `/wiki-connect --scope <type>`.
64
+
65
+ ### Step 3: Interactive Follow-up
66
+
67
+ If not `--json`: offer to view an entry by number selection.
68
+
69
+ ---
70
+
71
+ ## Subcommand: cleanup
72
+
73
+ ### Step 1: Scan Issues
74
+
75
+ Gather baseline via `maestro wiki health`, `orphans --json`, `graph`.
76
+
77
+ MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: graph operations (`orphans --json`, `graph`) — use the `maestro wiki` CLI to compute orphans and graph topology.
78
+
79
+ ### Step 2: Categorize Issues
80
+
81
+ | Issue Type | Detection | Auto-fix Action |
82
+ |-----------|-----------|----------------|
83
+ | Broken links | Forward link target doesn't exist | Remove broken link from frontmatter |
84
+ | Orphans | No in/out links | Suggest connections via BM25 title match |
85
+ | Stale entries | No updates in 90+ days, status=draft | Flag for review |
86
+ | Empty body | Entry exists but body is empty/placeholder | Flag for review |
87
+
88
+ ### Step 3: Display Issues
89
+
90
+ Show baseline health, issue counts by type, and entry-level details.
91
+
92
+ ### Step 4: Apply Fixes (--fix only)
93
+
94
+ Broken links: remove from frontmatter via `maestro wiki update`. Orphans: mini wiki-connect (BM25 + tag match). Stale/empty: flag only (no auto-delete).
95
+
96
+ Report: fixed count, remaining count, health delta.
97
+
98
+ ---
99
+
100
+ ## Subcommand: stats
101
+
102
+ ### Step 1: Gather Data
103
+
104
+ ```bash
105
+ maestro wiki list --json
106
+ ```
107
+
108
+ ### Step 2: Compute & Display Statistics
109
+
110
+ Compute: type distribution (count/%), top 20 tags, category distribution (specs), connectivity (avg in/out-degree, max hub), growth (entries/week).
111
+
112
+ Display as bar charts and summary tables.
113
+