ultra-builder-pro-cli 0.9.0 → 0.11.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 (119) hide show
  1. package/CHANGELOG.md +92 -1
  2. package/README.md +11 -6
  3. package/adapters/_shared/codex-assets.cjs +23 -331
  4. package/adapters/_shared/handbook.cjs +2 -0
  5. package/adapters/_shared/runtime-assets.cjs +25 -0
  6. package/adapters/_shared/tests/handbook.test.cjs +3 -0
  7. package/adapters/_shared/tests/runtime-assets.test.cjs +12 -4
  8. package/adapters/claude.js +28 -5
  9. package/adapters/kimi.js +15 -138
  10. package/adapters/opencode.js +59 -63
  11. package/adapters/tests/claude.test.cjs +26 -9
  12. package/adapters/tests/codex.test.cjs +23 -9
  13. package/adapters/tests/kimi.test.cjs +15 -11
  14. package/adapters/tests/opencode.test.cjs +57 -10
  15. package/agents/code-reviewer.md +24 -85
  16. package/agents/debugger.md +30 -132
  17. package/agents/review-code.md +24 -104
  18. package/agents/review-comments.md +20 -83
  19. package/agents/review-coordinator.md +40 -137
  20. package/agents/review-design.md +21 -118
  21. package/agents/review-errors.md +22 -70
  22. package/agents/review-spec.md +36 -0
  23. package/agents/review-tests.md +20 -76
  24. package/agents/tdd-runner.md +26 -84
  25. package/commands/learn.md +5 -36
  26. package/commands/ultra-change.md +5 -43
  27. package/commands/ultra-deliver.md +4 -46
  28. package/commands/ultra-dev.md +4 -48
  29. package/commands/ultra-doctor.md +4 -30
  30. package/commands/ultra-init.md +5 -47
  31. package/commands/ultra-plan.md +5 -48
  32. package/commands/ultra-research.md +5 -54
  33. package/commands/ultra-status.md +5 -44
  34. package/commands/ultra-test.md +5 -45
  35. package/commands/ultra-think.md +5 -40
  36. package/docs/AGENT-CONTEXT.md +34 -12
  37. package/docs/ARCHITECTURE.md +31 -5
  38. package/docs/PLAN.zh-CN.md +3 -2
  39. package/docs/ROADMAP.md +5 -4
  40. package/docs/RUNTIME-COMPAT-MATRIX.md +7 -5
  41. package/docs/SKILL-AUTHORING.md +75 -0
  42. package/docs/USER-HANDBOOK-CONTRACT.md +9 -2
  43. package/hooks/README.md +6 -4
  44. package/hooks/active_task_context.py +14 -0
  45. package/hooks/context_spine.py +218 -0
  46. package/hooks/health_check.py +1 -1
  47. package/hooks/workflow_context.py +16 -123
  48. package/hooks/workflow_resume.py +21 -0
  49. package/mcp-server/lib/change-workflow.cjs +89 -11
  50. package/mcp-server/lib/change-workflow.test.cjs +202 -7
  51. package/mcp-server/lib/context-spine.cjs +331 -0
  52. package/mcp-server/lib/context-spine.test.cjs +73 -0
  53. package/mcp-server/lib/spec-learning.cjs +191 -0
  54. package/mcp-server/lib/spec-learning.test.cjs +62 -0
  55. package/mcp-server/lib/state-db.cjs +72 -10
  56. package/mcp-server/lib/state-db.test.cjs +7 -2
  57. package/mcp-server/server.cjs +31 -1
  58. package/mcp-server/tests/db-ops.test.cjs +3 -3
  59. package/mcp-server/tests/server-contract.test.cjs +74 -0
  60. package/mcp-server/tests/state-db.test.cjs +20 -3
  61. package/package.json +3 -2
  62. package/skills/cc-collab/SKILL.md +16 -18
  63. package/skills/code-review-expert/SKILL.md +39 -114
  64. package/skills/code-review-expert/references/correctness-reliability.md +30 -0
  65. package/skills/code-review-expert/references/design-boundaries.md +26 -0
  66. package/skills/code-review-expert/references/removal-plan.md +17 -45
  67. package/skills/codex-collab/SKILL.md +23 -28
  68. package/skills/codex-collab/evals/evals.json +18 -23
  69. package/skills/integration-rules/SKILL.md +28 -67
  70. package/skills/learn/SKILL.md +46 -105
  71. package/skills/security-rules/SKILL.md +34 -56
  72. package/skills/testing-rules/SKILL.md +28 -52
  73. package/skills/ultra-change/SKILL.md +61 -145
  74. package/skills/ultra-deliver/SKILL.md +63 -229
  75. package/skills/ultra-dev/SKILL.md +46 -338
  76. package/skills/ultra-doctor/SKILL.md +39 -71
  77. package/skills/ultra-init/SKILL.md +59 -139
  78. package/skills/ultra-plan/SKILL.md +50 -310
  79. package/skills/ultra-research/SKILL.md +59 -152
  80. package/skills/ultra-research/references/architecture.md +38 -0
  81. package/skills/ultra-research/references/problem-product.md +39 -0
  82. package/skills/ultra-research/references/quality-delivery.md +34 -0
  83. package/skills/ultra-research/references/synthesis.md +38 -0
  84. package/skills/ultra-research/references/users-scope.md +40 -0
  85. package/skills/ultra-review/SKILL.md +55 -427
  86. package/skills/ultra-review/references/unified-schema.md +76 -101
  87. package/skills/ultra-review/scripts/review_wait.py +242 -77
  88. package/skills/ultra-status/SKILL.md +38 -173
  89. package/skills/ultra-test/SKILL.md +41 -195
  90. package/skills/ultra-think/SKILL.md +43 -101
  91. package/skills/ultra-verify/SKILL.md +44 -84
  92. package/skills/ultra-verify/evals/evals.json +24 -27
  93. package/spec/cli-protocol.md +3 -0
  94. package/spec/mcp-tools.yaml +133 -4
  95. package/spec/schemas/command-manifest.schema.json +7 -25
  96. package/spec/schemas/skill-manifest.schema.json +9 -79
  97. package/spec/schemas/state-db.sql +31 -0
  98. package/skills/code-review-expert/references/code-quality-checklist.md +0 -112
  99. package/skills/code-review-expert/references/integration-checklist.md +0 -46
  100. package/skills/code-review-expert/references/security-checklist.md +0 -100
  101. package/skills/code-review-expert/references/solid-checklist.md +0 -65
  102. package/skills/ultra-research/steps/step-00-problem-validation.md +0 -154
  103. package/skills/ultra-research/steps/step-01-opportunity-discovery.md +0 -172
  104. package/skills/ultra-research/steps/step-02-market-assessment.md +0 -195
  105. package/skills/ultra-research/steps/step-03-competitive-landscape.md +0 -197
  106. package/skills/ultra-research/steps/step-04-product-strategy.md +0 -196
  107. package/skills/ultra-research/steps/step-05-assumptions-validation.md +0 -234
  108. package/skills/ultra-research/steps/step-10-user-personas.md +0 -169
  109. package/skills/ultra-research/steps/step-11-user-scenarios.md +0 -181
  110. package/skills/ultra-research/steps/step-20-user-stories.md +0 -156
  111. package/skills/ultra-research/steps/step-21-features-scope.md +0 -157
  112. package/skills/ultra-research/steps/step-22-success-metrics.md +0 -195
  113. package/skills/ultra-research/steps/step-30-architecture-context.md +0 -154
  114. package/skills/ultra-research/steps/step-31-solution-strategy.md +0 -172
  115. package/skills/ultra-research/steps/step-32-building-blocks.md +0 -188
  116. package/skills/ultra-research/steps/step-40-deployment.md +0 -123
  117. package/skills/ultra-research/steps/step-41-quality-risks.md +0 -135
  118. package/skills/ultra-research/steps/step-99-synthesis.md +0 -188
  119. package/skills/ultra-review/scripts/review_verdict_update.py +0 -99
