@nst173/superpowers-ccg 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +14 -78
  2. package/agents/code-reviewer.md +1 -1
  3. package/bin/cli.js +179 -0
  4. package/bin/codeagent-wrapper-darwin-amd64 +0 -0
  5. package/bin/codeagent-wrapper-darwin-arm64 +0 -0
  6. package/bin/codeagent-wrapper-linux-amd64 +0 -0
  7. package/bin/codeagent-wrapper-linux-arm64 +0 -0
  8. package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
  9. package/bin/codeagent-wrapper-windows-arm64.exe +0 -0
  10. package/hooks/pre-tool-use-task.sh +4 -4
  11. package/hooks/session-start.sh +8 -9
  12. package/hooks/user-prompt-submit.sh +53 -19
  13. package/lib/installer.js +50 -0
  14. package/lib/mcp-config.js +85 -0
  15. package/lib/prompts.js +92 -0
  16. package/lib/skills-core.js +208 -0
  17. package/package.json +10 -15
  18. package/skills/EVALUATION.md +2 -82
  19. package/skills/brainstorming/SKILL.md +7 -8
  20. package/skills/coordinating-multi-model-work/GATE.md +5 -4
  21. package/skills/coordinating-multi-model-work/INTEGRATION.md +79 -15
  22. package/skills/coordinating-multi-model-work/SKILL.md +33 -8
  23. package/skills/coordinating-multi-model-work/checkpoints.md +113 -14
  24. package/skills/coordinating-multi-model-work/context-sharing.md +71 -0
  25. package/skills/coordinating-multi-model-work/prompts/codex-base.md +47 -10
  26. package/skills/coordinating-multi-model-work/prompts/gemini-base.md +47 -10
  27. package/skills/coordinating-multi-model-work/review-chain.md +11 -13
  28. package/skills/coordinating-multi-model-work/routing-decision.md +81 -24
  29. package/skills/debugging-systematically/SKILL.md +13 -15
  30. package/skills/developing-with-subagents/SKILL.md +18 -15
  31. package/skills/developing-with-subagents/implementer-prompt.md +44 -14
  32. package/skills/executing-plans/SKILL.md +13 -9
  33. package/skills/shared/multi-model-integration-section.md +10 -7
  34. package/skills/shared/protocol-threshold.md +158 -21
  35. package/skills/shared/supplementary-tools.md +22 -18
  36. package/skills/verifying-before-completion/SKILL.md +3 -1
  37. package/templates/antigravity/config/antigravity/superpowers-ccg.yaml +4 -0
  38. package/templates/claude-code/.claude/commands/brainstorm.md +6 -0
  39. package/templates/claude-code/.claude/commands/execute-plan.md +6 -0
  40. package/templates/claude-code/.claude/commands/write-plan.md +6 -0
  41. package/templates/claude-code/.claude/hooks/hooks.json +37 -0
  42. package/templates/claude-code/.claude/hooks/pre-tool-use-task.sh +4 -0
  43. package/templates/claude-code/.claude/hooks/run-hook.cmd +19 -0
  44. package/templates/claude-code/.claude/hooks/session-start.sh +71 -0
  45. package/templates/claude-code/.claude/hooks/user-prompt-submit.sh +65 -0
  46. package/templates/claude-code/CLAUDE.md +5 -0
  47. package/templates/cursor/.cursor/rules/superpowers-ccg.mdc +9 -0
  48. package/.agent/skills/brainstorming/SKILL.md +0 -26
  49. package/.agent/skills/coordinating-multi-model-work/SKILL.md +0 -29
  50. package/.agent/skills/executing-plans/SKILL.md +0 -27
  51. package/.agent/skills/using-superpowers/SKILL.md +0 -29
  52. package/.agent/skills/verifying-before-completion/SKILL.md +0 -20
  53. package/.agent/skills/writing-plans/SKILL.md +0 -29
  54. package/.cursor/agents/code-reviewer.md +0 -22
  55. package/.cursor/commands/brainstorm.md +0 -11
  56. package/.cursor/commands/execute-plan.md +0 -12
  57. package/.cursor/commands/write-plan.md +0 -11
  58. package/.cursor/hook-scripts/after-file-edit.mjs +0 -3
  59. package/.cursor/hook-scripts/before-shell-execution.mjs +0 -3
  60. package/.cursor/hook-scripts/session-end.mjs +0 -3
  61. package/.cursor/hooks.json +0 -21
  62. package/.cursor/mcp.json +0 -20
  63. package/.cursor/rules/checkpoint-protocol.mdc +0 -11
  64. package/.cursor/rules/orchestrator-routing.mdc +0 -12
  65. package/.cursor/rules/token-discipline.mdc +0 -12
  66. package/.cursor/skills/brainstorming/SKILL.md +0 -26
  67. package/.cursor/skills/coordinating-multi-model-work/SKILL.md +0 -29
  68. package/.cursor/skills/executing-plans/SKILL.md +0 -27
  69. package/.cursor/skills/using-superpowers/SKILL.md +0 -29
  70. package/.cursor/skills/verifying-before-completion/SKILL.md +0 -20
  71. package/.cursor/skills/writing-plans/SKILL.md +0 -29
  72. package/AGENTS.md +0 -23
  73. package/CLAUDE.md +0 -78
  74. package/GEMINI.md +0 -27
  75. package/cli/superpowers-ccg.mjs +0 -8
  76. package/config/antigravity/mcp_config.example.json +0 -26
  77. package/skills/developing-with-subagents/code-quality-reviewer-prompt.md +0 -30
  78. package/skills/developing-with-subagents/spec-reviewer-prompt.md +0 -25
  79. package/skills/dispatching-parallel-agents/SKILL.md +0 -195
  80. package/skills/finishing-development-branches/SKILL.md +0 -208
  81. package/skills/practicing-test-driven-development/SKILL.md +0 -346
  82. package/skills/practicing-test-driven-development/testing-anti-patterns.md +0 -299
  83. package/skills/receiving-code-review/SKILL.md +0 -221
  84. package/skills/requesting-code-review/SKILL.md +0 -127
  85. package/skills/requesting-code-review/code-reviewer.md +0 -146
  86. package/skills/using-git-worktrees/SKILL.md +0 -225
  87. package/skills/using-superpowers/SKILL.md +0 -101
  88. package/skills/writing-skills/CHECKLIST.md +0 -92
  89. package/skills/writing-skills/SKILL.md +0 -111
  90. package/skills/writing-skills/STRUCTURE.md +0 -208
  91. package/skills/writing-skills/TESTING.md +0 -155
  92. package/skills/writing-skills/anthropic-best-practices.md +0 -1150
  93. package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  94. package/skills/writing-skills/graphviz-conventions.dot +0 -172
  95. package/skills/writing-skills/persuasion-principles.md +0 -187
  96. package/skills/writing-skills/render-graphs.js +0 -168
  97. package/skills/writing-skills/testing-skills-with-subagents.md +0 -384
  98. package/src/cli.mjs +0 -165
  99. package/src/constants.mjs +0 -7
  100. package/src/install.mjs +0 -186
  101. package/src/io.mjs +0 -81
