claude-dev-env 4.3.0 → 7.0.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 (293) hide show
  1. package/.agents/agents/pr-description-writer.md +2 -2
  2. package/.agents/agents/test_agent_frontmatter.py +2 -2
  3. package/.agents/agents/test_pr_description_writer_style.py +1 -3
  4. package/.agents/skills/e-code-review/SKILL.md +12 -12
  5. package/.agents/skills/e-code-review/preflight-proposal.contract.test.mjs +20 -0
  6. package/.agents/skills/e-code-review/reference/fix.md +15 -17
  7. package/.agents/skills/e-code-review/reference/loop.md +35 -39
  8. package/.agents/skills/e-code-review/reference/mode-contract.test.mjs +2 -1
  9. package/.agents/skills/e-code-review/reference/preflight-proposal.md +44 -9
  10. package/.agents/skills/e-code-review/reference/runner-selection.md +13 -14
  11. package/.agents/skills/issue-tracker/SKILL.md +5 -4
  12. package/.agents/skills/pull-request/SKILL.md +11 -13
  13. package/.agents/skills/pull-request/reference/publication-tasks.md +3 -3
  14. package/.agents/skills/pull-request/scripts/github_pr_command_constants/config/constants.py +9 -1
  15. package/.agents/skills/pull-request/scripts/pull_request.py +33 -44
  16. package/.agents/skills/pull-request/scripts/test_github_pr_command_constants.py +9 -0
  17. package/.agents/skills/pull-request/scripts/test_pull_request.py +1 -3
  18. package/.agents/skills/skill-builder/SKILL.md +3 -196
  19. package/_shared/pr-loop/scripts/pr_loop_shared_constants/terminology_sweep_constants.py +6 -0
  20. package/_shared/pr-loop/scripts/terminology_sweep.py +64 -19
  21. package/_shared/pr-loop/scripts/tests/test_terminology_sweep.py +59 -0
  22. package/bin/install.agents-home.test.mjs +15 -13
  23. package/bin/install.mjs +28 -0
  24. package/bin/install.policy-lint.test.mjs +78 -0
  25. package/bin/install.prune.test.mjs +59 -20
  26. package/bin/install.pstack-plugin.test.mjs +114 -0
  27. package/bin/install.test.mjs +37 -0
  28. package/bin/refresh-pstack-plugin-skills.test.mjs +211 -0
  29. package/hooks/advisory/pr_done_reminder.py +342 -0
  30. package/hooks/advisory/test_pr_done_reminder.py +249 -0
  31. package/hooks/blocking/bash_post_call_dispatcher.py +53 -6
  32. package/hooks/blocking/code_rules_paired_test.py +22 -15
  33. package/hooks/blocking/test_bash_post_call_dispatcher.py +65 -4
  34. package/hooks/blocking/test_code_rules_enforcer_paired_test.py +36 -29
  35. package/hooks/blocking/test_code_rules_js_resume_task_enumeration.py +4 -4
  36. package/hooks/blocking/test_code_rules_js_returns_object_schemaless.py +5 -5
  37. package/hooks/blocking/test_pre_tool_use_dispatcher.py +68 -133
  38. package/hooks/blocking/test_pre_tool_use_dispatcher_native.py +20 -51
  39. package/hooks/blocking/test_precommit_code_rules_gate_native_owner.py +18 -18
  40. package/hooks/git-hooks/git_hooks_constants/staged_policy_lint.py +12 -0
  41. package/hooks/git-hooks/pre_commit.py +52 -11
  42. package/hooks/git-hooks/test_installed_policy_lint.py +159 -0
  43. package/hooks/git-hooks/test_native_policy_commit.py +87 -0
  44. package/hooks/git-hooks/test_pre_commit.py +246 -0
  45. package/hooks/hooks.json +1 -1
  46. package/hooks/hooks_constants/bash_post_call_dispatcher_constants.py +14 -1
  47. package/hooks/hooks_constants/pr_done_reminder_constants.py +98 -0
  48. package/hooks/hooks_constants/pre_tool_use_dispatcher_constants.py +10 -43
  49. package/hooks/hooks_constants/test_bash_post_call_dispatcher_constants.py +19 -2
  50. package/hooks/hooks_constants/test_pr_done_reminder_constants.py +40 -0
  51. package/hooks/hooks_constants/test_pre_tool_use_dispatcher_constants.py +20 -32
  52. package/package.json +2 -2
  53. package/rules/durable-post-artifacts.md +2 -1
  54. package/rules/git-workflow.md +6 -6
  55. package/scripts/check.ps1 +0 -1
  56. package/{.agents/skills/run-claude-dev-env/driver.mjs → scripts/ci/installer-lifecycle.mjs} +3 -28
  57. package/scripts/ci/installer-lifecycle.test.mjs +26 -0
  58. package/scripts/ci/windows-installer-lifecycle.ps1 +1 -11
  59. package/scripts/dev_env_scripts_constants/shared_tree_constants.py +4 -5
  60. package/{.agents/skills/_shared/pr-loop/scripts → scripts}/durable_post_lint.py +5 -41
  61. package/{.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/durable_post_lint_constants.py → scripts/durable_post_lint_config/config/constants.py} +0 -10
  62. package/{.agents/skills/_shared/pr-loop/scripts/test_durable_post_lint_constants.py → scripts/durable_post_lint_config/config/test_constants.py} +1 -1
  63. package/scripts/policy_lint/adapter_detectors.py +13 -6
  64. package/scripts/policy_lint/adapters.py +7 -4
  65. package/scripts/policy_lint/config/constants.py +5 -0
  66. package/scripts/policy_lint/engine.py +48 -4
  67. package/scripts/policy_lint/model.py +1 -0
  68. package/scripts/policy_lint/registry.py +1 -1
  69. package/scripts/policy_lint/selection.py +2 -1
  70. package/scripts/policy_lint/selection_git.py +2 -0
  71. package/scripts/refresh_pstack_plugin_skills.mjs +200 -0
  72. package/scripts/shared_tree_paths.py +32 -3
  73. package/scripts/test_shared_tree_paths.py +33 -0
  74. package/scripts/tests/test_policy_lint_rules_archive.py +120 -0
  75. package/scripts/tests/test_policy_lint_rules_engine.py +25 -4
  76. package/scripts/tests/test_policy_lint_rules_installed_loader.py +29 -0
  77. package/scripts/tests/test_policy_lint_rules_registry.py +227 -13
  78. package/scripts/tests/test_policy_lint_selection.py +25 -2
  79. package/scripts/tests/test_policy_lint_selection_native_index.py +30 -0
  80. package/scripts/tests/test_rules.py +3 -7
  81. package/.agents/skills/_shared/pr-loop/.claude/CLAUDE.md +0 -1
  82. package/.agents/skills/_shared/pr-loop/AGENTS.md +0 -1
  83. package/.agents/skills/_shared/pr-loop/audit-contract.md +0 -5
  84. package/.agents/skills/_shared/pr-loop/audit-reply-template.md +0 -5
  85. package/.agents/skills/_shared/pr-loop/code-rules-gate.md +0 -5
  86. package/.agents/skills/_shared/pr-loop/fix-protocol.md +0 -5
  87. package/.agents/skills/_shared/pr-loop/gh-payloads.md +0 -5
  88. package/.agents/skills/_shared/pr-loop/portable-driver.md +0 -149
  89. package/.agents/skills/_shared/pr-loop/post-audit-thread-contract.md +0 -5
  90. package/.agents/skills/_shared/pr-loop/precatch-rubric.md +0 -5
  91. package/.agents/skills/_shared/pr-loop/preflight-proposal.contract.test.mjs +0 -119
  92. package/.agents/skills/_shared/pr-loop/preflight-proposal.md +0 -5
  93. package/.agents/skills/_shared/pr-loop/prompts/.claude/CLAUDE.md +0 -1
  94. package/.agents/skills/_shared/pr-loop/prompts/AGENTS.md +0 -1
  95. package/.agents/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml +0 -324
  96. package/.agents/skills/_shared/pr-loop/scripts/.claude/CLAUDE.md +0 -1
  97. package/.agents/skills/_shared/pr-loop/scripts/AGENTS.md +0 -1
  98. package/.agents/skills/_shared/pr-loop/scripts/RUNTIME_SCRIPTS.md +0 -29
  99. package/.agents/skills/_shared/pr-loop/scripts/_cli_utils.py +0 -22
  100. package/.agents/skills/_shared/pr-loop/scripts/_path_resolver.py +0 -186
  101. package/.agents/skills/_shared/pr-loop/scripts/_xml_utils.py +0 -20
  102. package/.agents/skills/_shared/pr-loop/scripts/audit_category_schema.py +0 -355
  103. package/.agents/skills/_shared/pr-loop/scripts/build_audit_prompt.py +0 -289
  104. package/.agents/skills/_shared/pr-loop/scripts/build_converge_task_list.py +0 -310
  105. package/.agents/skills/_shared/pr-loop/scripts/build_fix_prompt.py +0 -292
  106. package/.agents/skills/_shared/pr-loop/scripts/init_loop_state.py +0 -134
  107. package/.agents/skills/_shared/pr-loop/scripts/portable_converge_driver.py +0 -1646
  108. package/.agents/skills/_shared/pr-loop/scripts/preflight_worktree.py +0 -392
  109. package/.agents/skills/_shared/pr-loop/scripts/select_converge_pacer.py +0 -215
  110. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/.claude/CLAUDE.md +0 -1
  111. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/AGENTS.md +0 -1
  112. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/__init__.py +0 -0
  113. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/audit_category_schema_constants.py +0 -37
  114. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/converge_task_list_constants.py +0 -56
  115. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/handoff_constants.py +0 -45
  116. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/pacer_constants.py +0 -47
  117. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/path_resolver_constants.py +0 -157
  118. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/portable_driver_constants.py +0 -177
  119. package/.agents/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/preflight_constants.py +0 -70
  120. package/.agents/skills/_shared/pr-loop/scripts/teardown_worktrees.py +0 -172
  121. package/.agents/skills/_shared/pr-loop/scripts/test__path_resolver.py +0 -106
  122. package/.agents/skills/_shared/pr-loop/scripts/test_audit_category_schema.py +0 -94
  123. package/.agents/skills/_shared/pr-loop/scripts/test_build_audit_prompt.py +0 -499
  124. package/.agents/skills/_shared/pr-loop/scripts/test_build_converge_task_list.py +0 -140
  125. package/.agents/skills/_shared/pr-loop/scripts/test_build_fix_prompt.py +0 -262
  126. package/.agents/skills/_shared/pr-loop/scripts/test_init_loop_state.py +0 -71
  127. package/.agents/skills/_shared/pr-loop/scripts/test_portable_converge_driver.py +0 -1119
  128. package/.agents/skills/_shared/pr-loop/scripts/test_preflight_worktree.py +0 -287
  129. package/.agents/skills/_shared/pr-loop/scripts/test_select_converge_pacer.py +0 -207
  130. package/.agents/skills/_shared/pr-loop/scripts/test_teardown_worktrees.py +0 -59
  131. package/.agents/skills/_shared/pr-loop/scripts/test_write_handoff.py +0 -201
  132. package/.agents/skills/_shared/pr-loop/scripts/write_audit_outcomes.py +0 -182
  133. package/.agents/skills/_shared/pr-loop/scripts/write_fix_outcomes.py +0 -206
  134. package/.agents/skills/_shared/pr-loop/scripts/write_handoff.py +0 -309
  135. package/.agents/skills/_shared/pr-loop/state-schema.md +0 -5
  136. package/.agents/skills/_shared/pr-loop/worker-spawn.md +0 -5
  137. package/.agents/skills/autoconverge/.claude/CLAUDE.md +0 -1
  138. package/.agents/skills/autoconverge/AGENTS.md +0 -1
  139. package/.agents/skills/autoconverge/SKILL.md +0 -431
  140. package/.agents/skills/autoconverge/reference/.claude/CLAUDE.md +0 -1
  141. package/.agents/skills/autoconverge/reference/AGENTS.md +0 -1
  142. package/.agents/skills/autoconverge/reference/closing-report.md +0 -93
  143. package/.agents/skills/autoconverge/reference/convergence-gates.md +0 -31
  144. package/.agents/skills/autoconverge/reference/convergence.md +0 -219
  145. package/.agents/skills/autoconverge/reference/copilot-findings.md +0 -51
  146. package/.agents/skills/autoconverge/reference/gotchas.md +0 -66
  147. package/.agents/skills/autoconverge/reference/headless-safety.md +0 -44
  148. package/.agents/skills/autoconverge/reference/multi-pr.md +0 -128
  149. package/.agents/skills/autoconverge/reference/self-closing-loop.md +0 -84
  150. package/.agents/skills/autoconverge/reference/stop-conditions.md +0 -127
  151. package/.agents/skills/autoconverge/test_portable_pacer_gate.py +0 -54
  152. package/.agents/skills/autoconverge/workflow/.claude/CLAUDE.md +0 -1
  153. package/.agents/skills/autoconverge/workflow/AGENTS.md +0 -1
  154. package/.agents/skills/autoconverge/workflow/aggregate_runs.py +0 -371
  155. package/.agents/skills/autoconverge/workflow/autoconverge_report_constants/.claude/CLAUDE.md +0 -1
  156. package/.agents/skills/autoconverge/workflow/autoconverge_report_constants/AGENTS.md +0 -1
  157. package/.agents/skills/autoconverge/workflow/autoconverge_report_constants/__init__.py +0 -0
  158. package/.agents/skills/autoconverge/workflow/autoconverge_report_constants/render_report_constants.py +0 -250
  159. package/.agents/skills/autoconverge/workflow/converge.clean-audit.test.mjs +0 -665
  160. package/.agents/skills/autoconverge/workflow/converge.codex-gate.test.mjs +0 -472
  161. package/.agents/skills/autoconverge/workflow/converge.contract.test.mjs +0 -64
  162. package/.agents/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +0 -1009
  163. package/.agents/skills/autoconverge/workflow/converge.fix-progress.test.mjs +0 -107
  164. package/.agents/skills/autoconverge/workflow/converge.fix-recovery.test.mjs +0 -33
  165. package/.agents/skills/autoconverge/workflow/converge.merge-conflict.test.mjs +0 -15
  166. package/.agents/skills/autoconverge/workflow/converge.mjs +0 -3132
  167. package/.agents/skills/autoconverge/workflow/converge.p2-advance.test.mjs +0 -202
  168. package/.agents/skills/autoconverge/workflow/converge.path-aware.test.mjs +0 -47
  169. package/.agents/skills/autoconverge/workflow/converge.precatch.test.mjs +0 -152
  170. package/.agents/skills/autoconverge/workflow/converge.run-input.test.mjs +0 -116
  171. package/.agents/skills/autoconverge/workflow/converge_multi.mjs +0 -169
  172. package/.agents/skills/autoconverge/workflow/converge_multi.run-input.test.mjs +0 -173
  173. package/.agents/skills/autoconverge/workflow/convergence_summary.py +0 -110
  174. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-a11d903476b803493.jsonl +0 -2
  175. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-a26213978adeef6fb.jsonl +0 -2
  176. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-a3def0d15ed9d9110.jsonl +0 -2
  177. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-a41f41b1b708ee3b7.jsonl +0 -2
  178. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-a758b880abecc3ff7.jsonl +0 -2
  179. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-a8897b89656b1bd16.jsonl +0 -2
  180. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-ab1c2d3e4f5a6b7c8.jsonl +0 -2
  181. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-abd463d744a1437bc.jsonl +0 -2
  182. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/subagents/workflows/wf_881252e6-700/agent-ad19d027ae8ee1816.jsonl +0 -2
  183. package/.agents/skills/autoconverge/workflow/fixtures/wf_run/workflows/wf_881252e6-700.json +0 -266
  184. package/.agents/skills/autoconverge/workflow/render_report.py +0 -1024
  185. package/.agents/skills/autoconverge/workflow/test_aggregate_runs.py +0 -134
  186. package/.agents/skills/autoconverge/workflow/test_convergence_summary.py +0 -149
  187. package/.agents/skills/autoconverge/workflow/test_render_report.py +0 -812
  188. package/.agents/skills/hitl/SKILL.md +0 -45
  189. package/.agents/skills/pr-cleanup/SKILL.md +0 -140
  190. package/.agents/skills/pr-cleanup/reference/process-inventory.md +0 -17
  191. package/.agents/skills/pr-cleanup/reference/task-seeds.md +0 -22
  192. package/.agents/skills/pr-name-by-capability/SKILL.md +0 -73
  193. package/.agents/skills/pr-name-by-capability/reference/fetch-commands.md +0 -29
  194. package/.agents/skills/pr-name-by-capability/reference/offense-examples.md +0 -32
  195. package/.agents/skills/pr-name-by-capability/reference/report-template.md +0 -29
  196. package/.agents/skills/pr-name-by-capability/reference/rule-checklist.md +0 -38
  197. package/.agents/skills/pr-name-by-capability/reference/task-seeds.md +0 -10
  198. package/.agents/skills/pr-plain-language-cleanup/SKILL.md +0 -93
  199. package/.agents/skills/pr-refinement/SKILL.md +0 -31
  200. package/.agents/skills/pr-shared-extraction/SKILL.md +0 -177
  201. package/.agents/skills/pr-shared-extraction/reference/examples.md +0 -46
  202. package/.agents/skills/pr-shared-extraction/reference/offense-taxonomy.md +0 -100
  203. package/.agents/skills/pr-small-cl/SKILL.md +0 -52
  204. package/.agents/skills/pr-title-description/SKILL.md +0 -96
  205. package/.agents/skills/prototype/SKILL.md +0 -85
  206. package/.agents/skills/prototype/reference/honest-limitations.md +0 -23
  207. package/.agents/skills/prototype/reference/promotion-tasks.md +0 -23
  208. package/.agents/skills/prototype/scripts/build_sandbox_settings.py +0 -249
  209. package/.agents/skills/prototype/scripts/conftest.py +0 -15
  210. package/.agents/skills/prototype/scripts/launch_sandbox.py +0 -205
  211. package/.agents/skills/prototype/scripts/probe_sandbox_safety.py +0 -311
  212. package/.agents/skills/prototype/scripts/prototype_scripts_constants/__init__.py +0 -1
  213. package/.agents/skills/prototype/scripts/prototype_scripts_constants/config/__init__.py +0 -0
  214. package/.agents/skills/prototype/scripts/prototype_scripts_constants/config/build_sandbox_settings_constants.py +0 -41
  215. package/.agents/skills/prototype/scripts/prototype_scripts_constants/config/launch_sandbox_constants.py +0 -23
  216. package/.agents/skills/prototype/scripts/prototype_scripts_constants/config/probe_sandbox_safety_constants.py +0 -45
  217. package/.agents/skills/prototype/scripts/prototype_scripts_constants/config/prototype_common_constants.py +0 -10
  218. package/.agents/skills/prototype/scripts/test_build_sandbox_settings.py +0 -275
  219. package/.agents/skills/prototype/scripts/test_launch_sandbox.py +0 -303
  220. package/.agents/skills/prototype/scripts/test_probe_sandbox_safety.py +0 -312
  221. package/.agents/skills/prototype/workflows/promotion.md +0 -25
  222. package/.agents/skills/prototype/workflows/sandbox.md +0 -35
  223. package/.agents/skills/rebase/.claude/CLAUDE.md +0 -1
  224. package/.agents/skills/rebase/AGENTS.md +0 -1
  225. package/.agents/skills/rebase/SKILL.md +0 -178
  226. package/.agents/skills/review-router/SKILL.md +0 -51
  227. package/.agents/skills/review-router/reference/route-policy.json +0 -7
  228. package/.agents/skills/review-router/reference/task-seeds.md +0 -1
  229. package/.agents/skills/review-router/scripts/conftest.py +0 -4
  230. package/.agents/skills/review-router/scripts/review_router.py +0 -50
  231. package/.agents/skills/review-router/scripts/review_router_cli.py +0 -211
  232. package/.agents/skills/review-router/scripts/review_router_constants/__init__.py +0 -1
  233. package/.agents/skills/review-router/scripts/review_router_constants/config/__init__.py +0 -0
  234. package/.agents/skills/review-router/scripts/review_router_constants/config/constants.py +0 -13
  235. package/.agents/skills/review-router/scripts/test_review_router.py +0 -23
  236. package/.agents/skills/review-router/scripts/test_review_router_cli.py +0 -47
  237. package/.agents/skills/review-tier/SKILL.md +0 -56
  238. package/.agents/skills/review-tier/reference/task-seeds.md +0 -1
  239. package/.agents/skills/review-tier/reference/tier-policy.json +0 -9
  240. package/.agents/skills/review-tier/scripts/conftest.py +0 -4
  241. package/.agents/skills/review-tier/scripts/review_tier.py +0 -359
  242. package/.agents/skills/review-tier/scripts/review_tier_constants/__init__.py +0 -1
  243. package/.agents/skills/review-tier/scripts/review_tier_constants/config/__init__.py +0 -0
  244. package/.agents/skills/review-tier/scripts/review_tier_constants/config/constants.py +0 -29
  245. package/.agents/skills/review-tier/scripts/test_generation.py +0 -159
  246. package/.agents/skills/review-tier/scripts/test_review_tier.py +0 -33
  247. package/.agents/skills/run-claude-dev-env/SKILL.md +0 -84
  248. package/.agents/skills/session-log/.claude/CLAUDE.md +0 -1
  249. package/.agents/skills/session-log/AGENTS.md +0 -1
  250. package/.agents/skills/session-log/SKILL.md +0 -170
  251. package/.agents/skills/session-log/templates/frontmatter.md +0 -40
  252. package/.agents/skills/session-tidy/.claude/CLAUDE.md +0 -1
  253. package/.agents/skills/session-tidy/AGENTS.md +0 -1
  254. package/.agents/skills/session-tidy/SKILL.md +0 -191
  255. package/.agents/skills/skill-builder/references/.claude/CLAUDE.md +0 -1
  256. package/.agents/skills/skill-builder/references/AGENTS.md +0 -1
  257. package/.agents/skills/skill-builder/references/delegation-map.md +0 -130
  258. package/.agents/skills/skill-builder/references/description-field.md +0 -111
  259. package/.agents/skills/skill-builder/references/deterministic-elements.md +0 -218
  260. package/.agents/skills/skill-builder/references/progressive-disclosure.md +0 -122
  261. package/.agents/skills/skill-builder/references/self-audit-checklist.md +0 -126
  262. package/.agents/skills/skill-builder/references/skill-modularity.md +0 -111
  263. package/.agents/skills/skill-builder/references/skill-types.md +0 -232
  264. package/.agents/skills/skill-builder/references/thariq-x-post-skills.json +0 -33
  265. package/.agents/skills/skill-builder/templates/.claude/CLAUDE.md +0 -1
  266. package/.agents/skills/skill-builder/templates/AGENTS.md +0 -1
  267. package/.agents/skills/skill-builder/templates/gap-analysis.md +0 -87
  268. package/.agents/skills/skill-builder/workflows/.claude/CLAUDE.md +0 -1
  269. package/.agents/skills/skill-builder/workflows/AGENTS.md +0 -1
  270. package/.agents/skills/skill-builder/workflows/improve-skill.md +0 -136
  271. package/.agents/skills/skill-builder/workflows/new-skill.md +0 -179
  272. package/.agents/skills/skill-builder/workflows/polish-skill.md +0 -139
  273. package/.agents/skills/source-command-sr-loop/SKILL.md +0 -82
  274. package/.agents/skills/update/.claude/CLAUDE.md +0 -1
  275. package/.agents/skills/update/AGENTS.md +0 -1
  276. package/.agents/skills/update/SKILL.md +0 -190
  277. package/_shared/pr-loop/AGENTS.md +0 -1
  278. package/_shared/pr-loop/CLAUDE.md +0 -1
  279. package/_shared/pr-loop/audit-contract.md +0 -183
  280. package/_shared/pr-loop/audit-reply-template.md +0 -151
  281. package/_shared/pr-loop/code-rules-gate.md +0 -65
  282. package/_shared/pr-loop/fix-protocol.md +0 -60
  283. package/_shared/pr-loop/gh-payloads.md +0 -75
  284. package/_shared/pr-loop/post-audit-thread-contract.md +0 -51
  285. package/_shared/pr-loop/precatch-rubric.md +0 -66
  286. package/_shared/pr-loop/preflight-proposal.md +0 -56
  287. package/_shared/pr-loop/scripts/post_audit_thread.py +0 -1242
  288. package/_shared/pr-loop/scripts/pr_loop_shared_constants/post_audit_thread_constants.py +0 -199
  289. package/_shared/pr-loop/scripts/tests/test_post_audit_thread.py +0 -1115
  290. package/_shared/pr-loop/scripts/tests/test_post_audit_thread_constants.py +0 -129
  291. package/_shared/pr-loop/state-schema.md +0 -45
  292. package/_shared/pr-loop/worker-spawn.md +0 -189
  293. /package/{.agents/skills/_shared/pr-loop/scripts → scripts}/test_durable_post_lint.py +0 -0
