maestro-flow 0.4.10 → 0.4.11

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 (226) hide show
  1. package/.agents/agents/cli-explore-agent.md +189 -0
  2. package/.agents/agents/conceptual-planning-agent.md +247 -0
  3. package/.agents/agents/impeccable-agent.md +101 -0
  4. package/.agents/agents/team-supervisor.md +145 -0
  5. package/.agents/agents/team-worker.md +239 -0
  6. package/.agents/agents/ui-design-agent.md +289 -0
  7. package/.agents/agents/workflow-analyzer.md +117 -0
  8. package/.agents/agents/workflow-codebase-mapper.md +79 -0
  9. package/.agents/agents/workflow-collab-planner.md +145 -0
  10. package/.agents/agents/workflow-debugger.md +105 -0
  11. package/.agents/agents/workflow-executor.md +134 -0
  12. package/.agents/agents/workflow-external-researcher.md +88 -0
  13. package/.agents/agents/workflow-integration-checker.md +85 -0
  14. package/.agents/agents/workflow-nyquist-auditor.md +87 -0
  15. package/.agents/agents/workflow-phase-researcher.md +87 -0
  16. package/.agents/agents/workflow-plan-checker.md +92 -0
  17. package/.agents/agents/workflow-planner.md +197 -0
  18. package/.agents/agents/workflow-project-researcher.md +76 -0
  19. package/.agents/agents/workflow-research-synthesizer.md +72 -0
  20. package/.agents/agents/workflow-reviewer.md +84 -0
  21. package/.agents/agents/workflow-roadmapper.md +83 -0
  22. package/.agents/agents/workflow-verifier.md +122 -0
  23. package/.agents/skills/codify-to-knowhow/SKILL.md +169 -0
  24. package/.agents/skills/codify-to-knowhow/phases/01-load-manifest.md +101 -0
  25. package/.agents/skills/codify-to-knowhow/phases/02-generate-knowhow.md +97 -0
  26. package/.agents/skills/codify-to-knowhow/phases/03-generate-specs.md +92 -0
  27. package/.agents/skills/codify-to-knowhow/phases/04-index-verify.md +119 -0
  28. package/.agents/skills/learn-decompose/SKILL.md +118 -0
  29. package/.agents/skills/learn-follow/SKILL.md +129 -0
  30. package/.agents/skills/learn-investigate/SKILL.md +154 -0
  31. package/.agents/skills/learn-retro/SKILL.md +159 -0
  32. package/.agents/skills/learn-second-opinion/SKILL.md +124 -0
  33. package/.agents/skills/maestro/SKILL.md +224 -0
  34. package/.agents/skills/maestro-amend/SKILL.md +165 -0
  35. package/.agents/skills/maestro-analyze/SKILL.md +135 -0
  36. package/.agents/skills/maestro-brainstorm/SKILL.md +118 -0
  37. package/.agents/skills/maestro-collab/SKILL.md +174 -0
  38. package/.agents/skills/maestro-composer/SKILL.md +181 -0
  39. package/.agents/skills/maestro-execute/SKILL.md +133 -0
  40. package/.agents/skills/maestro-fork/SKILL.md +88 -0
  41. package/.agents/skills/maestro-guard/SKILL.md +103 -0
  42. package/.agents/skills/maestro-help/SKILL.md +266 -0
  43. package/.agents/skills/maestro-help/index/catalog.json +184 -0
  44. package/.agents/skills/maestro-help/phases/01-parse-intent.md +122 -0
  45. package/.agents/skills/maestro-help/phases/02-search-present.md +181 -0
  46. package/.agents/skills/maestro-help/phases/03-workflow-guide.md +186 -0
  47. package/.agents/skills/maestro-impeccable/SKILL.md +251 -0
  48. package/.agents/skills/maestro-init/SKILL.md +80 -0
  49. package/.agents/skills/maestro-learn/SKILL.md +142 -0
  50. package/.agents/skills/maestro-merge/SKILL.md +66 -0
  51. package/.agents/skills/maestro-milestone-audit/SKILL.md +70 -0
  52. package/.agents/skills/maestro-milestone-complete/SKILL.md +77 -0
  53. package/.agents/skills/maestro-milestone-release/SKILL.md +98 -0
  54. package/.agents/skills/maestro-overlay/SKILL.md +180 -0
  55. package/.agents/skills/maestro-plan/SKILL.md +172 -0
  56. package/.agents/skills/maestro-player/SKILL.md +177 -0
  57. package/.agents/skills/maestro-quick/SKILL.md +67 -0
  58. package/.agents/skills/maestro-ralph/SKILL.md +685 -0
  59. package/.agents/skills/maestro-ralph-execute/SKILL.md +259 -0
  60. package/.agents/skills/maestro-roadmap/SKILL.md +170 -0
  61. package/.agents/skills/maestro-tools-execute/SKILL.md +119 -0
  62. package/.agents/skills/maestro-tools-register/SKILL.md +159 -0
  63. package/.agents/skills/maestro-ui-codify/SKILL.md +82 -0
  64. package/.agents/skills/maestro-update/SKILL.md +178 -0
  65. package/.agents/skills/maestro-verify/SKILL.md +111 -0
  66. package/.agents/skills/manage-codebase-rebuild/SKILL.md +77 -0
  67. package/.agents/skills/manage-codebase-refresh/SKILL.md +59 -0
  68. package/.agents/skills/manage-harvest/SKILL.md +96 -0
  69. package/.agents/skills/manage-issue/SKILL.md +75 -0
  70. package/.agents/skills/manage-issue-discover/SKILL.md +83 -0
  71. package/.agents/skills/manage-knowhow/SKILL.md +79 -0
  72. package/.agents/skills/manage-knowhow-capture/SKILL.md +81 -0
  73. package/.agents/skills/manage-learn/SKILL.md +67 -0
  74. package/.agents/skills/manage-status/SKILL.md +54 -0
  75. package/.agents/skills/manage-wiki/SKILL.md +64 -0
  76. package/.agents/skills/quality-auto-test/SKILL.md +138 -0
  77. package/.agents/skills/quality-debug/SKILL.md +122 -0
  78. package/.agents/skills/quality-refactor/SKILL.md +69 -0
  79. package/.agents/skills/quality-retrospective/SKILL.md +79 -0
  80. package/.agents/skills/quality-review/SKILL.md +130 -0
  81. package/.agents/skills/quality-sync/SKILL.md +53 -0
  82. package/.agents/skills/quality-test/SKILL.md +119 -0
  83. package/.agents/skills/security-audit/SKILL.md +157 -0
  84. package/.agents/skills/skill-iter-tune/SKILL.md +384 -0
  85. package/.agents/skills/skill-iter-tune/phases/01-setup.md +144 -0
  86. package/.agents/skills/skill-iter-tune/phases/02-execute.md +292 -0
  87. package/.agents/skills/skill-iter-tune/phases/03-evaluate.md +312 -0
  88. package/.agents/skills/skill-iter-tune/phases/04-improve.md +186 -0
  89. package/.agents/skills/skill-iter-tune/phases/05-report.md +166 -0
  90. package/.agents/skills/skill-iter-tune/specs/evaluation-criteria.md +63 -0
  91. package/.agents/skills/skill-iter-tune/templates/eval-prompt.md +134 -0
  92. package/.agents/skills/skill-iter-tune/templates/execute-prompt.md +97 -0
  93. package/.agents/skills/spec-add/SKILL.md +70 -0
  94. package/.agents/skills/spec-load/SKILL.md +73 -0
  95. package/.agents/skills/spec-remove/SKILL.md +53 -0
  96. package/.agents/skills/spec-setup/SKILL.md +50 -0
  97. package/.agents/skills/team-coordinate/SKILL.md +268 -0
  98. package/.agents/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +247 -0
  99. package/.agents/skills/team-coordinate/roles/coordinator/commands/dispatch.md +131 -0
  100. package/.agents/skills/team-coordinate/roles/coordinator/commands/monitor.md +358 -0
  101. package/.agents/skills/team-coordinate/roles/coordinator/role.md +365 -0
  102. package/.agents/skills/team-coordinate/specs/knowledge-transfer.md +111 -0
  103. package/.agents/skills/team-coordinate/specs/pipelines.md +97 -0
  104. package/.agents/skills/team-coordinate/specs/quality-gates.md +112 -0
  105. package/.agents/skills/team-coordinate/specs/role-spec-template.md +198 -0
  106. package/.agents/skills/team-executor/SKILL.md +191 -0
  107. package/.agents/skills/team-executor/roles/executor/commands/monitor.md +239 -0
  108. package/.agents/skills/team-executor/roles/executor/role.md +171 -0
  109. package/.agents/skills/team-executor/specs/session-schema.md +264 -0
  110. package/.agents/skills/team-lifecycle-v4/SKILL.md +211 -0
  111. package/.agents/skills/team-lifecycle-v4/roles/analyst/role.md +96 -0
  112. package/.agents/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +56 -0
  113. package/.agents/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +56 -0
  114. package/.agents/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +206 -0
  115. package/.agents/skills/team-lifecycle-v4/roles/coordinator/role.md +130 -0
  116. package/.agents/skills/team-lifecycle-v4/roles/executor/commands/fix.md +35 -0
  117. package/.agents/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -0
  118. package/.agents/skills/team-lifecycle-v4/roles/executor/role.md +69 -0
  119. package/.agents/skills/team-lifecycle-v4/roles/planner/role.md +87 -0
  120. package/.agents/skills/team-lifecycle-v4/roles/reviewer/commands/review-code.md +34 -0
  121. package/.agents/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +44 -0
  122. package/.agents/skills/team-lifecycle-v4/roles/reviewer/role.md +71 -0
  123. package/.agents/skills/team-lifecycle-v4/roles/supervisor/role.md +194 -0
  124. package/.agents/skills/team-lifecycle-v4/roles/tester/role.md +89 -0
  125. package/.agents/skills/team-lifecycle-v4/roles/writer/role.md +97 -0
  126. package/.agents/skills/team-lifecycle-v4/specs/knowledge-transfer.md +114 -0
  127. package/.agents/skills/team-lifecycle-v4/specs/pipelines.md +140 -0
  128. package/.agents/skills/team-lifecycle-v4/specs/quality-gates.md +130 -0
  129. package/.agents/skills/team-lifecycle-v4/templates/architecture.md +254 -0
  130. package/.agents/skills/team-lifecycle-v4/templates/epics.md +196 -0
  131. package/.agents/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
  132. package/.agents/skills/team-lifecycle-v4/templates/requirements.md +224 -0
  133. package/.agents/skills/team-quality-assurance/SKILL.md +149 -0
  134. package/.agents/skills/team-quality-assurance/roles/analyst/role.md +90 -0
  135. package/.agents/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -0
  136. package/.agents/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +111 -0
  137. package/.agents/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +250 -0
  138. package/.agents/skills/team-quality-assurance/roles/coordinator/role.md +143 -0
  139. package/.agents/skills/team-quality-assurance/roles/executor/role.md +68 -0
  140. package/.agents/skills/team-quality-assurance/roles/generator/role.md +70 -0
  141. package/.agents/skills/team-quality-assurance/roles/scout/role.md +77 -0
  142. package/.agents/skills/team-quality-assurance/roles/strategist/role.md +73 -0
  143. package/.agents/skills/team-quality-assurance/specs/pipelines.md +115 -0
  144. package/.agents/skills/team-quality-assurance/specs/team-config.json +131 -0
  145. package/.agents/skills/team-review/SKILL.md +149 -0
  146. package/.agents/skills/team-review/roles/coordinator/commands/analyze.md +71 -0
  147. package/.agents/skills/team-review/roles/coordinator/commands/dispatch.md +91 -0
  148. package/.agents/skills/team-review/roles/coordinator/commands/monitor.md +224 -0
  149. package/.agents/skills/team-review/roles/coordinator/role.md +132 -0
  150. package/.agents/skills/team-review/roles/fixer/role.md +78 -0
  151. package/.agents/skills/team-review/roles/reviewer/role.md +70 -0
  152. package/.agents/skills/team-review/roles/scanner/role.md +81 -0
  153. package/.agents/skills/team-review/specs/dimensions.md +82 -0
  154. package/.agents/skills/team-review/specs/finding-schema.json +82 -0
  155. package/.agents/skills/team-review/specs/pipelines.md +102 -0
  156. package/.agents/skills/team-review/specs/team-config.json +27 -0
  157. package/.agents/skills/team-tech-debt/SKILL.md +130 -0
  158. package/.agents/skills/team-tech-debt/roles/assessor/role.md +79 -0
  159. package/.agents/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -0
  160. package/.agents/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +156 -0
  161. package/.agents/skills/team-tech-debt/roles/coordinator/commands/monitor.md +209 -0
  162. package/.agents/skills/team-tech-debt/roles/coordinator/role.md +123 -0
  163. package/.agents/skills/team-tech-debt/roles/executor/role.md +78 -0
  164. package/.agents/skills/team-tech-debt/roles/planner/role.md +71 -0
  165. package/.agents/skills/team-tech-debt/roles/scanner/role.md +92 -0
  166. package/.agents/skills/team-tech-debt/roles/validator/role.md +80 -0
  167. package/.agents/skills/team-tech-debt/specs/pipelines.md +47 -0
  168. package/.agents/skills/team-tech-debt/specs/team-config.json +129 -0
  169. package/.agents/skills/team-testing/SKILL.md +145 -0
  170. package/.agents/skills/team-testing/roles/analyst/role.md +105 -0
  171. package/.agents/skills/team-testing/roles/coordinator/commands/analyze.md +70 -0
  172. package/.agents/skills/team-testing/roles/coordinator/commands/dispatch.md +108 -0
  173. package/.agents/skills/team-testing/roles/coordinator/commands/monitor.md +257 -0
  174. package/.agents/skills/team-testing/roles/coordinator/role.md +134 -0
  175. package/.agents/skills/team-testing/roles/executor/role.md +101 -0
  176. package/.agents/skills/team-testing/roles/generator/role.md +100 -0
  177. package/.agents/skills/team-testing/roles/strategist/role.md +85 -0
  178. package/.agents/skills/team-testing/specs/pipelines.md +101 -0
  179. package/.agents/skills/team-testing/specs/team-config.json +93 -0
  180. package/.agents/skills/wiki-connect/SKILL.md +64 -0
  181. package/.agents/skills/wiki-digest/SKILL.md +70 -0
  182. package/.agents/skills/workflow-skill-designer/SKILL.md +498 -0
  183. package/.agents/skills/workflow-skill-designer/phases/01-requirements-analysis.md +356 -0
  184. package/.agents/skills/workflow-skill-designer/phases/02-orchestrator-design.md +444 -0
  185. package/.agents/skills/workflow-skill-designer/phases/03-phase-design.md +458 -0
  186. package/.agents/skills/workflow-skill-designer/phases/04-validation.md +471 -0
  187. package/.agy/skills/maestro/SKILL.md +13 -11
  188. package/.agy/skills/maestro-ralph/SKILL.md +222 -87
  189. package/.claude/commands/maestro-ralph.md +222 -87
  190. package/.claude/commands/maestro.md +13 -11
  191. package/.codex/skills/maestro/SKILL.md +23 -17
  192. package/.codex/skills/maestro-ralph/SKILL.md +177 -67
  193. package/dist/src/commands/install-backend.d.ts +12 -0
  194. package/dist/src/commands/install-backend.d.ts.map +1 -1
  195. package/dist/src/commands/install-backend.js +144 -0
  196. package/dist/src/commands/install-backend.js.map +1 -1
  197. package/dist/src/core/component-defs.d.ts +6 -0
  198. package/dist/src/core/component-defs.d.ts.map +1 -1
  199. package/dist/src/core/component-defs.js +97 -0
  200. package/dist/src/core/component-defs.js.map +1 -1
  201. package/dist/src/tui/install-ui/ExtraMcpConfig.d.ts +11 -0
  202. package/dist/src/tui/install-ui/ExtraMcpConfig.d.ts.map +1 -0
  203. package/dist/src/tui/install-ui/ExtraMcpConfig.js +61 -0
  204. package/dist/src/tui/install-ui/ExtraMcpConfig.js.map +1 -0
  205. package/dist/src/tui/install-ui/InstallConfirm.d.ts +3 -0
  206. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  207. package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
  208. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  209. package/dist/src/tui/install-ui/InstallExecution.d.ts +2 -0
  210. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  211. package/dist/src/tui/install-ui/InstallExecution.js +14 -2
  212. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  213. package/dist/src/tui/install-ui/InstallFlow.d.ts +1 -1
  214. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  215. package/dist/src/tui/install-ui/InstallFlow.js +16 -3
  216. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  217. package/dist/src/tui/install-ui/InstallHub.d.ts +2 -0
  218. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  219. package/dist/src/tui/install-ui/InstallHub.js +8 -0
  220. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  221. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  222. package/dist/src/tui/install-ui/InstallResult.js +3 -1
  223. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  224. package/dist/src/utils/update-notices.js +19 -0
  225. package/dist/src/utils/update-notices.js.map +1 -1
  226. package/package.json +5 -2
