claude-dev-env 8.11.0 → 8.12.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 (47) hide show
  1. package/.agents/skills/e-code-review/SKILL.md +24 -71
  2. package/.agents/skills/e-code-review/reference/fix.md +7 -78
  3. package/.agents/skills/e-code-review/reference/high.md +129 -0
  4. package/.agents/skills/e-code-review/reference/low.md +20 -51
  5. package/.agents/skills/e-code-review/reference/max.md +169 -0
  6. package/.agents/skills/e-code-review/reference/medium.md +7 -191
  7. package/.agents/skills/e-code-review/reference/xhigh.md +47 -91
  8. package/_shared/pr-loop/scripts/fix_pr_test_proof.py +113 -12
  9. package/_shared/pr-loop/scripts/pr_loop_shared_constants/fix_pr_test_proof_constants.py +5 -1
  10. package/_shared/pr-loop/scripts/test_fix_pr_test_proof.py +63 -3
  11. package/bin/codex-skill-load-block.mjs +67 -19
  12. package/bin/codex-skill-load-block.test.mjs +87 -25
  13. package/bin/install.agents-home.test.mjs +9 -9
  14. package/bin/install.mjs +4 -2
  15. package/bin/install.test.mjs +20 -0
  16. package/commands/sr-loop.md +3 -1
  17. package/hooks/blocking/pii_prevention_blocker_parts/repository_exemption.py +3 -3
  18. package/hooks/blocking/tests/test_repository_exemption.py +7 -0
  19. package/hooks/hooks_constants/code_rules_path_utils_constants.py +0 -1
  20. package/package.json +1 -1
  21. package/rules/build-needs-a-user.md +1 -1
  22. package/rules/testing.md +1 -1
  23. package/scripts/policy_lint/config/constants.py +1 -1
  24. package/scripts/repository_checks/tracked_private_terms.py +15 -1
  25. package/scripts/tests/test_policy_lint_rules_callers.py +14 -0
  26. package/scripts/tests/test_tracked_private_terms.py +35 -0
  27. package/.agents/skills/e-code-review/preflight-proposal.contract.test.mjs +0 -20
  28. package/.agents/skills/e-code-review/reference/effort-evaluation.md +0 -35
  29. package/.agents/skills/e-code-review/reference/loop.md +0 -261
  30. package/.agents/skills/e-code-review/reference/mode-contract.test.mjs +0 -67
  31. package/.agents/skills/e-code-review/reference/preflight-proposal.md +0 -75
  32. package/.agents/skills/e-code-review/reference/runner-selection.md +0 -40
  33. package/.agents/skills/e-code-review/scripts/config/e_code_review_effort_constants/__init__.py +0 -41
  34. package/.agents/skills/e-code-review/scripts/config/e_code_review_effort_constants/effort_constants.py +0 -40
  35. package/.agents/skills/e-code-review/scripts/e_code_review_scripts_constants/__init__.py +0 -1
  36. package/.agents/skills/e-code-review/scripts/e_code_review_scripts_constants/finding_pipeline_constants.py +0 -49
  37. package/.agents/skills/e-code-review/scripts/e_code_review_scripts_constants/grok_code_review_constants.py +0 -55
  38. package/.agents/skills/e-code-review/scripts/effort_defaults_evidence.json +0 -186
  39. package/.agents/skills/e-code-review/scripts/effort_evaluation.py +0 -362
  40. package/.agents/skills/e-code-review/scripts/finding_pipeline.py +0 -140
  41. package/.agents/skills/e-code-review/scripts/fixtures/demanding.json +0 -26
  42. package/.agents/skills/e-code-review/scripts/fixtures/easy.json +0 -14
  43. package/.agents/skills/e-code-review/scripts/fixtures/medium.json +0 -20
  44. package/.agents/skills/e-code-review/scripts/grok_code_review.py +0 -230
  45. package/.agents/skills/e-code-review/scripts/test_effort_evaluation.py +0 -180
  46. package/.agents/skills/e-code-review/scripts/test_finding_pipeline.py +0 -197
  47. package/.agents/skills/e-code-review/scripts/test_grok_code_review.py +0 -289
@@ -1,90 +1,43 @@
1
1
  ---
2
2
  name: e-code-review
3
3
  description: >-
4
- Max-recall code review at a selectable effort level (low, medium, xhigh), with
5
- optional auto-fix and an auto-execute loop for any level. Triggers:
6
- /e-code-review, /e-code-review low, /e-code-review medium, /e-code-review
7
- xhigh, /e-code-review <level> --fix, /e-code-review <level> loop,
8
- /e-code-review preflight-proposal.
4
+ Code review at one of five effort levels that match the built-in
5
+ /code-review recipes step for step: low, medium, high, xhigh, max.
6
+ Triggers: /e-code-review, /e-code-review low, /e-code-review medium,
7
+ /e-code-review high, /e-code-review xhigh, /e-code-review max, and any
8
+ level with --fix.
9
9
  ---
10
10
 
11
11
  # e-code-review
12
12
 
