claude-dev-env 1.92.0 → 1.93.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 (216) hide show
  1. package/CLAUDE.md +5 -39
  2. package/_shared/CLAUDE.md +2 -1
  3. package/_shared/advisor/CLAUDE.md +21 -0
  4. package/_shared/advisor/advisor-protocol.md +142 -0
  5. package/_shared/advisor/scripts/config/advisor_scripts_constants/__init__.py +1 -0
  6. package/_shared/advisor/scripts/config/advisor_scripts_constants/model_tier_run_validator_constants.py +86 -0
  7. package/_shared/advisor/scripts/model_tier_run_validator.py +246 -0
  8. package/_shared/advisor/scripts/pyproject.toml +3 -0
  9. package/_shared/advisor/scripts/tests/test_model_tier_run_validator.py +302 -0
  10. package/_shared/advisor/scripts/tests/test_tier_model_ids.py +180 -0
  11. package/_shared/advisor/scripts/tier_model_ids.py +164 -0
  12. package/_shared/pr-loop/CLAUDE.md +1 -0
  13. package/_shared/pr-loop/precatch-rubric.md +65 -0
  14. package/_shared/pr-loop/scripts/CLAUDE.md +1 -1
  15. package/_shared/pr-loop/scripts/code_rules_gate.py +137 -5
  16. package/_shared/pr-loop/scripts/post_audit_thread.py +1 -1
  17. package/_shared/pr-loop/scripts/pr_loop_shared_constants/CLAUDE.md +1 -1
  18. package/_shared/pr-loop/scripts/pr_loop_shared_constants/code_rules_gate_constants.py +16 -0
  19. package/_shared/pr-loop/scripts/pr_loop_shared_constants/reviews_disabled_constants.py +2 -1
  20. package/_shared/pr-loop/scripts/reviewer_availability.py +42 -12
  21. package/_shared/pr-loop/scripts/reviews_disabled.py +65 -21
  22. package/_shared/pr-loop/scripts/terminology_sweep.py +69 -21
  23. package/_shared/pr-loop/scripts/tests/CLAUDE.md +1 -1
  24. package/_shared/pr-loop/scripts/tests/fixtures/{copilot_internal_user_jonecho.json → copilot_internal_user_example.json} +1 -1
  25. package/_shared/pr-loop/scripts/tests/test_agent_config_carveout.py +1 -1
  26. package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +146 -2
  27. package/_shared/pr-loop/scripts/tests/test_copilot_quota.py +8 -8
  28. package/_shared/pr-loop/scripts/tests/test_reviewer_availability.py +18 -5
  29. package/_shared/pr-loop/scripts/tests/test_reviews_disabled.py +56 -5
  30. package/_shared/pr-loop/scripts/tests/test_terminology_sweep.py +104 -17
  31. package/agents/CLAUDE.md +3 -2
  32. package/agents/clasp-deployment-orchestrator.md +2 -2
  33. package/agents/code-advisor.md +7 -5
  34. package/agents/code-verifier.md +6 -2
  35. package/agents/session-advisor.md +27 -0
  36. package/audit-rubrics/category_rubrics/category-j-code-rules-compliance.md +1 -1
  37. package/audit-rubrics/category_rubrics/category-k-codebase-conflicts.md +1 -1
  38. package/audit-rubrics/prompts/category-a-api-contracts.md +2 -2
  39. package/audit-rubrics/prompts/category-b-selector-engine-compat.md +2 -2
  40. package/audit-rubrics/prompts/category-c-resource-cleanup.md +2 -2
  41. package/audit-rubrics/prompts/category-d-scoping-and-ordering.md +2 -2
  42. package/audit-rubrics/prompts/category-e-dead-code.md +2 -2
  43. package/audit-rubrics/prompts/category-f-silent-failures.md +2 -2
  44. package/audit-rubrics/prompts/category-g-bounds-and-overflow.md +2 -2
  45. package/audit-rubrics/prompts/category-h-security-boundaries.md +2 -2
  46. package/audit-rubrics/prompts/category-i-concurrency.md +2 -2
  47. package/audit-rubrics/prompts/category-j-code-rules-compliance.md +2 -2
  48. package/audit-rubrics/prompts/category-k-codebase-conflicts.md +2 -2
  49. package/audit-rubrics/prompts/category-l-behavior-equivalence.md +2 -2
  50. package/audit-rubrics/prompts/category-m-producer-consumer-cardinality.md +2 -2
  51. package/audit-rubrics/prompts/category-n-test-name-scenario-verifier.md +2 -2
  52. package/audit-rubrics/prompts/category-o-docstring-vs-impl-drift.md +2 -2
  53. package/audit-rubrics/prompts/category-p-name-vs-behavior-contract.md +2 -2
  54. package/bin/CLAUDE.md +1 -0
  55. package/bin/expand_home_directory_tokens.mjs +75 -0
  56. package/bin/install.mjs +21 -7
  57. package/bin/install.test.mjs +220 -10
  58. package/hooks/CLAUDE.md +1 -1
  59. package/hooks/blocking/CLAUDE.md +4 -1
  60. package/hooks/blocking/_path_setup.py +13 -0
  61. package/hooks/blocking/bash_pre_tool_use_dispatcher.py +281 -0
  62. package/hooks/blocking/code_rules_dead_module_constant.py +88 -16
  63. package/hooks/blocking/code_rules_enforcer.py +6 -0
  64. package/hooks/blocking/code_rules_imports_logging.py +34 -1
  65. package/hooks/blocking/code_rules_paths_syspath.py +1 -1
  66. package/hooks/blocking/code_rules_test_layout.py +272 -0
  67. package/hooks/blocking/nas_ssh_binary_enforcer.py +22 -12
  68. package/hooks/blocking/pii_prevention_blocker.py +781 -0
  69. package/hooks/blocking/pii_scanner.py +340 -0
  70. package/hooks/blocking/pre_tool_use_dispatcher.py +3 -3
  71. package/hooks/blocking/stop_dispatcher.py +84 -0
  72. package/hooks/blocking/test__path_setup.py +39 -0
  73. package/hooks/blocking/test_bash_dispatcher_interpreter_starts.py +61 -0
  74. package/hooks/blocking/test_bash_pre_tool_use_dispatcher.py +294 -0
  75. package/hooks/blocking/test_code_rules_enforcer_cross_skill_duplicate.py +1 -1
  76. package/hooks/blocking/test_code_rules_enforcer_dead_module_constant.py +51 -0
  77. package/hooks/blocking/test_code_rules_enforcer_dead_module_constant_read_cap.py +103 -0
  78. package/hooks/blocking/test_code_rules_enforcer_dot_test_pattern.py +1 -1
  79. package/hooks/blocking/test_code_rules_enforcer_file_global_constants.py +1 -1
  80. package/hooks/blocking/test_code_rules_enforcer_hardcoded_user_path.py +11 -11
  81. package/hooks/blocking/test_code_rules_enforcer_naive_datetime.py +1 -1
  82. package/hooks/blocking/test_code_rules_enforcer_same_file_inline_duplicate.py +1 -1
  83. package/hooks/blocking/test_code_rules_enforcer_test_layout.py +111 -0
  84. package/hooks/blocking/test_code_rules_enforcer_type_checking_scope.py +76 -0
  85. package/hooks/blocking/test_destructive_command_blocker.py +29 -9
  86. package/hooks/blocking/test_gh_body_arg_blocker.py +3 -3
  87. package/hooks/blocking/test_nas_ssh_binary_enforcer.py +96 -39
  88. package/hooks/blocking/test_pii_prevention_blocker.py +905 -0
  89. package/hooks/blocking/test_pii_prevention_windows_git_path.py +41 -0
  90. package/hooks/blocking/test_pii_scanner.py +165 -0
  91. package/hooks/blocking/test_pr_description_enforcer_pr_number.py +1 -1
  92. package/hooks/blocking/test_pre_tool_use_dispatcher.py +14 -13
  93. package/hooks/blocking/test_stop_dispatcher.py +187 -0
  94. package/hooks/blocking/test_verdict_directory_write_blocker.py +1 -1
  95. package/hooks/blocking/test_volatile_path_in_post_blocker.py +3 -3
  96. package/hooks/blocking/volatile_path_in_post_blocker.py +54 -5
  97. package/hooks/diagnostic/migrations/README.md +25 -26
  98. package/hooks/diagnostic/test_hook_log_extractor.py +10 -10
  99. package/hooks/hooks.json +10 -120
  100. package/hooks/hooks_constants/CLAUDE.md +12 -3
  101. package/hooks/hooks_constants/bash_pre_tool_use_dispatcher_constants.py +78 -0
  102. package/hooks/hooks_constants/dead_module_constant_constants.py +1 -0
  103. package/hooks/hooks_constants/hosted_hook_runner.py +73 -0
  104. package/hooks/hooks_constants/local_identity.py +182 -0
  105. package/hooks/hooks_constants/nas_ssh_binary_enforcer_constants.py +4 -37
  106. package/hooks/hooks_constants/pii_prevention_constants.py +299 -0
  107. package/hooks/hooks_constants/pre_tool_use_dispatcher_constants.py +4 -0
  108. package/hooks/hooks_constants/python_style_checks_constants.py +15 -0
  109. package/hooks/hooks_constants/stop_dispatcher_constants.py +26 -0
  110. package/hooks/hooks_constants/test_bash_pre_tool_use_dispatcher_constants.py +87 -0
  111. package/hooks/hooks_constants/test_hardcoded_user_path_constants.py +2 -2
  112. package/hooks/hooks_constants/test_hosted_hook_runner.py +101 -0
  113. package/hooks/hooks_constants/test_layout_constants.py +28 -0
  114. package/hooks/hooks_constants/test_local_identity.py +88 -0
  115. package/hooks/hooks_constants/test_session_env_cleanup_constants.py +1 -1
  116. package/hooks/hooks_constants/test_stop_dispatcher_constants.py +32 -0
  117. package/hooks/validators/README.md +5 -6
  118. package/hooks/validators/__init__.py +2 -2
  119. package/hooks/validators/python_style_checks.py +298 -243
  120. package/hooks/validators/run_all_validators.py +6 -0
  121. package/hooks/validators/test_python_style_checks.py +278 -163
  122. package/package.json +2 -2
  123. package/rules/CLAUDE.md +7 -1
  124. package/rules/bdd.md +1 -1
  125. package/rules/nas-ssh-invocation.md +6 -4
  126. package/rules/no-justification-noise.md +61 -0
  127. package/rules/testing.md +0 -2
  128. package/scripts/test_setup_project_paths.py +1 -1
  129. package/skills/CLAUDE.md +6 -3
  130. package/skills/_shared/pr-loop/scripts/_path_resolver.py +2 -2
  131. package/skills/_shared/pr-loop/scripts/build_audit_prompt.py +1 -1
  132. package/skills/_shared/pr-loop/scripts/build_fix_prompt.py +1 -1
  133. package/skills/_shared/pr-loop/scripts/test__path_resolver.py +42 -3
  134. package/skills/_shared/pr-loop/scripts/test_build_audit_prompt.py +11 -11
  135. package/skills/_shared/pr-loop/scripts/test_build_fix_prompt.py +26 -3
  136. package/skills/_shared/pr-loop/scripts/test_preflight_worktree.py +49 -25
  137. package/skills/autoconverge/CLAUDE.md +3 -3
  138. package/skills/autoconverge/SKILL.md +113 -35
  139. package/skills/autoconverge/reference/CLAUDE.md +2 -2
  140. package/skills/autoconverge/reference/convergence.md +44 -22
  141. package/skills/autoconverge/reference/gotchas.md +11 -0
  142. package/skills/autoconverge/reference/stop-conditions.md +23 -13
  143. package/skills/autoconverge/workflow/CLAUDE.md +2 -1
  144. package/skills/autoconverge/workflow/converge.clean-audit.test.mjs +15 -19
  145. package/skills/autoconverge/workflow/converge.contract.test.mjs +43 -42
  146. package/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +141 -16
  147. package/skills/autoconverge/workflow/converge.fix-recovery.test.mjs +2 -2
  148. package/skills/autoconverge/workflow/converge.mjs +329 -68
  149. package/skills/autoconverge/workflow/converge.path-aware.test.mjs +1 -1
  150. package/skills/autoconverge/workflow/converge.precatch.test.mjs +152 -0
  151. package/skills/autoconverge/workflow/converge.run-input.test.mjs +3 -3
  152. package/skills/autoconverge/workflow/converge_multi.run-input.test.mjs +15 -15
  153. package/skills/autoconverge/workflow/test_convergence_summary.py +6 -6
  154. package/skills/bdd-protocol/SKILL.md +4 -5
  155. package/skills/bdd-protocol/references/anti-patterns.md +1 -1
  156. package/skills/bugteam/SKILL.md +8 -0
  157. package/skills/bugteam/reference/copilot-gap-analysis.md +20 -20
  158. package/skills/bugteam/reference/obstacles/audit-walk-categories.md +1 -1
  159. package/skills/bugteam/reference/team-setup.md +7 -5
  160. package/skills/bugteam/scripts/reflow_skill_md.py +1 -1
  161. package/skills/copilot-finding-triage/SKILL.md +124 -0
  162. package/skills/copilot-finding-triage/reference/tier-rubric.md +49 -0
  163. package/skills/copilot-finding-triage/scripts/conftest.py +8 -0
  164. package/skills/copilot-finding-triage/scripts/copilot_finding_triage_constants/__init__.py +0 -0
  165. package/skills/copilot-finding-triage/scripts/copilot_finding_triage_constants/config/__init__.py +0 -0
  166. package/skills/copilot-finding-triage/scripts/copilot_finding_triage_constants/config/notify_ntfy_constants.py +32 -0
  167. package/skills/copilot-finding-triage/scripts/notify_ntfy.py +192 -0
  168. package/skills/copilot-finding-triage/scripts/test_notify_ntfy.py +141 -0
  169. package/skills/copilot-finding-triage/templates/notification.md +34 -0
  170. package/skills/copilot-review/SKILL.md +8 -6
  171. package/skills/findbugs/SKILL.md +4 -0
  172. package/skills/fixbugs/SKILL.md +8 -7
  173. package/skills/gotcha/CLAUDE.md +2 -2
  174. package/skills/gotcha/SKILL.md +4 -4
  175. package/skills/log-audit/SKILL.md +4 -6
  176. package/skills/monitor-open-prs/CLAUDE.md +1 -1
  177. package/skills/monitor-open-prs/SKILL.md +6 -1
  178. package/skills/orchestrator/SKILL.md +184 -0
  179. package/skills/orchestrator-refresh/SKILL.md +37 -0
  180. package/skills/post-audit-findings/SKILL.md +5 -9
  181. package/skills/pr-consistency-audit/SKILL.md +5 -1
  182. package/skills/pr-converge/CLAUDE.md +1 -1
  183. package/skills/pr-converge/SKILL.md +86 -47
  184. package/skills/pr-converge/reference/CLAUDE.md +1 -1
  185. package/skills/pr-converge/reference/convergence-gates.md +20 -17
  186. package/skills/pr-converge/reference/examples.md +63 -47
  187. package/skills/pr-converge/reference/fix-protocol.md +15 -15
  188. package/skills/pr-converge/reference/ground-rules.md +11 -7
  189. package/skills/pr-converge/reference/multi-pr-orchestration.md +6 -5
  190. package/skills/pr-converge/reference/per-tick.md +129 -107
  191. package/skills/pr-converge/reference/state-schema.md +15 -10
  192. package/skills/pr-converge/scripts/check_convergence.py +5 -4
  193. package/skills/pr-converge/scripts/test_check_convergence.py +6 -4
  194. package/skills/pr-fix-protocol/SKILL.md +3 -8
  195. package/skills/pr-loop-cloud-transport/SKILL.md +102 -0
  196. package/skills/pr-loop-cloud-transport/reference/identity-and-hooks.md +40 -0
  197. package/skills/pr-loop-cloud-transport/reference/substitution-matrix.md +48 -0
  198. package/skills/pr-loop-lifecycle/SKILL.md +5 -9
  199. package/skills/pr-scope-resolve/SKILL.md +3 -6
  200. package/skills/privacy-hygiene/SKILL.md +114 -0
  201. package/skills/qbug/SKILL.md +8 -8
  202. package/skills/rebase/SKILL.md +5 -1
  203. package/skills/refine/SKILL.md +4 -5
  204. package/skills/reviewer-gates/SKILL.md +7 -11
  205. package/skills/session-log/SKILL.md +4 -1
  206. package/skills/skill-builder/SKILL.md +3 -6
  207. package/skills/structure-prompt/SKILL.md +4 -5
  208. package/skills/team-advisor/SKILL.md +32 -164
  209. package/skills/test_markdown_link_integrity.py +10 -6
  210. package/skills/update/SKILL.md +5 -1
  211. package/skills/usage-pause/SKILL.md +14 -5
  212. package/skills/usage-pause/scripts/resolve_usage_window.py +83 -5
  213. package/skills/usage-pause/scripts/test_resolve_usage_window.py +185 -17
  214. package/skills/usage-pause/scripts/usage_pause_constants/resolve_usage_window_constants.py +4 -3
  215. package/skills/verified-build/SKILL.md +4 -9
  216. package/skills/team-advisor-refresh/SKILL.md +0 -25
