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,297 @@
1
+ ---
2
+ name: delegation-check
3
+ description: "Check workflow delegation prompts against agent role definitions for content separation violations. Detects conflicts, duplication, boundary leaks, and missing contracts. Triggers on \"check delegation\", \"delegation conflict\", \"prompt vs role check\"."
4
+ allowed-tools: Read Glob Grep Bash AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Validate that command delegation prompts (Agent() calls) and agent role definitions respect GSD content separation boundaries. Detects 7 conflict dimensions: role re-definition, domain expertise leaking into prompts, quality gate duplication, output format conflicts, process override, scope authority conflicts, and missing contracts.
9
+
10
+ Invoked when user requests "check delegation", "delegation conflict", "prompt vs role check", or when reviewing workflow skill quality.
11
+ </purpose>
12
+
13
+ <required_reading>
14
+ - @.claude/skills/delegation-check/specs/separation-rules.md
15
+ </required_reading>
16
+
17
+ <process>
18
+
19
+ ## Pre-load (before execution)
20
+
21
+ 1. **Codebase docs**: If `.workflow/codebase/ARCHITECTURE.md` exists, read for project context
22
+ 2. **Specs**: `maestro load --type spec --category coding` — load coding conventions
23
+ 3. **Wiki knowledge**: `maestro search "skill design optimization" --json` — top 5 entries as prior context
24
+ 4. All optional — proceed without if unavailable
25
+
26
+ ## 1. Determine Scan Scope
27
+
28
+ Parse `$ARGUMENTS` to identify what to check.
29
+
30
+ | Signal | Scope |
31
+ |--------|-------|
32
+ | File path to command `.md` | Single command + its agents |
33
+ | File path to agent `.md` | Single agent + commands that spawn it |
34
+ | Directory path (e.g., `.claude/skills/team-*/`) | All commands + agents in that skill |
35
+ | "all" or no args | Scan all `.claude/commands/`, `.claude/skills/*/`, `.claude/agents/` |
36
+
37
+ If ambiguous, ask:
38
+
39
+ ```
40
+ AskUserQuestion(
41
+ header: "Scan Scope",
42
+ question: "What should I check for delegation conflicts?",
43
+ options: [
44
+ { label: "Specific skill", description: "Check one skill directory" },
45
+ { label: "Specific command+agent pair", description: "Check one command and its spawned agents" },
46
+ { label: "Full scan", description: "Scan all commands, skills, and agents" }
47
+ ]
48
+ )
49
+ ```
50
+
51
+ ## 2. Discover Command-Agent Pairs
52
+
53
+ For each command file in scope:
54
+
55
+ **2a. Extract Agent() calls from commands:**
56
+
57
+ ```bash
58
+ # Search both Agent() (current) and Task() (legacy GSD) patterns
59
+ grep -n "Agent(\|Task(" "$COMMAND_FILE"
60
+ grep -n "subagent_type" "$COMMAND_FILE"
61
+ ```
62
+
63
+ For each `Agent()` call, extract:
64
+ - `subagent_type` → agent name
65
+ - Full prompt content between the prompt markers (the string passed as `prompt=`)
66
+ - Line range of the delegation prompt
67
+
68
+ **2b. Locate agent definitions:**
69
+
70
+ For each `subagent_type` found:
71
+ ```bash
72
+ # Check standard locations
73
+ ls .claude/agents/${AGENT_NAME}.md 2>/dev/null
74
+ ls .claude/skills/*/agents/${AGENT_NAME}.md 2>/dev/null
75
+ ```
76
+
77
+ **2c. Build pair map:**
78
+
79
+ ```
80
+ $PAIRS = [
81
+ {
82
+ command: { path, agent_calls: [{ line, subagent_type, prompt_content }] },
83
+ agent: { path, role, sections, quality_gate, output_contract }
84
+ }
85
+ ]
86
+ ```
87
+
88
+ If an agent file cannot be found, record as `MISSING_AGENT` — this is itself a finding.
89
+
90
+ ## 3. Parse Delegation Prompts
91
+
92
+ For each Agent() call, extract structured blocks from the prompt content:
93
+
94
+ | Block | What It Contains |
95
+ |-------|-----------------|
96
+ | `<objective>` | What to accomplish |
97
+ | `<files_to_read>` | Input file paths |
98
+ | `<additional_context>` / `<planning_context>` / `<verification_context>` | Runtime parameters |
99
+ | `<output>` / `<expected_output>` | Output format/location expectations |
100
+ | `<quality_gate>` | Per-invocation quality checklist |
101
+ | `<deep_work_rules>` / `<instructions>` | Cross-cutting policy or revision instructions |
102
+ | `<downstream_consumer>` | Who consumes the output |
103
+ | `<success_criteria>` | Success conditions |
104
+ | Free-form text | Unstructured instructions |
105
+
106
+ Also detect ANTI-PATTERNS in prompt content:
107
+ - Role identity statements ("You are a...", "Your role is...")
108
+ - Domain expertise (decision tables, heuristics, comparison examples)
109
+ - Process definitions (numbered steps, step-by-step instructions beyond scope)
110
+ - Philosophy statements ("always prefer...", "never do...")
111
+ - Anti-pattern lists that belong in agent definition
112
+
113
+ ## 4. Parse Agent Definitions
114
+
115
+ For each agent file, extract:
116
+
117
+ | Section | Key Content |
118
+ |---------|------------|
119
+ | `<role>` | Identity, spawner, responsibilities, mandatory read |
120
+ | `<philosophy>` | Guiding principles |
121
+ | `<upstream_input>` | How agent interprets input |
122
+ | `<output_contract>` | Return markers (COMPLETE/BLOCKED/CHECKPOINT) |
123
+ | `<quality_gate>` | Self-check criteria |
124
+ | Domain sections | All `<section_name>` tags with their content |
125
+ | YAML frontmatter | name, description, tools |
126
+
127
+ ## 5. Run Conflict Checks (7 Dimensions)
128
+
129
+ ### Dimension 1: Role Re-definition
130
+
131
+ **Question:** Does the delegation prompt redefine the agent's identity?
132
+
133
+ **Check:** Scan prompt content for:
134
+ - "You are a..." / "You are the..." / "Your role is..."
135
+ - "Your job is to..." / "Your responsibility is..."
136
+ - "Core responsibilities:" lists
137
+ - Any content that contradicts agent's `<role>` section
138
+
139
+ **Allowed:** References to mode ("standard mode", "revision mode") that the agent's `<role>` already lists in "Spawned by:".
140
+
141
+ **Severity:** `error` if prompt redefines role; `warning` if prompt adds responsibilities not in agent's `<role>`.
142
+
143
+ ### Dimension 2: Domain Expertise Leak
144
+
145
+ **Question:** Does the delegation prompt embed domain knowledge that belongs in the agent?
146
+
147
+ **Check:** Scan prompt content for:
148
+ - Decision/routing tables (`| Condition | Action |`)
149
+ - Good-vs-bad comparison examples (`| TOO VAGUE | JUST RIGHT |`)
150
+ - Heuristic rules ("If X then Y", "Always prefer Z")
151
+ - Anti-pattern lists ("DO NOT...", "NEVER...")
152
+ - Detailed process steps beyond task scope
153
+
154
+ **Exception:** `<deep_work_rules>` is an acceptable cross-cutting policy pattern from GSD — flag as `info` only.
155
+
156
+ **Severity:** `error` if prompt contains domain tables/examples that duplicate agent content; `warning` if prompt contains heuristics not in agent.
157
+
158
+ ### Dimension 3: Quality Gate Duplication
159
+
160
+ **Question:** Do the prompt's quality checks overlap or conflict with the agent's own `<quality_gate>`?
161
+
162
+ **Check:** Compare prompt `<quality_gate>` / `<success_criteria>` items against agent's `<quality_gate>` items:
163
+ - **Duplicate:** Same check appears in both → `warning` (redundant, may diverge)
164
+ - **Conflict:** Contradictory criteria (e.g., prompt says "max 3 tasks", agent says "max 5 tasks") → `error`
165
+ - **Missing:** Prompt expects quality checks agent doesn't have → `info`
166
+
167
+ **Severity:** `error` for contradictions; `warning` for duplicates; `info` for gaps.
168
+
169
+ ### Dimension 4: Output Format Conflict
170
+
171
+ **Question:** Does the prompt's expected output format conflict with the agent's `<output_contract>`?
172
+
173
+ **Check:**
174
+ - Prompt `<expected_output>` markers vs agent's `<output_contract>` return markers
175
+ - Prompt expects specific format agent doesn't define
176
+ - Prompt expects file output but agent's contract only defines markers (or vice versa)
177
+ - Return marker names differ (prompt expects `## DONE`, agent returns `## TASK COMPLETE`)
178
+
179
+ **Severity:** `error` if return markers conflict; `warning` if format expectations unspecified on either side.
180
+
181
+ ### Dimension 5: Process Override
182
+
183
+ **Question:** Does the delegation prompt dictate HOW the agent should work?
184
+
185
+ **Check:** Scan prompt for:
186
+ - Numbered step-by-step instructions ("Step 1:", "First..., Then..., Finally...")
187
+ - Process flow definitions beyond `<objective>` scope
188
+ - Tool usage instructions ("Use grep to...", "Run bash command...")
189
+ - Execution ordering that conflicts with agent's own execution flow
190
+
191
+ **Allowed:** `<instructions>` block for revision mode (telling agent what changed, not how to work).
192
+
193
+ **Severity:** `error` if prompt overrides agent's process; `warning` if prompt suggests process hints.
194
+
195
+ ### Dimension 6: Scope Authority Conflict
196
+
197
+ **Question:** Does the prompt make decisions that belong to the agent's domain?
198
+
199
+ **Check:**
200
+ - Prompt specifies implementation choices (library selection, architecture patterns) when agent's `<philosophy>` or domain sections own these decisions
201
+ - Prompt overrides agent's discretion areas
202
+ - Prompt locks decisions that agent's `<context_fidelity>` says are "Claude's Discretion"
203
+
204
+ **Allowed:** Passing through user-locked decisions from CONTEXT.md — this is proper delegation, not authority conflict.
205
+
206
+ **Severity:** `error` if prompt makes domain decisions agent should own; `info` if prompt passes through user decisions (correct behavior).
207
+
208
+ ### Dimension 7: Missing Contracts
209
+
210
+ **Question:** Are the delegation handoff points properly defined?
211
+
212
+ **Check:**
213
+ - Agent has `<output_contract>` with return markers → command handles all markers?
214
+ - Command's return handling covers COMPLETE, BLOCKED, CHECKPOINT
215
+ - Agent lists "Spawned by:" — does command actually spawn it?
216
+ - Agent expects `<files_to_read>` — does prompt provide it?
217
+ - Agent has `<upstream_input>` — does prompt provide matching input structure?
218
+
219
+ **Severity:** `error` if return marker handling is missing; `warning` if agent expects input the prompt doesn't provide.
220
+
221
+ ## 6. Aggregate and Report
222
+
223
+ ### 6a. Per-pair summary
224
+
225
+ For each command-agent pair, aggregate findings:
226
+
227
+ ```
228
+ {command_path} → {agent_name}
229
+ Agent() at line {N}:
230
+ D1 (Role Re-def): {PASS|WARN|ERROR} — {detail}
231
+ D2 (Domain Leak): {PASS|WARN|ERROR} — {detail}
232
+ D3 (Quality Gate): {PASS|WARN|ERROR} — {detail}
233
+ D4 (Output Format): {PASS|WARN|ERROR} — {detail}
234
+ D5 (Process Override): {PASS|WARN|ERROR} — {detail}
235
+ D6 (Scope Authority): {PASS|WARN|ERROR} — {detail}
236
+ D7 (Missing Contract): {PASS|WARN|ERROR} — {detail}
237
+ ```
238
+
239
+ ### 6b. Overall verdict
240
+
241
+ | Verdict | Condition |
242
+ |---------|-----------|
243
+ | **CLEAN** | 0 errors, 0-2 warnings |
244
+ | **REVIEW** | 0 errors, 3+ warnings |
245
+ | **CONFLICT** | 1+ errors |
246
+
247
+ ### 6c. Fix recommendations
248
+
249
+ For each finding, provide:
250
+ - **Location:** file:line
251
+ - **What's wrong:** concrete description
252
+ - **Fix:** move content to correct owner (command or agent)
253
+ - **Example:** before/after snippet if applicable
254
+
255
+ ## 7. Present Results
256
+
257
+ ```
258
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
259
+ DELEGATION-CHECK ► SCAN COMPLETE
260
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
261
+
262
+ Scope: {description}
263
+ Pairs checked: {N} command-agent pairs
264
+ Findings: {E} errors, {W} warnings, {I} info
265
+
266
+ Verdict: {CLEAN | REVIEW | CONFLICT}
267
+
268
+ | Pair | D1 | D2 | D3 | D4 | D5 | D6 | D7 |
269
+ |------|----|----|----|----|----|----|-----|
270
+ | {cmd} → {agent} | ✅ | ⚠️ | ✅ | ✅ | ❌ | ✅ | ✅ |
271
+ | ... | | | | | | | |
272
+
273
+ {If CONFLICT: detailed findings with fix recommendations}
274
+
275
+ ───────────────────────────────────────────────────────
276
+
277
+ ## Fix Priority
278
+
279
+ 1. {Highest severity fix}
280
+ 2. {Next fix}
281
+ ...
282
+
283
+ ───────────────────────────────────────────────────────
284
+ ```
285
+
286
+ </process>
287
+
288
+ <success_criteria>
289
+ - [ ] Scan scope determined and all files discovered
290
+ - [ ] All Agent() calls extracted from commands with full prompt content
291
+ - [ ] All corresponding agent definitions located and parsed
292
+ - [ ] 7 conflict dimensions checked for each command-agent pair
293
+ - [ ] No false positives on legitimate patterns (mode references, user decision passthrough, `<deep_work_rules>`)
294
+ - [ ] Fix recommendations provided for every error/warning
295
+ - [ ] Summary table with per-pair dimension results displayed
296
+ - [ ] Overall verdict determined (CLEAN/REVIEW/CONFLICT)
297
+ </success_criteria>
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: domain-add
3
+ description: "Register a domain term into project glossary Arguments: <canonical> \\\"<definition>\\\""
4
+ allowed-tools: Read Write Bash Glob Grep AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Register a domain term into `.workflow/domain/glossary.yaml`. Domain terms are automatically injected into agent context via hooks (domain-compact for all prompts, domain-expanded on keyword match).
9
+ </purpose>
10
+
11
+ <required_reading>
12
+ @~/.maestro/workflows/domain-add.md
13
+ </required_reading>
14
+
15
+ <context>
16
+ $ARGUMENTS -- expects `<canonical> "<definition>"`
17
+
18
+ **Examples:**
19
+ ```bash
20
+ /domain-add auth-token "Short-lived credential for API authentication"
21
+ /domain-add event-bus "Central pub-sub message broker for cross-module communication"
22
+ /domain-add 会话上下文 "Runtime state container for active workflow session"
23
+ ```
24
+
25
+ Domain term lifecycle: discover/manual → register → active → (optional) deprecated → removed.
26
+
27
+ **Related commands:**
28
+ - `maestro domain list` — list all registered terms
29
+ - `maestro domain discover` — scan codebase for term candidates
30
+ - `maestro domain show <canonical>` — show term details
31
+ - `maestro domain deprecate <canonical> --successor <new>` — deprecate a term
32
+ </context>
33
+
34
+ <invariants>
35
+ 1. **Single-term atomic operation** — each invocation registers exactly ONE term; NEVER batch-write multiple terms in a single execution
36
+ 2. **Glossary append-only** — existing terms in `glossary.yaml` SHALL NOT be modified or removed; only new entries are appended
37
+ 3. **Duplicate guard** — MUST check for exact canonical name match AND near-matches before writing; NEVER create duplicate entries
38
+ 4. **Confirmation mandatory** — MUST present term details (canonical, definition, aliases, tier, path) via AskUserQuestion before any glossary write; NEVER write without user confirmation
39
+ 5. **Schema compliance** — every term entry MUST include canonical name, definition, tier, and at least one alias/keyword; incomplete entries SHALL NOT be persisted
40
+ 6. **Domain directory prerequisite** — `.workflow/domain/` MUST exist before writing; NEVER auto-create the directory (E002 if missing)
41
+ </invariants>
42
+
43
+ <execution>
44
+ Follow '~/.maestro/workflows/domain-add.md' completely.
45
+
46
+ **Confirmation gate**: Before writing to glossary.yaml, AskUserQuestion showing the term canonical name, definition, extracted aliases/keywords, tier, and target file path. Proceed only on user confirm.
47
+ </execution>
48
+
49
+ <error_codes>
50
+ | Code | Severity | Description | Stage |
51
+ |------|----------|-------------|-------|
52
+ | E001 | fatal | Canonical name and definition are both required | parse_input |
53
+ | E002 | fatal | `.workflow/domain/` not initialized — run `maestro domain init` first | validate |
54
+ | E003 | fatal | Term already registered with same canonical name | duplicate_check |
55
+ | E004 | warning | Near-match found — confirm merge or create new | duplicate_check |
56
+ </error_codes>
57
+
58
+ <success_criteria>
59
+ - [ ] Canonical name and definition parsed and validated
60
+ - [ ] No duplicate term in glossary (or user confirmed near-match)
61
+ - [ ] Aliases and keywords auto-extracted from definition
62
+ - [ ] Term written to glossary.yaml with tier and relationships
63
+ - [ ] Confirmation displayed with term details and verify command
64
+ </success_criteria>
65
+
66
+ <completion>
67
+ ### Next-step routing
68
+
69
+ | Condition | Suggestion |
70
+ |-----------|-----------|
71
+ | Verify term added | `maestro domain show <canonical>` |
72
+ | Add more terms | `/domain-add <canonical> "<definition>"` |
73
+ | Discover candidates | `maestro domain discover` |
74
+ | List all terms | `maestro domain list` |
75
+ </completion>
@@ -0,0 +1,226 @@
1
+ ---
2
+ name: insight-challenge
3
+ description: "Adversarial review of code quality findings. Challenges insights with counter-evidence, verifies claims against source code, and produces structured verdicts. Triggers on 'insight-challenge', 'challenge finding', '审查发现'."
4
+ allowed-tools: Read Glob Grep Bash Write
5
+ ---
6
+
7
+ # Insight Challenge
8
+
9
+ Adversarial review of code quality findings. Challenges insights with counter-evidence, verifies claims against source code, and produces structured verdicts.
10
+
11
+ **适用场景**: 当需要对代码审查、质量分析、或架构评估中的发现进行对抗性验证时使用。
12
+
13
+ ## Architecture
14
+
15
+ ```
16
+ ┌─────────────────────────────────────────────────────────────┐
17
+ │ Insight Challenge (SKILL.md) — Adversarial Review │
18
+ │ → Parse finding → Read source → Challenge → Verdict │
19
+ └─────────────────────────────────────────────────────────────┘
20
+
21
+ ┌──────────┬───────────┼───────────┬──────────┐
22
+ ↓ ↓ ↓ ↓ │
23
+ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │
24
+ │Phase 1 │ │Phase 2 │ │Phase 3 │ │Phase 4 │ │
25
+ │ Parse │ │ Source │ │Challenge│ │Verdict │ │
26
+ │Finding │ │ Review │ │Analysis │ │Report │ │
27
+ └───┬────┘ └───┬────┘ └───┬────┘ └───┬────┘ │
28
+ │ │ │ │ │
29
+ finding source counter- structured │
30
+ parsed code evidence verdict │
31
+ ```
32
+
33
+ ## Key Design Principles
34
+
35
+ 1. **Adversarial by Default**: Assume findings may be incorrect; seek counter-evidence first
36
+ 2. **Source-Code Anchored**: All claims must be verified against actual code, not assumptions
37
+ 3. **Structured Output**: Verdicts follow a fixed schema for downstream consumption
38
+ 4. **Fair Challenge**: If evidence supports the finding, confirm it; don't manufacture doubt
39
+ 5. **Transparent Reasoning**: Show the chain of evidence and reasoning
40
+
41
+ ## Finding Input Format
42
+
43
+ Findings can be provided as JSON or structured text:
44
+
45
+ ```json
46
+ {
47
+ "id": "HIGH-01",
48
+ "title": "知识边类型 resolves/documents 未在 types.ts 声明",
49
+ "severity": "high",
50
+ "file": "src/graph/kg/db/types.ts",
51
+ "line": 58,
52
+ "description": "issue-extractor 使用 'resolves' 边类型...",
53
+ "evidence": "types.ts KnowledgeEdgeKind: defines, constrains...",
54
+ "suggestion": "补齐缺失的边类型声明",
55
+ "design_ref": "Gap 2 — 12 CodeEdgeKind + 9 KnowledgeEdgeKind"
56
+ }
57
+ ```
58
+
59
+ Or structured text:
60
+ ```
61
+ HIGH-01: 知识边类型 resolves/documents 未在 types.ts 声明
62
+ Severity: high
63
+ File: src/graph/kg/db/types.ts:58
64
+ Claim: issue-extractor 使用 'resolves' 边类型但未在类型系统中声明
65
+ Evidence: types.ts KnowledgeEdgeKind 列表中缺少 'resolves'
66
+ ```
67
+
68
+ ## Execution Flow
69
+
70
+ ### Phase 1: Parse Finding
71
+
72
+ 1. Extract finding ID, title, severity, file reference, and claims
73
+ 2. Identify all verifiable assertions:
74
+ - File existence claims
75
+ - Code structure claims (types, functions, variables)
76
+ - Behavioral claims (usage patterns, dependencies)
77
+ - Design conformance claims
78
+ 3. Create verification checklist
79
+
80
+ ### Phase 2: Source Review
81
+
82
+ 1. Read the referenced file(s) at the specified lines
83
+ 2. Search for related code using Grep/Glob
84
+ 3. Document actual state of the code:
85
+ - What types/functions actually exist
86
+ - What values are actually declared
87
+ - What the actual implementation looks like
88
+ 4. Compare claims against reality
89
+
90
+ ### Phase 3: Challenge Analysis
91
+
92
+ For each claim in the finding:
93
+
94
+ 1. **Seek confirming evidence**: Does the source code support this claim?
95
+ 2. **Seek disconfirming evidence**: Does the source code contradict this claim?
96
+ 3. **Check for misinterpretation**: Could the claim be based on outdated code or misunderstanding?
97
+ 4. **Verify design references**: Are cited design docs accurate?
98
+
99
+ Challenge strategies:
100
+ - **Direct contradiction**: Source code explicitly shows the opposite
101
+ - **Context omission**: Finding omits relevant context that changes the interpretation
102
+ - **Stale reference**: Finding references code that has been updated
103
+ - **Miscounted**: Numeric claims (missing N types) are incorrect
104
+ - **Scope error**: Finding applies wrong scope (e.g., confuses edge types with language types)
105
+
106
+ ### Phase 4: Verdict Report
107
+
108
+ Produce structured output:
109
+
110
+ ```json
111
+ {
112
+ "finding_id": "HIGH-01",
113
+ "challenge_result": "overturned|weakened|confirmed",
114
+ "confidence": 95,
115
+ "reasoning": "Detailed explanation of why the finding was challenged or confirmed",
116
+ "counter_evidence": [
117
+ "Source file line 64: 'resolves' IS declared in KnowledgeEdgeKind",
118
+ "Design doc specifies 20 edge types, not 28"
119
+ ],
120
+ "supporting_evidence": [],
121
+ "adjusted_severity": "none|high|medium|low",
122
+ "recommendation": "Dismiss this finding; the claimed gap does not exist"
123
+ }
124
+ ```
125
+
126
+ ## Verdict Definitions
127
+
128
+ | Verdict | Meaning | When to Use |
129
+ |---------|---------|-------------|
130
+ | **overturned** | Finding is factually incorrect | Source code directly contradicts the claim |
131
+ | **weakened** | Finding is partially correct but overstated | Some evidence supports it, but severity/scope is wrong |
132
+ | **confirmed** | Finding is accurate | Source code supports all claims |
133
+
134
+ ## Challenge Patterns
135
+
136
+ ### Pattern 1: Type Declaration Check
137
+ ```
138
+ Claim: "Type X is not declared"
139
+ Challenge: Read the type file → check if X exists in type union/enum
140
+ Counter: "Line N shows X IS declared in the type definition"
141
+ ```
142
+
143
+ ### Pattern 2: Design Reference Verification
144
+ ```
145
+ Claim: "Design requires N items, implementation has M"
146
+ Challenge: Read design doc → verify the claimed requirement
147
+ Counter: "Design doc actually specifies K items, not N"
148
+ ```
149
+
150
+ ### Pattern 3: Usage Verification
151
+ ```
152
+ Claim: "Code uses type X but X is not defined"
153
+ Challenge: Check both usage site AND definition site
154
+ Counter: "X is defined at line N in file Y"
155
+ ```
156
+
157
+ ### Pattern 4: Scope Confusion
158
+ ```
159
+ Claim: "Missing 7 edge types (total should be 28)"
160
+ Challenge: Check what the "28" actually refers to
161
+ Counter: "The 28 refers to language types, not edge types; edge types are 21"
162
+ ```
163
+
164
+ ## Output Format
165
+
166
+ The challenge produces a markdown report:
167
+
168
+ ```markdown
169
+ ## Challenge Report: <finding_id>
170
+
171
+ **Verdict**: <overturned|weakened|confirmed>
172
+ **Confidence**: <0-100>%
173
+ **Adjusted Severity**: <none|high|medium|low>
174
+
175
+ ### Original Finding
176
+ <finding summary>
177
+
178
+ ### Counter-Evidence
179
+ - <evidence point 1>
180
+ - <evidence point 2>
181
+
182
+ ### Supporting Evidence
183
+ - <evidence point 1> (if any)
184
+
185
+ ### Reasoning
186
+ <detailed explanation>
187
+
188
+ ### Recommendation
189
+ <action recommendation>
190
+ ```
191
+
192
+ ## Error Handling
193
+
194
+ | Scenario | Resolution |
195
+ |----------|------------|
196
+ | Referenced file not found | Report file missing; verdict = weakened (potentially stale) |
197
+ | Line number out of range | Search for the claimed content; adjust line reference |
198
+ | Design doc not found | Skip design verification; note in report |
199
+ | Ambiguous evidence | Present both sides; lower confidence score |
200
+ | Multiple findings batch | Process each independently; produce per-finding verdicts |
201
+
202
+ ## Usage Examples
203
+
204
+ ### Single Finding Challenge
205
+ ```
206
+ Skill(skill="insight-challenge", args='{"id":"HIGH-01","title":"...","file":"src/types.ts","line":58,...}')
207
+ ```
208
+
209
+ ### Batch Challenge
210
+ ```
211
+ Skill(skill="insight-challenge", args='findings.json')
212
+ ```
213
+
214
+ ### Inline Challenge
215
+ ```
216
+ Challenge this finding:
217
+ Claim: Function X is not exported
218
+ File: src/utils.ts:45
219
+ Evidence: grep shows no export keyword
220
+ ```
221
+
222
+ ## Related Skills
223
+
224
+ - **team-adversarial-swarm**: Multi-agent adversarial analysis
225
+ - **team-quality-assurance**: QA pipeline with issue discovery
226
+ - **codify-to-knowhow**: Capturing verified knowledge