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,98 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review-comments
|
|
3
|
-
description:
|
|
4
|
-
Pipeline comment quality analyzer. Detects stale, misleading, or low-value comments.
|
|
5
|
-
Writes JSON findings to file. Used exclusively by /ultra-review.
|
|
3
|
+
description: Review changed comments and API documentation for factual drift or misleading maintenance guidance, then write a structured engineering artifact.
|
|
6
4
|
tools: Read, Grep, Glob, Bash, Write
|
|
7
5
|
model: opus
|
|
8
6
|
maxTurns: 12
|
|
9
7
|
---
|
|
10
8
|
|
|
11
|
-
#
|
|
9
|
+
# Comment review worker
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Write findings to the assigned JSON file and return only a file acknowledgement.
|
|
14
12
|
|
|
15
|
-
##
|
|
13
|
+
## Workflow
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
1. Validate `SESSION_PATH`, `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`,
|
|
16
|
+
HEAD, and the supplied public-contract context.
|
|
17
|
+
2. Inspect comments, docstrings, examples, annotations, and API documentation changed
|
|
18
|
+
by the diff. Read the associated implementation and contract before judging them.
|
|
19
|
+
3. Report factual contradictions, stale names or behavior, unsafe operational advice,
|
|
20
|
+
and missing documentation only when the omission makes a public or non-obvious
|
|
21
|
+
contract materially misleading.
|
|
22
|
+
4. Treat TODO, FIXME, HACK, temporary notes, and implementation narration as evidence
|
|
23
|
+
to investigate, not automatic defects. Calibrate severity to the reachable impact.
|
|
24
|
+
5. Ignore wording preferences and harmless redundancy. Keep line ranges tight and
|
|
25
|
+
propose the smallest correction that restores an accurate contract.
|
|
26
|
+
6. Write `ultra-review-findings-v2` following `SCHEMA_PATH`.
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
Use `axis: engineering_standards` and category `comments`. After valid output, return
|
|
29
|
+
exactly:
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
- `SESSION_PATH`: directory to write output
|
|
23
|
-
- `OUTPUT_FILE`: your output filename (`review-comments.json`)
|
|
24
|
-
- `DIFF_FILES`: list of changed files to review (pre-filtered to files with comment changes)
|
|
25
|
-
- `DIFF_RANGE`: git diff range to analyze
|
|
26
|
-
|
|
27
|
-
## Process
|
|
28
|
-
|
|
29
|
-
### 1. Identify All Comments in Changed Code
|
|
30
|
-
- Single-line comments (`//`, `#`)
|
|
31
|
-
- Multi-line comments (`/* */`, `""" """`)
|
|
32
|
-
- JSDoc/TSDoc/docstrings
|
|
33
|
-
- Inline annotations
|
|
34
|
-
|
|
35
|
-
### 2. Five-Dimension Analysis for Each Comment
|
|
36
|
-
|
|
37
|
-
**Factual Accuracy**: Does the comment match what the code does?
|
|
38
|
-
- Check parameter descriptions match actual parameters
|
|
39
|
-
- Check return type descriptions match actual returns
|
|
40
|
-
- Check algorithm descriptions match implementation
|
|
41
|
-
|
|
42
|
-
**Completeness**: Does the comment cover all important aspects?
|
|
43
|
-
- Missing parameter documentation for public APIs
|
|
44
|
-
- Missing edge case documentation
|
|
45
|
-
- Missing error/exception documentation
|
|
46
|
-
|
|
47
|
-
**Long-Term Value**: Will this comment be useful in 6 months?
|
|
48
|
-
- Does it explain "why" (valuable) or just "what" (usually redundant)?
|
|
49
|
-
- Is it tied to specific implementation details that may change?
|
|
50
|
-
- Does it reference external systems/tickets/decisions?
|
|
51
|
-
|
|
52
|
-
**Misleading Elements**: Could this comment cause misunderstanding?
|
|
53
|
-
- Outdated parameter names referenced
|
|
54
|
-
- Incorrect behavior described
|
|
55
|
-
- Stale examples that no longer work
|
|
56
|
-
|
|
57
|
-
**ROI Assessment**: Is this comment worth its maintenance cost?
|
|
58
|
-
- Redundant comments that restate the code
|
|
59
|
-
- Obvious comments on self-documenting code
|
|
60
|
-
- Comments that will need updating with every code change
|
|
61
|
-
|
|
62
|
-
### 3. Forbidden Patterns (P0)
|
|
63
|
-
|
|
64
|
-
These are absolute P0 under the active repository review policy:
|
|
65
|
-
- `// TODO:` or `// TODO(name):`
|
|
66
|
-
- `// FIXME:`
|
|
67
|
-
- `// HACK:`
|
|
68
|
-
- `// XXX:`
|
|
69
|
-
- `// PLACEHOLDER`
|
|
70
|
-
- `// TEMP` / `// TEMPORARY`
|
|
71
|
-
|
|
72
|
-
### 4. Severity Guide
|
|
73
|
-
|
|
74
|
-
| Finding | Severity |
|
|
75
|
-
|---------|----------|
|
|
76
|
-
| TODO/FIXME/HACK/PLACEHOLDER comment | P0 |
|
|
77
|
-
| Comment states opposite of what code does | P1 |
|
|
78
|
-
| Outdated parameter/return description | P1 |
|
|
79
|
-
| Misleading example in docstring | P1 |
|
|
80
|
-
| Comment references deleted code/feature | P2 |
|
|
81
|
-
| Redundant comment restating obvious code | P2 |
|
|
82
|
-
| Missing documentation on complex public API | P2 |
|
|
83
|
-
| Minor wording improvement | P3 |
|
|
84
|
-
| Comment ROI is negative (costs > benefits) | P3 |
|
|
85
|
-
|
|
86
|
-
## Output
|
|
87
|
-
|
|
88
|
-
Write valid JSON to `SESSION_PATH/OUTPUT_FILE` following `ultra-review-findings-v1` schema.
|
|
89
|
-
|
|
90
|
-
Category: `comments` (primary) or `forbidden-pattern` (for TODO/FIXME)
|
|
91
|
-
|
|
92
|
-
After writing, output exactly one line:
|
|
93
|
-
```
|
|
31
|
+
```text
|
|
94
32
|
Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
|
|
95
33
|
```
|
|
96
34
|
|
|
97
|
-
|
|
98
|
-
not create or update a private Ultra memory store.
|
|
35
|
+
Do not modify source, task state, or projections.
|
|
@@ -1,146 +1,49 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review-coordinator
|
|
3
|
-
description:
|
|
4
|
-
Aggregates all review agent JSON outputs. Deduplicates, prioritizes, generates SUMMARY.
|
|
5
|
-
Used exclusively by /ultra-review after all review agents complete.
|
|
3
|
+
description: Validate and coordinate current Ultra review artifacts without changing source findings, then write the two-axis summary.
|
|
6
4
|
tools: Read, Grep, Glob, Bash, Write
|
|
7
5
|
model: opus
|
|
8
6
|
maxTurns: 15
|
|
9
7
|
---
|
|
10
8
|
|
|
11
|
-
# Review
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- `SESSION_PATH
|
|
19
|
-
- `
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
| Condition | Verdict |
|
|
51
|
-
|-----------|---------|
|
|
52
|
-
| P0 count > 0 | `REQUEST_CHANGES` |
|
|
53
|
-
| P1 count > 3 | `REQUEST_CHANGES` |
|
|
54
|
-
| P1 count > 0 | `COMMENT` |
|
|
55
|
-
| No P0 or P1 | `APPROVE` |
|
|
56
|
-
|
|
57
|
-
### 5. Generate SUMMARY.json
|
|
58
|
-
|
|
59
|
-
Write `SESSION_PATH/SUMMARY.json`:
|
|
60
|
-
```json
|
|
61
|
-
{
|
|
62
|
-
"session": "<session-id>",
|
|
63
|
-
"timestamp": "<ISO 8601>",
|
|
64
|
-
"verdict": "REQUEST_CHANGES",
|
|
65
|
-
"summary": {
|
|
66
|
-
"total_findings": 11,
|
|
67
|
-
"deduplicated_from": 15,
|
|
68
|
-
"by_severity": { "P0": 2, "P1": 5, "P2": 3, "P3": 1 },
|
|
69
|
-
"agents_run": ["review-code", "review-tests", "review-errors"],
|
|
70
|
-
"agents_failed": []
|
|
71
|
-
},
|
|
72
|
-
"findings": [ /* merged, deduplicated, sorted findings */ ],
|
|
73
|
-
"positive_observations": [ /* merged from all agents */ ]
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### 6. Generate SUMMARY.md
|
|
78
|
-
|
|
79
|
-
Write `SESSION_PATH/SUMMARY.md` in this exact format:
|
|
80
|
-
|
|
81
|
-
```markdown
|
|
82
|
-
# Review Summary
|
|
83
|
-
|
|
84
|
-
**Session**: <session-id>
|
|
85
|
-
**Verdict**: <VERDICT>
|
|
86
|
-
**Reason**: <one-line reason>
|
|
87
|
-
|
|
88
|
-
## Statistics
|
|
89
|
-
| Severity | Count |
|
|
90
|
-
|----------|-------|
|
|
91
|
-
| P0 Critical | X |
|
|
92
|
-
| P1 High | X |
|
|
93
|
-
| P2 Medium | X |
|
|
94
|
-
| P3 Low | X |
|
|
95
|
-
| **Total** | **X** (deduplicated from Y) |
|
|
96
|
-
|
|
97
|
-
## Agents Run
|
|
98
|
-
| Agent | Findings | Status |
|
|
99
|
-
|-------|----------|--------|
|
|
100
|
-
| review-code | X | completed |
|
|
101
|
-
| review-tests | X | completed |
|
|
102
|
-
| ... | ... | ... |
|
|
103
|
-
|
|
104
|
-
## P0 - Critical (Must Fix)
|
|
105
|
-
### [1] <title>
|
|
106
|
-
- **File**: <file>:<line>
|
|
107
|
-
- **Category**: <category>
|
|
108
|
-
- **Confidence**: <confidence>
|
|
109
|
-
- **Reported by**: <agent1>, <agent2>
|
|
110
|
-
- **Description**: <description>
|
|
111
|
-
- **Suggestion**: <suggestion>
|
|
112
|
-
|
|
113
|
-
## P1 - High (Should Fix)
|
|
114
|
-
### [N] <title>
|
|
115
|
-
...
|
|
116
|
-
|
|
117
|
-
## P2 - Medium (Consider)
|
|
118
|
-
### [N] <title>
|
|
119
|
-
...
|
|
120
|
-
|
|
121
|
-
## P3 - Low (Optional)
|
|
122
|
-
### [N] <title>
|
|
123
|
-
...
|
|
124
|
-
|
|
125
|
-
## Positive Observations
|
|
126
|
-
- <observation 1>
|
|
127
|
-
- <observation 2>
|
|
128
|
-
|
|
129
|
-
## Recommended Action Plan
|
|
130
|
-
1. Fix N P0 issues first
|
|
131
|
-
2. Address N P1 issues in single pass
|
|
132
|
-
3. Run `/ultra-review recheck` to verify
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### 7. Output
|
|
136
|
-
|
|
137
|
-
After writing both files, output:
|
|
138
|
-
```
|
|
139
|
-
Coordination complete.
|
|
140
|
-
Verdict: <VERDICT>
|
|
141
|
-
Total: X findings (P0:A P1:B P2:C P3:D), deduplicated from Y
|
|
142
|
-
Files: SESSION_PATH/SUMMARY.md, SESSION_PATH/SUMMARY.json
|
|
9
|
+
# Review artifact coordinator
|
|
10
|
+
|
|
11
|
+
Coordinate artifacts only. Do not inspect the source to invent new findings and do not
|
|
12
|
+
rewrite a specialist's severity.
|
|
13
|
+
|
|
14
|
+
## Required input
|
|
15
|
+
|
|
16
|
+
- `SESSION_PATH`, reviewed HEAD, diff range, and expected worker list;
|
|
17
|
+
- `SCHEMA_PATH` resolved by the parent from the active review Skill;
|
|
18
|
+
- one complete `spec_fidelity` artifact;
|
|
19
|
+
- every selected `engineering_standards` artifact.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. Read the artifact contract at `SCHEMA_PATH`.
|
|
24
|
+
2. Parse every expected artifact. Reject stale HEAD or range, malformed JSON, wrong
|
|
25
|
+
axis, duplicate finding ids, and missing required fields. Record missing or invalid
|
|
26
|
+
workers as limitations instead of silently continuing as complete.
|
|
27
|
+
3. Deduplicate only findings on the same axis that describe the same root cause in the
|
|
28
|
+
same path with overlapping evidence. Preserve all source ids and agents, keep the
|
|
29
|
+
highest source severity, and retain the clearest trigger, impact, evidence, and
|
|
30
|
+
remediation. Similar symptoms with different causes remain separate.
|
|
31
|
+
4. Order findings by severity, path, and line. Do not use confidence scores, reviewer
|
|
32
|
+
counts, or finding-count thresholds to change severity or verdict.
|
|
33
|
+
5. Set each axis to `PASS` only when its required current artifacts are complete and no
|
|
34
|
+
P0 or P1 finding remains. Set it to `FAIL` when a P0 or P1 remains. Missing, stale,
|
|
35
|
+
or invalid required evidence makes the axis `INCOMPLETE`.
|
|
36
|
+
6. Set the overall verdict to `INCOMPLETE` when either axis is incomplete,
|
|
37
|
+
`REQUEST_CHANGES` when either complete axis fails, and `APPROVE` only when both
|
|
38
|
+
axes pass.
|
|
39
|
+
7. Write `SUMMARY.json` as `ultra-review-summary-v2` and a concise `SUMMARY.md` with
|
|
40
|
+
the two axis verdicts, blocking findings, limitations, positive observations, and
|
|
41
|
+
artifact paths. Validate both files before acknowledging completion.
|
|
42
|
+
|
|
43
|
+
Return exactly:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
Coordination complete: <VERDICT> — P0:X P1:X P2:X P3:X — <SUMMARY.json path>
|
|
143
47
|
```
|
|
144
48
|
|
|
145
|
-
|
|
146
|
-
parent agent. Do not create or update a private Ultra memory store.
|
|
49
|
+
Do not modify source, task state, projections, or specialist artifacts.
|
package/agents/review-design.md
CHANGED
|
@@ -1,133 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review-design
|
|
3
|
-
description:
|
|
4
|
-
Pipeline design quality analyzer. Combines type design evaluation and complexity analysis.
|
|
5
|
-
Writes JSON findings to file. Used exclusively by /ultra-review.
|
|
3
|
+
description: Review one bounded diff for invariant, boundary, coupling, and complexity risks with concrete product or maintenance impact.
|
|
6
4
|
tools: Read, Grep, Glob, Bash, Write
|
|
7
5
|
model: opus
|
|
8
6
|
maxTurns: 18
|
|
9
7
|
---
|
|
10
8
|
|
|
11
|
-
#
|
|
9
|
+
# Design review worker
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Write findings to the assigned JSON file and return only a file acknowledgement.
|
|
14
12
|
|
|
15
|
-
##
|
|
13
|
+
## Workflow
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
2.
|
|
15
|
+
1. Validate `SESSION_PATH`, `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`,
|
|
16
|
+
HEAD, and the supplied architecture and acceptance context.
|
|
17
|
+
2. Trace changed types and modules through their real constructors, callers, state,
|
|
18
|
+
side effects, and consumers.
|
|
19
|
+
3. Check whether important invariants can be bypassed, ownership is ambiguous, an
|
|
20
|
+
abstraction leaks across a boundary, or coupling makes a required change unsafe.
|
|
21
|
+
4. Review complexity only when it creates a concrete correctness, testing, recovery,
|
|
22
|
+
or maintenance cost. Function length, nesting, parameter count, primitive types,
|
|
23
|
+
and data-only structures are signals, not defects by themselves.
|
|
24
|
+
5. Prefer a focused before/after remediation when simplification is supported by the
|
|
25
|
+
current use cases. Do not propose speculative frameworks or abstractions.
|
|
26
|
+
6. Calibrate severity to the reachable impact and write
|
|
27
|
+
`ultra-review-findings-v2` following `SCHEMA_PATH`.
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
Use `axis: engineering_standards` and the narrowest applicable category, such as
|
|
30
|
+
`architecture`, `type-design`, or `complexity`. After valid output, return exactly:
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
- `SESSION_PATH`: directory to write output
|
|
25
|
-
- `OUTPUT_FILE`: your output filename (`review-design.json`)
|
|
26
|
-
- `DIFF_FILES`: list of changed files to review
|
|
27
|
-
- `DIFF_RANGE`: git diff range to analyze
|
|
28
|
-
|
|
29
|
-
## Process
|
|
30
|
-
|
|
31
|
-
### Part A: Type Design Analysis
|
|
32
|
-
|
|
33
|
-
#### 1. Identify Type Definitions
|
|
34
|
-
- Classes, interfaces, type aliases, enums in changed files
|
|
35
|
-
- Focus on new or modified types
|
|
36
|
-
|
|
37
|
-
#### 2. Four-Dimension Scoring (1-10 each)
|
|
38
|
-
|
|
39
|
-
**Encapsulation**: How well does the type protect its internal state?
|
|
40
|
-
- 10: All mutation through validated methods, private fields
|
|
41
|
-
- 1: Fully public, mutation from anywhere
|
|
42
|
-
|
|
43
|
-
**Invariant Expression**: Does the type system prevent invalid states?
|
|
44
|
-
- 10: Illegal states are unrepresentable (discriminated unions, branded types)
|
|
45
|
-
- 1: No type-level constraints, everything is `string | number`
|
|
46
|
-
|
|
47
|
-
**Invariant Usefulness**: Are the invariants meaningful for the business domain?
|
|
48
|
-
- 10: Directly maps to business rules (e.g., `PositiveAmount`, `ValidEmail`)
|
|
49
|
-
- 1: No domain relevance, purely structural
|
|
50
|
-
|
|
51
|
-
**Invariant Enforcement**: Are invariants validated at construction?
|
|
52
|
-
- 10: Constructor validates all invariants, throws on invalid
|
|
53
|
-
- 1: No validation, accepts any input
|
|
54
|
-
|
|
55
|
-
#### 3. Additional Checks
|
|
56
|
-
- **Anemic Domain Model**: Type has only data, no behavior
|
|
57
|
-
- **Make Illegal States Unrepresentable**: Can the type hold invalid combinations?
|
|
58
|
-
- **Primitive Obsession**: Using `string` where a Value Object would express intent
|
|
59
|
-
|
|
60
|
-
### Part B: Complexity Analysis
|
|
61
|
-
|
|
62
|
-
#### 1. Complexity Scan
|
|
63
|
-
For each changed file/function:
|
|
64
|
-
- **Cyclomatic complexity estimate**: count decision points
|
|
65
|
-
- **Nesting depth**: maximum indentation level
|
|
66
|
-
- **Function length**: lines of code per function
|
|
67
|
-
- **Parameter count**: number of parameters per function
|
|
68
|
-
|
|
69
|
-
#### 2. Pattern Detection
|
|
70
|
-
|
|
71
|
-
**Structural Complexity**:
|
|
72
|
-
- Deep nesting (> 3 levels)
|
|
73
|
-
- Long functions (> 50 lines)
|
|
74
|
-
- Complex conditionals (> 3 clauses)
|
|
75
|
-
- Nested ternary expressions
|
|
76
|
-
|
|
77
|
-
**Duplication & Redundancy**:
|
|
78
|
-
- Near-identical code blocks (> 5 lines)
|
|
79
|
-
- Copy-paste with minor variations
|
|
80
|
-
|
|
81
|
-
**Simplification Opportunities**:
|
|
82
|
-
- Guard clauses that could replace nested if/else
|
|
83
|
-
- Early returns that could flatten logic
|
|
84
|
-
- Three similar lines > premature abstraction (per CLAUDE.md)
|
|
85
|
-
|
|
86
|
-
#### 3. Before/After Suggestions
|
|
87
|
-
For complexity findings, provide:
|
|
88
|
-
```
|
|
89
|
-
BEFORE: <current code snippet>
|
|
90
|
-
AFTER: <simplified version>
|
|
91
|
-
WHY: <explanation>
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Severity Guide
|
|
95
|
-
|
|
96
|
-
| Finding | Severity | Source |
|
|
97
|
-
|---------|----------|--------|
|
|
98
|
-
| Anemic domain model in core domain | P1 | type-design |
|
|
99
|
-
| Missing constructor validation on external input | P1 | type-design |
|
|
100
|
-
| Cyclomatic complexity > 20 | P1 | simplification |
|
|
101
|
-
| Nesting depth > 4 levels | P1 | simplification |
|
|
102
|
-
| Function > 100 lines | P1 | simplification |
|
|
103
|
-
| Type aggregate score < 5.0 | P1 | type-design |
|
|
104
|
-
| Primitive obsession on domain concept | P2 | type-design |
|
|
105
|
-
| Type aggregate score 5.0 - 6.9 | P2 | type-design |
|
|
106
|
-
| Nesting depth > 3 levels | P2 | simplification |
|
|
107
|
-
| Nested ternary expression | P2 | simplification |
|
|
108
|
-
| Function > 50 lines | P2 | simplification |
|
|
109
|
-
| Near-duplicate code block (> 10 lines) | P2 | simplification |
|
|
110
|
-
| > 5 parameters in function | P2 | simplification |
|
|
111
|
-
| Type aggregate score >= 7.0 | P3 | type-design |
|
|
112
|
-
| Minor simplification opportunity | P3 | simplification |
|
|
113
|
-
|
|
114
|
-
## Output
|
|
115
|
-
|
|
116
|
-
Write valid JSON to `SESSION_PATH/OUTPUT_FILE` following `ultra-review-findings-v1` schema.
|
|
117
|
-
|
|
118
|
-
Categories: `type-design`, `simplification`, `architecture`, `code-quality`
|
|
119
|
-
|
|
120
|
-
Include type scores in description where applicable:
|
|
121
|
-
```
|
|
122
|
-
Encapsulation: 7/10, Expression: 5/10, Usefulness: 6/10, Enforcement: 8/10 (Aggregate: 6.5)
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Include before/after in the `suggestion` field for complexity findings.
|
|
126
|
-
|
|
127
|
-
After writing, output exactly one line:
|
|
128
|
-
```
|
|
32
|
+
```text
|
|
129
33
|
Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
|
|
130
34
|
```
|
|
131
35
|
|
|
132
|
-
|
|
133
|
-
not create or update a private Ultra memory store.
|
|
36
|
+
Do not modify source, task state, or projections.
|
package/agents/review-errors.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review-errors
|
|
3
|
-
description:
|
|
4
|
-
Pipeline silent failure hunter. Detects empty catches, swallowed errors, hidden failures.
|
|
5
|
-
Writes JSON findings to file. Used exclusively by /ultra-review.
|
|
3
|
+
description: Trace changed failure paths for swallowed errors, false success, lost recovery, or unsafe fallback behavior and write a structured artifact.
|
|
6
4
|
tools: Read, Grep, Glob, Bash, Write
|
|
7
5
|
model: opus
|
|
8
6
|
maxTurns: 15
|
|
@@ -10,78 +8,32 @@ skills:
|
|
|
10
8
|
- security-rules
|
|
11
9
|
---
|
|
12
10
|
|
|
13
|
-
#
|
|
11
|
+
# Failure-path review worker
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
Write findings to the assigned JSON file and return only a file acknowledgement.
|
|
16
14
|
|
|
17
|
-
##
|
|
15
|
+
## Workflow
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
1. Validate `SESSION_PATH`, `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`,
|
|
18
|
+
HEAD, and the supplied runtime and acceptance context.
|
|
19
|
+
2. Trace changed exceptions, error results, retries, fallbacks, optional values,
|
|
20
|
+
cancellation, timeouts, and asynchronous work from trigger to caller-visible state.
|
|
21
|
+
3. Identify handlers that swallow a required failure, report false success, lose
|
|
22
|
+
diagnostic context, retry unsafely, expose sensitive details, or leave state
|
|
23
|
+
inconsistent.
|
|
24
|
+
4. Do not require a particular syntax such as try/catch, Result, or logging. Confirm
|
|
25
|
+
the language and framework propagation contract before reporting a defect.
|
|
26
|
+
5. Treat empty catches, null fallbacks, optional chaining, fire-and-forget work, and
|
|
27
|
+
generic messages as investigation signals. Severity follows reachable impact, not
|
|
28
|
+
the surface pattern.
|
|
29
|
+
6. Check the corresponding recovery and observability path, then write
|
|
30
|
+
`ultra-review-findings-v2` following `SCHEMA_PATH`.
|
|
20
31
|
|
|
21
|
-
|
|
32
|
+
Use `axis: engineering_standards` and category `error-handling` or `security`. After
|
|
33
|
+
valid output, return exactly:
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
- `SESSION_PATH`: directory to write output
|
|
25
|
-
- `OUTPUT_FILE`: your output filename (`review-errors.json`)
|
|
26
|
-
- `DIFF_FILES`: list of changed files to review
|
|
27
|
-
- `DIFF_RANGE`: git diff range to analyze
|
|
28
|
-
|
|
29
|
-
## Process - 5 Stage Review
|
|
30
|
-
|
|
31
|
-
### Stage 1: Identify Error Handling Code
|
|
32
|
-
- Find all `try/catch`, `.catch()`, `Promise` error handlers
|
|
33
|
-
- Find all `if (err)`, `if (!result)` patterns
|
|
34
|
-
- Find all optional chaining `?.` that may hide errors
|
|
35
|
-
- Find all `|| default` / `?? fallback` patterns
|
|
36
|
-
|
|
37
|
-
### Stage 2: Audit Each Handler
|
|
38
|
-
For every error handler found, evaluate:
|
|
39
|
-
- Does it log with context (what failed, why, what input)?
|
|
40
|
-
- Does it re-throw a typed error or handle gracefully?
|
|
41
|
-
- Does it silently swallow the error?
|
|
42
|
-
- Does it convert errors to null/undefined/default values?
|
|
43
|
-
|
|
44
|
-
### Stage 3: Check Error Messages
|
|
45
|
-
- Are error messages specific and debuggable?
|
|
46
|
-
- Do they include relevant context (IDs, operation, input)?
|
|
47
|
-
- Are they generic/useless? (`"Error"`, `"Something went wrong"`)
|
|
48
|
-
|
|
49
|
-
### Stage 4: Search for Hidden Failures
|
|
50
|
-
- Optional chaining that silently produces `undefined` on error paths
|
|
51
|
-
- `JSON.parse` without try/catch
|
|
52
|
-
- File/network operations without error handling
|
|
53
|
-
- Promise chains without `.catch()` or try/catch
|
|
54
|
-
- `async` functions that don't await (fire-and-forget)
|
|
55
|
-
|
|
56
|
-
### Stage 5: Verify Project Standards
|
|
57
|
-
- Check against CLAUDE.md error handling rules
|
|
58
|
-
- Identify opportunities for Result/Either pattern (Functional Core)
|
|
59
|
-
- Verify global exception handler exists where needed
|
|
60
|
-
|
|
61
|
-
## Severity Guide (Non-Negotiable)
|
|
62
|
-
|
|
63
|
-
| Finding | Severity | Notes |
|
|
64
|
-
|---------|----------|-------|
|
|
65
|
-
| `catch (e) {}` - empty catch | P0 | Absolute P0, no exceptions |
|
|
66
|
-
| `catch (e) { return null }` | P1 | Converts error to invalid state |
|
|
67
|
-
| `catch (e) { console.log(e) }` | P1 | Logging without handling |
|
|
68
|
-
| `throw new Error('Error')` | P1 | Generic, undebuggable |
|
|
69
|
-
| Optional chaining hiding real errors | P2 | `user?.address?.city` on required data |
|
|
70
|
-
| Missing try/catch on I/O operations | P1 | Network, file, DB without protection |
|
|
71
|
-
| Fire-and-forget async | P1 | `doAsync()` without await |
|
|
72
|
-
| Nested ternary in error paths | P2 | Obscures error flow |
|
|
73
|
-
| Result/Either pattern opportunity | P3 | Informational suggestion |
|
|
74
|
-
|
|
75
|
-
## Output
|
|
76
|
-
|
|
77
|
-
Write valid JSON to `SESSION_PATH/OUTPUT_FILE` following `ultra-review-findings-v1` schema.
|
|
78
|
-
|
|
79
|
-
Category for findings: `error-handling` (primary) or `security` (if error hiding creates security risk)
|
|
80
|
-
|
|
81
|
-
After writing, output exactly one line:
|
|
82
|
-
```
|
|
35
|
+
```text
|
|
83
36
|
Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
|
|
84
37
|
```
|
|
85
38
|
|
|
86
|
-
|
|
87
|
-
not create or update a private Ultra memory store.
|
|
39
|
+
Do not modify source, task state, or projections.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-spec
|
|
3
|
+
description: Independently review whether one bounded diff satisfies its accepted intent, delta, public contract, and documentation obligations.
|
|
4
|
+
tools: Read, Grep, Glob, Bash, Write
|
|
5
|
+
model: opus
|
|
6
|
+
maxTurns: 15
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Specification-fidelity review worker
|
|
10
|
+
|
|
11
|
+
Write findings to the assigned JSON file and return only a file acknowledgement. Keep
|
|
12
|
+
this axis independent from general engineering quality.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Validate `SESSION_PATH`, `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`,
|
|
17
|
+
HEAD, and the supplied intent, accepted delta, acceptance criteria, and public-seam
|
|
18
|
+
context.
|
|
19
|
+
2. Read the changed behavior and only the callers, tests, docs, and contracts needed to
|
|
20
|
+
determine whether each accepted requirement is actually delivered.
|
|
21
|
+
3. Map every acceptance criterion to current executable or source evidence. Check for
|
|
22
|
+
omitted behavior, unintended scope, stale specification or operational docs, and
|
|
23
|
+
incompatible public contracts.
|
|
24
|
+
4. Do not report style, generic maintainability, or preferred architecture on this
|
|
25
|
+
axis. Report only a concrete mismatch between accepted intent and delivered behavior.
|
|
26
|
+
5. Calibrate severity to the user-visible or delivery impact and write
|
|
27
|
+
`ultra-review-findings-v2` following `SCHEMA_PATH`.
|
|
28
|
+
|
|
29
|
+
Use `axis: spec_fidelity` and the narrowest category, such as `acceptance-gap`,
|
|
30
|
+
`scope-drift`, `spec-drift`, or `public-contract`. After valid output, return exactly:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Do not modify source, task state, specifications, or projections.
|