claude-dev-env 2.7.1 → 2.9.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 (127) hide show
  1. package/CLAUDE.md +7 -1
  2. package/_shared/CLAUDE.md +1 -0
  3. package/_shared/advisor/advisor-protocol.md +19 -9
  4. package/_shared/pr-loop/audit-contract.md +4 -4
  5. package/_shared/pr-loop/precatch-rubric.md +2 -2
  6. package/_shared/process-tree/CLAUDE.md +41 -0
  7. package/_shared/process-tree/scripts/config/process_tree_scripts_constants/__init__.py +1 -0
  8. package/_shared/process-tree/scripts/config/process_tree_scripts_constants/process_tree_kill_constants.py +27 -0
  9. package/_shared/process-tree/scripts/process_tree_kill.py +141 -0
  10. package/_shared/process-tree/scripts/pyproject.toml +16 -0
  11. package/_shared/process-tree/scripts/test_process_tree_kill.py +278 -0
  12. package/agents/clean-coder.md +9 -19
  13. package/agents/code-quality-agent.md +6 -5
  14. package/agents/deep-research.md +7 -24
  15. package/agents/docs-agent.md +1 -27
  16. package/agents/issue-tracker.md +1 -7
  17. package/agents/skill-writer-agent.md +1 -2
  18. package/agents/test_agent_frontmatter.py +335 -12
  19. package/docs/CODE_RULES.md +4 -2
  20. package/docs/references/CLAUDE.md +2 -2
  21. package/docs/references/advisor-tool.md +44 -6
  22. package/docs/references/team-advisor-skill.md +14 -8
  23. package/hooks/blocking/CLAUDE.md +2 -0
  24. package/hooks/blocking/fable_spawn_gate.py +187 -0
  25. package/hooks/blocking/piped_pytest_blocker.py +1223 -0
  26. package/hooks/blocking/plain_language_blocker.py +287 -15
  27. package/hooks/blocking/test_fable_spawn_gate.py +374 -0
  28. package/hooks/blocking/test_piped_pytest_blocker.py +587 -0
  29. package/hooks/blocking/test_plain_language_blocker.py +277 -2
  30. package/hooks/blocking/test_pre_tool_use_dispatcher.py +34 -2
  31. package/hooks/git-hooks/CLAUDE.md +2 -2
  32. package/hooks/git-hooks/git_hooks_constants/__init__.py +28 -0
  33. package/hooks/git-hooks/pre_push.py +343 -54
  34. package/hooks/git-hooks/test_pre_push.py +852 -6
  35. package/hooks/hooks.json +9 -19
  36. package/hooks/hooks_constants/CLAUDE.md +2 -0
  37. package/hooks/hooks_constants/bash_pre_tool_use_dispatcher_constants.py +1 -0
  38. package/hooks/hooks_constants/code_rules_path_utils_constants.py +1 -0
  39. package/hooks/hooks_constants/fable_spawn_gate_constants.py +62 -0
  40. package/hooks/hooks_constants/piped_pytest_blocker_constants.py +360 -0
  41. package/hooks/hooks_constants/plain_language_blocker_constants.py +64 -1
  42. package/hooks/hooks_constants/pre_tool_use_dispatcher_constants.py +10 -0
  43. package/hooks/hooks_constants/shell_command_segments.py +1 -1
  44. package/hooks/hooks_constants/test_bash_pre_tool_use_dispatcher_constants.py +1 -0
  45. package/hooks/hooks_constants/test_pre_tool_use_dispatcher_constants.py +27 -0
  46. package/hooks/hooks_constants/test_prose_metrics_parity.py +124 -0
  47. package/output-styles/CLAUDE.md +17 -0
  48. package/output-styles/caveman-agent.md +37 -0
  49. package/package.json +2 -1
  50. package/rules/CLAUDE.md +1 -0
  51. package/rules/ask-user-question-required.md +26 -0
  52. package/rules/claims-as-quotes.md +65 -0
  53. package/rules/code-standards.md +33 -7
  54. package/rules/eli11-replies.md +1 -1
  55. package/scripts/CLAUDE.md +3 -3
  56. package/scripts/_code_review_test_support.py +6 -0
  57. package/scripts/check.ps1 +18 -5
  58. package/scripts/claude_chain_runner.py +203 -31
  59. package/scripts/codec_forwarding_test_support.py +2 -0
  60. package/scripts/dev_env_scripts_constants/CLAUDE.md +4 -4
  61. package/scripts/dev_env_scripts_constants/claude_chain_constants.py +38 -0
  62. package/scripts/dev_env_scripts_constants/code_review_constants.py +403 -2
  63. package/scripts/dev_env_scripts_constants/grok_run_ledger_constants.py +50 -0
  64. package/scripts/dev_env_scripts_constants/grok_worker_constants.py +132 -24
  65. package/scripts/grok_headless_runner.py +16 -83
  66. package/scripts/grok_patch_artifacts.py +123 -0
  67. package/scripts/grok_run_ledger.py +318 -0
  68. package/scripts/spawn_grok_batch.py +591 -10
  69. package/scripts/test_claude_chain_runner.py +358 -0
  70. package/scripts/test_grok_headless_runner.py +18 -63
  71. package/scripts/test_grok_patch_artifacts.py +82 -0
  72. package/scripts/test_grok_run_ledger.py +116 -0
  73. package/scripts/test_invoke_code_review.py +298 -0
  74. package/scripts/test_resolve_worker_spawn.py +6 -0
  75. package/scripts/test_spawn_grok_batch.py +396 -0
  76. package/scripts/tests/CLAUDE.md +1 -0
  77. package/scripts/tests/test_grok_worker_constants.py +59 -0
  78. package/skills/CLAUDE.md +4 -2
  79. package/skills/_shared/CLAUDE.md +37 -4
  80. package/skills/_shared/advisor/CLAUDE.md +9 -0
  81. package/skills/_shared/advisor/advisor-protocol.md +5 -0
  82. package/skills/_shared/advisor/scripts/README.md +9 -0
  83. package/skills/_shared/end-of-run-gotcha-recommendations.md +156 -0
  84. package/skills/_shared/pr-loop/CLAUDE.md +18 -1
  85. package/skills/_shared/pr-loop/audit-contract.md +5 -0
  86. package/skills/_shared/pr-loop/audit-reply-template.md +5 -0
  87. package/skills/_shared/pr-loop/code-rules-gate.md +5 -0
  88. package/skills/_shared/pr-loop/fix-protocol.md +5 -0
  89. package/skills/_shared/pr-loop/gh-payloads.md +5 -0
  90. package/skills/_shared/pr-loop/post-audit-thread-contract.md +5 -0
  91. package/skills/_shared/pr-loop/precatch-rubric.md +5 -0
  92. package/skills/_shared/pr-loop/scripts/CLAUDE.md +8 -1
  93. package/skills/_shared/pr-loop/scripts/RUNTIME_SCRIPTS.md +29 -0
  94. package/skills/_shared/pr-loop/scripts/test_build_audit_prompt.py +46 -0
  95. package/skills/_shared/pr-loop/state-schema.md +5 -0
  96. package/skills/_shared/pr-loop/worker-spawn.md +5 -0
  97. package/skills/autoconverge/workflow/converge.contract.test.mjs +105 -2
  98. package/skills/autoconverge/workflow/converge.fix-recovery.test.mjs +34 -1
  99. package/skills/autoconverge/workflow/converge.mjs +66 -33
  100. package/skills/codex-review/scripts/codex_review_scripts_constants/codex_usage_probe_constants.py +0 -4
  101. package/skills/codex-review/scripts/codex_usage_probe.py +20 -33
  102. package/skills/codex-review/scripts/run_codex_review.py +16 -64
  103. package/skills/codex-review/scripts/test_codex_usage_probe.py +46 -41
  104. package/skills/codex-review/scripts/test_run_codex_review.py +1 -33
  105. package/skills/e-code-review/SKILL.md +15 -9
  106. package/skills/e-code-review/reference/fix.md +29 -7
  107. package/skills/e-code-review/reference/loop.md +230 -14
  108. package/skills/e-code-review/reference/low.md +33 -15
  109. package/skills/e-code-review/reference/medium.md +55 -21
  110. package/skills/e-code-review/reference/runner-selection.md +40 -0
  111. package/skills/e-code-review/reference/xhigh.md +30 -12
  112. package/skills/e-code-review/scripts/e_code_review_scripts_constants/__init__.py +1 -0
  113. package/skills/e-code-review/scripts/e_code_review_scripts_constants/grok_code_review_constants.py +55 -0
  114. package/skills/e-code-review/scripts/grok_code_review.py +221 -0
  115. package/skills/e-code-review/scripts/test_grok_code_review.py +212 -0
  116. package/skills/fresh-branch/CLAUDE.md +5 -5
  117. package/skills/fresh-branch/SKILL.md +14 -6
  118. package/skills/fresh-branch/scripts/create_fresh_branch.py +122 -39
  119. package/skills/fresh-branch/scripts/fresh_branch_scripts_constants/fresh_branch_cli_constants.py +10 -3
  120. package/skills/fresh-branch/scripts/test_create_fresh_branch.py +251 -0
  121. package/skills/grok-spawn/SKILL.md +10 -0
  122. package/skills/orchestrator/SKILL.md +9 -1
  123. package/skills/orchestrator-refresh/SKILL.md +5 -1
  124. package/skills/task-build/reference/tool-routing.md +3 -0
  125. package/skills/team-advisor/SKILL.md +23 -41
  126. package/system-prompts/software-engineer.xml +6 -3
  127. package/skills/test_markdown_link_integrity.py +0 -107
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Act
4
4
 
