pi-lens 4.3.0 → 4.4.1

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 (659) hide show
  1. package/CHANGELOG.md +1159 -0
  2. package/README.md +116 -25
  3. package/config/dependency-cruiser-eager-allowlist.json +6 -2
  4. package/dist/chunk-2BEMIWEW.js +51 -0
  5. package/dist/chunk-2EECBNC5.js +89 -0
  6. package/dist/chunk-2FQ62SPM.js +83 -0
  7. package/dist/chunk-2UMYMRI3.js +118 -0
  8. package/dist/chunk-34OCDWOS.js +48 -0
  9. package/dist/chunk-3FERWMCH.js +144 -0
  10. package/dist/chunk-3JL6IFD7.js +97 -0
  11. package/dist/chunk-3JSEWUWI.js +327 -0
  12. package/dist/chunk-3MED75HT.js +37 -0
  13. package/dist/chunk-3MRXIJ6I.js +79 -0
  14. package/dist/chunk-3P4PF2BX.js +2250 -0
  15. package/dist/chunk-3PNFWVHT.js +201 -0
  16. package/dist/chunk-3TTPKMEF.js +162 -0
  17. package/dist/chunk-5JHXUETW.js +326 -0
  18. package/dist/chunk-5W3R6LFT.js +24 -0
  19. package/dist/chunk-64LU2OVH.js +341 -0
  20. package/dist/chunk-6B5I6ICN.js +44 -0
  21. package/dist/chunk-6P54TMWL.js +274 -0
  22. package/dist/chunk-6UYA642J.js +145 -0
  23. package/dist/chunk-6XX5HCLK.js +398 -0
  24. package/dist/chunk-7AXO3ZDF.js +30 -0
  25. package/dist/chunk-7BX5DWSA.js +1907 -0
  26. package/dist/chunk-7ELY2CSM.js +902 -0
  27. package/dist/chunk-7M4T5N3V.js +38 -0
  28. package/dist/chunk-7U2IDNXN.js +37 -0
  29. package/dist/chunk-ABBOA7UD.js +157 -0
  30. package/dist/chunk-AFZYMAIV.js +756 -0
  31. package/dist/chunk-ALQRYH6O.js +112 -0
  32. package/dist/chunk-AXKPQ6ZI.js +1610 -0
  33. package/dist/chunk-BHWHXMQ2.js +62 -0
  34. package/dist/chunk-BJF25SUG.js +22 -0
  35. package/dist/chunk-BNKLYOOO.js +18 -0
  36. package/dist/chunk-BW5KFIQC.js +59 -0
  37. package/dist/chunk-CBD2B5CP.js +599 -0
  38. package/dist/chunk-CFYISHUW.js +42 -0
  39. package/dist/chunk-CMU4RMJB.js +30 -0
  40. package/dist/chunk-CULQYFLU.js +14 -0
  41. package/dist/chunk-D65GOCJB.js +289 -0
  42. package/dist/chunk-D6YF5HKX.js +59 -0
  43. package/dist/chunk-DMS52BEP.js +342 -0
  44. package/dist/chunk-ELVWJYRV.js +211 -0
  45. package/dist/chunk-EUT3B22Y.js +27 -0
  46. package/dist/chunk-F5VLZHUW.js +146 -0
  47. package/dist/chunk-FC4RP4I2.js +12 -0
  48. package/dist/chunk-FGALODG3.js +55 -0
  49. package/dist/chunk-G3RLJYA2.js +2358 -0
  50. package/dist/chunk-GAYGGICG.js +32 -0
  51. package/dist/chunk-H2W2AXD3.js +419 -0
  52. package/dist/chunk-H5EV3VMF.js +114 -0
  53. package/dist/chunk-HREZQCT3.js +106 -0
  54. package/dist/chunk-HSIRMK2D.js +517 -0
  55. package/dist/chunk-IMSQR4WO.js +184 -0
  56. package/dist/chunk-IQZXOZ7S.js +4816 -0
  57. package/dist/chunk-IR6XFA5P.js +37 -0
  58. package/dist/chunk-IUKPRZER.js +78 -0
  59. package/dist/chunk-IUR76K6A.js +262 -0
  60. package/dist/chunk-J3FZR3YY.js +98 -0
  61. package/dist/chunk-J6DFZDFA.js +562 -0
  62. package/dist/chunk-J7WJZ6W7.js +50 -0
  63. package/dist/chunk-JONGANYH.js +202 -0
  64. package/dist/chunk-KJCWXUUS.js +425 -0
  65. package/dist/chunk-KJN4IOEJ.js +17 -0
  66. package/dist/chunk-KMGPUKFD.js +25 -0
  67. package/dist/chunk-LD7WFTRX.js +4533 -0
  68. package/dist/chunk-LJDODBBZ.js +78 -0
  69. package/dist/chunk-LNOMA3MP.js +169 -0
  70. package/dist/chunk-MGIWSROG.js +2334 -0
  71. package/dist/chunk-MQA2YBAH.js +308 -0
  72. package/dist/chunk-MTDRLSI7.js +21720 -0
  73. package/dist/chunk-N2IRDBZI.js +2355 -0
  74. package/dist/chunk-N77WFUL7.js +50 -0
  75. package/dist/chunk-N7YNJE5R.js +466 -0
  76. package/dist/chunk-NABLC7W3.js +148 -0
  77. package/dist/chunk-NFXP47RV.js +999 -0
  78. package/dist/chunk-NJF2X5XF.js +45 -0
  79. package/dist/chunk-NXL4FFQQ.js +47 -0
  80. package/dist/chunk-O7HZX7CA.js +309 -0
  81. package/dist/chunk-OC7LYAU5.js +708 -0
  82. package/dist/chunk-OEX24ECI.js +348 -0
  83. package/dist/chunk-OYOB3ZFG.js +78 -0
  84. package/dist/chunk-OYTMZXRF.js +41 -0
  85. package/dist/chunk-OZJINN4O.js +84 -0
  86. package/dist/chunk-PCHDGUKT.js +23 -0
  87. package/dist/chunk-QOZXJ4NA.js +3364 -0
  88. package/dist/chunk-QYF5S6P6.js +45 -0
  89. package/dist/chunk-RJFED73B.js +79 -0
  90. package/dist/chunk-RTQNRM5X.js +27 -0
  91. package/dist/chunk-S6AMWKPC.js +189 -0
  92. package/dist/chunk-T4QZ6FEH.js +308 -0
  93. package/dist/chunk-T54VJRAD.js +5456 -0
  94. package/dist/chunk-TA5L5KWQ.js +167 -0
  95. package/dist/chunk-TQFBZVCG.js +27 -0
  96. package/dist/chunk-U52SAGRM.js +62 -0
  97. package/dist/chunk-UEAHAMEI.js +5814 -0
  98. package/dist/chunk-UGSMCQ4D.js +327 -0
  99. package/dist/chunk-UOPVJQ4N.js +103 -0
  100. package/dist/chunk-USHG4DLH.js +459 -0
  101. package/dist/chunk-UXVNL3D7.js +23 -0
  102. package/dist/chunk-V5MEBST3.js +4139 -0
  103. package/dist/chunk-VGEVL5EQ.js +29 -0
  104. package/dist/chunk-VPWKF3GN.js +87 -0
  105. package/dist/chunk-VSMJK3ZJ.js +1250 -0
  106. package/dist/chunk-VYKKMYVT.js +560 -0
  107. package/dist/chunk-VZHJS6DR.js +442 -0
  108. package/dist/chunk-WATC3IQR.js +213 -0
  109. package/dist/chunk-WPE5FPGR.js +54 -0
  110. package/dist/chunk-WSEWKCXU.js +188 -0
  111. package/dist/chunk-WW5BLB74.js +659 -0
  112. package/dist/chunk-XGUL4SLQ.js +406 -0
  113. package/dist/chunk-XHSCVSOL.js +170 -0
  114. package/dist/chunk-XIMYZ3JA.js +27 -0
  115. package/dist/chunk-YLN4K6WD.js +385 -0
  116. package/dist/chunk-Z3CCVDUB.js +76 -0
  117. package/dist/chunk-Z54ZSOBZ.js +61 -0
  118. package/dist/chunk-Z6BB4JLQ.js +478 -0
  119. package/dist/chunk-Z7QQA2KT.js +27 -0
  120. package/dist/chunk-ZETYB3XG.js +2626 -0
  121. package/dist/chunk-ZMOMPX2Z.js +87 -0
  122. package/dist/chunk-ZOEYVXSV.js +149 -0
  123. package/dist/chunk-ZZUFZUQZ.js +12120 -0
  124. package/dist/index.js +39712 -29876
  125. package/dist/mcp/analyze-cli.js +186 -232
  126. package/dist/mcp/cli.js +137 -98
  127. package/dist/mcp/server.js +22688 -1573
  128. package/dist/mcp/worker.js +97 -38
  129. package/dist/probes/installer.js +135 -0
  130. package/dist/workers/project-snapshot-persist-worker.js +22 -0
  131. package/dist/workers/review-graph-persist-worker.js +15 -0
  132. package/docs/agent-guide.md +13 -4
  133. package/docs/agent-tools.md +42 -0
  134. package/docs/ast-grep_rules_catalog.md +5 -4
  135. package/docs/configuration.md +28 -2
  136. package/docs/custom-rules.md +25 -2
  137. package/docs/environment-variables.md +86 -8
  138. package/docs/features.md +45 -5
  139. package/docs/globalconfig.md +2 -1
  140. package/docs/io-bridge-v2-migration.md +94 -0
  141. package/docs/lsp-capability-matrix.md +37 -4
  142. package/docs/lsp-idle-eviction.md +124 -0
  143. package/docs/mcp.md +21 -5
  144. package/docs/merge-queue-rollout.md +77 -0
  145. package/docs/pi-lens-fixer.md +160 -88
  146. package/docs/pi-lens-investigator.md +74 -26
  147. package/docs/pi-lens-merge-policy.md +736 -0
  148. package/docs/pi-lens-monitor.md +75 -7
  149. package/docs/pi-lens-retro.md +6 -4
  150. package/docs/pi-lens-reviewer.md +189 -48
  151. package/docs/pi-lens-subagent.md +246 -45
  152. package/docs/pi-lens-warden.md +18 -7
  153. package/docs/public-api-stability.md +55 -0
  154. package/docs/release-qa-baseline.md +84 -17
  155. package/docs/rfcs/3654-unified-io-bridge-v2.md +316 -0
  156. package/docs/schema/pi-lens-config-v1.json +530 -0
  157. package/docs/servercapabilities.md +56 -49
  158. package/docs/settings.md +1 -0
  159. package/docs/usage.md +5 -1
  160. package/docs/word-index.md +6 -0
  161. package/grammars/tree-sitter-bash.wasm +0 -0
  162. package/grammars/tree-sitter-bash.wasm.json +3 -3
  163. package/package.json +19 -7
  164. package/rules/ast-grep-rules/rule-tests/advisory-registry-subset-test.yml +41 -0
  165. package/rules/ast-grep-rules/rule-tests/no-identity-operator-on-literals-test.yml +12 -2
  166. package/rules/ast-grep-rules/rule-tests/throw-new-error-js-test.yml +2 -0
  167. package/rules/ast-grep-rules/rule-tests/throw-new-error-test.yml +2 -0
  168. package/rules/ast-grep-rules/rules/advisory-registry-subset.yml +50 -0
  169. package/rules/ast-grep-rules/rules/no-identity-operator-on-literals.yml +20 -12
  170. package/rules/ast-grep-rules/rules/throw-new-error-js.yml +2 -2
  171. package/rules/ast-grep-rules/rules/throw-new-error.yml +2 -2
  172. package/scripts/analyze-pi-lens-logs.mjs +1275 -62
  173. package/scripts/download-grammars.js +5 -0
  174. package/scripts/grammars.lock.json +6 -1
  175. package/scripts/install-selftest.mjs +33 -34
  176. package/scripts/lib/host-provided-deps.mjs +13 -4
  177. package/scripts/lib/web-tree-sitter-dir.mjs +18 -0
  178. package/dist/clients/actionable-warnings-logger.js +0 -35
  179. package/dist/clients/actionable-warnings.js +0 -1610
  180. package/dist/clients/advisory-provenance.js +0 -593
  181. package/dist/clients/agent-behavior-client.js +0 -147
  182. package/dist/clients/agent-nudge.js +0 -325
  183. package/dist/clients/analysed-root.js +0 -1
  184. package/dist/clients/ast-grep-client.js +0 -731
  185. package/dist/clients/ast-grep-rule-manager.js +0 -146
  186. package/dist/clients/ast-grep-tool-logger.js +0 -118
  187. package/dist/clients/ast-grep-types.js +0 -10
  188. package/dist/clients/ast-grep-yaml-synth.js +0 -154
  189. package/dist/clients/atomic-write-staging.js +0 -75
  190. package/dist/clients/atomic-write.js +0 -189
  191. package/dist/clients/availability-probe-flight.js +0 -12
  192. package/dist/clients/bash-file-access.js +0 -1056
  193. package/dist/clients/biome-client.js +0 -357
  194. package/dist/clients/blocker-freshness.js +0 -837
  195. package/dist/clients/blocker-past-eof.js +0 -129
  196. package/dist/clients/bootstrap.js +0 -569
  197. package/dist/clients/bounded-cache.js +0 -190
  198. package/dist/clients/bounded-pid-file-lock.js +0 -202
  199. package/dist/clients/bounded-telemetry.js +0 -295
  200. package/dist/clients/build-identity.js +0 -95
  201. package/dist/clients/bundled-resource-health.js +0 -113
  202. package/dist/clients/bus-events-logger.js +0 -105
  203. package/dist/clients/bus-publish.js +0 -171
  204. package/dist/clients/cache/rule-cache.js +0 -190
  205. package/dist/clients/cache-manager.js +0 -524
  206. package/dist/clients/cache-observability.js +0 -1313
  207. package/dist/clients/call-graph.js +0 -852
  208. package/dist/clients/cargo-manifest.js +0 -422
  209. package/dist/clients/cascade-budget.js +0 -196
  210. package/dist/clients/cascade-format.js +0 -315
  211. package/dist/clients/cascade-logger.js +0 -31
  212. package/dist/clients/cascade-types.js +0 -9
  213. package/dist/clients/child-unref.js +0 -124
  214. package/dist/clients/code-quality-warnings.js +0 -286
  215. package/dist/clients/codebase-model.js +0 -173
  216. package/dist/clients/collateral-test-role.js +0 -40
  217. package/dist/clients/complexity-client.js +0 -462
  218. package/dist/clients/config-core/deny.js +0 -221
  219. package/dist/clients/config-core/index.js +0 -50
  220. package/dist/clients/config-core/merge.js +0 -357
  221. package/dist/clients/config-core/normalize.js +0 -340
  222. package/dist/clients/config-core/process-spec.js +0 -248
  223. package/dist/clients/config-core/provenance.js +0 -164
  224. package/dist/clients/config-core/records.js +0 -218
  225. package/dist/clients/config-core/resolve.js +0 -125
  226. package/dist/clients/config-core/safe-object.js +0 -78
  227. package/dist/clients/config-core/schema.js +0 -165
  228. package/dist/clients/config-diagnostic-codes.js +0 -285
  229. package/dist/clients/config-locations.js +0 -388
  230. package/dist/clients/config-resolve.js +0 -798
  231. package/dist/clients/config-schema.js +0 -251
  232. package/dist/clients/config-warn.js +0 -407
  233. package/dist/clients/console-guard-install.js +0 -26
  234. package/dist/clients/cooperative-budget.js +0 -42
  235. package/dist/clients/dead-code-client.js +0 -510
  236. package/dist/clients/dead-code-logger.js +0 -30
  237. package/dist/clients/deadline-utils.js +0 -280
  238. package/dist/clients/debug-handles.js +0 -211
  239. package/dist/clients/debug-heap.js +0 -174
  240. package/dist/clients/deferred-lsp-work.js +0 -106
  241. package/dist/clients/degradation-ledger.js +0 -426
  242. package/dist/clients/demoted-finding-render.js +0 -169
  243. package/dist/clients/dependency-checker.js +0 -885
  244. package/dist/clients/deps/ast-grep-napi.js +0 -22
  245. package/dist/clients/deps/js-yaml.js +0 -9
  246. package/dist/clients/deps/minimatch.js +0 -4
  247. package/dist/clients/deps/pi-tui.js +0 -14
  248. package/dist/clients/deps/typebox.js +0 -14
  249. package/dist/clients/deps/vscode-jsonrpc.js +0 -1
  250. package/dist/clients/deps/web-tree-sitter.js +0 -24
  251. package/dist/clients/diagnostic-dispositions.js +0 -630
  252. package/dist/clients/diagnostic-line-freshness.js +0 -305
  253. package/dist/clients/diagnostic-logger.js +0 -73
  254. package/dist/clients/diagnostic-tracker.js +0 -105
  255. package/dist/clients/diagnostics-publish.js +0 -230
  256. package/dist/clients/dispatch/ast-grep-catalog.js +0 -65
  257. package/dist/clients/dispatch/auxiliary-lsp.js +0 -343
  258. package/dist/clients/dispatch/collect-later-tier.js +0 -35
  259. package/dist/clients/dispatch/diagnostic-taxonomy.js +0 -66
  260. package/dist/clients/dispatch/dispatcher.js +0 -1269
  261. package/dist/clients/dispatch/fact-provider-types.js +0 -1
  262. package/dist/clients/dispatch/fact-rule-runner.js +0 -17
  263. package/dist/clients/dispatch/fact-runner.js +0 -30
  264. package/dist/clients/dispatch/fact-scheduler.js +0 -68
  265. package/dist/clients/dispatch/fact-store.js +0 -377
  266. package/dist/clients/dispatch/facts/comment-facts.js +0 -22
  267. package/dist/clients/dispatch/facts/file-content.js +0 -19
  268. package/dist/clients/dispatch/facts/function-facts.js +0 -348
  269. package/dist/clients/dispatch/facts/import-facts.js +0 -204
  270. package/dist/clients/dispatch/facts/tree-sitter-facts.js +0 -34
  271. package/dist/clients/dispatch/facts/try-catch-facts.js +0 -119
  272. package/dist/clients/dispatch/finding-policy.js +0 -339
  273. package/dist/clients/dispatch/indent-detect.js +0 -417
  274. package/dist/clients/dispatch/inline-suppressions.js +0 -89
  275. package/dist/clients/dispatch/integration.js +0 -2377
  276. package/dist/clients/dispatch/lazy.js +0 -11
  277. package/dist/clients/dispatch/pending-runner-findings.js +0 -87
  278. package/dist/clients/dispatch/plan.js +0 -278
  279. package/dist/clients/dispatch/priorities.js +0 -20
  280. package/dist/clients/dispatch/rule-id-normalize.js +0 -50
  281. package/dist/clients/dispatch/rule-ignores.js +0 -69
  282. package/dist/clients/dispatch/rule-policy.js +0 -135
  283. package/dist/clients/dispatch/rules/async-noise.js +0 -40
  284. package/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +0 -27
  285. package/dist/clients/dispatch/rules/cors-wildcard.js +0 -54
  286. package/dist/clients/dispatch/rules/error-obscuring.js +0 -32
  287. package/dist/clients/dispatch/rules/error-swallowing.js +0 -31
  288. package/dist/clients/dispatch/rules/framework-call-noise.js +0 -67
  289. package/dist/clients/dispatch/rules/high-complexity.js +0 -72
  290. package/dist/clients/dispatch/rules/high-fan-out.js +0 -74
  291. package/dist/clients/dispatch/rules/high-import-coupling.js +0 -37
  292. package/dist/clients/dispatch/rules/missing-error-propagation.js +0 -62
  293. package/dist/clients/dispatch/rules/no-commented-credentials.js +0 -52
  294. package/dist/clients/dispatch/rules/pass-through-wrappers.js +0 -42
  295. package/dist/clients/dispatch/rules/placeholder-comments.js +0 -40
  296. package/dist/clients/dispatch/rules/unsafe-boundary.js +0 -126
  297. package/dist/clients/dispatch/runner-context.js +0 -52
  298. package/dist/clients/dispatch/runners/actionlint.js +0 -111
  299. package/dist/clients/dispatch/runners/ast-grep-napi.js +0 -1196
  300. package/dist/clients/dispatch/runners/biome-check.js +0 -296
  301. package/dist/clients/dispatch/runners/cpp-check.js +0 -219
  302. package/dist/clients/dispatch/runners/credo.js +0 -82
  303. package/dist/clients/dispatch/runners/cue-vet.js +0 -416
  304. package/dist/clients/dispatch/runners/dart-analyze.js +0 -183
  305. package/dist/clients/dispatch/runners/detekt.js +0 -176
  306. package/dist/clients/dispatch/runners/dotnet-build.js +0 -164
  307. package/dist/clients/dispatch/runners/elixir-check.js +0 -195
  308. package/dist/clients/dispatch/runners/eslint.js +0 -137
  309. package/dist/clients/dispatch/runners/fact-rules.js +0 -29
  310. package/dist/clients/dispatch/runners/fish-indent.js +0 -69
  311. package/dist/clients/dispatch/runners/gleam-check.js +0 -167
  312. package/dist/clients/dispatch/runners/go-vet.js +0 -104
  313. package/dist/clients/dispatch/runners/golangci-lint.js +0 -135
  314. package/dist/clients/dispatch/runners/hadolint.js +0 -91
  315. package/dist/clients/dispatch/runners/helm-lint.js +0 -171
  316. package/dist/clients/dispatch/runners/helm-render.js +0 -940
  317. package/dist/clients/dispatch/runners/htmlhint.js +0 -117
  318. package/dist/clients/dispatch/runners/index.js +0 -108
  319. package/dist/clients/dispatch/runners/javac.js +0 -99
  320. package/dist/clients/dispatch/runners/ktlint.js +0 -110
  321. package/dist/clients/dispatch/runners/lsp.js +0 -379
  322. package/dist/clients/dispatch/runners/markdownlint.js +0 -167
  323. package/dist/clients/dispatch/runners/mypy.js +0 -102
  324. package/dist/clients/dispatch/runners/oxlint.js +0 -414
  325. package/dist/clients/dispatch/runners/php-lint.js +0 -85
  326. package/dist/clients/dispatch/runners/phpstan.js +0 -120
  327. package/dist/clients/dispatch/runners/prisma-validate.js +0 -62
  328. package/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -445
  329. package/dist/clients/dispatch/runners/pyright.js +0 -169
  330. package/dist/clients/dispatch/runners/rubocop.js +0 -99
  331. package/dist/clients/dispatch/runners/ruff.js +0 -88
  332. package/dist/clients/dispatch/runners/rust-clippy.js +0 -256
  333. package/dist/clients/dispatch/runners/shellcheck.js +0 -173
  334. package/dist/clients/dispatch/runners/shfmt.js +0 -102
  335. package/dist/clients/dispatch/runners/spellcheck.js +0 -128
  336. package/dist/clients/dispatch/runners/spotbugs.js +0 -259
  337. package/dist/clients/dispatch/runners/sqlfluff.js +0 -183
  338. package/dist/clients/dispatch/runners/stylelint.js +0 -166
  339. package/dist/clients/dispatch/runners/swiftlint.js +0 -163
  340. package/dist/clients/dispatch/runners/taplo.js +0 -174
  341. package/dist/clients/dispatch/runners/terragrunt.js +0 -168
  342. package/dist/clients/dispatch/runners/tflint.js +0 -125
  343. package/dist/clients/dispatch/runners/tree-sitter.js +0 -643
  344. package/dist/clients/dispatch/runners/trivy-config.js +0 -253
  345. package/dist/clients/dispatch/runners/utils/availability-policy.js +0 -496
  346. package/dist/clients/dispatch/runners/utils/candidate-probe.js +0 -90
  347. package/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -95
  348. package/dist/clients/dispatch/runners/utils/lazy-installer.js +0 -274
  349. package/dist/clients/dispatch/runners/utils/runner-helpers.js +0 -1701
  350. package/dist/clients/dispatch/runners/utils/spawn-outcome.js +0 -101
  351. package/dist/clients/dispatch/runners/utils/tool-failure.js +0 -235
  352. package/dist/clients/dispatch/runners/utils/toolchain-availability.js +0 -169
  353. package/dist/clients/dispatch/runners/utils.js +0 -15
  354. package/dist/clients/dispatch/runners/vale.js +0 -128
  355. package/dist/clients/dispatch/runners/yaml-rule-parser.js +0 -242
  356. package/dist/clients/dispatch/runners/yamllint.js +0 -95
  357. package/dist/clients/dispatch/runners/zig-check.js +0 -79
  358. package/dist/clients/dispatch/suppress-writer.js +0 -79
  359. package/dist/clients/dispatch/tool-profile.js +0 -30
  360. package/dist/clients/dispatch/types.js +0 -21
  361. package/dist/clients/dispatch/utils/format-utils.js +0 -45
  362. package/dist/clients/dispatch/utils/lsp-diagnostics.js +0 -35
  363. package/dist/clients/disposition-logger.js +0 -32
  364. package/dist/clients/disposition-publish.js +0 -124
  365. package/dist/clients/durable-store.js +0 -97
  366. package/dist/clients/effective-config.js +0 -415
  367. package/dist/clients/env-utils.js +0 -83
  368. package/dist/clients/error-class.js +0 -23
  369. package/dist/clients/eval-timestamp.js +0 -17
  370. package/dist/clients/event-loop-hold.js +0 -274
  371. package/dist/clients/event-loop-monitor.js +0 -250
  372. package/dist/clients/extension-log.js +0 -504
  373. package/dist/clients/extension-mode.js +0 -73
  374. package/dist/clients/feature-hints.js +0 -103
  375. package/dist/clients/file-kinds.js +0 -412
  376. package/dist/clients/file-role.js +0 -134
  377. package/dist/clients/file-time.js +0 -160
  378. package/dist/clients/file-utils.js +0 -1032
  379. package/dist/clients/finding-delivery-gate.js +0 -494
  380. package/dist/clients/finding-identity.js +0 -88
  381. package/dist/clients/fix-worklog.js +0 -103
  382. package/dist/clients/format-events-publish.js +0 -343
  383. package/dist/clients/format-service.js +0 -222
  384. package/dist/clients/formatters-lazy.js +0 -9
  385. package/dist/clients/formatters.js +0 -2032
  386. package/dist/clients/freshness-cadence.js +0 -17
  387. package/dist/clients/freshness.js +0 -38
  388. package/dist/clients/generated-artifacts.js +0 -394
  389. package/dist/clients/generation-guard.js +0 -215
  390. package/dist/clients/git-guard.js +0 -1136
  391. package/dist/clients/git-tracked-ignore.js +0 -243
  392. package/dist/clients/gitleaks-client.js +0 -509
  393. package/dist/clients/go-client.js +0 -104
  394. package/dist/clients/govulncheck-client.js +0 -605
  395. package/dist/clients/gradle-ktfmt-style.js +0 -348
  396. package/dist/clients/grammar-source.js +0 -465
  397. package/dist/clients/gzip-stage-write.js +0 -135
  398. package/dist/clients/hashline-anchor.js +0 -424
  399. package/dist/clients/hook-budgets.js +0 -76
  400. package/dist/clients/host-edit-normalize.js +0 -140
  401. package/dist/clients/host-ports.js +0 -39
  402. package/dist/clients/indent-retarget.js +0 -154
  403. package/dist/clients/inline-blocker-dispositions.js +0 -186
  404. package/dist/clients/install-diagnostics.js +0 -156
  405. package/dist/clients/installer/index.js +0 -5416
  406. package/dist/clients/installer/managed-tool-refresh-session.js +0 -58
  407. package/dist/clients/installer/managed-tool-refresh.js +0 -783
  408. package/dist/clients/instance-reaper-state.js +0 -7
  409. package/dist/clients/instance-reaper.js +0 -1137
  410. package/dist/clients/instance-registry-lock.js +0 -145
  411. package/dist/clients/instance-registry.js +0 -773
  412. package/dist/clients/jscpd-client.js +0 -378
  413. package/dist/clients/json-cache-read.js +0 -65
  414. package/dist/clients/knip-client.js +0 -788
  415. package/dist/clients/language-policy.js +0 -252
  416. package/dist/clients/language-profile.js +0 -361
  417. package/dist/clients/language-registry.js +0 -603
  418. package/dist/clients/latency-logger.js +0 -727
  419. package/dist/clients/lazy-import.js +0 -21
  420. package/dist/clients/ledger-bounds.js +0 -54
  421. package/dist/clients/lens-config.js +0 -404
  422. package/dist/clients/lens-engine.js +0 -358
  423. package/dist/clients/lens-events.js +0 -125
  424. package/dist/clients/lens-flag-registry.js +0 -467
  425. package/dist/clients/lens-map.js +0 -1156
  426. package/dist/clients/live-bus-emitter.js +0 -74
  427. package/dist/clients/log-cleanup.js +0 -222
  428. package/dist/clients/lsp/aggregation.js +0 -178
  429. package/dist/clients/lsp/cascade-tier.js +0 -421
  430. package/dist/clients/lsp/client.js +0 -4593
  431. package/dist/clients/lsp/config.js +0 -691
  432. package/dist/clients/lsp/content-limits.js +0 -41
  433. package/dist/clients/lsp/diagnostic-binding.js +0 -225
  434. package/dist/clients/lsp/document-drift.js +0 -467
  435. package/dist/clients/lsp/edits.js +0 -1219
  436. package/dist/clients/lsp/index.js +0 -8305
  437. package/dist/clients/lsp/inferred-project.js +0 -216
  438. package/dist/clients/lsp/jvm-runtime.js +0 -298
  439. package/dist/clients/lsp/language.js +0 -63
  440. package/dist/clients/lsp/launch.js +0 -746
  441. package/dist/clients/lsp/lombok.js +0 -158
  442. package/dist/clients/lsp/path-utils.js +0 -5
  443. package/dist/clients/lsp/pending-aux-coverage.js +0 -251
  444. package/dist/clients/lsp/position-encoding.js +0 -61
  445. package/dist/clients/lsp/ruby-drive-dirs.js +0 -83
  446. package/dist/clients/lsp/server.js +0 -3290
  447. package/dist/clients/lsp/session-roots.js +0 -192
  448. package/dist/clients/lsp/spawn-history.js +0 -17
  449. package/dist/clients/lsp/sync-kind.js +0 -56
  450. package/dist/clients/lsp/tsserver-sync.js +0 -332
  451. package/dist/clients/lsp/wait-policy/capability-snapshot.js +0 -1
  452. package/dist/clients/lsp/wait-policy/classification.js +0 -85
  453. package/dist/clients/lsp/wait-policy/index.js +0 -10
  454. package/dist/clients/lsp/wait-policy/strategies.js +0 -392
  455. package/dist/clients/lsp/watch-queue.js +0 -61
  456. package/dist/clients/lsp/workspace-diagnostics-cache.js +0 -639
  457. package/dist/clients/lsp/workspace-diagnostics-session.js +0 -30
  458. package/dist/clients/lsp/workspace-sweep-hold.js +0 -184
  459. package/dist/clients/lsp-budget.js +0 -186
  460. package/dist/clients/lsp-document-symbols.js +0 -110
  461. package/dist/clients/lsp-lazy.js +0 -9
  462. package/dist/clients/lsp-mutation.js +0 -396
  463. package/dist/clients/lsp-status.js +0 -59
  464. package/dist/clients/map-with-concurrency.js +0 -40
  465. package/dist/clients/mcp/analyze.js +0 -420
  466. package/dist/clients/mcp/host-shim.js +0 -31
  467. package/dist/clients/mcp/ipc.js +0 -523
  468. package/dist/clients/mcp/review.js +0 -197
  469. package/dist/clients/mcp/session.js +0 -412
  470. package/dist/clients/memory-sampler.js +0 -208
  471. package/dist/clients/message-end-attribution.js +0 -30
  472. package/dist/clients/metrics-client.js +0 -107
  473. package/dist/clients/metrics-history.js +0 -327
  474. package/dist/clients/middle-man-analysis.js +0 -263
  475. package/dist/clients/model-provider.js +0 -53
  476. package/dist/clients/module-report-lsp.js +0 -189
  477. package/dist/clients/module-report.js +0 -2150
  478. package/dist/clients/mutating-tool.js +0 -651
  479. package/dist/clients/mutation-attribution.js +0 -368
  480. package/dist/clients/mutation-bridge.js +0 -240
  481. package/dist/clients/ndjson-logger.js +0 -734
  482. package/dist/clients/observed-mutation-sources.js +0 -101
  483. package/dist/clients/observed-mutation.js +0 -1253
  484. package/dist/clients/oldtext-autopatch.js +0 -128
  485. package/dist/clients/opaque-mutation-scan.js +0 -496
  486. package/dist/clients/opengrep-client.js +0 -333
  487. package/dist/clients/opengrep-config.js +0 -76
  488. package/dist/clients/package-manager.js +0 -607
  489. package/dist/clients/package-root.js +0 -38
  490. package/dist/clients/partial-edit-apply.js +0 -439
  491. package/dist/clients/path-attribution-telemetry.js +0 -43
  492. package/dist/clients/path-keyed-map.js +0 -108
  493. package/dist/clients/path-utils.js +0 -1244
  494. package/dist/clients/performance-report.js +0 -331
  495. package/dist/clients/persist-debounce.js +0 -70
  496. package/dist/clients/persistent-reverify.js +0 -271
  497. package/dist/clients/php-cs-fixer-config.js +0 -119
  498. package/dist/clients/pipeline.js +0 -1480
  499. package/dist/clients/post-autofix-notice.js +0 -37
  500. package/dist/clients/print-mode.js +0 -21
  501. package/dist/clients/probe-home-state.js +0 -228
  502. package/dist/clients/process-bridge.js +0 -66
  503. package/dist/clients/process-singletons.js +0 -210
  504. package/dist/clients/process-snapshot.js +0 -68
  505. package/dist/clients/project-changes.js +0 -181
  506. package/dist/clients/project-conventions.js +0 -171
  507. package/dist/clients/project-diagnostics/cache.js +0 -137
  508. package/dist/clients/project-diagnostics/extractors.js +0 -109
  509. package/dist/clients/project-diagnostics/fresh-fetch.js +0 -668
  510. package/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +0 -118
  511. package/dist/clients/project-diagnostics/runner-adapters/dead-code.js +0 -47
  512. package/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +0 -40
  513. package/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +0 -34
  514. package/dist/clients/project-diagnostics/runner-adapters/jscpd.js +0 -38
  515. package/dist/clients/project-diagnostics/runner-adapters/knip.js +0 -47
  516. package/dist/clients/project-diagnostics/runner-adapters/madge.js +0 -48
  517. package/dist/clients/project-diagnostics/runner-adapters/opengrep.js +0 -40
  518. package/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +0 -127
  519. package/dist/clients/project-diagnostics/runner-adapters/trivy.js +0 -81
  520. package/dist/clients/project-diagnostics/scanner.js +0 -520
  521. package/dist/clients/project-diagnostics/types.js +0 -1
  522. package/dist/clients/project-lens-config.js +0 -807
  523. package/dist/clients/project-report.js +0 -701
  524. package/dist/clients/project-scale.js +0 -237
  525. package/dist/clients/project-scan-policy.js +0 -11
  526. package/dist/clients/project-snapshot-fingerprint.js +0 -48
  527. package/dist/clients/project-snapshot-persist-worker.js +0 -20
  528. package/dist/clients/project-snapshot.js +0 -1653
  529. package/dist/clients/project-trust.js +0 -181
  530. package/dist/clients/python-environment.js +0 -217
  531. package/dist/clients/python-provenance.js +0 -639
  532. package/dist/clients/quiet-window-config.js +0 -47
  533. package/dist/clients/quiet-window.js +0 -236
  534. package/dist/clients/read-bridge.js +0 -139
  535. package/dist/clients/read-expansion.js +0 -266
  536. package/dist/clients/read-guard-logger.js +0 -251
  537. package/dist/clients/read-guard-tool-lines.js +0 -1306
  538. package/dist/clients/read-guard.js +0 -1561
  539. package/dist/clients/recent-touches.js +0 -240
  540. package/dist/clients/redact/secrets.js +0 -449
  541. package/dist/clients/resource-sampler.js +0 -628
  542. package/dist/clients/reverse-deps.js +0 -270
  543. package/dist/clients/review-graph/builder.js +0 -5126
  544. package/dist/clients/review-graph/format.js +0 -33
  545. package/dist/clients/review-graph/git-identity.js +0 -163
  546. package/dist/clients/review-graph/import-resolvers.js +0 -481
  547. package/dist/clients/review-graph/persist-worker.js +0 -10
  548. package/dist/clients/review-graph/query.js +0 -244
  549. package/dist/clients/review-graph/revision-drift.js +0 -21
  550. package/dist/clients/review-graph/service.js +0 -96
  551. package/dist/clients/review-graph/shared-extraction-ir.js +0 -82
  552. package/dist/clients/review-graph/symbol-id.js +0 -103
  553. package/dist/clients/review-graph/tsconfig-paths.js +0 -299
  554. package/dist/clients/review-graph/types.js +0 -1
  555. package/dist/clients/review-graph/workspace-modules.js +0 -449
  556. package/dist/clients/review-graph-logger.js +0 -81
  557. package/dist/clients/ruff-client.js +0 -179
  558. package/dist/clients/rules-scanner.js +0 -131
  559. package/dist/clients/run-duration.js +0 -55
  560. package/dist/clients/runtime-agent-end.js +0 -746
  561. package/dist/clients/runtime-config.js +0 -77
  562. package/dist/clients/runtime-context.js +0 -211
  563. package/dist/clients/runtime-coordinator.js +0 -1324
  564. package/dist/clients/runtime-session.js +0 -2485
  565. package/dist/clients/runtime-tool-call.js +0 -1295
  566. package/dist/clients/runtime-tool-result.js +0 -2049
  567. package/dist/clients/runtime-turn.js +0 -3767
  568. package/dist/clients/rust-client.js +0 -97
  569. package/dist/clients/safe-spawn.js +0 -2357
  570. package/dist/clients/sanitize.js +0 -286
  571. package/dist/clients/scan-utils.js +0 -25
  572. package/dist/clients/scratch-tree-policy.js +0 -165
  573. package/dist/clients/search-read-registration.js +0 -94
  574. package/dist/clients/secret-findings.js +0 -114
  575. package/dist/clients/security-scan-client.js +0 -352
  576. package/dist/clients/session-event-guard.js +0 -297
  577. package/dist/clients/session-lifecycle.js +0 -484
  578. package/dist/clients/session-start-observability.js +0 -94
  579. package/dist/clients/session-state-store.js +0 -101
  580. package/dist/clients/session-summary.js +0 -15
  581. package/dist/clients/sessionstart-logger.js +0 -27
  582. package/dist/clients/sg-runner.js +0 -876
  583. package/dist/clients/sgconfig.js +0 -347
  584. package/dist/clients/shared-checkout-guard.js +0 -338
  585. package/dist/clients/single-flight.js +0 -158
  586. package/dist/clients/situational-tool-telemetry.js +0 -108
  587. package/dist/clients/skills-resolver.js +0 -141
  588. package/dist/clients/slow-fs.js +0 -138
  589. package/dist/clients/smells-rollup.js +0 -231
  590. package/dist/clients/source-filter.js +0 -596
  591. package/dist/clients/source-walker.js +0 -211
  592. package/dist/clients/spawn-output-cap.js +0 -120
  593. package/dist/clients/spawn-timeout-cooldown.js +0 -110
  594. package/dist/clients/stale-marker.js +0 -17
  595. package/dist/clients/startup-scan.js +0 -400
  596. package/dist/clients/startup-timing.js +0 -130
  597. package/dist/clients/string-utils.js +0 -33
  598. package/dist/clients/subagent-mode.js +0 -111
  599. package/dist/clients/symbol-containment.js +0 -24
  600. package/dist/clients/symbol-types.js +0 -5
  601. package/dist/clients/test-runner-client.js +0 -2507
  602. package/dist/clients/test-runner-delivery.js +0 -287
  603. package/dist/clients/todo-scanner.js +0 -229
  604. package/dist/clients/tool-agreement.js +0 -423
  605. package/dist/clients/tool-config.js +0 -249
  606. package/dist/clients/tool-cwd.js +0 -270
  607. package/dist/clients/tool-definition.js +0 -47
  608. package/dist/clients/tool-event.js +0 -105
  609. package/dist/clients/tool-policy.js +0 -2755
  610. package/dist/clients/tool-probe.js +0 -53
  611. package/dist/clients/tool-render.js +0 -156
  612. package/dist/clients/tool-set-policy.js +0 -118
  613. package/dist/clients/tree-sitter-cache.js +0 -364
  614. package/dist/clients/tree-sitter-client.js +0 -4195
  615. package/dist/clients/tree-sitter-logger.js +0 -100
  616. package/dist/clients/tree-sitter-navigator.js +0 -269
  617. package/dist/clients/tree-sitter-query-loader.js +0 -569
  618. package/dist/clients/tree-sitter-shared.js +0 -158
  619. package/dist/clients/tree-sitter-symbol-extractor.js +0 -1265
  620. package/dist/clients/trivy-client.js +0 -467
  621. package/dist/clients/tui-fit.js +0 -50
  622. package/dist/clients/turn-context.js +0 -52
  623. package/dist/clients/turn-end/lane.js +0 -51
  624. package/dist/clients/turn-end/lanes/govulncheck.js +0 -112
  625. package/dist/clients/turn-end/lanes/secrets.js +0 -204
  626. package/dist/clients/turn-summary-render.js +0 -72
  627. package/dist/clients/turn-summary.js +0 -132
  628. package/dist/clients/typos-config.js +0 -29
  629. package/dist/clients/user-notify.js +0 -51
  630. package/dist/clients/vanished-instance-marker.js +0 -57
  631. package/dist/clients/warm-attach.js +0 -305
  632. package/dist/clients/widget-state.js +0 -1808
  633. package/dist/clients/word-index-logger.js +0 -49
  634. package/dist/clients/word-index-store.js +0 -459
  635. package/dist/clients/word-index.js +0 -2080
  636. package/dist/clients/workspace-topology.js +0 -443
  637. package/dist/clients/write-ordering-guard.js +0 -65
  638. package/dist/clients/zizmor-config.js +0 -340
  639. package/dist/i18n.js +0 -69
  640. package/dist/mcp/build-staleness.js +0 -124
  641. package/dist/scripts/lib/process-scan.mjs +0 -583
  642. package/dist/scripts/lib/skills-predicate.mjs +0 -129
  643. package/dist/scripts/lib/web-tree-sitter-dir.mjs +0 -123
  644. package/dist/tools/activate-tools.js +0 -87
  645. package/dist/tools/ast-grep-outline.js +0 -137
  646. package/dist/tools/ast-grep-replace.js +0 -244
  647. package/dist/tools/ast-grep-search.js +0 -762
  648. package/dist/tools/effective-config.js +0 -90
  649. package/dist/tools/lens-diagnostic-mark.js +0 -375
  650. package/dist/tools/lens-diagnostics.js +0 -2571
  651. package/dist/tools/lsp-diagnostics.js +0 -1745
  652. package/dist/tools/lsp-navigation.js +0 -1367
  653. package/dist/tools/lsp-structured-output.js +0 -294
  654. package/dist/tools/module-report.js +0 -382
  655. package/dist/tools/project-report.js +0 -86
  656. package/dist/tools/render-compact.js +0 -374
  657. package/dist/tools/scan-progress.js +0 -53
  658. package/dist/tools/shared.js +0 -29
  659. package/dist/tools/symbol-search.js +0 -155
