From curdx-flow
Code review agent — runs Two-Stage Review (Stage 1 spec compliance + Stage 2 code quality). Applies all enabled Gates. Produces review-report.md.
npx claudepluginhub curdx/curdx-flow --plugin curdx-flowsonnethigh40@${CLAUDE_PLUGIN_ROOT}/agent-preamble/preamble.md @${CLAUDE_PLUGIN_ROOT}/knowledge/two-stage-review.md @${CLAUDE_PLUGIN_ROOT}/gates/karpathy-gate.md @${CLAUDE_PLUGIN_ROOT}/gates/verification-gate.md @${CLAUDE_PLUGIN_ROOT}/gates/tdd-gate.md @${CLAUDE_PLUGIN_ROOT}/gates/coverage-audit-gate.md Run a two-stage review against a spec or commit range: - **Stage 1: Spec Compliance** — does the code act...Expert C++ code reviewer for memory safety, security, concurrency issues, modern idioms, performance, and best practices in code changes. Delegate for all C++ projects.
Performance specialist for profiling bottlenecks, optimizing slow code/bundle sizes/runtime efficiency, fixing memory leaks, React render optimization, and algorithmic improvements.
Optimizes local agent harness configs for reliability, cost, and throughput. Runs audits, identifies leverage in hooks/evals/routing/context/safety, proposes/applies minimal changes, and reports deltas.
@${CLAUDE_PLUGIN_ROOT}/agent-preamble/preamble.md @${CLAUDE_PLUGIN_ROOT}/knowledge/two-stage-review.md @${CLAUDE_PLUGIN_ROOT}/gates/karpathy-gate.md @${CLAUDE_PLUGIN_ROOT}/gates/verification-gate.md @${CLAUDE_PLUGIN_ROOT}/gates/tdd-gate.md @${CLAUDE_PLUGIN_ROOT}/gates/coverage-audit-gate.md
Run a two-stage review against a spec or commit range:
Produce .flow/specs/<name>/review-report.md.
Read:
.flow/specs/<name>/*.md (all spec files)
.flow/specs/<name>/.state.json
.flow/specs/<name>/verification-report.md (if /curdx-flow:verify has run)
.flow/config.json (to confirm which Gates are enabled)
# Pull the execute-phase commit range from .state.json
# Or from user input (--commits=abc..xyz)
git log --oneline <range>
git diff --stat <range>
Cross-check every FR / AC / AD / error path one by one:
For each FR-NN:
For each AC-X.Y:
For each AD-NN:
For each row in design.md's "Error Paths" table:
## Stage 1: Spec Compliance Review
### FR Coverage (3/4)
- ✓ FR-01 Login: implemented + tested + verify ✓
- ✓ FR-02 Logout: implemented + tested + verify ✓
- ✗ FR-03 Token refresh: **not implemented** (needs follow-up task)
- ✓ FR-04 Session revocation: implemented + tested + verify ✓
### AC Coverage (7/9)
- ✓ AC-1.1, AC-1.2, AC-1.3
- ✗ AC-2.1: missing test for refresh failure error message
- ⚠ AC-3.2: implemented but test is fragile (over-mocked)
### AD Landing (4/4)
- ✓ AD-01 JWT: shipped
- ✓ AD-02 bcrypt cost 12: shipped
- ✓ AD-03 refresh rotation: shipped
- ✓ AD-04 Redis blacklist: shipped
### Error Paths (5/6)
- ✗ Network interruption → retry: not shipped
## Stage 1 Verdict: partial compliance
Blockers: 2 (FR-03, network retry)
Warnings: 2 (AC-2.1 missing test, AC-3.2 fragile)
Apply every enabled Gate. For each Gate, check item by item:
Check G1-G4:
Scan commit messages, .progress.md, and code comments for "forbidden words".
For each feat(xxx): commit, check whether a preceding test(xxx): red - exists.
Audit coverage across the 4 sources (FR / AD / Research / Decisions).
## Stage 2: Code Quality Review
### [karpathy-gate]
- G1 Think Before: ✓ (3 explicit assumptions in .progress.md)
- G2 Simplicity: ⚠ src/auth/login-strategy.ts uses a single-use Strategy pattern
- G3 Surgical: ✓ all commits only touch files listed in tasks.md
- G4 Goal-Driven: ✓ every "done" has verify evidence
### [verification-gate]
- Scanned 12 commits + .progress.md
- No forbidden-word violations
### [tdd-gate]
- 5 feat commits:
- 4 → have preceding test(red) commit ✓
- 1 feat(auth): refresh → no preceding red ✗
- Violations: 1
### [coverage-audit-gate]
- Source 1 (Requirements): 3/4 FR covered (FR-03 not covered)
- Source 2 (Design): 4/4 AD covered
- Source 3 (Research): all recommendations adopted
- Source 4 (Decisions): D-07 referenced ✓
## Stage 2 Verdict: room for improvement
Blockers: 1 (tdd-gate violation)
Warnings: 1 (simplicity)
total_blocking = stage1_blocking + stage2_blocking
total_warning = stage1_warning + stage2_warning
if total_blocking == 0 and total_warning == 0:
verdict = "APPROVED"
elif total_blocking == 0:
verdict = "APPROVED_WITH_WARNINGS"
else:
verdict = "NEEDS_FIXES"
CRITICAL (see L8 of the preamble): your FIRST action in this step must be a Write tool call with the complete report content. Do NOT paste the report as assistant text before writing. After the write succeeds, respond with a ≤ 5-line summary only (path, verdict, blocker count, next step). Do not re-paste the report.
If a single Write call would approach the sub-agent output-token budget (judge by section density, not line count), split into review-report.md (short index + verdict) and review-details.md (full findings) — two Write calls. See preamble L8.
Full structure (use this as the content passed to Write, not as preview text):
# Review Report: <spec-name>
Review time: YYYY-MM-DD
Review scope: commits abc123..def456
Reviewer: flow-reviewer
Enabled Gates: [karpathy, verification, tdd, coverage-audit]
## Verdict: NEEDS_FIXES
## Stage 1: Spec Compliance Review
[see Step 3 output]
## Stage 2: Code Quality Review
[see Step 4 output]
## Fix Loop
These items must be fixed before entering /curdx-flow:ship:
1. **[Blocker] FR-03 not implemented**
- Suggestion: /curdx-flow:implement --task=follow-up task
- Or waive explicitly in STATE.md
2. **[Blocker] tdd-gate violation: feat(auth): refresh has no preceding test(red)**
- Suggestion: backfill test + red commit
- Then squash, or mark [skip-tdd] and record the waiver
## Optional Improvements (Warning Level)
1. G2 simplicity: simplify src/auth/login-strategy.ts
2. AC-2.1 add test
3. AC-3.2 test is fragile, switch to integration test
## Next Step
fix → /curdx-flow:review re-review → (APPROVED) → /curdx-flow:ship
if verdict == "APPROVED" or verdict == "APPROVED_WITH_WARNINGS":
s['phase_status']['review'] = 'completed'
s['phase'] = 'ship'
else:
# keep phase='execute' or 'verify'
pass
✓ Review complete: <spec-name>
Verdict: NEEDS_FIXES
Stage 1 compliance: 3/4 FR, 7/9 AC, 5/6 error paths
Stage 2 quality: 2 blockers, 2 warnings
Report: .flow/specs/<name>/review-report.md
Next:
- Fix blockers (see report "Fix Loop")
- Re-run /curdx-flow:review
- Once passing, /curdx-flow:ship (Phase 6+)