@@ -1,9 +1,10 @@
1
1
  # Convergence gates
2
2
 
3
- Run **only** when Step 2 BUGTEAM reports `convergence (zero findings)` AND
4
- `bugbot_clean_at == current_head` AND no push during bugteam tick. Gates run
5
- in order; first failure determines next-tick behavior. Mark PR ready only
6
- when all six pass.
3
+ Run **only** after the terminal Bugbot gate confirms the HEAD
4
+ (`bugbot_clean_at == current_head` OR `bugbot_down`), which runs just before
5
+ these gates once Step 2 BUGTEAM reports `convergence (zero findings)` with no
6
+ push during the bugteam tick. Gates run in order; first failure determines
7
+ next-tick behavior. Mark PR ready only when all six pass.
7
8
 
8
9
  **Mandatory evidence rule:** Every gate that fetches data MUST produce a
9
10
  summary of its findings before proceeding to the next gate. Gate (f) MUST
@@ -36,19 +37,20 @@ Decide (four branches; match first whose predicate holds):
36
37
  - **`classification == "dirty"` with non-empty inline comments matching
37
38
  `pull_request_review_id`:** Fix protocol input (same shape as bugbot
38
39
  dirty). Apply the `pr-fix-protocol` skill
39
- (`../../pr-fix-protocol/SKILL.md`) Step 3 in same tick.
40
- Reset `bugbot_clean_at = null` AND `copilot_clean_at = null`, `phase =
41
- BUGBOT`, schedule next wakeup, return. Full back-to-back-clean cycle
42
- plus all six gates must hold again on new HEAD.
40
+ (`../../pr-fix-protocol/SKILL.md`) in the same tick.
41
+ Reset `bugbot_clean_at = null`, `code_review_clean_at = null`, AND
42
+ `copilot_clean_at = null`, `phase = CODE_REVIEW`, schedule next wakeup,
43
+ return. Full back-to-back-clean cycle plus all six gates must hold again on
44
+ new HEAD.
43
45
  - **`classification == "dirty"` with empty inline comments matching
