claude-dev-env 1.93.0 → 1.94.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 (220) hide show
  1. package/_shared/pr-loop/CLAUDE.md +1 -0
  2. package/_shared/pr-loop/audit-contract.md +1 -1
  3. package/_shared/pr-loop/gh-payloads.md +3 -3
  4. package/_shared/pr-loop/post-audit-thread-contract.md +51 -0
  5. package/_shared/pr-loop/scripts/README.md +2 -2
  6. package/_shared/pr-loop/scripts/code_rules_gate.py +127 -13
  7. package/_shared/pr-loop/scripts/fix_hookspath.py +47 -12
  8. package/_shared/pr-loop/scripts/pr_loop_shared_constants/code_rules_gate_constants.py +4 -0
  9. package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +146 -69
  10. package/_shared/pr-loop/scripts/tests/test_fix_hookspath.py +497 -374
  11. package/_shared/pr-loop/state-schema.md +3 -22
  12. package/bin/CLAUDE.md +1 -1
  13. package/bin/install.mjs +2 -7
  14. package/bin/install.test.mjs +10 -4
  15. package/hooks/blocking/CLAUDE.md +2 -0
  16. package/hooks/blocking/pii_commit_command.py +398 -0
  17. package/hooks/blocking/pii_payload_scan.py +133 -0
  18. package/hooks/blocking/pii_prevention_blocker.py +151 -449
  19. package/hooks/blocking/pii_scanner.py +26 -1
  20. package/hooks/blocking/test_code_rules_enforcer_dead_config_field.py +2 -2
  21. package/hooks/blocking/test_pii_prevention_blocker.py +299 -0
  22. package/hooks/blocking/test_pii_scanner.py +27 -2
  23. package/hooks/blocking/test_verdict_directory_write_blocker.py +42 -7
  24. package/hooks/hooks_constants/CLAUDE.md +2 -2
  25. package/hooks/hooks_constants/code_rules_path_utils_constants.py +0 -2
  26. package/hooks/hooks_constants/local_identity.py +65 -15
  27. package/hooks/hooks_constants/pii_prevention_constants.py +20 -8
  28. package/hooks/hooks_constants/pr_description_enforcer_constants.py +1 -1
  29. package/hooks/hooks_constants/test_local_identity.py +68 -0
  30. package/package.json +1 -1
  31. package/scripts/CLAUDE.md +10 -1
  32. package/scripts/Get-SessionAccount.ps1 +210 -0
  33. package/scripts/tests/CLAUDE.md +15 -1
  34. package/scripts/tests/Get-SessionAccount.Tests.ps1 +350 -0
  35. package/skills/CLAUDE.md +3 -25
  36. package/skills/anthropic-plan/SKILL.md +1 -13
  37. package/skills/autoconverge/CLAUDE.md +5 -2
  38. package/skills/autoconverge/SKILL.md +112 -387
  39. package/skills/autoconverge/reference/CLAUDE.md +4 -1
  40. package/skills/autoconverge/reference/closing-report.md +9 -2
  41. package/skills/autoconverge/reference/convergence.md +26 -22
  42. package/skills/autoconverge/reference/headless-safety.md +44 -0
  43. package/skills/autoconverge/reference/multi-pr.md +88 -0
  44. package/skills/autoconverge/reference/self-closing-loop.md +84 -0
  45. package/skills/autoconverge/reference/stop-conditions.md +21 -13
  46. package/skills/autoconverge/workflow/converge.clean-audit.test.mjs +87 -27
  47. package/skills/autoconverge/workflow/converge.contract.test.mjs +40 -10
  48. package/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +179 -47
  49. package/skills/autoconverge/workflow/converge.fix-progress.test.mjs +1 -1
  50. package/skills/autoconverge/workflow/converge.mjs +284 -94
  51. package/skills/bugteam/CLAUDE.md +1 -1
  52. package/skills/bugteam/CONSTRAINTS.md +3 -3
  53. package/skills/bugteam/PROMPTS.md +8 -19
  54. package/skills/bugteam/SKILL.md +13 -14
  55. package/skills/bugteam/reference/CLAUDE.md +1 -1
  56. package/skills/bugteam/reference/audit-and-teammates.md +2 -2
  57. package/skills/bugteam/reference/copilot-gap-analysis.md +2 -0
  58. package/skills/bugteam/reference/github-pr-reviews.md +56 -38
  59. package/skills/bugteam/reference/team-setup.md +11 -11
  60. package/skills/bugteam/scripts/CLAUDE.md +6 -6
  61. package/skills/bugteam/scripts/README.md +20 -8
  62. package/skills/bugteam/scripts/bugteam_code_rules_gate.py +13 -1463
  63. package/skills/bugteam/scripts/bugteam_fix_hookspath.py +23 -358
  64. package/skills/bugteam/scripts/bugteam_preflight.py +13 -315
  65. package/skills/bugteam/scripts/bugteam_scripts_constants/CLAUDE.md +2 -3
  66. package/skills/bugteam/scripts/test_bugteam_code_rules_gate.py +34 -1053
  67. package/skills/bugteam/scripts/test_bugteam_fix_hookspath.py +30 -347
  68. package/skills/bugteam/scripts/test_bugteam_preflight.py +30 -305
  69. package/skills/copilot-finding-triage/SKILL.md +80 -28
  70. package/skills/copilot-finding-triage/reference/tier-rubric.md +70 -11
  71. package/skills/copilot-finding-triage/templates/notification.md +8 -3
  72. package/skills/everything-search/SKILL.md +1 -2
  73. package/skills/grokify/SKILL.md +58 -0
  74. package/skills/grokify/templates/handoff-template.md +92 -0
  75. package/skills/orchestrator/SKILL.md +12 -8
  76. package/skills/orchestrator-refresh/SKILL.md +3 -3
  77. package/skills/pr-converge/SKILL.md +132 -233
  78. package/skills/pr-converge/reference/convergence-gates.md +102 -66
  79. package/skills/pr-converge/reference/examples.md +37 -25
  80. package/skills/pr-converge/reference/fix-protocol.md +7 -7
  81. package/skills/pr-converge/reference/multi-pr-orchestration.md +10 -4
  82. package/skills/pr-converge/reference/per-tick.md +64 -41
  83. package/skills/pr-converge/reference/state-schema.md +27 -2
  84. package/skills/pr-converge/scripts/CLAUDE.md +8 -0
  85. package/skills/pr-converge/scripts/README.md +4 -3
  86. package/skills/pr-converge/scripts/_pr_converge_path_setup.py +23 -0
  87. package/skills/pr-converge/scripts/check_convergence.py +189 -645
  88. package/skills/pr-converge/scripts/check_convergence_gates.py +235 -0
  89. package/skills/pr-converge/scripts/check_convergence_thread_gates.py +219 -0
  90. package/skills/pr-converge/scripts/conftest.py +8 -0
  91. package/skills/pr-converge/scripts/pr_converge_scripts_constants/CLAUDE.md +1 -0
  92. package/skills/pr-converge/scripts/pr_converge_scripts_constants/convergence_gate_constants.py +36 -0
  93. package/skills/pr-converge/scripts/test__pr_converge_path_setup.py +26 -0
  94. package/skills/pr-converge/scripts/test_check_convergence.py +73 -228
  95. package/skills/pr-converge/scripts/test_check_convergence_contract.py +321 -0
  96. package/skills/pr-converge/scripts/test_check_convergence_gates.py +68 -0
  97. package/skills/pr-converge/scripts/test_check_convergence_thread_gates.py +75 -0
  98. package/skills/privacy-hygiene/SKILL.md +8 -7
  99. package/skills/reviewer-gates/SKILL.md +26 -8
  100. package/skills/session-log/SKILL.md +11 -12
  101. package/skills/session-tidy/SKILL.md +40 -30
  102. package/skills/skill-builder/CLAUDE.md +13 -10
  103. package/skills/skill-builder/SKILL.md +31 -31
  104. package/skills/skill-builder/references/CLAUDE.md +10 -6
  105. package/skills/skill-builder/references/delegation-map.md +13 -4
  106. package/skills/skill-builder/references/description-field.md +113 -0
  107. package/skills/skill-builder/references/self-audit-checklist.md +21 -4
  108. package/skills/skill-builder/references/skill-modularity.md +113 -0
  109. package/skills/skill-builder/references/skill-types.md +4 -0
  110. package/skills/skill-builder/templates/CLAUDE.md +4 -4
  111. package/skills/skill-builder/templates/gap-analysis.md +25 -1
  112. package/skills/skill-builder/workflows/CLAUDE.md +6 -4
  113. package/skills/skill-builder/workflows/improve-skill.md +17 -16
  114. package/skills/skill-builder/workflows/new-skill.md +34 -10
  115. package/skills/skill-builder/workflows/polish-skill.md +59 -43
  116. package/skills/usage-pause/SKILL.md +10 -14
  117. package/skills/bdd-protocol/CLAUDE.md +0 -26
  118. package/skills/bdd-protocol/SKILL.md +0 -30
  119. package/skills/bdd-protocol/references/CLAUDE.md +0 -10
  120. package/skills/bdd-protocol/references/anti-patterns.md +0 -26
  121. package/skills/bdd-protocol/references/example-mapping.md +0 -23
  122. package/skills/bg-agent/CLAUDE.md +0 -17
  123. package/skills/bg-agent/SKILL.md +0 -69
  124. package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_code_rules_gate_constants.py +0 -55
  125. package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_fix_hookspath_constants.py +0 -26
  126. package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_preflight_constants.py +0 -35
  127. package/skills/caveman/CLAUDE.md +0 -15
  128. package/skills/caveman/SKILL.md +0 -38
  129. package/skills/code/CLAUDE.md +0 -17
  130. package/skills/code/SKILL.md +0 -178
  131. package/skills/deep-research/CLAUDE.md +0 -17
  132. package/skills/deep-research/SKILL.md +0 -80
  133. package/skills/findbugs/CLAUDE.md +0 -20
  134. package/skills/findbugs/SKILL.md +0 -241
  135. package/skills/fixbugs/CLAUDE.md +0 -19
  136. package/skills/fixbugs/SKILL.md +0 -142
  137. package/skills/gh-paginate/CLAUDE.md +0 -18
  138. package/skills/gh-paginate/SKILL.md +0 -84
  139. package/skills/gotcha/CLAUDE.md +0 -33
  140. package/skills/gotcha/SKILL.md +0 -73
  141. package/skills/implement/CLAUDE.md +0 -27
  142. package/skills/implement/SKILL.md +0 -66
  143. package/skills/implement/scripts/CLAUDE.md +0 -22
  144. package/skills/implement/scripts/append_note.py +0 -133
  145. package/skills/implement/scripts/implement_scripts_constants/CLAUDE.md +0 -22
  146. package/skills/implement/scripts/implement_scripts_constants/__init__.py +0 -0
  147. package/skills/implement/scripts/implement_scripts_constants/notes_constants.py +0 -12
  148. package/skills/implement/scripts/test_append_note.py +0 -191
  149. package/skills/log-audit/CLAUDE.md +0 -20
  150. package/skills/log-audit/SKILL.md +0 -66
  151. package/skills/log-audit/reference/CLAUDE.md +0 -9
  152. package/skills/log-audit/reference/charter.md +0 -52
  153. package/skills/log-audit/scripts/CLAUDE.md +0 -27
  154. package/skills/log-audit/scripts/cluster_recurrences.py +0 -261
  155. package/skills/log-audit/scripts/collect_log_window.py +0 -199
  156. package/skills/log-audit/scripts/log_audit_constants/CLAUDE.md +0 -12
  157. package/skills/log-audit/scripts/log_audit_constants/__init__.py +0 -0
  158. package/skills/log-audit/scripts/log_audit_constants/cluster_recurrences_constants.py +0 -23
  159. package/skills/log-audit/scripts/log_audit_constants/collect_log_window_constants.py +0 -24
  160. package/skills/log-audit/scripts/log_audit_constants/mine_copilot_findings_constants.py +0 -49
  161. package/skills/log-audit/scripts/mine_copilot_findings.py +0 -302
  162. package/skills/log-audit/scripts/test_cluster_recurrences.py +0 -160
  163. package/skills/log-audit/scripts/test_collect_log_window.py +0 -111
  164. package/skills/log-audit/scripts/test_mine_copilot_findings.py +0 -126
  165. package/skills/logifix/CLAUDE.md +0 -36
  166. package/skills/logifix/SKILL.md +0 -69
  167. package/skills/logifix/scripts/CLAUDE.md +0 -16
  168. package/skills/logifix/scripts/logifix.ps1 +0 -205
  169. package/skills/monitor-open-prs/CLAUDE.md +0 -34
  170. package/skills/monitor-open-prs/SKILL.md +0 -88
  171. package/skills/monitor-open-prs/scripts/CLAUDE.md +0 -17
  172. package/skills/monitor-open-prs/scripts/discover_open_prs.py +0 -69
  173. package/skills/monitor-open-prs/scripts/test_discover_open_prs.py +0 -149
  174. package/skills/monitor-open-prs/test_skill_contract.py +0 -27
  175. package/skills/post-audit-findings/SKILL.md +0 -80
  176. package/skills/pr-consistency-audit/CLAUDE.md +0 -34
  177. package/skills/pr-consistency-audit/SKILL.md +0 -116
  178. package/skills/pr-consistency-audit/reference/CLAUDE.md +0 -16
  179. package/skills/pr-consistency-audit/reference/detection-rules.md +0 -96
  180. package/skills/pr-consistency-audit/reference/illustrations.md +0 -78
  181. package/skills/pr-fix-protocol/SKILL.md +0 -65
  182. package/skills/pr-review-responder/CLAUDE.md +0 -35
  183. package/skills/pr-review-responder/EXAMPLES.md +0 -590
  184. package/skills/pr-review-responder/PRINCIPLES.md +0 -533
  185. package/skills/pr-review-responder/README.md +0 -168
  186. package/skills/pr-review-responder/SKILL.md +0 -203
  187. package/skills/pr-review-responder/TESTING.md +0 -350
  188. package/skills/pr-scope-resolve/SKILL.md +0 -45
  189. package/skills/pre-compact/CLAUDE.md +0 -24
  190. package/skills/pre-compact/SKILL.md +0 -134
  191. package/skills/qbug/CLAUDE.md +0 -40
  192. package/skills/qbug/SKILL.md +0 -387
  193. package/skills/qbug/test_qbug_skill_audit_schema.py +0 -152
  194. package/skills/qbug/test_qbug_skill_post_fix_audit.py +0 -103
  195. package/skills/refine/CLAUDE.md +0 -44
  196. package/skills/refine/SKILL.md +0 -262
  197. package/skills/refine/templates/CLAUDE.md +0 -17
  198. package/skills/refine/templates/implementation-notes-template.html +0 -56
  199. package/skills/refine/templates/plan-template.md +0 -60
  200. package/skills/research-mode/CLAUDE.md +0 -35
  201. package/skills/research-mode/SKILL.md +0 -53
  202. package/skills/structure-prompt/CLAUDE.md +0 -42
  203. package/skills/structure-prompt/SKILL.md +0 -44
  204. package/skills/structure-prompt/reference/CLAUDE.md +0 -28
  205. package/skills/structure-prompt/reference/adversarial-tuning.md +0 -62
  206. package/skills/structure-prompt/reference/block-classification.md +0 -27
  207. package/skills/structure-prompt/reference/canonical-case.md +0 -48
  208. package/skills/structure-prompt/reference/citation-depth.md +0 -70
  209. package/skills/structure-prompt/reference/cleanup.md +0 -33
  210. package/skills/structure-prompt/reference/constraints.md +0 -33
  211. package/skills/structure-prompt/reference/directives.md +0 -37
  212. package/skills/structure-prompt/reference/examples.md +0 -72
  213. package/skills/structure-prompt/reference/instantiation.md +0 -51
  214. package/skills/structure-prompt/reference/output-contract.md +0 -72
  215. package/skills/structure-prompt/reference/per-category.md +0 -23
  216. package/skills/structure-prompt/reference/persona.md +0 -38
  217. package/skills/structure-prompt/reference/research.md +0 -33
  218. package/skills/structure-prompt/reference/structure.md +0 -28
  219. package/skills/verified-build/CLAUDE.md +0 -33
  220. package/skills/verified-build/SKILL.md +0 -33