@@ -85,7 +85,10 @@ test('Kimi manifest exposes native skills, commands, hooks, session bootstrap, a
85
85
 
86
86
  const hookText = JSON.stringify(manifest.hooks);
87
87
  assert.match(hookText, /hooks\/adapters\/kimi\.py/);
88
- for (const hook of WORKFLOW_HOOK_FILES) assert.match(hookText, new RegExp(hook.replace('.', '\\.')));
88
+ for (const hook of WORKFLOW_HOOK_FILES.filter((value) => value !== 'context_spine.py')) {
89
+ assert.match(hookText, new RegExp(hook.replace('.', '\\.')));
90
+ }
91
+ assert.ok(fs.existsSync(path.join(pluginRoot, 'hooks', 'context_spine.py')));
89
92
  assert.doesNotMatch(hookText, /memory|recall|journal|prompt[_ -]?capture|block_dangerous|post_edit_guard/i);
90
93
 
91
94
  const commands = fs.readdirSync(path.join(pluginRoot, 'commands')).sort();
@@ -118,19 +121,19 @@ test('Kimi assets are allowlisted and adapted to native tools and paths', () =>
118
121
  path.join(pluginRoot, 'skills', 'using-ultra-builder-pro', 'SKILL.md'),
119
122
  'utf8',
120
123
  );
121
- assert.match(learn, /~\/.kimi-code\/skills\/learned-<pattern-slug>-unverified\/SKILL\.md/);
124
+ assert.match(learn, /`~\/.kimi-code\/skills`/);
125
+ assert.doesNotMatch(learn, /_unverified|learned-[^\s/]*-unverified/i);
122
126
  assert.match(review, /Kimi `AgentSwarm`/);
123
- assert.match(review, /5 specialized reviewers/);
124
- assert.doesNotMatch(review, /6 specialized|ALL 6/);
125
- assert.match(review, /\$KIMI_PLUGIN_ROOT\/agents\/review-code\.md/);
126
- assert.match(review, /`prompt_template` containing\s+`\{\{item\}\}`/);
127
- assert.match(review, /selected reviewer names as the `items` array/);
128
- assert.match(review, /Launch the coordinator with one foreground Kimi `Agent` call/);
129
- assert.doesNotMatch(review, /background mode|Set Kimi `AgentSwarm` parallel execution|Launch review-coordinator with Kimi `AgentSwarm`/);
130
- assert.match(init, /\| Kimi \| `\/ultra-builder-pro:ultra-init/);
131
- assert.doesNotMatch(init, /codex exec "run \/ultra-init/);
127
+ assert.match(review, /\$KIMI_PLUGIN_ROOT\/agents\//);
128
+ assert.match(review, /scripts\/review_wait\.py/);
129
+ assert.match(review, /spec_fidelity/);
130
+ assert.match(review, /engineering_standards/);
131
+ assert.doesNotMatch(review, /background mode|run_in_background/);
132
+ assert.match(init, /task\.init_project/);
133
+ assert.doesNotMatch(init, /Claude Code|OpenCode|Codex/);
132
134
  assert.match(bootstrap, /\.ultra\/state\.db/);
133
135
  assert.match(bootstrap, /external providers/);
136
+ assert.match(fs.readFileSync(path.join(pluginRoot, 'skills', 'codex-collab', 'SKILL.md'), 'utf8'), /--ephemeral/);
134
137
 
135
138
  const allPromptAssets = [];
136
139
  for (const root of ['commands', 'skills', 'agents']) {
@@ -149,6 +152,7 @@ test('Kimi assets are allowlisted and adapted to native tools and paths', () =>
149
152
  const text = fs.readFileSync(file, 'utf8');
150
153
  assert.doesNotMatch(text, foreign, file);
151
154
  assert.doesNotMatch(text, /(^|[\s`("'])\/ultra-(?!builder-pro:)[a-z]/m, file);
155
+ assert.doesNotMatch(text, /[\u3400-\u9fff]|ultra-review-findings-v1|Context7|Exa MCP|confidence\s*>=?\s*\d+/iu, file);
152
156
  }
153
157
  } finally {
154
158
  fs.rmSync(home, { recursive: true, force: true });
@@ -5,6 +5,7 @@ const assert = require('node:assert/strict');
5
5
  const fs = require('node:fs');
6
6
  const os = require('node:os');
7
7
  const path = require('node:path');
8
+ const { execFileSync } = require('node:child_process');
8
9
  const { pathToFileURL } = require('node:url');
9
10
 
10
11
  const opencode = require('../opencode.js');
@@ -63,15 +64,17 @@ test('install performs content-level OpenCode adaptation for commands, skills, r
63
64
  const verify = fs.readFileSync(path.join(target, 'skills', 'ultra-verify', 'SKILL.md'), 'utf8');
64
65
 
65
66
  assert.deepEqual(Object.keys(parseFm(plan).fm), ['name', 'description']);
66
- assert.match(learn, /~\/.config\/opencode\/skills\/learned-<pattern-slug>-unverified\/SKILL\.md/);
67
- assert.doesNotMatch(learn, /_unverified\.md/);
68
- assert.match(review, /~\/.config\/opencode\/skills\/ultra-review\/scripts\/review_wait\.py/);
67
+ assert.match(learn, /`~\/.config\/opencode\/skills`/);
68
+ assert.doesNotMatch(learn, /_unverified|learned-[^\s/]*-unverified/i);
69
+ assert.match(review, /OpenCode `task` tool/);
70
+ assert.match(review, /scripts\/review_wait\.py/);
69
71
  assert.match(codexCollab, /OpenCode remains primary/);
70
- assert.match(verify, /OpenCode remains primary/);
72
+ assert.match(verify, /OpenCode writes the first analysis/);
71
73
  assert.match(verify, /opencode-analysis\.md/);
72
74
  assert.match(verify, /codex exec -s read-only/);
73
- assert.match(plan, /LEGACY_STATE_MIGRATION_REQUIRED/);
74
- assert.match(plan, /never read or write .*tasks\.json/i);
75
+ assert.match(verify, /--ignore-user-config/);
76
+ assert.doesNotMatch(plan, /LEGACY_STATE_MIGRATION_REQUIRED|v4\.4|v4\.5/);
77
+ assert.match(plan, /never read or\s+write .*tasks\.json/i);
75
78
  assert.doesNotMatch(plan, /ultra-tools task create/);
76
79
 
77
80
  const markdown = [];
@@ -88,7 +91,9 @@ test('install performs content-level OpenCode adaptation for commands, skills, r
88
91
  }
89
92
  const incompatible = /~\/.claude|CLAUDE\.md|AskUserQuestion|TaskCreate|TaskUpdate|TaskList|run_in_background:\s*true|--yolo|--full-auto|\/codex:|ask\.question|review\.run/;
90
93
  for (const file of markdown) {
91
- assert.doesNotMatch(fs.readFileSync(file, 'utf8'), incompatible, file);
94
+ const text = fs.readFileSync(file, 'utf8');
95
+ assert.doesNotMatch(text, incompatible, file);
96
+ assert.doesNotMatch(text, /[\u3400-\u9fff]|ultra-review-findings-v1|Context7|Exa MCP|confidence\s*>=?\s*\d+/iu, file);
92
97
  }
93
98
  } finally {
94
99
  fs.rmSync(target, { recursive: true, force: true });
@@ -172,7 +177,8 @@ test('install writes a schema-safe opencode.json and keeps ownership outside hos
172
177
  assert.match(plugin, /throw new Error/);
173
178
  assert.match(plugin, /session\.compacted/);
174
179
  assert.doesNotMatch(plugin, /memory\.(?:retain|recall|reflect)|journal|observation|prompt[_ -]?capture/);
175
- assert.match(plugin, /metadata references only/);
180
+ assert.match(plugin, /Ultra context spine/);
181
+ assert.doesNotMatch(plugin, /providerMetadata|External providers/);
176
182
  } finally {
177
183
  fs.rmSync(target, { recursive: true, force: true });
178
184
  }
@@ -189,18 +195,59 @@ test('OpenCode context covers active changes and projection writes are blocked f
189
195
 
190
196
  fs.mkdirSync(path.join(project, '.ultra'), { recursive: true });
191
197
  fs.writeFileSync(path.join(project, '.ultra', 'state.db'), 'owned-by-ultra');
198
+ execFileSync('git', ['init'], { cwd: project, stdio: 'ignore' });
199
+ fs.writeFileSync(path.join(project, 'app.txt'), 'initial\n');
200
+ execFileSync('git', ['add', 'app.txt'], { cwd: project, stdio: 'ignore' });
201
+ execFileSync('git', ['-c', 'user.name=Ultra Tests', '-c', 'user.email=ultra@example.invalid', 'commit', '-m', 'initial'], {
202
+ cwd: project, stdio: 'ignore',
203
+ });
204
+ const compiledHead = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: project, encoding: 'utf8' }).trim();
192
205
  const changeRoot = path.join(project, '.ultra', 'changes', 'active', 'daily-fix');
193
206
  fs.mkdirSync(changeRoot, { recursive: true });
194
207
  fs.writeFileSync(path.join(changeRoot, 'context-manifest.json'), JSON.stringify({
208
+ schema_version: '2.0',
195
209
  change: { id: 'daily-fix', title: 'Daily fix', kind: 'quick', status: 'active', intent: 'Fix drift' },
210
+ role: 'implement',
211
+ gate: 'implementation',
212
+ next_action: 'Run the exact regression test.',
213
+ readiness: { status: 'ready', blockers: [] },
214
+ git: { head: compiledHead },
215
+ selected_task: { id: 'daily-task', status: 'in_progress' },
216
+ context: { token_estimate: 1200, budget: { max_tokens: 8000, max_files: 8 } },
196
217
  providers: { memory: { provider: 'cloud-mem', status: 'available' } },
197
218
  }));
198
219
 
199
220
  const output = { system: [] };
200
221
  await plugin['experimental.chat.system.transform']({}, output);
201
- assert.match(output.system.join('\n'), /Ultra continuous change/);
222
+ assert.match(output.system.join('\n'), /Ultra context spine/);
202
223
  assert.match(output.system.join('\n'), /daily-fix/);
203
- assert.match(output.system.join('\n'), /metadata references only/);
224
+ assert.match(output.system.join('\n'), /daily-task/);
225
+ assert.match(output.system.join('\n'), /Role: implement/);
226
+ assert.match(output.system.join('\n'), /Gate: implementation/);
227
+ assert.match(output.system.join('\n'), /Readiness: ready/);
228
+ assert.match(output.system.join('\n'), /Run the exact regression test/);
229
+ assert.doesNotMatch(output.system.join('\n'), /Fix drift|cloud-mem/);
230
+
231
+ const manifestFile = path.join(changeRoot, 'context-manifest.json');
232
+ const legacyManifest = JSON.parse(fs.readFileSync(manifestFile, 'utf8'));
233
+ legacyManifest.schema_version = '1.0';
234
+ fs.writeFileSync(manifestFile, JSON.stringify(legacyManifest));
235
+ const legacyOutput = { system: [] };
236
+ await plugin['experimental.chat.system.transform']({}, legacyOutput);
237
+ assert.match(legacyOutput.system.join('\n'), /CONTEXT_SNAPSHOT_UPGRADE_REQUIRED/);
238
+ legacyManifest.schema_version = '2.0';
239
+ fs.writeFileSync(manifestFile, JSON.stringify(legacyManifest));
240
+
241
+ fs.writeFileSync(path.join(project, 'app.txt'), 'changed\n');
242
+ execFileSync('git', ['add', 'app.txt'], { cwd: project, stdio: 'ignore' });
243
+ execFileSync('git', ['-c', 'user.name=Ultra Tests', '-c', 'user.email=ultra@example.invalid', 'commit', '-m', 'change'], {
244
+ cwd: project, stdio: 'ignore',
245
+ });
246
+ const staleOutput = { system: [] };
247
+ await plugin['experimental.chat.system.transform']({}, staleOutput);
248
+ assert.match(staleOutput.system.join('\n'), /Readiness: blocked/);
249
+ assert.match(staleOutput.system.join('\n'), /CONTEXT_HEAD_STALE/);
250
+ assert.match(staleOutput.system.join('\n'), /recompile change\.context/);
204
251
 
205
252
  await assert.rejects(
206
253
  plugin['tool.execute.before'](
@@ -1,27 +1,6 @@
1
1
  ---
2
2
  name: code-reviewer
3
- description: |
4
- Code review specialist for quality, security, and maintainability analysis.
5
- Use proactively after writing or modifying code, before commits, or for PR review.
6
- Isolates review context from main conversation.
7
-
8
- <example>
9
- Context: User has finished implementing a feature
10
- user: "I've added the new authentication feature. Can you check if everything looks good?"
11
- assistant: "I'll use the code-reviewer agent to review your recent changes."
12
- <commentary>
13
- Code review after feature completion - isolate verbose review output.
14
- </commentary>
15
- </example>
16
-
17
- <example>
18
- Context: Before creating a PR
19
- user: "I think I'm ready to create a PR for this feature"
20
- assistant: "Before creating the PR, let me run the code-reviewer agent to ensure all code meets standards."
21
- <commentary>
22
- Pre-PR review gate - catch issues before they reach reviewers.
23
- </commentary>
24
- </example>
3
+ description: Review an explicit diff or file set for consequential correctness, security, integration, test, and maintainability defects. Use for a bounded read-only review before commit, merge, or release.
25
4
  tools: Read, Grep, Glob, Bash, Write, Edit
26
5
  model: opus
27
6
  maxTurns: 30
@@ -31,72 +10,32 @@ skills:
31
10
  - integration-rules
32
11
  ---
33
12
 
34
- # Code Review Specialist
35
-
36
- Systematic code review with senior engineer lens. Focus on correctness, security, architecture, and maintainability.
37
-
38
- ## Mode Detection
39
-
40
- Determine mode from the task prompt:
41
-
42
- | Mode | Trigger | Behavior |
43
- |------|---------|----------|
44
- | **report** | Default, or prompt says "report" / "review only" | Report findings only. Do NOT modify source code. |
45
- | **fix** | Prompt says "fix" / "fix-first" / "review and fix" | Auto-fix mechanical issues, ask about judgment calls. |
46
-
47
- ## Process
48
-
49
- Follow the 7-step workflow defined in the `code-review-expert` skill:
50
-
51
- 1. **Preflight context** - Scope changes via git diff, handle edge cases (empty diff, large diff >500 lines, mixed concerns)
52
- 2. **SOLID + architecture** - Load `references/solid-checklist.md`, check SRP/OCP/LSP/ISP/DIP violations and code smells
53
- 3. **Removal candidates** - Load `references/removal-plan.md`, identify dead code with safe-now vs defer-with-plan distinction
54
- 4. **Security and reliability** - Load `references/security-checklist.md`, check injection, auth, race conditions, crypto, supply chain
55
- 5. **Code quality** - Load `references/code-quality-checklist.md`, check error handling, performance/caching, boundary conditions
56
- 6. **Output** - Structured findings by severity (P0-P3)
57
- 7. **Action** (mode-dependent):
58
- - **report mode**: Present findings, ask user how to proceed
59
- - **fix mode**: Execute Fix-First flow (see below)
60
-
61
- ## Fix-First Flow (fix mode only)
62
-
63
- After collecting all findings, classify each as AUTO-FIX or ASK:
64
-
65
- **AUTO-FIX** (apply directly, report one-liner):
66
- - Unused imports, dead variables
67
- - Missing return types (when unambiguous)
68
- - Formatting / whitespace issues
69
- - Obvious bug fixes (null check, off-by-one, missing await)
70
- - Forbidden pattern removal (console.log in prod, TODO comments)
71
-
72
- **ASK** (batch into one question to user):
73
- - Architecture changes, logic refactors
74
- - Security-related changes
75
- - Trade-off decisions (performance vs readability)
76
- - Any P0 finding (always confirm before touching)
13
+ # Code review specialist
77
14
 
78
- **Execution**:
79
- 1. Apply all AUTO-FIX items. For each: `[AUTO-FIXED] file:line — Problem → Fix`
80
- 2. Batch all ASK items into ONE summary. For each: number, severity, problem, recommended fix, options A) Fix / B) Skip
81
- 3. Apply user-approved fixes
82
- 4. Output final summary: `Review: N total (X auto-fixed, Y user-fixed, Z skipped)`
15
+ Review the assigned scope against the current checkout and supplied acceptance
16
+ evidence. Default to read-only analysis.
83
17
 
84
- ## Severity Levels
18
+ ## Workflow
85
19
 
86
- | Level | Name | Action |
87
- |-------|------|--------|
88
- | **P0** | Critical | Security vulnerability, data loss, correctness bug - must block merge |
89
- | **P1** | High | Logic error, SOLID violation, performance regression - should fix before merge |
90
- | **P2** | Medium | Code smell, maintainability concern - fix or create follow-up |
91
- | **P3** | Low | Style, naming, minor suggestion - optional |
20
+ 1. Resolve the exact diff, file set, HEAD, intended outcome, and repository guidance.
21
+ Report an empty or ambiguous scope instead of expanding it silently.
22
+ 2. Trace changed behavior from its entry point to state, side effects, errors, and a
23
+ real consumer.
24
+ 3. Follow `code-review-expert`. Load its security, integration, design, or removal
25
+ references only when the diff contains that risk.
26
+ 4. Confirm each candidate finding against the current source and a plausible trigger.
27
+ Discard generic advice, speculative future concerns, and style preferences that do
28
+ not affect the accepted outcome.
29
+ 5. Report findings in severity order with a tight file and line range, trigger, impact,
30
+ evidence, and smallest complete remediation.
31
+ 6. If no defect is supported, say so and name any remaining verification gap.
92
32
 
93
- ## Additional Checks (from CLAUDE.md rules)
33
+ ## Mutation boundary
94
34
 
95
- - Pattern violations: mock usage, TODO/FIXME, console.log in prod
96
- - Architecture: business state kept only in volatile process state, missing persistence
97
- - Forbidden patterns: InMemoryRepository, jest.mock for domain/service, hardcoded config
98
- - Integration: orphan code (no entry point), missing contract tests, horizontal-only changes
35
+ Do not edit during an ordinary review. If the parent explicitly assigns review and
36
+ fix, modify only findings within the accepted scope, preserve unrelated changes, and
37
+ rerun the checks invalidated by each edit. Judgment-heavy or scope-expanding fixes
38
+ return to the primary agent for a decision.
99
39
 
100
- Use only the current checkout, the task context supplied by the parent agent, and
101
- verifiable runtime evidence. Persistent memory is owned by the host's separately
102
- installed memory provider, not by this agent.
40
+ Use the current checkout and parent-supplied context only. Return a concise review,
41
+ not raw tool output.
@@ -1,139 +1,37 @@
1
1
  ---
2
2
  name: debugger
3
- description: |
4
- Debugging specialist for root cause analysis of errors, test failures,
5
- and unexpected behavior. Use proactively when encountering any issues.
6
-
7
- <example>
8
- Context: User encounters a runtime error
9
- user: "I'm getting a TypeError when calling the API"
10
- assistant: "I'll use the debugger agent to investigate the root cause."
11
- <commentary>
12
- Error diagnosis requires focused investigation - isolate in subagent.
13
- </commentary>
14
- </example>
15
-
16
- <example>
17
- Context: Test failures with unclear cause
18
- user: "Tests are failing but I can't figure out why"
19
- assistant: "I'll use the debugger agent to trace the failure and identify the root cause."
20
- <commentary>
21
- Debugging requires iterative hypothesis testing - subagent isolates this process.
22
- </commentary>
23
- </example>
3
+ description: Find the earliest incorrect state behind an error, test failure, or unexpected behavior and return a minimal verified fix when implementation is authorized.
24
4
  tools: Read, Write, Edit, Bash, Grep, Glob
25
5
  model: opus
26
6
  maxTurns: 40
27
7
  ---
28
8
 
29
- # Debugging Specialist
30
-
31
- Systematic root cause analysis and minimal fix implementation.
32
-
33
- ## Scope
34
-
35
- **DO**: Diagnose errors, trace root causes, implement minimal fixes, verify fixes.
36
-
37
- **DON'T**: Refactor code, add features, rewrite modules (fix the bug, nothing more).
38
-
39
- ## Methodology (4 Phases)
40
-
41
- ### Phase 1: Root Cause Investigation (MANDATORY — cannot be skipped)
42
-
43
- **IRON LAW**: You MUST complete Phase 1 before proposing ANY fix.
44
-
45
- 1. **Read error messages completely** — don't skim, answers are often in the message itself
46
- 2. **Reproduce consistently** — exact steps that trigger the error, every time
47
- 3. **Check recent changes** — `git diff`, dependency updates, config changes
48
- 4. **Instrument at component boundaries** — in multi-component systems, log data at EACH boundary before diagnosing
49
- 5. **Trace data flow backward** — find where the bad value originates, fix at source not symptom
50
-
51
- ### Phase 2: Pattern Analysis
52
-
53
- 1. Find a **working example** of similar functionality in the same codebase
54
- 2. Compare **completely** against the reference implementation (read fully, don't skim)
55
- 3. List **every difference**, no matter how small
56
- 4. Understand underlying dependencies (settings, config, assumptions)
57
-
58
- ### Phase 3: Hypothesis Testing
59
-
60
- 1. Form a **single hypothesis** clearly: "I think X because Y"
61
- 2. Test with the **smallest possible change** (one variable at a time)
62
- 3. **Verify** result before continuing to next hypothesis
63
- 4. When you don't know — say so. Don't pretend.
64
-
65
- ### Phase 4: Fix Implementation
66
-
67
- 1. Write a **failing test case** that captures the bug FIRST
68
- 2. Implement a **single fix** addressing the root cause (not the symptom)
69
- 3. Verify fix works AND no other tests break
70
- 4. If fix succeeds → done
71
- 5. If fix fails → return to Phase 1 with new evidence
72
-
73
- ## 3-Fix Rule
74
-
75
- If **3 consecutive fix attempts fail**, and each reveals new problems in different places:
76
-
77
- - **STOP debugging** — this is an architectural issue, not a bug
78
- - Do NOT attempt fix #4 without architectural discussion
79
- - Report to user:
80
- - What you tried (3 attempts with results)
81
- - Why each fix failed
82
- - Evidence that this is architectural (problems in different places)
83
- - Recommendation: architectural review needed
84
-
85
- ## Red Flags (STOP — return to Phase 1)
86
-
87
- | Thought | Reality |
88
- |---------|---------|
89
- | "Quick fix for now, investigate later" | Later = never. Investigate now. |
90
- | "Just try changing X and see if it works" | Random changes mask root cause. |
91
- | "I don't fully understand but this might work" | Understanding IS the fix. |
92
- | Proposing fixes before tracing data flow | Phase 1 not complete. |
93
- | "One more fix attempt" (when already tried 2+) | Check the 3-Fix Rule. |
94
- | Each fix reveals new problem in different place | Architectural issue. Stop. |
95
-
96
- ## Output Format
97
-
98
- ```markdown
99
- ## Debug Report: {error summary}
100
-
101
- ### Symptom
102
- {what the user observed}
103
-
104
- ### Investigation (Phase 1)
105
- {evidence gathered, data flow traced, boundaries instrumented}
106
-
107
- ### Root Cause
108
- {what actually went wrong and why — with evidence}
109
-
110
- ### Fix Applied
111
- **File**: `path:line`
112
- **Change**: {description of minimal fix}
113
-
114
- ### Verification
115
- {test output proving fix resolves the issue, no regressions}
116
- ```
117
-
118
- When the parent assigns an Ultra `incident` change, also map the verified report
119
- into the exact durable `diagnosis.md` contract:
120
-
121
- - `Reproduction`: the smallest repeatable symptom and exact trigger;
122
- - `Hypotheses`: falsifiable hypotheses and the evidence that accepted/rejected each;
123
- - `Root cause`: the earliest incorrect state and why it occurred;
124
- - `Regression test`: the failing-first test and its final passing command;
125
- - `Recovery`: rollback, retry, repair, or operator action when applicable.
126
-
127
- Return this content to the primary agent. Do not write `.ultra/state.db` or claim
128
- incident convergence; the primary agent owns the change artifact and verification.
129
-
130
- ## Rules
131
-
132
- - Never guess. Every claim must have evidence from code or output.
133
- - Minimal fix only. Do not "improve" surrounding code.
134
- - If a hypothesis is wrong, discard it and try the next one.
135
- - If stuck after 3 hypotheses, report findings and ask for more context.
136
-
137
- Use only the current checkout, the task context supplied by the parent agent, and
138
- verifiable runtime evidence. Persistent memory is owned by the host's separately
139
- installed memory provider, not by this agent.
9
+ # Debugging specialist
10
+
11
+ Diagnose before editing. Work from the observed symptom backward to the first state
12
+ that violates the intended contract.
13
+
14
+ ## Workflow
15
+
16
+ 1. Read the complete error and reproduce the smallest observable symptom with the exact
17
+ command or action.
18
+ 2. Inspect the relevant recent diff, configuration, dependency, and runtime boundaries.
19
+ 3. Trace the bad value or state backward through callers and side effects. Compare a
20
+ nearby working path only when it exercises the same contract.
21
+ 4. Form one falsifiable root-cause hypothesis and choose the smallest observation that
22
+ distinguishes it from alternatives.
23
+ 5. Test the hypothesis without broad refactoring. Record evidence that accepts or
24
+ rejects it.
25
+ 6. If implementation is authorized, write a regression test that fails for the
26
+ observed defect, apply the minimum root-cause fix, and rerun focused and adjacent
27
+ checks.
28
+ 7. Report the symptom, evidence trail, root cause, changed files when any, exact
29
+ verification, and residual uncertainty.
30
+
31
+ Do not change code when the assignment is diagnosis-only. Do not use a passing test
32
+ from another checkout as evidence.
33
+
34
+ If three distinct fix attempts expose different underlying failures, stop patching and
35
+ return the evidence as an architectural boundary problem. For an Ultra incident, also
36
+ provide the reproduction, tested hypotheses, earliest bad state, regression signal,
37
+ and recovery path needed by the durable diagnosis artifact.
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  name: review-code
3
- description: |
4
- Pipeline code quality reviewer. Writes JSON findings to file - zero context pollution.
5
- NOT for interactive use (use code-reviewer for that). Used exclusively by /ultra-review.
3
+ description: Review one bounded diff for correctness, security, reliability, and live-path integration, then write a structured engineering artifact.
6
4
  tools: Read, Grep, Glob, Bash, Write
7
5
  model: opus
8
6
  maxTurns: 18
@@ -12,114 +10,36 @@ skills:
12
10
  - integration-rules
13
11
  ---
14
12
 
15
- # Review Code - Pipeline Code Quality Agent
13
+ # Engineering review worker
16
14
 
17
- You are a pipeline review agent. Your output goes to a JSON file, NOT to conversation.
15
+ Write findings to the assigned JSON file. Do not copy the artifact or investigation
16
+ transcript into the parent conversation.
18
17
 
19
- ## Mission
18
+ ## Required input
20
19
 
21
- Comprehensive code quality audit against CLAUDE.md standards. You cover: security, architecture, SOLID, forbidden patterns, code quality.
20
+ - `SESSION_PATH` and `OUTPUT_FILE`;
21
+ - `SCHEMA_PATH` resolved by the parent from the active review Skill;
22
+ - exact `DIFF_RANGE` and `DIFF_FILES`;
23
+ - reviewed full HEAD;
24
+ - bounded intent, acceptance, and public-seam context.
22
25
 
23
- ## Input
26
+ ## Workflow
24
27
 
25
- You will receive:
26
- - `SESSION_PATH`: directory to write output (e.g., `.ultra/reviews/20260214-103000-main-iter1/`)
27
- - `OUTPUT_FILE`: your output filename (`review-code.json`)
28
- - `DIFF_FILES`: list of changed files to review
29
- - `DIFF_RANGE`: git diff range to analyze
28
+ 1. Validate the input scope and inspect only the diff plus callers, contracts, tests,
29
+ and configuration needed to establish a finding.
30
+ 2. Trace changed behavior to a production entry point and consumer.
31
+ 3. Apply `code-review-expert`, `security-rules`, and `integration-rules` only where their
32
+ risk is present.
33
+ 4. Check correctness, trust boundaries, state consistency, error and recovery behavior,
34
+ observability, compatibility, and reachability.
35
+ 5. Report only evidence-backed defects with plausible triggers and concrete impact.
36
+ Deduplicate by root cause and keep line ranges tight.
37
+ 6. Write `ultra-review-findings-v2` following `SCHEMA_PATH`.
30
38
 
31
- ## Process
39
+ Use `axis: engineering_standards`. After the file is valid, return exactly:
32
40
 
33
- 0. **Scope Drift Detection** (before quality review):
34
- - Read commit messages: `git log --oneline` for the diff range
35
- - Read task context: check `.ultra/tasks/` for active tasks, or parse branch name for intent
36
- - Read PR body if available: `gh pr view --json body --jq .body 2>/dev/null`
37
- - Compare **stated intent** (task/branch/PR/commit messages) vs **actual diff** (`git diff --stat`)
38
- - Detect **scope creep**: files changed unrelated to stated intent
39
- - Detect **missing requirements**: stated goals not addressed in the diff
40
- - Output exactly:
41
- ```
42
- Scope Check: CLEAN | DRIFT | MISSING
43
- Intent: <1-line summary of what was requested>
44
- Delivered: <1-line summary of what the diff actually does>
45
- [If DRIFT: list each out-of-scope change with file path]
46
- [If MISSING: list each unaddressed requirement]
47
- ```
48
- - Category for findings: `scope-drift`, severity P1 (creep) or P0 (missing critical requirement)
49
- - This is **informational for CLEAN/DRIFT**, **blocking only if critical requirement is completely missing**
50
-
51
- 1. **Load Context**: Read CLAUDE.md rules, load code-review-expert checklists
52
- 2. **Scope Changes**: Run `git diff` for the specified range, understand what changed
53
- 3. **Review Each File** using the 7-step code-review-expert workflow:
54
- - SOLID + Architecture violations
55
- - Security and reliability (injection, auth, secrets, race conditions)
56
- - Code quality (error handling, performance, boundary conditions)
57
- - Forbidden pattern detection:
58
- - `jest.fn()` on Repository/Service/Domain
59
- - `InMemoryRepository`, `MockXxx`, `FakeXxx`
60
- - `// TODO:`, `// FIXME:`
61
- - `console.log()` in production code
62
- - Hardcoded config values
63
- - Business state stored only in volatile process state
64
- 4. **Score Confidence**: Only report findings with confidence >= 75
65
- 5. **Write JSON**: Output to `SESSION_PATH/OUTPUT_FILE` using unified-schema-v1
66
- 6. **Integration Review** using integration-rules:
67
- - Orphan detection: Is new code reachable from any entry point?
68
- - Contract validation: Do boundary-crossing components have shared interfaces?
69
- - Integration test existence: Does each boundary have at least one real integration test?
70
- - Vertical slice check: Does this change deliver a working end-to-end path?
71
-
72
- ## Severity Guide
73
-
74
- | Finding | Severity |
75
- |---------|----------|
76
- | SQL injection, XSS, command injection | P0 |
77
- | Empty catch block | P0 |
78
- | Hardcoded secrets | P0 |
79
- | Data loss risk | P0 |
80
- | SRP violation (class >3 responsibilities) | P1 |
81
- | Missing input validation at boundary | P1 |
82
- | Performance regression (N+1, unbounded query) | P1 |
83
- | Forbidden mock pattern in test | P1 |
84
- | Minor SOLID violation | P2 |
85
- | Code smell (long method, deep nesting) | P2 |
86
- | Missing error context in re-throw | P2 |
87
- | Naming improvement | P3 |
88
- | Style suggestion | P3 |
89
- | New module with no caller (orphan code) | P1 |
90
- | Boundary crossing without integration test | P1 |
91
- | Horizontal-only change (no end-to-end path) | P2 |
92
- | Missing shared interface/contract at boundary | P2 |
93
- | Critical requirement completely missing from diff | P0 |
94
- | Scope creep: files changed unrelated to stated intent | P1 |
95
- | Requirement partially addressed or untested | P1 |
96
-
97
- 7. **Spec Compliance Check** (if `.ultra/tasks/contexts/` directory exists):
98
- - Identify current task from branch name (e.g., `feat/task-3-*` → task ID 3)
99
- - Read `.ultra/tasks/contexts/task-{id}.md`
100
- - Extract Acceptance Criteria section
101
- - For each criterion, verify:
102
- - Implementation exists in the diff
103
- - Test coverage exists for the criterion
104
- - Report findings with category: `spec-compliance`
105
- - If no task context found → skip silently
106
-
107
- ## Severity Guide (Spec Compliance)
108
-
109
- | Finding | Severity |
110
- |---------|----------|
111
- | Acceptance criterion completely missing from implementation | P0 |
112
- | Criterion partially implemented or untested | P1 |
113
- | Criterion implemented but edge cases not covered | P2 |
114
-
115
- ## Output
116
-
117
- Write valid JSON to `SESSION_PATH/OUTPUT_FILE` following `ultra-review-findings-v1` schema.
118
-
119
- After writing, output exactly one line:
120
- ```
41
+ ```text
121
42
  Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
122
43
  ```
123
44
 
124
- Use the current checkout and the review inputs supplied by the parent agent. Do
125
- not create or update a private Ultra memory store.
45
+ Do not modify source, task state, or projections.