@herbertgao/pi-extensions 2026.10.14 → 2026.10.16

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 (203) hide show
  1. package/README.md +13 -11
  2. package/THIRD_PARTY_NOTICES.md +3 -3
  3. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -2
  4. package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -2
  5. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +38 -1
  6. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +13 -9
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +2 -2
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-highlight.ts +41 -1
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +42 -25
  10. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  11. package/node_modules/@narumitw/pi-btw/README.md +1 -1
  12. package/node_modules/@narumitw/pi-btw/dist/index.ts +77 -64
  13. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +2 -2
  14. package/node_modules/@narumitw/pi-btw/docs/core-alignment.md +10 -2
  15. package/node_modules/@narumitw/pi-btw/package.json +5 -5
  16. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +83 -63
  17. package/node_modules/@narumitw/pi-caffeinate/package.json +3 -3
  18. package/node_modules/pi-lens/CHANGELOG.md +37 -0
  19. package/node_modules/pi-lens/README.md +32 -0
  20. package/node_modules/pi-lens/config/biome/core.jsonc +3 -3
  21. package/node_modules/pi-lens/dist/{chunk-K2GUZ4DN.js → chunk-2DDDCJDL.js} +4 -4
  22. package/node_modules/pi-lens/dist/{chunk-DS2USX5G.js → chunk-2DMLM3ZO.js} +11 -11
  23. package/node_modules/pi-lens/dist/chunk-2F47TQOA.js +73 -0
  24. package/node_modules/pi-lens/dist/{chunk-YXDCRUKQ.js → chunk-2PHMIAKO.js} +4 -4
  25. package/node_modules/pi-lens/dist/{chunk-PP2A5V2T.js → chunk-2RLWJO5K.js} +7 -7
  26. package/node_modules/pi-lens/dist/{chunk-T4NGVFYI.js → chunk-2X4VLOCC.js} +2 -2
  27. package/node_modules/pi-lens/dist/{chunk-QT66NEYN.js → chunk-3MYEA7QD.js} +3 -3
  28. package/node_modules/pi-lens/dist/{chunk-7ZS7MC24.js → chunk-3WEPUD2V.js} +22 -22
  29. package/node_modules/pi-lens/dist/{chunk-TL2TCJYL.js → chunk-4AVZ3TG7.js} +14 -14
  30. package/node_modules/pi-lens/dist/{chunk-SNEUMLM7.js → chunk-4PCQCU47.js} +4 -4
  31. package/node_modules/pi-lens/dist/chunk-4WX4CTUE.js +57 -0
  32. package/node_modules/pi-lens/dist/{chunk-5LRUKYFA.js → chunk-5APMQ2IJ.js} +2 -2
  33. package/node_modules/pi-lens/dist/{chunk-4U7GDSZQ.js → chunk-5CV5ITZF.js} +2 -2
  34. package/node_modules/pi-lens/dist/{chunk-VUAVE3QC.js → chunk-5ZR3APIM.js} +36 -36
  35. package/node_modules/pi-lens/dist/{chunk-CPZ5JJW6.js → chunk-63RIVFQI.js} +4 -4
  36. package/node_modules/pi-lens/dist/{chunk-EDMLIW6W.js → chunk-75SY4F24.js} +12 -12
  37. package/node_modules/pi-lens/dist/{chunk-RCHO5W7M.js → chunk-7RQXA5GG.js} +6 -6
  38. package/node_modules/pi-lens/dist/{chunk-XHDBJODR.js → chunk-A3YNG5KP.js} +21 -21
  39. package/node_modules/pi-lens/dist/{chunk-3WCEHYOI.js → chunk-AE37FEGH.js} +1 -1
  40. package/node_modules/pi-lens/dist/{chunk-KPVLQHCZ.js → chunk-AMXIUN2R.js} +2 -2
  41. package/node_modules/pi-lens/dist/{chunk-XI34NWDI.js → chunk-ARD426WI.js} +1 -1
  42. package/node_modules/pi-lens/dist/{chunk-RG3MXTRI.js → chunk-BHUWL2Y3.js} +7 -7
  43. package/node_modules/pi-lens/dist/{chunk-4ODSZ35Z.js → chunk-BI5LAQ3Y.js} +44 -44
  44. package/node_modules/pi-lens/dist/{chunk-Q42LJANT.js → chunk-BM5GS6ZH.js} +2 -2
  45. package/node_modules/pi-lens/dist/{chunk-CG5V25HX.js → chunk-BWYQUPOS.js} +1 -1
  46. package/node_modules/pi-lens/dist/{chunk-HYVXA3BB.js → chunk-CFRQMBGP.js} +23 -23
  47. package/node_modules/pi-lens/dist/{chunk-NLIVE7L6.js → chunk-CJYKEW2L.js} +1 -1
  48. package/node_modules/pi-lens/dist/{chunk-MEFLGBCS.js → chunk-DC4CFXM5.js} +3 -3
  49. package/node_modules/pi-lens/dist/{chunk-ASRAO7KG.js → chunk-DMSLNKF7.js} +27 -27
  50. package/node_modules/pi-lens/dist/{chunk-YSDPVDFC.js → chunk-DQXSPYRI.js} +3 -3
  51. package/node_modules/pi-lens/dist/{chunk-YKVDBNPO.js → chunk-EVDGNG4F.js} +3 -3
  52. package/node_modules/pi-lens/dist/{chunk-2LDMXL2M.js → chunk-F5Z6URKM.js} +2 -2
  53. package/node_modules/pi-lens/dist/{chunk-72J27ICO.js → chunk-F6X3YJWD.js} +2 -2
  54. package/node_modules/pi-lens/dist/{chunk-YXGRRORB.js → chunk-FA5LDARD.js} +13 -13
  55. package/node_modules/pi-lens/dist/{chunk-OMJ3OFBJ.js → chunk-FFL3A2VP.js} +6 -6
  56. package/node_modules/pi-lens/dist/chunk-FJIVKLPH.js +31 -0
  57. package/node_modules/pi-lens/dist/chunk-G2B7F6ZU.js +88 -0
  58. package/node_modules/pi-lens/dist/{chunk-YWWG4AQA.js → chunk-GAACZY6R.js} +24 -25
  59. package/node_modules/pi-lens/dist/{chunk-F7BO6FWH.js → chunk-GMTFDAOK.js} +11 -11
  60. package/node_modules/pi-lens/dist/{chunk-UVY4TOJH.js → chunk-GNSIWBAT.js} +3 -3
  61. package/node_modules/pi-lens/dist/chunk-GTAI2J6U.js +27 -0
  62. package/node_modules/pi-lens/dist/{chunk-SJHC3BCZ.js → chunk-GZE7WOI4.js} +98 -111
  63. package/node_modules/pi-lens/dist/{chunk-ZAPSUBLU.js → chunk-H7HTEQUZ.js} +7 -7
  64. package/node_modules/pi-lens/dist/{chunk-ZPJM7DID.js → chunk-HK6JVFZC.js} +3 -3
  65. package/node_modules/pi-lens/dist/chunk-IPDG45G5.js +26 -0
  66. package/node_modules/pi-lens/dist/{chunk-ZSUX7KEM.js → chunk-J6JP25XU.js} +2 -2
  67. package/node_modules/pi-lens/dist/{chunk-6XSESGWD.js → chunk-JL6CXUMW.js} +2 -2
  68. package/node_modules/pi-lens/dist/{chunk-Y5KTA2OB.js → chunk-K2YGBXOA.js} +2 -2
  69. package/node_modules/pi-lens/dist/{chunk-AHWA4AKM.js → chunk-KLQVC3XC.js} +4 -4
  70. package/node_modules/pi-lens/dist/{chunk-27VWVB23.js → chunk-KSR7RGQY.js} +10 -10
  71. package/node_modules/pi-lens/dist/{chunk-N3PLNNCW.js → chunk-KXF5R4UN.js} +1 -1
  72. package/node_modules/pi-lens/dist/{chunk-GLW3YDZZ.js → chunk-LEJOJDXL.js} +9 -9
  73. package/node_modules/pi-lens/dist/{chunk-Y2TPADJR.js → chunk-MA77RSFN.js} +9 -9
  74. package/node_modules/pi-lens/dist/{chunk-IL7K66ZQ.js → chunk-MKVZQUEG.js} +15 -15
  75. package/node_modules/pi-lens/dist/{chunk-EIKRZ32J.js → chunk-MN7MHUXQ.js} +2 -2
  76. package/node_modules/pi-lens/dist/{chunk-4FHUGDKU.js → chunk-MT6BVNFW.js} +5 -5
  77. package/node_modules/pi-lens/dist/{chunk-3SNDVPOR.js → chunk-NDMCVUYK.js} +8 -8
  78. package/node_modules/pi-lens/dist/{chunk-63NMUNYP.js → chunk-NIU2IPC5.js} +6 -6
  79. package/node_modules/pi-lens/dist/{chunk-APFJKOP6.js → chunk-NNKXDXXS.js} +2 -2
  80. package/node_modules/pi-lens/dist/{chunk-FEDWAYDS.js → chunk-OJLTLYHB.js} +12 -12
  81. package/node_modules/pi-lens/dist/{chunk-KJJAVH3X.js → chunk-OLAWH5UQ.js} +5 -5
  82. package/node_modules/pi-lens/dist/{chunk-G224FADB.js → chunk-OOU2WZZE.js} +1 -1
  83. package/node_modules/pi-lens/dist/{chunk-NFNVDDGB.js → chunk-OSTKYB55.js} +1 -1
  84. package/node_modules/pi-lens/dist/chunk-P4QNXS6I.js +27 -0
  85. package/node_modules/pi-lens/dist/{chunk-7IYC4ENJ.js → chunk-PKES3ISE.js} +2 -2
  86. package/node_modules/pi-lens/dist/{chunk-UCVMSOXF.js → chunk-PO45POGF.js} +2 -2
  87. package/node_modules/pi-lens/dist/{chunk-JWOVP5BL.js → chunk-PPIBVH4R.js} +6 -6
  88. package/node_modules/pi-lens/dist/{chunk-EWXXLS26.js → chunk-PQJFG24Z.js} +82 -12
  89. package/node_modules/pi-lens/dist/{chunk-TPYYEDP5.js → chunk-Q3UZHW6N.js} +45 -22
  90. package/node_modules/pi-lens/dist/{chunk-5DKE4HGX.js → chunk-Q4EMRFNA.js} +34 -34
  91. package/node_modules/pi-lens/dist/{chunk-XHLK33VM.js → chunk-Q4FCYCRE.js} +16 -16
  92. package/node_modules/pi-lens/dist/chunk-Q6D6VMI4.js +22 -0
  93. package/node_modules/pi-lens/dist/{chunk-Q4BKKOVC.js → chunk-QGSTQH4D.js} +8 -8
  94. package/node_modules/pi-lens/dist/{chunk-GYRZ72R4.js → chunk-RZOXUSPC.js} +2 -2
  95. package/node_modules/pi-lens/dist/{chunk-EN5AM7PX.js → chunk-S67UJDGQ.js} +10 -10
  96. package/node_modules/pi-lens/dist/{chunk-YWNO5Q4R.js → chunk-SCIUNBPF.js} +17 -17
  97. package/node_modules/pi-lens/dist/{chunk-VIDEKABZ.js → chunk-SJJYRZB4.js} +2 -2
  98. package/node_modules/pi-lens/dist/chunk-SXGD4ANG.js +25 -0
  99. package/node_modules/pi-lens/dist/{chunk-THEXI2QO.js → chunk-T7FTXGS3.js} +42 -42
  100. package/node_modules/pi-lens/dist/{chunk-WUY4BZEP.js → chunk-TIQJPRDD.js} +106 -50
  101. package/node_modules/pi-lens/dist/{chunk-EXVXBSGN.js → chunk-TIYGSODX.js} +17 -17
  102. package/node_modules/pi-lens/dist/{chunk-2FYKETQJ.js → chunk-U2SDMG7C.js} +5 -5
  103. package/node_modules/pi-lens/dist/{chunk-PJXNTPB2.js → chunk-U6OC3QEM.js} +21 -21
  104. package/node_modules/pi-lens/dist/{chunk-LMCTHJ2H.js → chunk-UCGQT677.js} +18 -18
  105. package/node_modules/pi-lens/dist/{chunk-UL5SXQVX.js → chunk-UHGF5UT5.js} +1 -1
  106. package/node_modules/pi-lens/dist/{chunk-AI3GP74G.js → chunk-UN4TEBWN.js} +15 -15
  107. package/node_modules/pi-lens/dist/{chunk-2SDHYHHO.js → chunk-V3APN3DY.js} +13 -13
  108. package/node_modules/pi-lens/dist/{chunk-7FLRUH6B.js → chunk-V63BC55Q.js} +1 -1
  109. package/node_modules/pi-lens/dist/{chunk-S55TEC7I.js → chunk-VG5JS5SW.js} +2 -2
  110. package/node_modules/pi-lens/dist/{chunk-IEBJF3PN.js → chunk-VPBIMOAQ.js} +11 -11
  111. package/node_modules/pi-lens/dist/{chunk-EX4EXBW7.js → chunk-VQH24FIP.js} +15 -15
  112. package/node_modules/pi-lens/dist/{chunk-TVZRLTG6.js → chunk-VSFLRN5Y.js} +1 -1
  113. package/node_modules/pi-lens/dist/{chunk-KCBRHV5E.js → chunk-W2V54OCL.js} +3 -3
  114. package/node_modules/pi-lens/dist/{chunk-VITFDI3O.js → chunk-W5LGKNET.js} +12 -12
  115. package/node_modules/pi-lens/dist/{chunk-OZNCKLOX.js → chunk-W5R5SABV.js} +12 -12
  116. package/node_modules/pi-lens/dist/{chunk-ELZRSR5N.js → chunk-WIZWZR4C.js} +38 -38
  117. package/node_modules/pi-lens/dist/{chunk-MKPCELNI.js → chunk-WQOIR3QY.js} +13 -13
  118. package/node_modules/pi-lens/dist/{chunk-COOUUC5W.js → chunk-XAIT2YGS.js} +6 -6
  119. package/node_modules/pi-lens/dist/chunk-XCUHKYCQ.js +23 -0
  120. package/node_modules/pi-lens/dist/{chunk-KFXCL4OV.js → chunk-XQCSWV2G.js} +22 -23
  121. package/node_modules/pi-lens/dist/{chunk-RU34BA4D.js → chunk-YBSONGSZ.js} +34 -34
  122. package/node_modules/pi-lens/dist/{chunk-GTDSYEA2.js → chunk-YISME6ON.js} +1 -1
  123. package/node_modules/pi-lens/dist/chunk-YRD4ISED.js +30 -0
  124. package/node_modules/pi-lens/dist/{chunk-X3UTCXAA.js → chunk-YSBHPOY6.js} +12 -12
  125. package/node_modules/pi-lens/dist/{chunk-XWFIHYCH.js → chunk-Z2XAOKHK.js} +2 -2
  126. package/node_modules/pi-lens/dist/{chunk-K4SZB56V.js → chunk-Z7IGUAXL.js} +7 -7
  127. package/node_modules/pi-lens/dist/{chunk-KX56K73G.js → chunk-ZKXQKGWZ.js} +2 -2
  128. package/node_modules/pi-lens/dist/{chunk-FWZRGGGY.js → chunk-ZQ6NZZTB.js} +6 -4
  129. package/node_modules/pi-lens/dist/{chunk-2Y6OJRSI.js → chunk-ZUUI3ZSA.js} +3 -3
  130. package/node_modules/pi-lens/dist/{chunk-UO66IMVP.js → chunk-ZYNI26MI.js} +2 -2
  131. package/node_modules/pi-lens/dist/index.js +571 -409
  132. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +10 -10
  133. package/node_modules/pi-lens/dist/mcp/cli.js +42 -42
  134. package/node_modules/pi-lens/dist/mcp/server.js +108 -108
  135. package/node_modules/pi-lens/dist/mcp/worker.js +61 -61
  136. package/node_modules/pi-lens/dist/probes/installer.js +19 -19
  137. package/node_modules/pi-lens/docs/agent-tools.md +28 -7
  138. package/node_modules/pi-lens/docs/configuration.md +3 -1
  139. package/node_modules/pi-lens/docs/defect-shapes.md +738 -0
  140. package/node_modules/pi-lens/docs/invariants/caches-stores.md +30 -0
  141. package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +164 -0
  142. package/node_modules/pi-lens/docs/invariants/git-guard-host.md +53 -0
  143. package/node_modules/pi-lens/docs/invariants/language-config.md +31 -0
  144. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +286 -0
  145. package/node_modules/pi-lens/docs/invariants/paths-os.md +59 -0
  146. package/node_modules/pi-lens/docs/invariants/session-telemetry.md +74 -0
  147. package/node_modules/pi-lens/docs/pi-lens-fixer.md +2 -1
  148. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +10 -8
  149. package/node_modules/pi-lens/docs/pi-lens-monitor.md +2 -2
  150. package/node_modules/pi-lens/docs/pi-lens-orchestration.md +41 -0
  151. package/node_modules/pi-lens/docs/pi-lens-release.md +20 -0
  152. package/node_modules/pi-lens/docs/pi-lens-retro.md +3 -2
  153. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +6 -6
  154. package/node_modules/pi-lens/docs/pi-lens-subagent.md +2 -2
  155. package/node_modules/pi-lens/package.json +3 -2
  156. package/node_modules/pi-provider-qoder/dist/index.js +27 -5
  157. package/node_modules/pi-provider-qoder/package.json +1 -1
  158. package/node_modules/pi-typesafe/README.md +1 -1
  159. package/node_modules/pi-typesafe/dist/client.js +43 -1
  160. package/node_modules/pi-typesafe/package.json +1 -1
  161. package/node_modules/pi-web-access/CHANGELOG.md +40 -0
  162. package/node_modules/pi-web-access/README.md +96 -22
  163. package/node_modules/pi-web-access/brave-rate-limit.ts +2 -2
  164. package/node_modules/pi-web-access/curator-page.ts +3 -1
  165. package/node_modules/pi-web-access/curator-server.ts +1 -0
  166. package/node_modules/pi-web-access/dist/index.js +2607 -1674
  167. package/node_modules/pi-web-access/dist/mcp-cli.js +1119 -327
  168. package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +95 -0
  169. package/node_modules/pi-web-access/duckduckgo.ts +51 -45
  170. package/node_modules/pi-web-access/exa.ts +48 -6
  171. package/node_modules/pi-web-access/extract.ts +2 -2
  172. package/node_modules/pi-web-access/fetch-params.ts +5 -4
  173. package/node_modules/pi-web-access/field-extract.ts +347 -0
  174. package/node_modules/pi-web-access/gemini-search.ts +151 -13
  175. package/node_modules/pi-web-access/index.ts +128 -125
  176. package/node_modules/pi-web-access/mistral-search.ts +1 -1
  177. package/node_modules/pi-web-access/ninerouter.ts +92 -0
  178. package/node_modules/pi-web-access/offtopic-judge.ts +72 -0
  179. package/node_modules/pi-web-access/openai-search.ts +36 -10
  180. package/node_modules/pi-web-access/package.json +1 -1
  181. package/node_modules/pi-web-access/perplexity.ts +1 -0
  182. package/node_modules/pi-web-access/query-rewrite.ts +39 -13
  183. package/node_modules/pi-web-access/source-check.ts +31 -15
  184. package/node_modules/pi-web-access/summary-model-scope.ts +19 -1
  185. package/node_modules/pi-web-access/summary-review.ts +13 -20
  186. package/node_modules/pi-web-access/tool-arguments.ts +1 -1
  187. package/node_modules/pi-web-access/upgrade-notice.ts +47 -0
  188. package/node_modules/pi-web-access/utils.ts +26 -1
  189. package/node_modules/pi-web-access/web-tool-contract.ts +4 -1
  190. package/node_modules/pi-web-access/web-tool-core.ts +99 -19
  191. package/node_modules/pi-web-access/xai-search.ts +3 -3
  192. package/package.json +10 -10
  193. package/node_modules/pi-lens/dist/chunk-22Y2BM7H.js +0 -23
  194. package/node_modules/pi-lens/dist/chunk-44X7VIKR.js +0 -73
  195. package/node_modules/pi-lens/dist/chunk-54NIOJJZ.js +0 -25
  196. package/node_modules/pi-lens/dist/chunk-7WWQAW5P.js +0 -30
  197. package/node_modules/pi-lens/dist/chunk-EA2ZRG44.js +0 -27
  198. package/node_modules/pi-lens/dist/chunk-EKNWOL2I.js +0 -27
  199. package/node_modules/pi-lens/dist/chunk-G5UCJFT7.js +0 -26
  200. package/node_modules/pi-lens/dist/chunk-N5FBM25N.js +0 -22
  201. package/node_modules/pi-lens/dist/chunk-P5XUGPIX.js +0 -31
  202. package/node_modules/pi-lens/dist/chunk-PKOXJIVT.js +0 -88
  203. package/node_modules/pi-lens/dist/chunk-RG7OODGM.js +0 -57