@@ -57,12 +57,12 @@ First match wins; respond with the quoted line exactly and stop:
57
57
 
58
58
  Every internal audit pass (CLEAN or DIRTY) ends with one posted GitHub PR
59
59
  review; the mandate applies whether bugteam runs inside `/pr-converge` or
60
- standalone. Apply the `post-audit-findings` skill
61
- ([../post-audit-findings/SKILL.md](../post-audit-findings/SKILL.md)) with
62
- `--skill bugteam`: it covers the findings-JSON mapping (the `failure_mode`
63
- split at the literal `Fix:` heading), the anchored-vs-unanchored partition,
64
- the `post_audit_thread.py` invocation, the self-PR reviewer toggle
65
- (`BUGTEAM_REVIEWER_ACCOUNT`), the exit codes, and the id harvest.
60
+ standalone. Run the shared posting helper
61
+ [`_shared/pr-loop/scripts/post_audit_thread.py`](../../_shared/pr-loop/scripts/post_audit_thread.py)
62
+ with `--skill bugteam`: map findings to the review-comment JSON (the
63
+ `failure_mode` split at the literal `Fix:` heading), partition anchored from
64
+ unanchored comments, honor the self-PR reviewer toggle
65
+ (`BUGTEAM_REVIEWER_ACCOUNT`) and the exit codes, and harvest the ids.
66
66
 