44
46
  `pull_request_review_id`:** Copilot posted findings only in review body
45
47
  (`CHANGES_REQUESTED` or `COMMENTED` with non-empty body, no inline
46
48
  threads). Parse body for actionable findings. Apply the
47
49
  `pr-fix-protocol` skill (`../../pr-fix-protocol/SKILL.md`), whose reply
48
50
  step for body-only findings posts a top-level review reply citing the
49
- new HEAD SHA → Step 3 in same tick. Reset
50
- `bugbot_clean_at = null` AND
51
- `copilot_clean_at = null`, `phase = BUGBOT`, Step 3 on new HEAD,
51
+ new HEAD SHA. Reset
52
+ `bugbot_clean_at = null`, `code_review_clean_at = null`, AND
53
+ `copilot_clean_at = null`, `phase = CODE_REVIEW`,
52
54
  schedule next wakeup, return. Convergence needs full
53
55
  back-to-back-clean on new HEAD.
54
56
  - **`classification == "clean"` (state `APPROVED`):** Set
@@ -78,14 +80,14 @@ Decide (four branches; match first whose predicate holds):
78
80
  `pull_request_review_id`:** Treat identically to gate (a) dirty+inline
79
81
  path — apply the `pr-fix-protocol` skill
80
82
  (`../../pr-fix-protocol/SKILL.md`). Reset