5
- `loop` on the hub command authorizes the full cycle. After the effort level procedure returns findings, take the matching branch below immediately.
5
+ `loop` on the hub command authorizes the full cycle. After the effort level procedure returns findings, run the gate sequence below immediately.
6
6
 
7
7
  Do not ask whether to fix, which nits to keep, whether to commit or push, or whether to re-review. Do not open a plan fork. Do not end the turn on a recommendation.
8
8
 
@@ -10,11 +10,18 @@ Report progress while you work. Stop for the user only on a terminal outcome bel
10
10
 
11
11
  ## Where fixes come from
12
12
 
13
- When `--fix` is also set, each round's fix pass runs `reference\fix.md`
14
- (relative to this skill's folder) it owns which agent applies each fix, the
15
- commit gate, skip logging, and outcome reporting. Apply the branch rules below
16
- on top of it: they decide whether a round fixes, commits, pushes, and
17
- re-reviews.
13
+ A round fixes whether or not `--fix` is set. Gate 2 below applies the round's
14
+ fixes on every run, and its three cases read the same way with the flag and
15
+ without it. What `--fix` adds is `fix.md`'s mechanics, not permission to fix:
16
+ the flag decides where the mechanics come from, never whether a round fixes at
17
+ all.
18
+
19
+ When `--fix` is also set, the round's fixing happens inside the gate sequence
20
+ below. Gate 2 is the only place a round applies a fix, and there is no separate
21
+ fix pass sitting around the round. Gate 2 loads `reference\fix.md` (relative to
22
+ this skill's folder) for the mechanics — which agent applies each fix, agent
23
+ resume, the code-rules gate, skip logging, and outcome reporting — while the
24
+ gate sequence decides whether a round fixes, commits, pushes, and re-reviews.
18
25
 
19
26
  ## Scope stays narrow
20
27
 
@@ -22,22 +29,231 @@ Auto-fix only verified findings on the review target. Leave deferred PR-body fol
22
29
 
23
30
  ## How to class each finding
24
31
 
25
- Use the finding's verified `severity` when the level emits one.
32
+ Every retained finding carries a verified `severity` and a verification
33
+ `verdict` (`CONFIRMED` or `PLAUSIBLE`). The frozen severity set is exactly
34
+ `blocker`, `high`, `medium`, `low`, `nit`.
35
+
36
+ A finding is a `nit` only when that severity is `nit`. Runtime-correctness,
37
+ security, data-loss, compatibility, and every other non-nit finding is a
38
+ `bug`.
26
39
 
27
- A finding is a `nit` only when that severity is `nit`. Runtime-correctness, security, data-loss, compatibility, and every other non-nit finding is a `bug`.
40
+ A finding that lacks severity is **unclassified**. Consult the assigned
41
+ advisor to classify it before Gate 2. When that advisor is unreachable,
42
+ terminate with `advisor_blocked` and preserve draft state.
28
43
 
29
- If the level emits no severity (for example untagged `low` lines), consult your advisor to determine classification.
44
+ A finding this document has already classed keeps that class at every level. An
45
+ on-target shape-reader break is `bug` under *A shape change names its readers*;
46
+ no advisor call reopens that.
30
47
 
31
48
  ## Required checks
32
49
 
33
- "Run required checks" means: run `~/.claude/_shared/pr-loop/scripts/code_rules_gate.py --repo-root <repo root> <changed/added files>` against every file changed or added in the round. On any violation, fix it and re-run the exact same command again — repeat until it reports clean.
50
+ "Run required checks" means: run
51
+ `~/.claude/_shared/pr-loop/scripts/code_rules_gate.py --repo-root <repo root>`
52
+ with no file paths and no `--only-under` prefix. On a violation on lines this
53
+ round already owns, fix it and re-run the exact same command until clean. A
54
+ violation outside the review target is reported or skipped — not force-fixed into
55
+ unrelated files — and the skip is logged with path and reason.
56
+
57
+ That bare call gates the git diff since the merge-base (and any staged added
58
+ lines the gate already includes). Working-tree lines that are neither staged
59
+ nor committed sit outside that scope until they are staged or committed. Gate 2
60
+ leaves its edits uncommitted, so the round tail stages those edits before
61
+ required checks when this round produced edits.
62
+
63
+ Two failure scenarios keep the call bare. A file path named on the command line
64
+ puts the gate in whole-file scope on that file: a CODE_RULES violation on a line
65
+ this round never touched fails the round and churns the loop. An `--only-under`
66
+ prefix that matches nothing in the diff leaves the gate zero files to inspect and
67
+ exits clean, so a run that inspected nothing reads as a pass.
68
+
69
+ ## Each round reviews new code
70
+
71
+ A repair diff is new code. From the second round on, the round runs the level
72
+ file end to end at the new head. End to end means that file's review phases, up
73
+ to and including its findings report; the round stops there and brings those
74
+ findings back to the gate sequence below. It does not run the level file's
75
+ *Looping* section — that section hands control to this document, and the round
76
+ is already inside it. The round's scope is the level's own review
77
+ target — the diff or path the level gathers up front, called Phase 0 in
78
+ `medium.md` and `xhigh.md` — taken against that target's base. A repair edit
79
+ landing outside that target widens the next round's scope to cover it: the next
80
+ round's review target is the original target **plus** that path, and the round
81
+ reviews both. A later widening adds to that target the same way.
82
+
83
+ The widened target is what the round hands the level file. When a round runs the
84
+ level file end to end, it passes the current review target — the original target
85
+ plus every path a widening has since added — as that run's target argument, in
86
+ place of the argument the first round was given. When the first round was given
87
+ no target argument, the original target is the item `default-range` — the level
88
+ file's own default gather — so the widened target is `default-range` plus every
89
+ added path, and the range the first round reviewed stays in scope. The level
90
+ file gathers what the round hands it, so a widened path is gathered and reviewed
91
+ like any other part of the target.
92
+
93
+ ## Dangerous diffs take two full rounds
94
+
95
+ A diff is dangerous when it touches deletion paths, locks or other concurrency
96
+ control, or shared mutable state. A deletion path is a runtime path that removes
97
+ data or files; a dead-code cleanup is not one. Each round names whether the diff
98
+ it reviewed is dangerous. A dangerous diff holds the loop open until two full
99
+ rounds have reviewed it. A repair that rewrites the dangerous surface restarts
100
+ the two-round count at the first round that reviews the rewritten surface.
101
+
102
+ The round's progress report is where both facts are recorded: the dangerous
103
+ classification, and the dangerous-round count written as `N of M`.
104
+
105
+ ## A shape change names its readers
106
+
107
+ When a repair changes a key, an identifier format, or a data shape, list every
108
+ reader of the shape it changed and state how each one reads the new shape. The
109
+ list goes in the round's progress report.
110
+
111
+ The round that follows a posted list checks each reader on that list against the
112
+ new shape and names each reader with its result in that round's progress report.
113
+
114
+ Discharge then turns on where the reader sits.
115
+
116
+ - An **off-target** reader discharges once it is named with a result. This
117
+ branch cannot repair it.
118
+ - An **on-target** reader that reads the new shape correctly discharges on that
119
+ result.
120
+ - An **on-target** reader that reads the new shape wrong is a bug-severity
121
+ finding of the round that checked it. It joins that round's findings, and it
122
+ discharges on exactly one of three results, each of them an outcome gate 2
123
+ already produces: it is repaired, it is recorded as a skipped finding, or the
124
+ advisor refutes it. Naming the break discharges nothing on its own, and
125
+ neither does a further round merely happening.
126
+
127
+ The list discharges once every reader on it has discharged.
128
+
129
+ A broken reader outside the review target does not block the loop and does not
130
+ widen scope. Hand it off as a reported finding. Two separate things are owed for
131
+ that hand-off, and they land at different times:
132
+
133
+ - **The round-scoped record** — what a round produces. Check the reader, record
134
+ its result, and name it in that round's progress report. All three are done
135
+ inside the round that checks the reader, and nothing outside that round is
136
+ needed to complete them. This is the record gate 2 reads.
137
+ - **The termination-time disclosure** — what terminating requires. The
138
+ ready-for-review message names every broken off-target reader and every
139
+ skipped finding that still exists, and the pull request body carries the same
140
+ names when the target is a pull request. A target with no pull request owes
141
+ the ready message alone. Gate 3 enforces this at the moment the loop
142
+ terminates; no earlier round owes it.
34
143
 
35
144
  ## Terminal outcomes
36
145
 
37
- Repeat the same-level review/fix cycle until one of these holds:
146
+ The loop emits exactly one of these terminals when it stops:
147
+
148
+ | Terminal | When |
149
+ |---|---|
150
+ | `clean` | Zero retained findings on the current head, and required checks pass |
151
+ | `nits_fixed` | Every retained finding is a nit with severity and a retained verdict, every nit is fixed, and required checks pass |
152
+ | `advisor_blocked` | Classification needs the assigned advisor and that advisor is unreachable |
153
+
154
+ Every round does this round's own work first, then runs the three gates below,
155
+ in order: gate 1, then gate 2, then gate 3.
156
+
157
+ **This round's work — before the gates.** Record this round's dangerous
158
+ classification and the dangerous-round count as `N of M`; and when a shape-change
159
+ list is open, check each reader on that list and name each reader with its
160
+ result, adding any on-target reader that reads the new shape wrong to this
161
+ round's findings as *A shape change names its readers* directs. Then run the
162
+ gates.
163
+
164
+ **Gate 1 — obligations.** Gate 1 is evaluated first in the sequence, and its
165
+ answer turns on the round's open obligations alone — the findings are in hand by
166
+ now, and no content they carry changes it. Ask only: does any obligation remain
167
+ open? Two kinds exist.
168
+
169
+ - A dangerous diff that has had fewer than two full rounds.
170
+ - A posted shape-change list that no round has discharged.
171
+
172
+ Gate 1 states its answer and stops there: an obligation remains open, or none
173
+ does. It states no re-entry, no continuation, and no routing. Gate 3 is the sole
174
+ router — every path out of a round passes through it.
175
+
176
+ **Gate 2 — findings.** When `--fix` is set, load `reference\fix.md` here and
177
+ follow it for the mechanics of every fix this gate applies — the fix agent,
178
+ agent resume, the code-rules gate, skip logging, and outcome reporting. When `--fix` is
179
+ absent, apply each fix in this session yourself, and log each skip in this
180
+ round's progress report. Then take the one case that matches the round's
181
+ findings.
182
+
183
+ - Any bug-severity finding: validate each bug with an advisor before touching
184
+ code — confirm it's real and confirm the intended fix — then fix every
185
+ validated bug and every nit on the review target. A refuted bug removes only
186
+ itself from the round's work; the nits are fixed either way.
187
+ - Nits only, with at least one nit present: fix all of them on the review
188
+ target.
189
+ - No findings at all: make no edits.
190
+
191
+ Gate 2 then ends by stating one of exactly two outcomes: unresolved findings
192
+ remain, or none remain. A refuted bug is resolved. A fixed nit is resolved. A
193
+ fixed validated bug is resolved. A handed-off off-target finding is resolved once
194
+ this round has made its round-scoped record as *A shape change names its readers*
195
+ defines that record — checked, result recorded, named in this round's progress
196
+ report — whether or not the problem behind it is solved. Gate 2 reads the record
197
+ and nothing else; the termination-time disclosure belongs to gate 3.
198
+
199
+ A skipped finding — a finding deliberately not applied, because fixing it would
200
+ change intended behavior, would reach beyond the review target, or the finding
201
+ itself is judged a false positive — is resolved once its skip is logged in this
202
+ round's progress report, naming the finding and the reason it was skipped. That
203
+ report is the sink every run has, with or without `--fix`. When `--fix` is set,
204
+ the skip handling `fix.md` carries runs inside this gate and adds to this log
205
+ rather than replacing it.
206
+
207
+ Gate 3 reads that stated outcome, never a case label.
208
+
209
+ **Gate 3 — exit test.** Resolve the terminal from the table above, then stop or
210
+ continue:
211
+
212
+ - zero retained findings and required checks pass → `clean`;
213
+ - nits only (each with severity and a retained verdict), all fixed, required checks pass → `nits_fixed`;
214
+ - advisor needed for classification and unreachable → `advisor_blocked`;
215
+ - otherwise continue.
216
+
217
+ Also require, for `clean` and `nits_fixed`:
218
+
219
+ - gate 1 shows no open obligation;
220
+ - gate 2 states no unresolved findings remain;
221
+ - this round produced no edits after the gates settled.
222
+
223
+ Any other combination runs the round tail and re-enters the loop.
224
+
225
+ Terminating with `clean` or `nits_fixed` carries one further condition — the
226
+ termination-time disclosure: the ready-for-review message names every broken
227
+ off-target reader and every skipped finding that still exists. When the target
228
+ is a pull request, the pull request body carries the same names; a target with
229
+ no pull request owes the ready message alone. Every surface this condition
230
+ names is written at termination — the ready message always, the pull request
231
+ body too when the target is a pull request — so each one is available to the
232
+ terminating round. A round that cannot name them does not terminate; it runs
233
+ the round tail and re-enters the loop, the same as any other non-terminating
234
+ round. With that condition met, post the proof-of-work PR comment when the
235
+ target is a PR, then run `gh pr ready` for a draft PR, or state ready
236
+ otherwise.
237
+
238
+ `advisor_blocked` keeps the pull request draft. It does
239
+ not run `gh pr ready`. It reports every surviving structured finding.
240
+
241
+ Gate 3 points at gate 1 for the obligation answer. It does not restate the
242
+ two-round rule or the shape-reader rule; each of those keeps its one home in its
243
+ own section above.
244
+
245
+ **The round tail.** Every round runs required checks here, in the one form
246
+ *Required checks* gives: the bare command, no file paths. When this round
247
+ produced edits, stage those edits first so they enter the bare gate's scope,
248
+ then run the checks. When this round produced no edits, run the same checks.
249
+ Should those checks produce repairs, this round has produced edits — stage
250
+ them and re-run the checks.
38
251
 
39
- - **Clean.** Findings are `[]` or `(none)`. Post the proof-of-work PR comment when the target is a PR. Run `gh pr ready` for a draft PR; otherwise state ready.
40
- - **Nits only.** Every surviving finding is severity `nit`. Fix all of them on the review target. Run required checks. Commit once per loop round. Push. Consider this clean — post the proof-of-work PR comment and mark ready as in the Clean branch above.
41
- - **Any bug.** Validate each bug-severity finding with an advisor before touching code — confirm it's real and confirm the intended fix. Then fix all validated findings (bugs and nits) on the review target. Run required checks. Commit once per loop round. Push. Run the same effort level on the new head. Repeat until clean, then mark ready as above.
252
+ **Commit and push are lead-owned.** Gate 2 and the round tail leave every fix
253
+ unstaged-or-staged in the working tree for the lead that owns the branch. A
254
+ fix agent, patch worker, or resumed finding agent never creates the commit and
255
+ never pushes. The lead stages, commits once per review round, and pushes after
256
+ the gates pass. Start the next round under *Each round reviews new code* only
257
+ after that lead commit lands a new head.
42
258
 
43
259
  Do not drop findings to force ready. Without `loop`, run one review at the selected level, fix, and return every validated finding.
@@ -1,13 +1,20 @@
1
- `low effort → 1 diff pass → no verify → ≥min(files,4) findings`
1
+ `low effort → 1 diff pass per target item → no verify → ≥min(files,4) findings`
2
2
 
3
3
  ## Turn 1 — read
4
4
 
5
- One tool call: read the unified diff (`git diff @{upstream}...HEAD; git diff HEAD`
5
+ 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). Skip test/fixture
8
- hunks (`test/`, `spec/`, `__tests__/`, `*_test.*`, `*.test.*`,
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.*`,
9
16
  `fixtures/`, `testdata/`) — test-file changes are not reviewed at this level.
10
- No subagents, no full-file reads.
17
+ One read pass per target item, and no more: no subagents, no full-file reads.
11
18
 
12
19
  ## Turn 2 — findings
13
20
 
@@ -32,11 +39,13 @@ also print the findings as text.
32
39
 
33
40
  ## Applying fixes (--fix)
34
41
 
35
- The `--fix` flag was passed. Follow `reference\fix.md` (relative to this
36
- skill's folder) for the exact fix, commit-gate, and skip-handling behavior —
37
- it governs which agent applies each fix, how a fix gets committed, how a skip
38
- is logged, and how outcomes get reported. Do not repeat the findings as text;
39
- follow that document's reporting rules once fixes land.
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.
40
49
 
41
50
  ## If findings are fixed later
42
51
 
@@ -50,8 +59,17 @@ summary; the host UI's per-finding status updates only from that call.
50
59
  ## Looping (`loop`)
51
60
 
52
61
  The `loop` arg was passed. Follow `reference\loop.md` (relative to this
53
- skill's folder) for how to re-run Turn 1 (read), Turn 2 (findings), and (if
54
- `--fix` is also present) `reference\fix.md`'s fix pass, repeatedly
55
- including its exit condition, iteration cap, and re-invocation rules. Do not
56
- treat a single pass through this document as complete while `loop` is active;
57
- hand control to that document instead of stopping at Turn 2.
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.
68
+
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
+
75
+ When `loop` was not passed, skip this section.
@@ -9,8 +9,15 @@ Run `git diff @{upstream}...HEAD` (or `git diff main...HEAD` / `git diff HEAD~1`
9
9
  if there's no upstream) to get the unified diff under review. If there are
10
10
  uncommitted changes, or the range diff is empty, also run `git diff HEAD` and
11
11
  include the working-tree changes in scope — the review often runs before the
12
- commit. If a PR number, branch name, or file path was passed as an argument,
13
- review that target instead. Treat this diff as the review scope.
12
+ commit. If a target was passed as an argument, review that target instead. A
13
+ target names one or more items, each a PR number, a branch name, a file path, or
14
+ `default-range` — the diff this phase gathers when no target is passed — and it
15
+ may mix those forms. A loop round widens a target by adding a path to whatever
16
+ it started as, and it names `default-range` as an item whenever the round it
17
+ widened was given no target argument, so the original scope stays under review.
18
+ When a target names more than one item, gather each item's diff and take their
19
+ union — a shared hunk counted once, an empty one adding nothing — as the
20
+ target's diff. Treat this diff as the review scope.
14
21
 
15
22
  ## Phase 1 — Find candidates (3 correctness angles + 3 cleanup angles + 1 altitude angle + 1 conventions angle)
16
23
 
@@ -116,23 +123,41 @@ Keep candidates where the vote is CONFIRMED or PLAUSIBLE.
116
123
 
117
124
  Report this review's results — `{level, findings}` — through the structured
118
125
  findings-report call: the mechanism that renders a review's results as a typed
119
- list in the host UI, ranked most-severe first. Each entry has `file`, `line`,
120
- `summary`, `short_summary` the claim compressed to ≤60 characters, no
121
- rationale or consequence clause — `failure_scenario`, and `category` — a short
122
- kebab-case slug for the angle that produced it (`correctness`,
123
- `simplification`, `efficiency`, `reuse`, `altitude`, `conventions`, or a more
124
- specific slug like `test-coverage` when one fits better) — plus `verdict` when
125
- a verify pass produced one. If nothing survives verification, make that call
126
- with an empty array. Do not also print the findings as text, and do not create
127
- or publish an artifact of the review — the structured call is the report.
126
+ list in the host UI, ranked most-severe first. Each **retained** entry carries
127
+ every field below. Drop REFUTED candidates before this report; do not emit a
128
+ finding that lacks `severity` or `verdict`.
129
+
130
+ | Field | Required | Value |
131
+ |---|---|---|
132
+ | `file` | yes | path under review |
133
+ | `line` | yes | 1-based line number |
134
+ | `summary` | yes | full claim |
135
+ | `short_summary` | yes | claim compressed to ≤60 characters, no rationale or consequence clause |
136
+ | `failure_scenario` | yes | concrete trigger and wrong outcome, or concrete cost for cleanup |
137
+ | `category` | yes | short kebab-case slug for the angle (`correctness`, `simplification`, `efficiency`, `reuse`, `altitude`, `conventions`, or a tighter slug like `test-coverage`) |
138
+ | `severity` | yes | one of `blocker`, `high`, `medium`, `low`, `nit` |
139
+ | `verdict` | yes | `CONFIRMED` or `PLAUSIBLE` from Phase 2 |
140
+
141
+ **Severity rules.** Assign exactly one token from the frozen set above. Use
142
+ `nit` only when all five hold: the change is localized clarity, formatting, or
143
+ a typo; correctness, security, data, and API behavior stay identical; test
144
+ coverage and operability stay identical; dependencies and rollout stay
145
+ identical; the fix is mechanical and bounded. Any other retained finding is
146
+ `low` or higher. Correctness bugs outrank cleanup, altitude, and conventions.
147
+
148
+ If nothing survives verification, make that call with an empty array. Do not
149
+ also print the findings as text, and do not create or publish an artifact of
150
+ the review — the structured call is the report.
128
151
 
129
152
  ## Applying fixes (--fix)
130
153
 
131
- The `--fix` flag was passed. Follow `reference\fix.md` (relative to this
132
- skill's folder) for the exact fix, commit-gate, and skip-handling behavior —
133
- it governs which agent applies each fix, how a fix gets committed, how a skip
134
- is logged, and how outcomes get reported. Do not repeat the findings as text;
135
- follow that document's reporting rules once fixes land.
154
+ The `--fix` flag was passed. Follow `reference\fix.md` (relative
155
+ to this skill's folder) for the exact fix, code-rules-gate, and skip-handling
156
+ behavior — it governs which agent applies each fix, how the code-rules gate
157
+ runs, how a skip is logged, and how outcomes get reported. Do not repeat the
158
+ findings as text; follow that document's reporting rules once fixes land.
159
+
160
+ When `loop` is also set, skip this section.
136
161
 
137
162
  ## If findings are fixed later
138
163
 
@@ -146,8 +171,17 @@ summary; the host UI's per-finding status updates only from that call.
146
171
  ## Looping (`loop`)
147
172
 
148
173
  The `loop` arg was passed. Follow `reference\loop.md` (relative to this
149
- skill's folder) for how to re-run Phases 0–2, Output, and (if `--fix` is also
150
- present) `reference\fix.md`'s fix pass, repeatedly including its exit
151
- condition, iteration cap, and re-invocation rules. Do not treat a single pass
152
- through this document as complete while `loop` is active; hand control to that
153
- document instead of stopping at Output.
174
+ skill's folder) for how to re-run Phases 0–2 and Output repeatedly including
175
+ its exit condition and re-invocation rules. Schedule no fix pass of your own
176
+ here: when `--fix` is also present, `reference\loop.md`'s gate sequence owns the
177
+ round's fixing and loads `reference\fix.md` for the mechanics. Do not treat a
178
+ single pass through this document as complete while `loop` is active; hand
179
+ control to that document, and do not stop at Output.
180
+
181
+ That hand-off applies when this document is entered directly. When a loop round
182
+ is already running and has handed this document its target, the round owns the
183
+ loop: end at Output with the findings report and return those findings to
184
+ `reference\loop.md`'s gate sequence, rather than handing control to that
185
+ document again from here.
186
+
187
+ When `loop` was not passed, skip this section.
@@ -0,0 +1,40 @@
1
+ # Runner selection (medium review)
2
+
3
+ How `/e-code-review medium` (and loop) should pick a **harness runner** for
4
+ finder/verify work. This file is the map; `SKILL.md` only points here.
5
+
6
+ ## What lives here
7
+
8
+ | Topic | Content |
9
+ |---|---|
10
+ | Goal | One skill surface; many possible runners (Grok, Codex, Claude headless, …) |
11
+ | Today | `scripts/grok_code_review.py` is the Grok medium orchestration module |
12
+ | Target | A thin selector chooses a runner by availability and task flags |
13
+ | Non-goals | Reimplementing every harness inside this skill |
14
+
15
+ ## Today
16
+
17
+ - Medium procedure: `reference/medium.md` (angles, verify, output fields).
18
+ - Grok orchestration API: `scripts/grok_code_review.py` (discovery, dedupe,
19
+ retain, head-drift).
20
+ - Constants: `scripts/e_code_review_scripts_constants/`.
21
+
22
+ ## Target shape (tracked separately)
23
+
24
+ 1. **Runner protocol** — shared inputs (diff base, head, angles) and outputs
25
+ (candidates, verdicts, severities).
26
+ 2. **Detection** — which runners are installed/configured (PATH, skills,
27
+ account chain).
28
+ 3. **Selection** — pick one runner without baking a single vendor into
29
+ `SKILL.md` process steps.
30
+ 4. **Adapters** — thin wrappers: Grok (current module), Codex, Claude, …
31
+
32
+ Open issue for implementation work should link this file and keep PRs small
33
+ (Google small-CL practice: one concern per PR).
34
+
35
+ ## Related always-on docs
36
+
37
+ - Skill hub: `../SKILL.md` (levels, fix, loop — not runner internals).
38
+ - Medium procedure: `medium.md`.
39
+ - Shared worker spawn (when applicable):
40
+ `packages/claude-dev-env/_shared/pr-loop/worker-spawn.md` in the package tree.
@@ -10,8 +10,15 @@ Run `git diff @{upstream}...HEAD` (or `git diff main...HEAD` / `git diff HEAD~1`
10
10
  if there's no upstream) to get the unified diff under review. If there are
11
11
  uncommitted changes, or the range diff is empty, also run `git diff HEAD` and
12
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.
13
+ commit. If a target was passed as an argument, review that target instead. A
14
+ target names one or more items, each a PR number, a branch name, a file path, or
15
+ `default-range` — the diff this phase gathers when no target is passed — and it
16
+ may mix those forms. A loop round widens a target by adding a path to whatever
17
+ it started as, and it names `default-range` as an item whenever the round it
18
+ widened was given no target argument, so the original scope stays under review.
19
+ When a target names more than one item, gather each item's diff and take their
20
+ union — a shared hunk counted once, an empty one adding nothing — as the
21
+ target's diff. Treat this diff as the review scope.
15
22
 
16
23
  ## Phase 1 — Find candidates (5 correctness angles + 3 cleanup angles + 1 altitude angle + 1 conventions angle)
17
24
 
@@ -157,11 +164,13 @@ or publish an artifact of the review — the structured call is the report.
157
164
 
158
165
  ## Applying fixes (--fix)
159
166
 
160
- The `--fix` flag was passed. Follow `reference\fix.md` (relative to this
161
- skill's folder) for the exact fix, commit-gate, and skip-handling behavior —
162
- it governs which agent applies each fix, how a fix gets committed, how a skip
163
- is logged, and how outcomes get reported. Do not repeat the findings as text;
164
- follow that document's reporting rules once fixes land.
167
+ The `--fix` flag was passed. Follow `reference\fix.md` (relative
168
+ to this skill's folder) for the exact fix, code-rules-gate, and skip-handling
169
+ behavior — it governs which agent applies each fix, how the code-rules gate
170
+ runs, how a skip is logged, and how outcomes get reported. Do not repeat the
171
+ findings as text; follow that document's reporting rules once fixes land.
172
+
173
+ When `loop` is also set, skip this section.
165
174
 
166
175
  ## If findings are fixed later
167
176
 
@@ -175,8 +184,17 @@ summary; the host UI's per-finding status updates only from that call.
175
184
  ## Looping (`loop`)
176
185
 
177
186
  The `loop` arg was passed. Follow `reference\loop.md` (relative to this
178
- skill's folder) for how to re-run Phases 0–3, Output, and (if `--fix` is also
179
- present) `reference\fix.md`'s fix pass, repeatedly including its exit
180
- condition, iteration cap, and re-invocation rules. Do not treat a single pass
181
- through this document as complete while `loop` is active; hand control to that
182
- document instead of stopping at Output.
187
+ skill's folder) for how to re-run Phases 0–3 and Output repeatedly including
188
+ its exit condition and re-invocation rules. Schedule no fix pass of your own
189
+ here: when `--fix` is also present, `reference\loop.md`'s gate sequence owns the
190
+ round's fixing and loads `reference\fix.md` for the mechanics. Do not treat a
191
+ single pass through this document as complete while `loop` is active; hand
192
+ control to that document, and do not stop at Output.
193
+
194
+ That hand-off applies when this document is entered directly. When a loop round
195
+ is already running and has handed this document its target, the round owns the
196
+ loop: end at Output with the findings report and return those findings to
197
+ `reference\loop.md`'s gate sequence, rather than handing control to that
198
+ document again from here.
199
+
200
+ When `loop` was not passed, skip this section.
@@ -0,0 +1 @@
1
+ """Constants package for e-code-review scripts."""
@@ -0,0 +1,55 @@
1
+ """Named constants for Grok medium-review discovery and verification."""
2
+
3
+ from __future__ import annotations
4
+
5
+ MEDIUM_REVIEW_SCHEMA_VERSION: str = "1.0.0"
6
+ """Schema version for medium-review run documents."""
7
+
8
+ MEDIUM_REVIEW_FINDER_COUNT: int = 8
9
+ """Exactly eight finder angles execute per medium review head."""
10
+
11
+ ALL_MEDIUM_FINDER_ANGLES: tuple[str, ...] = (
12
+ "correctness",
13
+ "security",
14
+ "code_rules",
15
+ "tests",
16
+ "docs",
17
+ "concurrency",
18
+ "api_contracts",
19
+ "regressions",
20
+ )
21
+ """Named finder angles for one medium-review discovery batch."""
22
+
23
+ VERDICT_CONFIRMED: str = "CONFIRMED"
24
+ """Verification retained a concrete failure scenario."""
25
+
26
+ VERDICT_PLAUSIBLE: str = "PLAUSIBLE"
27
+ """Verification could not refute the finding."""
28
+
29
+ VERDICT_REFUTED: str = "REFUTED"
30
+ """Verification rejected the finding."""
31
+
32
+ ALL_VERIFICATION_VERDICTS: frozenset[str] = frozenset(
33
+ {VERDICT_CONFIRMED, VERDICT_PLAUSIBLE, VERDICT_REFUTED}
34
+ )
35
+ """Legal verification verdict tokens."""
36
+
37
+ SEVERITY_BLOCKER: str = "blocker"
38
+ SEVERITY_HIGH: str = "high"
39
+ SEVERITY_MEDIUM: str = "medium"
40
+ SEVERITY_LOW: str = "low"
41
+ SEVERITY_NIT: str = "nit"
42
+
43
+ ALL_SEVERITIES: frozenset[str] = frozenset(
44
+ {
45
+ SEVERITY_BLOCKER,
46
+ SEVERITY_HIGH,
47
+ SEVERITY_MEDIUM,
48
+ SEVERITY_LOW,
49
+ SEVERITY_NIT,
50
+ }
51
+ )
52
+ """Legal severity tokens on retained findings."""
53
+
54
+ UTF8_ENCODING: str = "utf-8"
55
+ """Text encoding for review artifacts."""