13
- **Pick a level, run that review, optionally fix and loop.** Each level has its own procedure file. Fix application lives in `reference/fix.md`; repeat-until-clean lives in `reference/loop.md`.
13
+ **Pick a level, load its file, run it.** Each file has the same steps, angles, caps, and fields as the built-in `/code-review` recipe for that level. Only the wording differs, where this repo's prose rules require it.
14
14
 
15
- ## Mode routing
16
-
17
- Resolve the first matching invocation before the normal refusal and loop rules:
18
-
19
- 1. `preflight-proposal` requires `<pr_number>`, `--level <low|medium|xhigh>`, `--base-sha <immutable SHA>`, `--head-sha <immutable SHA>`, and `--worktree <isolated path>`. Default level is `low`. Follow [reference/preflight-proposal.md](reference/preflight-proposal.md). The mode runs `<review_level> --fix loop` locally and returns selected-candidate-ready proposal evidence.
20
- 2. Normal mode follows the current level, `--fix`, and `loop` behavior.
21
-
22
- Proposal mode selects the review level and records finding outcomes. The downstream owner records selected proposal IDs before reapplication. Each new finding gets a new ID.
23
-
24
- ## Gotchas
25
-
26
- - **`low` stays single-pass.** No subagents, no full-file reads: one read pass per target item, one findings pass.
27
- - **Collection reports every finding.** Keep every CONFIRMED or PLAUSIBLE finding at its assigned severity (`blocker`, `high`, `medium`, `low`, `nit`). Do not drop low or nit findings during collection. Severity or action filtering is a separate consumer stage after the collection record is complete (`scripts/finding_pipeline.py`).
28
- - **`medium` favors precision, `xhigh` favors recall.** At `medium` (8 angles) assign severity carefully so a later filter can pick maintainer-action findings. At `xhigh` (10 angles plus a gap sweep) a single non-REFUTED vote carries the finding; do not drop on uncertainty.
29
- - **Every retained finding carries `severity` and `verdict`.** Severity is one of `blocker`, `high`, `medium`, `low`, `nit`. Verdict is `CONFIRMED` or `PLAUSIBLE`. Drop REFUTED candidates only; never emit an unclassified retained finding.
30
- - **`--fix` applies findings once.** Load `reference/fix.md` and follow it. That file owns the fix agent, the code-rules gate, skip logging, and outcome reporting. Commits are lead-owned; fix agents never commit or push.
31
- - **`loop` never asks.** A round with bug findings validates them with an advisor, fixes, and re-reviews. Terminals are exactly `clean`, `nits_fixed`, and `advisor_blocked`. There is no reviewed-head count limit; a new head increments the count once, a re-review of the same head does not. Load `reference/loop.md` and follow it.
32
- - **`--fix` and `loop` combine.** With both, each loop round runs the level file, and the round's fixing happens inside `reference/loop.md`'s gate sequence, which loads `reference/fix.md` for the mechanics. There is no separate fix pass around the round.
33
-
34
- ## When this skill applies
15
+ | Level | File | Shape |
16
+ |---|---|---|
17
+ | `low` | [reference/low.md](reference/low.md) | 1 diff pass, no verify, at most 4 findings |
18
+ | `medium` | [reference/medium.md](reference/medium.md) | 1 careful diff pass, at most 15 findings |
19
+ | `high` | [reference/high.md](reference/high.md) | 8 inline angles, dedup with no verify, at most 10 findings |
20
+ | `xhigh` | [reference/xhigh.md](reference/xhigh.md) | 10 inline angles, dedup, gap sweep, at most 15 findings |
21
+ | `max` | [reference/max.md](reference/max.md) | 10 subagent angles, 1-vote verify, gap sweep, at most 15 findings |
35
22
 
36
- Triggers: `/e-code-review <level> [--fix] [loop]`. `<level>` is `low`, `medium`, or `xhigh`. `--fix` and `loop` are each optional and may be used together.
23
+ ## Level
37
24
 
38
- **Refusal. First match wins:**
25
+ With no level, or an unknown one, run `high`.
39
26
 
40
- - **No level, or an unknown level.** Respond exactly: `Which effort level — low, medium, or xhigh?`
27
+ ## Target
41
28
 
42
- ## Evaluation-backed defaults (e-code-review family)
29
+ A PR number, branch name, or file path after the level is the review target. With no target, the review reads the current diff.
43
30
 
44
- When the caller asks which level to pick for a known fixture band (easy / medium / demanding scope), use the committed OP-02B evaluation evidence. Thinking stays on; **effort** is the only cost/latency lever.
31
+ ## Report
45
32
 
46
- | Fixture band | Skill effort | Source |
47
- |---|---|---|
48
- | easy | `medium` | `scripts/effort_defaults_evidence.json` → `skill_defaults.default_by_band.easy` |
49
- | medium | `xhigh` | same file → `medium` (maps evaluation `high`) |
50
- | demanding | `xhigh` | same file → `demanding` (maps evaluation `max`) |
33
+ Each level file reports through the ReportFindings tool. When the host has no ReportFindings tool, print the findings in its place, most severe first, one per line as `file:line — summary`. `--fix` reports its outcomes the same way, with the outcome at the end of each line.
51
34
 