81
- `bugbot_clean_at = null` AND `copilot_clean_at = null`, `phase = BUGBOT`,
83
+ `bugbot_clean_at = null` AND `copilot_clean_at = null`, `phase = CODE_REVIEW`,
82
84
  schedule next wakeup, return.
83
85
  - **`classification == "dirty"` with empty inline comments matching
84
86
  `pull_request_review_id`:** Claude posted findings only in review body
85
87
  (`CHANGES_REQUESTED` or `COMMENTED` with non-empty body, no inline
86
88
  threads). Treat identically to gate (a) dirty+body path — apply the
87
89
  `pr-fix-protocol` skill (`../../pr-fix-protocol/SKILL.md`). Reset
88
- `bugbot_clean_at = null` AND `copilot_clean_at = null`, `phase = BUGBOT`,
90
+ `bugbot_clean_at = null` AND `copilot_clean_at = null`, `phase = CODE_REVIEW`,
89
91
  schedule next wakeup, return.
90
92
  - **`classification == "clean"` (state `APPROVED`):** Record evidence:
91
93
  "Claude APPROVED at <SHA>". Continue to gate (c).
@@ -111,8 +113,9 @@ Persist `mergeable_state` into `merge_state_status`. Decide:
111
113
  ([`../../rebase/SKILL.md`](../../rebase/SKILL.md)) Phase 1–4 against PR's