@@ -0,0 +1,736 @@
1
+ # pi-lens merge policy — role contract
2
+
3
+ Run the review → verify → merge policy over one or more open PRs: landing a
4
+ PR, babysitting the merge queue, processing a review backlog. It encodes the
5
+ standing quality gates so any session applies the same discipline.
6
+
7
+ > Source of truth for every rule below is `AGENTS.md` ("Orchestration and
8
+ > delegated work", plus the defect catalog). This file
9
+ > is the procedure and the record; on any conflict AGENTS.md wins. It replaces
10
+ > the former `merge-train` skill (#3837); the merge-train lane that skill also
11
+ > described is retired.
12
+
13
+ The policy that landed the 2026-08-17 arc (11 PRs, every one adversarially
14
+ reviewed, zero unreviewed merges). Apply it to each PR in the queue.
15
+
16
+ A fix to a CI lane or workflow is accepted only when that lane's own run on
17
+ the PR's exact head completes inside its `timeout-minutes`, with the
18
+ acceptance surface quoted from that run's log. Any self-bound inside the lane
19
+ must sit below the job cap by a stated margin so the loud-failure path is
20
+ reachable.
21
+
22
+ Every PR body starts with `## Why`, `## Notes for the reviewer`, and
23
+ `## Change outline`, followed by the existing `## Summary`, `## Tests`,
24
+ `## Blast radius`, `## Class sweep`, and `## Observability` sections. The
25
+ change outline is the changed symbol's caller/callee tree with `+`/`-` on
26
+ moved lines; include only structural views that changed.
27
+
28
+ ## The loop, per PR
29
+
30
+ 1. **Review.** Spawn `pi-lens-reviewer` (worktree isolation) with the PR
31
+ number, a one-paragraph summary of the claim, and any PR-specific attack
32
+ angles. Self-authored and small PRs get reviewed too — the depth follows
33
+ the review tier below, never the priority label.
34
+ 2. **Fix rounds.** Send findings back to the PR's original author agent when
35
+ its worktree survives (SendMessage — cheapest context); otherwise spawn
36
+ `pi-lens-fixer` on the branch with the findings inlined.
37
+ **Since #2486, `SubagentStop` REAPS the stopped agent's own worktree**
38
+ (maintainer decision, 2026-09-02, reversing the earlier "never removes
39
+ here" rule, which left ten stale trees in one afternoon). So by default an
40
+ agent's tree is gone the moment it finishes, and SendMessage to it lands on
41
+ a branch with no checkout. Its branch survives — a tree is never removed
42
+ unless its HEAD is already in an `origin/*` ref — so nothing committed is
43
+ lost and a fresh `pi-lens-fixer` on the branch always works. If this
44
+ session intends to resume fixers by SendMessage, export
45
+ `PILENS_HYGIENE_KEEP_AGENT_TREES=1` for the session (or add
46
+ `--keep-agent-tree` to the registered hook) and the reap is off.
47
+ Kept trees are then reaped by the `SessionStart` sweep —
48
+ which runs on `startup` and `resume` only, not on `/clear`, compaction or a
49
+ fork — once they have been idle ≥30m and are clean and pushed. Idle is
50
+ measured from the checkout directory and the worktree's HEAD (and its
51
+ reflog), never from the git index, so the sweep's own dirty check cannot
52
+ make a finished tree look busy.
53
+ A tree with uncommitted work, or with work not yet on an `origin/*` ref, is
54
+ never removed at any age, by any sweep — so a fix round in flight is safe by
55
+ its own state, not by the clock.
56
+ 3. **Verify.** The SAME reviewer verifies each fix round with its own probes.
57
+ Do not take the fixer's word; do not swap reviewers mid-PR. A reviewer's
58
+ worktree is an `agent-*` tree too, so once its report lands the tree is
59
+ clean+pushed and `SubagentStop` reaps it exactly like a fixer's — a
60
+ SendMessage resume finds no checkout, same as above. Recreate it: the
61
+ merge-train practice is a FRESH reviewer worktree per VERIFY round, not a
62
+ kept one. Continuity is the reviewer AGENT (SendMessage still reaches the
63
+ same identity, so the same judgment and probes carry over); the checkout
64
+ under it is expected to be rebuilt each round, not preserved. Do not set
65
+ `--keep-agent-tree` / `PILENS_HYGIENE_KEEP_AGENT_TREES=1` merely to dodge
66
+ this — that decision stays off by default (see step 2).
67
+ 4. **Merge gate.** Merge only when: verdict is merge-ready; every gating check
68
+ genuinely EXECUTED and passed on the exact head SHA
69
+ (`node scripts/ci-verdict.mjs <pr-number|sha>` — a DIRTY PR silently skips
70
+ them, absent is not green); every failing check
71
+ was read and judged (infra failures — codeload 429/503, SARIF-upload
72
+ errors, Initialize-CodeQL outages — may be waved through only with the
73
+ log read and the judgment recorded). A PR that is green on its head but
74
+ whose merge with `origin/master` was not tested against the exact-pin
75
+ sweeps is not green — run the sweep on the merge before merging. Apply
76
+ AGENTS.md's one mutation layer (#4005): new-guard proof and demonstrated
77
+ correctness gaps gate the merge. `ci-verdict` prints no mutation line, and
78
+ the nightly Stryker report is not a merge input.
79
+ 5. **Merge.** `gh pr merge <N> --merge` (merge commit, repo convention).
80
+ If "not up to date", `gh api -X PUT .../pulls/<N>/update-branch`, wait for
81
+ CI, re-gate, merge. On GitHub 503s: retry with backoff, never switch to
82
+ raw-API merge endpoints.
83
+ Alternative, once the verdict is in: arm GitHub auto-merge
84
+ (`gh pr merge <N> --auto --merge`) and let it land the PR when the required
85
+ checks are green on the current head. Steps 1 through 4 are unchanged: arm
86
+ it only after the review verdict and with the pushed SHA verified.
87
+ 6. **After each merge.** Master moved: check other open PRs for BEHIND/DIRTY,
88
+ check in-flight agents for file overlap with the merged diff and nudge
89
+ affected ones to merge origin/master before their next push.
90
+ Then prune the lane — and ONLY the lane: the merged-ness test is "this
91
+ tree's branch is the head of the PR just merged" (`gh pr view <n> --json
92
+ headRefName`), never `merge-base --is-ancestor`: a live fixer's branch
93
+ with no commits yet passes the ancestor test, and on 2026-09-06 that
94
+ removed #2358's tree with its uncommitted work. `git worktree remove` every tree on the merged
95
+ branch (fixer AND reviewer trees, wherever they were created) and delete
96
+ the merged local branch. A lane's tree lives until its PR merges, not
97
+ after — the orchestrator owns this step; the reaper only sees
98
+ `.claude/worktrees/agent-*`, and on 2026-09-06 twenty-one merged trees
99
+ were still standing at the regroup.
100
+
101
+ ## Merge queue (once the maintainer enables it, #3754)
102
+
103
+ The repository merges through GitHub's merge queue after the maintainer applies
104
+ the settings in `docs/merge-queue-rollout.md`. Until then every rule above is
105
+ unchanged. With the queue on:
106
+
107
+ - **Enqueue, do not merge.** `gh pr merge <N> --merge` (add `--auto` while
108
+ checks are still pending) enqueues the PR: `gh` routes through the queue when
109
+ the base branch requires one, and a direct merge is refused (step 5). The queue tests the PR merged onto the
110
+ LATEST master in a `gh-readonly-queue/master/pr-<N>-<sha>` ref via a
111
+ `merge_group` run of `ci.yml` and `lint.yml`, then merges it with a merge
112
+ commit.
113
+ - **In the queue is a state, not absent and not done.** `ci-verdict <pr>` on a
114
+ queued PR with a green head exits 3, kind `in-queue`, naming the queue state
115
+ and position (`--wait` keeps waiting). A PR that was ejected after a FAILED
116
+ queue run exits 1, kind `failed`, reason `merge queue run failed and ejected
117
+ the PR`, with the failing job, step and test lines read from the
118
+ `merge_group` run. Treat that exactly as a red PR run: fix, push, enqueue
119
+ again. A failure from before the head's last push is an earlier head's and is
120
+ ignored. The queue read is one GraphQL call each time a poll finds the head's
121
+ own checks green (a red or still-running head costs none); an in-queue PR
122
+ stays pending, so under `--wait` the queue is re-read once per poll until it
123
+ merges or ejects. Without a queue on master it is the only extra call.
124
+ - **Retire update-branch and BEHIND.** The queue tests against the latest
125
+ master itself, so `gh pr update-branch`, "not up to date" retries, and the
126
+ `gh run rerun` replays-the-old-merge-commit workaround are moot. Worse, any
127
+ push to a queued PR re-runs every check and EJECTS it;
128
+ ci-verdict's update-branch hint reads "do not update-branch" when master has a
129
+ queue. The pre-queue rules for retargeting (push to re-arm CI) still apply to
130
+ the PR's own `pull_request` run.
131
+ - **What still gates enqueueing.** The PR's own head must still be green:
132
+ the same exit-0 merge gate as step 4, then enqueue. The `merge_group` run
133
+ re-checks the same required checks on the merge commit; a check that is
134
+ required but never reports there (a workflow without a `merge_group`
135
+ trigger) stalls the queue, which `tests/config/merge-queue-workflows.test.ts`
136
+ pins.
137
+ - **No competing merge lane.** The `train:approved` lane that merged through
138
+ the REST merge API was retired (#3837); every merge now goes through
139
+ `gh pr merge` (auto-merge or direct), which the queue intercepts when the
140
+ base branch requires one.
141
+
142
+ ## Queue ordering
143
+
144
+ Order by dependency, not age: a PR whose schema/API another PR must consume
145
+ merges first (the consumer then rebases and wires the new surface). Two PRs
146
+ editing the same file get an explicit order decided up front. Log-schema
147
+ changes must extend exact-key pins (`BASELINE_KEYS`-style), never loosen them.
148
+
149
+ ## Quota gate (orchestrator)
150
+
151
+ Before ANY new dispatch (not a fix round on an open PR): know the account's
152
+ 5h and weekly usage. Above 75% of the 5h window or 85% of the weekly window,
153
+ no new work — finish in-flight lanes and merge on green. The numbers are
154
+ readable live: `GET https://api.anthropic.com/api/oauth/usage` with the OAuth
155
+ token from `~/.claude/.credentials.json` (`anthropic-beta: oauth-2025-04-20`)
156
+ returns `five_hour.utilization` / `seven_day.utilization` and reset times; the
157
+ `~/.claude/hooks/quota-gate.mjs` PreToolUse hook on `Agent` reads them and
158
+ blocks dispatch above the thresholds (no hand-written fallback;
159
+ `QUOTA_GATE_OVERRIDE=1` lifts it when the maintainer says so). Read the meters at session start and before
160
+ every refill; state them in the lane ledger. Standing rule from
161
+ 2026-09-03, lifted only when the maintainer says so.
162
+
163
+ ## Brief contract (orchestrator)
164
+
165
+ Before dispatching any issue that adds a shared helper or seam: grep for
166
+ same-shape siblings yourself and write the fold into the SAME slice, or write
167
+ the sibling list, the reason folding is unsafe in one PR, and the follow-up
168
+ issue into the brief. AGENTS.md's net-count rule binds the brief author; the
169
+ fixer and reviewer only enforce what the brief scoped. #2530 shipped a fifth
170
+ bound helper because the brief deferred the fold without a reason.
171
+
172
+ ## External reports (orchestrator)
173
+
174
+ The contract lives in AGENTS.md, "Issue triage (standing rule)" — assess the
175
+ report against the code before accepting or dispatching, ask the one or two
176
+ facts that would change the design, **do not dispatch work that depends on an
177
+ unanswered load-bearing question**, mirror the answer on the issue and point
178
+ the worker there rather than at a paraphrase, and cite the reporter's reasoning
179
+ as authority. Read it there; this section only points at it.
180
+
181
+ The train-specific consequence: an external lane's first dispatch is often
182
+ worth delaying by one exchange. On 2026-09-12 a fixer was dispatched on #3000
183
+ between asking the question and receiving the answer, and the answer invalidated
184
+ the brief's central premise — the correction cost a mid-flight `plegma_send` and
185
+ rework that waiting ten minutes would have avoided entirely.
186
+
187
+ ## Filing issues (orchestrator)
188
+
189
+ Every `gh issue create` carries one TYPE label, at least one `area:*`, and
190
+ exactly one `priority:p1|p2|p3` (AGENTS.md #1676 rubric). The priority labels
191
+ were found deleted from the repo on 2026-09-03 and recreated (#2553); an
192
+ issue filed without one is a triage defect, not a shortcut.
193
+
194
+ Every reviewer **follow-up issue** generalization verdict is filed and assigned
195
+ to a seam group on the tracking queue in the same turn. At each regroup, scan
196
+ merged PRs for subset-shaped changes that lack a generalization verdict.
197
+
198
+ Before filing a review follow-up, apply the standing fold rule: fold same-seam
199
+ or same-file items that are about one commit and need no maintainer decision
200
+ into the same PR. Contract-only folds are trailing commits with no
201
+ re-verification; small code folds carry a red-first test and return to the same
202
+ reviewer. File only different-seam, blocked, decision-dependent, untouched
203
+ pre-existing, or risk-class-changing items, as one consolidated issue per PR.
204
+
205
+ ## Round-count rail (orchestrator)
206
+
207
+ When a verify round reports that a fix round introduced a NEW defect on the
208
+ same record or seam (not merely left one), the next fix brief opens with
209
+ AGENTS.md's state-space step — invariants, writers × axes, the cell list —
210
+ written into the PR body BEFORE any edit, and the fixer is Opus. Never send a
211
+ third patch-only round: #2528 went r2 → r3 → r4 on one cache record, each
212
+ round fixing three findings and adding two, until the model was demanded.
213
+
214
+ ## Orchestrator invariants (any orchestrator, not only Claude)
215
+
216
+ These are the habits the train depends on. They live here, not in any one
217
+ operator's private notes, so a different orchestrator can run the same train.
218
+
219
+ - **Contracts move in the same session.** When a review or a dogfood finding
220
+ reveals a defect CLASS (not an instance), add a numbered shape to AGENTS.md's
221
+ catalog with the issue ref and a one-line screen, extend the fixer's screen
222
+ list, and cite the number in the next brief — before the next dispatch. "To
223
+ err twice is not the mark of a wise man." (2026-09-03: shapes 28–36 came out
224
+ of one day's reviews this way.)
225
+ - **Second instance of a catalogued shape opens the consolidation lane, not a
226
+ third instance fix (2026-09-09).** The trigger is the shape recurring at all,
227
+ not only twice in one session: when a review, an issue or a dogfood finding
228
+ is the second member of a shape already in AGENTS.md's catalog, the
229
+ orchestrator files the consolidation lane BEFORE the second instance merges,
230
+ with three fixed deliverables: one seam every consumer calls, one log line
231
+ per resolution (which value was chosen and why, throttled once per key per
232
+ session), and one bounded degradation record for the fallback path. The
233
+ record: #2691 (yamllint cwd) and #2756 (Prettier ignore cwd) were shape 40
234
+ twice in one week; each was fixed at its own seam with no log line, and the
235
+ maintainer had to ask for the seam (#2777). "Contracts move in the same
236
+ session" covers the catalog row; this rule covers the code.
237
+ - **An external bug's first round is the probe, not the fix (2026-09-09).**
238
+ For any bug reported from outside (or any bug whose symptom is a tool
239
+ verdict), the first delegation is an investigator or a fixer whose FIRST
240
+ deliverable is the reporter's symptom reproduced through the production
241
+ entry point (the tool handler / MCP tool, not a seam beneath it), red on
242
+ master, before any state-space table or edit. A fix brief that names a
243
+ suspected seam is a hypothesis and says so. The record: #2776 spent seven
244
+ fixer rounds on `clients/lsp/client.ts` (pull-vs-push classification) —
245
+ each internally consistent, each verified — before a premise probe through
246
+ `LSPService.touchFile` showed master already returned the pushed
247
+ diagnostic; one investigator round through `createLspDiagnosticsTool`
248
+ then found the real cause in `tools/lsp-diagnostics.ts` (primary/auxiliary
249
+ partition by `diagnostic.source`). Principles §1 "Premise first" already
250
+ said this; the train had been dispatching fixers on the orchestrator's guess.
251
+ - **Every "should have been caught by" names a nightly or smoke row, and
252
+ the row is filed the same day.** A detection retrospective that ends in
253
+ prose is not a retrospective. #2776 (emmylua_ls declares pull diagnostics
254
+ but only pushes → false "confirmed clean") was reachable by a
255
+ declared-vs-observed channel probe the capability matrix never ran, and by
256
+ the custom-`lsp.servers` population the matrix never covers.
257
+ - **Brief pre-flight by touched surface (2026-09-09).** Before dispatching a
258
+ fixer, read what the fix WILL touch and put the matching dependents into the
259
+ brief's required test set. Every row below cost at least one extra round
260
+ today because the fixer ran only "targeted files":
261
+
262
+ | Fix touches | Brief must name |
263
+ |---|---|
264
+ | a new export on a module that has `vi.mock` doubles | every test file that mocks that module (`grep -rl 'vi.mock(".*<module>' tests`), run them all — #2782 r1: 30 reds in 6 files |
265
+ | a field on a durable or shared record (cache entry, diagnostic, ledger row) | old-record parse proof, cache schema version, and every test that deep-equals or snapshots the record — #2783 r1/r3 |
266
+ | a test that spawns a real child (LSP fake server, tool smoke, installer) | the lane admission (header + `vitest.config.ts` project + coverage baseline) and `tests/config/` — #2783 r5 |
267
+ | a new fixture under `tests/fixtures/` | the fixture-contract sweeps for that directory (style-preserving, population guards) — #2782 r2 |
268
+ | a change that touches identifier uses of a glossary-retired synonym | run `tests/config/glossary-synonym-sweep.test.ts` on the head AND on the merge with `origin/master`, then re-pin in the PR from the sweep's own `UNPINNED`/`STALE` output — #3279, #3283, #3284, #3288 |
269
+ | a new `vi.mock` in a test file | run `tests/config/vi-mock-export-sweep.test.ts`; whole-module mocks of a production module must spread `importOriginal` — PR #3268's CI red, fixed by trailing commit `621d61c5c` |
270
+ | a changelog fragment | front matter `section: <Section>` plus `audience: user` or `audience: internal` and exactly one top-level entry; new user entries open with a bold lead of at most 100 characters (refs excluded), never `CHANGELOG.md`, validated by `node scripts/check-changelog-fragments.mjs` — PR #3268 r1 shipped `category:` and a paragraph |
271
+ | a PR body | the header gate: exactly one-sentence `## Why`, `## Notes for the reviewer`, `## Change outline`, plus Summary / Tests with `### Test assessment` / Blast radius / Class sweep / Observability; run `node scripts/check-pr-body.mjs --lint-local` before pushing — three PRs this week needed orchestrator body edits |
272
+ | a whole-tree docs restructure of `AGENTS.md` | every governance test that reads `AGENTS.md`, with markers on their own lines — PR #3265 r1 |
273
+ | a raw poll in a test | the flake-shape ratchet; the fix is the governed wait, never a header admission — #2781 r1 |
274
+ | a new, renamed or deleted rule file under `rules/` | `npm run docs:rule-catalogs` and commit the generated catalog; `tests/scripts/rule-catalogs.test.ts` is a strict consumer of every rule file, not of rule ids — #3214 r1 |
275
+
276
+ - **Sandbox by test shape (2026-09-09).** A lane whose tests spawn children
277
+ (LSP fake server, tool smoke, installer, formatter wire) is dispatched with
278
+ the runner's full-access mode from round 1. #2781 spent four rounds with a
279
+ fixer that could not run its own wire tests and reasoned about ordering
280
+ instead of observing it; the first full-access round found the cause in
281
+ one pass.
282
+ - **A CI-only red is reproduced in the job's shape before any fix.** Replicate
283
+ the job env (the `npm test` PATH prefix with `node_modules/.bin`, a pinned
284
+ `HOME`, no `PI_LENS_HOME`) and trace the leg that differs; a fix that only
285
+ passes under `node_modules/.bin/vitest run` is a guess. #2775 carried one
286
+ CI-only red through three rounds until round 5 traced it to the npm PATH
287
+ prefix resolving the dev-dependency `oxfmt` past the mocked `which`.
288
+ - **Follow-up rounds go to the same worker by send, not a fresh delegation,**
289
+ while its handle is alive: it keeps the diff and the reasoning, and the
290
+ brief shrinks to the findings. Release only when the lane moves to review.
291
+ A fresh worker on a resume loses uncommitted work.
292
+ - **Release a reviewer handle only after reading a merge-ready verdict.** A fix
293
+ round resumes the SAME reviewer via `resumeFrom` with the model pinned. Twice
294
+ this week (PRs #3263 r2 and #3261 r2), release ran in the same batch as the
295
+ read and continuity was lost.
296
+ - **Fleet inventory at every settlement.** A one-shot watch misses anything
297
+ that settles while it is disarmed: after each settlement,
298
+ list live workers and read every `done` handle not yet consumed. Two lanes
299
+ sat finished for 90 minutes today.
300
+ - **Keep a lane ledger.** One file, one row per lane: issue/PR, worker id,
301
+ round, state, head SHA, merge-order note, and for bug lanes
302
+ `caught by / should have been caught by`; a header line with the quota
303
+ reading and the merged list. Update it on every dispatch, report and merge.
304
+ It is what survives a context reset. `state` is one of exactly:
305
+ `not started`, `fixing rN`, `waiting on CI`, `waiting on review`,
306
+ `waiting on verify`, `blocked`, `ready to merge`, `merged`,
307
+ `needs user decision`, `held` — a fixed vocabulary so a resumed session
308
+ (or a different orchestrator) can build the status table without reading
309
+ the transcripts, and so "needs user decision" and "held" are visible as
310
+ rows rather than buried in prose. (Borrowed 2026-09-07 from the heartbeat
311
+ classification in aromanarguello/roman-skills `orchestrate-lane`.)
312
+ - **A lane's worktree lives until its PR merges.** Pruning it after a report
313
+ makes the owning worker un-resumable, so every fix round then costs a fresh
314
+ worker. Prune on merge, or when the lane is abandoned.
315
+ - **Scope changes are mirrored on the issue before they are sent.** A fixer
316
+ cannot verify a mid-task `SendMessage`; it CAN verify an issue comment.
317
+ Post the comment first, then send the message pointing at it
318
+ (`docs/pi-lens-subagent.md` tells every worker to check). Unmirrored
319
+ additions are declined by design.
320
+ - **Dependabot PRs merge on real checks, no issue needed (maintainer,
321
+ 2026-09-07).** The PR-title issue-ref gate is a policy check this train
322
+ applies to human PRs; a bump title can never carry a ref. Merge order: one
323
+ at a time (each merge dirties the rest; dependabot rebases them itself);
324
+ gate on Lint, Unit tests and every non-advisory check on the exact head;
325
+ pr-metadata.yml itself skips "PR title", "PR body (advisory)" and
326
+ "Close-keyword syntax" for dependabot (2026-09-09, refs #2714), so nothing
327
+ needs hand-ignoring; hold anything red on a real check
328
+ with a comment naming the check (2026-09-07: tsls 6 needs a Node-floor bump, biome
329
+ fails the install test, vitest 5 fails four gates; a bump whose install
330
+ script is pinned by `allowScripts` needs the pin moved in a maintainer
331
+ commit on the bump branch). A major bump with peers (vitest + coverage-v8)
332
+ lands together or not at all.
333
+ - **Detector, ratchet and governance-sweep authoring goes to Opus from
334
+ round 1.** Their correctness lives in parsing edge cases, exactly where the
335
+ smaller model loses: #2693 took two Sonnet rounds (~720k tokens) on a text
336
+ scanner before the rail sent round 3 to Opus, which rewrote it on the AST
337
+ and closed in two rounds.
338
+ - **Brief shape for a fixer.** Issue/PR number and head; the checked-out
339
+ branch; the exact findings with file:line, the reviewer's probe to reproduce
340
+ FIRST, and the remedy shape the maintainer chose; what to fold (net-count)
341
+ and what stays out; the suites to run (named files + the mechanical
342
+ governance selector + every tests/config file); the observability record to
343
+ name; "no agents, foreground runs, one CI read, no monitors". Brief a
344
+ reviewer with the PR number, the claims as the fixer stated them, and the
345
+ attack angles that matter for THIS diff; ask for a verdict first.
346
+ - **Round routing.** Fix rounds that only apply a reviewer-prescribed remedy
347
+ with quoted reds merge on green (CI read on the exact head, both required
348
+ checks, mergeable state). Rounds that add mechanism, touch session or
349
+ lifecycle semantics, or rewrite a guard get a fresh verify. Classify the
350
+ round by its worst finding, not its count: a round whose findings are all
351
+ contract (body text, docstrings, a record added WITH its test, a test
352
+ added for an existing behaviour) merges on green — #2647 r2 is that shape;
353
+ a round with one behaviour finding (a verdict, a guard direction, a
354
+ lifecycle hook, a failsafe) gets the same-reviewer verify — #2649 r2 and
355
+ #2654 r2. Say which in the fixer brief so the reviewer is not re-armed by
356
+ reflex. A verify that
357
+ reports a NEW defect triggers the round-count rail above.
358
+ - **Retargeting a PR's base does not re-arm CI.** `ci.yml` fires on
359
+ `opened`/`synchronize`/`reopened`; `gh pr edit --base` is an `edited`
360
+ event, so the required checks stay ABSENT and `ci-verdict` reports "absent,
361
+ treating as pending" — exit 3, not 0; the "exit 0" first recorded on #2664
362
+ was `$?` read after a `| tail`. After a retarget, push a commit or
363
+ close/reopen. Read the final `ci-verdict: exit <N> (<kind>)` stdout line,
364
+ never `$?` after a pipe (`; echo $?` on its own line, before any pipe, is
365
+ also fine). The merge loop is
366
+ `node scripts/ci-verdict.mjs <pr> --wait <seconds>` — read its final line:
367
+ 0 merge, 3 still pending (re-arm the wait), anything else read the table. Never
368
+ text-match the table for `failure`: advisory rows (PR body, Vale)
369
+ print `failure` while the verdict is green, and on 2026-09-07 that stopped
370
+ the #2692 loop on a green PR.
371
+ - **Maintainer trailing commits** are for intent-free deltas only (a literal
372
+ NUL byte, a false comment, a missing PR-body heading); anything that changes
373
+ what code MEANS goes through a fix round.
374
+ - **Mechanical-only verdict (2026-09-07).** When EVERY finding in a review or
375
+ verify is intent-free — a PR-body census the reviewer corrected, an inverted
376
+ body sentence, a heading, a literal, a comment — the orchestrator applies
377
+ them as trailing commits and merges on green: no fixer resume, no re-verify.
378
+ That is one resume saved per such PR. One finding that changes what code
379
+ means, however small, makes it a fix round; a fix round that exists anyway
380
+ carries the mechanical findings with it (#2693 r2 carried F3–F5). Borrowed
381
+ from the auto-fix-mechanical rule in aromanarguello/roman-skills
382
+ `final-review`; NOT borrowed from it: auto-fixing null checks, error
383
+ handling or cleanup hooks, which change meaning.
384
+ - **Allocate the catalog number at MERGE, not at dispatch (2026-09-15).**
385
+ AGENTS.md's defect-shape catalog is a markdownlint MD029 ordered list: the
386
+ number is the list position, so dispatch-time reservations create a gap on
387
+ branches whose holder has not merged. The orchestrator owns allocation; a
388
+ lane may draft a shape but must not claim a number. At merge, insert or
389
+ renumber the shape at the next valid sequential position and recheck the
390
+ whole catalog. This prevents concurrent lanes from colliding without
391
+ shipping a gap.
392
+ - **On a CROSS-REPOSITORY PR, `action_required` is not `absent` (2026-09-12).**
393
+ A fork PR's workflow runs sit unapproved until a maintainer approves them
394
+ (GitHub reports them as `status: completed`, `conclusion: action_required`,
395
+ with no CI check-run rows), so the required checks read as absent and the
396
+ verdict is pending. Absent because CI has not registered yet and absent
397
+ because nobody approved the run look identical in the verdict table and are
398
+ hours apart in remedy. `node scripts/ci-verdict.mjs <pr>` now tells them
399
+ apart (#3694): when the verdict is otherwise pending and required checks
400
+ are absent, it prints `awaiting fork approval` with one
401
+ `gh api -X POST repos/<owner>/<repo>/actions/runs/<id>/approve` per run. It
402
+ never approves; approving is the maintainer's call. A head that is green or
403
+ failing keeps that verdict whatever stale `action_required` runs it carries.
404
+ #2983 sat unapproved while the lane read it as a slow queue.
405
+ - **`ci-verdict` is the ONE CI reader; do not hand-roll `gh pr checks`,
406
+ `gh run view --log` or a `watch-*.sh` poller (#3700, 2026-09-30).** Every
407
+ read the orchestrator did by hand is a mode of `node scripts/ci-verdict.mjs`:
408
+ - `<pr|sha> [--wait N]` — the gating verdict (exit 0 / 1 / 2 / 3, see the
409
+ merge loop above). A failed gating job now also prints its failed STEP
410
+ (so `Ast-grep self-scan` or `Audit production dependencies` reads as what
411
+ it is, not as a test failure), its `FAIL` and assertion lines and the
412
+ `Tests` summary with the ANSI codes stripped, the gating and advisory
413
+ counts on separate lines (advisory reds never gate, and are read before
414
+ merging), and the remedy hint: `gh run rerun <run>` for a cancelled or
415
+ superseded run, the `gh api -X POST .../approve` command for fork
416
+ approval, `gh pr update-branch <pr>` when the failed merge's base is no
417
+ longer master's head (a rerun replays the old merge commit, #3660). A job
418
+ that failed with `couldn't find remote ref refs/pull/N/merge` on a MERGED
419
+ PR is reported as post-merge noise, exit 0, not a red lane.
420
+ - `--all` — one line per open PR (`#N <author> auto-merge=on|off head=<sha>
421
+ gating=<state> [first-failure=<check>]`) for status reports; it always
422
+ exits 0.
423
+ - `--watch-open [--wait N] [--state-file <path>]` — the notifying wait:
424
+ watches every open PR that has auto-merge armed or is authored by the
425
+ repository owner or the `gh` viewer (a PR in a fix round has no
426
+ auto-merge and still goes red), polls every 90 s, and exits 0 on the first
427
+ poll with an event, printing `#<pr> <event> @<sha>: <reason>` plus the
428
+ failure detail (events: `failed`, `fork-approval`, `absent-rearm`,
429
+ `merged`, `closed`; each PR reports on the TRANSITION from its last seen
430
+ state, keyed by head SHA). Exit 3 means the window ended with none.
431
+ `--state-file ~/.cache/pi-lens-orchestrator/watch-state.json` keeps the
432
+ last seen state across re-arms so the same red is not reported twice. Run
433
+ it with `run_in_background: true`; it replaces the session-local
434
+ `watch-automerge.sh`. Events also include `dirty` (merge-conflicted) and
435
+ `cancelled` (a superseded run nobody replaced, with its rerun command),
436
+ and a `merged` PR lists its closing issues' states.
437
+ - `--watch-open --stream` — does not exit on an event: it prints one line per
438
+ event per head (`FAIL #N@sha: ...` plus the failing test names,
439
+ `DIRTY #N@sha`, `CANCELLED-NOT-REPLACED #N@sha: ... (gh run rerun <id>)`,
440
+ `MERGED #N` plus `closes #M: <state>`, `CLOSED #N`) until the window ends
441
+ (exit 0 if any line was printed, 3 if none).
442
+ - `--rerun-cancelled` (with `--watch-open`, and REQUIRING `--state-file`:
443
+ without it every re-armed watch would re-run the same head, so it is a
444
+ usage error) re-runs a cancelled, unreplaced run itself
445
+ (`RERUN #N@sha: gh run rerun <id>`), once per head. A refused re-run is
446
+ retried on the next poll after a backoff (180 s, then 360 s), at most
447
+ three attempts per head, then left to you.
448
+ - `--sync-main <path>` (with `--watch-open`) fast-forwards that checkout after
449
+ a merge (`git pull --ff-only`) and prints `SYNCED <path>: <old> -> <new>`.
450
+ It refuses, saying why (git's own line, such as `Not possible to
451
+ fast-forward`), when the checkout is off master, has modified tracked
452
+ files, or cannot fast-forward, notes local commits not on origin, and prints `LOCKFILE CHANGED: run
453
+ npm ci when no worker is live` when `package-lock.json` moved. It never
454
+ runs `npm ci`: live workers share that install.
455
+ - `--approve-fork <PR>` approves that PR's `action_required` runs on its
456
+ current head (`gh api -X POST .../actions/runs/<id>/approve`). Explicit,
457
+ per PR, never part of any watch.
458
+ Apart from `--approve-fork`, `--rerun-cancelled` and `--sync-main`, which you
459
+ pass by name, it never approves, reruns or updates a branch: it prints the
460
+ command.
461
+ - **Read the advisory rows before merging, even though they never gate
462
+ (2026-09-12).** The exit-code rule above is right and stays: never text-match
463
+ the verdict table for `failure`, because advisory rows print `failure` on a
464
+ green PR. But "does not gate" is not "carries no information", and filtering
465
+ advisory rows out of your attention is a different mistake from filtering
466
+ them out of the gate. `typos (advisory)` found a real defect in #2955's
467
+ round-12 diff — a comment in which "reading" was misspelt — which the
468
+ gating checks had no opinion about and which would otherwise have reached
469
+ master. (The misspelling is described rather than reproduced here: quoting
470
+ it verbatim makes this file itself red the typos lane, which is the same
471
+ detector-versus-prose problem the testing rules already name.) Gate on the exit code; read the advisory failures on the exact head
472
+ before the merge and dispose of each one (fix as a trailing commit, or say
473
+ why it is noise).
474
+ - **`gh run rerun` replays the ORIGINAL merge commit; it does not pick up a
475
+ moved base (2026-09-12).** A pull-request CI run tests `refs/pull/N/merge`,
476
+ master merged into the branch. When master moves — say a fix for the very
477
+ failure that red the lane just landed — rerunning the failed job re-runs the
478
+ SAME merge commit, so the fix is not in the tree and the lane reds again
479
+ identically. The log's checkout line is the proof and is worth reading every
480
+ time: `HEAD is now at <sha> Merge <branch-sha> into <BASE-sha>`; if that base
481
+ is not current master, the run tells you nothing about current master. This
482
+ cost a false conclusion on 2026-09-12 — a lane red on `pi-lens-warmup-oneshot-*`
483
+ after its fix had merged looked like the fix not working, and the base was one
484
+ commit behind. Re-arm with
485
+ `gh api -X PUT repos/<o>/<r>/pulls/<N>/update-branch` (or a push), never a
486
+ rerun, whenever the reason to re-run is that the BASE changed. Same family as
487
+ the retarget rule above: the event that re-runs CI must be one that rebuilds
488
+ the merge ref.
489
+ - **A nondeterministic gate makes a green a sample, not a proof
490
+ (2026-09-12).** The fixture-hygiene ratchet reds only when a leaky family
491
+ actually loses the race, so two PRs on the SAME base can disagree: on
492
+ 2026-09-12 #2994 went green and #2997 red on identical master. Before merging
493
+ on a green whose base is stale, ask whether the gate that matters is
494
+ deterministic; if it is not, re-gate on a current base rather than bank the
495
+ sample. The merged result runs against master, not against the tree that
496
+ happened to pass.
497
+ - **Detection retrospective on every merged bug fix (2026-09-06).** The
498
+ catalog records the CODE lesson of a bug (a shape, a screen, a guard). Before
499
+ a bug-labelled lane's ledger row closes, the orchestrator also records the
500
+ DETECTION lesson in one line: which verification layer caught it (external
501
+ user, reviewer probe, CI job, governance sweep, install/compat/tool smoke,
502
+ dogfood, release gate) and which layer SHOULD have caught it earlier and at
503
+ what cost. If that layer does not exist, file it as an issue with the bug as
504
+ its named recurrence — the same standard shapes are held to. The ledger
505
+ carries a `caught by / should have been caught by` column. Record: #2587's
506
+ manifest entry escaped the package for four releases; a second registration
507
+ path masked it, so the shipped defect was foreign-tree adoption, not absence
508
+ — and no check ever asked a real pi which SOURCE a skill came from. The
509
+ shape lesson went into AGENTS.md the same day; the layer lesson (a witnessed
510
+ real-pi pass asserting source and path, #2606) surfaced only because the
511
+ maintainer brought an outside skill in, and the first runner's count-only
512
+ row would have passed the broken release.
513
+ - **Harvest every reviewer's "Could not verify" and "Named output".** Those
514
+ sections hold the structural insights the probes could not close (a
515
+ runIf-conditional guard, a smoke section that never ran on a real runner, a
516
+ detector's boundary map). Each entry becomes, before merge, one of: an
517
+ issue, a ledger note with a reason, or a line in the PR body. Silence is not
518
+ a disposition.
519
+ When a Named output becomes an issue the orchestrator declines or defers,
520
+ the ledger note names a DURABLE reason (a measured cost, a dependency, a
521
+ design decision with its date), never "not now"; otherwise the same
522
+ candidate is re-harvested at the next regroup rather than silently dropped.
523
+ - **Debt pass at the regroup (2026-09-07).** Before prioritising the next
524
+ cycle, run the repo's own dead-code and duplication tools over the files
525
+ changed since the last release tag (`git diff --name-only v<last>..origin/master`;
526
+ `npx knip` uses the config in package.json, Sonar's duplication gate is the
527
+ CI form): every reviewer's "Named output" that named a re-derived seam
528
+ (#2694: the call-site scan hand-rolled in three sweeps) is what this pass
529
+ finds across lanes that no single review can see. Findings become issues
530
+ with the file list, never release blockers, and test-seam duplication is
531
+ IN scope — "Test infrastructure — reuse before you write" in AGENTS.md is
532
+ the standing rule, so the borrowed skill's "test duplication is often
533
+ intentional" exclusion is not borrowed. (Shape from aromanarguello/roman-skills
534
+ `techdebt`.)
535
+ Within that changed-file list, weight candidates by commit frequency since
536
+ the last tag (`git log --since=<last-tag-date> --name-only --pretty=format: |
537
+ sort | uniq -c | sort -rn`) so the pass follows the real hot spots rather
538
+ than every touched file equally. A FULL-repo debt pass (not the diff-scoped
539
+ one) carries a coverage contract: one ledger row per subsystem (id, files,
540
+ status) and the pass is not closed until every row is filled or skipped with
541
+ a reason. A debt-pass subsystem worker reports at most TWO materially useful
542
+ simplifications, each with the deletion test answered, drawn from six
543
+ candidate shapes: scattered booleans or nullable fields that permit invalid
544
+ combinations (a state machine or discriminated union); repeated assumptions
545
+ about an object shape (one typed model); duplicated branching a small map,
546
+ registry or reducer would remove; unclear state or behaviour ownership (a
547
+ module boundary); repeated scans or lookups a better collection or index
548
+ would remove; lifecycle, concurrency or async state whose representation
549
+ permits stale or contradictory state. Never force an abstraction; boring
550
+ local code that is already clear stays. This cap is for
551
+ debt-pass dispatch only and never applies to PR review, where every finding
552
+ from CRITICAL to NITPICK is reported.
553
+ - **Session retrospective before the regroup.** One ledger block: what the
554
+ maintainer had to bring in from outside, why the process did not surface it,
555
+ and where the lesson was routed (contract, skill, issue). The
556
+ 2026-09-06 entry: the autoqa witness/reachability rules and the release-QA
557
+ layer came from a maintainer link, not from the train's own retrospective
558
+ on #2587.
559
+ - **Review tier follows what the diff touches, never the priority label
560
+ (2026-09-06).** The record: the two most dangerous regressions of that day
561
+ came from p3 follow-ups — #2595 (a 125 s stall on an awaited path, a latent
562
+ crash) and #2604 (broke offline installs in r2, broke `npm install` on
563
+ Windows in r3) — and both were caught only by full review; the p3s where
564
+ review found nothing were the ones touching no production code.
565
+ - **Tier A — full adversarial review, any priority:** anything under
566
+ `clients/`, `tools/`, `mcp/`, `scripts/`, `.github/`, or a package
567
+ manifest / lockfile.
568
+ - **Tier B — one scoped review pass, scope stated in the brief:** tests-only
569
+ diffs that are not governance sweeps or ratchets (those are Tier A: a
570
+ guard is production for the train).
571
+ - **Tier C — no reviewer agent:** docs, comments, rename-only, data files.
572
+ Orchestrator read plus CI on the exact head.
573
+ A prescribed-remedy fix round stays "merge on green" in every tier.
574
+ - **Same-seam siblings batch into the open PR (2026-09-06).** When a review
575
+ finds a sibling of the same shape on the same seam, it goes into the current
576
+ PR as another round — reusing the fixer's context and the reviewer's probes
577
+ — when all three hold: same dependent sweep, remedy prescribed rather than
578
+ designed, and the PR is not on the critical path of an external or p1 fix.
579
+ Otherwise file it with the sibling list and the reason. The record: #2598
580
+ out of #2599 and #2593 out of #2594 each cost a fresh fixer spin-up plus a
581
+ fresh review (and #2604 then needed three rounds under a review that was
582
+ already armed on that file); #2603 out of #2595 and #2592 out of #2585 were
583
+ rightly separate (a new matcher; seventeen per-seam reads). #2596 was filed
584
+ as a follow-up and closed as a duplicate — pure waste.
585
+ - **Refill order** when the quota gate is open: p1 first, then the queued
586
+ follow-ups in ledger order, then the program work (#2421 → #2416 → #2383/#195).
587
+
588
+ ## Disposition tables
589
+
590
+ Verify reports and fixer handoffs end with a per-finding disposition table
591
+ (defined in `docs/pi-lens-reviewer.md` "Findings and verdict");
592
+ read the worst cell to route the round.
593
+
594
+ ## Honesty rules
595
+
596
+ - A finding is real when a probe proves it; a fix is real when the same probe
597
+ passes and the regression test was red first.
598
+ - `closes` vs `refs` follows delivery, not optimism; leftovers get an issue
599
+ comment before anything closes.
600
+ - After merging a `refs #N` PR, VERIFY the issue: read `gh issue view N
601
+ --comments` and confirm a comment names the remainder. If the PR in fact
602
+ satisfied every acceptance criterion, close N crediting the PR; if a
603
+ remainder exists but is unnamed, post it. A `refs` PR with no remainder
604
+ comment is how #1968 and #2355 sat open for weeks after their fixes
605
+ landed (found 2026-09-02).
606
+ - Report what ran, what was skipped, and what CI must still confirm.
607
+
608
+ ## Common mistakes (scan at task start)
609
+
610
+ Each row cost a lane at least once; the prose above carries the record.
611
+
612
+ | Mistake | Fix |
613
+ |---------|-----|
614
+ | Reading a CI verdict without checking the SHA it judged | `ci-verdict --wait` returned exit 0 for the PREVIOUS head seconds after a push (#2878 trailing, 2026-09-10); compare the verdict's SHA with `gh pr view --json headRefOid` before merging |
615
+ | Reporting "pushed" before `git log -1` shows the commit | Two trailing commits failed the pre-commit hook (changelog one-entry rule, unused vars) and the ledger/body already said pushed; verify the head, then write the row |
616
+ | Folding a worker's extra changelog fragment into an existing one | One fragment = one top-level entry (`rollup-changelog --check`); keep a second fragment separate or drop it |
617
+ | Accepting a worker's "pre-existing red on master" | Run the file on origin/master in YOUR environment before believing it; four workers reported env-specific reds as master reds (2026-09-10) |
618
+ | Letting a fix round enumerate cases instead of deriving the rule | #2877 took 7 rounds; the brief for a rule fix demands derivation from the source of truth (grammar table, measured host sequence) |
619
+ | Accepting a state-space table on its claims | Grep every test id in the table before accepting the round; #2877 r3 and #2868 r3 (2026-09-10) shipped 48–72-cell tables with zero real ids |
620
+ | Believing a worker's "N suites red on origin/master" without auditing its probe ENV | #3026's fixer pinned `TMPDIR` to the harness `.probe-home` and reported 16 unrelated suites red; the tree was green (2026-09-15). Ask for the A/B with the variable held fixed; the `tmpdirCollision` deny rule in `scripts/hooks/guard-bash.mjs` blocks the command |
621
+ | Merging a PR before its own CI has been read on the exact head | #3051 landed 20:05Z with the gitignore negation commit missing; `gitignore-tracked-shadow` redded on every open lane for ~30 min (#3055). `node scripts/ci-verdict.mjs <sha>` before every merge, admin merges included |
622
+ | Hand-triggering attempt 3 after a second infra kill | `ci-infra-kill-rerun.yml`'s classify job was gated `run_attempt == 1`, so it never covered the second kill on one head; #3048 and #3040 each needed a manual rerun (2026-09-15). The gate now covers attempt 2; a third kill is a hand rerun by design |
623
+ | Merging a workflow edit whose only executing lane is master-only | #3033 edited install-smoke's `pnpm-global`/`mise-repro` steps, both gated `!= 'pull_request'`; six cells failed on every master push for a day (#3043). Give the edited lane a PR-eligible cell, or run `gh workflow run <file> --ref <branch>` and quote the run id |
624
+ | Sending a governance-sweep brief to a Sonnet fixer | Two rounds cost 765k tokens / 459 tool uses on #3066 and 587k on round 1 alone (2026-09-15). A brief that adds or edits a `tests/support/sweep-kit.ts` registered-or-fail sweep goes to the strongest available fixer |
625
+ | Dispatching into a backend session window that cannot hold the brief | commandcode's undocumented 5-hour cap killed #2928's worker after 42 turns with uncommitted work and no `COMMIT_MSG.txt`, and gave #3045 r2's worker 0 turns (2026-09-16 00:07Z). Check the backend's cap and reset time before dispatch; re-route on reset (plegma #436) |
626
+ | Accepting a derived guard whose mutations are all neutered-guard rows | #3045 r1's guard accepted a junk marker and a substring launcher with M3/M4/M6 green. Demand one negative-population row: an input the guard must reject (#3075) |
627
+ | Merging a fold PR without mutating what the deleted sibling used to back | Four folds in one session each shipped a newly-sole predicate that was untested (#3064 F1, #3065 F3, #3066 F3, #3068 F2). Mutate every predicate the fold promoted, not only the new code |
628
+ | Accepting a runtime test as red-first evidence for a type-only defect | #3026's case could never red — `tsc` erased both changed lines and the emitted JS was byte-identical. The compile transcript on both `tsconfig.build.json` and `tsconfig.json` is the evidence (#3074) |
629
+ | Admitting a real `git show <sha>` in a test to read historical content | #3066 r1 ran it at MODULE SCOPE; CI checks out at depth 1, so the file would have collected zero tests including three pre-existing #525 cases. Commit the content as a fixture under `tests/fixtures/` |
630
+ | Letting a heavy governance test land without a measured peak RSS | `bounded-container-guard` landed at 9.2 GB on 2026-09-14 and drove the CI kill rate 7.1% → 30.4% in five days (#3058). The `worker-peak-rss` gate (#3062) now fails a `default`-project file over budget; keep it gating, not advisory (#3067) |
631
+ | Arming `plegma watch --next` after the lane already settled | The watch only sees settlements newer than itself; check `plegma_status` by handle first and process a done lane directly (three lanes sat settled for hours, 2026-09-10) |
632
+ | Pruning trees with `merge-base --is-ancestor` | Prune only trees whose branch is the head of the PR just merged (#2358's tree, 2026-09-06) |
633
+ | Retargeting a PR base and waiting for CI | `edited` does not fire ci.yml; push a commit or close/reopen |
634
+ | Reading `$?` after a pipe | Read the final `ci-verdict: exit <N> (<kind>)` line (`; echo $?` on its own line, before any pipe, is also fine) |
635
+ | Text-matching the verdict table for `failure` | Key on the exit code; advisory rows print `failure` on green PRs (#2692) |
636
+ | Committing a worker tree with `git add -A` and a pathspec exclude | Check `git ls-files` for handoff files and scratch dirs before the commit; fold a second fragment (#2807, #2808, 2026-09-09) |
637
+ | Merging two green PRs that edit the same baseline or admission map in parallel | Serialise them and re-run that file's test on master between (#2816) |
638
+ | Reviewing a branch head that no longer carries master | Reviewer merges origin/master into the scratch checkout first; CONFLICTING is not reviewable (#2808 vs #2795) |
639
+ | Pushing docs, config or data straight to master without preflight | `npm run preflight` on the exact tree first; three master reds on 2026-09-09 |
640
+ | Nudging a capped small-model lane more than once | One continuation, then reassign to the strongest model (GLM lanes, 2026-09-09) |
641
+ | Waiting on CI for a bot-authored PR (github-actions nightly refresh) | A GITHUB_TOKEN push fires no `pull_request` run: required checks stay ABSENT forever; close/reopen the PR to fire them (#2801, 2026-09-09) |
642
+ | Leaving a design question to the fixer (where evidence comes from, which identity rule) | Decide it in the brief; #2900 oscillated three rounds (walker → findings → walker again) until round 4's brief fixed the evidence source (2026-09-10) |
643
+ | Guessing a lane's branch name when writing a brief | Read `gh pr view N --json headRefName` in the same command that builds the brief; plegma refused two dispatches on invented refs (#2908, #2898; 2026-09-10) |
644
+ | `git add -A -- . ':!<ignored file>'` in a chained command | The exclude pathspec on an IGNORED path makes `git add` exit 1 and the chain stops before the commit; use plain `git add -A` (ignored files never stage) and verify the index afterwards (2026-09-10, twice) |
645
+ | Treating a `ci-verdict --wait` exit as a CI verdict without reading it | Exit 70 = GitHub API unreachable; every armed wait died at once during two outages on 2026-09-10 — poll `https://api.github.com/` until 200, then re-arm one wait per PR |
646
+ | Merging a PR that arms a registry-membership guard without telling the other lanes | After #2924, every open PR that adds a formatter, LSP server or MCP tool needs a docs line in the same change; note it in the ledger and the next briefs (2026-09-10) |
647
+ | Judging master from the local checkout | `git fetch origin` and read `origin/master`; #2693 r1 reported a catalog row missing that had merged an hour earlier, and the orchestrator's own branch that morning was cut from a master six commits behind |
648
+ | Swapping reviewers between rounds | Same reviewer verifies; the probes and the mutation set are the continuity |
649
+ | Trusting the fixer's "CI green" | Read ci-verdict on the exact head SHA yourself; absent required checks are not green |
650
+ | A third patch-only round on one seam | Round-count rail: state-space table in the body first, Opus fixer |
651
+ | Merging a `refs` PR with no remainder comment | Post the remainder or close the issue crediting the PR |
652
+ | Dispatching independent agents one message at a time | All independent Agent calls in one message; the quota gate is read once before the batch |
653
+ | Resuming a fixer whose tree was reaped | Spawn a fresh fixer on the branch, or export `PILENS_HYGIENE_KEEP_AGENT_TREES=1` for the session up front |
654
+ | Sweeping a shape by grep-counting tokens | A ratchet reads the exact literal it governs (#2693: four sites counted, six real) |
655
+ | `npx <tool>@latest` inside the repo to measure something | It rewrote package-lock.json (108 deletions) on 2026-09-07; run one-off tools from a scratch prefix, and `git diff --stat` before every commit |
656
+ | `git add -A` in a worktree that links `node_modules` | The ignore rule `node_modules/` does not match a SYMLINK; #2703 committed one and broke the clean-clone install and the tracked-shadow test. `git add <paths>`, and `.gitignore` now says `node_modules` without the slash |
657
+ | `git worktree remove --force` on a tree whose `node_modules` is a symlink | Git follows the link and empties the shared checkout's install (twice on 2026-09-16, #2704 class; every other lane's build broke). `rm node_modules` first (unlink, never `rm -r`), then remove; mechanisation in the Bash hook is filed |
658
+ | Checking a branch out in the shared main tree for your own fix | Reviewers saw the checkout switch under them three times on 2026-09-07; use a throwaway `git worktree add` under `~/.local/share/pi-lens-orchestrator/tmp/<lane>` (never the scratchpad -- #3526: it is `/tmp` on this launcher, tmpfs, and `guard-bash.mjs` denies a checkout landing there), remove it after the push |
659
+ | `gh run rerun --failed` while the run is still in progress | GitHub refuses it; wait for the run to complete (poll `gh run view --json status`), then rerun, then re-read the verdict |
660
+ | Reading a failed job's log before its run completes | Empty output; the log is withheld until the whole run finishes |
661
+ | Treating a reviewer's prescription as the fix | It is a hypothesis: #2693 r2's blanked-slice remedy stayed green on `env: { PWD: cwd }`; the fixer's AST rule replaced it and the reviewer withdrew the prescription |
662
+ | `git add -A` from a worktree without the probe-home exclude | 978 `.probe-home/npm-cache` blobs reached master in a direct push (2026-09-09, #2843); the user-level `commit-index-check` hook now denies it — keep the exclude anyway |
663
+ | Ignoring a red advisory row on a PR that changes what the lane runs | #2833 merged with `Unit tests Windows (advisory)` red on its own head; master carried the red until #2842. Read that row like a gate when the diff touches the lane's script, step or executed files |
664
+ | Restarting the plegma daemon under systemd with the default PATH | Backend detection is a PATH walk in the daemon process; 5 of 10 backends vanished and every Luna/GLM brief was rejected `Unknown model` (plegma#375). Set `Environment=PATH=…npm-global/bin…` in a drop-in and read `daemon.out`'s `backends:` line after ANY restart |
665
+ | Polling `plegma_list` every turn | 68 calls, 194 KB of context in one session for no decision. Arm one background `plegma wait <handle>` per lane in the dispatch turn; `plegma_list` only at reconnect and to consume `done` handles |
666
+ | Running `node ../../scripts/<x>` from a worktree | The path resolves against the worktree's parent, not the repo; two CI waits exited at once with the wrapper's exit 0 (2026-09-10). Inside a worktree the scripts are at `scripts/`; read the wait's output file before trusting an exit code |
667
+ | Appending a worker's body section keyed on an exact heading level | The worker wrote `# Round 7`, the append keyed on `## Round 7`, and the PR body shipped without the round (#2846 v7). `grep` the published body for the section before reporting it landed |
668
+ | Pushing an orchestrator round without `npm run fmt:check` on the whole tree | #2853's merge round redded oxfmt on two trimmed lists (2026-09-10). fmt:check is the last command before any push, orchestrator rounds included |
669
+ | Running a governance suite in the main checkout after merges without rebuilding | Vitest loads compiled `.js`; a stale build makes the run fail closed (or worse, test old code). `npm run build` before any test run in a checkout that has moved |
670
+ | Accepting a lifecycle round on `-t`-only mutation reds | #2853 r6/r7 quoted reds that only reproduced under `-t`; nine awaits never returned whole-file (#2859). Whole-file mutation runs are the acceptance shape (AGENTS.md round-routing) |
671
+ | Sending a scope `note` to a worker about to finish | The #2854 r2 worker settled before the note was read; the round shipped without H2/M1. Check `plegma_status` first; a worker with no turns left gets a new round, not a note |
672
+ | Chaining a check and a commit or push with `;` or a pipe | Three times on 2026-09-25: a commit with `lint=1`, a push with the flake-shape ratchet red, and a push reported done by `echo $?` of a later `grep`. Gate with `&&`, or read the check in its own call; the guard is #3471. Recurred 2026-09-26 on #3492's pushes (a commit piped to `grep` then `;` push piped to `tail -1`, and a mutation `vitest` run `;`-chained to a commit) |
673
+ | Pushing with `npm run build >log 2>&1; echo build=$?; test "$(git rev-parse HEAD)" = SHA && git push …` | `guard-bash.mjs`'s `checkUngated` rule (#3471, landed in G12) denies this: the build's real exit code is thrown away by `;`, so a failed build still reaches the `git push` (case 1's own shape). Rewrite as `npm run build >log 2>&1 && test "$(git rev-parse HEAD)" = SHA && git push …`, or split the build and the push into two calls — never exempt `build` from the check |
674
+ | Opening a PR without `npm run preflight` | #3468 opened with a `build:` title that the title gate rejects; a hand-picked subset of checks (body lint only) left it out. Write `PR_BODY.md` and `COMMIT_MSG.txt` and run the preflight, which lints both |
675
+ | Adding real spawns or waits to a test without running the flake-shape ratchet | #3464's `git init` fixture raised a spawn count and pushed red (#3472); #3492's 60 s `setTimeout` reddened CI the next day, and that push's `clients/lsp/client.ts` change (it alone matches 71 test files) had capped the hook to build-only. `scripts/pre-push-targeted-tests.mjs` now arms `TEST_TREE_GOVERNANCE_TESTS` (the ratchet) on any `tests/` change and runs the armed registries past the cap |
676
+ | Carrying a field from a replaced queue entry into an entry of another kind | #3481 r1 kept the pending read stamp on an unstamped replacement; the queued rename close inherited a stale stamp and was dropped, reopening #3477 inside its own PR (#3491 verify round, fixed in `b937ff0a9`). Probe a review-round fix on every entry kind that shares the queue; AGENTS.md shape 55, model composition #3495 |
677
+ | Encoding a server's message order from the model instead of measuring it | #3484's first cut fenced every version-less server; docker-langserver publishes before the fence reply, so its only answer was dropped, and the fake server published after the reply (#3484 r1, found by the reviewer running the real server). Measure the order per server before the fixture encodes it; AGENTS.md shape 54 |
678
+ | Adding a second per-server strategy marker without a test that drives both | intelephense carried `emptyFirstPublish` when #3484 marked it `diagnosticsFence`; the fence dropped the first publish, the hold swallowed the answer, and three #3310 tests timed out in CI on `b937ff0a9`. `tests/config/strategy-marker-pair-coverage.test.ts` now reds an unregistered pair |
679
+ | Asserting on a record a production deadline can cut short | The dispatch-cap case needed all 33 files hashed inside the 50 ms settle deadline; a loaded runner cut one and master went red on `afea9074d` (#3493). Pin the bounds through a test seam (`_setObservedTimeBoundsForTests`, #3494); the load-simulation pass is #3496 |
680
+ | Reading a `check_suite.completed` wake as a green head | The wake excludes cancelled suites; #3491's run on `a16fb1f82` was cancelled and was reported "finished green" (2026-09-26). Read the run's conclusion on the exact SHA; `ci-verdict` needs `gh`, which cloud sessions lack (#3497) |
681
+ | Describing a guard in a contract line as if it runs | AGENTS.md shape 52 said stores were "pinned by name in the #1894 registry ratchet"; no such ratchet existed (2026-09-25 catalog retro). Name a guard by its path, and a planned one by its open issue |
682
+ | Rewriting a PR body's narrative without re-reading the `.changelog/` fragment | The fragment kept the retracted round-1 story after the body moved on to a different remedy (#3155 r2); re-read the fragment on every body rework, not just the body |
683
+ | Accepting a subset-shaped change without a generalization verdict | #3622 applied idle eviction to 4 of ~44 LSP servers; the maintainer caught the missing population screen by reading the PR. At each regroup, scan merged PRs and require the verdict. |
684
+ | Filing an issue mid-session without a seam group | Issues filed mid-session must be assigned to a seam group at filing (2026-09-30); do not leave the follow-up queue ungrouped. |
685
+ | Filing follow-up issues through the GitHub API without a TYPE or priority label | The orchestrator filed about a dozen issues this way on 2026-09-26 (#3543-#3546, #3548, #3549, #3552, #3556, #3558-#3560); the issue templates that would force a label are bypassed by API creation, and they stayed untriaged until the maintainer noticed by hand. `.github/workflows/untriaged-issues.yml` now fails a daily job listing any open issue still missing either (#3563) |
686
+ | Issuing a mid-flight order without naming the overridden brief clause | State which part of the original brief it overrides and post the order on the issue (#3695 handoff 6) |
687
+ | Explaining why an agent stopped without checking its status | Check the agent's status before attributing its stop (#3695 handoff 7) |
688
+ | Starting agents against an ambiguous target | Confirm the target before dispatching agents (#3695 handoff 8) |
689
+ | Letting strictness-ratchet and glossary pins collide on one change | Run both pin sweeps before pushing (#3455/#3643) |
690
+ | Re-running a `pull_request` job against the old merge SHA | Use `gh pr update-branch` to rebuild the merge ref (#3660; 2026-09-30) |
691
+ | Fixing a hooks or lint gate without sweeping older open branches | Sweep open branches committed before the fix (#3675; 2026-09-30) |
692
+ | Enabling auto-merge before local HEAD equals the pushed SHA | Verify the pushed SHA before enabling auto-merge (#3671) |
693
+ | Waiting for CI after retargeting a base without a push | Push after a base retarget to re-arm CI (#3679) |
694
+ | Leaving fork-PR `action_required` runs unapproved | Approve the runs after pushing to a fork PR (#3656) |
695
+ | Writing a closing keyword on a partial delivery | #4021's title said "closes #1513" while its notes said the global-bin walk remained; the merge auto-closed #1513 and it was reopened by hand (2026-10-07). Close only when every acceptance criterion is met; otherwise write `Refs #N` and post the remainder before merging. Title and body must agree |
696
+ | Two writers doing read-modify-write on one shared record without a lock | The orchestrator ledger lost a freshly written row: a sync script read the file, a row was appended, the sync wrote back its stale copy (2026-10-07). Every writer of a shared record holds one lock across the whole read-modify-write (principles §1, "Design shared state once") |
697
+ | Paraphrasing an acceptance criterion into a review brief | A combination-review brief for #3997 said substituted labels "must reject" where they must be accepted when they form an identifier (2026-10-06). Quote the criterion from the PR body or issue; never restate its polarity from memory |
698
+ | Treating a `completed` settlement as delivered when its declared report is missing | Two codex settlements in one batch wrote `REVIEW.md` instead of the declared `REVIEW_4024.md`, or only a GitHub comment (plegma #689; 2026-10-07). Check the declared file exists; else read the file the worker's final line links, and release by hand |
699
+ | Assuming a hook added mid-session is live | A `SubagentStop` hook added to `.claude/settings.local.json` mid-session never fired and did not show under `/hooks` (2026-10-07). Hooks load at session start: confirm under `/hooks` after adding one, or restart before relying on it |
700
+ | Leaving a lane's report inside the checkout that gets torn down | Closing a reviewer's worktree deleted its `REVIEW_4028.md`; the fix round worked from a relayed list (2026-10-07). Reports go outside worktrees (the handbacks directory), and teardown copies any root report out first |
701
+ | Relying on a declared deliverable name the worker never sees | plegma does not pass `deliverables:` into the delivered task; 4 of 4 briefs that omitted the file name got `REVIEW.md` or no file, 2 of 2 that named it were followed (plegma #689; 2026-10-07). Name every declared file in the brief text |
702
+ | Telling a worker to dispatch a workflow without checking what it publishes | A brief asked a fixer to `gh workflow run` its branch; the job publishes `data/test-history` with no ref guard, and the queued run would have pushed unreviewed rollup output with an oldest-row eviction (#4037, cancelled; 2026-10-07). Read the workflow's push and publish steps and their `if:` guards before asking for a branch dispatch |
703
+ | Trusting a `completed` fix round without checking the PR head moved | The #3997 maintainer round settled `completed` while its lease push to the base repo was rejected; the commit sat in the worker tree (plegma #692; 2026-10-07). After each fix round, compare `gh pr view --json headRefOid` with the worker's commit |
704
+ | Raising a timing budget without proving the guard still reds | A request to widen a 300 ms occupancy budget to 500 ms; the yield-removal mutation measured 220 ms locally while healthy CI measured 324–520 ms, so the guard was vacuous at either value (2026-10-07). Mutate the regression the budget exists for before moving the number |
705
+ | Re-running a broad suite after a one-file conflict resolution | A census-conflict merge on #4013 re-ran `tests/scripts` plus governance (~240 files) the reviewer had just run green on the prior head; the 4 affected files already passed (2026-10-07). Run the files the resolution touches; CI runs the rest |
706
+ | Claiming a measured fact from a partial grep | The orchestrator told the maintainer the merge-train warden's last 20 runs "took zero actions"; the grep had counted only update-branch, rerun and cancel calls, and the runs had posted 24 PR comments and 37 label changes (#4105, 2026-10-07). The maintainer decided on the wrong number and had to re-confirm. Count every effect a component can have before calling it inert |
707
+ | Letting one transient backend error re-route a whole day | A single Luna `Selected model is at capacity` failure moved about 15 later fix lanes to Claude Sonnet while codex had 80% weekly budget and 4 free slots; Claude's weekly budget reached 50% (2026-10-07/08). Treat a capacity error as transient, retry on the next dispatch, and check `plegma_quota` before every Claude fixer |
708
+ | Reading CI in a chain whose push silently did nothing | A background chain gated its push on `&&` after a build that never ran, then read the unchanged head's red Windows job as the "fixed head" result and wrote it into #4111's body (2026-10-07). After every push, compare `gh pr view --json headRefOid` with the pushed commit before reading any CI |
709
+ | Diagnosing a red from the first `##[error]` line | #4054's shard-5 red was called "npm registry unreachable"; that line came from a passing stubbed test, and the real failure was a 5 s timeout in check-pr-body.test.ts (#4088, 2026-10-07). Read the FAIL lines; treat annotation lines from stubbed tests as noise |
710
+ | Triggering CI on a bot PR before checking whether a run already exists | land.sh closed and reopened #4084 30 s after an update-branch, before the new run registered, which cancelled the run, and the cancelled aggregate read red (2026-10-07). Reopen only when no run exists for the head after a real wait |
711
+ | Writing a closing keyword where GitHub does not honour it, or by accident | #4121's title said `closes #3873`, which fails the close-keyword check (titles are never honoured); #4094's body said "then fixed #4080", an accidental closing keyword (2026-10-07). Put closing keywords in the body only, and reread the body for `fix(es\|ed) #N` prose |
712
+ | Seeding a group list from the active queue instead of the tracker | The orchestrator's session group held 3 issues while `area:session` had 8 more open p2s, so "is the session group done?" was answered from an incomplete list (2026-10-08). Build a group from the label and the tracker, then subtract what is out of scope |
713
+ | Filing every LOW review finding as an issue | Each review spawned about one follow-up, so the CI group stayed at about 36 open after 16 closures (2026-10-07). Fold or drop LOW findings; file only MEDIUM and above or a reproduced sibling, and give each group a "done when" |
714
+ | No cleanup when lanes end | 78 GB of finished lane trees and a 22 GB leaking test TMPDIR filled the root disk twice; two reviewers lost probe runs and one fixer's test file was truncated (2026-10-07). Remove a lane's trees and TMPDIR when its PR merges, and keep a disk alarm |
715
+ | Deriving the next round from a stale brief or a stale premise | #3871's brief asked for a selection fix #3903 had already shipped, and #3813's assumed every producer was unfixed; both fixers correctly refused to rebuild merged work (2026-10-07). Re-check the premise on current master when a lane starts, not when the issue was filed |
716
+ | Calling a PR-owned hygiene leak pre-existing because the same files fail on a later run | The PR's own CI run exposed the leak, but the reviewer classified it as a flake and fixed an unreachable injected path; the PR review and red-on-base comparison should have owned the finding. The hygiene check now treats a new leak on a green-master PR as CAUSED-BY-PR until red-on-base proves otherwise, and harness children receive a private `TMPDIR` (#4133, #4128). |
717
+ | Passing a commit SHA where a command expected wait seconds | The shell invocation was caught by the command's outcome review; argument-shape validation should have caught it before execution. `land.sh` now validates the wait argument and prints its outcome line. |
718
+ | Losing executable mode in an atomic `.new` to `mv` replacement | The next invocation caught the non-executable script; the file-install check should have compared mode as well as bytes. The replacement now preserves the executable bit. |
719
+ | Reusing a finished PR row for `lane-set --new` | The lane ledger exposed the wrong PR identity; the row allocator should have rejected terminal rows before allocation. New rows now require an unused active identity. |
720
+ | Matching a flake on text that CI never prints | The unmatched CI output was noticed during review; the matcher test should have used a captured CI transcript. The flake matcher now keys on the classifier's actual output. |
721
+ | Letting keyword-title lint contradict the repository convention | The title gate review found the contradiction; the title-convention test should have pinned the accepted form. The lint rule now follows the repository's title convention. |
722
+ | Relaying a shard failure to a fixer without mirroring it on the PR | The fixer noticed the missing scope record; the scope-mirror hook should have rejected the handoff. The handoff path now records the scope on the PR before dispatch. |
723
+ | Treating a repeatedly red advisory lane as harmless | The maintainer's retrospective found the 21% flake after a misleading PR draw; the advisory policy and newest-master comparison should have held the PR. `land.sh` now holds a PR-red/master-green advisory unless `ADVISORY_OK=1`. |
724
+ | Forgetting to arm the landing chain after a trailing fix | A later PR-GREEN event exposed that the fix was waiting unarmed; the trailing-fix command should have verified arming. Rule: after a trailing fix, arm `land.sh` in the same step (not yet mechanised). |
725
+ | Accepting an identity trade-off without a complete timing-cell table | Cloud verification found primary-item loss after the trade-off was accepted from prose; the fixer's state table and review should have enumerated every timing cell. The brief now requires the complete state table before accepting the trade-off. |
726
+ | Letting a scoped test exceed Vitest's default timeout | A repeated cloud review caught the timeout; the local targeted run should have exercised the test under its default timeout. Rule: a scoped review runs new tests under the default Vitest timeout before passing them (not yet mechanised). |
727
+ | Specifying a truncation mechanism instead of an output acceptance criterion | The orchestrator's output read found cut lines after the worker followed the brief; the brief should have stated the required output (complete first sentence, no ellipsis). Rule: acceptance names the required output, not only the mechanism. |
728
+ | Adding a second idle timer without naming the probe consumer | The nightly eviction probe caught the missing configuration coverage; the change's call-tree diff should have listed every idle-timer environment setter. The configuration test now requires every client-read idle timer to be armed by the probe. |
729
+ | Reproducing only one step of a multi-step release-body producer | A user noticed the missing Thanks section; the release-body test should have run the complete producer chain. `bin/relnotes-regen.sh` now runs both steps and refuses to lose the section. |
730
+ | Basing a real-pi premise on an unavailable maintainer-machine probe | The fixer could not rerun the stale probe and the recurrence was found in review; the premise check should have required a repository witness. Fix briefs now require a `tests/real-harness` witness using `withRealPi` and a scripted provider. |
731
+ | Sending a sandboxed verifier a brief path instead of its contents | The verifier reported that the brief was unreadable; the dispatch smoke test should have inspected the delivered argument. Verification now inlines file arguments. |
732
+ | Allowing a mocked handler to throw so every assertion passes vacuously | Verify found the non-blocking degradation; the test double should have failed explicitly when the handler throws. Rule: a test asserting a handler verdict must also assert that no handler-throw degradation was recorded; a shared helper is a candidate, not yet built. |
733
+ | Trusting a worker hand-back that omitted exact test summaries and misreported fixes | Review found nine CAUSED-BY-CHANGE failures and unsupported “fixed” and TLA+ claims; the hand-back check should have required exact summary lines and reviewer red-on-base reruns. Fix lanes now paste the named Vitest summaries and verify identity claims. |
734
+ | Adapting repository fixtures to a Plegma guard failure | Verify caught the harness-specific workaround; the fixture lane should have reported the environment block without changing repository tests. Plegma-guard fixture failures are now reported as environmental. |
735
+ | Reading a piped command's exit status instead of its outcome record | A pending chain was reported as successful because `tail` returned zero; the landing check should have read the chain's own result. `land.sh` now prints `LAND-RESULT #N: <state> (rc=N)`, which callers must read. |
736
+ | Routing a same-seam new defect to a weaker fixer after a prior round | The next verify found the same-seam defect after a Luna-high assignment; round routing should have selected Opus from the seam and round count. Rule: a new same-seam defect after two rounds goes to Opus (cloud fixer when the subscription is short) with the state table and model step first. |