52
- Resolve programmatically with `scripts/effort_evaluation.py` → `resolve_skill_effort_for_band`. Every default cites a completed evaluation row. The user-facing command still requires an explicit level flag; these defaults answer "what should I pick?" for this workflow family only.
35
+ ## --fix
53
36
 
54
- Detail: `reference/effort-evaluation.md`.
37
+ `--fix` works with every level. It lives in one file, [reference/fix.md](reference/fix.md). No level file carries its own fix steps.
55
38
 
56
39
  ## The process
57
40
 
58
- 1. Read `<level>` and the optional `--fix` and `loop` flags. Apply the refusal first.
59
- 2. Load `reference/low.md`, `reference/medium.md`, or `reference/xhigh.md`. Run that file as one review cycle, ending in its structured findings report.
60
- 3. If `--fix` is set and `loop` is not set, load `reference/fix.md` and apply it to that cycle's findings. This path has no commit step: the fixes stay uncommitted in the working tree for the user to review and commit.
61
- 4. If `loop` is set, load `reference/loop.md` and follow it with that cycle's findings still unfixed. Round 1's findings are the ones step 2 already produced; from the second round on, the round re-runs that same level file end to end. End to end means the level file's review phases, up to and including its findings report. Skip that file's *Looping* section, which hands control to `loop.md` and would re-enter the loop the round is already inside. `loop.md`'s gate sequence owns when the round fixes.
62
- 5. Without `--fix` or `loop`, return the cycle findings and stop.
63
-
64
- ## File index
65
-
66
- | File | Purpose |
67
- |---|---|
68
- | `SKILL.md` | Route by level; dispatch `--fix` and `loop` |
69
- | `reference/low.md` | low review procedure: 1 diff pass per target item, no verify |
70
- | `reference/medium.md` | medium review procedure: 8 angles, 1-vote verify |
71
- | `reference/xhigh.md` | xhigh review procedure: 10 angles, 1-vote verify, gap sweep |
72
- | `reference/fix.md` | Fix application, code-rules gate, skip logging, outcome reporting |
73
- | `reference/loop.md` | Repeat review/fix rounds until clean |
74
- | `reference/preflight-proposal.md` | Isolated local review, immutable SHAs, proposal evidence, and mutation boundary |
75
- | `reference/effort-evaluation.md` | Effort evaluation fixtures, evidence, and skill defaults |
76
- | `reference/runner-selection.md` | Runner selection map |
77
- | `scripts/finding_pipeline.py` | Collect every finding; filter severity only later |
78
- | `scripts/test_finding_pipeline.py` | Collection and filter-stage behavioral tests |
79
- | `scripts/e_code_review_scripts_constants/finding_pipeline_constants.py` | Named constants for the collect-then-filter pipeline |
80
- | `scripts/effort_evaluation.py` | Effort rows, recommendation, skill default resolver |
81
- | `scripts/effort_defaults_evidence.json` | Committed evaluation rows + e-code-review skill defaults |
82
- | `scripts/grok_code_review.py` | Grok medium-review discovery and verification |
83
- | `scripts/test_grok_code_review.py` | Behavioral tests for the Grok medium-review module |
84
- | `scripts/e_code_review_scripts_constants/` | Skill-local constants (unique package name; avoids bare `config` import shadow) |
85
-
86
- ## Folder map
87
-
88
- - `SKILL.md`: route and dispatch.
89
- - `reference/`: level procedures, fix/loop, effort evaluation, runner selection.
90
- - `scripts/`: collect-then-filter finding pipeline, effort evaluation, Grok medium-review module, tests, and `e_code_review_scripts_constants/`.
41
+ 1. Read the level and the optional `--fix` flag. Load the level file.
42
+ 2. Run it end to end, ending in its ReportFindings call.
43
+ 3. With `--fix`, load `reference/fix.md` and run it on those findings.
@@ -1,80 +1,9 @@
1
- # Fix Behavior (--fix)
1
+ # --fix
2
2
 
3
- When `--fix` is passed, apply the reviewed findings to the working tree.
3
+ Runs after any level's review, once its findings are reported.
4
4
 