67
67
  Bugteam-only obligations:
68
68
 
@@ -72,9 +72,9 @@ Bugteam-only obligations:
72
72
  thread_node_id}` triple into `loop_comment_index` (per-loop scope; see
73
73
  [reference/team-setup.md](reference/team-setup.md) § Loop state block) so
74
74
  the matching FIX action owns the reply-and-resolve unit.
75
- - Exit 2 from `post_audit_thread.py` is a hard blocker: the lead halts the
76
- loop and exits `error: post_audit_thread retry exhausted` without
77
- retrying.
75
+ - Exit-code policy: the bugteam row in
76
+ [`../../_shared/pr-loop/post-audit-thread-contract.md`](../../_shared/pr-loop/post-audit-thread-contract.md)
77
+ § Per-caller policy.
78
78
 
79
79
  ## Progress checklist
80
80
 
@@ -83,10 +83,9 @@ Bugteam-only obligations:
83
83
  [ ] Step 1: PR scope resolved
84
84
  [ ] Step 2: loop state set
85
85
  [ ] Step 3: cycle complete (converged | cap reached | stuck | error)
86
- [ ] Step 4: working tree clean
87
- [ ] Step 4.5: PR description rewritten (or skip warning logged)
88
- [ ] Step 5: project permissions revoked
89
- [ ] Step 6: final report printed
86
+ [ ] Step 4: apply pr-loop-lifecycle Close
87
+ Skill({skill: "pr-loop-lifecycle", args: "--skill bugteam close"})
88
+ (see pr-loop-lifecycle/SKILL.md "How callers invoke this")
90
89
  ```