package/lib/prompts.js ADDED
@@ -0,0 +1,92 @@
1
+ import prompts from 'prompts';
2
+
3
+ const AGENT_CHOICES = [
4
+ {
5
+ title: 'Claude Code',
6
+ value: 'claude-code'
7
+ },
8
+ {
9
+ title: 'Cursor',
10
+ value: 'cursor'
11
+ },
12
+ {
13
+ title: 'Antigravity',
14
+ value: 'antigravity'
15
+ }
16
+ ];
17
+
18
+ export async function collectInteractiveConfig() {
19
+ const answers = await prompts(
20
+ [
21
+ {
22
+ type: 'multiselect',
23
+ name: 'agents',
24
+ message: 'Which agents do you want to install?',
25
+ choices: AGENT_CHOICES,
26
+ min: 1,
27
+ instructions: false
28
+ },
29
+ {
30
+ type: 'text',
31
+ name: 'grokApiUrl',
32
+ message: 'GROK_API_URL',
33
+ validate: requiredValue
34
+ },
35
+ {
36
+ type: 'password',
37
+ name: 'grokApiKey',
38
+ message: 'GROK_API_KEY',
39
+ validate: requiredValue
40
+ },
41
+ {
42
+ type: 'text',
43
+ name: 'tavilyApiUrl',
44
+ message: 'TAVILY_API_URL (optional)'
45
+ },
46
+ {
47
+ type: 'password',
48
+ name: 'tavilyApiKey',
49
+ message: 'TAVILY_API_KEY (optional)'
50
+ },
51
+ {
52
+ type: 'password',
53
+ name: 'firecrawlApiKey',
54
+ message: 'FIRECRAWL_API_KEY (optional)'
55
+ },
56
+ {
57
+ type: 'text',
58
+ name: 'firecrawlApiUrl',
59
+ message: 'FIRECRAWL_API_URL (optional)'
60
+ }
61
+ ],
62
+ {
63
+ onCancel() {
64
+ throw new Error('Installation cancelled.');
65
+ }
66
+ }
67
+ );
68
+
69
+ return {
70
+ agents: answers.agents,
71
+ mcpEnv: buildMcpEnv({
72
+ GROK_API_URL: answers.grokApiUrl,
73
+ GROK_API_KEY: answers.grokApiKey,
74
+ TAVILY_API_URL: answers.tavilyApiUrl,
75
+ TAVILY_API_KEY: answers.tavilyApiKey,
76
+ FIRECRAWL_API_KEY: answers.firecrawlApiKey,
77
+ FIRECRAWL_API_URL: answers.firecrawlApiUrl
78
+ })
79
+ };
80
+ }
81
+
82
+ function requiredValue(value) {
83
+ return value && value.trim() ? true : 'This value is required.';
84
+ }
85
+
86
+ function buildMcpEnv(values) {
87
+ return Object.fromEntries(
88
+ Object.entries(values)
89
+ .map(([key, value]) => [key, typeof value === 'string' ? value.trim() : ''])
90
+ .filter(([, value]) => value)
91
+ );
92
+ }
@@ -0,0 +1,208 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { execSync } from 'child_process';
4
+
5
+ /**
6
+ * Extract YAML frontmatter from a skill file.
7
+ * Current format:
8
+ * ---
9
+ * name: skill-name
10
+ * description: Use when [condition] - [what it does]
11
+ * ---
12
+ *
13
+ * @param {string} filePath - Path to SKILL.md file
14
+ * @returns {{name: string, description: string}}
15
+ */
16
+ function extractFrontmatter(filePath) {
17
+ try {
18
+ const content = fs.readFileSync(filePath, 'utf8');
19
+ const lines = content.split('\n');
20
+
21
+ let inFrontmatter = false;
22
+ let name = '';
23
+ let description = '';
24
+
25
+ for (const line of lines) {
26
+ if (line.trim() === '---') {
27
+ if (inFrontmatter) break;
28
+ inFrontmatter = true;
29
+ continue;
30
+ }
31
+
32
+ if (inFrontmatter) {
33
+ const match = line.match(/^(\w+):\s*(.*)$/);
34
+ if (match) {
35
+ const [, key, value] = match;
36
+ switch (key) {
37
+ case 'name':
38
+ name = value.trim();
39
+ break;
40
+ case 'description':
41
+ description = value.trim();
42
+ break;
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ return { name, description };
49
+ } catch (error) {
50
+ return { name: '', description: '' };
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Find all SKILL.md files in a directory recursively.
56
+ *
57
+ * @param {string} dir - Directory to search
58
+ * @param {string} sourceType - 'personal' or 'superpowers' for namespacing
59
+ * @param {number} maxDepth - Maximum recursion depth (default: 3)
60
+ * @returns {Array<{path: string, name: string, description: string, sourceType: string}>}
61
+ */
62
+ function findSkillsInDir(dir, sourceType, maxDepth = 3) {
63
+ const skills = [];
64
+
65
+ if (!fs.existsSync(dir)) return skills;
66
+
67
+ function recurse(currentDir, depth) {
68
+ if (depth > maxDepth) return;
69
+
70
+ const entries = fs.readdirSync(currentDir, { withFileTypes: true });
71
+
72
+ for (const entry of entries) {
73
+ const fullPath = path.join(currentDir, entry.name);
74
+
75
+ if (entry.isDirectory()) {
76
+ // Check for SKILL.md in this directory
77
+ const skillFile = path.join(fullPath, 'SKILL.md');
78
+ if (fs.existsSync(skillFile)) {
79
+ const { name, description } = extractFrontmatter(skillFile);
80
+ skills.push({
81
+ path: fullPath,
82
+ skillFile: skillFile,
83
+ name: name || entry.name,
84
+ description: description || '',
85
+ sourceType: sourceType
86
+ });
87
+ }
88
+
89
+ // Recurse into subdirectories
90
+ recurse(fullPath, depth + 1);
91
+ }
92
+ }
93
+ }
94
+
95
+ recurse(dir, 0);
96
+ return skills;
97
+ }
98
+
99
+ /**
100
+ * Resolve a skill name to its file path, handling shadowing
101
+ * (personal skills override superpowers skills).
102
+ *
103
+ * @param {string} skillName - Name like "superpowers:brainstorming" or "my-skill"
104
+ * @param {string} superpowersDir - Path to superpowers skills directory
105
+ * @param {string} personalDir - Path to personal skills directory
106
+ * @returns {{skillFile: string, sourceType: string, skillPath: string} | null}
107
+ */
108
+ function resolveSkillPath(skillName, superpowersDir, personalDir) {
109
+ // Strip superpowers: prefix if present
110
+ const forceSuperpowers = skillName.startsWith('superpowers:');
111
+ const actualSkillName = forceSuperpowers ? skillName.replace(/^superpowers:/, '') : skillName;
112
+
113
+ // Try personal skills first (unless explicitly superpowers:)
114
+ if (!forceSuperpowers && personalDir) {
115
+ const personalPath = path.join(personalDir, actualSkillName);
116
+ const personalSkillFile = path.join(personalPath, 'SKILL.md');
117
+ if (fs.existsSync(personalSkillFile)) {
118
+ return {
119
+ skillFile: personalSkillFile,
120
+ sourceType: 'personal',
121
+ skillPath: actualSkillName
122
+ };
123
+ }
124
+ }
125
+
126
+ // Try superpowers skills
127
+ if (superpowersDir) {
128
+ const superpowersPath = path.join(superpowersDir, actualSkillName);
129
+ const superpowersSkillFile = path.join(superpowersPath, 'SKILL.md');
130
+ if (fs.existsSync(superpowersSkillFile)) {
131
+ return {
132
+ skillFile: superpowersSkillFile,
133
+ sourceType: 'superpowers',
134
+ skillPath: actualSkillName
135
+ };
136
+ }
137
+ }
138
+
139
+ return null;
140
+ }
141
+
142
+ /**
143
+ * Check if a git repository has updates available.
144
+ *
145
+ * @param {string} repoDir - Path to git repository
146
+ * @returns {boolean} - True if updates are available
147
+ */
148
+ function checkForUpdates(repoDir) {
149
+ try {
150
+ // Quick check with 3 second timeout to avoid delays if network is down
151
+ const output = execSync('git fetch origin && git status --porcelain=v1 --branch', {
152
+ cwd: repoDir,
153
+ timeout: 3000,
154
+ encoding: 'utf8',
155
+ stdio: 'pipe'
156
+ });
157
+
158
+ // Parse git status output to see if we're behind
159
+ const statusLines = output.split('\n');
160
+ for (const line of statusLines) {
161
+ if (line.startsWith('## ') && line.includes('[behind ')) {
162
+ return true; // We're behind remote
163
+ }
164
+ }
165
+ return false; // Up to date
166
+ } catch (error) {
167
+ // Network down, git error, timeout, etc. - don't block bootstrap
168
+ return false;
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Strip YAML frontmatter from skill content, returning just the content.
174
+ *
175
+ * @param {string} content - Full content including frontmatter
176
+ * @returns {string} - Content without frontmatter
177
+ */
178
+ function stripFrontmatter(content) {
179
+ const lines = content.split('\n');
180
+ let inFrontmatter = false;
181
+ let frontmatterEnded = false;
182
+ const contentLines = [];
183
+
184
+ for (const line of lines) {
185
+ if (line.trim() === '---') {
186
+ if (inFrontmatter) {
187
+ frontmatterEnded = true;
188
+ continue;
189
+ }
190
+ inFrontmatter = true;
191
+ continue;
192
+ }
193
+
194
+ if (frontmatterEnded || !inFrontmatter) {
195
+ contentLines.push(line);
196
+ }
197
+ }
198
+
199
+ return contentLines.join('\n').trim();
200
+ }
201
+
202
+ export {
203
+ extractFrontmatter,
204
+ findSkillsInDir,
205
+ resolveSkillPath,
206
+ checkForUpdates,
207
+ stripFrontmatter
208
+ };
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@nst173/superpowers-ccg",
3
- "version": "1.3.0",
4
- "description": "CLI to install Superpowers CCG workflows at project level for Claude Code, Cursor, and Antigravity.",
3
+ "version": "1.3.1",
4
+ "description": "Superpowers CCG workflows for Claude Code, Cursor, and Antigravity.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "superpowers-ccg": "./cli/superpowers-ccg.mjs",
8
- "spccg": "./cli/superpowers-ccg.mjs"
7
+ "superpowers-ccg": "./bin/cli.js"
9
8
  },
10
9
  "files": [
11
10
  "AGENTS.md",
@@ -17,16 +16,10 @@
17
16
  "commands",
18
17
  "hooks",
19
18
  "skills",
20
- ".cursor",
21
- ".agent",
22
- "config/antigravity",
23
- "cli",
24
- "src"
19
+ "bin",
20
+ "lib",
21
+ "templates"
25
22
  ],
26
- "scripts": {
27
- "test:smoke": "node scripts/smoke-test-cli.mjs",
28
- "prepublishOnly": "npm run test:smoke"
29
- },
30
23
  "keywords": [
31
24
  "claude-code",
32
25
  "cursor",
@@ -34,8 +27,7 @@
34
27
  "workflow",
35
28
  "skills",
36
29
  "orchestrator",
37
- "mcp",
38
- "cli"
30
+ "mcp"
39
31
  ],
40
32
  "license": "MIT",
41
33
  "author": "nst173",
@@ -50,6 +42,9 @@
50
42
  "engines": {
51
43
  "node": ">=18"
52
44
  },
45
+ "dependencies": {
46
+ "prompts": "2.4.2"
47
+ },
53
48
  "publishConfig": {
54
49
  "access": "public"
55
50
  }
@@ -18,37 +18,7 @@ Use evaluation scenarios (per Anthropic best practices) to validate skill effect
18
18
 
19
19
  ## Core Workflow Skills
20
20
 
21
- ### test-driven-development
22
-
23
- ```json
24
- {
25
- "skill": "test-driven-development",
26
- "query": "Add a function to validate email format",
27
- "expected_behavior": [
28
- "Write a failing test before implementation",
29
- "Run tests to confirm failure and show the reason",
30
- "Write minimal code to make the test pass",
31
- "Run tests to confirm passing",
32
- "Do not add functionality beyond the test scope"
33
- ]
34
- }
35
- ```
36
-
37
- ```json
38
- {
39
- "skill": "test-driven-development",
40
- "query": "This function has a bug, please fix it",
41
- "context": "src/utils/parser.ts",
42
- "expected_behavior": [
43
- "Write a failing test that reproduces the bug",
44
- "Confirm the test fails for the correct reason",
45
- "Fix the code",
46
- "Confirm the test passes"
47
- ]
48
- }
49
- ```
50
-
51
- ### debugging-systematically
21
+ ### debugging-systematically
52
22
 
53
23
  ```json
54
24
  {
@@ -143,57 +113,7 @@ Use evaluation scenarios (per Anthropic best practices) to validate skill effect
143
113
  }
144
114
  ```
145
115
 
146
- ## Supporting Skills
147
-
148
- ### using-git-worktrees
149
-
150
- ```json
151
- {
152
- "skill": "using-git-worktrees",
153
- "query": "Create an isolated workspace to develop a new feature",
154
- "expected_behavior": [
155
- "Check existing .worktrees or worktrees directories",
156
- "Verify the directory is gitignored",
157
- "If not ignored, add it to .gitignore and commit",
158
- "Run project setup after creating the worktree",
159
- "Run tests to verify a clean baseline"
160
- ]
161
- }
162
- ```
163
-
164
- ### finishing-development-branches
165
-
166
- ```json
167
- {
168
- "skill": "finishing-development-branches",
169
- "query": "Development is complete, help me handle the branch",
170
- "expected_behavior": [
171
- "Run tests and verify they pass",
172
- "Do not offer completion options if tests fail",
173
- "Provide exactly 4 options",
174
- "Require confirmation when discarding",
175
- "Clean up the worktree correctly"
176
- ]
177
- }
178
- ```
179
-
180
- ### dispatching-parallel-agents
181
-
182
- ```json
183
- {
184
- "skill": "dispatching-parallel-agents",
185
- "query": "Five test files are failing, help me fix them",
186
- "expected_behavior": [
187
- "Identify whether failures are independent",
188
- "If independent, group them by problem domain",
189
- "Dispatch multiple agents in parallel",
190
- "Give each agent a clear scope and constraints",
191
- "Summarize results and verify no conflicts"
192
- ]
193
- }
194
- ```
195
-
196
- ## Run the Evaluation
116
+ ## Run the Evaluation
197
117
 
198
118
  1. Run the query without the skill and record behavior
199
119
  2. Enable the skill and run the same query
@@ -29,10 +29,10 @@ Follow `skills/shared/protocol-threshold.md`. The hook injects CP reminders auto
29
29
 
30
30
  **Supplementary tools (optional, enhance research):**
31
31
  - **Grok Search (Tavily):** If the idea involves unfamiliar tech, current trends, or competitive analysis — use `mcp__grok-search__web_search` to gather real-time information before proposing approaches. Especially useful when the user references a library, service, or pattern you're uncertain about.
32
- - **Serena:** If the project is large (>10 files involved) — use Serena for semantic codebase exploration to understand existing architecture and symbol relationships.
32
+ - **Auggie:** If the project is large (>10 files involved) — use Auggie for full-context semantic codebase retrieval to understand the existing architecture and likely implementation anchors.
33
33
  - See `skills/shared/supplementary-tools.md` for full reference.
34
34
 
35
- **► CP1 (Task Analysis):** After understanding the idea, apply `coordinating-multi-model-work/checkpoints.md`.
35
+ **► CP1 (Task Assessment & Routing):** After understanding the idea, apply `coordinating-multi-model-work/checkpoints.md`.
36
36
 
37
37
  **Exploring approaches:**
38
38
 
@@ -41,7 +41,7 @@ Follow `skills/shared/protocol-threshold.md`. The hook injects CP reminders auto
41
41
  - Lead with your recommended option and explain why
42
42
  - **Sequential-Thinking (optional):** For complex designs with 3+ interacting components, use Sequential-Thinking MCP to systematically decompose trade-offs and validate reasoning chains before presenting options.
43
43
 
44
- **► CP2 (Mid-Review):** When multiple approaches have significant trade-offs, apply `coordinating-multi-model-work/checkpoints.md`.
44
+ **CP2 note:** CP2 is the external execution phase and starts only after the design is routed into implementation.
45
45
 
46
46
  **Presenting the design:**
47
47
 
@@ -100,11 +100,10 @@ TaskUpdate:
100
100
 
101
101
  Before handing off to writing-plans, run `TaskList` to display the complete task tree with dependency status so the user can confirm it looks right.
102
102
 
103
- **Implementation (if continuing):**
104
-
105
- - Ask: "Ready to set up for implementation?"
106
- - Use superpowers:using-git-worktrees to create isolated workspace
107
- - Use superpowers:writing-plans to create detailed implementation plan
103
+ **Implementation (if continuing):**
104
+
105
+ - Ask: "Ready to turn this into an implementation plan?"
106
+ - Use superpowers:writing-plans to create detailed implementation plan
108
107
 
109
108
  ## Key Principles
110
109
 
@@ -5,7 +5,7 @@ Use this gate whenever a skill decides **Routing != CLAUDE** (`CODEX`, `GEMINI`,
5
5
  ## Core Rule
6
6
 
7
7
  - If `Routing != CLAUDE`, you must obtain external model output via MCP tools (`mcp__codex__codex`, `mcp__gemini__gemini`).
8
- - If code changed, you must run the review chain per `coordinating-multi-model-work/review-chain.md`.
8
+ - You must finish with CP4 Final Spec Review per `coordinating-multi-model-work/review-chain.md`.
9
9
  - If you cannot obtain required external output, stop in `BLOCKED`.
10
10
 
11
11
  ## Evidence Requirement
@@ -20,9 +20,10 @@ Evidence (Implementation):
20
20
  - Params: <key MCP parameters used>
21
21
  - Result: <3-6 bullets>
22
22
 
23
- Evidence (Opus Review):
24
- - Reviewer: Opus
25
- - Artifact: <commit SHA>
23
+ Evidence (CP4 Spec Review):
24
+ - Reviewer: Claude
25
+ - Status: PASS | PARTIAL | FAIL
26
+ - Artifact: <files reviewed>
26
27
  - Result: <3-6 bullets>
27
28
  ```
28
29
 
@@ -5,47 +5,111 @@ Claude is orchestrator-only. All implementation code goes through external model
5
5
  ## Standard Pattern
6
6
 
7
7
  1. Define one bounded task.
8
- 2. Include only the minimum context needed to complete that task.
9
- 3. Ask the worker for one of two outcomes:
10
- - changed hunks / patch-ready diff
11
- - blocking questions
12
- 4. Reuse `SESSION_ID` only for follow-up fixes on the same task.
13
- 5. Run Opus review on the resulting artifact.
8
+ 2. Turn CP0 findings into small reusable `CONTEXT_ARTIFACTS`.
9
+ 3. Build one `TASK_CONTEXT_BUNDLE` for the bounded task.
10
+ 4. If routing is not `CLAUDE`, execute CP2 with:
11
+ - a compressed original user request
12
+ - `CONTEXT_REFS` from the task-scoped bundle
13
+ - `HYDRATED_CONTEXT` snippets for that task only
14
+ - the CP1 task summary
15
+ - the explicit file set
16
+ - the success criteria and verify command for the bounded task
17
+ 5. Ask the worker to return complete final file content whenever practical, with unified diff patch as fallback, using External Response Protocol v1.1.
18
+ 6. Reuse `SESSION_ID` only for follow-up fixes on the same task, and send deltas only:
19
+ - changed refs
20
+ - new hydrated snippets
21
+ - updated verification failures or spec gaps
22
+ 7. If CP1 chose `Cross-Validation`, or CP2 returned conflicts, overlap, gaps, clarifications, or continuation requests, run CP3 Reconciliation as Claude's decision layer.
23
+ 8. Always run CP4 Final Spec Review after CP3, or directly after CP2/Claude-only work when no reconciliation is needed.
24
+ 9. Only `PASS` completes the task. `PARTIAL` and `FAIL` require a retry, follow-up, or user clarification.
14
25
 
15
26
  ## Hard Rules
16
27
 
17
28
  - Do not ask for draft code that the orchestrator will later re-implement.
18
29
  - Do not ask for design prose on an implementation task.
19
30
  - Do not restate the whole PRD, plan, or prior conversation in every prompt.
31
+ - Do not repaste the full CP0 discovery output into every worker prompt.
20
32
  - Do not send multiple workers the same bounded implementation task.
33
+ - Do not ask for changed hunks only when the worker can return the final file content directly.
34
+ - Do not turn CP4 into a code-quality or best-practice review pass.
21
35
 
22
36
  ## Prompt Structure
23
37
 
24
38
  Every implementation prompt should contain:
25
39
 
26
40
  ```text
27
- ## Task
41
+ ## Original User Request
42
+ [original user request]
43
+
44
+ ## Task Context Bundle
45
+ TASK_ID: [stable bounded-task id]
46
+
47
+ ## Context Refs
48
+ - [artifact id]
49
+ - [artifact id]
50
+
51
+ ## Hydrated Context
52
+ [only the small context snippets needed to complete this bounded task]
53
+
54
+ ## CP1 Task Summary
28
55
  [single bounded task]
29
56
 
30
57
  ## Files
31
58
  [explicit file set]
32
59
 
33
- ## Acceptance
60
+ ## Success Criteria
34
61
  [2-5 concrete checks]
35
62
 
36
63
  ## Verify
37
64
  [exact command]
38
65
 
39
66
  ## Response Protocol
40
- FIRST: Read Serena memory 'global/response_protocol' for full format rules.
41
- FALLBACK: Output only one of:
42
- 1. ## DIFF ## VERIFY → ## ISSUES
43
- 2. ## QUESTIONS
67
+ Use exactly this structure:
68
+
69
+ # EXTERNAL RESPONSE PROTOCOL v1.1
70
+
71
+ ## SUMMARY
72
+ [one sentence]
73
+
74
+ ## FILES MODIFIED
75
+ | Action | File Path | Description of Change |
76
+ |---------|--------------------|-----------------------|
77
+ | Created | src/... | ... |
78
+ | Edited | src/... | ... |
79
+
80
+ ## FILE CONTENTS
81
+ [complete final file content for each modified file, preferred; unified diff patch only when full content is impractical]
82
+
83
+ ## CONTEXT ARTIFACTS
84
+ [optional reusable artifacts discovered or updated during execution]
85
+
86
+ ## SPEC COMPLIANCE
87
+ - Meets Spec? YES / PARTIAL / NO
88
+ - Explanation: ...
89
+
90
+ ## CLARIFICATIONS NEEDED
91
+ None (or list questions)
92
+
93
+ ## NEXT STEPS / CONTINUATION
94
+ TASK_COMPLETE / CONTINUE_SESSION / HANDOVER_TO_CLAUDE
44
95
  ```
45
96
 
46
97
  ## When To Cross-Validate
47
98
 
48
99
  Use `CROSS_VALIDATION` only for design arbitration or unresolved multi-domain ambiguity. When you do:
49
- - ask both models the same narrow question
50
- - compare only divergences
51
- - do not ask both to generate full implementations
100
+ - keep the file set and success criteria narrow
101
+ - compare only the meaningful divergences
102
+ - return one reconciled artifact in External Response Protocol v1.1, not two unrelated implementations
103
+
104
+ ## CP4 Final Spec Review
105
+
106
+ Claude performs CP4 in the main thread using:
107
+ - the original user request
108
+ - the CP1 task summary
109
+ - the CP1 success criteria
110
+ - the files modified by the workflow
111
+
112
+ CP4 returns:
113
+ - `PASS` when the implementation fully satisfies the spec
114
+ - `PARTIAL` when some required behavior is missing or incomplete
115
+ - `FAIL` when a core requirement is not satisfied