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.
- package/CHANGELOG.md +92 -1
- package/README.md +11 -6
- package/adapters/_shared/codex-assets.cjs +23 -331
- package/adapters/_shared/handbook.cjs +2 -0
- package/adapters/_shared/runtime-assets.cjs +25 -0
- package/adapters/_shared/tests/handbook.test.cjs +3 -0
- package/adapters/_shared/tests/runtime-assets.test.cjs +12 -4
- package/adapters/claude.js +28 -5
- package/adapters/kimi.js +15 -138
- package/adapters/opencode.js +59 -63
- package/adapters/tests/claude.test.cjs +26 -9
- package/adapters/tests/codex.test.cjs +23 -9
- package/adapters/tests/kimi.test.cjs +15 -11
- package/adapters/tests/opencode.test.cjs +57 -10
- package/agents/code-reviewer.md +24 -85
- package/agents/debugger.md +30 -132
- package/agents/review-code.md +24 -104
- package/agents/review-comments.md +20 -83
- package/agents/review-coordinator.md +40 -137
- package/agents/review-design.md +21 -118
- package/agents/review-errors.md +22 -70
- package/agents/review-spec.md +36 -0
- package/agents/review-tests.md +20 -76
- package/agents/tdd-runner.md +26 -84
- package/commands/learn.md +5 -36
- package/commands/ultra-change.md +5 -43
- package/commands/ultra-deliver.md +4 -46
- package/commands/ultra-dev.md +4 -48
- package/commands/ultra-doctor.md +4 -30
- package/commands/ultra-init.md +5 -47
- package/commands/ultra-plan.md +5 -48
- package/commands/ultra-research.md +5 -54
- package/commands/ultra-status.md +5 -44
- package/commands/ultra-test.md +5 -45
- package/commands/ultra-think.md +5 -40
- package/docs/AGENT-CONTEXT.md +34 -12
- package/docs/ARCHITECTURE.md +31 -5
- package/docs/PLAN.zh-CN.md +3 -2
- package/docs/ROADMAP.md +5 -4
- package/docs/RUNTIME-COMPAT-MATRIX.md +7 -5
- package/docs/SKILL-AUTHORING.md +75 -0
- package/docs/USER-HANDBOOK-CONTRACT.md +9 -2
- package/hooks/README.md +6 -4
- package/hooks/active_task_context.py +14 -0
- package/hooks/context_spine.py +218 -0
- package/hooks/health_check.py +1 -1
- package/hooks/workflow_context.py +16 -123
- package/hooks/workflow_resume.py +21 -0
- package/mcp-server/lib/change-workflow.cjs +89 -11
- package/mcp-server/lib/change-workflow.test.cjs +202 -7
- package/mcp-server/lib/context-spine.cjs +331 -0
- package/mcp-server/lib/context-spine.test.cjs +73 -0
- package/mcp-server/lib/spec-learning.cjs +191 -0
- package/mcp-server/lib/spec-learning.test.cjs +62 -0
- package/mcp-server/lib/state-db.cjs +72 -10
- package/mcp-server/lib/state-db.test.cjs +7 -2
- package/mcp-server/server.cjs +31 -1
- package/mcp-server/tests/db-ops.test.cjs +3 -3
- package/mcp-server/tests/server-contract.test.cjs +74 -0
- package/mcp-server/tests/state-db.test.cjs +20 -3
- package/package.json +3 -2
- package/skills/cc-collab/SKILL.md +16 -18
- package/skills/code-review-expert/SKILL.md +39 -114
- package/skills/code-review-expert/references/correctness-reliability.md +30 -0
- package/skills/code-review-expert/references/design-boundaries.md +26 -0
- package/skills/code-review-expert/references/removal-plan.md +17 -45
- package/skills/codex-collab/SKILL.md +23 -28
- package/skills/codex-collab/evals/evals.json +18 -23
- package/skills/integration-rules/SKILL.md +28 -67
- package/skills/learn/SKILL.md +46 -105
- package/skills/security-rules/SKILL.md +34 -56
- package/skills/testing-rules/SKILL.md +28 -52
- package/skills/ultra-change/SKILL.md +61 -145
- package/skills/ultra-deliver/SKILL.md +63 -229
- package/skills/ultra-dev/SKILL.md +46 -338
- package/skills/ultra-doctor/SKILL.md +39 -71
- package/skills/ultra-init/SKILL.md +59 -139
- package/skills/ultra-plan/SKILL.md +50 -310
- package/skills/ultra-research/SKILL.md +59 -152
- package/skills/ultra-research/references/architecture.md +38 -0
- package/skills/ultra-research/references/problem-product.md +39 -0
- package/skills/ultra-research/references/quality-delivery.md +34 -0
- package/skills/ultra-research/references/synthesis.md +38 -0
- package/skills/ultra-research/references/users-scope.md +40 -0
- package/skills/ultra-review/SKILL.md +55 -427
- package/skills/ultra-review/references/unified-schema.md +76 -101
- package/skills/ultra-review/scripts/review_wait.py +242 -77
- package/skills/ultra-status/SKILL.md +38 -173
- package/skills/ultra-test/SKILL.md +41 -195
- package/skills/ultra-think/SKILL.md +43 -101
- package/skills/ultra-verify/SKILL.md +44 -84
- package/skills/ultra-verify/evals/evals.json +24 -27
- package/spec/cli-protocol.md +3 -0
- package/spec/mcp-tools.yaml +133 -4
- package/spec/schemas/command-manifest.schema.json +7 -25
- package/spec/schemas/skill-manifest.schema.json +9 -79
- package/spec/schemas/state-db.sql +31 -0
- package/skills/code-review-expert/references/code-quality-checklist.md +0 -112
- package/skills/code-review-expert/references/integration-checklist.md +0 -46
- package/skills/code-review-expert/references/security-checklist.md +0 -100
- package/skills/code-review-expert/references/solid-checklist.md +0 -65
- package/skills/ultra-research/steps/step-00-problem-validation.md +0 -154
- package/skills/ultra-research/steps/step-01-opportunity-discovery.md +0 -172
- package/skills/ultra-research/steps/step-02-market-assessment.md +0 -195
- package/skills/ultra-research/steps/step-03-competitive-landscape.md +0 -197
- package/skills/ultra-research/steps/step-04-product-strategy.md +0 -196
- package/skills/ultra-research/steps/step-05-assumptions-validation.md +0 -234
- package/skills/ultra-research/steps/step-10-user-personas.md +0 -169
- package/skills/ultra-research/steps/step-11-user-scenarios.md +0 -181
- package/skills/ultra-research/steps/step-20-user-stories.md +0 -156
- package/skills/ultra-research/steps/step-21-features-scope.md +0 -157
- package/skills/ultra-research/steps/step-22-success-metrics.md +0 -195
- package/skills/ultra-research/steps/step-30-architecture-context.md +0 -154
- package/skills/ultra-research/steps/step-31-solution-strategy.md +0 -172
- package/skills/ultra-research/steps/step-32-building-blocks.md +0 -188
- package/skills/ultra-research/steps/step-40-deployment.md +0 -123
- package/skills/ultra-research/steps/step-41-quality-risks.md +0 -135
- package/skills/ultra-research/steps/step-99-synthesis.md +0 -188
- package/skills/ultra-review/scripts/review_verdict_update.py +0 -99
|
@@ -1,453 +1,81 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ultra-review
|
|
3
|
-
description:
|
|
4
|
-
user-invocable: true
|
|
5
|
-
runtime: all
|
|
6
|
-
mcp_tools_required:
|
|
7
|
-
- change.list
|
|
8
|
-
- task.list
|
|
3
|
+
description: Run independent specification-fidelity and engineering reviews over one current diff using bounded workers and file-based evidence. Use when implementation needs a read-only review gate before task completion or delivery.
|
|
9
4
|
---
|
|
10
5
|
|
|
11
|
-
#
|
|
6
|
+
# Review one current diff
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
Keep two verdict axes independent:
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+
1. `spec_fidelity`: intent, acceptance, delta, documentation impact, and public seam;
|
|
11
|
+
2. `engineering_standards`: correctness, safety, maintainability, testing,
|
|
12
|
+
observability, and recovery.
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
One axis cannot compensate for the other. Preserve each finding's source, severity,
|
|
15
|
+
file and line, and axis during coordination.
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|------|---------|------------|
|
|
21
|
-
| 1 | Setup & Scope Detection | Detecting diff scope... |
|
|
22
|
-
| 2 | Agent Selection | Selecting review agents... |
|
|
23
|
-
| 3 | Background Execution | Running review agents... |
|
|
24
|
-
| 4 | Wait & Coordinate | Waiting for agent results... |
|
|
25
|
-
| 5 | Report to User | Generating review report... |
|
|
17
|
+
## Scope and context
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
1. Resolve one explicit diff range and file set. Include staged and unstaged changes
|
|
20
|
+
for a default working-tree review.
|
|
21
|
+
2. Bind the single matching change through `change.list` and `task.list`; require an id
|
|
22
|
+
when ambiguous.
|
|
23
|
+
3. Compile `change.context` for the review role and gate with only the intent, delta,
|
|
24
|
+
acceptance, tests, diff paths, and public-seam contract needed for this review.
|
|
25
|
+
4. Stop on stale HEAD, blocked readiness, empty scope, or missing acceptance evidence.
|
|
26
|
+
5. Create `.ultra/reviews/<session-id>/` with the reviewed HEAD, range, change id,
|
|
27
|
+
selected workers, and a pending verdict.
|
|
30
28
|
|
|
31
|
-
##
|
|
29
|
+
## Run the independent fidelity axis
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/ultra-review security # Security focus (review-code + review-errors)
|
|
38
|
-
/ultra-review tests # Test quality focus (review-tests only)
|
|
39
|
-
/ultra-review recheck # Re-check only P0/P1 files from last session
|
|
40
|
-
/ultra-review delta # Review only changes since last review session
|
|
41
|
-
/ultra-review <agents...> # Custom: e.g., /ultra-review tests errors types
|
|
42
|
-
```
|
|
31
|
+
Always dispatch `review-spec` with only the accepted intent, delta, acceptance criteria,
|
|
32
|
+
public-seam context, current HEAD, and diff scope. Do not give it engineering findings
|
|
33
|
+
or an implementation rationale that is not part of the accepted contract. It writes
|
|
34
|
+
`spec-fidelity.json` with `axis: spec_fidelity`.
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
## Select engineering specialists
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
/ultra-review --pr 123 # Review PR #123 diff (base...head)
|
|
48
|
-
/ultra-review --range main..HEAD # Review specific commit range
|
|
49
|
-
/ultra-review --range abc123 # Review single commit
|
|
50
|
-
/ultra-review security --pr 42 # Security review scoped to PR #42
|
|
51
|
-
```
|
|
38
|
+
Use the smallest set that covers the diff. The delivery gate runs all five:
|
|
52
39
|
|
|
53
|
-
|
|
40
|
+
- `review-code`: correctness, security, and live-path reachability;
|
|
41
|
+
- `review-tests`: behavioral coverage and feedback-loop evidence;
|
|
42
|
+
- `review-errors`: hidden failures, recovery, and observability;
|
|
43
|
+
- `review-design`: types, boundaries, complexity, and coupling;
|
|
44
|
+
- `review-comments`: stale or misleading comments and documentation.
|
|
54
45
|
|
|
55
|
-
|
|
46
|
+
Record why any engineering specialist is skipped. The independent specification
|
|
47
|
+
worker is required for every change-linked review.
|
|
56
48
|
|
|
57
|
-
|
|
58
|
-
# 1. Determine session context
|
|
59
|
-
BRANCH = git branch --show-current # e.g., "feat/task-3-auth"
|
|
60
|
-
ITER = count existing sessions matching this branch + 1 # iteration number
|
|
61
|
-
CHANGE_ID = active change whose linked tasks/diff match this scope, else null
|
|
49
|
+
## Execute bounded workers
|
|
62
50
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
Use the current host's native bounded-worker mechanism. Dispatch `review-spec` and the
|
|
52
|
+
selected engineering workers independently. Each worker must inspect only the supplied
|
|
53
|
+
diff and role context. Resolve `references/unified-schema.md` from this
|
|
54
|
+
Skill directory and pass that absolute path as `SCHEMA_PATH`; never make a worker infer
|
|
55
|
+
the plugin installation root. Each worker writes `<session>/<worker>.json` following
|
|
56
|
+
that contract, limits output to actionable findings, and returns only a short file
|
|
57
|
+
acknowledgement to the parent context.
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
# See Session Index below for full schema
|
|
72
|
-
|
|
73
|
-
# 4. Cleanup (see Lifecycle Management below)
|
|
74
|
-
|
|
75
|
-
# 5. Detect diff scope (priority order)
|
|
76
|
-
```
|
|
59
|
+
Resolve bundled paths relative to this skill directory. Validate the exact expected
|
|
60
|
+
artifacts before coordination:
|
|
77
61
|
|
|
78
|
-
**Scope resolution priority:**
|
|
79
|
-
|
|
80
|
-
| Flag | Diff Command | DIFF_RANGE |
|
|
81
|
-
|------|-------------|------------|
|
|
82
|
-
| `--pr NUMBER` | `gh pr diff NUMBER --name-only` | PR base...head |
|
|
83
|
-
| `--range RANGE` | `git diff RANGE --name-only` | Specified range |
|
|
84
|
-
| _(default)_ | `git diff --name-only HEAD` + `git diff --cached --name-only` | HEAD (unstaged + staged) |
|
|
85
|
-
|
|
86
|
-
**PR scope details** (`--pr NUMBER`):
|
|
87
|
-
```bash
|
|
88
|
-
# Get PR metadata for session naming
|
|
89
|
-
gh pr view NUMBER --json headRefName,baseRefName,title
|
|
90
|
-
# Get changed files
|
|
91
|
-
gh pr diff NUMBER --name-only
|
|
92
|
-
# Set DIFF_RANGE to base...head for agents
|
|
93
|
-
DIFF_RANGE="$(gh pr view NUMBER --json baseRefName -q .baseRefName)..HEAD"
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Range scope details** (`--range RANGE`):
|
|
97
62
|
```bash
|
|
98
|
-
|
|
99
|
-
DIFF_RANGE="RANGE"
|
|
63
|
+
python3 scripts/review_wait.py <session-path> agents spec-fidelity review-code review-tests
|
|
100
64
|
```
|
|
101
65
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Call `change.list` and `task.list`, then bind the review to the single active or
|
|
105
|
-
blocked change whose linked task files intersect `DIFF_FILES`. If multiple
|
|
106
|
-
changes match, require an explicit scope instead of guessing. Write
|
|
107
|
-
`change_id` and reviewed HEAD into `SUMMARY.json` and the session index so
|
|
108
|
-
`/ultra-deliver` can use this artifact as review evidence. Initial-baseline
|
|
109
|
-
reviews may use `change_id: null`.
|
|
66
|
+
Pass only the engineering worker stems actually selected. Missing or invalid required
|
|
67
|
+
artifacts make the corresponding axis incomplete; a partial set is never a pass.
|
|
110
68
|
|
|
111
|
-
|
|
69
|
+
Run `review-coordinator` only after validation. It may merge duplicate root causes but
|
|
70
|
+
must retain source identifiers and the highest original severity.
|
|
71
|
+
Validate its summary with the same waiter.
|
|
112
72
|
|
|
113
|
-
|
|
73
|
+
## Report and handoff
|
|
114
74
|
|
|
115
|
-
|
|
116
|
-
|
|
75
|
+
Report both axis verdicts first, followed by blocking findings and artifact paths.
|
|
76
|
+
Review is read-only except for review artifacts; fixes are a separate implementation
|
|
77
|
+
action. Recheck only unresolved or changed scope after fixes.
|
|
117
78
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
| review-tests | No test files in diff AND no source files without tests | WARN: "Code changed without test updates" |
|
|
122
|
-
| review-errors | No error handling code detected | - |
|
|
123
|
-
| review-design | No type definitions AND no function-level changes in diff | - |
|
|
124
|
-
| review-comments | No comment changes in diff | - |
|
|
125
|
-
|
|
126
|
-
**Auto-skip detection commands:**
|
|
127
|
-
```bash
|
|
128
|
-
# Has type definitions?
|
|
129
|
-
grep -l "interface \|type \|class \|enum " <diff_files>
|
|
130
|
-
|
|
131
|
-
# Has comment changes?
|
|
132
|
-
git diff HEAD -- <diff_files> | grep "^[+-].*//\|^[+-].*\*\|^[+-].*#"
|
|
133
|
-
|
|
134
|
-
# Has test files?
|
|
135
|
-
echo "<diff_files>" | grep -E "\.(test|spec)\.(ts|tsx|js|jsx)$|test_.*\.py$|.*_test\.go$"
|
|
136
|
-
|
|
137
|
-
# Has error handling?
|
|
138
|
-
grep -l "try\|catch\|\.catch\|throw\|Error(" <diff_files>
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Mode: `all`** → Force ALL 5 reviewers, no auto-skip. Use for pre-merge gates (`/ultra-dev`).
|
|
142
|
-
**Mode: `quick`** → review-code only
|
|
143
|
-
**Mode: `security`** → review-code + review-errors
|
|
144
|
-
**Mode: `tests`** → review-tests only
|
|
145
|
-
**Mode: `recheck`** → See Recheck Logic below
|
|
146
|
-
**Mode: `delta`** → See Delta Logic below
|
|
147
|
-
**Mode: custom** → Parse agent names from arguments
|
|
148
|
-
|
|
149
|
-
### Phase 3: Background Execution (Zero Context Pollution)
|
|
150
|
-
|
|
151
|
-
Launch ALL selected agents in **background mode** (`run_in_background: true`) using multiple Task tool calls in a single message. This prevents agent output from polluting the main conversation context.
|
|
152
|
-
|
|
153
|
-
Each agent receives this prompt template:
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
You are running as part of /ultra-review pipeline.
|
|
157
|
-
|
|
158
|
-
SESSION_PATH: {SESSION_PATH}
|
|
159
|
-
OUTPUT_FILE: {agent-name}.json
|
|
160
|
-
DIFF_FILES: {comma-separated file list}
|
|
161
|
-
DIFF_RANGE: {resolved DIFF_RANGE from Phase 1}
|
|
162
|
-
|
|
163
|
-
Review the changed files and write your findings as JSON to:
|
|
164
|
-
{SESSION_PATH}/{agent-name}.json
|
|
165
|
-
|
|
166
|
-
Follow the ultra-review-findings-v1 schema exactly. Read the schema from:
|
|
167
|
-
$CLAUDE_PLUGIN_ROOT/skills/ultra-review/references/unified-schema.md
|
|
168
|
-
|
|
169
|
-
Only report findings with confidence >= 75.
|
|
170
|
-
|
|
171
|
-
After writing the JSON file, output one line: "Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>"
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
**Important**: Use `subagent_type` matching the agent name (e.g., `review-code`, `review-tests`, etc.).
|
|
175
|
-
|
|
176
|
-
**Important**: Set `run_in_background: true` on every Task call. Do NOT read TaskOutput — this avoids injecting agent results into main context.
|
|
177
|
-
|
|
178
|
-
Maximum 12 findings per agent. If you find more, report only the top 12 by severity (P0 first),
|
|
179
|
-
then confidence. Note total count in your output line: "Wrote 12/23 findings..."
|
|
180
|
-
|
|
181
|
-
**CRITICAL PROHIBITION**: After launching background agents, you MUST:
|
|
182
|
-
1. Call `review_wait.py` IMMEDIATELY — do NOT process idle notifications
|
|
183
|
-
2. NEVER call TaskOutput for any review agent — their output goes to JSON files only
|
|
184
|
-
3. Ignore all agent idle/completion messages between launch and wait script return
|
|
185
|
-
4. The ONLY information path from agents is: wait script → Read SUMMARY.json
|
|
186
|
-
|
|
187
|
-
Violation of these rules causes context overflow. The review agents write to files; you read from files.
|
|
188
|
-
|
|
189
|
-
### Phase 4: Wait & Coordinate (File-Based)
|
|
190
|
-
|
|
191
|
-
**Step 4a: Wait for agents** — Use Bash to block until all agents finish writing:
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
python3 "$CLAUDE_PLUGIN_ROOT/skills/ultra-review/scripts/review_wait.py" {SESSION_PATH} agents {AGENT_COUNT}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
This polls for `review-*.json` files every 2 seconds. Timeout: 5 minutes.
|
|
198
|
-
Output is structured JSON on stdout:
|
|
199
|
-
- `status: "complete"` → all agents done, proceed normally
|
|
200
|
-
- `status: "partial"` → timeout, log missing agents, pass only `agents_done` to coordinator, note partial review in SUMMARY
|
|
201
|
-
- Exit code 1 (0 agents) → skip review, warn user, allow ultra-dev to continue
|
|
202
|
-
|
|
203
|
-
**Step 4b: Launch coordinator in background:**
|
|
204
|
-
|
|
205
|
-
Launch review-coordinator with `run_in_background: true`:
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
You are the review coordinator.
|
|
209
|
-
|
|
210
|
-
SESSION_PATH: {SESSION_PATH}
|
|
211
|
-
AGENTS_RUN: {list of agents from wait output}
|
|
212
|
-
|
|
213
|
-
Read all review-*.json files in the session directory, deduplicate findings,
|
|
214
|
-
compute verdict, and generate SUMMARY.md + SUMMARY.json.
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
**Step 4c: Wait for coordinator:**
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
python3 "$CLAUDE_PLUGIN_ROOT/skills/ultra-review/scripts/review_wait.py" {SESSION_PATH} summary
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
Output is a single verdict line (~15 tokens).
|
|
224
|
-
|
|
225
|
-
### Phase 5: Report to User
|
|
226
|
-
|
|
227
|
-
After `review_wait.py summary` returns:
|
|
228
|
-
|
|
229
|
-
1. **Read SUMMARY.json** (one Read call, ~500 tokens) to get verdict and counts
|
|
230
|
-
2. **Update index.json** — fill in the placeholder entry with actual verdict, p0, p1, total from SUMMARY.json
|
|
231
|
-
3. Present a concise summary:
|
|
232
|
-
|
|
233
|
-
```markdown
|
|
234
|
-
## Review Complete
|
|
235
|
-
|
|
236
|
-
**Verdict**: {APPROVE | COMMENT | REQUEST_CHANGES}
|
|
237
|
-
**Findings**: X total (P0: A, P1: B, P2: C, P3: D)
|
|
238
|
-
**Agents**: N ran, M succeeded
|
|
239
|
-
|
|
240
|
-
### Top Findings
|
|
241
|
-
1. [P0] {title} - {file}:{line}
|
|
242
|
-
2. [P1] {title} - {file}:{line}
|
|
243
|
-
3. ...
|
|
244
|
-
(show up to 5 most critical findings)
|
|
245
|
-
|
|
246
|
-
Full report: {SESSION_PATH}/SUMMARY.md
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
Then ask the user:
|
|
250
|
-
1. **Fix all** - Fix all P0 and P1 issues
|
|
251
|
-
2. **Fix P0 only** - Fix only critical issues
|
|
252
|
-
3. **View full report** - Read SUMMARY.md
|
|
253
|
-
4. **Skip** - No fixes needed
|
|
254
|
-
|
|
255
|
-
## Recheck Logic
|
|
256
|
-
|
|
257
|
-
When mode is `recheck`:
|
|
258
|
-
1. Find the most recent session **for the current branch** in `index.json`
|
|
259
|
-
2. Read its `SUMMARY.json`
|
|
260
|
-
3. Extract files with P0 or P1 findings
|
|
261
|
-
4. Run review-code only on those specific files
|
|
262
|
-
5. Compare with previous findings to show delta (resolved / new / unchanged)
|
|
263
|
-
|
|
264
|
-
## Delta Logic
|
|
265
|
-
|
|
266
|
-
When mode is `delta`:
|
|
267
|
-
1. Find the most recent session **for the current branch** in `index.json`
|
|
268
|
-
2. Read its `SUMMARY.json` to get the scope of last review
|
|
269
|
-
3. Identify files changed since the last review:
|
|
270
|
-
```bash
|
|
271
|
-
# If last session was commit-based, diff from that commit
|
|
272
|
-
git diff --name-only <last-reviewed-commit>..HEAD
|
|
273
|
-
# If last session was working-tree-based, diff current unstaged + staged
|
|
274
|
-
git diff --name-only HEAD
|
|
275
|
-
```
|
|
276
|
-
4. **Exclude** files that have NOT changed since last review (already reviewed)
|
|
277
|
-
5. Run full agent set only on the newly changed files
|
|
278
|
-
6. In coordinator, merge with previous session findings (carry forward unresolved P0/P1)
|
|
279
|
-
|
|
280
|
-
**Use case**: Iterative development — fix issues, add code, only review what's new.
|
|
281
|
-
|
|
282
|
-
## Session Index
|
|
283
|
-
|
|
284
|
-
A lightweight index file tracks all sessions for cross-referencing:
|
|
285
|
-
|
|
286
|
-
**File**: `.ultra/reviews/index.json`
|
|
287
|
-
|
|
288
|
-
```json
|
|
289
|
-
{
|
|
290
|
-
"sessions": [
|
|
291
|
-
{
|
|
292
|
-
"id": "20260214-103000-feat-task-3-auth-iter1",
|
|
293
|
-
"branch": "feat/task-3-auth",
|
|
294
|
-
"change_id": "auth-change",
|
|
295
|
-
"iteration": 1,
|
|
296
|
-
"mode": "full",
|
|
297
|
-
"timestamp": "2026-02-14T10:30:00Z",
|
|
298
|
-
"verdict": "REQUEST_CHANGES",
|
|
299
|
-
"p0": 2,
|
|
300
|
-
"p1": 3,
|
|
301
|
-
"total": 12,
|
|
302
|
-
"parent": null
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
"id": "20260214-113000-feat-task-3-auth-iter2",
|
|
306
|
-
"branch": "feat/task-3-auth",
|
|
307
|
-
"iteration": 2,
|
|
308
|
-
"mode": "recheck",
|
|
309
|
-
"timestamp": "2026-02-14T11:30:00Z",
|
|
310
|
-
"verdict": "COMMENT",
|
|
311
|
-
"p0": 0,
|
|
312
|
-
"p1": 1,
|
|
313
|
-
"total": 4,
|
|
314
|
-
"parent": "20260214-103000-feat-task-3-auth-iter1"
|
|
315
|
-
}
|
|
316
|
-
]
|
|
317
|
-
}
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
**Fields**:
|
|
321
|
-
|
|
322
|
-
| Field | Description |
|
|
323
|
-
|-------|-------------|
|
|
324
|
-
| `id` | Session directory name |
|
|
325
|
-
| `branch` | Git branch at review time |
|
|
326
|
-
| `change_id` | Continuous change reviewed, or null for initial baseline |
|
|
327
|
-
| `iteration` | Nth review for this branch (auto-incremented) |
|
|
328
|
-
| `mode` | Review mode used (full/quick/security/recheck/delta) |
|
|
329
|
-
| `timestamp` | ISO 8601 |
|
|
330
|
-
| `verdict` | APPROVE / COMMENT / REQUEST_CHANGES |
|
|
331
|
-
| `p0`, `p1`, `total` | Finding counts from SUMMARY.json |
|
|
332
|
-
| `parent` | Previous session ID for this branch (forms iteration chain) |
|
|
333
|
-
|
|
334
|
-
**Branch-scoped queries**:
|
|
335
|
-
- `recheck` / `delta`: filter `index.json` by `branch == current branch`, take latest
|
|
336
|
-
- Avoids cross-task pollution when multiple branches are active
|
|
337
|
-
|
|
338
|
-
## Lifecycle Management
|
|
339
|
-
|
|
340
|
-
**Cleanup strategy** (runs at Phase 1 of every `/ultra-review`):
|
|
341
|
-
|
|
342
|
-
| Rule | Action |
|
|
343
|
-
|------|--------|
|
|
344
|
-
| Session > 7 days AND verdict = APPROVE | Delete directory + remove from index |
|
|
345
|
-
| Session > 7 days AND verdict = COMMENT | Delete directory + remove from index |
|
|
346
|
-
| Session > 7 days AND verdict = REQUEST_CHANGES | **Keep** (unresolved P0s should not be silently deleted) |
|
|
347
|
-
| Session > 30 days (any verdict) | Delete directory + remove from index |
|
|
348
|
-
| Per-branch limit: > 5 sessions | Delete oldest APPROVE/COMMENT sessions for that branch |
|
|
349
|
-
|
|
350
|
-
**Implementation**:
|
|
351
|
-
```python
|
|
352
|
-
# In Phase 1, after creating session directory:
|
|
353
|
-
index = read index.json (or create if missing)
|
|
354
|
-
|
|
355
|
-
# 1. Remove stale sessions
|
|
356
|
-
now = current_time()
|
|
357
|
-
for session in index.sessions:
|
|
358
|
-
age_days = (now - session.timestamp).days
|
|
359
|
-
if age_days > 30:
|
|
360
|
-
delete(session)
|
|
361
|
-
elif age_days > 7 and session.verdict != 'REQUEST_CHANGES':
|
|
362
|
-
delete(session)
|
|
363
|
-
|
|
364
|
-
# 2. Per-branch cap (keep latest 5)
|
|
365
|
-
branch_sessions = [s for s in index.sessions if s.branch == current_branch]
|
|
366
|
-
if len(branch_sessions) > 5:
|
|
367
|
-
# Sort by timestamp, keep latest 5, delete rest (except REQUEST_CHANGES)
|
|
368
|
-
to_remove = sorted(branch_sessions, key=timestamp)[:-5]
|
|
369
|
-
for s in to_remove:
|
|
370
|
-
if s.verdict != 'REQUEST_CHANGES':
|
|
371
|
-
delete(s)
|
|
372
|
-
|
|
373
|
-
# 3. Write updated index
|
|
374
|
-
write index.json
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
## Fix Flow
|
|
378
|
-
|
|
379
|
-
When user selects "Fix all" or "Fix P0 only" after review:
|
|
380
|
-
|
|
381
|
-
**Step 0: Context Reset** (if verdict is REQUEST_CHANGES):
|
|
382
|
-
- Run `/compact` to clear TDD cycle history from context
|
|
383
|
-
- After compact, read `.ultra/workflow-state.json` to restore task context
|
|
384
|
-
- Read `SUMMARY.json` fresh to get actionable findings
|
|
385
|
-
- Then proceed with fixes below
|
|
386
|
-
|
|
387
|
-
1. **Read SUMMARY.json** — extract actionable P0/P1 items, sort by severity (P0 first)
|
|
388
|
-
2. **Group by file** — organize findings per file
|
|
389
|
-
3. **For each file with findings** (with circuit breaker tracking):
|
|
390
|
-
a. Read the file once
|
|
391
|
-
b. Apply ALL P0/P1 fixes for that file (batch within same file)
|
|
392
|
-
c. Run the RELEVANT test file only:
|
|
393
|
-
- Detect: `foo.ts` → `foo.test.ts` / `foo.spec.ts`
|
|
394
|
-
- Run: `npx jest <test-file> --bail` or `pytest <test-file> -x`
|
|
395
|
-
d. If test passes → mark findings as addressed, move to next file
|
|
396
|
-
e. If test fails from THIS fix → increment per-file failure counter, revert, try alternative approach
|
|
397
|
-
f. If test fails from pre-existing issue → note it, continue
|
|
398
|
-
g. **Circuit Breaker**: If same file has 3 consecutive fix failures (test fails after each attempt):
|
|
399
|
-
- Display: "Circuit breaker: {filename} — 3 consecutive fix failures. Likely architectural issue, not isolated bug."
|
|
400
|
-
- Use AskUserQuestion:
|
|
401
|
-
- A) "Skip this file, continue with others"
|
|
402
|
-
- B) "Manually inspect this file" (exit auto-fix, user takes over)
|
|
403
|
-
- C) "Abandon this fix round" (end fix flow, write UNRESOLVED.md)
|
|
404
|
-
h. **Global Circuit Breaker**: If 3+ files trigger per-file circuit breaker:
|
|
405
|
-
- Display: "Multiple files failing repeatedly — suggests systematic issue, not isolated bugs."
|
|
406
|
-
- Recommend ending fix flow, write all unresolved findings to UNRESOLVED.md with tag `ARCHITECTURAL_CONCERN`
|
|
407
|
-
4. **After all files fixed**: run FULL test suite once as validation
|
|
408
|
-
5. **Update verdict** — after all P0 fixes applied and tests pass:
|
|
409
|
-
```bash
|
|
410
|
-
python3 "$CLAUDE_PLUGIN_ROOT/skills/ultra-review/scripts/review_verdict_update.py" {SESSION_PATH}
|
|
411
|
-
```
|
|
412
|
-
This recalculates the verdict from current P0/P1 counts and updates both SUMMARY.json and index.json.
|
|
413
|
-
Without this step, pre_stop_check will block on stale REQUEST_CHANGES verdict.
|
|
414
|
-
6. **Optionally**: `/ultra-review recheck` (counts as iteration, respects max 2 cap)
|
|
415
|
-
|
|
416
|
-
**Important**: The main agent (not review agents) performs fixes. Review agents are read-only by design.
|
|
417
|
-
|
|
418
|
-
## Integration with ultra-dev
|
|
419
|
-
|
|
420
|
-
This skill integrates with the TDD workflow:
|
|
421
|
-
- After `tdd-runner` confirms tests pass
|
|
422
|
-
- Before `commit` or PR creation
|
|
423
|
-
- Quick mode for iterative development
|
|
424
|
-
- Full mode for pre-merge gate
|
|
425
|
-
- Recheck mode after fixing review findings
|
|
426
|
-
- Delta mode for incremental review during long development sessions
|
|
427
|
-
|
|
428
|
-
## Error Handling
|
|
429
|
-
|
|
430
|
-
- If no diff detected: inform user, suggest using `--range` or `--pr` to specify scope
|
|
431
|
-
- If `--pr` fails (no gh CLI or no PR): fall back to default diff and warn user
|
|
432
|
-
- If an agent fails to write JSON: note in coordinator input, skip that agent's findings
|
|
433
|
-
- If coordinator fails: fall back to reading individual JSON files and presenting raw findings
|
|
434
|
-
- If no agents selected (all skipped): inform user with skip reasons
|
|
435
|
-
|
|
436
|
-
## Directory Structure
|
|
437
|
-
|
|
438
|
-
```
|
|
439
|
-
.ultra/reviews/
|
|
440
|
-
├── index.json # Session index (all sessions metadata)
|
|
441
|
-
├── 20260214-103000-feat-task-3-auth-iter1/ # First review
|
|
442
|
-
│ ├── review-code.json
|
|
443
|
-
│ ├── review-tests.json
|
|
444
|
-
│ ├── review-errors.json
|
|
445
|
-
│ ├── review-design.json
|
|
446
|
-
│ ├── review-comments.json
|
|
447
|
-
│ ├── SUMMARY.json
|
|
448
|
-
│ └── SUMMARY.md
|
|
449
|
-
└── 20260214-113000-feat-task-3-auth-iter2/ # Recheck after fixes
|
|
450
|
-
├── review-code.json
|
|
451
|
-
├── SUMMARY.json
|
|
452
|
-
└── SUMMARY.md
|
|
453
|
-
```
|
|
79
|
+
At the final HEAD, compile review context with one convergence action. Delivery must
|
|
80
|
+
submit separate review evidence rows for `spec_fidelity` and
|
|
81
|
+
`engineering_standards`; a single aggregate pass is invalid.
|