@@ -0,0 +1,30 @@
1
+ <important if="touching caches, stores, and project intelligence rules">
2
+
3
+ ### Caches, stores, and project intelligence
4
+
5
+ - Behavior-gating durable stores use `clients/durable-store.ts`: lock, re-read,
6
+ merge the caller delta, atomically publish, refresh coupled mirrors before
7
+ releasing the lock. Best-effort derived caches declare their loss policy.
8
+ - Every cache states its freshness axes, bound, eviction axis, and invalidation
9
+ source. A bounded entry count does not excuse unbounded bytes, timers, WASM
10
+ objects, or persisted evidence.
11
+ - Workspace diagnostics cache mtime-drift hashing is limited by
12
+ `CONTENT_HASH_MAX_BYTES` in `clients/content-stamp.ts`; larger entries retain
13
+ strict mtime invalidation. Persistent reverify keeps zero mtime tolerance;
14
+ session-state restore keeps its 1 ms tolerance.
15
+ - Tree-sitter's `queryBatchCache` is invalidated by `clearWasmInput` when a
16
+ trapped query heals, because an in-flight batch may have cached a result that
17
+ omitted the healed rule (#3834).
18
+ - Async publication carries a generation or epoch and checks it before and
19
+ after awaited work. Graph snapshots are immutable by replacement.
20
+ - Review-graph, snapshot, reverse-dependency, word-index, and call-graph data
21
+ use path identities and explicit partial-coverage markers. A capped walk is
22
+ lower-bound evidence, never a clean zero.
23
+ - Tree-sitter uses the shared client and file-major project passes. Grammar
24
+ crashes are blocked before load; source overrides record package/version
25
+ provenance. Real grammar and rule tests use the warmed shared client.
26
+ - `module_report` and `symbol_search` are read-only orientation surfaces.
27
+ `read_symbol` and `read_enclosing` return bodies and record pi read coverage;
28
+ outlines do not claim body coverage. MCP adapters call `lens-engine.ts` only.
29
+
30
+ </important>
@@ -0,0 +1,164 @@
1
+ <important if="touching dispatch, runners, formatters, and installers rules">
2
+
3
+ ### Dispatch, runners, formatters, and installers
4
+
5
+ - The analysed-state latch records a pipeline-owned target hash captured after
6
+ pi-lens writes and before LSP or dispatch awaits. `fileModified` also covers
7
+ side-effect files, so `postWriteStateHash` is the ownership discriminator;
8
+ an absent hash must not stamp the target with later disk bytes (#2499).
9
+ - The opaque prescan resolves its root once, through `opaquePrescanRoot`
10
+ (`clients/opaque-mutation-scan.ts`), and every consumer of that session root
11
+ asks the same owner: the baseline record and take, the head-move record and
12
+ take, and the root each held-primary send is scoped by. A
13
+ session whose cwd is not the coordinator's `projectRoot` — a concurrent
14
+ secondary session, which the host's session-start guard declines before any
15
+ `session_start` body runs — otherwise records its baseline and its HEAD under
16
+ one root and takes them under another, reporting `no-pending-snapshot` for a
17
+ command that did write. Scan evidence is scoped to the checkout it ran in: a
18
+ recognized write outside that root is kept (never cleared by a scan that
19
+ could not see it) and earns no authorship the scan cannot confirm.
20
+ - A bash command's writes are recovered from that session root AND from every
21
+ checkout the command ITSELF names — its `cd`/`pushd` target or a recognised
22
+ write operand — when that checkout is a linked worktree of the session's own
23
+ repository (`resolveOpaqueRecoveryRoots`, `sameCheckoutOtherRoot`). Both hooks
24
+ derive bounded root lists (`OPAQUE_RECOVERY_ROOT_CAP`) from the command text,
25
+ the session root, and the checkout each hook sees at its own instant, so a
26
+ worktree the command itself creates is admitted only at `tool_result` and its
27
+ missing baseline is reported as `partial-recognition-no-baseline`, while a
28
+ root both hooks admit still names one key for its record and its take; a
29
+ checkout of another repository, a checkout named past the cap, and a
30
+ git target under a non-checkout session root each leave one bounded
31
+ `opaque-recovery-root-refused` record per session. This is why a `cd` into a
32
+ sibling worktree no longer reads a clean `git status` in the wrong checkout as
33
+ "nothing changed". Relative operands resolve against the directory in effect
34
+ for their own segment (`scanShellWriteScopes`). That directory moves only for
35
+ an admitted form: `cd DIR` or `pushd DIR` whose one operand is a plain
36
+ path: bash's own word after quote removal, made only of admitted characters
37
+ (any quoted one, an escape bash also removes, an unquoted letter, digit or
38
+ `_./@%:,=+-`, and a leading `~` only as `~` or `~/`), starting with a
39
+ letter, digit, `_`, `.`, `/` or `~`; or a bare `popd` of a push the scan
40
+ admitted, entered at list start or after `&&`, `;`, a newline
41
+ or a backgrounded list, ended by `&&`, `;`, a newline or the end, and in no
42
+ pipeline or backgrounded list. A move entered after `&&` holds only to the end
43
+ of that `&&` chain, because it happened only if the left side succeeded. A
44
+ directory builtin in a pipeline or a backgrounded list leaves the directory
45
+ unchanged. Any other directory change, construct or shell-text builtin
46
+ returns the scan to the session root for the rest of the command.
47
+ - A recovered write is judged by the checkout that OWNS it, in both directions:
48
+ the ignore gate a synthetic bash-write dispatch passes asks the `.gitignore`
49
+ of the root that admitted the write (`_ownerRoot`), not the session root's, so
50
+ a linked worktree nested under a directory the session checkout ignores is
51
+ analysed instead of dropped silently (`.claude/worktrees/` in this
52
+ repository); and admission asks `analysis-root.ts`
53
+ (`canWriteAnalysisRoot(resolveAnalysisRoot(...))`) rather than re-deriving the
54
+ rule. Ownership is compared by REAL path, so a `cd` into a symlinked spelling
55
+ of a worktree keeps its authorship and its observed identity.
56
+ - `RUNNERS` declarations include file kinds. Runner selection is gated by file
57
+ kind and anchored at the file's language root, not by dispatch-root config or
58
+ declaration order. Runner children use `resolveToolCwd` with launcher markers.
59
+ - Automatic tests do not cross a Git checkout boundary, including through
60
+ filesystem aliases: `foreignGitRoot` (`clients/test-runner-client.ts`) gates
61
+ failed-first cache admission, retirement, every discovery path, and the
62
+ turn-end gate. Indeterminate ownership is not a foreign verdict, a deleted
63
+ target retires as `retired-missing`, and final rejections emit
64
+ `test-target-foreign-checkout`. Proven by
65
+ `tests/clients/test-runner-worktree-isolation.test.ts`.
66
+ - By design, a session whose cwd is a plain folder with no `.git` that holds several repositories, a submodule, or a nested linked worktree gets no automatic tests for the files inside them: any nested `.git` is a foreign checkout, and there is no per-project opt-in (maintainer decision, #3649/#3691). Run them explicitly.
67
+ - The one exception to that boundary is a linked worktree of the session's own repository (same git commondir, different top level, `resolveLinkedWorktreeOwner` in `clients/review-graph/git-identity.ts`, #3871): turn_end selects and runs its tests with that worktree's root as the project root (`clients/test-target-roots.ts`), so config, `node_modules` and the failed-first state are the worktree's own. A worktree root without its own runner install (no `node_modules/.bin`, venv or `vendor/bin`) is skipped with a counted `turn-end-test-root-skipped` row rather than run through `npx` or a bare interpreter; a reported location is rebased through `displayRoot` using the runner cwd first, then the dispatch root, only when that file exists, and otherwise remains as printed. A sibling worktree's file is still foreign to every other root. Python's ambient `VIRTUAL_ENV`, `CONDA_PREFIX`, or absolute `UV_PROJECT_ENVIRONMENT` is accepted for the session checkout, and for a linked worktree only when the environment root is inside that checkout; a skipped pytest row says that ambient environments were not borrowed when one is set. The edit worklist is the session's project worklist (#2504), so a session whose cwd is itself a linked worktree never sees an edit in the main checkout or a sibling and runs only its own tests. Each turn that edited files writes one `turn_end_test_selection` record to `latency.log` (candidates, selected, why not, and selected/candidates per owning root; first 8 roots, the rest in `rootsOmitted`; `selected` includes carried deferred targets, which no candidate bucket counts, so per-root `selected` can sum below it; one row of about 570 B per edit turn with candidates, bounded by log rotation only), so a turn with 0 tests is explained without the dbg lines the MCP route drops.
68
+ - Managed tools resolve through the registry and sanctioned availability seams.
69
+ Do not hand-roll install, PATH, or package-manager discovery. Use typed
70
+ `SpawnFailure.kind`; repair only `tool-not-found`.
71
+ - Windows LSP startup exit-code-1 failures are repairable only when the shared
72
+ command resolver finds no command or an npm shim target is absent; present
73
+ binaries that exit 1 remain runtime failures (#4263, #1199). The launch and
74
+ repair gate are pinned by `tests/clients/lsp/windows-startup-repair.test.ts`.
75
+ - Expected skips remain distinct from clean success and failure. Extend the
76
+ closed `RUNNER_SKIP_REASONS` taxonomy when policy intentionally defers work.
77
+ Preserve the skip reason through runner latency and model-facing delivery.
78
+ - `scripts/ci-verdict.mjs` ends every CLI path with `ci-verdict: exit <N> (<kind>)`;
79
+ read that final stdout line instead of `$?` after a pipe. `guard-bash` denies
80
+ the piped-status recurrence while allowing output-only pipes.
81
+ - A formatter is handed the file's identity, never the link that named it:
82
+ `realpathOrResolve` (`clients/path-utils.ts`) is the real path
83
+ of the nearest existing ancestor plus the missing tail, with no lexical `..`
84
+ collapse first. `formatFile` and `FormatService.formatFile` use it, so
85
+ `AGENTS.md -> CLAUDE.md` formats `CLAUDE.md` and Prettier's "is a symbolic
86
+ link" rejection never occurs. `FormatService.formatFile` also requires
87
+ `sessionRoot` and classifies the identity through `resolveAnalysisRoot`: an
88
+ `adopted` or `none` identity is refused, writes nothing, and records one
89
+ `adopted-root-writer-skipped` row (`writer: "format"`). The refusal is on
90
+ identity, not spelling, so a plain file outside every writable root (a
91
+ sibling package of a monorepo session cwd, say) is refused as well; a caller
92
+ that must format it passes that root as `sessionRoot`. Proven by
93
+ `tests/clients/format-service-symlink-identity.test.ts`.
94
+ - Formatter and autofix policy is config-first where the registry says so.
95
+ Formatting is strict by default. Autofix must carry per-diagnostic fixability
96
+ or a conservative capability allowlist.
97
+ - Analyzer and runner fallback filters must match the substituted surface's
98
+ contract. Empty output distinguishes clean, skipped, unavailable, errored,
99
+ inconclusive, and partial states.
100
+ - Every autonomous writer (pipeline autofix, immediate/deferred formatter, and
101
+ actionable-warning quickfix) resolves through `clients/tool-agreement.ts`.
102
+ Its declarative population assigns one evidence bucket and declines absent,
103
+ unreadable, unparseable, unsupported, or unregistered evidence; callers emit
104
+ bounded degradation records. Ktlint's standalone-CLI exception still
105
+ declines Gradle-owned projects without guessing a CLI version.
106
+ - Node tool agreement in `nodeAgreement` is established from the project's lockfile evidence in the deterministic order npm (`package-lock.json`) → pnpm (`pnpm-lock.yaml`, v9 `importers` and v6 top-level maps) → yarn (`yarn.lock`, v1 blocks and Berry `npm:` descriptors); the decision names the supplying lockfile, and missing, unreadable, unparseable, or shape-unsupported evidence declines.
107
+ - A whole-package fixer (`cargo clippy --fix`, `dart fix --apply`) rewrites
108
+ files pi's mutation queue does not hold, so it runs through
109
+ `runWithFixRestore` (`clients/fix-run-restore.ts`, #3598): hash the tool's
110
+ source files, capture agent mutations pi-lens observes during the run (the
111
+ tool_result seam and the mutation bridge), write them back after, one
112
+ degradation per run, and name any edit that cannot be restored. The restore
113
+ takes pi's queue entry for each sibling, one at a time (#3830). It starts
114
+ after the caller's scan of the tool's changes and is awaited only after the
115
+ target's hold is released, never inside it. The tool_result pipeline does not
116
+ await it (F's result must not wait on a sibling's holder; the loss notice is
117
+ queued as an advisory), the `agent_end` drain does, after the release: a queue entry is requested by something that holds no other
118
+ entry, except the multi-path LSP edit, which requests in ascending key order,
119
+ and nothing that holds an entry awaits the restore. Do not add a second
120
+ whole-package fixer without it, and do not await a queue entry while holding
121
+ another.
122
+ - A file's first write in a session blocks on the linter delta, not on every
123
+ linter error. The `tool_call` of the first classified write or edit
124
+ runs the file's inline linters (`PRE_EDIT_SEED_RUNNER_IDS`, tied to the
125
+ edit-scope census's LINTER lanes) over the bytes still on disk, under
126
+ `bounded()` with `PRE_EDIT_CAPTURE_BUDGET_MS` (500 ms), and installs their blocking
127
+ findings as `session.preEdit.<file>` beside the delta baseline. The capture
128
+ admits at most four active captures, aborts their process groups on abandonment
129
+ or session reset, and retains slots until teardown settles. It
130
+ only creates that record, and only while no baseline, tombstone or seed
131
+ exists, the bytes are the ones it read, and its session is current; each
132
+ dispatch only shrinks it (`classifyPreExisting`, identity plus line text,
133
+ one current finding per entry). A matched finding is reported as
134
+ pre-existing, never as a blocker, unless the inline record already holds
135
+ it. Language servers, type checkers, gated runners and scanners are never
136
+ seeded (maintainer scope, 2026-10-15). Collect-later linters and the MCP
137
+ route have no seed. Proven by
138
+ `tests/index-4483-first-write-seed-witness.test.ts`.
139
+ - `clients/dispatch/runners/runner-spawn-cwd-sweep.test.ts` is the population
140
+ guard for child cwd derivation. Add a reasoned migration row instead of a
141
+ pin-only update.
142
+ - Each real-bytes fixture under `tests/fixtures/runner-output/` records the
143
+ availability probe its runner sends (`availability`: the argv, the binary
144
+ that answered from its own banner, and the real exit status) and a real clean
145
+ run (`clean`; there is no prose alternative). The clean record is the
146
+ fixture's own invocation run in `tests/fixtures/runner-output-clean/<runner>`,
147
+ whose inputs are un-ignored by `.gitignore` on purpose. One gate,
148
+ `recordProblems` in `scripts/capture-runner-output.mjs`, refuses a record whose
149
+ version its own answer never printed, and a clean run whose argv is not this
150
+ fixture's; the capture and the census both call it.
151
+ `captured-real-output.test.ts` runs the REAL checker against that record
152
+ instead of mocking it, so a tool that rejects its own probe — helm 4 rejects
153
+ `--version` — reaches the replay; the clean bytes are what the matrix's clean
154
+ cell replays, in the clean workspace. `scripts/capture-runner-fixtures.mjs
155
+ --records-only` retrofits those records onto an existing fixture without
156
+ touching its work bytes, keyed on the fixture's own case.
157
+ Enforced by `tests/clients/dispatch/smoke-fixture-coverage.test.ts` and
158
+ `tests/clients/dispatch/tool-state-matrix.test.ts`.
159
+ - Every `parseToolRun` runner documents its nonzero-exit table; the documented
160
+ `ran` codes are pinned exactly so adding or removing one does not pass
161
+ silently, and each documented code needs an executable status fixture in the
162
+ runner's own test matrix (#3292).
163
+
164
+ </important>
@@ -0,0 +1,53 @@
1
+ <important if="touching git guard and host adapters rules">
2
+
3
+ ### Git guard and host adapters
4
+
5
+ - Git command classification has one lexer and one guarded-verb matcher seam.
6
+ Unknown wrappers and indirect guarded verbs fail closed. Text-consumer
7
+ allowances recurse through command substitutions and execution contexts. A
8
+ substitution's output is read both empty and opaque (shape 61).
9
+ - The commit gate reads two states: the inline-blocker map's latch
10
+ (`RuntimeCoordinator`), then the persisted `turn-end-findings` record. A
11
+ collect-later runner's blocking findings join the map through
12
+ `clients/deferred-runner-blockers.ts`, never a second store: the turn-end
13
+ late-runner lane records them before the blocker replay (so the replay is
14
+ their one delivery and the composer persists them), and the gate judges
15
+ answers that settled but no turn end has drained, then refreshes the
16
+ persisted record (`syncGitGuardRecord`) as the inline path does at
17
+ `tool_result`. Both sites call one verdict, `judgeDeferredRunnerFindings`
18
+ (freshness, then policy), and the record's `sources` and `lines` come from
19
+ `clients/inline-blocker-fields.ts`, shared with the pipeline's writer. A run
20
+ still in flight does not gate, and an edit to the file while its re-check is in
21
+ flight clears the record until that answer settles (#3814). The gate and the
22
+ record's writers in `clients/git-guard.ts` and the turn-end composer read it
23
+ at any age. Each blocker section keeps the session that wrote it (top-level
24
+ `sessionId`, other owners in `carriedBlockers`; a record without that field
25
+ is one owner's), and a writer replaces only its own session's sections.
26
+ Another session's section leaves only for a file a dispatch checked
27
+ whole and found clean (`checkedWholeFile`), or whose file is gone. Its text
28
+ no file owns (a project lane's report: CVEs, secrets, cascade) leaves only
29
+ when its owner rewrites it, or at a turn end once `DEFAULT_MAX_AGE_MS` has
30
+ passed since its owner's own write (`blockerWrittenAt`, per partition; the
31
+ record's own timestamp moves with every writer). A record written before
32
+ this version has no stamp: the first turn end of another session that
33
+ carries it (a composer write or a settled turn end) writes one, and its
34
+ window starts there. Only a write logs what it drops. The gate judges a
35
+ record alone only when this session is its sole owner. A settled turn end
36
+ drops this session's sections and another session's expired text no file
37
+ owns, and retires a record that is this session's own, claims no blocker, or
38
+ holds no structured claim (the `--lens-guard`-off writer's), with one
39
+ `record_retired` row (#4725). A dispatch that never answered
40
+ (`pipeline_crash`, `pipeline_error`) is latched per file, apart from the
41
+ record's latch, and only that file's own returning dispatch clears it.
42
+ - The shared-checkout guard refuses unsafe worktree mutation when another live
43
+ session and uncommitted work are both proven. It never auto-stashes.
44
+ - `mcp/server.ts` talks to pi-lens through `clients/lens-engine.ts`. A mirrored
45
+ capability is one engine method plus one route. MCP transport remains
46
+ hand-rolled and dependency-free.
47
+ - Host SDK imports are type-only, except the one lazy, caught lookup of pi's
48
+ `withFileMutationQueue` in `index.ts` (#3506), admitted by count in
49
+ `tests/host-sdk-type-only.test.ts`; `clients/file-mutation-queue.ts` detects
50
+ and records a second SDK copy. Runtime dependencies belong in
51
+ `dependencies`.
52
+
53
+ </important>
@@ -0,0 +1,31 @@
1
+ <important if="touching language and configuration rules">
2
+
3
+ ### Language and configuration
4
+
5
+ - `clients/language-registry.ts` is the identity source for language ids,
6
+ extensions, filenames, file kinds, LSP ids, and grammars. Consumers project
7
+ from it; they do not maintain parallel language tables.
8
+ - Agent-facing advisory text resolves names through `resolveLensToolName` with
9
+ the delivery host: pi uses `piName`, and MCP uses `mcpName` from
10
+ `TOOL_REGISTRY`. Known tools without a host mapping resolve to `undefined`,
11
+ so callers omit or rephrase them; pi-only rows require
12
+ `PI_ONLY_TOOL_REASONS`. Do not add a second name map or hard-code a pi tool
13
+ name in advisory output (#2535).
14
+ - `clients/config-core/` owns schema validation, normalization, merging,
15
+ provenance, deny precedence, merge strategies, trust-gated process specs,
16
+ and bounded migration records. Existing LSP, global, and project loaders
17
+ adopt it without adding another merge implementation.
18
+ - Canonical config is `.pi-lens.json` plus `~/.pi-lens/config.json`; locations,
19
+ legacy migrations, and namespaces live in the config-location/schema modules.
20
+ A new config key or environment flag needs a forcing function, stability tier,
21
+ diagnostic code, tests, and docs.
22
+ - `rules.<id>.ignorePaths` is an experimental, project-relative path denial
23
+ resolved by config-core with array-union semantics: global entries cannot be
24
+ cleared by project config. Ast-grep and tree-sitter apply it before scanning;
25
+ other runner output uses the shared rule-policy filter.
26
+ - `lens_diagnostics` has one model-facing diagnostic surface. `source` is
27
+ `session` or `lsp`; `scope` is `paths` or `workspace`; explicit paths always
28
+ win. Severity is a threshold. Retired compatibility names must not widen a
29
+ request into a workspace sweep.
30
+
31
+ </important>
@@ -0,0 +1,286 @@
1
+ <important if="touching lsp, trust, and process execution rules">
2
+
3
+ ### LSP, trust, and process execution
4
+
5
+ - `safeSpawnAsync` is the subprocess seam. It carries ambient abort behavior,
6
+ process-tree cleanup, output caps, typed failure kinds, and bounded timeouts.
7
+ Installs pass `ignoreAmbientSignal: true` and remain trust-gated.
8
+ It is also the lookup chokepoint. Under pi trust other than
9
+ `trusted`, every child's search path loses the session repository's own
10
+ directories, and a bare command that still resolves into them is refused
11
+ with a typed `trust-refused` result. "Session repository" is one rule in
12
+ `clients/session-repository.ts`, never a caller-threaded root: the kernel-real
13
+ path lies under `process.cwd()`, under a project-local bin dir of its
14
+ ancestors below HOME, or in a checkout sharing its git commondir; the data
15
+ dir never counts and a session at or above HOME owns nothing. Lookups that
16
+ start a path rather than a name (`which` answers, global bin dirs, the
17
+ installer's PATH walk, the LSP launcher) ask `isUntrustedProjectPath` or
18
+ `admittedLookupAnswer` for the same judgment, and every refusal writes one
19
+ `trust-refusal` row per target. A raw `node:child_process` start in the
20
+ runtime trees is a hole by construction:
21
+ `tests/config/spawn-chokepoint-sweep.test.ts` derives them from the module
22
+ binding and requires each to be routed, or admitted with a reason, evidence
23
+ and a pinned site count. Extend the seam; never add a per-caller guard. A
24
+ non-pi maintenance host that starts the checkout's own tools adopts trust at
25
+ its entry, as the MCP entry points do.
26
+ - Under pi, project trust is consumed through `isProjectTrusted`; pi-lens never
27
+ registers the host's trust-answer handler. `compileLspRegistry` is the one admission
28
+ seam for LSP executable fields: global config and built-ins remain allowed,
29
+ while project `command`, command overrides, `env`, and
30
+ `initializationOptions` require pi's `trusted` answer. Missing trust APIs are
31
+ fail-closed for those project fields with one bounded notice; installs keep
32
+ their existing compatibility policy. `tests/clients/lsp/lsp-registry-trust.test.ts`
33
+ and the LSP config/service suites pin the boundary.
34
+ Non-pi process entry points (`mcp/server.ts`, `mcp/worker.ts`,
35
+ `mcp/analyze-cli.ts`, and `mcp/cli.ts`) declare trusted execution once at
36
+ startup through `setProjectTrustState`: workspace trust belongs to their
37
+ calling client, and pi trust is not consulted.
38
+ `tests/mcp/server.smoke.test.ts` and `tests/mcp/analyze-cli.test.ts` pin it.
39
+ The standalone harness scripts that drive the built `dist/clients/lsp/`
40
+ service (`scripts/characterize-lsp.mjs`, `probe-clean-signal.mjs`,
41
+ `server-capabilities.mjs`, `measure-lsp-idle-eviction.mjs`, `bench-lsp.mjs`,
42
+ `smoke-tools.mjs`) are the same kind of entry point: each adopts trust once
43
+ through `adoptFixtureProjectTrust` (`scripts/lib/lsp-fixture-workspace.mjs`),
44
+ because a script that leaves trust `unknown` measures every refused server as
45
+ absent. `tests/config/lsp-script-trust-census.test.ts` fails a
46
+ `scripts/*.mjs` that reaches `dist/clients/lsp/` without it. The four nightly
47
+ producers that run under `continue-on-error` also report what they evaluated
48
+ to `scripts/lib/assert-evaluated.mjs` (one pure count function per producer,
49
+ called by the script and by its test); the nightly's floor step fails below
50
+ each measured floor and when a matrix cell classified at HEAD turned
51
+ `unknown` without a HEAD `firstMissed` stamp at least
52
+ `FIRST_PUBLISH_EXPIRY_DAYS` old (`tests/config/nightly-evaluated-floors.test.ts`).
53
+ Every other
54
+ `continue-on-error` producer either calls the same helper (`--count
55
+ <producer>=<n> --floor <m>` from a workflow step; `--min-pass`, the
56
+ complexity file count and the shuffle census's missing starts already do) or
57
+ needs none, and one census decides that: every `continue-on-error` site in a
58
+ `.github/workflows/*.yml` or `*.yaml` file and in a composite
59
+ `.github/actions/**/action.yml` or `action.yaml` is registered in
60
+ `tests/fixtures/nightly-floors/continue-on-error-sites.json` as `floored`
61
+ (naming the gating step and the floor text, which must sit in the argument
62
+ list of a named measuring invocation — `scripts/assert-evaluated.mjs`,
63
+ `scripts/smoke-tools.mjs`, `scripts/complexity-report.mjs` — on a top-level
64
+ line the shell executes, of a step whose `if:` is absent or a conjunction of
65
+ `always()`, `success()`, `!cancelled()` and one `github.event_name` or
66
+ `matrix.<name>` comparison the parsed document settles (the workflow's `on:`
67
+ keys, that job's `strategy.matrix` list), so
68
+ `!cancelled() && matrix.os == 'macos-latest'` counts only where the matrix
69
+ declares that leg; every other `if:` expression, including a trivially true
70
+ literal and a comparison no declared value satisfies, leaves the floor
71
+ unproven, and so does a job whose own `if:` the document proves never true).
72
+ A `\`-continued line and a line the previous one left unfinished with `&&`,
73
+ `||` or `|` are one command, so the measuring invocation must start the
74
+ joined command; an `exit` ends the script only in command position. A
75
+ `no-floor` row states the reader that makes an empty result visible, or
76
+ `governed-by` (naming the issue and the live tests that own the site, in
77
+ files vitest collects). The reader derives the population from the parsed
78
+ files, so it fails closed on a site the registry
79
+ does not name, on a producer file or a non-file entry it does not classify,
80
+ on a `continue-on-error` key in a location that is not a job or a step, and
81
+ on a floor whose evidence is not in the argument list of such an invocation
82
+ on a top-level command (a comment, a quoted command, a heredoc body, a
83
+ printed command, a function or block body, a subshell, a chained command, or
84
+ a line after an `exit`), or that names a step whose `if:` is outside that
85
+ allowlist; a floor comes from a run recorded in
86
+ `tests/fixtures/nightly-floors/measurements.json`. A
87
+ `# No floor (<issue>): <reason>` header above a job is human-facing copy
88
+ where one exists, not the record: six sites keep one (the five `lint.yml`
89
+ jobs and `install-smoke.yml`'s `mise-repro`), and the registry row the
90
+ census requires is the record.
91
+ The helper must stay importable without `dist/` (the refresh-PR job runs it
92
+ on a fresh checkout).
93
+ - LSP service generations, workspace-sweep holds, and repair latches use
94
+ versioned process singletons. Reset tears down the old generation before a
95
+ replacement can spawn. Idle eviction is lease-guarded and clears ownership
96
+ timers on every removal path.
97
+ - Production callers use the grouped experimental `LspCapabilities` adapter in
98
+ `clients/lsp/capabilities.ts`; direct `LSPService` module imports are limited
99
+ to that adapter and are enforced by
100
+ `tests/config/lsp-capabilities-import-sweep.test.ts` (#2372/#277).
101
+ - Idle-eviction policy is the registry's `idleEviction` field, declared per
102
+ server. The nightly (`scripts/measure-lsp-idle-eviction.mjs`) measures every
103
+ registry server's eviction cost and respawn safety into
104
+ `docs/lsp-idle-eviction.md` and changes no policy; a declaration change is a
105
+ follow-up that cites its row, or the nightly's draft promotion PR
106
+ (`bot/lsp-idle-evict-promote`, #3989: two consecutive eligible nights, idle
107
+ RSS floor, cold-start cap, hold list in
108
+ `scripts/lib/lsp-idle-eviction-promote.mjs`, derived from the registry test's
109
+ `HOLD_INDEXER_IDS` class; the PR also moves the id into
110
+ the registry test's `TRANSPARENT_IDS`; night memory in the matrix doc's
111
+ refresh-state block; never auto-merged, never demotes). `tests/config/lsp-idle-eviction-measurement.test.ts`
112
+ fails when a registry server can go unmeasured without an admission or when
113
+ the committed measurement vetoes a server declared `transparent`.
114
+ - The compiled registry holds the CATALOG ENTRY for every built-in with no
115
+ command override (`compileLspRegistry`), so the object the client registry
116
+ keeps (`SpawnedServer.info`) is the object `LSP_SERVERS`/`getServerById`
117
+ exposes; an overridden server keeps its own copy so its `spawn` and trust
118
+ admission never reach the catalog. A copy here is not a safe container: it is
119
+ a second registry whose entries swallow every arm a caller applies to the
120
+ first (history: `HISTORY.md`, 2026-10-19).
121
+ `tests/clients/lsp/lsp-registry-trust.test.ts` pins both directions;
122
+ `scheduleIdleEviction` records `lsp-idle-eviction-declined` once per server
123
+ per session when it arms no timer.
124
+ - The server-role vocabulary and the declared trait table have one owner,
125
+ `clients/lsp/server-traits.ts` (#1488, #1756 stage 1). Ask `isAuxiliary`,
126
+ never a comparison against the role literal, and read `notifyInflightLimit`
127
+ or `replyOrdering` through `serverTraits`, never by re-deriving a default;
128
+ `LspServerRole` is declared there and nowhere else, so a second
129
+ `"primary" | "auxiliary"` is a re-fork. `LSPServerInfo.role` is
130
+ non-optional: a row declares it, or the factory and custom-server builders
131
+ apply `DEFAULT_LSP_SERVER_ROLE`. Measured-behaviour markers (`silentOnClean`
132
+ and the census siblings named by `STRATEGY_TABLE_TRAITS`) stay on
133
+ `wait-policy/strategies.ts`, which their probes and expiry tests own; the two
134
+ tables stay disjoint. The auxiliary lifecycle and wait policy lives in
135
+ `clients/lsp/auxiliary-lifecycle.ts`, the diagnostic policy in
136
+ `clients/dispatch/auxiliary-lsp.ts`. Enforced by
137
+ `tests/config/lsp-role-predicate-sweep.test.ts` (production and `scripts/`
138
+ trees at zero inlined predicates) and
139
+ `tests/config/lsp-server-trait-table.test.ts` (registered-or-fail).
140
+ - Which auxiliaries the operator's configuration switches off (a kill switch
141
+ such as `--no-opengrep` / `opengrep.enabled=false`) has one owner,
142
+ `configDisabledAuxiliaryLspServerIds` in `clients/dispatch/auxiliary-lsp.ts`.
143
+ The explicit `lsp_diagnostics` probe and `lsp_navigation workspaceDiagnostics`
144
+ pass that set as `excludeServerIds` to both the touch and `getDiagnostics`,
145
+ through the flag resolver each host injects; the session's resource degrade
146
+ is not part of it. The probe's batch cache key comes from
147
+ `buildProbeScopeKey`, never equal to the workspace sweep's key, because the
148
+ sweep records before `pi-lens-ignore` and the probe after it.
149
+ - Every diagnostics entry route starts the same server set and gives the same
150
+ confirmation verdict under each server-selecting switch (`--no-opengrep`,
151
+ `opengrep.enabled=false`, a disabled or missing primary). Enforced by
152
+ `tests/tools/diagnostics-route-switch-matrix.test.ts`, which derives the
153
+ routes from every production access to an `LSPService` diagnostics member
154
+ and fails closed on an access it cannot classify, so a new read joins the
155
+ matrix or carries a reasoned exemption keyed by its `clientScope` and
156
+ `diagnostics` options. Each cell asserts the exact lines the route shows.
157
+ - A file no primary answered for is unconfirmed, never clean, whether the
158
+ primary could not start, was still starting, or is in `lsp.disabledServers`.
159
+ The one rule is `unansweredPrimaries` (clients/lsp/index.ts), which names
160
+ the disabled ones through `disabledPrimaries`
161
+ (clients/lsp/session-roots.ts, not `config.js`, whose import surface the
162
+ test mocks mirror). A `fallbackFor` alternate standing in for a disabled
163
+ owner keeps the denial as the cause when it cannot answer either; the
164
+ cascade names such a server once per session, not per neighbour.
165
+ Every route words the cause through `primaryUnavailableCause` and
166
+ `PRIMARY_UNAVAILABLE_CAUSE` (clients/lsp/diagnostic-binding.ts), never its
167
+ own sentence. A later write of such a file prints a one-line unconfirmed
168
+ status naming the cause, never the clean line.
169
+ - LSP roots never exceed the session-cwd ceiling. Root/config discovery uses
170
+ shared marker seams. Child cwd resolution uses `resolveToolCwd` and its
171
+ caller-specific markers.
172
+ - Temporary roots (#1129) are classified once per process by
173
+ `clients/ephemeral-root.ts`, on real paths on both sides. A directory inside
174
+ a real git checkout below `os.tmpdir()` (root or subdirectory) is a normal
175
+ LSP root with the ephemeral idle window, and `getProjectDataDir` gives it
176
+ its usual slug under `<base>/.ephemeral/<pid>-<8 hex>/`: normal within the
177
+ process, never read by another one, removed by the exit hook and, for a
178
+ dead pid, by the session-start sweep. A `pi-agent-*` path below the tmpdir
179
+ that no checkout owns is declined at `resolveLspServerCwd` with one
180
+ `lsp-root-declined` record per staging root per session.
181
+ - Per-path LSP notifications serialize read/build/send/record work. Pull
182
+ cancellation blocks a same-path replacement until settlement. Waits are
183
+ deadline- and abort-bounded, and silence is never clean.
184
+ - Document line addressing has one owner, `clients/lsp/content-scan.ts`: the
185
+ `\n` count behind the `lsp_document_send` record's `contentLineCount` and the
186
+ LSP sync bound (`countLfNewlines`), the last LSP-addressable line an
187
+ Incremental change spans, and one line's text (`lineTextAt`, which the
188
+ diagnostic-conversion call sites read) all come from it. The rule it owns is
189
+ the count and the one-line read: no other module may `split("\n")` document
190
+ content to obtain a line count or a single line — a send, a bound check, and
191
+ a line read ask this owner. A module that needs the whole line array (a
192
+ multi-line table, a per-line scan of its own document) keeps its `split`; the
193
+ array is the value it consumes, never a way to count or to reach one line.
194
+ - `touchFile` fires a type-2 watched-file announcement at entry for the first
195
+ seen content hash of a path, before the owner's didChange; it reaches every
196
+ other live client of the same server across package roots through the client
197
+ watch queue. Content hashes are session-scoped and bounded (#4156).
198
+ - A capability the client advertises has a sender, or the advertisement states
199
+ why it has none. `textDocument/didSave` follows a landed didOpen/didChange
200
+ only when the server declared `textDocumentSync.save` and the caller declared
201
+ the touch a save — the post-write sync, the explicit `lsp_diagnostics` query
202
+ and the MCP analysis's first touch (`analyzeFile`, the MCP hosts' post-write
203
+ route), never a sweep warm-up, cascade or sweep touch. The touch debounce
204
+ reads one rule: skip only when the bytes the server will hold once the path's
205
+ notify queue drains are this touch's content. The evidence is the client's
206
+ own sent-content record (`getSentContent`) AND `hasNotifyInFlight`, because
207
+ that record reports what landed and a send still running lands after a skip.
208
+ `hasNotifyInFlight` counts a content send only: a save-only send
209
+ (`sendDidSaveForHeldDocument`) cannot change the bytes or remove the document,
210
+ so it leaves the record final, while a didClose always counts. A client that
211
+ cannot answer either question is pushed, never skipped: the elapsed window
212
+ that used to decide there is gone (`formal/lsp-server-content`
213
+ `GateWindowReopen` is why). Its key is (path, server): the client scope never
214
+ re-pushes bytes a server holds. The debounce never drops a save: a saved touch
215
+ whose push it skipped sends the save alone (`notify.save`), and the save mark
216
+ names the content a `didSave` LANDED for, owned by the client's document
217
+ record and written only by the send continuation. Every rebuild of that
218
+ record carries the mark with the rest of the binding: Incremental's
219
+ text-budget eviction strips the payload, never the save evidence. A failed
220
+ carried save leaves the save owed; a failed standalone save gets one bounded
221
+ retry (`GateSaveRetry`, `MutGateSaveNoRetry`) and a retry that lands for
222
+ other bytes cannot suppress the save the next saved touch owes.
223
+
224
+ - Every server-produced `WorkspaceEdit` a path applies is bound to the bytes the
225
+ server computed it from. Both rename flows take the request instant before
226
+ they ask (`rename` right before `lspService.rename`, `renameFile` right before
227
+ `workspace/willRenameFiles`) and pass `captureRenameExpectedContent`'s map as
228
+ `expectedContent`; `clients/lsp/edits.ts` compares every bound file inside
229
+ pi's mutation queue before its first write, refuses the whole edit, and
230
+ records one `lsp-edit-stale-content` row naming the file. `renameFile` has no
231
+ target (nothing read the old path), so an unopened file there is best effort
232
+ by mtime, the same remainder the `rename` path carries. The evidence a file
233
+ is compared against the sent-content records of every client that
234
+ contributed a kept edit for that file, keyed by the registry client key; a
235
+ merged edit never falls back to a different client's priority record. The
236
+ records bind the file only when every contributor holds one; a contributor
237
+ with none leaves the file on the mtime rule, and the refusal names it. One
238
+ client's failed `willRenameFiles` never discards another client's answer,
239
+ of the same server id or not. `documentVersions` is
240
+ the other binding axis, for a server-initiated `workspace/applyEdit`. A new
241
+ apply site binds the content or states why it cannot.
242
+ - `touchFile` freezes content-bound auxiliary coverage at merge time. A later
243
+ publication cannot undo a finding drop. Auxiliary gaps narrow coverage and
244
+ never turn a primary answer inconclusive. When a primary touch is
245
+ inconclusive but the merged result contains answered diagnostics, dispatch
246
+ preserves only diagnostics from content-confirmed contributors and carries
247
+ the named primary gap as unconfirmed; only an empty inconclusive result is
248
+ skipped (#4219, #4231). Auxiliaries never confirm a file alone: a touch that
249
+ acquired auxiliaries but no primary that rooted for the file is inconclusive
250
+ with `primary-unavailable`, naming those primaries, and `getDiagnostics`
251
+ records the same ids as `unavailablePrimaryServerIds` (one rule,
252
+ `unansweredPrimaries`; an auxiliary-only language is unaffected).
253
+ - A server's `window/showMessage` is observed once per distinct text per
254
+ session (`lsp_server_message`), and an error-level message reporting that the
255
+ server's own config or rules failed to load records
256
+ `lsp-server-config-load-failed`. An AUXILIARY in that state never evaluated
257
+ the bytes it reports on, so its empty publications are refused as evidence
258
+ (`lsp_publish_dropped_server_config_failed`) and empty answers already stored
259
+ are retracted; a non-empty answer still flows, and a language-role server is
260
+ recorded but never gated. A refused publication still answers its send,
261
+ the server's own `semgrep/rulesRefreshed` clears the failure, and the
262
+ touch's `lsp-scanner-coverage-gap` reason carries the failure text. It
263
+ composes with the hold of the empty publish before the rules load (table:
264
+ `tests/clients/lsp/opengrep-pre-rules-publish-4763.test.ts`). Proven by
265
+ `tests/clients/lsp/opengrep-offline-config-failure.test.ts`. The same gate
266
+ (`auxiliaryEmptyIsNotEvidence`) refuses an auxiliary's UNVERSIONED empty
267
+ publication that lands in the phase of the path's stored or pending finding:
268
+ one rules generation (`semgrep/rulesRefreshed` count) and one client send.
269
+ Opengrep's open-documents scan publishes `[]` for files it did not target, so
270
+ that empty is no scan; a new send or a rules refresh clears as before, and a
271
+ versioned or language-server publication keeps last write wins
272
+ (`lsp-auxiliary-empty-after-finding`).
273
+ - The explicit `lsp_diagnostics` read checks `exceedsLspSyncLimits` once before
274
+ warm attachment or `touchFile`; an over-bound file returns a `too_large`
275
+ result with its byte/line measurement and records
276
+ `lsp-diagnostics-file-too-large` once per file per session.
277
+ - Every new LSP server has a smoke fixture or a documented alternate/toolchain
278
+ exemption. Real LSP-spawn tests belong in the serialized `lsp-spawn-heavy`
279
+ lane.
280
+ - A `fallbackFor` family is one primary for workspace grouping: a selected
281
+ preferred server and its sequential alternate do not disable the workspace-
282
+ pull fast path merely because both registry members match the file. Measure
283
+ the alternate independently; do not attribute the preferred server's
284
+ capabilities or diagnostics to it (#3939).
285
+
286
+ </important>
@@ -0,0 +1,59 @@
1
+ <important if="touching paths, data, and operating systems rules">
2
+
3
+ ### Paths, data, and operating systems
4
+
5
+ - Use `PathKeyedMap` for path-keyed memory. Choose
6
+ `normalizeEphemeralMapKey` for process-local hot indexes and `normalizeMapKey`
7
+ for long-lived shared state. Preserve original display paths separately.
8
+ - Resolve a path's identity once, where it enters (a tool argument, a write
9
+ event, `createDispatchContext`, `FormatService`), and hand it down. The
10
+ widget, delta-baseline and finding stores key a path that is already an
11
+ identity: they keep the syntactic key and resolve nothing per write
12
+ (maintainer decision 2026-10-24; shape 1). A walk or key derived from a caller
13
+ spelling instead answers for the link's project, not the file's.
14
+ - A path a host tool was given resolves through `resolveHostToolPath` (the
15
+ base expansion) or `resolveToolCallFilePath` (base plus pi's variant
16
+ ladder), never a bare `path.resolve(base, raw)`; see shape 74.
17
+ - Windows-shaped paths use `path.win32` functions. Use `toPosix`,
18
+ `splitPathSegments`, `isUnderDir`, `isSameOrWithin`, and
19
+ `isAtOrAboveHomeDir` instead of inline separator or containment logic.
20
+ - Data and log locations follow **Data directories and logs**; never hardcode
21
+ `.pi-lens` paths in writes or user-facing text.
22
+ - Probes and child processes pin `PI_LENS_HOME`, `PILENS_DATA_DIR`, `HOME`, and
23
+ install/log/cache directories to `.probe-home` under the worktree; never the
24
+ maintainer's real home, and never via `TMPDIR`/`TMP`/`TEMP`, which moves the
25
+ vitest harness home into the checkout (#3026).
26
+ - Scratch checkouts and `mktemp -d` never land under `/tmp` (tmpfs; #3526). Use
27
+ `~/.local/share/pi-lens-orchestrator/tmp/<lane>` for orchestrator and
28
+ reviewer scratch, `<worktree>/../probes-<pr>` for probes, and
29
+ `.claude/worktrees/` for a fixer's own worktree.
30
+ - Vitest also pins `HOME`, `USERPROFILE`, `XDG_CONFIG_HOME`, `XDG_CACHE_HOME`
31
+ and `XDG_DATA_HOME` per worker, to a scratch directory under
32
+ `pi-lens-scratch`, so `os.homedir()` and every child a test spawns
33
+ resolve inside it. A test that sets `HOME` itself (`pinFixtureHome`) wins. The
34
+ real home stays reachable only as `REAL_HOME` from `tests/support/vitest-setup.ts`
35
+ (or `os.userInfo()`), and a file that spells either is a named row in
36
+ `tests/support/real-home-readers.ts` with a `// real-home: <reason>` header.
37
+ The managed bin directory refuses to resolve outside a pinned `PI_LENS_HOME`
38
+ (`assertManagedBinDirInsidePinnedHome`, `clients/installer/index.ts`).
39
+ - Vitest gives every worker its own `PI_LENS_HOME`, `<run-shared home>/worker-home-<run>-<pid>`
40
+ (#3721); log sinks bind their path at module load, so a `PI_LENS_HOME` assigned
41
+ in `beforeEach`/an `it` body moves nothing. A test process never truncates a log
42
+ under the real `~/.pi-lens` (`isTestProcessTargetingRealHome`); the first refusal
43
+ emits one `process.emitWarning` (visible on stderr) and folds a
44
+ `log-sink-truncate-refused` row into `pilens_health`. `vitest-setup.ts` also pins the orphan-backstop
45
+ directory through `resolveBackstopStateDir` (#3083) when the home IS the
46
+ run-shared one. Explicit per-case homes remain authoritative. Never bypass this
47
+ seam for its lock or stamp.
48
+ - Test tmp roots are swept by the worker that made them (#2912):
49
+ `tests/support/vitest-setup.ts` removes every `setupTestEnvironment` root at
50
+ `afterAll` and on SIGTERM; any other straggler reds its owner, so do not widen
51
+ the sweep. Registry: `tests/support/tmp-root-registry.ts`.
52
+ - Two vitest invocations may share one `TMPDIR`. An invocation judges and
53
+ sweeps only tmp entries owned by files its own workers loaded (#3314), so a
54
+ tmp fixture names its family in the prefix at its own `mkdtempSync` or
55
+ `setupTestEnvironment` call (#3306).
56
+ - New filesystem walkers use shared exclusions and ignore matching, cap
57
+ walk-down work, and use the correct home-ceiling policy for walk-up discovery.
58
+
59
+ </important>