@@ -1,183 +0,0 @@
1
- # Audit contract
2
-
3
- Shared output schema and audit-loop contract used by `/bugteam`, `clean-room audit (code-quality-agent)`, and `/pr-fix-protocol`. Changing a shape here is a breaking change for every consuming skill.
4
-
5
- ## Contents
6
-
7
- - Finding schema (Shape A, Shape B)
8
- - Adversarial second pass
9
- - Haiku secondary auditor
10
- - Post-fix self-audit
11
- - De-dup and merge
12
- - Persistence (loop-<L>-audit.json, loop-<L>-diagnostics.json)
13
-
14
- ## Collection before severity filtering
15
-
16
- Audit collection reports every real finding. The collection record retains all
17
- seeded severities (`P0`, `P1`, `P2`) and every Shape A field (`file`, `line`,
18
- `category`, `severity`, `excerpt`, `failure_mode`, `evidence_files`). Do not drop a real finding because its severity is low.
19
-
20
- Severity or action filtering is a **separate consumer stage** after collection
21
- is complete. A consumer may select a subset for fix or posting; it must not
22
- rewrite the collection record or strip file, line, evidence, or category from
23
- retained entries.
24
-
25
- ## Finding schema
26
-
27
- Each finding an audit produces MUST be one of exactly two shapes.
28
-
29
- ### Shape A — structured finding
30
-
31
- ```json
32
- {
33
- "id": "loop<L>-<K>",
34
- "file": "path/relative/to/repo/root.py",
35
- "line": 123,
36
- "category": "A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q",
37
- "severity": "P0 | P1 | P2",
38
- "excerpt": "verbatim code snippet from the offending line(s)",
39
- "failure_mode": "one sentence describing what goes wrong and when",
40
- "evidence_files": ["additional/files/opened.py"]
41
- }
42
- ```
43
-
44
- `id` is `loop<L>-<K>` where `L` is the loop counter (1-based) and `K` is the 1-based index within the loop. For `clean-room audit (code-quality-agent)` which runs once, use `find<K>`.
45
-
46
- ### Shape B — structured proof-of-absence
47
-
48
- Used when an audit investigates a category and does NOT find a bug. Bare "verified clean" claims are REJECTED because they hide shallow reading.
49
-
50
- ```json
51
- {
52
- "category": "A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q",
53
- "files_opened": ["file1.py", "file2.py"],
54
- "lines_quoted": [
55
- {"file": "file1.py", "line": 88, "text": "verbatim line content"}
56
- ],
57
- "adversarial_probes": [
58
- "what failure mode was tested for and how it was ruled out"
59
- ]
60
- }
61
- ```
62
-
63
- Every category an audit touches MUST have either at least one Shape A finding OR at least one Shape B proof-of-absence entry. A category with neither is a protocol violation.
64
-
65
- ### Example — Shape A
66
-
67
- ```json
68
- {
69
- "id": "loop1-1",
70
- "file": "scripts/db/neon.py",
71
- "line": 43,
72
- "category": "C",
73
- "severity": "P1",
74
- "excerpt": "load_dotenv(env_path, override=False)",
75
- "failure_mode": "Called on every connect() — repeats file I/O per connection in scripts that open multiple short-lived connections.",
76
- "evidence_files": ["scripts/db/neon.py", "scripts/update_new_releases.py"]
77
- }
78
- ```
79
-
80
- ### Example — Shape B
81
-
82
- ```json
83
- {
84
- "category": "H",
85
- "files_opened": ["scripts/db/neon.py", "scripts/db/config.py"],
86
- "lines_quoted": [
87
- {"file": "scripts/db/neon.py", "line": 30, "text": "dsn = os.environ.get(\"DATABASE_URL\")"}
88
- ],
89
- "adversarial_probes": [
90
- "Checked whether DATABASE_URL is interpolated into a shell — it is passed to psycopg.connect() directly with no shell involvement.",
91
- "Checked whether the env path is user-controlled — it is derived from a fixed Y: drive constant, not user input."
92
- ]
93
- }
94
- ```
95
-
96
- ## Adversarial second pass
97
-
98
- After the primary finding list is complete, every audit runs a second pass against itself with the prompt:
99
-
100
- > Assume your first pass missed at least 3 P1 bugs. Where are they?
101
-
102
- The audit must either produce new Shape A findings citing new file:line references not present in the first pass, or cite explicit Shape B adversarial-probe entries for each category it re-examined. An adversarial pass that returns "nothing new, confident first pass was complete" is REJECTED — produce evidence or findings, not confidence.
103
-
104
- ## Haiku secondary auditor
105
-
106
- For single-subagent skills (`/bugteam`, `clean-room audit (code-quality-agent)`) the LEAD spawns two `Agent()` calls in one message:
107
-
108
- - **Primary** — `subagent_type=clean-coder`, `model=sonnet` (for `/bugteam` cycle) or `subagent_type=code-quality-agent`, `model=sonnet` (for clean-room audit).
109
- - **Secondary (Haiku)** — `subagent_type=code-quality-agent`, `model=haiku`, same self-contained clean-room prompt shape used by `clean-room audit (code-quality-agent)`.
110
-
111
- Both audit the same diff. The secondary returns findings to the LEAD only — never posted to the PR.
112
-
113
- Merge rules — applied whenever the LEAD combines findings from multiple sources (primary auditor, Haiku secondary auditor, adversarial pass):
114
-
115
- - **De-dup key**: `(file, line, category)`. Two findings sharing the same `(file, line, category)` tuple are the same finding and collapse into one entry.
116
- - **Severity conflict**: max wins (`P0 > P1 > P2`). When sources disagree on severity for the same de-dup key, the merged entry keeps the highest severity.
117
- - **Unique-to-secondary findings**: added to the merged set with the secondary's severity and source annotation.
118
- - **Unique-to-primary findings**: kept as-is.
119
- - **Zero secondary findings**: the primary set is trusted and the audit moves on.
120
- - **Malformed or non-parseable secondary output**: lead trusts the primary set and logs the event in `loop-<L>-diagnostics.json` under `haiku_findings` as `[{"parse_error": "<message>"}]`.
121
-
122
- For `/bugteam`, the single audit agent provides per-category coverage by walking all A–Q rubrics in one invocation.
123
-
124
- ## Post-fix self-audit
125
-
126
- Audit-and-fix skills (`/bugteam`) MUST re-audit modified files between `py_compile` and `git add`. This catches fix-induced regressions in the same loop that introduced them rather than on loop N+1.
127
-
128
- Sequence:
129
-
130
- 1. Capture pre-fix file contents for every file this FIX will touch.
131
- 2. Apply edits.
132
- 3. Run `py_compile` (or language-equivalent) on each modified file.
133
- 4. Compute `fix_diff` against pre-fix contents for the modified set.
134
- 5. Run `_shared/pr-loop/scripts/code_rules_gate.py` with explicit paths for every modified file.
135
- 6. Spawn a scoped audit of `fix_diff` with full A–Q rigor, Shape A/B contract, adversarial pass, AND Haiku secondary in parallel (paranoid mode on post-fix).
136
- 7. Read the previous loop's outcome XML (`<worktree_path>/.bugteam-pr<N>-loop<L-1>.outcomes.xml`) and obtain its total finding count. If this is the first loop (L <= 1) or the file does not exist, skip this comparison. Compute the post-fix total: previous total minus bugs fixed in this round plus new violations found in the post-fix audit (step 6). If the post-fix total exceeds the previous total, flag all new findings as same-loop fix-targets and revise. An increase in total findings across loop transitions is a regression.
137
- 8. Any new findings become same-loop fix-targets. Internal iteration count increments by one.
138
- 9. After 3 internal iterations with fresh findings each time, exit `stuck: post-fix audit not converging`.
139
- 10. Only when `gate_findings` empty AND `post_fix_findings` empty: `git add`, commit, push.
140
-
141
- `converged` exit condition: `primary_audit_clean AND post_fix_audit_clean` for the committing loop.
142
-
143
- ## De-dup and merge
144
-
145
- Findings from primary, adversarial, Haiku secondary, and post-fix passes are merged into a single deduped finding list before persistence.
146
-
147
- - **De-dup key:** `(file, line, category)`. Two findings sharing the same `(file, line, category)` tuple collapse into a single deduped entry.
148
- - **Severity conflict resolution:** `max wins`. When merged findings disagree on severity, the deduped entry carries the highest severity (`P0 > P1 > P2`).
149
- - **Excerpt and failure_mode:** the deduped entry inherits these fields from the highest-severity contributing finding. Ties keep the first observed contributor.
150
- - **`evidence_files`:** the deduped entry carries the union of every contributor's `evidence_files`, deduplicated and sorted.
151
-
152
- The merged list lands in `loop-<L>-diagnostics.json` under both `merged` (one entry per contributing finding) and `deduped` (one entry per unique `(file, line, category)` tuple).
153
-
154
- ## Persistence
155
-
156
- Every audit loop writes two JSON files under the skill's scoped temp directory (resolved via `tempfile.gettempdir()`):
157
-
158
- ### `loop-<L>-audit.json`
159
-
160
- ```json
161
- {
162
- "findings": [],
163
- "proof_of_absence": [],
164
- "source": "primary | haiku | adversarial | merged"
165
- }
166
- ```
167
-
168
- ### `loop-<L>-diagnostics.json`
169
-
170
- ```json
171
- {
172
- "loop": 1,
173
- "gate_findings": [],
174
- "primary_findings": [],
175
- "adversarial_findings": [],
176
- "haiku_findings": [],
177
- "post_fix_findings": [],
178
- "merged": [],
179
- "deduped": []
180
- }
181
- ```
182
-
183
- All eight keys MUST be present. Missing keys break convergence debugging.
@@ -1,151 +0,0 @@
1
- # Audit reply template
2
-
3
- Canonical reply shape for every orchestrator-to-thread reply posted by the PR-loop suite (`pr-converge`, `bugteam`, and the `clean-coder` agent). Every reply Claude posts to an unresolved review thread on a draft PR uses this template.
4
-
5
- Read this doc before authoring any code that posts a reply. The template is the contract emitted by every `clean-coder` reply path; the audit-skill wiring (`bugteam`, `pr-converge`) reads it before authoring a reply.
6
-
7
- Use `~/.claude/rules/asd-ste100-language.md` for user-facing word choice,
8
- sentence style, tone, punctuation, and prose form. This template owns review
9
- thread fields, evidence slots, and action/status structure.
10
-
11
- This doc has two surfaces, called out separately so consumers do not conflate them: the **reply template** (this section and below) shapes the body Claude posts back to a single review thread; the **audit body skeleton** in [Relationship to the audit review body](#relationship-to-the-audit-review-body) shapes the parent review `post_audit_thread.py` posts at audit time. The reply-template consumers are the skills/agents listed above (read-only `clean-room audit` is excluded — it posts an audit review via `post_audit_thread.py` but never authors thread replies). The audit-body-skeleton consumers include `clean-room audit` alongside `bugteam` because both post audit reviews via the same script.
12
-
13
- ## Provenance
14
-
15
- The template mirrors Anthropic's `claude[bot]` reply structure observed on `anthropics/claude-code`. Reference example: PR `anthropics/claude-code#10826`, inline comment `2483980211`. Reading that thread shows the structural anchors this template captures: a status header line, a horizontal-rule separator, an `<action_heading> ✅` section, a plain-language explanation, anchored `**`<file>:<line>`:**` bullets, and a closing paragraph.
16
-
17
- ## When the template applies
18
-
19
- Every reply path uses the same skeleton. Two paths exist; both produce a reply with the structure below.
20
-
21
- | Path | When the orchestrator picks it | Code-side action |
22
- |---|---|---|
23
- | Fix | Thread classified `still_applies`. Code change addresses the finding. | `clean-coder` commits the fix, pushes, then replies. |
24
- | No-longer-applies | Thread classified `no_longer_applies`. Concern is moot under the current code (file removed, intent satisfied differently, refactor obviated the concern). | No code change. Orchestrator posts the reply directly. |
25
-
26
- ## Template skeleton
27
-
28
- ```
29
- **Claude finished @<reviewer>'s task** —— <status_line>
30
-
31
- ---
32
- ### <action_heading> ✅
33
-
34
- <1–2 paragraph plain-language explanation>
35
-
36
- **`<file>:<line>`:**
37
- - <bullet describing change or rationale>
38
- - <bullet describing change or rationale>
39
-
40
- <closing paragraph>
41
- ```
42
-
43
- ### Placeholder reference
44
-
45
- | Placeholder | Required value |
46
- |---|---|
47
- | `<reviewer>` | GitHub login of the reviewer whose thread the reply addresses (e.g., `cursor[bot]`, `copilot-pull-request-reviewer[bot]`, `claude[bot]`, the bugteam-account login, a human reviewer's login). |
48
- | `<status_line>` | One of two fixed strings, see [Per-path variation](#per-path-variation). |
49
- | `<action_heading>` | Per-path content, see [Per-path variation](#per-path-variation). |
50
- | `<file>:<line>` | Path relative to repo root and the line number the reviewer anchored to. Multiple `**`<file>:<line>`:**` blocks are allowed when the reply spans more than one anchor in the same thread. |
51
- | Bullets | Two or more bullets per anchor block. Each bullet is one sentence. |
52
- | Closing paragraph | One paragraph that ties the bullets back to the reviewer's concern. Affirmative phrasing only. |
53
-
54
- The separator between the header and `<action_heading>` is a Markdown horizontal rule (`---`) on its own line. The em-dash separator inside the header line is `——` (two em-dashes, U+2014 ×2). Both render correctly on GitHub.
55
-
56
- ## Per-path variation
57
-
58
- | Path | `<status_line>` | `<action_heading>` |
59
- |---|---|---|
60
- | Fix | `Fixed in <SHA>` (short SHA, 7 characters) | Finding-specific action verb. Example: `Replaced Any with concrete type`, `Renamed handle_request to dispatch_webhook`, `Added missing Raises: section`. |
61
- | No longer applies | `This concern no longer applies` | Reason-specific. Example: `File removed in commit <SHA>`, `Intent satisfied via refactor in commit <SHA>`, `Concern superseded by upstream change`. |
62
-
63
- ## Structural identity rule
64
-
65
- The skeleton is identical across both paths. The only per-path differences are `<status_line>` and `<action_heading>`. Every other element is present in both paths:
66
-
67
- - The header line with `**Claude finished @<reviewer>'s task** —— <status_line>` is present in both paths.
68
- - The horizontal rule separator is present in both paths.
69
- - The `### <action_heading> ✅` line is present in both paths.
70
- - The plain-language explanation is present in both paths.
71
- - The `**`<file>:<line>`:**` bullet blocks are present in both paths. On the fix path, bullets describe what changed. On the no-longer-applies path, bullets describe why the concern is moot at that anchor.
72
- - The closing paragraph is present in both paths.
73
-
74
- A reply that omits any of these elements does not satisfy the template.
75
-
76
- ## Worked example — fix path
77
-
78
- Reviewer thread (synthesized for this doc):
79
-
80
- > `cursor[bot]` on `src/foo.py:42`:
81
- > The `handle_request` function returns `Any`. Name the concrete return type so callers do not lose type information.
82
-
83
- Reply posted by `clean-coder` after committing the fix at SHA `a3f9c12`:
84
-
85
- ```markdown
86
- **Claude finished @cursor[bot]'s task** —— Fixed in a3f9c12
87
-
88
- ---
89
- ### Replaced Any with concrete return type ✅
90
-
91
- The reviewer's concern is correct: returning `Any` from a public function erases type information for every caller and defeats `mypy`'s ability to catch shape mismatches downstream. The fix names the concrete return type the function already produces.
92
-
93
- **`src/foo.py:42`:**
94
- - Changed the return annotation from `Any` to `RequestOutcome`.
95
- - Renamed the function from `handle_request` to `dispatch_webhook` to comply with the banned-prefix rule (`handle_` is one of the banned function prefixes per `CODE_RULES.md`).
96
- - Added a Google-style `Returns:` section to the docstring naming the new return type.
97
-
98
- The function signature now matches its actual behavior, and `mypy --strict` reports zero errors on the touched file.
99
- ```
100
-
101
- ## Worked example — no-longer-applies path
102
-
103
- Reviewer thread (synthesized for this doc):
104
-
105
- > `copilot-pull-request-reviewer[bot]` on `src/legacy_adapter.py:88`:
106
- > This compatibility shim should be removed once the upstream migration completes. Add a TODO with the planned removal date.
107
-
108
- Reply posted by the orchestrator directly (no code change) after the upstream migration lands and removes the shim file entirely:
109
-
110
- ```markdown
111
- **Claude finished @copilot-pull-request-reviewer[bot]'s task** —— This concern no longer applies
112
-
113
- ---
114
- ### File removed in commit b8e2d4f ✅
115
-
116
- The compatibility shim the reviewer flagged is no longer present in the tree. The upstream migration completed in commit `b8e2d4f`, and the same commit deleted `src/legacy_adapter.py` outright. There is no longer any shim to add a TODO to, and there is no longer any caller that imports from the removed module.
117
-
118
- **`src/legacy_adapter.py:88`:**
119
- - The anchored line lives in a file deleted by commit `b8e2d4f`.
120
- - A repo-wide grep for `legacy_adapter` returns zero matches.
121
- - The two former call sites (`src/api/router.py`, `src/api/middleware.py`) import from the consolidated module instead.
122
-
123
- The thread can be resolved without further action; the reviewer's underlying concern is satisfied by the deletion rather than by the originally requested TODO.
124
- ```
125
-
126
- ## Relationship to the audit review body
127
-
128
- The audit review body posted by `post_audit_thread.py` (consumers: `bugteam`, `clean-room audit`) shares the same header anchor pattern:
129
-
130
- <!-- audit-body-skeleton:start -->
131
- ```
132
- **<Skill> audit completed** —— <state_label>
133
-
134
- ---
135
- ### <heading>
136
-
137
- <summary paragraph>
138
-
139
- **Findings:** <N> | **Severity:** <P0 count>P0 / <P1 count>P1 / <P2 count>P2
140
-
141
- <optional collapsed details section per finding>
142
- ```
143
- <!-- audit-body-skeleton:end -->
144
-
145
- The audit review body announces a complete audit pass; the reply template addresses one specific thread. They use the same `**Title** —— <status>` header convention so a reader scanning a PR sees consistent visual anchoring across both surfaces.
146
-
147
- ## Cross-references
148
-
149
- - [`audit-contract.md`](audit-contract.md) — finding schema (Shape A / Shape B), adversarial second pass, post-fix self-audit, persistence layout. The fields in a Shape A finding (`file`, `line`, `failure_mode`) feed the placeholders in this template. Replies cite the same `<file>:<line>` anchors that the originating audit recorded.
150
- - [`fix-protocol.md`](fix-protocol.md) — step 12 of the fix protocol describes the reply step and renders this template's full structure.
151
- - [`gh-payloads.md`](gh-payloads.md) — MCP and REST endpoints used to post replies (`add_reply_to_pull_request_comment` and `post_fix_reply.py`). The transport is independent of the template; both transports accept the body string this template defines.
@@ -1,65 +0,0 @@
1
- # CODE_RULES gate
2
-
3
- Pre-audit validator run before each AUDIT (and pre-commit when applicable). Wraps `validate_content_for_full_gate` from `~/.claude/hooks/blocking/code_rules_enforcer.py`.
4
-
5
- ## Script location
6
-
7
- Canonical: `~/.claude/_shared/pr-loop/scripts/code_rules_gate.py` after install.
8
-
9
- Workflows reference it via:
10
- - all skills (bugteam, pr-converge): `${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/code_rules_gate.py`
11
-
12
- Cross-skill path traversal works because every skill installs as a flat top-level dir under the skills lookup path (`~/.claude/skills/`, a directory pointer to `~/.agents/skills/`) and `_shared/` lives alongside `skills/` under `~/.claude/`.
13
-
14
- ## Invocation
15
-
16
- Default mode (full PR diff against base):
17
- ```bash
18
- python "<gate_script>" --base origin/<base_branch>
19
- ```
20
-
21
- Staged mode (pre-commit subset):
22
- ```bash
23
- python "<gate_script>" --staged
24
- ```
25
-
26
- Path-scoped mode:
27
- ```bash
28
- python "<gate_script>" --base origin/<base_branch> --only-under <prefix> [--only-under <other_prefix>]
29
- ```
30
-
31
- ## Exit codes
32
-
33
- - `0` — no violations on changed lines (advisories on touched-but-unchanged lines may still print)
34
- - `1` — at least one blocking violation on changed lines; halt
35
- - `2` — gate execution error (missing enforcer, git failure, malformed diff)
36
-
37
- ## Workflow integration
38
-
39
- - **bugteam:** before every AUDIT in Step 3 of the loop. Non-zero → spawn clean-coder for standards fix; loop until exit 0 or 5 consecutive gate failures → `error: code rules gate failed pre-audit`.
40
- - **pr-converge:** before every push in the Fix protocol and before every commit during the fix loop. Halt on non-zero, fix violations, re-run.
41
-
42
- ## Coverage
43
-
44
- - File-global UPPER_SNAKE constants (must live in `config/` outside exempt path families)
45
- - Magic values in production function bodies (literals other than 0, 1, -1)
46
- - Imports outside top of module
47
- - New code comments anywhere; comments tied to touched code are removed and comments tied to untouched code remain unchanged
48
- - File-global constants used by fewer than 2 functions/methods
49
- - Logging format-arg violations
50
- - Database column-name string magic (snake_case strings as first element of 2-tuples in function bodies)
51
- - Public-wrapper-drops-optional-kwargs of same-file delegates
52
-
53
- Test files use the same no-new-comment policy; their magic-value and constants-location exemptions remain.
54
-
55
- When a change touches code that an existing comment describes or is attached to, remove that comment in the same change and carry its meaning through clear names and structure. Leave comments tied to untouched code unchanged. Keep comment cleanup inside the requested task.
56
- Production and tests follow one rule. Changed directive, TODO, FIXME, HACK, XXX, and type-ignore comments are removed rather than added or justified.
57
-
58
- ## Halt-fix-rerun protocol
59
-
60
- When the gate exits non-zero:
61
- 1. Capture stderr (gate prints `<file>: Line <N>: <issue>` per violation)
62
- 2. Group violations by file
63
- 3. Apply fixes in the smallest change set (extract constants to `config/`, rename collection params with `all_` prefix, replace literals with named constants, etc.)
64
- 4. Re-run the gate with the same arguments
65
- 5. Cap at 5 consecutive failures (bugteam, pr-converge); on cap exceeded, exit `error`
@@ -1,60 +0,0 @@
1
- # Fix protocol
2
-
3
- ## Sequence
4
-
5
- 1. **Read each referenced file:line** before editing. The repo enforces read-before-edit at the tool layer.
6
- 2. **Capture pre-fix SHA:** `git rev-parse HEAD`. Store as `pre_fix_sha`.
7
- 3. **Capture pre-fix file contents** for every file this fix will touch. Used in step 8 for the post-fix self-audit diff.
8
- 4. **TDD where applicable:** when the finding has behavior to test, write a failing test first; for pure doc, comment, or naming nits with no behavior, fix directly.
9
- 5. **Apply each fix:**
10
- - Preserve existing comments on lines left unchanged
11
- - Add complete type hints on every signature touched
12
- - Apply `~/.claude/rules/asd-ste100-language.md` to new user-facing prose
13
- 6. **Validate each modified Python file:** `python -m py_compile <path>`. Halt on syntax error; fix and re-run.
14
- 7. **Compute fix diff:** the diff between pre-fix and post-fix file contents for every modified file.
15
- 8. **Post-fix self-audit:** follow [`audit-contract.md`](audit-contract.md) post-fix self-audit sequence. Internal iteration cap: 3. Three rounds with fresh findings → exit `stuck: post-fix audit not converging`. Only when `gate_findings` empty AND `post_fix_findings` empty → proceed to git add.
16
- 9. **Stage by explicit path:** `git add <path>` for each modified file. Avoid `git add -A` and `git add .`.
17
- 10. **Create one commit** summarizing the fixed findings. Let every git hook run. When a hook blocks the commit, capture stderr, mark every finding in this loop `status=hook_blocked`, and move to the next iteration without retrying this loop.
18
- 11. **Push fast-forward:** `git push origin <branch>`. Verify `git fetch origin <branch> && git rev-parse origin/<branch>` matches `HEAD`.
19
- 12. **Reply + resolve, atomic per thread.** For each finding, post the reply and call `resolve_thread` as one logical action — no yield to the orchestrator between them, no batching all replies before any resolves.
20
-
21
- The reply body uses the unified template from [`audit-reply-template.md`](audit-reply-template.md). Skeleton (identical across all paths):
22
-
23
- ```
24
- **Claude finished @<reviewer>'s task** —— <status_line>
25
-
26
- ---
27
- ### <action_heading> ✅
28
-
29
- <1–2 paragraph plain-language explanation>
30
-
31
- **`<file>:<line>`:**
32
- - <bullet describing change or rationale>
33
- - <bullet describing change or rationale>
34
-
35
- <closing paragraph>
36
- ```
37
-
38
- Per-path `<status_line>` / `<action_heading>`:
39
- - `status=fixed`: `Fixed in <short_sha>` (7-char SHA) / finding-specific action verb (e.g., `Replaced Any with concrete type`).
40
- - `status=could_not_address`: `Could not address this loop` / one-line reason text.
41
- - `status=hook_blocked`: `Hook blocked the fix commit` / one-line hook summary.
42
-
43
- Transport: post the reply via [`gh-payloads.md`](gh-payloads.md), then call `pull_request_review_write(method="resolve_thread", threadId=<thread_node_id>, ...)` for the same thread before moving to the next finding (this is the PR review thread node ID — `PRRT_kwDOxxx` — distinct from the numeric comment ID; harvest it at audit time when calling `get_review_comments`; see the archived [`fix-resolve-thread` runbook](../../.agents/skills-archived/bugteam/reference/obstacles/fix-resolve-thread.md)).
44
- 13. **Re-trigger reviewer** when the calling workflow specifies. Workflow-specific:
45
- - **autoconverge** — terminal Bugbot, Copilot, and Codex gates re-run after each fix push per [`../../.agents/skills/autoconverge/reference/convergence.md`](../../.agents/skills/autoconverge/reference/convergence.md)
46
- - **Archived pr-converge** — post `bugbot run` after every push; see archived skill reference
47
- - **Archived bugteam** — skip external re-trigger; the next loop iteration audits
48
-
49
- ## Stuck detection
50
-
51
- After step 11, when `git rev-parse HEAD` is unchanged from `pre_fix_sha`, the fix produced no commit. Exit reason: `stuck — could not address findings`. Record unresolved findings as `{file, line, severity, title, reason}` quadruples.
52
-
53
- ## Constraints
54
-
55
- - Edit only files reachable from the PR diff's scope.
56
- - Append commits; the branch stays linear (one commit per fix loop, fast-forward push only).
57
- - No comment deletion on lines left unchanged.
58
- - No `--no-verify`. Hook rejections flag real underlying issues worth investigating.
59
- - **Narrow scope.** Fix only the exact defect at the specified file:line. No structural refactoring, no inlining helpers.
60
- - **Preserve helpers.** Do not remove or inline existing helper functions unless the finding explicitly names them.
@@ -1,75 +0,0 @@
1
- # MCP-based payloads
2
-
3
- Shared payload shapes for posting PR reviews and replies. Used by autoconverge
4
- terminal gates and the archived `bugteam` / `pr-converge` skills.
5
-
6
- ## Build payloads with MCP tools
7
-
8
- Build payloads as structured arguments to MCP tools. Body content passes as a string parameter directly.
9
-
10
- ## One review per loop
11
-
12
- Posting the per-loop audit review is handled by
13
- [`_shared/pr-loop/scripts/post_audit_thread.py`](scripts/post_audit_thread.py).
14
- The script owns the review-create/POST/retry flow internally; callers no longer
15
- build the GitHub reviews-API payload themselves. See
16
- [`post-audit-thread-contract.md`](post-audit-thread-contract.md) for the contract
17
- and the archived
18
- [`bugteam` audit-posting section](../../.agents/skills-archived/bugteam/SKILL.md)
19
- for the historical invocation shape in
20
- [`PROMPTS.md`](../../.agents/skills-archived/bugteam/PROMPTS.md).
21
-
22
- ## Review body skeleton
23
-
24
- The review body skeleton lives in
25
- [`audit-reply-template.md`](audit-reply-template.md) between the
26
- `<!-- audit-body-skeleton:start -->` and `<!-- audit-body-skeleton:end -->`
27
- markers. `post_audit_thread.py` reads that skeleton at runtime and substitutes
28
- its placeholders (`<Skill>`, `<state_label>`, `<heading>`, severity counts,
29
- collapsed `<details>` block). Callers pass the skill name, state, commit SHA,
30
- and findings JSON; the body shape is owned by the template.
31
-
32
- ## Reply to a finding
33
-
34
- Call `add_reply_to_pull_request_comment` with the finding comment ID and a
35
- reply body rendered from
36
- [`audit-reply-template.md`](audit-reply-template.md):
37
-
38
- ```
39
- add_reply_to_pull_request_comment(
40
- commentId=finding_comment_id,
41
- body=reply_body,
42
- owner=owner,
43
- repo=repo,
44
- pullNumber=pull_number
45
- )
46
- ```
47
-
48
- The `body` follows the unified reply skeleton documented in
49
- [`audit-reply-template.md` § Template skeleton](audit-reply-template.md#template-skeleton).
50
-
51
- ## Anchor fallback (line not in diff)
52
-
53
- Lines not in the PR diff cannot anchor an inline comment. The AUDIT teammate
54
- keeps such findings out of the findings JSON handed to
55
- `post_audit_thread.py`, lists them in the audit outcome XML under `<finding>`
56
- with an empty `finding_comment_id`, and surfaces them in the calling skill's
57
- user-facing output (chat reply to the user) rather than in the PR review body.
58
-
59
- ## Review POST failure
60
-
61
- There is no fallback payload to build. On retry exhaustion
62
- `post_audit_thread.py` exits `2` and the orchestrator halts — see
63
- [`post-audit-thread-contract.md`](post-audit-thread-contract.md) § Exit codes.
64
- A hard blocker on the audit-posting path is a halt condition, not a degraded
65
- flat-issue-comment fall-through.
66
-
67
- ## Endpoints
68
-
69
- - Review: handled by `post_audit_thread.py` (POSTs to
70
- `/repos/{owner}/{repo}/pulls/{N}/reviews` internally).
71
- - Reply: `add_reply_to_pull_request_comment(...)`.
72
-
73
- ## SHA capture timing
74
-
75
- `commit_id` and any `<head_sha_at_post_time>` reference: `git rev-parse HEAD` immediately before the POST, in the cwd of whichever subagent or process is posting.
@@ -1,51 +0,0 @@
1
- # post_audit_thread.py invocation contract
2
-
3
- Single source of truth for how every PR-loop caller runs
4
- [`scripts/post_audit_thread.py`](scripts/post_audit_thread.py) to post one
5
- audit review per pass. The script posts an `APPROVE` review on `CLEAN` (an
6
- empty findings list, zero inline comments) and a `REQUEST_CHANGES` review on
7
- `DIRTY` (one inline anchored comment per finding). It reads its body skeleton
8
- from [`audit-reply-template.md`](audit-reply-template.md) at runtime.
9
-
10
- ## Invocation
11
-
12
- ```
13
- python "<pr-loop-scripts>/post_audit_thread.py" \
14
- --skill <caller> \
15
- --owner <owner> \
16
- --repo <repo> \
17
- --pr-number <N> \
18
- --commit <head_sha> \
19
- --state <CLEAN|DIRTY> \
20
- --findings-json <path>
21
- ```
22
-
23
- Capture `<head_sha>` with `git rev-parse HEAD` in the caller's cwd right before
24
- the call, so the review attaches to the commit the audit scoped. `--findings-json`
25
- points to a JSON file whose root is a list; on `CLEAN` the list is empty (`[]`).
26
-
27
- ## Exit codes
28
-
29
- The script retries on its own with 1s / 4s / 16s backoff across four tries (one
30
- plus three retries). It then exits:
31
-
32
- | Exit | Meaning |
33
- |---|---|
34
- | `0` | Review posted. The new review's `html_url` is on stdout. |
35
- | `1` | User input error: bad arguments, malformed findings JSON, or a missing template. |
36
- | `2` | Retry exhaustion: every try failed. |
37
-
38
- ## Per-caller policy
39
-
40
- The same exit codes carry different weight per caller:
41
-
42
- - **bugteam** — an exit `2` is a hard blocker. The lead exits with
43
- `error: post_audit_thread retry exhausted`, and does not retry or fall back to
44
- a flat issue comment.
45
- - **autoconverge clean-audit** — any post that does not land (a denied post, an
46
- error, or an agent that never ran) is a recorded bypass, not a blocker. Every
47
- review lens already cleared the HEAD, so the CLEAN post is a record-keeping
48
- artifact. The run records a bypass note, sets the convergence check's
49
- `--bugteam-post-blocked` flag, and proceeds to the terminal Bugbot gate. Full
50
- policy: [`../../skills/autoconverge/reference/stop-conditions.md`](../../skills/autoconverge/reference/stop-conditions.md)
51
- § "Clean-audit post bypassed".
@@ -1,66 +0,0 @@
1
- # Pre-catch lens checklist
2
-
3
- The shared checklist the internal pre-catch lenses read on demand.
4
-
5
- ## Lane 1 — Deterministic sweep
6
-
7
- The mechanical, static, and test classes belong to a deterministic run. The static-sweep
8
- step owns them: it runs the CODE_RULES gate (`code_rules_gate.py --base origin/main`),
9
- `ruff`, `mypy`, and stem-matched `pytest` over the changed files. A reading lens trusts the
10
- sweep to have cleared them and reviews sweep-clean code.
11
-
12
- - Every CODE_RULES violation the gate reports is a finding.
13
- - Every `ruff` and `mypy` diagnostic on a changed file is a finding.
14
- - Every failing test in a changed production module's paired test is a finding.
15
- - **Proof of absence:** the gate exits 0, `ruff` and `mypy` report no diagnostic
16
- on the changed files, and the stem-matched tests pass.
17
-
18
- ## Lane 2 — Doc-vs-code parity
19
-
20
- Every doc claim in the diff matches the code it describes. Reuse the cross-file
21
- consistency prompt at
22
- [`../../.agents/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml`](../../.agents/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml)
23
- (installed as `~/.claude/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml`)
24
- and the drift rubric at
25
- [`../../audit-rubrics/category_rubrics/category-o-docstring-vs-impl-drift.md`](../../audit-rubrics/category_rubrics/category-o-docstring-vs-impl-drift.md).
26
-
27
- - Every line citation resolves to the line it names.
28
- - Every referenced file or script path exists.
29
- - Every symbol is attributed to the file that defines it.
30
- - Every inventory table, env-var table, count claim, and ordering claim matches
31
- the code.
32
- - **Proof of absence:** each referenced path, citation, symbol, and table checked
33
- against its source and found in step.
34
-
35
- ## Lane 3 — Test-assertion completeness
36
-
37
- Every changed or new production path carries a test that exercises its behavior.
38
-
39
- - Every changed or new production path has a paired test that calls it and asserts
40
- on its return value or side effect.
41
- - A changed test pins the behavior it covers rather than hiding it behind a mock.
42
- - **Proof of absence:** each changed production path paired with a behavior test
43
- that fails when the path regresses.
44
-
45
- ## Lane 4 — PR-description-vs-diff two-way parity
46
-
47
- The PR body and the diff describe the same change, both directions.
48
-
49
- - Every claim in the PR body maps to a hunk in the diff.
50
- - Every hunk in the diff maps to a claim in the PR body.
51
- - Flag any invented path, invented count, or out-of-scope change.
52
- - **Proof of absence:** the two-way map complete — every claim has a hunk and
53
- every hunk has a claim.
54
-
55
- ## Lane 5 — Adversarial audit
56
-
57
- The bug-audit lens runs the adversarial second pass the audit contract specifies
58
- (`~/.claude/_shared/pr-loop/audit-contract.md`): assume the first A-Q pass missed
59
- at least three P1 bugs, then find them.
60
-
61
- - Return new file:line findings for the bugs the first pass missed.
62
- - Or return a per-category proof-of-absence entry naming each re-examined category
63
- and why it holds.
64
- - A bare "nothing new" is not an acceptable result for this pass.
65
- - **Proof of absence:** a per-category adversarial-probe entry for each re-examined
66
- A-Q category with no new finding.