@@ -0,0 +1,144 @@
1
+ # Phase 1: Setup
2
+
3
+ Initialize workspace, backup skills, parse inputs.
4
+
5
+ ## Objective
6
+
7
+ - Parse skill path(s) and test scenario from user input
8
+ - Validate all skill paths exist and contain SKILL.md
9
+ - Create isolated workspace directory structure
10
+ - Backup original skill files
11
+ - Initialize iteration-state.json
12
+
13
+ ## Execution
14
+
15
+ ### Step 1.1: Parse Input
16
+
17
+ Parse `$ARGUMENTS` to extract skill paths and test scenario.
18
+
19
+ ```javascript
20
+ // Parse skill paths (first argument or comma-separated)
21
+ const args = $ARGUMENTS.trim();
22
+ const pathMatch = args.match(/^([^\s]+)/);
23
+ const rawPaths = pathMatch ? pathMatch[1].split(',') : [];
24
+
25
+ // Parse test scenario
26
+ const scenarioMatch = args.match(/(?:--scenario|--test)\s+"([^"]+)"/);
27
+ const scenarioText = scenarioMatch ? scenarioMatch[1] : args.replace(rawPaths.join(','), '').trim();
28
+
29
+ // Record chain order (preserves input order for chain mode)
30
+ const chainOrder = rawPaths.map(p => p.startsWith('.claude/') ? p.split('/').pop() : p);
31
+
32
+ // If no scenario, ask user
33
+ if (!scenarioText) {
34
+ const response = ask_user({
35
+ questions: [{
36
+ question: "Please describe the test scenario for evaluating this skill:",
37
+ header: "Test Scenario",
38
+ multiSelect: false,
39
+ options: [
40
+ { label: "General quality test", description: "Evaluate overall skill quality with a generic task" },
41
+ { label: "Specific scenario", description: "I'll describe a specific test case" }
42
+ ]
43
+ }]
44
+ });
45
+ // Use response to construct testScenario
46
+ }
47
+ ```
48
+
49
+ ### Step 1.2: Validate Skill Paths
50
+
51
+ ```javascript
52
+ const targetSkills = [];
53
+ for (const rawPath of rawPaths) {
54
+ const skillPath = rawPath.startsWith('.claude/') ? rawPath : `.claude/skills/${rawPath}`;
55
+
56
+ // Validate SKILL.md exists
57
+ const skillFiles = find_files(`${skillPath}/SKILL.md`);
58
+ if (skillFiles.length === 0) {
59
+ throw new Error(`Skill not found at: ${skillPath} -- SKILL.md missing`);
60
+ }
61
+
62
+ // Collect all skill files
63
+ const allFiles = find_files(`${skillPath}/**/*.md`);
64
+ targetSkills.push({
65
+ name: skillPath.split('/').pop(),
66
+ path: skillPath,
67
+ files: allFiles.map(f => f.replace(skillPath + '/', '')),
68
+ primary_file: 'SKILL.md'
69
+ });
70
+ }
71
+ ```
72
+
73
+ ### Step 1.3: Create Workspace
74
+
75
+ ```javascript
76
+ const ts = Date.now();
77
+ const workDir = `.workflow/.scratchpad/skill-iter-tune-${ts}`;
78
+
79
+ shell(`mkdir -p "${workDir}/backups" "${workDir}/iterations"`);
80
+ ```
81
+
82
+ ### Step 1.4: Backup Original Skills
83
+
84
+ ```javascript
85
+ for (const skill of targetSkills) {
86
+ shell(`cp -r "${skill.path}" "${workDir}/backups/${skill.name}"`);
87
+ }
88
+ ```
89
+
90
+ ### Step 1.5: Initialize State
91
+
92
+ Write `iteration-state.json` with initial state:
93
+
94
+ ```javascript
95
+ const initialState = {
96
+ status: 'running',
97
+ started_at: new Date().toISOString(),
98
+ updated_at: new Date().toISOString(),
99
+ target_skills: targetSkills,
100
+ test_scenario: {
101
+ description: scenarioText,
102
+ // Parse --requirements and --input-args from $ARGUMENTS if provided
103
+ // e.g., --requirements "clear output,no errors" --input-args "my-skill --scenario test"
104
+ requirements: parseListArg(args, '--requirements') || [],
105
+ input_args: parseStringArg(args, '--input-args') || '',
106
+ success_criteria: parseStringArg(args, '--success-criteria') || 'Produces correct, high-quality output'
107
+ },
108
+ execution_mode: workflowPreferences.executionMode || 'single',
109
+ chain_order: workflowPreferences.executionMode === 'chain'
110
+ ? targetSkills.map(s => s.name)
111
+ : [],
112
+ current_iteration: 0,
113
+ max_iterations: workflowPreferences.maxIterations,
114
+ quality_threshold: workflowPreferences.qualityThreshold,
115
+ latest_score: 0,
116
+ score_trend: [],
117
+ converged: false,
118
+ iterations: [],
119
+ errors: [],
120
+ error_count: 0,
121
+ max_errors: 3,
122
+ work_dir: workDir,
123
+ backup_dir: `${workDir}/backups`
124
+ };
125
+
126
+ write_file(`${workDir}/iteration-state.json`, JSON.stringify(initialState, null, 2));
127
+
128
+ // Chain mode: create per-skill tracking tasks
129
+ if (initialState.execution_mode === 'chain') {
130
+ for (const skill of targetSkills) {
131
+ create_task({
132
+ subject: `Chain: ${skill.name}`,
133
+ activeForm: `Tracking ${skill.name}`,
134
+ description: `Skill chain member: ${skill.path} | Position: ${targetSkills.indexOf(skill) + 1}/${targetSkills.length}`
135
+ });
136
+ }
137
+ }
138
+ ```
139
+
140
+ ## Output
141
+
142
+ - **Variables**: `workDir`, `targetSkills[]`, `testScenario`, `chainOrder` (chain mode)
143
+ - **Files**: `iteration-state.json`, `backups/` directory with skill copies
144
+ - **track_tasks**: Mark Phase 1 completed, start Iteration Loop. Chain mode: per-skill tracking tasks created
@@ -0,0 +1,292 @@
1
+ # Phase 2: Execute Skill
2
+
3
+ > **COMPACT SENTINEL [Phase 2: Execute]**
4
+ > This phase contains 4 execution steps (Step 2.1 -- 2.4).
5
+ > If you can read this sentinel but cannot find the full Step protocol below, context has been compressed.
6
+ > Recovery: `read_file("phases/02-execute.md")`
7
+
8
+ Execute the target skill against the test scenario using `ccw cli --tool claude --mode write`. Claude receives the full skill definition and simulates producing its expected output artifacts.
9
+
10
+ ## Objective
11
+
12
+ - Snapshot current skill version before execution
13
+ - Construct execution prompt with full skill content + test scenario
14
+ - Execute via ccw cli Claude
15
+ - Collect output artifacts
16
+
17
+ ## Execution
18
+
19
+ ### Step 2.1: Snapshot Current Skill
20
+
21
+ ```javascript
22
+ const N = state.current_iteration;
23
+ const iterDir = `${state.work_dir}/iterations/iteration-${N}`;
24
+ shell(`mkdir -p "${iterDir}/skill-snapshot" "${iterDir}/artifacts"`);
25
+
26
+ // Chain mode: create per-skill artifact directories
27
+ if (state.execution_mode === 'chain') {
28
+ for (const skillName of state.chain_order) {
29
+ shell(`mkdir -p "${iterDir}/artifacts/${skillName}"`);
30
+ }
31
+ }
32
+
33
+ // Snapshot current skill state (so we can compare/rollback)
34
+ for (const skill of state.target_skills) {
35
+ shell(`cp -r "${skill.path}" "${iterDir}/skill-snapshot/${skill.name}"`);
36
+ }
37
+ ```
38
+
39
+ ### Step 2.2: Construct Execution Prompt (Single Mode)
40
+
41
+ Read the execute-prompt template and substitute variables.
42
+
43
+ > Skip to Step 2.2b if `state.execution_mode === 'chain'`.
44
+
45
+ ```javascript
46
+ // Ref: templates/execute-prompt.md
47
+
48
+ // Build skillContent by reading only executable skill files (SKILL.md, phases/, specs/)
49
+ // Exclude README.md, docs/, and other non-executable files to save tokens
50
+ const skillContent = state.target_skills.map(skill => {
51
+ const skillMd = read_file(`${skill.path}/SKILL.md`);
52
+ const phaseFiles = find_files(`${skill.path}/phases/*.md`).sort().map(f => ({
53
+ relativePath: f.replace(skill.path + '/', ''),
54
+ content: read_file(f)
55
+ }));
56
+ const specFiles = find_files(`${skill.path}/specs/*.md`).map(f => ({
57
+ relativePath: f.replace(skill.path + '/', ''),
58
+ content: read_file(f)
59
+ }));
60
+
61
+ return `### File: SKILL.md\n${skillMd}\n\n` +
62
+ phaseFiles.map(f => `### File: ${f.relativePath}\n${f.content}`).join('\n\n') +
63
+ (specFiles.length > 0 ? '\n\n' + specFiles.map(f => `### File: ${f.relativePath}\n${f.content}`).join('\n\n') : '');
64
+ }).join('\n\n---\n\n');
65
+
66
+ // Construct full prompt using template
67
+ const executePrompt = `PURPOSE: Simulate executing the following workflow skill against a test scenario. Produce all expected output artifacts as if the skill were invoked with the given input.
68
+
69
+ SKILL CONTENT:
70
+ ${skillContent}
71
+
72
+ TEST SCENARIO:
73
+ Description: ${state.test_scenario.description}
74
+ Input Arguments: ${state.test_scenario.input_args}
75
+ Requirements: ${state.test_scenario.requirements.join('; ')}
76
+ Success Criteria: ${state.test_scenario.success_criteria}
77
+
78
+ TASK:
79
+ 1. Study the complete skill structure (SKILL.md + all phase files)
80
+ 2. Follow the skill execution flow sequentially
81
+ 3. For each phase, produce the artifacts that phase would generate
82
+ 4. Write all output artifacts to the current working directory
83
+ 5. Create a manifest.json listing all produced artifacts
84
+
85
+ MODE: write
86
+ CONTEXT: @**/*
87
+ EXPECTED: All artifacts written to disk + manifest.json
88
+ CONSTRAINTS: Follow skill flow exactly, produce realistic output, not placeholders`;
89
+ ```
90
+
91
+ ### Step 2.3: Execute via ccw cli
92
+
93
+ > **CHECKPOINT**: Before executing CLI, verify:
94
+ > 1. This phase is track_tasks `in_progress`
95
+ > 2. `iterDir/artifacts/` directory exists
96
+ > 3. Prompt is properly escaped
97
+
98
+ ```javascript
99
+ function escapeForShell(str) {
100
+ return str.replace(/"/g, '\\"').replace(/\$/g, '\\$').replace(/`/g, '\\`');
101
+ }
102
+
103
+ const cliCommand = `ccw cli -p "${escapeForShell(executePrompt)}" --tool claude --mode write --cd "${iterDir}/artifacts"`;
104
+
105
+ // Execute in background, wait for hook callback
106
+ shell({
107
+ command: cliCommand,
108
+ run_in_background: true,
109
+ timeout: 600000 // 10 minutes max
110
+ });
111
+
112
+ // STOP HERE -- wait for hook callback to resume
113
+ // After callback, verify artifacts were produced
114
+ ```
115
+
116
+ ### Step 2.2b: Chain Execution Path
117
+
118
+ > Skip this step if `state.execution_mode === 'single'`.
119
+
120
+ In chain mode, execute each skill sequentially. Each skill receives the previous skill's artifacts as input context.
121
+
122
+ ```javascript
123
+ // Chain execution: iterate through chain_order
124
+ let previousArtifacts = ''; // Accumulates upstream output
125
+
126
+ for (let i = 0; i < state.chain_order.length; i++) {
127
+ const skillName = state.chain_order[i];
128
+ const skill = state.target_skills.find(s => s.name === skillName);
129
+ const skillArtifactDir = `${iterDir}/artifacts/${skillName}`;
130
+
131
+ // Build this skill's content
132
+ const skillMd = read_file(`${skill.path}/SKILL.md`);
133
+ const phaseFiles = find_files(`${skill.path}/phases/*.md`).sort().map(f => ({
134
+ relativePath: f.replace(skill.path + '/', ''),
135
+ content: read_file(f)
136
+ }));
137
+ const specFiles = find_files(`${skill.path}/specs/*.md`).map(f => ({
138
+ relativePath: f.replace(skill.path + '/', ''),
139
+ content: read_file(f)
140
+ }));
141
+
142
+ const singleSkillContent = `### File: SKILL.md\n${skillMd}\n\n` +
143
+ phaseFiles.map(f => `### File: ${f.relativePath}\n${f.content}`).join('\n\n') +
144
+ (specFiles.length > 0 ? '\n\n' + specFiles.map(f => `### File: ${f.relativePath}\n${f.content}`).join('\n\n') : '');
145
+
146
+ // Build chain context from previous skill's artifacts
147
+ const chainInputContext = previousArtifacts
148
+ ? `\nPREVIOUS CHAIN OUTPUT (from upstream skill "${state.chain_order[i - 1]}"):\n${previousArtifacts}\n\nIMPORTANT: Use the above output as input context for this skill's execution.\n`
149
+ : '';
150
+
151
+ // Construct per-skill execution prompt
152
+ // Ref: templates/execute-prompt.md
153
+ const chainPrompt = `PURPOSE: Simulate executing the following workflow skill against a test scenario. Produce all expected output artifacts.
154
+
155
+ SKILL CONTENT (${skillName} — chain position ${i + 1}/${state.chain_order.length}):
156
+ ${singleSkillContent}
157
+ ${chainInputContext}
158
+ TEST SCENARIO:
159
+ Description: ${state.test_scenario.description}
160
+ Input Arguments: ${state.test_scenario.input_args}
161
+ Requirements: ${state.test_scenario.requirements.join('; ')}
162
+ Success Criteria: ${state.test_scenario.success_criteria}
163
+
164
+ TASK:
165
+ 1. Study the complete skill structure
166
+ 2. Follow the skill execution flow sequentially
167
+ 3. Produce all expected artifacts
168
+ 4. Write output to the current working directory
169
+ 5. Create manifest.json listing all produced artifacts
170
+
171
+ MODE: write
172
+ CONTEXT: @**/*
173
+ CONSTRAINTS: Follow skill flow exactly, produce realistic output`;
174
+
175
+ function escapeForShell(str) {
176
+ return str.replace(/"/g, '\\"').replace(/\$/g, '\\$').replace(/`/g, '\\`');
177
+ }
178
+
179
+ const cliCommand = `ccw cli -p "${escapeForShell(chainPrompt)}" --tool claude --mode write --cd "${skillArtifactDir}"`;
180
+
181
+ // Execute in background
182
+ shell({
183
+ command: cliCommand,
184
+ run_in_background: true,
185
+ timeout: 600000
186
+ });
187
+
188
+ // STOP -- wait for hook callback
189
+
190
+ // After callback: collect artifacts for next skill in chain
191
+ const artifacts = find_files(`${skillArtifactDir}/**/*`);
192
+ const skillSuccess = artifacts.length > 0;
193
+
194
+ if (skillSuccess) {
195
+ previousArtifacts = artifacts.slice(0, 10).map(f => {
196
+ const relPath = f.replace(skillArtifactDir + '/', '');
197
+ const content = read_file(f, { limit: 100 });
198
+ return `--- ${relPath} ---\n${content}`;
199
+ }).join('\n\n');
200
+ } else {
201
+ // Mid-chain failure: keep previous artifacts for downstream skills
202
+ // Log warning but continue chain — downstream skills receive last successful output
203
+ state.errors.push({
204
+ phase: 'execute',
205
+ message: `Chain skill "${skillName}" (position ${i + 1}) produced no artifacts. Downstream skills will receive upstream output from "${state.chain_order[i - 1] || 'none'}" instead.`,
206
+ timestamp: new Date().toISOString()
207
+ });
208
+ state.error_count++;
209
+ // previousArtifacts remains from last successful skill (or empty if first)
210
+ }
211
+
212
+ // Update per-skill track_tasks
213
+ // update_task chain skill task with execution status
214
+
215
+ // Record per-skill execution
216
+ if (!state.iterations[N - 1].execution.chain_executions) {
217
+ state.iterations[N - 1].execution.chain_executions = [];
218
+ }
219
+ state.iterations[N - 1].execution.chain_executions.push({
220
+ skill_name: skillName,
221
+ cli_command: cliCommand,
222
+ artifacts_dir: skillArtifactDir,
223
+ success: skillSuccess
224
+ });
225
+
226
+ // Check error budget: abort chain if too many consecutive failures
227
+ if (state.error_count >= 3) {
228
+ state.errors.push({
229
+ phase: 'execute',
230
+ message: `Chain execution aborted at skill "${skillName}" — error limit reached (${state.error_count} errors).`,
231
+ timestamp: new Date().toISOString()
232
+ });
233
+ break;
234
+ }
235
+ }
236
+ ```
237
+
238
+ ### Step 2.4: Collect Artifacts
239
+
240
+ After CLI completes (hook callback received):
241
+
242
+ ```javascript
243
+ // List produced artifacts
244
+ const artifactFiles = find_files(`${iterDir}/artifacts/**/*`);
245
+
246
+ // Chain mode: check per-skill artifacts
247
+ if (state.execution_mode === 'chain') {
248
+ const chainSuccess = state.iterations[N - 1].execution.chain_executions?.every(e => e.success) ?? false;
249
+ state.iterations[N - 1].execution.success = chainSuccess;
250
+ state.iterations[N - 1].execution.artifacts_dir = `${iterDir}/artifacts`;
251
+ } else {
252
+
253
+ if (artifactFiles.length === 0) {
254
+ // Execution produced nothing -- record error
255
+ state.iterations[N - 1].execution = {
256
+ cli_command: cliCommand,
257
+ started_at: new Date().toISOString(),
258
+ completed_at: new Date().toISOString(),
259
+ artifacts_dir: `${iterDir}/artifacts`,
260
+ success: false
261
+ };
262
+ state.error_count++;
263
+ // Continue to Phase 3 anyway -- Gemini can evaluate the skill even without artifacts
264
+ } else {
265
+ state.iterations[N - 1].execution = {
266
+ cli_command: cliCommand,
267
+ started_at: new Date().toISOString(),
268
+ completed_at: new Date().toISOString(),
269
+ artifacts_dir: `${iterDir}/artifacts`,
270
+ success: true
271
+ };
272
+ }
273
+
274
+ } // end single mode branch
275
+
276
+ // Update state
277
+ write_file(`${state.work_dir}/iteration-state.json`, JSON.stringify(state, null, 2));
278
+ ```
279
+
280
+ ## Error Handling
281
+
282
+ | Error | Recovery |
283
+ |-------|----------|
284
+ | CLI timeout (10min) | Record failure, continue to Phase 3 without artifacts |
285
+ | CLI crash | Retry once with simplified prompt (SKILL.md only, no phase files) |
286
+ | No artifacts produced | Continue to Phase 3, evaluation focuses on skill definition quality |
287
+
288
+ ## Output
289
+
290
+ - **Files**: `iteration-{N}/skill-snapshot/`, `iteration-{N}/artifacts/`
291
+ - **State**: `iterations[N-1].execution` updated
292
+ - **Next**: Phase 3 (Evaluate)