5
- ## Preflight-proposal mode
6
-
7
- When the hub selects `preflight-proposal`, consume the established proposal context, selected review level, and current pull-request head.
8
-
9
- ## Resume the finding agent
10
-
11
- For each finding, resume the same Agent-tool agent instance that originally
12
- surfaced it. That agent applies all relevant fixes, which you provide guidance
13
- on in your resume prompt.
14
-
15
- At `low`, and any time the Agent tool is unavailable, no finder agent exists
16
- to resume. Apply the fixes yourself, sequentially, in this context, holding to
17
- every rule below.
18
-
19
- ## Code-rules gate
20
-
21
- Before returning, the resumed agent runs the code-rules gate with the same bare
22
- call every other surface in this skill uses:
23
-
24
- 1. Run `python ~/.claude/_shared/pr-loop/scripts/code_rules_gate.py --repo-root
25
- <repo root>` with no file paths and no `--only-under` prefix. The `python`
26
- prefix is required. On Windows a bare `.py` path opens the file in Cursor,
27
- which then crashes on the gate flags.
28
- 2. If the gate reports violations **on lines this fix already owns** (the files
29
- and added lines the fix changed), fix them and re-run the exact same command.
30
- 3. A violation on a path or added line outside this fix's own work is reported
31
- or skipped. It is not force-fixed into unrelated files. Log each skip with
32
- the path and reason, then continue.
33
- 4. Repeat until every violation on this fix's own work is clean (or skipped with
34
- a logged reason for out-of-scope hits).
35
- 5. Only after that result does the agent return control and report its outcome.
36
-
37
- A file path named on the command line puts the gate in whole-file scope and can
38
- churn on untouched lines; keep the call bare.
39
-
40
- This gate commits nothing. The fix lands in the working tree and stays
41
- uncommitted. **Commit ownership is lead-only:** a fix agent, patch worker, or
42
- resumed finding agent never runs `git commit` or `git push`. The lead that owns
43
- the branch creates the commit after gates pass. The bare code-rules call covers
44
- the merge-base surface and staged added lines only. Working-tree-only lines
45
- enter that scope after the lead stages or commits them.
46
-
47
- Under a bare `--fix` (this document invoked without `loop`), nothing
48
- downstream commits either. A one-shot fix pass leaves its fixes uncommitted in
49
- the working tree for the lead to review and commit (stage first if you re-run
50
- the gate on those lines). Under `loop`, the round tail in `reference\loop.md`
51
- stages and runs required checks; the lead still owns the commit and push.
52
-
53
- ## Skip candidates
54
-
55
- Skip a finding when fixing it would change intended behavior, require changes
56
- well outside the reviewed diff, or the finding itself is judged a false
57
- positive.
58
-
59
- Every logged skip surfaces exactly once, batched together, in a single
60
- list presented to the user at the end of the fix pass, after every other
61
- finding has been fixed, marked not-needed, or skipped, and never before.
62
-
63
- ## Reporting outcomes
64
-
65
- After fixes land, report the same findings list again through the structured
66
- findings-report call, the call that renders this review's results as a typed
67
- list in the host UI, with each finding now carrying an `outcome`:
68
- `fixed`, `no_change_needed` (the finding was wrong or already handled), or
69
- `skipped` (the finding stands but no fix was applied). Do not repeat the findings as text in the
70
- response body; the structured call is the record the host UI reads, and the
71
- batched skip list from above goes in the prose that follows it.
72
-
73
- ## If findings are fixed later
74
-
75
- Whenever a reported finding is fixed later in the session, because the user
76
- asks for the fix or later work fixes it incidentally, call the structured
77
- findings-report call again with the same findings, each carrying an
78
- `outcome` (`fixed`, `no_change_needed`, or `skipped`). Do not repeat the
79
- findings as text. Make that call immediately after the fixes land, before any
80
- prose summary.
5
+ 1. Take the findings the review just reported, most severe first.
6
+ 2. Apply each one to the working tree. Keep each edit to the finding's own lines.
7
+ 3. Make no commit and no push. The edits stay uncommitted for the user.
8
+ 4. When a finding cannot be fixed, or the fix would change behavior the finding did not name, leave the code and mark it `skipped`.
9
+ 5. Report the same findings again, each with an `outcome`: `fixed`, `no_change_needed` (the finding was wrong or already handled), or `skipped`.
@@ -0,0 +1,129 @@
1
+ `high effort → 8 inline angles → dedup (no verify) → ≤10 findings`
2
+
3
+ You are reviewing for **recall** at high effort: catch every bug a careful
4
+ reviewer would catch in one sitting. At this level, surface a finding even when
5
+ it may be a false positive. Err on the side of surfacing.
6
+
7
+ ## Phase 0 — Gather the diff
8
+
9
+ Run `git diff @{upstream}...HEAD` (or `git diff main...HEAD` / `git diff HEAD~1`
10
+ if there's no upstream) to get the unified diff under review. If there are
11
+ uncommitted changes, or the range diff is empty, also run `git diff HEAD` and
12
+ include the working-tree changes in scope — the review often runs before the
13
+ commit. If a PR number, branch name, or file path was passed as an argument,
14
+ review that target instead. Treat this diff as the review scope.
15
+
16
+ ## Phase 1 — Find candidates (3 correctness angles + 3 cleanup angles + 1 altitude angle + 1 conventions angle, up to 6 each)
17
+
18
+ Run **8 independent finder angles** in sequence yourself, in THIS context — do NOT spawn subagents for them. Each
19
+ surfaces **up to 6 candidate findings** with `file`, `line`, a one-line
20
+ `summary`, and a concrete `failure_scenario`.
21
+
22
+ ### Angle A — line-by-line diff scan
23
+
24
+ Read every hunk in the diff, line by line. Then Read the enclosing function for
25
+ each hunk — bugs in unchanged lines of a touched function are in scope (the PR
26
+ re-exposes or fails to fix them). For every line ask: what input, state, timing,
27
+ or platform makes this line wrong? Look for inverted/wrong conditions,
28
+ off-by-one, null/undefined deref, missing `await`, falsy-zero checks,
29
+ wrong-variable copy-paste, error swallowed in catch, unescaped regex metachars.
30
+
31
+ ### Angle B — removed-behavior auditor
32
+
33
+ For every line the diff DELETES or rewrites, name the invariant or behavior it
34
+ enforced, then search the new code for where that invariant is re-established.
35
+ If you can't find it, that's a candidate: a removed guard, a dropped error
36
+ path, a narrowed validation, a deleted test that was covering a live case.
37
+
38
+ ### Angle C — cross-file tracer
39
+
40
+ For each function the diff changes, find its callers (Grep for the symbol) and
41
+ check whether the change breaks any call site: a new precondition, a changed
42
+ return shape, a new exception, a timing/ordering dependency. Also check callees:
43
+ does a parallel change in the same PR make a call unsafe?
44
+
45
+ ### Reuse
46
+
47
+ The angles above hunt for bugs; this one and the next two hunt for cleanup in
48
+ the changed code. Flag new code that re-implements something the codebase
49
+ already has — Grep shared/utility modules and files adjacent to the change,
50
+ and name the existing helper to call instead.
51
+
52
+ ### Simplification
53
+
54
+ Flag unnecessary complexity the diff adds: redundant or derivable state,
55
+ copy-paste with slight variation, deep nesting, dead code left behind. Name
56
+ the simpler form that does the same job.
57
+
58
+ ### Efficiency
59
+
60
+ Flag wasted work the diff introduces: redundant computation or repeated I/O,
61
+ independent operations run sequentially, blocking work added to startup or
62
+ hot paths. Also flag long-lived objects built from closures or captured
63
+ environments — they keep the entire enclosing scope alive for the object's
64
+ lifetime (a memory leak when that scope holds large values); prefer a
65
+ class/struct that copies only the fields it needs. Name the cheaper
66
+ alternative.
67
+
68
+ ### Altitude
69
+
70
+ Check that each change fixes the root cause at the right depth. A fix that
71
+ patches a symptom with a fragile bandaid is a finding. Special cases layered on shared
72
+ infrastructure are a sign the fix isn't deep enough — prefer the simpler, more
73
+ general change to the underlying mechanism over adding special cases, and name
74
+ that change.
75
+
76
+ ### Conventions (CLAUDE.md)
77
+
78
+ Find the CLAUDE.md files that govern the changed code: the user-level
79
+ ~/.claude/CLAUDE.md, the repo-root CLAUDE.md, plus any CLAUDE.md or
80
+ CLAUDE.local.md in a directory that is an ancestor of a changed file (a
81
+ directory's CLAUDE.md only applies to files at or below it). Read each one
82
+ that exists, then check the diff for clear violations of the rules they state.
83
+
84
+ Only flag a violation when you can quote the exact rule and the exact line
85
+ that breaks it — no style preferences, no vague "spirit of the doc"
86
+ inferences. In the finding, name the CLAUDE.md path and quote the rule so the
87
+ report can cite it. If no CLAUDE.md applies, return nothing for this angle.
88
+
89
+ Cleanup, altitude, and conventions candidates use the same
90
+ `file`/`line`/`summary` shape; in `failure_scenario`, state the concrete
91
+ cost (what is duplicated, wasted, harder to maintain, or which CLAUDE.md rule
92
+ is broken) in the place a crash would go. Correctness bugs always outrank cleanup,
93
+ altitude, and conventions findings when the output cap forces a cut.
94
+
95
+ Pass every candidate with a nameable failure scenario through — finders that
96
+ silently drop half-believed candidates are the dominant cause of misses.
97
+
98
+ ## Phase 2 — Dedup only (no verify)
99
+
100
+ Pool all candidates. Dedup near-duplicates only (same defect, same location, same reason → keep one). Do NOT run verifiers; do NOT re-judge. Sort by severity.
101
+
102
+ ## Output
103
+
104
+ Target **at least 5 findings**. If fewer findings exist, emit what you have — do not invent to hit the floor.
105
+
106
+ Call the ReportFindings tool once to report this review's results
107
+ with `{level, findings}`. `findings` is at most 10 entries ranked
108
+ most-severe first; each entry has `file`, `line`, `summary`,
109
+ `short_summary` — the claim compressed to ≤60 characters, no rationale
110
+ or consequence clause — `failure_scenario`, and `category` — a short kebab-case slug for the angle
111
+ that produced it (`correctness`, `simplification`, `efficiency`,
112
+ `reuse`, `altitude`, `conventions`, or a more specific slug like
113
+ `test-coverage` when one fits better) — plus `verdict` when a verify pass
114
+ produced one. If more than 10 survive, keep the 10 most severe. If
115
+ nothing survives, call it with an empty array. Do not also print
116
+ the findings as text, and do not create or publish an artifact of the review -
117
+ the tool call is the report.
118
+
119
+
120
+ ## If findings are fixed later
121
+
122
+ Whenever reported findings get fixed later in this session - the user asks you
123
+ to fix them, or later work fixes them incidentally - you MUST call ReportFindings again with the same findings, each
124
+ carrying an `outcome`: `fixed`, `no_change_needed` (the finding was wrong or
125
+ already handled), or `skipped` (valid but not applied). Do not repeat the
126
+ findings as text.
127
+ Make that call immediately after the fixes land, before any prose summary; the
128
+ host UI's per-finding status updates only from it, and without it the findings
129
+ stay marked unresolved.
@@ -1,20 +1,13 @@
1
- `low effort → 1 diff pass per target item → no verify → ≥min(files,4) findings`
1
+ `low effort → 1 diff pass → no verify → ≤4 findings`
2
2
 
3
3
  ## Turn 1 — read
4
4
 
5
- Read the unified diff (`git diff @{upstream}...HEAD; git diff HEAD`
5
+ One tool call: read the unified diff (`git diff @{upstream}...HEAD; git diff HEAD`
6
6
  to cover both committed and uncommitted changes, or `git diff main...HEAD` /
7
- the target passed as an argument). A target names one or more items, each a PR
8
- number, a branch name, a file path, or `default-range` — the default `git diff`
9
- read named above, which is what this step reads when no target is passed — and
10
- it may mix those forms. A loop round widens a target by adding a path to whatever it
11
- started as, and it names `default-range` as an item whenever the round it
12
- widened was given no target argument, so the original scope stays under review.
13
- When a target names more than one item, read each item's diff and review their
14
- union — a shared hunk counted once, an empty one adding nothing. Skip
15
- test/fixture hunks (`test/`, `spec/`, `__tests__/`, `*_test.*`, `*.test.*`,
7
+ the target passed as an argument). Skip test/fixture
8
+ hunks (`test/`, `spec/`, `__tests__/`, `*_test.*`, `*.test.*`,
16
9
  `fixtures/`, `testdata/`) — test-file changes are not reviewed at this level.
17
- One read pass per target item, and no more: no subagents, no full-file reads.
10
+ No subagents, no full-file reads.
18
11
 
19
12
  ## Turn 2 — findings
20
13
 
@@ -28,48 +21,24 @@ helper visible in the diff context, and dead code the diff leaves behind.
28
21
  Do **not** flag style, naming, perf, missing tests, or anything outside the
29
22
  hunk.
30
23
 
31
- Target **min(files_changed, 4) findings**, most-severe first, reported in one
32
- call to the structured findings-report call — the mechanism that renders
33
- findings as a typed list in the host UI — with `{level, findings}`; each
34
- entry has `file`, `line`, `summary`, `short_summary` (≤60 characters), and
35
- `failure_scenario`. If you have fewer, do one more pass focused on the largest
36
- changed file and on any **removed** code blocks. Make that call with an empty
37
- findings array only if the diff is trivially correct after that pass. Do not
38
- also print the findings as text.
24
+ Report at most **4 findings**, most-severe first, in one
25
+ ReportFindings call with `{level, findings}` — each entry has
26
+ `file`, `line`, `summary`, `short_summary` (≤60 characters), and
27
+ `failure_scenario`. If nothing qualifies, call it with an empty findings
28
+ array. Do not also print the findings as text.
39
29
 
40
- ## Applying fixes (--fix)
41
-
42
- The `--fix` flag was passed. Follow `reference\fix.md` (relative
43
- to this skill's folder) for the exact fix, code-rules-gate, and skip-handling
44
- behavior — it governs which agent applies each fix, how the code-rules gate
45
- runs, how a skip is logged, and how outcomes get reported. Do not repeat the
46
- findings as text; follow that document's reporting rules once fixes land.
47
-
48
- When `loop` is also set, skip this section.
49
30
 
50
31
  ## If findings are fixed later
51
32
 
52
- Whenever a reported finding is fixed later in this session — the user asks you
53
- to fix it, or later work fixes it incidentally — follow `reference\fix.md`'s
54
- reporting rules again: report the same findings through the structured
55
- findings-report call, each carrying an `outcome`. Do not repeat the findings
56
- as text. Make that call immediately after the fixes land, before any prose
57
- summary; the host UI's per-finding status updates only from that call.
58
-
59
- ## Looping (`loop`)
60
-
61
- The `loop` arg was passed. Follow `reference\loop.md` (relative to this
62
- skill's folder) for how to re-run Turn 1 (read) and Turn 2 (findings)
63
- repeatedly — including its exit condition and re-invocation rules. Schedule no
64
- fix pass of your own here: when `--fix` is also present, `reference\loop.md`'s
65
- gate sequence owns the round's fixing and loads `reference\fix.md` for the
66
- mechanics. Do not treat a single pass through this document as complete while
67
- `loop` is active; hand control to that document, and do not stop at Turn 2.
33
+ Whenever reported findings get fixed later in this session - the user asks you
34
+ to fix them, or later work fixes them incidentally - you MUST call ReportFindings again with the same findings, each
35
+ carrying an `outcome`: `fixed`, `no_change_needed` (the finding was wrong or
36
+ already handled), or `skipped` (valid but not applied). Do not repeat the
37
+ findings as text.
38
+ Make that call immediately after the fixes land, before any prose summary; the
39
+ host UI's per-finding status updates only from it, and without it the findings
40
+ stay marked unresolved.
68
41
 
69
- That hand-off applies when this document is entered directly. When a loop round
70
- is already running and has handed this document its target, the round owns the
71
- loop: end at Turn 2 with the findings report and return those findings to
72
- `reference\loop.md`'s gate sequence, rather than handing control to that
73
- document again from here.
74
42
 
75
- When `loop` was not passed, skip this section.
43
+ After you finish the review, end your response with this exact line on its own:
44
+ Tip: For a deeper cloud-based review, try /ultrareview next time.
@@ -0,0 +1,169 @@
1
+ `max effort → 5+5 angles × 8 candidates → 1-vote verify → sweep → ≤15 findings`
2
+
3
+ You are reviewing for **recall** at maximum effort: catch every bug. At
4
+ this level, surface a finding even when it may be a false positive. A
5
+ missed bug ships. Err on the side of surfacing.
6
+
7
+ ## Phase 0 — Gather the diff
8
+
9
+ Run `git diff @{upstream}...HEAD` (or `git diff main...HEAD` / `git diff HEAD~1`
10
+ if there's no upstream) to get the unified diff under review. If there are
11
+ uncommitted changes, or the range diff is empty, also run `git diff HEAD` and
12
+ include the working-tree changes in scope — the review often runs before the
13
+ commit. If a PR number, branch name, or file path was passed as an argument,
14
+ review that target instead. Treat this diff as the review scope.
15
+
16
+ ## Phase 1 — Find candidates (5 correctness angles + 3 cleanup angles + 1 altitude angle + 1 conventions angle, up to 8 each)
17
+
18
+ Run **10 independent finder angles** via the Agent tool. Each
19
+ surfaces **up to 8 candidate findings**. Do NOT let one angle's conclusions
20
+ suppress another's — if two angles flag the same line for different reasons,
21
+ record both. If the Agent tool is not available in your current tool set, do not error — perform each angle (and each verification) yourself, sequentially, in this context.
22
+
23
+ ### Angle A — line-by-line diff scan
24
+
25
+ Read every hunk in the diff, line by line. Then Read the enclosing function for
26
+ each hunk — bugs in unchanged lines of a touched function are in scope (the PR
27
+ re-exposes or fails to fix them). For every line ask: what input, state, timing,
28
+ or platform makes this line wrong? Look for inverted/wrong conditions,
29
+ off-by-one, null/undefined deref, missing `await`, falsy-zero checks,
30
+ wrong-variable copy-paste, error swallowed in catch, unescaped regex metachars.
31
+
32
+ ### Angle B — removed-behavior auditor
33
+
34
+ For every line the diff DELETES or rewrites, name the invariant or behavior it
35
+ enforced, then search the new code for where that invariant is re-established.
36
+ If you can't find it, that's a candidate: a removed guard, a dropped error
37
+ path, a narrowed validation, a deleted test that was covering a live case.
38
+
39
+ ### Angle C — cross-file tracer
40
+
41
+ For each function the diff changes, find its callers (Grep for the symbol) and
42
+ check whether the change breaks any call site: a new precondition, a changed
43
+ return shape, a new exception, a timing/ordering dependency. Also check callees:
44
+ does a parallel change in the same PR make a call unsafe?
45
+
46
+ ### Angle D — language-pitfall specialist
47
+
48
+ Scan for the classic pitfalls of the diff's language/framework — for example:
49
+ JS falsy-zero, `==` coercion, closure-captured loop var; Python mutable default
50
+ args, late-binding closures; Go nil-map write, range-var capture; SQL injection;
51
+ timezone/DST drift; float equality. Flag any instance the diff introduces.
52
+
53
+ ### Angle E — wrapper/proxy correctness
54
+
55
+ When the PR adds or modifies a type that wraps another (cache, proxy, decorator,
56
+ adapter): check that every method routes to the wrapped instance and not back
57
+ through a registry/session/global — e.g. a caching provider holding a
58
+ `delegate` field that resolves IDs via `session.get(...)` where it should call
59
+ `delegate.get(...)` will re-enter the cache or recurse. Also check that the
60
+ wrapper forwards all the methods the callers use.
61
+
62
+ ### Reuse
63
+
64
+ The angles above hunt for bugs; this one and the next two hunt for cleanup in
65
+ the changed code. Flag new code that re-implements something the codebase
66
+ already has — Grep shared/utility modules and files adjacent to the change,
67
+ and name the existing helper to call instead.
68
+
69
+ ### Simplification
70
+
71
+ Flag unnecessary complexity the diff adds: redundant or derivable state,
72
+ copy-paste with slight variation, deep nesting, dead code left behind. Name
73
+ the simpler form that does the same job.
74
+
75
+ ### Efficiency
76
+
77
+ Flag wasted work the diff introduces: redundant computation or repeated I/O,
78
+ independent operations run sequentially, blocking work added to startup or
79
+ hot paths. Also flag long-lived objects built from closures or captured
80
+ environments — they keep the entire enclosing scope alive for the object's
81
+ lifetime (a memory leak when that scope holds large values); prefer a
82
+ class/struct that copies only the fields it needs. Name the cheaper
83
+ alternative.
84
+
85
+ ### Altitude
86
+
87
+ Check that each change fixes the root cause at the right depth. A fix that
88
+ patches a symptom with a fragile bandaid is a finding. Special cases layered on shared
89
+ infrastructure are a sign the fix isn't deep enough — prefer the simpler, more
90
+ general change to the underlying mechanism over adding special cases, and name
91
+ that change.
92
+
93
+ ### Conventions (CLAUDE.md)
94
+
95
+ Find the CLAUDE.md files that govern the changed code: the user-level
96
+ ~/.claude/CLAUDE.md, the repo-root CLAUDE.md, plus any CLAUDE.md or
97
+ CLAUDE.local.md in a directory that is an ancestor of a changed file (a
98
+ directory's CLAUDE.md only applies to files at or below it). Read each one
99
+ that exists, then check the diff for clear violations of the rules they state.
100
+
101
+ Only flag a violation when you can quote the exact rule and the exact line
102
+ that breaks it — no style preferences, no vague "spirit of the doc"
103
+ inferences. In the finding, name the CLAUDE.md path and quote the rule so the
104
+ report can cite it. If no CLAUDE.md applies, return nothing for this angle.
105
+
106
+ Cleanup, altitude, and conventions candidates use the same
107
+ `file`/`line`/`summary` shape; in `failure_scenario`, state the concrete
108
+ cost (what is duplicated, wasted, harder to maintain, or which CLAUDE.md rule
109
+ is broken) in the place a crash would go. Correctness bugs always outrank cleanup,
110
+ altitude, and conventions findings when the output cap forces a cut.
111
+
112
+ ## Phase 2 — Verify (1-vote, 3-state)
113
+
114
+ Dedup candidates that point at the same line/mechanism, keeping the one with
115
+ the most concrete failure scenario. For each remaining candidate, run **one
116
+ verifier** via the Agent tool: give it the diff, the relevant
117
+ file(s), and the candidate, and have it return exactly one of:
118
+
119
+ - **CONFIRMED** — can name the inputs/state that trigger it and the wrong
120
+ output or crash. Quote the line.
121
+ - **PLAUSIBLE** — mechanism is present, trigger is uncertain (timing, env,
122
+ config). State what would confirm it.
123
+ - **REFUTED** — factually wrong (code doesn't say that) or guarded elsewhere.
124
+ Quote the line that proves it.
125
+
126
+ Keep candidates where the vote is CONFIRMED or PLAUSIBLE.
127
+
128
+ This is recall mode — a single non-REFUTED vote carries the finding. Do NOT
129
+ drop on uncertainty.
130
+
131
+ ## Phase 3 — Sweep for gaps
132
+
133
+ Run **one more finder** as a fresh reviewer who has the verified list. Re-read
134
+ the diff and enclosing functions looking ONLY for defects not already listed.
135
+ Do not re-derive or re-confirm anything already there — the job is gaps. Focus
136
+ on what the first pass tends to miss: moved/extracted code that dropped a guard
137
+ or anchor; second-tier footguns (dataclass default evaluated once, `hash()`
138
+ non-determinism, lock-scope shrink, predicate methods with side effects);
139
+ setup/teardown asymmetry in tests; config defaults flipped.
140
+
141
+ Surface **up to 8 additional candidates**, each naming a defect not already on
142
+ the list. If nothing new, return an empty sweep — do not pad.
143
+
144
+ ## Output
145
+
146
+ Call the ReportFindings tool once to report this review's results
147
+ with `{level, findings}`. `findings` is at most 15 entries ranked
148
+ most-severe first; each entry has `file`, `line`, `summary`,
149
+ `short_summary` — the claim compressed to ≤60 characters, no rationale
150
+ or consequence clause — `failure_scenario`, and `category` — a short kebab-case slug for the angle
151
+ that produced it (`correctness`, `simplification`, `efficiency`,
152
+ `reuse`, `altitude`, `conventions`, or a more specific slug like
153
+ `test-coverage` when one fits better) — plus `verdict` when a verify pass
154
+ produced one. If more than 15 survive, keep the 15 most severe. If
155
+ nothing survives verification, call it with an empty array. Do not also print
156
+ the findings as text, and do not create or publish an artifact of the review -
157
+ the tool call is the report.
158
+
159
+
160
+ ## If findings are fixed later
161
+
162
+ Whenever reported findings get fixed later in this session - the user asks you
163
+ to fix them, or later work fixes them incidentally - you MUST call ReportFindings again with the same findings, each
164
+ carrying an `outcome`: `fixed`, `no_change_needed` (the finding was wrong or
165
+ already handled), or `skipped` (valid but not applied). Do not repeat the
166
+ findings as text.
167
+ Make that call immediately after the fixes land, before any prose summary; the
168
+ host UI's per-finding status updates only from it, and without it the findings
169
+ stay marked unresolved.