91
90
 
92
91
  ## First invocation of a session
@@ -104,7 +103,7 @@ end-to-end mental model before starting Step 0.
104
103
  | `--bugbot-retrigger` flag behavior | [reference/team-setup.md](reference/team-setup.md) |
105
104
  | AUDIT action and code-rules pre-audit gate, pre-cycle walk, cycle decision tree | [reference/audit-and-teammates.md](reference/audit-and-teammates.md) |
106
105
  | FIX action and verify-push semantics | [reference/audit-and-teammates.md](reference/audit-and-teammates.md) |
107
- | Posting the end-of-pass audit review (APPROVE on CLEAN, REQUEST_CHANGES with inline anchored comments on DIRTY) | [§ Audit posting](#audit-posting), which applies [../post-audit-findings/SKILL.md](../post-audit-findings/SKILL.md) |
106
+ | Posting the end-of-pass audit review (APPROVE on CLEAN, REQUEST_CHANGES with inline anchored comments on DIRTY) | [§ Audit posting](#audit-posting), which runs [`_shared/pr-loop/scripts/post_audit_thread.py`](../../_shared/pr-loop/scripts/post_audit_thread.py) |
108
107
  | Posting per-finding fix replies via GitHub MCP `add_reply_to_pull_request_comment` (rendered with the unified template at [`_shared/pr-loop/audit-reply-template.md`](../../_shared/pr-loop/audit-reply-template.md)) | [reference/github-pr-reviews.md](reference/github-pr-reviews.md) |
109
108
  | Teardown, PR description rewrite composed by the lead, permission revoke, final report | [../pr-loop-lifecycle/reference/teardown-publish-permissions.md](../pr-loop-lifecycle/reference/teardown-publish-permissions.md) |
110
109
  | Spawn-prompt XML, A–P category bindings, outcome XML schemas | [PROMPTS.md](PROMPTS.md) |
@@ -7,7 +7,7 @@ Expanded workflow detail for the `bugteam` skill. Load a file from this director
7
7
  | File | Purpose |
8
8
  |---|---|
9
9
  | `README.md` | Index of all files in this directory with one-line domain summaries. |
10
- | `team-setup.md` | Permissions grant, PR scope resolution (applies the `pr-scope-resolve` skill), run name, temp dir, and loop state. |
10
+ | `team-setup.md` | Permissions grant, PR scope resolution, run name, temp dir, and loop state. |
11
11
  | `audit-and-teammates.md` | Pre-audit CODE_RULES gate, full cycle numbering, AUDIT and FIX action detail. |
12
12
  | `github-pr-reviews.md` | Per-loop review posting, `jq`+`gh api` payloads, inline anchors, fallbacks, REST endpoints. |
13
13
  | `design-rationale.md` | Why clean-room subagents, when `/bugteam` applies, refusal reasons. |
@@ -153,7 +153,7 @@ Agent(
153
153
 
154
154
  The teammate sees only the latest audit’s findings — each `Agent` call starts with a fresh context window; prior-loop findings, fix history, and chat stay in the lead.
155
155
 
156
- Pass finding comment URL, comment id, and thread node id for each finding (from `loop_comment_index`) in the XML prompt so the teammate owns both the reply and the thread resolution. After commit, the teammate posts one reply per finding using the unified template at [`../../../_shared/pr-loop/audit-reply-template.md`](../../../_shared/pr-loop/audit-reply-template.md) — the full header / horizontal rule / `<action_heading> ✅` / explanation / anchored-bullet / closing-paragraph skeleton, with `<status_line>` set per the path (`Fixed in <short_sha>` for `status=fixed`, `Could not address this loop` for `status=could_not_address`, `Hook blocked the fix commit` for `status=hook_blocked`). Per-thread reply and `resolve_thread` are atomic; the mechanics follow the `pr-fix-protocol` skill ([`../../pr-fix-protocol/SKILL.md`](../../pr-fix-protocol/SKILL.md)), which frames the shared 13-step sequence in [`../../../_shared/pr-loop/fix-protocol.md`](../../../_shared/pr-loop/fix-protocol.md) (step 12 carries the exact reply-and-resolve sequence). Same identity model as bugfind: teammate posts; lead waits.
156
+ Pass finding comment URL, comment id, and thread node id for each finding (from `loop_comment_index`) in the XML prompt so the teammate owns both the reply and the thread resolution. After commit, the teammate posts one reply per finding using the unified template at [`../../../_shared/pr-loop/audit-reply-template.md`](../../../_shared/pr-loop/audit-reply-template.md) — the full header / horizontal rule / `<action_heading> ✅` / explanation / anchored-bullet / closing-paragraph skeleton, with `<status_line>` set per the path (`Fixed in <short_sha>` for `status=fixed`, `Could not address this loop` for `status=could_not_address`, `Hook blocked the fix commit` for `status=hook_blocked`). Per-thread reply and `resolve_thread` are atomic; the mechanics follow the shared 13-step sequence in [`../../../_shared/pr-loop/fix-protocol.md`](../../../_shared/pr-loop/fix-protocol.md) (step 12 carries the exact reply-and-resolve sequence). Same identity model as bugfind: teammate posts; lead waits.
157
157
 
158
158
  After replies, the teammate writes outcome XML (schema in [`../PROMPTS.md`](../PROMPTS.md)).
159
159
 
@@ -161,7 +161,7 @@ After replies, the teammate writes outcome XML (schema in [`../PROMPTS.md`](../P
161
161
 
162
162
  Same self-termination model as bugfind. Missing notification → hard blocker.
163
163
 
164
- `approve: false` → `error: bugfix teammate refused shutdown` → Step 4 then 5.
164
+ `approve: false` → `error: bugfix teammate refused shutdown` → Step 4 (`pr-loop-lifecycle` Close).
165
165
 
166
166
  Substitute placeholders from `last_findings` into the fix prompt per [`../PROMPTS.md`](../PROMPTS.md). The spawn XML includes TaskCreate/self_audit_checklist for task tracking — the FIX subagent MUST create tasks before starting.
167
167
 
@@ -1,5 +1,7 @@
1
1
  # Copilot gap analysis
2
2
 
3
+ > **Of-record gate location:** skill-local `bugteam_code_rules_gate.py` is a thin re-export. The of-record implementation is `_shared/pr-loop/scripts/code_rules_gate.py`.
4
+
3
5
  > **Status: HISTORICAL — patch plan partially superseded.**
4
6
  >
5
7
  > This file documents the read-only investigation that motivated the K–N rubric addendum and the Step 2.6 / Step 3.5 standards-review phases. **The audit-rubric portion of the patch plan was reverted in [PR #292](https://github.com/jl-cmd/claude-dev-env/pull/292):** PROMPTS.md no longer carries the K–N addendum or the `<copilot_derived_addendum_source>` block, and SKILL.md no longer runs the Step 2.6 / Step 3.5 standards-review phases.
@@ -1,13 +1,15 @@
1
- # GitHub PR comments
1
+ # GitHub PR comments (bugteam-only)
2
2
 
3
- Per-loop pull-request reviews and post-fix replies use two distinct transports:
3
+ Transport, exit codes, retry/backoff, and payload shapes live in
4
+ [`../../../_shared/pr-loop/gh-payloads.md`](../../../_shared/pr-loop/gh-payloads.md)
5
+ and
6
+ [`post_audit_thread.py`](../../../_shared/pr-loop/scripts/post_audit_thread.py).
7
+ Read those for how the review POST runs; this file covers only bugteam lead and
8
+ FIX behavior around that transport.
4
9
 
5
- - **Per-loop audit review** posted via [`post_audit_thread.py`](../../../_shared/pr-loop/scripts/post_audit_thread.py). One review per audit pass. `APPROVE` on CLEAN (the request event; GitHub stores it as `state=APPROVED`; body documents "no findings", zero inline comments). `REQUEST_CHANGES` on DIRTY (one inline anchored comment per finding; each becomes its own resolvable thread).
6
- - **Fix replies** — posted via the GitHub MCP `add_reply_to_pull_request_comment` after the fix commit lands. The reply body uses the unified template at [`../../../_shared/pr-loop/audit-reply-template.md`](../../../_shared/pr-loop/audit-reply-template.md); reply and `resolve_thread` are atomic per thread.
10
+ ## Lead posts the audit review
7
11
 
8
- ## Per-loop audit review (post_audit_thread.py)
9
-
10
- Run the script at the end of every audit pass:
12
+ The lead runs `post_audit_thread.py` at the end of every audit pass:
11
13
 
12
14
  ```
13
15
  python "${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/post_audit_thread.py" \
@@ -20,23 +22,55 @@ python "${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/post_audit_thread.py"
20
22
  --findings-json <path>
21
23
  ```
22
24
 
23
- Capture `<head_sha>` via `git rev-parse HEAD` in the subagent cwd immediately before this call so the review attaches to the commit the audit actually scoped.
25
+ Capture `<head_sha>` via `git rev-parse HEAD` in the subagent cwd immediately
26
+ before this call so the review attaches to the commit the audit actually scoped.
27
+
28
+ - **CLEAN** — `APPROVE` event (GitHub stores `state=APPROVED`); body documents
29
+ "no findings"; empty findings list (`[]`); zero inline comments.
30
+ - **DIRTY** — `REQUEST_CHANGES`; one inline anchored comment per finding (each
31
+ becomes its own resolvable thread).
32
+
33
+ ## Findings JSON (Shape A `Fix:` split)
34
+
35
+ `--findings-json` is a JSON list of
36
+ `{path, line, side, severity, description, fix_summary}`. Build it from the
37
+ merged Shape A findings: finding `file` → `path`. Each finding's `failure_mode`
38
+ carries the full audit-to-fix handoff text per
39
+ [`agents/code-quality-agent.md`](../../../agents/code-quality-agent.md); split
40
+ `failure_mode` at the literal `Fix:` heading so the failure narrative becomes
41
+ `description` and the suffix beginning at `Fix:` (including the trailing
42
+ `Validation:` clause) becomes `fix_summary`. When a finding's `failure_mode`
43
+ omits the `Fix:` heading, write the full text to BOTH `description` and
44
+ `fix_summary`. Set `side="RIGHT"` for every entry.
24
45
 
25
- `--findings-json` points to a JSON file whose root is a list of objects shaped `{path, line, side, severity, description, fix_summary}`. Build it from the merged Shape A findings: finding `file` → `path`. Each finding's `failure_mode` carries the full audit-to-fix handoff text per [`agents/code-quality-agent.md`](../../../agents/code-quality-agent.md); split `failure_mode` at the literal `Fix:` heading so the failure narrative becomes `description` and the suffix beginning at `Fix:` (including the trailing `Validation:` clause) becomes `fix_summary`. When a finding's `failure_mode` omits the `Fix:` heading, write the full text to BOTH `description` and `fix_summary` so the script's body template (`INLINE_COMMENT_BODY_TEMPLATE` in [`packages/claude-dev-env/_shared/pr-loop/scripts/pr_loop_shared_constants/post_audit_thread_constants.py`](../../../_shared/pr-loop/scripts/pr_loop_shared_constants/post_audit_thread_constants.py)) renders coherently. Set `side="RIGHT"` for every entry. On CLEAN the list is empty (`[]`); on DIRTY the list carries one entry per finding.
46
+ ## Anchor validation before JSON
26
47
 
27
- The script handles retries internally 1s / 4s / 16s backoff across four attempts (one initial plus three retries). Exit codes:
48
+ Validate `(path, line)` against the captured diff before adding a finding to the
49
+ findings JSON. GitHub rejects the entire review POST when any inline comment
50
+ targets a line missing from the diff at `--commit`. Findings without a diff
51
+ anchor stay out of the JSON; surface them in the calling skill's user-facing
52
+ output so the audit pass still completes.
28
53
 
29
- - `0` review posted; the new review's `html_url` is on stdout.
30
- - `1` — user input error (bad arguments, malformed findings JSON, missing template).
31
- - `2` — retry exhaustion. Hard blocker; the lead exits `error: post_audit_thread retry exhausted` without retrying and without falling back to a flat issue comment.
54
+ ## FIX waits for harvest (`loop_comment_index`)
32
55
 
33
- Harvest the parent review URL from stdout, then extract the numeric review id from the URL's `#pullrequestreview-<id>` suffix (the trailing URL fragment of `html_url`, the part after `#`). Fetch child-comment URLs via `pull_request_read(method="get_review_comments", owner=<owner>, repo=<repo>, pullNumber=<N>)` filtered to that review id. That same response carries each comment's PR review thread node id (e.g. `PRRT_kwDOxxx`) — capture it alongside the numeric comment id. Match children to findings in the order they appear in the findings JSON, and store the mapping as `loop_comment_index[finding_id]` carrying both `finding_comment_id` (numeric) and `thread_node_id` (`PRRT_kwDOxxx`) for the FIX step to reply against and resolve.
56
+ FIX does not reply until harvest completes. After a successful post:
34
57
 
35
- The script reads its body skeleton from [`../../../_shared/pr-loop/audit-reply-template.md`](../../../_shared/pr-loop/audit-reply-template.md) at runtime, so the template doc remains the single source of truth for the body shape edits there propagate without restarting the caller.
58
+ 1. Read the parent review URL from stdout; extract the numeric review id from
59
+ the `#pullrequestreview-<id>` suffix.
60
+ 2. Fetch child comments via
61
+ `pull_request_read(method="get_review_comments", ...)` filtered to that
62
+ review id.
63
+ 3. Capture each comment's PR review thread node id (`PRRT_kwDOxxx`) alongside
64
+ the numeric comment id.
65
+ 4. Match children to findings in findings-JSON order; store
66
+ `loop_comment_index[finding_id]` with `finding_comment_id` (numeric) and
67
+ `thread_node_id` (`PRRT_kwDOxxx`).
36
68
 
37
- ## Fix reply (MCP)
69
+ ## Atomic reply + resolve
38
70
 
39
- After the fix commit lands, post one reply per finding thread and resolve the thread atomically.
71
+ After the fix commit lands, post one reply per finding thread and resolve that
72
+ thread as one atomic action. Do not yield to the lead between the two calls. Do
73
+ not batch all replies before any resolves.
40
74
 
41
75
  ```
42
76
  mcp__plugin_github_github__add_reply_to_pull_request_comment(
@@ -46,13 +80,7 @@ mcp__plugin_github_github__add_reply_to_pull_request_comment(
46
80
  commentId=<finding_comment_id>,
47
81
  body="<reply body using unified template>"
48
82
  )
49
- ```
50
-
51
- The reply body uses the unified template from [`../../../_shared/pr-loop/audit-reply-template.md`](../../../_shared/pr-loop/audit-reply-template.md). Per-status `<status_line>` / `<action_heading>` values live in [`../PROMPTS.md`](../PROMPTS.md) § FIX execution step 8.
52
-
53
- Immediately after the reply call returns, resolve the same thread:
54
83
 
55
- ```
56
84
  mcp__plugin_github_github__pull_request_review_write(
57
85
  method="resolve_thread",
58
86
  owner="<owner>",
@@ -62,18 +90,8 @@ mcp__plugin_github_github__pull_request_review_write(
62
90
  )
63
91
  ```
64
92
 
65
- `<thread_node_id>` is the PR review thread node ID (`PRRT_kwDOxxx`) harvested above when calling `get_review_comments`, distinct from the numeric comment ID used in the reply call. See [obstacles/fix-resolve-thread.md](obstacles/fix-resolve-thread.md) for the full identifier-shape rationale.
66
-
67
- The two calls form one atomic per-thread action. Do not yield to the lead between them. Do not batch all replies before any resolves.
68
-
69
- ## Anchor validation
70
-
71
- GitHub's reviews endpoint rejects the entire POST if any inline comment in `comments[]` targets a line not present in the diff at `--commit`. Validate `(path, line)` against the captured diff before adding a finding to the findings JSON. Findings without a diff anchor stay out of the JSON; surface them in the calling skill's user-facing output instead so the audit pass still completes.
72
-
73
- ## GitHub MCP tools used
74
-
75
- - `add_reply_to_pull_request_comment` — fix replies on existing review comments.
76
- - `pull_request_review_write` (`method="resolve_thread"`) — thread resolution after the reply lands; called atomically with the reply.
77
- - `pull_request_read` (`method="get_review_comments"`) — harvest child-comment ids/urls after the script's parent review posts.
78
-
79
- Reference: https://github.com/github/github-mcp-server.
93
+ Reply body template:
94
+ [`../../../_shared/pr-loop/audit-reply-template.md`](../../../_shared/pr-loop/audit-reply-template.md).
95
+ Per-status `<status_line>` / `<action_heading>` values live in
96
+ [`../PROMPTS.md`](../PROMPTS.md) § FIX execution step 8. Identifier-shape
97
+ rationale: [obstacles/fix-resolve-thread.md](obstacles/fix-resolve-thread.md).
@@ -4,10 +4,12 @@
4
4
 
5
5
  ### Utility scripts
6
6
 
7
- Bugteam-specific utilities (preflight, fix_hookspath, grant, revoke) live in
8
- the skill-local [`scripts/`](../scripts/) directory. Shared utilities remain in
9
- [`_shared/pr-loop/scripts/`](../../_shared/pr-loop/scripts/) (run, do not paste
10
- into context). Utility scripts are **executed**, not loaded as primary context
7
+ Skill-path thin entries for preflight and fix_hookspath live in the skill-local
8
+ [`scripts/`](../scripts/) directory and delegate to package shared
9
+ [`_shared/pr-loop/scripts/`](../../_shared/pr-loop/scripts/). Shared homes for
10
+ grant, revoke, and code_rules_gate also live under `_shared/pr-loop/scripts/`
11
+ (run, do not paste into context). Utility scripts are **executed**, not loaded
12
+ as primary context
11
13
  ([`sources.md`](../sources.md) § Progressive disclosure and utility scripts).
12
14
 
13
15
  ```bash
@@ -60,16 +62,14 @@ python "${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/grant_project_claude_p
60
62
 
61
63
  The script reads `Path.cwd()` and writes idempotent allow rules into `~/.claude/settings.json`. Run from the project root. If it fails (non-zero exit), surface the error and stop — do not proceed without the grant.
62
64
 
63
- This is the **first** action of every `/bugteam` invocation, before any subagent spawn. The corresponding revoke runs at Step 5 regardless of how the cycle exits.
65
+ This is the **first** action of every `/bugteam` invocation, before any subagent spawn. The matching revoke runs inside Step 4 (`pr-loop-lifecycle` Close) regardless of how the cycle exits.
64
66
 
65
67
  ## Step 1 — Resolve PR scope (detail)
66
68
 
67
- Apply the `pr-scope-resolve` skill
68
- ([../../pr-scope-resolve/SKILL.md](../../pr-scope-resolve/SKILL.md)) with
69
- caller `bugteam`. Its resolution ladder hands back `owner`, `repo`, `number`,
70
- `head_ref`, `base_ref`, `url`, and `head_sha`; when no PR and no upstream
71
- diff exist, respond exactly `No PR or upstream diff. /bugteam needs a
72
- target.` and stop.
69
+ Resolve the PR scope for caller `bugteam`: from the current branch's open PR
70
+ (or an explicit PR argument), capture `owner`, `repo`, `number`, `head_ref`,
71
+ `base_ref`, `url`, and `head_sha`; when no PR and no upstream diff exist,
72
+ respond exactly `No PR or upstream diff. /bugteam needs a target.` and stop.
73
73
 
74
74
  Capture `<owner>/<repo>`, head branch, base branch, PR number, PR URL. This scope persists across every loop — `/bugteam` runs to completion from the single up-front confirmation.
75
75
 
@@ -6,9 +6,9 @@ Python scripts executed by the bugteam lead or teammates at runtime. These are n
6
6
 
7
7
  | File | Purpose |
8
8
  |---|---|
9
- | `bugteam_preflight.py` | Run pytest and optional `pre-commit` before the first loop. Skips pytest when `BUGTEAM_PREFLIGHT_SKIP=1` or no test files exist. |
10
- | `bugteam_fix_hookspath.py` | Auto-remediate a stale `core.hooksPath` override, set the canonical global value, re-run preflight. |
11
- | `bugteam_code_rules_gate.py` | Run `validate_content` from `code_rules_enforcer.py` on PR-scoped files. Exit 1 on mandatory rule failures. |
9
+ | `bugteam_preflight.py` | Skill-path thin entry for shared `_shared/pr-loop/scripts/preflight.py`. Skips pytest when `BUGTEAM_PREFLIGHT_SKIP=1` or no test files exist. |
10
+ | `bugteam_fix_hookspath.py` | Skill-path thin entry for shared `_shared/pr-loop/scripts/fix_hookspath.py`. Auto-remediates a stale `core.hooksPath` override. |
11
+ | `bugteam_code_rules_gate.py` | Thin skill-path entry; re-exports shared `_shared/pr-loop/scripts/code_rules_gate.py` (of record). |
12
12
  | `windows_safe_rmtree.py` | Remove a directory tree on Windows by stripping ReadOnly attributes and retrying on failure. |
13
13
  | `probe_code_rules_enforcer_check.py` | Load `code_rules_enforcer.py` and invoke a named check function against a fixture file. |
14
14
  | `reflow_skill_md.py` | Reflow the bugteam SKILL.md body to fit line-length limits. |
@@ -17,9 +17,9 @@ Python scripts executed by the bugteam lead or teammates at runtime. These are n
17
17
 
18
18
  | File | Tests |
19
19
  |---|---|
20
- | `test_bugteam_preflight.py` | `bugteam_preflight.py` |
21
- | `test_bugteam_code_rules_gate.py` | `bugteam_code_rules_gate.py` |
22
- | `test_bugteam_fix_hookspath.py` | `bugteam_fix_hookspath.py` |
20
+ | `test_bugteam_preflight.py` | Smoke for thin wrap; behavioral suite is `_shared/pr-loop/scripts/tests/test_preflight.py` |
21
+ | `test_bugteam_code_rules_gate.py` | Smoke for thin wrap; behavioral suite is `_shared/pr-loop/scripts/tests/test_code_rules_gate.py` |
22
+ | `test_bugteam_fix_hookspath.py` | Smoke for thin wrap; behavioral suite is `_shared/pr-loop/scripts/tests/test_fix_hookspath.py` |
23
23
  | `test_probe_code_rules_enforcer_check.py` | `probe_code_rules_enforcer_check.py` |
24
24
  | `test_windows_safe_rmtree.py` | `windows_safe_rmtree.py` |
25
25
 
@@ -4,14 +4,16 @@ Scripts in this directory are **executed** by the lead or teammates. They are no
4
4
 
5
5
  | Script | Purpose |
6
6
  |--------|---------|
7
- | `bugteam_preflight.py` | Run pytest (when configured) and optional `pre-commit` before `/bugteam`. |
8
- | `bugteam_fix_hookspath.py` | Auto-remediate a stale local `core.hooksPath` override, set canonical global value, re-run `bugteam_preflight.py`. Invoked by Claude when preflight reports a `core.hooksPath` failure. |
9
- | `bugteam_code_rules_gate.py` | Run `validate_content` from `code-rules-enforcer.py` on PR-scoped files (`git diff` vs merge-base). Exit `1` if any mandatory rule fails. Invoked **before each audit**; the fixer clears it before the auditor runs. |
10
- | `windows_safe_rmtree.py` | Recursively remove a directory tree on Windows by stripping ReadOnly attributes and retrying the failing syscall. Invoked from SKILL.md Step 4 to delete `<run_temp_dir>` after teardown. |
7
+ | `bugteam_preflight.py` | Run pytest (when configured) and optional `pre-commit` before `/bugteam`. Skill-path thin entry; implementation lives at package shared `_shared/pr-loop/scripts/preflight.py`. |
8
+ | `bugteam_fix_hookspath.py` | Auto-remediate a stale local `core.hooksPath` override, set canonical global value, re-run preflight. Skill-path thin entry; implementation lives at package shared `_shared/pr-loop/scripts/fix_hookspath.py`. Invoked by Claude when preflight reports a `core.hooksPath` failure. |
9
+ | `bugteam_code_rules_gate.py` | Thin skill-path entry that re-exports shared `_shared/pr-loop/scripts/code_rules_gate.py`. **Not the pre-audit gate of record** invoke the shared script for live pre-audit (see `reference/audit-and-teammates.md`). |
10
+ | `windows_safe_rmtree.py` | Windows-safe recursive directory removal (strips ReadOnly, retries). Standalone helper with unit tests; run-temp teardown is `skills/_shared/pr-loop/scripts/teardown_worktrees.py` under `pr-loop-lifecycle` Close. |
11
11
  | `probe_code_rules_enforcer_check.py` | Dynamically load `~/.claude/hooks/blocking/code_rules_enforcer.py` and invoke a named check function against a fixture file. Used by the historical Copilot gap-analysis investigation as a verification shape (see `reference/copilot-gap-analysis.md`). |
12
12
 
13
13
  ## `bugteam_preflight.py`
14
14
 
15
+ Skill-path thin entry; implementation lives at `_shared/pr-loop/scripts/preflight.py`.
16
+
15
17
  From the repository root:
16
18
 
17
19
  ```bash
@@ -25,6 +27,8 @@ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_preflight.py"
25
27
 
26
28
  ## `bugteam_fix_hookspath.py`
27
29
 
30
+ Skill-path thin entry; implementation lives at `_shared/pr-loop/scripts/fix_hookspath.py`.
31
+
28
32
  From the repository root:
29
33
 
30
34
  ```bash
@@ -35,13 +39,21 @@ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_fix_hookspath.py"
35
39
  - Sets `git config --global core.hooksPath ~/.claude/hooks/git-hooks` when the global value is unset or non-canonical.
36
40
  - Refuses to run (exit non-zero) when `~/.claude/hooks/git-hooks` does not exist on disk — install via `npx claude-dev-env .` first.
37
41
  - Idempotent: a second invocation is a clean no-op.
38
- - Re-runs `bugteam_preflight.py --no-pytest` and propagates its exit code.
42
+ - Re-runs package-shared `preflight.py --no-pytest` and propagates its exit code.
39
43
 
40
44
  The bugteam SKILL invokes this automatically when preflight stderr indicates a `core.hooksPath` failure, so Claude does not surface the error to the user.
41
45
 
42
- ## `bugteam_code_rules_gate.py`
46
+ ## `bugteam_code_rules_gate.py` (thin skill-path entry)
47
+
48
+ Skill-path thin entry; re-exports `main` from package-shared `_shared/pr-loop/scripts/code_rules_gate.py`.
49
+
50
+ **Not the pre-audit gate of record.** The live pre-audit gate is the package-shared script:
51
+
52
+ ```bash
53
+ python "${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/code_rules_gate.py" --base origin/<baseRefName>
54
+ ```
43
55
 
44
- From the repository root (same merge-base rules as the PR head vs base default `--base origin/main`):
56
+ See `reference/audit-and-teammates.md`. Keep this wrap for callers that still invoke the skill-local path.
45
57
 
46
58
  ```bash
47
59
  python "${CLAUDE_SKILL_DIR}/scripts/bugteam_code_rules_gate.py"
@@ -53,4 +65,4 @@ Optional explicit files instead of `git diff`:
53
65
  python "${CLAUDE_SKILL_DIR}/scripts/bugteam_code_rules_gate.py" path/to/a.py path/to/b.ts
54
66
  ```
55
67
 
56
- This loads `validate_content` from `hooks/blocking/code-rules-enforcer.py` inside `claude-dev-env` (same logic as the PreToolUse hook). Exit `0` = mandatory checks pass on scanned files; exit `1` = violations printed to stderr.
68
+ Both the wrap and the shared script load `validate_content` from `hooks/blocking/code_rules_enforcer.py` inside `claude-dev-env` (same logic as the PreToolUse hook). Exit `0` = mandatory checks pass on scanned files; exit `1` = violations printed to stderr.