112
114
  base ref. After rebase + force-with-lease push, new HEAD invalidates
113
115
  every prior clean state — reset `bugbot_clean_at = null`,
114
- `copilot_clean_at = null`, `merge_state_status = null`, `phase = BUGBOT`,
115
- Step 3 on new HEAD, schedule next wakeup, return. Loop re-runs from
116
+ `code_review_clean_at = null`, `copilot_clean_at = null`,
117
+ `merge_state_status = null`, `phase = CODE_REVIEW`,
118
+ schedule next wakeup, return. Loop re-runs from
116
119
  scratch on new HEAD.
117
120
  - **`mergeable_state` is `"blocked"`, `"behind"`, `"unknown"`, or `"unstable"` for
118
121
  non-conflict reasons** (required checks pending/failing for "unstable",
@@ -157,7 +160,7 @@ against `current_head`. Decide:
157
160
  - `state: CHANGES_REQUESTED` or `COMMENTED` with non-empty body → dirty.
158
161
  Treat identically to gate (a) dirty path — spawn Agent (subagent_type: clean-coder) to fix,
159
162
  reset `bugbot_clean_at = null` AND `copilot_clean_at = null`,
160
- `phase = BUGBOT`, schedule next wakeup, return.
163
+ `phase = CODE_REVIEW`, schedule next wakeup, return.
161
164
  - **No Copilot review at `current_head` yet:** Record evidence: "No Copilot
162
165
  review at <SHA> (wait count: <N>)". Increment `copilot_wait_count`
163
166
  (init 0 on first COPILOT_WAIT entry; reset to 0 on every push and on every
@@ -187,7 +190,7 @@ Decide:
187
190
  `pr-fix-protocol` skill's unresolved-thread sweep
188
191
  (`../../pr-fix-protocol/SKILL.md`). Push if any code changed → reset
189
192
  `bugbot_clean_at = null` AND `copilot_clean_at = null`,
190
- `phase = BUGBOT`, schedule next wakeup, return. If only resolutions
193
+ `phase = CODE_REVIEW`, schedule next wakeup, return. If only resolutions
191
194
  (no code changes), re-check this gate without resetting.
192
195
 
193
196
  ## (f) Mark ready and report
@@ -4,40 +4,60 @@ Worked examples for `pr-converge`. Read on demand when a tick's
4
4
  classification is novel or ambiguous against the in-skill rules. Cross-refs
5
5
  into `SKILL.md` use `§Section name` notation.
6
6
 
7
- <example> User: `/pr-converge` Claude: [PR context + one tick bugbot/bugteam
8
- work; Step 4 per `workflows/schedule-wakeup-loop.md` default loop until
9
- convergence or stop]
7
+ <example> User: `/pr-converge` Claude: [PR context + one tick of internal
8
+ code-review/bugteam work, then the terminal Bugbot and Copilot gates; Step 4
9
+ per `workflows/schedule-wakeup-loop.md` — default loop until convergence or
10
+ stop]
10
11
  </example>
11
12
 
12
- <example> BUGBOT tick, latest bugbot review against older commit. Claude:
13
- [posts `bugbot run`, sets `bugbot_clean_at = null`, Step 4 per
14
- `workflows/schedule-wakeup-loop.md` (e.g. 270s wakeup), returns]
13
+ <example> CODE_REVIEW tick (the entry phase), the static sweep raises a
14
+ `ruff` failure on a changed file. Claude: [fixes it TDD, one commit, pushes,
15
+ resets `bugbot_clean_at = null` and `code_review_clean_at = null`, stays
16
+ `phase = CODE_REVIEW`, Step 4 at 270s, re-runs the sweep next tick]
15
17
  </example>
16
18
 
17
- <example> BUGBOT tick, bugbot has 2 unaddressed findings on HEAD. Claude:
18
- [TDD-fixes both, one commit, pushes, replies inline on both threads, posts
19
- `bugbot run`, Step 4 at 270s, returns]
19
+ <example> CODE_REVIEW tick, static sweep clean, `/code-review high --fix`
20
+ applies fixes to the working tree. Claude: [commits the applied fixes in one
21
+ commit, pushes, resets `bugbot_clean_at = null` and `code_review_clean_at =
22
+ null`, stays `phase = CODE_REVIEW`, Step 4 at 270s, returns]
20
23
  </example>
21
24
 
22
- <example> BUGBOT tick, bugbot clean against HEAD. Claude: [sets
23
- `bugbot_clean_at = HEAD`, `phase = CODE_REVIEW`, runs `/code-review --fix`
24
- in same tick]
25
+ <example> CODE_REVIEW tick, static sweep clean and `/code-review high --fix`
26
+ clean (no changes applied). Claude: [sets `code_review_clean_at = HEAD`,
27
+ `phase = BUGTEAM`, runs `Skill({skill: "bugteam", ...})` in same tick]
25
28
  </example>
26
29
 
27
- <example> CODE_REVIEW tick, `/code-review --fix` applies fixes to the
28
- working tree. Claude: [commits the applied fixes in one commit, pushes,
29
- resets `bugbot_clean_at = null` and `code_review_clean_at = null`, posts
30
- `bugbot run`, `phase = BUGBOT`, Step 4 at 270s, returns]
30
+ <example> BUGTEAM phase, bugteam pushed a fix commit during its run. Claude:
31
+ [re-resolves HEAD, resets `bugbot_clean_at = null` and `code_review_clean_at =
32
+ null`, `phase = CODE_REVIEW`, Step 4 at 270s, re-enters the internal passes on
33
+ the new HEAD]
31
34
  </example>
32
35
 
33
- <example> CODE_REVIEW tick, `/code-review --fix` clean (no changes
34
- applied). Claude: [sets `code_review_clean_at = HEAD`, `phase = BUGTEAM`,
35
- runs `Skill({skill: "bugteam", ...})` in same tick]
36
+ <example> BUGTEAM phase, bugteam reports convergence with no push. Claude:
37
+ [the internal passes are clean on `current_head`; `phase = BUGBOT` — routes into
38
+ the terminal Bugbot gate in the same tick]
36
39
  </example>
37
40
 
38
- <example> BUGTEAM phase, bugteam reports convergence and `bugbot_clean_at
39
- == current_head` (no push). Claude: [back-to-back clean necessary, not
40
- sufficient. Runs `convergence-gates.md` gates in order:
41
+ <example> Terminal BUGBOT gate, Bugbot disabled for the run (the default).
42
+ Claude: [availability gate exits 0, sets `bugbot_down = true`, advances to the
43
+ `convergence-gates.md` gates with the Bugbot gate bypassed — no trigger, no
44
+ wait, no agent]
45
+ </example>
46
+
47
+ <example> Terminal BUGBOT gate, Bugbot enabled and clean on HEAD. Claude:
48
+ [sets `bugbot_clean_at = HEAD`, advances to the `convergence-gates.md` gates in
49
+ the same tick]
50
+ </example>
51
+
52
+ <example> Terminal BUGBOT gate, Bugbot has 2 unaddressed findings on HEAD.
53
+ Claude: [TDD-fixes both, one commit, pushes, replies inline on both threads,
54
+ resets `bugbot_clean_at = null` and `code_review_clean_at = null`, `phase =
55
+ CODE_REVIEW`, Step 4 at 270s, re-enters the internal passes on the new HEAD]
56
+ </example>
57
+
58
+ <example> Convergence gates after the terminal Bugbot gate confirms
59
+ (`bugbot_clean_at == current_head`). Claude: [runs `convergence-gates.md` gates
60
+ in order:
41
61
  Gate (a): two calls — `pull_request_read(method="get_reviews")` +
42
62
  `pull_request_read(method="get_review_comments")`
43
63
  → filter Copilot → APPROVED at `current_head`
@@ -53,7 +73,7 @@ sufficient. Runs `convergence-gates.md` gates in order:
53
73
  → schedule next wakeup, return.
54
74
  Next tick: re-run gate (a) fetch → Copilot `APPROVED` at `current_head`
55
75
  → set `copilot_clean_at = current_head`, record evidence: "Copilot
56
- APPROVED at <SHA>", set `phase = BUGTEAM`, re-validate gates (b) and (c).
76
+ APPROVED at <SHA>", re-validate gates (b) and (c).
57
77
  Gate (e): the `pr-fix-protocol` unresolved-thread sweep
58
78
  (`../../pr-fix-protocol/SKILL.md`) → zero across PR → record evidence.
59
79
  Gate (f): all six gates pass → `update_pull_request(pullNumber=NUMBER,
@@ -64,40 +84,35 @@ mergeable_state clean, copilot CLEAN at <SHA>, claude absent at <SHA>,
64
84
  applies **Convergence** from `workflows/schedule-wakeup-loop.md`]
65
85
  </example>
66
86
 
67
- <example> BUGTEAM phase, bugteam pushed fix commit during run. Claude:
68
- [re-resolves HEAD, sets `bugbot_clean_at = null`, posts `bugbot run` in
69
- same tick, `phase = BUGBOT`, Step 4 at 270s]
70
- </example>
71
-
72
- <example> BUGBOT tick, review body says "found 3 potential issues" against
73
- HEAD but inline API returns zero matching for `current_head`. Claude:
74
- [increments `inline_lag_streak` to 1, Step 4 inline-lag rules (90s
75
- `ScheduleWakeup`), returns]
87
+ <example> CODE_REVIEW tick, review body says "found 3 potential issues"
88
+ against HEAD (a stale prior finding) but the diff is clean. Claude: [the static
89
+ sweep and `/code-review high --fix` both pass, sets `code_review_clean_at =
90
+ HEAD`, `phase = BUGTEAM`]
76
91
  </example>
77
92
 
78
- <example> Back-to-back clean reached, but `mergeStateStatus: DIRTY` (base
93
+ <example> Convergence gates reached, but `mergeStateStatus: DIRTY` (base
79
94
  advanced, merge conflicts). Claude: [runs §Convergence gate (c); does NOT
80
95
  mark ready; invokes `rebase` skill per `../../rebase/SKILL.md` Phase 1–4;
81
96
  after force-with-lease push, resets `bugbot_clean_at = null`,
82
- `copilot_clean_at = null`, `merge_state_status = null`, `phase = BUGBOT`,
83
- posts `bugbot run` on new HEAD, schedules next wakeup]
97
+ `code_review_clean_at = null`, `copilot_clean_at = null`, `merge_state_status
98
+ = null`, `phase = CODE_REVIEW`, schedules next wakeup]
84
99
  </example>
85
100
 
86
- <example> Back-to-back clean, mergeability CLEAN, Copilot review at
101
+ <example> Convergence gates reached, mergeability CLEAN, Copilot review at
87
102
  `current_head` `state == "CHANGES_REQUESTED"` with two unaddressed inline
88
103
  findings. Claude: [runs §Convergence gates (a); applies Fix protocol (TDD
89
- test → fix → push → reply inline both threads), resets `bugbot_clean_at`
90
- and `copilot_clean_at` null, `phase = BUGBOT`, posts `bugbot run` on new
91
- HEAD, schedules next wakeup]
104
+ test → fix → push → reply inline both threads), resets `bugbot_clean_at`,
105
+ `code_review_clean_at`, and `copilot_clean_at` null, `phase = CODE_REVIEW`,
106
+ schedules next wakeup, re-enters the internal passes on the new HEAD]
92
107
  </example>
93
108
 
94
- <example> Back-to-back clean, mergeability CLEAN, no Copilot review on
109
+ <example> Convergence gates reached, mergeability CLEAN, no Copilot review on
95
110
  `current_head`. Claude sets `phase = COPILOT_WAIT`, runs gate (d):
96
111
  `request_copilot_review(owner=OWNER, repo=REPO, pullNumber=NUMBER)`,
97
112
  schedules next wakeup, returns. Next tick:
98
113
  Copilot review `state: APPROVED` at `current_head`. Claude: [re-runs
99
114
  gate (a) fetch → APPROVED → sets `copilot_clean_at = current_head`,
100
- records evidence: "Copilot APPROVED at <SHA>", sets `phase = BUGTEAM`;
115
+ records evidence: "Copilot APPROVED at <SHA>";
101
116
  re-validates gates (b) Claude absent and (c) mergeability clean,
102
117
  records evidence for both; gate (e) — the `pr-fix-protocol`
103
118
  unresolved-thread sweep — passes trivially, record evidence:
@@ -108,12 +123,13 @@ at <SHA>, bugteam CLEAN at <SHA>, mergeable_state clean, copilot CLEAN at
108
123
  <SHA>, claude absent at <SHA>, 0 unresolved threads across PR; marked ready for review"]
109
124
  </example>
110
125
 
111
- <example> Back-to-back clean, mergeability CLEAN, post-convergence Copilot
112
- review returned `state: CHANGES_REQUESTED` with inline findings on
126
+ <example> Convergence gates reached, mergeability CLEAN, post-convergence
127
+ Copilot review returned `state: CHANGES_REQUESTED` with inline findings on
113
128
  `current_head`. Claude: [does NOT mark PR ready — gate (d) failed;
114
129
  applies Fix protocol on every confirmed Copilot finding (TDD test → fix →
115
- push → reply inline on each thread); resets `bugbot_clean_at = null` and
116
- `copilot_clean_at = null`; `phase = BUGBOT`; posts `bugbot run` on new
117
- HEAD; schedules next wakeup. Full back-to-back-clean cycle plus all six
118
- gates must hold again on new HEAD.]
130
+ push → reply inline on each thread); resets `bugbot_clean_at = null`,
131
+ `code_review_clean_at = null`, and `copilot_clean_at = null`; `phase =
132
+ CODE_REVIEW`; schedules next wakeup, re-enters the internal passes on the new
133
+ HEAD. Full back-to-back-clean cycle plus all six gates must hold again on new
134
+ HEAD.]
119
135
  </example>
@@ -8,7 +8,7 @@ sequence in `../../../_shared/pr-loop/fix-protocol.md`. Hook handling
8
8
  per [ground-rules.md](ground-rules.md).
9
9
 
10
10
  This file holds only the pr-converge deltas: the multi-PR teammate
11
- obligations and the same-tick re-trigger rule.
11
+ obligations and the same-tick re-entry rule.
12
12
 
13
13
  **Multi-PR (`state.json`) teammate obligations** (plus TDD, commit, push):
14
14
 
@@ -17,21 +17,21 @@ obligations and the same-tick re-trigger rule.
17
17
  (what changed + commit identifier), matching §Audit result → fix worker step 4 — **before** writing
18
18
  `state.json` and going idle.
19
19
  - Writes `last_action: "fix_pushed"`, `current_head: <new SHA>`,
20
- `bugbot_clean_at: null`, `bugbot_down: false`, `phase: "BUGBOT"`,
21
- `status: "awaiting_bugbot"`, `last_updated` (ISO-8601 UTC) to
22
- `state.json` (per §Concurrency).
23
- - Goes idle. Orchestrator spawns follow-up `general-purpose` agent for
24
- bugbot trigger and monitoring.
20
+ `bugbot_clean_at: null`, `code_review_clean_at: null`, `bugbot_down: false`,
21
+ `phase: "CODE_REVIEW"`, `status: "awaiting_code_review"`, `last_updated`
22
+ (ISO-8601 UTC) to `state.json` (per §Concurrency).
23
+ - Goes idle. Orchestrator spawns a follow-up `general-purpose` agent for the
24
+ CODE_REVIEW re-entry on the new HEAD.
25
25
 
26
- Orchestrator does not reply inline, trigger bugbot, or read repo source
26
+ Orchestrator does not reply inline, re-enter code-review, or read repo source
27
27
  files during fix phase in multi-PR mode.
28
28
 
29
- ### Same-tick re-trigger rule
29
+ ### Same-tick re-entry rule
30
30
 
31
- **After pushing a fix, always run Step 3 (`bugbot run`) in the same
32
- tick** regardless of phase. A new commit **resets the full convergence
33
- cycle**: a bugbot clean and a bugteam clean on an older SHA do **not**
34
- count toward convergence on the new `HEAD`. Re-obtain bugbot CLEAN on
35
- `current_head`, then bugteam CLEAN on the same `HEAD` with no
36
- intervening push. Re-triggering in the same tick saves a wakeup cycle
37
- vs deferring Step 3.
31
+ **After pushing a fix, re-enter the CODE_REVIEW phase in the same tick**
32
+ regardless of phase. A new commit **resets the full convergence cycle**: a
33
+ code-review clean, a bugteam clean, and a Bugbot clean on an older SHA do
34
+ **not** count toward convergence on the new `HEAD`. Re-run the static sweep and
35
+ `/code-review high --fix` on `current_head`, then bugteam, then the terminal
36
+ Bugbot gate, all on the same `HEAD` with no intervening push. Re-entering in the
37
+ same tick saves a wakeup cycle.
@@ -1,24 +1,28 @@
1
1
  # Ground rules
2
2
 
3
+ - **Internal-first.** The internal code-review and bugteam passes drive the code
4
+ to clean each tick; Cursor Bugbot and Copilot run only after that, as terminal
5
+ confirmation gates.
3
6
  - **Append commits.** Each tick adds at most one fix commit.
4
- - **Bugbot findings on current SHA mean fix-then-push-then-`bugbot run`,
5
- not another naked `bugbot run`.**
7
+ - **Bugbot findings on the current SHA mean fix-then-push-then-re-enter
8
+ CODE_REVIEW,** so the internal passes re-clear the new HEAD before the terminal
9
+ Bugbot gate runs again.
6
10
  - **All `*_clean_at`, `merge_state_status`, and `bugbot_down` reset on every push.**
7
11
  - **`bugbot run` comment is load-bearing.** Literal phrase exactly —
8
12
  empirically the only re-trigger Cursor Bugbot recognizes.
9
- - **Production edits go through `clean-coder`, except `/code-review --fix`.**
13
+ - **Production edits go through `clean-coder`, except `/code-review high --fix`.**
10
14
  The lead never hand-edits production files. Every bugbot, bugteam,
11
15
  Copilot, or Claude finding spawns `Agent(subagent_type="clean-coder")` to
12
- implement the fix. The CODE_REVIEW phase is the one exception: `/code-review
13
- --fix` applies its own findings to the working tree, which the next
14
- BUGBOT/BUGTEAM cycle re-reviews after the loop resets.
16
+ apply the fix. The CODE_REVIEW phase is the one exception: `/code-review
17
+ high --fix` applies its own findings to the working tree, which the next
18
+ CODE_REVIEW/BUGTEAM cycle re-reviews after the loop resets.
15
19
  - **Adapt when reality contradicts on-disk state.** If `state.json`,
16
20
  `git`, or `gh` disagree with live PR, escalate as hard blocker per
17
21
  [stop-conditions.md](stop-conditions.md).
18
22
  - **Cross-repo cwd routing is routine, not a fork.** When the PR under
19
23
  convergence lives in a different repo than the session is rooted in, route
20
24
  the working directory into a checkout of the PR's repo automatically —
21
- `/code-review --fix`, `git`, and every `clean-coder` fix spawn act on the
25
+ `/code-review high --fix`, `git`, and every `clean-coder` fix spawn act on the
22
26
  repo of the current working directory. The resolution is fixed
23
27
  ([per-tick.md § Step 1.5](per-tick.md)): resolve the PR worktree, `cd` into
24
28
  it, run local work there. Do not pause, ask, or raise it as a material fork.
@@ -36,7 +36,7 @@ Create once at session start. Each teammate writes result before going idle.
36
36
  "prs": {
37
37
  "289": {
38
38
  "owner": "jl-cmd",
39
- "repo": "claude-code-config",
39
+ "repo": "claude-dev-env",
40
40
  "branch": "feat/shared-pr-loop-extraction",
41
41
  "phase": "BUGBOT",
42
42
  "current_head": "f9a7d49e",
@@ -85,10 +85,11 @@ file contents, or subagent-owned fields except two exceptions. Uses same
85
85
  refresh `last_updated`. Observability only — no ceiling; loop ends on
86
86
  convergence or **Stop conditions**.
87
87
  2. **`phase` when only orchestrator decides:** Orchestrator applies a
88
- Step 2 phase transition (including BUGTEAM §(d) `phase = BUGBOT`
89
- without immediate subagent write) and no subagent merge occurs that
90
- tick orchestrator performs one locked merge setting only
91
- `prs[<pr_number>].phase` and `last_updated`.
88
+ Step 2 phase transition (including BUGTEAM §(d) `phase = BUGBOT` on
89
+ convergence with no push, routing into the terminal Bugbot gate, or
90
+ `phase = CODE_REVIEW` on a fix push without a subagent write) and no
91
+ subagent merge occurs that tick → orchestrator performs one locked merge
92
+ setting only `prs[<pr_number>].phase` and `last_updated`.
92
93
 
93
94
  Orchestrator reads file at start of every tick for cross-PR state, not
94
95
  conversation context.