pi-maestro-flow 0.2.0

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 (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: spec-add
3
+ description: "Add spec entry by category with role tagging Arguments: [--scope project|global|team|personal] [-y] <category> <content>"
4
+ allowed-tools: Read Write Bash Glob Grep AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Add `<spec-entry>` to specs by category. 4 scopes: project (default), global, team, personal.
9
+ </purpose>
10
+
11
+ <required_reading>
12
+ @~/.maestro/workflows/specs-add.md
13
+ </required_reading>
14
+
15
+ <context>
16
+ $ARGUMENTS -- expects `[--scope <scope>] [--uid <uid>] <category> <content>`
17
+
18
+ **Options:**
19
+ - `--description <desc>` — One-line description for search results (falls back to content[:240])
20
+ - `--json` — Output JSON with generated `sid` (needed for supersession: `maestro spec supersede <old-sid> --by <new-sid>`)
21
+ - `--ref <path>` — Create as index entry referencing a knowhow document. If the path exists, only creates the spec index entry. If path doesn't exist, also creates the knowhow file.
22
+ - `--knowhow-type <type>` — Knowhow document type when creating with --ref (asset, blueprint, document, template, recipe, reference, decision)
23
+
24
+ Scope-to-directory mapping, category-to-file mapping, and entry format defined in workflow specs-add.md.
25
+
26
+ **Examples:**
27
+ ```bash
28
+ # English content → English keywords
29
+ /spec-add coding "Named exports" "Always use named exports" --keywords "exports,naming"
30
+
31
+ # With description for search results
32
+ /spec-add coding "OAuth PKCE Flow" "完整 PKCE 集成流程" --keywords "oauth,pkce" --description "OAuth 2.0 PKCE 认证流程规范"
33
+
34
+ # Chinese content → Chinese keywords
35
+ /spec-add coding "命名导出规范" "始终使用命名导出" --keywords "导出,命名,模块"
36
+
37
+ # Ref mode
38
+ /spec-add arch "OAuth PKCE 集成" "完整流程设计" --ref knowhow/AST-oauth-flow.md
39
+ ```
40
+ </context>
41
+
42
+ <invariants>
43
+ 1. **Idempotent append** — duplicate entry ID MUST be rejected (E003-level check on title + category match before write)
44
+ 2. **Category validation** — category MUST be one of: coding, arch, quality, debug, test, review, learning, ui. Invalid category → E003
45
+ 3. **Scope isolation** — writes target ONLY the scope-resolved directory; project scope NEVER writes to global (~/.maestro/specs/), global scope NEVER writes to project (.workflow/specs/)
46
+ 4. **Confirmation gate** — MUST AskUserQuestion before appending entry (unless -y flag); NEVER write without user confirmation in interactive mode
47
+ 5. **Entry format invariance** — all entries MUST use `<spec-entry>` closed-tag format with id, keywords, and category attributes
48
+ 6. **Output boundary** — ALL file writes MUST target the scope-resolved specs directory (.workflow/specs/, ~/.maestro/specs/, .workflow/collab/specs/, or .workflow/collab/{uid}/specs/) and optionally .workflow/knowhow/ for --ref mode. NEVER modify source code or files outside these paths
49
+ </invariants>
50
+
51
+ <execution>
52
+ Follow '~/.maestro/workflows/specs-add.md' completely.
53
+
54
+ ### Phase Gates (MANDATORY, BLOCKING)
55
+
56
+ **GATE 1: Parse → Validate**
57
+ - REQUIRED: Category and content both parsed from arguments.
58
+ - REQUIRED: Category is a valid value (coding, arch, quality, debug, test, review, learning, ui).
59
+ - REQUIRED: Scope resolved to a valid directory path.
60
+ - BLOCKED if: E001 (missing args), E003 (invalid category), E004 (invalid scope), E005 (personal scope without uid).
61
+
62
+ **GATE 2: Validate → Format**
63
+ - REQUIRED: Specs directory exists for the resolved scope.
64
+ - REQUIRED: No duplicate entry with identical title + category already present in target file.
65
+ - BLOCKED if: E002 (specs not initialized).
66
+
67
+ **GATE 3: Format → Write**
68
+ - REQUIRED: `<spec-entry>` block formatted with id, keywords, category attributes.
69
+ - REQUIRED: User confirmation via AskUserQuestion (unless -y flag).
70
+ - BLOCKED if: user declines confirmation — abort without writing.
71
+
72
+ **Confirmation gate**: Unless -y flag is passed, after formatting the `<spec-entry>` block but before appending to the target file, AskUserQuestion showing the formatted entry, target file path, and scope. Proceed only on user confirm.
73
+ </execution>
74
+
75
+ <error_codes>
76
+ | Code | Severity | Description | Stage |
77
+ |------|----------|-------------|-------|
78
+ | E001 | fatal | Category and content are both required | parse_input |
79
+ | E002 | fatal | Specs directory not initialized -- run `maestro spec init --scope <scope>` | validate_entry |
80
+ | E003 | fatal | Invalid category -- must be one of: coding, arch, quality, debug, test, review, learning, ui | parse_input |
81
+ | E004 | fatal | Invalid scope -- must be one of: project, global, team, personal | parse_input |
82
+ | E005 | fatal | Personal scope requires uid -- use `--uid` or run `maestro collab join` first | parse_input |
83
+ </error_codes>
84
+
85
+ <success_criteria>
86
+ - [ ] Scope and category parsed and validated
87
+ - [ ] Keywords auto-extracted from content (3-5 relevant terms)
88
+ - [ ] Entry written in `<spec-entry>` closed-tag format
89
+ - [ ] Entry appended to correct target file for scope
90
+ - [ ] Confirmation report displayed with scope, path, keywords
91
+ - [ ] Next step routed
92
+ </success_criteria>
93
+
94
+ <completion>
95
+ ### Next-step routing
96
+
97
+ | Condition | Suggestion |
98
+ |-----------|-----------|
99
+ | Verify entry added | `maestro load --type spec --scope <scope> --keyword {keyword}` |
100
+ | New entry replaces old one | `maestro spec supersede <old-sid> --by <new-sid>` |
101
+ | View evolution chain | `maestro spec history <sid>` |
102
+ | Add more entries | `/spec-add <category>` |
103
+ | View all specs | `/spec-load --category <category>` |
104
+ | Check knowledge health | `maestro spec health` |
105
+ </completion>
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: spec-load
3
+ description: "Load specs and lessons for current context Arguments: [--scope <scope>] [--category <category>] [--keyword <word>]"
4
+ allowed-tools: Read Bash Glob Grep
5
+ ---
6
+
7
+ <purpose>
8
+ Load relevant specs filtered by scope, category (file-level) and/or keyword (entry-level).
9
+ Category-based loading: loads the category's primary doc in full + matching entries from other files.
10
+ By default, loads from both global (~/.maestro/specs/) and project (.workflow/specs/) layers.
11
+ </purpose>
12
+
13
+ <required_reading>
14
+ @~/.maestro/workflows/specs-load.md
15
+ </required_reading>
16
+
17
+ <context>
18
+ $ARGUMENTS -- optional flags and keyword
19
+
20
+ **Flags:**
21
+ - `--scope <scope>` — Load scope (default: global + project merged):
22
+ - `project`: project baseline only (.workflow/specs/)
23
+ - `global`: global + project merged (~/.maestro/specs/ + .workflow/specs/)
24
+ - `team`: project + team shared (.workflow/collab/specs/)
25
+ - `personal`: project + team + personal (requires uid)
26
+ - `--category <category>` — Load by category: primary category doc (full) + cross-file entries with matching category attr. Categories: coding, arch, quality, test, review, debug, learning, ui.
27
+ - `--keyword <word>` — Filter by keyword within entries
28
+
29
+ **File → Primary Category mapping:**
30
+ | File | Category |
31
+ |------|----------|
32
+ | coding-conventions.md | coding |
33
+ | architecture-constraints.md | arch |
34
+ | test-conventions.md | test |
35
+ | review-standards.md | review |
36
+ | debug-notes.md | debug |
37
+ | ui-conventions.md | ui |
38
+ | quality-rules.md | review |
39
+ | learnings.md | learning |
40
+
41
+ **Examples:**
42
+ ```
43
+ /spec-load --category coding # coding全文 + 跨文件coding条目 (global + project)
44
+ /spec-load --scope global --category arch # 明确包含全局 arch 规范
45
+ /spec-load --category review # review-standards + quality-rules + 跨文件review条目
46
+ /spec-load --category coding --keyword auth
47
+ /spec-load --keyword auth
48
+ ```
49
+
50
+ **Ref entries:**
51
+ When loading entries with `ref` attribute, only the summary is shown with a load command:
52
+ → Detail: maestro load --type knowhow --id <knowhow-id>
53
+ Use the load command to read the full referenced document.
54
+ </context>
55
+
56
+ <invariants>
57
+ 1. **Read-only** — NEVER modify, create, or delete any spec files during load. This command is purely a read operation
58
+ 2. **Output to context only** — loaded specs are injected into the conversation context; NEVER write loaded content to new files or modify existing files
59
+ 3. **Scope layering** — global scope MUST merge both ~/.maestro/specs/ and .workflow/specs/; project scope loads .workflow/specs/ only; team adds .workflow/collab/specs/; personal adds .workflow/collab/{uid}/specs/
60
+ 4. **Category primary doc** — when --category is specified, the primary category doc MUST be loaded in full before cross-file matching
61
+ 5. **Entry-level filtering** — --keyword filtering operates at `<spec-entry>` level via keywords attribute, NOT at file level; unmatched entries in a matching file are excluded
62
+ 6. **Output boundary** — this command produces NO file writes. All output is conversation-context injection only
63
+ </invariants>
64
+
65
+ <execution>
66
+ Follow '~/.maestro/workflows/specs-load.md' completely.
67
+
68
+ ### Phase Gates (MANDATORY, BLOCKING)
69
+
70
+ **GATE 1: Parse → Discover**
71
+ - REQUIRED: Arguments parsed — at least one of --category or --keyword is provided, or empty args triggers full load.
72
+ - REQUIRED: Scope resolved (default: global+project merged).
73
+ - BLOCKED if: invalid scope value or invalid category value.
74
+
75
+ **GATE 2: Discover → Load**
76
+ - REQUIRED: At least one spec directory exists in the resolved scope chain.
77
+ - BLOCKED if: E001 — .workflow/specs/ not initialized AND no global specs available. Warn and abort.
78
+
79
+ **GATE 3: Load → Display**
80
+ - REQUIRED: Spec files read and entries parsed.
81
+ - REQUIRED: Keyword filtering applied if --keyword was provided.
82
+ - BLOCKED if: no readable spec files found in any scope layer.
83
+ </execution>
84
+
85
+ <error_codes>
86
+ | Code | Severity | Description | Stage |
87
+ |------|----------|-------------|-------|
88
+ | E001 | warning | `.workflow/specs/` not initialized -- run `/spec-setup` first (global specs still available) | detect_context |
89
+ | W001 | warning | No matching specs found for keyword -- showing all specs in category instead | load_specs |
90
+ </error_codes>
91
+
92
+ <success_criteria>
93
+ - [ ] Category and/or keyword parsed from arguments
94
+ - [ ] Spec files loaded per category mapping
95
+ - [ ] Keyword filtering applied at entry level (via `<spec-entry>` keywords attribute)
96
+ - [ ] Legacy entries filtered by text grep fallback
97
+ - [ ] Results displayed with file:category references
98
+ </success_criteria>
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: spec-remove
3
+ description: "Remove spec entry by ID Arguments: <entry-id> [--cascade] [-y]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Remove a `<spec-entry>` from a specs file. Symmetric with `/spec-add`.
9
+ Uses `maestro wiki remove-entry` for atomic removal with index auto-update.
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @~/.maestro/workflows/specs-remove.md
14
+ </required_reading>
15
+
16
+ <context>
17
+ $ARGUMENTS -- expects `<entry-id>` (e.g., `spec-learnings-003`, `spec-coding-conventions-001`)
18
+
19
+ **Entry ID format**: `spec-{file-stem}-{NNN}` — the sub-node ID assigned by WikiIndexer when indexing `<spec-entry>` blocks.
20
+
21
+ **Discovery**: Use `maestro wiki list --type spec --json` or `/spec-load --keyword <term>` to find entry IDs.
22
+
23
+ **Flags:**
24
+ - `--cascade` — When the target spec is a ref-type entry (created via `spec-add --ref` and linked to a knowhow document), also delete the referenced knowhow file. Without this flag, ref-type removal leaves an orphan knowhow file.
25
+ </context>
26
+
27
+ <invariants>
28
+ 1. **Confirmation required** — MUST AskUserQuestion before deletion (unless -y flag); NEVER remove entries silently
29
+ 2. **Referential integrity** — before removing, check if other spec entries reference the target entry; warn user if references exist
30
+ 3. **Cascade explicit** — ref-type entries MUST NOT cascade-delete the linked knowhow file unless --cascade is explicitly passed; default leaves orphan knowhow intact
31
+ 4. **Atomic removal** — use `maestro wiki remove-entry` for atomic operation; NEVER manually edit spec files to remove entries
32
+ 5. **Index consistency** — wiki index MUST be auto-updated after removal; stale index entries are a hard failure
33
+ 6. **Output boundary** — file modifications MUST target ONLY the spec container file (.workflow/specs/*.md) and optionally the referenced knowhow file (.workflow/knowhow/*) when --cascade is used. NEVER modify source code or files outside these paths
34
+ </invariants>
35
+
36
+ <execution>
37
+ Follow '~/.maestro/workflows/specs-remove.md' completely.
38
+
39
+ ### Phase Gates (MANDATORY, BLOCKING)
40
+
41
+ **GATE 1: Parse → Lookup**
42
+ - REQUIRED: Entry ID parsed from arguments.
43
+ - BLOCKED if: E001 — no entry ID provided.
44
+
45
+ **GATE 2: Lookup → Confirm**
46
+ - REQUIRED: .workflow/specs/ directory exists.
47
+ - REQUIRED: Entry found in wiki index as a spec sub-node.
48
+ - REQUIRED: Entry content loaded for user preview.
49
+ - BLOCKED if: E002 (specs not initialized), E003 (entry not found), E004 (wrong type).
50
+
51
+ **GATE 3: Confirm → Remove**
52
+ - REQUIRED: User confirmed removal via AskUserQuestion (unless -y flag).
53
+ - REQUIRED: If --cascade and entry has ref attribute, user additionally confirmed knowhow file deletion.
54
+ - BLOCKED if: user declines — abort without modification.
55
+ </execution>
56
+
57
+ <error_codes>
58
+ | Code | Severity | Description | Stage |
59
+ |------|----------|-------------|-------|
60
+ | E001 | fatal | Entry ID is required -- usage: `/spec-remove <entry-id>` | parse_input |
61
+ | E002 | fatal | `.workflow/specs/` not initialized -- run `/spec-setup` first | validate |
62
+ | E003 | fatal | Entry ID not found in wiki index | lookup |
63
+ | E004 | fatal | Entry is not a spec sub-node (wrong type) | validate |
64
+ </error_codes>
65
+
66
+ <success_criteria>
67
+ - [ ] Entry ID parsed and validated
68
+ - [ ] Entry found in wiki index (type=spec, is sub-node)
69
+ - [ ] User confirmed removal (unless -y flag)
70
+ - [ ] Entry removed from container file via `maestro wiki remove-entry`
71
+ - [ ] Wiki index auto-updated
72
+ - [ ] If `--cascade` and entry has a `ref` attribute: referenced knowhow file deleted, orphan avoided
73
+ - [ ] Confirmation displayed with removed entry details (and cascaded knowhow path if applicable)
74
+ </success_criteria>
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: spec-setup
3
+ description: "Initialize specs from project structure Arguments: "
4
+ allowed-tools: Read Write Bash Glob Grep AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Initialize `.workflow/specs/` by scanning codebase for conventions. Core files always created; optional files created when signals detected. Also generates recipe knowhow for detected workflows.
9
+ </purpose>
10
+
11
+ <required_reading>
12
+ @~/.maestro/workflows/specs-setup.md
13
+ </required_reading>
14
+
15
+ <context>
16
+ $ARGUMENTS (no arguments expected)
17
+
18
+ **Preconditions:**
19
+ - `.workflow/` directory must exist (created by `/maestro-init`) # (see code: E001)
20
+ - Project must contain source files to scan # (see code: E002)
21
+ </context>
22
+
23
+ <invariants>
24
+ 1. **Non-destructive** — NEVER overwrite existing spec files; if a file already exists, skip it and report as already-initialized
25
+ 2. **Idempotent** — safe to re-run on an initialized project; re-running MUST NOT duplicate entries or corrupt existing content
26
+ 3. **Confirmation gate** — MUST AskUserQuestion showing all files to be created before writing; NEVER write without user confirmation
27
+ 4. **Output boundary** — ALL file writes MUST target .workflow/specs/ (spec files) and .workflow/knowhow/ (recipe knowhow) only. NEVER modify source code, .workflow/state.json, or files outside these paths
28
+ 5. **Core files mandatory** — coding-conventions.md, architecture-constraints.md, and learnings.md MUST always be created (unless they already exist)
29
+ 6. **Signal-driven optionals** — optional spec files (quality-rules.md, test-conventions.md, ui-conventions.md) MUST only be created when corresponding framework/tool signals are detected in the codebase; NEVER create optional files without evidence
30
+ </invariants>
31
+
32
+ <execution>
33
+ Follow '~/.maestro/workflows/specs-setup.md' completely.
34
+
35
+ ### Phase Gates (MANDATORY, BLOCKING)
36
+
37
+ **GATE 1: Precondition → Scan**
38
+ - REQUIRED: .workflow/ directory exists.
39
+ - REQUIRED: Project contains source files to scan.
40
+ - BLOCKED if: E001 (.workflow/ not initialized), E002 (no source files).
41
+
42
+ **GATE 2: Scan → Plan**
43
+ - REQUIRED: Codebase scan completed — framework, language, and tooling signals collected.
44
+ - REQUIRED: Core spec file list determined (always 3: coding-conventions, architecture-constraints, learnings).
45
+ - REQUIRED: Optional spec files determined by detected signals only.
46
+
47
+ **GATE 3: Plan → Write**
48
+ - REQUIRED: User confirmed the full list of files to create via AskUserQuestion (showing core specs, optional specs, recipe knowhow, and detected signals).
49
+ - BLOCKED if: user declines — abort without writing.
50
+
51
+ **GATE 4: Write → Report**
52
+ - REQUIRED: All confirmed files written to .workflow/specs/ and .workflow/knowhow/.
53
+ - REQUIRED: Existing files skipped (not overwritten).
54
+ - REQUIRED: .proposed.md files created when slug collision detected (W003).
55
+
56
+ **Confirmation gate**: After scanning codebase and determining which files/directories will be created (core specs, optional specs, recipe knowhow), AskUserQuestion showing the full list of files to create with their categories and detected signals. Proceed only on user confirm.
57
+ </execution>
58
+
59
+ <error_codes>
60
+ | Code | Severity | Description | Stage |
61
+ |------|----------|-------------|-------|
62
+ | E001 | fatal | `.workflow/` directory not initialized -- run `/maestro-init` first | parse_input |
63
+ | E002 | fatal | No source files found in project -- nothing to scan | scan_codebase |
64
+ | W001 | warning | Convention detection uncertain for one or more categories -- marked `[UNCERTAIN]` | generate_specs |
65
+ | W002 | warning | Workflow recipe signals detected but commands ambiguous -- recipe skipped | generate_recipes |
66
+ | W003 | warning | Existing recipe slug found -- new content written as `.proposed.md` for manual diff | generate_recipes |
67
+ </error_codes>
68
+
69
+ <success_criteria>
70
+ - [ ] `.workflow/specs/` directory created
71
+ - [ ] Core spec files always created: `coding-conventions.md`, `architecture-constraints.md`, `learnings.md`
72
+ - [ ] Optional spec files created when detected: `quality-rules.md` (linter/CI), `test-conventions.md` (test framework), `ui-conventions.md` (frontend framework). `debug-notes.md` / `review-standards.md` deferred (on demand via `/spec-add`).
73
+ - [ ] Workflow recipe knowhow created in `.workflow/knowhow/` for each detected operational workflow (test / debug / build / dev / lint). Each recipe matches the `recipe` schema in `~/.maestro/workflows/knowhow.md` Part B and contains at least one runnable command.
74
+ - [ ] Report displayed grouped by destination (specs / recipes / skipped / deferred), with `.proposed.md` files surfaced when an existing recipe slug was preserved.
75
+ </success_criteria>
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: team-adversarial-swarm
3
+ description: "ACO swarm intelligence with modular Workflow composition and adversarial decision gates. Coordinator drives iteration loop; 4 composable Workflow scripts handle exploration, scoring, convergence, and synthesis — each with built-in adversarial patterns."
4
+ allowed-tools: Read Write Edit Bash Glob Grep Workflow AskUserQuestion Agent
5
+ ---
6
+
7
+ # Team Adversarial Swarm
8
+
9
+ ACO 蚁群优化 + 模块化 Workflow 编排 + 对抗决策。
10
+
11
+ 继承 `team-swarm` 的蚁群算法核心(Python ACO 脚本),用 4 个可组合的 Workflow 脚本
12
+ 替代 team-worker 架构,在每个决策节点注入对抗性 agent 模式。
13
+
14
+ ## Architecture
15
+
16
+ ```
17
+ SKILL.md (Coordinator — this file)
18
+
19
+ │ Phase 1: Config Generation (inline)
20
+ │ Phase 2: ACO Init (Bash: aco.py init)
21
+
22
+ │ Phase 3: Iteration Loop ×K
23
+ │ ┌──────────────────────────────────────────────────┐
24
+ │ │ 3a. Bash: aco.py select → assignments │
25
+ │ │ 3b. Workflow(wf-swarm-explore) ← 模块1 │
26
+ │ │ N ants parallel → ant_results │
27
+ │ │ 3c. Workflow(wf-swarm-score) ← 模块2 │
28
+ │ │ 3-vote adversarial scoring → verified_scores │
29
+ │ │ 3d. Write scores → Bash: aco.py update │
30
+ │ │ 3e. Workflow(wf-swarm-converge) ← 模块3 │
31
+ │ │ prosecutor/defender/judge → converged? │
32
+ │ │ 3f. if converged: break │
33
+ │ └──────────────────────────────────────────────────┘
34
+
35
+ │ Phase 4: Bash: aco.py report
36
+ │ Workflow(wf-swarm-synthesize) ← 模块4
37
+ │ 3-perspective analysis + arbitration → best-solution.md
38
+ ```
39
+
40
+ ## Workflow Module Registry
41
+
42
+ | Module | Script | Args Interface | Adversarial Pattern | Returns |
43
+ |--------|--------|---------------|--------------------|---------|
44
+ | **Explore** | `workflows/wf-swarm-explore.js` | `{ iteration, assignments[], objective, session, config }` | N ants parallel | `{ ant_results[] }` |
45
+ | **Score** | `workflows/wf-swarm-score.js` | `{ iteration, ant_results[], objective, rubric? }` | 3-vote per ant (prosecutor/defender/judge) | `{ scores{}, calibration }` |
46
+ | **Converge** | `workflows/wf-swarm-converge.js` | `{ iteration, best, history[], config }` | prosecutor(continue)/defender(stop)/judge | `{ converged, reason, confidence }` |
47
+ | **Synthesize** | `workflows/wf-swarm-synthesize.js` | `{ best, top_k[], convergence_story, objective }` | 3-perspective + arbitrator | `{ report, caveats }` |
48
+
49
+ 每个模块独立可用,也可由 Coordinator 组合编排。
50
+
51
+ ## Shared Dependencies
52
+
53
+ **所有依赖均在本 skill 内部,无外部引用。**
54
+
55
+ - **Python ACO 脚本**: `<this-skill>/scripts/aco.py`
56
+ - 运行时解析: `Glob(".claude/skills/team-adversarial-swarm/scripts/aco.py")`
57
+ - 依赖模块: `pheromone.py`, `scoring.py`(同目录)
58
+ - 命令: `init` / `select` / `update` / `converged` / `report`
59
+ - 协议: [specs/swarm-protocol.md](specs/swarm-protocol.md)
60
+ - **Workflow 脚本**: `<this-skill>/workflows/wf-swarm-*.js`
61
+ - 运行时解析: `Glob(".claude/skills/team-adversarial-swarm/workflows/wf-swarm-*.js")`
62
+
63
+ ## Specs Reference
64
+
65
+ | Spec | Purpose |
66
+ |------|---------|
67
+ | [specs/swarm-protocol.md](specs/swarm-protocol.md) | Coordinator ↔ Script ↔ Workflow 三方协议 |
68
+ | [specs/pheromone-schema.md](specs/pheromone-schema.md) | 信息素矩阵结构、更新公式、蒸发规则 |
69
+ | [specs/ant-output-schema.md](specs/ant-output-schema.md) | 蚁输出 JSON 合约(三层评分) |
70
+ | [specs/convergence-criteria.md](specs/convergence-criteria.md) | 双层收敛:Python 信号 + 对抗辩论 |
71
+ | [specs/swarm-config-template.json](specs/swarm-config-template.json) | 用户配置模板 |
72
+
73
+ ## Session Directory
74
+
75
+ ```
76
+ .workflow/.team/TAS-<slug>-<date>/
77
+ ├── swarm-config.json # Phase 1 output
78
+ ├── pheromone/ # ACO state (managed by aco.py)
79
+ │ ├── current.json
80
+ │ └── history/
81
+ ├── trails/ # Per-iteration trails (managed by aco.py)
82
+ ├── scores/ # Adversarial scoring results
83
+ │ └── iter-<k>-scores.json
84
+ ├── artifacts/
85
+ │ ├── ant-<k>-<id>.json # Ant outputs
86
+ │ └── best-solution.md # Final synthesis
87
+ ├── workflows/ # Workflow run artifacts
88
+ │ ├── explore-<k>.json # Per-iteration explore results
89
+ │ ├── score-<k>.json # Per-iteration score results
90
+ │ └── converge-<k>.json # Per-iteration convergence decision
91
+ └── best.json # Canonical best (managed by aco.py)
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Coordinator Execution Flow
97
+
98
+ ### Phase 0: Resume Check
99
+
100
+ 1. `Glob(".workflow/.team/TAS-*/swarm-config.json")` → 查找活跃 session
101
+ 2. 若存在且有 `workflows/converge-*.json` 未标记 converged → 恢复到对应迭代
102
+ 3. 若无活跃 session → Phase 1
103
+
104
+ ### Phase 1: Config Generation
105
+
106
+ 解析用户 intent,生成 `swarm-config.json`。
107
+
108
+ 若 intent 不够明确,用 AskUserQuestion 澄清:
109
+ - 搜索空间是什么?(文件 glob / 节点列表 / 抽象决策集)
110
+ - 目标是什么?(最优方案 / 发现问题 / 优化路径)
111
+ - 如何评分?(测试通过率 / lint / 自定义规则 / LLM 对抗评分)
112
+ - 预算?(最大迭代 / 每轮蚁数 / token 预算)
113
+
114
+ 生成 config 字段:
115
+ ```json
116
+ {
117
+ "task": { "objective": "...", "evidence_requirements": "..." },
118
+ "swarm": { "n_ants": 5, "max_iterations": 5 },
119
+ "aco": { "alpha": 1.0, "beta": 2.0, "rho": 0.1, "q": 1.0 },
120
+ "task_space": { "nodes": [...], "auto_discover_from": "..." },
121
+ "scoring": { "mode": "adversarial", "rubric": "..." },
122
+ "convergence": { "patience": 2, "min_improvement": 0.01, "max_iterations": 5 }
123
+ }
124
+ ```
125
+
126
+ Write 到 `<session>/swarm-config.json`。
127
+
128
+ ### Phase 2: ACO Init
129
+
130
+ 1. 创建 session 目录: `TAS-<slug>-<date>`
131
+ 2. 解析 aco.py 路径(从 team-swarm skill 继承)
132
+ 3. `Bash: python <aco.py> --session <session> init`
133
+ 4. 解析输出: `{ n_nodes, n_edges, pheromone_path }`
134
+
135
+ ### Phase 3: Iteration Loop
136
+
137
+ ```python
138
+ for k in range(1, max_iterations + 1):
139
+ # 3a. ACO selection
140
+ assignments = Bash("python aco.py --session <session> select --iter k")
141
+
142
+ # 3b. Parallel exploration (Workflow Module 1)
143
+ explore_result = Workflow({
144
+ scriptPath: "<skill>/workflows/wf-swarm-explore.js",
145
+ args: { iteration: k, assignments, objective, session, config }
146
+ })
147
+
148
+ # 3c. Adversarial scoring (Workflow Module 2)
149
+ score_result = Workflow({
150
+ scriptPath: "<skill>/workflows/wf-swarm-score.js",
151
+ args: { iteration: k, ant_results: explore_result.ant_results, objective, rubric }
152
+ })
153
+
154
+ # 3d. Write scores + pheromone update
155
+ Write("<session>/scores/iter-k-scores.json", score_result)
156
+ Bash("python aco.py --session <session> update --iter k")
157
+
158
+ # 3e. Adversarial convergence check (Workflow Module 3)
159
+ converge_result = Workflow({
160
+ scriptPath: "<skill>/workflows/wf-swarm-converge.js",
161
+ args: { iteration: k, best: aco_best, history: iter_history, config }
162
+ })
163
+
164
+ # 3f. Save + check
165
+ Write("<session>/workflows/converge-k.json", converge_result)
166
+ if converge_result.converged: break
167
+ ```
168
+
169
+ **注意**:每次 Workflow 调用是独立的,数据通过 args 传入、返回值传出。
170
+ Coordinator 负责 Workflow 间的数据桥接和 Python 脚本调用。
171
+
172
+ ### Phase 4: Synthesis
173
+
174
+ 1. `Bash: python aco.py --session <session> report` → 获取 best + top_k + curve
175
+ 2. 调用 Workflow Module 4:
176
+ ```
177
+ Workflow({
178
+ scriptPath: "<skill>/workflows/wf-swarm-synthesize.js",
179
+ args: { best, top_k, convergence_story, objective }
180
+ })
181
+ ```
182
+ 3. 将 synthesis 结果写入 `<session>/artifacts/best-solution.md`
183
+ 4. 展示完成摘要 + AskUserQuestion(归档 / 保留 / 导出 / 再跑一轮)
184
+
185
+ ---
186
+
187
+ ## Module Composition Patterns
188
+
189
+ ### 完整流水线(默认)
190
+ ```
191
+ explore → score → update → converge → [loop] → synthesize
192
+ ```
193
+
194
+ ### 仅探索(跳过评分,用 self_score)
195
+ ```
196
+ explore → update(self_score) → converge → synthesize
197
+ ```
198
+
199
+ ### 单次迭代调试
200
+ ```
201
+ explore(k=1) → score(k=1) // 不循环,只看一轮
202
+ ```
203
+
204
+ ### 独立评分(已有 ant artifacts)
205
+ ```
206
+ score(ant_results from files) → 输出 verified_scores
207
+ ```
208
+
209
+ ### 独立综合(已有 best + trails)
210
+ ```
211
+ synthesize(best, top_k) → best-solution.md
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Error Handling
217
+
218
+ | Scenario | Resolution |
219
+ |----------|------------|
220
+ | aco.py 未找到 | Glob team-swarm skill 路径;提示安装 |
221
+ | Python < 3.10 | 尝试 python3;报告依赖 |
222
+ | Workflow 执行失败 | 记录错误,提供 --resume 恢复点 |
223
+ | 所有蚁全部失败 | 暂停,AskUserQuestion(重试/终止/调整config) |
224
+ | 收敛从不触发 | max_iterations 安全网总会触发 |
225
+ | 幻觉集群 (>50% 蚁被降分) | 暂停,AskUserQuestion(继续/调整评分规则) |
226
+
227
+ ## Completion
228
+
229
+ 展示最终结果 + 交互选择:
230
+ - **归档**: 保存 session,展示 best-solution.md
231
+ - **继续**: 保持 session,可追加迭代
232
+ - **导出**: 复制 best-solution.md 到目标位置
233
+ - **再跑**: 重置收敛,继续 K 轮