@iowarp/clio-coder 0.4.1 → 0.4.2

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 (437) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/CONTRIBUTING.md +59 -36
  3. package/README.md +404 -472
  4. package/SECURITY.md +2 -1
  5. package/dist/{acp-ZILU3AUO.js → acp-TMDQZDIG.js} +7 -7
  6. package/dist/{agents-HYWGBGQR.js → agents-5N5NG3XG.js} +28 -28
  7. package/dist/assets/codewiki.json +1 -1
  8. package/dist/{auth-N3QT7CBO.js → auth-Z5CCBXKQ.js} +8 -9
  9. package/dist/{builtins-UJLMOVOV.js → builtins-K6TNDT24.js} +4 -4
  10. package/dist/{chunk-GVQJ5CCZ.js → chunk-2HFQNRV3.js} +7 -7
  11. package/dist/{chunk-QMXC4JB7.js → chunk-2NHR3NAY.js} +163 -1401
  12. package/dist/chunk-2X4RYJTJ.js +39 -0
  13. package/dist/{chunk-Y45G3AXC.js → chunk-2Z2IKEXI.js} +6 -10
  14. package/dist/{chunk-EIMVLWB3.js → chunk-34BHNEE3.js} +7 -3
  15. package/dist/{chunk-GIZNH63R.js → chunk-35MSIRKH.js} +9 -4
  16. package/dist/chunk-3EBYEESD.js +314 -0
  17. package/dist/{chunk-CTJ4RNAA.js → chunk-3F7VUY77.js} +2 -2
  18. package/dist/{chunk-AP73CFDC.js → chunk-3KIPBMUA.js} +2 -2
  19. package/dist/{chunk-J5LZHVIT.js → chunk-3M6DQK6S.js} +113 -35
  20. package/dist/{chunk-VEGN6WIQ.js → chunk-462T4EGZ.js} +2 -2
  21. package/dist/{chunk-AFKWHWXF.js → chunk-4JDLP6ZS.js} +33 -16
  22. package/dist/{chunk-6FN3E6KX.js → chunk-4O6MANBS.js} +2 -2
  23. package/dist/{chunk-AKB4GYDL.js → chunk-54ODD65L.js} +5 -5
  24. package/dist/{chunk-BBTJOK6Y.js → chunk-5KW52TEP.js} +3 -3
  25. package/dist/{chunk-6CCS4G3W.js → chunk-5PFYMY2V.js} +2 -2
  26. package/dist/chunk-77QIVUZB.js +1334 -0
  27. package/dist/{chunk-7OBGU7UB.js → chunk-7BHIY2MW.js} +7 -13
  28. package/dist/{chunk-3QSOM6PA.js → chunk-AZ4WMN4W.js} +2 -2
  29. package/dist/{chunk-6NJQITNH.js → chunk-B74PXLU7.js} +6 -3
  30. package/dist/{chunk-R23Z6K6I.js → chunk-B7HM5Z7T.js} +15 -15
  31. package/dist/{chunk-R32CLGZ6.js → chunk-BO7Y52RY.js} +81 -20
  32. package/dist/{chunk-UEDMSP56.js → chunk-BYMNWQ7O.js} +123 -148
  33. package/dist/{chunk-ZJLUDYFY.js → chunk-CRFOIAX3.js} +4 -4
  34. package/dist/{chunk-2NM363SV.js → chunk-CYZW7JHJ.js} +7 -7
  35. package/dist/{chunk-6HMJX2VU.js → chunk-DYHAXKHD.js} +38 -10
  36. package/dist/{chunk-THYWACCR.js → chunk-DZAW46HP.js} +3 -3
  37. package/dist/{chunk-FYUN5KZ3.js → chunk-DZEK6CJN.js} +17 -17
  38. package/dist/{chunk-3I5NY75V.js → chunk-E7GT7O5N.js} +5 -5
  39. package/dist/{chunk-VKFQTNDV.js → chunk-F2I26BDK.js} +4 -4
  40. package/dist/{chunk-HLW2MRKE.js → chunk-F4EKGO4N.js} +3 -1
  41. package/dist/{chunk-IXJT6DCX.js → chunk-FVDGR2ZL.js} +3 -3
  42. package/dist/{chunk-TZSKNMZG.js → chunk-GTUD2WMY.js} +2 -1
  43. package/dist/{chunk-7EPLI7VL.js → chunk-HIICAHCJ.js} +2 -2
  44. package/dist/{chunk-E67WX76H.js → chunk-HKMD33FO.js} +29 -80
  45. package/dist/chunk-HLAFFSEK.js +360 -0
  46. package/dist/{chunk-UAPGZHYC.js → chunk-I64IFBLB.js} +9 -2
  47. package/dist/{chunk-XKA2ICR3.js → chunk-I66ZTYNP.js} +440 -175
  48. package/dist/{chunk-7PWAODYW.js → chunk-I7XBWTYH.js} +2 -2
  49. package/dist/{chunk-PVAMAVBB.js → chunk-IDNA72AH.js} +102 -2
  50. package/dist/{chunk-GCSMB2KY.js → chunk-IKOZFYBN.js} +1 -1
  51. package/dist/{chunk-2VG7KLYV.js → chunk-IKSLQ4XV.js} +5460 -3241
  52. package/dist/{chunk-QKIFBZKT.js → chunk-IMXMHHMQ.js} +166 -25
  53. package/dist/{chunk-74YWRRU5.js → chunk-JBCS7CRR.js} +2 -2
  54. package/dist/{chunk-BDPT6GTK.js → chunk-JWJGP5DQ.js} +2 -2
  55. package/dist/{chunk-K6BF4U2H.js → chunk-KKOJXO6R.js} +62 -14
  56. package/dist/chunk-KPXDY6QF.js +47 -0
  57. package/dist/{chunk-ABLSQ6JX.js → chunk-LJID3DYZ.js} +7 -1
  58. package/dist/{chunk-VKRH2TCS.js → chunk-M2DAX4F6.js} +2 -2
  59. package/dist/{chunk-6I5ILFOF.js → chunk-M2WXEHER.js} +2 -2
  60. package/dist/{chunk-YPI3QQCF.js → chunk-MCEPRMZW.js} +2 -4
  61. package/dist/{chunk-N5UK64DP.js → chunk-MCMZMDAC.js} +2 -2
  62. package/dist/{chunk-Y4CAGMM6.js → chunk-MNJGS2IN.js} +5 -6
  63. package/dist/{chunk-TVHHYFHE.js → chunk-NEDJ26B5.js} +2 -2
  64. package/dist/{chunk-U2WB7TZS.js → chunk-NMJXSHBJ.js} +97 -85
  65. package/dist/{chunk-HUAS7ITX.js → chunk-O3YUNJZ2.js} +13 -21
  66. package/dist/{chunk-MA3H6DM5.js → chunk-P75RZCJW.js} +25 -3
  67. package/dist/{chunk-IG7BCQBA.js → chunk-PGF63K6I.js} +2 -2
  68. package/dist/chunk-PJX3WQUQ.js +42 -0
  69. package/dist/{chunk-6DWBAZ5U.js → chunk-Q4XWMHX6.js} +4 -6
  70. package/dist/{chunk-OJTRZGR3.js → chunk-QQLGQY2A.js} +8 -8
  71. package/dist/{chunk-J4HBWF6Y.js → chunk-RLYRBIYQ.js} +115 -20
  72. package/dist/{chunk-NLFAQR7Z.js → chunk-S66XZJOF.js} +3 -23
  73. package/dist/{chunk-C537JADH.js → chunk-SSEYRH53.js} +6 -7
  74. package/dist/chunk-SZAA6XDG.js +30 -0
  75. package/dist/{chunk-MOPSG2X7.js → chunk-TPEQIQIE.js} +6 -6
  76. package/dist/{chunk-JA5QWE4Z.js → chunk-UBRFI4HS.js} +1879 -1650
  77. package/dist/{chunk-BTGG6BG2.js → chunk-UH347SHR.js} +154 -15
  78. package/dist/{chunk-5YHDIDBP.js → chunk-UH632ZYL.js} +2 -2
  79. package/dist/{chunk-BWW4HLO4.js → chunk-UXCU4E3T.js} +8 -6
  80. package/dist/{chunk-6VC4OV3Z.js → chunk-VIA6RFQZ.js} +3 -11
  81. package/dist/{chunk-ZAZB4JMW.js → chunk-VKPAQYEB.js} +27 -8
  82. package/dist/{chunk-UXN6JT4W.js → chunk-W4YEMFBX.js} +2 -2
  83. package/dist/{chunk-TD3PGPQA.js → chunk-W6NIE6OW.js} +2 -2
  84. package/dist/{chunk-TVH4ONAM.js → chunk-X7IARSHT.js} +3 -3
  85. package/dist/{chunk-PJJ6MY27.js → chunk-XE3PCIXH.js} +3 -3
  86. package/dist/{chunk-FEFIFZTL.js → chunk-XGDPUNND.js} +2 -2
  87. package/dist/{chunk-SCYB3HA4.js → chunk-XOXV5GKE.js} +51 -16
  88. package/dist/{chunk-QTFGO774.js → chunk-XQRY4DTA.js} +24 -11
  89. package/dist/{chunk-BJGUKIG4.js → chunk-YJISEZKC.js} +2 -2
  90. package/dist/{chunk-GPPB3JBE.js → chunk-ZGNYYXQ6.js} +2 -2
  91. package/dist/{chunk-SINK3QR6.js → chunk-ZNT2M6TG.js} +7 -7
  92. package/dist/{chunk-7RY5VZPH.js → chunk-ZW4HH5JJ.js} +6 -6
  93. package/dist/cli/index.js +33 -32
  94. package/dist/{clio-IT3G3VQH.js → clio-7VB377CC.js} +7 -7
  95. package/dist/{code-nav-RK6S7F6E.js → code-nav-YVLCYA7V.js} +85 -17
  96. package/dist/{config-3QZRWZJF.js → config-4HVOS65E.js} +88 -43
  97. package/dist/{configure-FL7Y3KJF.js → configure-PIWO7B24.js} +10 -10
  98. package/dist/{context-5HE7ODYK.js → context-IYEHL3WQ.js} +33 -31
  99. package/dist/{context-XNHL75JV.js → context-KQYIWPWT.js} +47 -34
  100. package/dist/{context-KYQFRVDC.js → context-N6ZE3LGJ.js} +11 -11
  101. package/dist/{context-clear-N545L53A.js → context-clear-G4OGZJDS.js} +33 -31
  102. package/dist/{context-working-set-QHKXSV2F.js → context-working-set-BWLF6LJP.js} +7 -7
  103. package/dist/{dispatch-runner-RGIE5PCT.js → dispatch-runner-2QQAITS3.js} +38 -38
  104. package/dist/{docs-5NAF6AU7.js → docs-PD3EXDKU.js} +21 -20
  105. package/dist/{doctor-ZGPEGHIP.js → doctor-LHBD36VU.js} +23 -22
  106. package/dist/{eval-GXLL44RD.js → eval-C45FYRJ6.js} +21 -20
  107. package/dist/{eval-inventory-HBWSWQOK.js → eval-inventory-6DEJPLBF.js} +2 -2
  108. package/dist/{evidence-HWLBRH3Q.js → evidence-6SHONYAF.js} +30 -28
  109. package/dist/{evolve-FTZBMNVW.js → evolve-KRKMV72X.js} +30 -28
  110. package/dist/{extensions-VHRBEID7.js → extensions-KPZ2UHBB.js} +5 -3
  111. package/dist/{fleet-CKZHJWZJ.js → fleet-IVTCKDHT.js} +62 -61
  112. package/dist/{fleet-commands-EXDXBMV6.js → fleet-commands-EDWL3IT7.js} +5 -5
  113. package/dist/{fleet-decisions-OTHB6KRL.js → fleet-decisions-YP3YEFGK.js} +4 -4
  114. package/dist/{fleet-graph-YTEZUCUT.js → fleet-graph-ZFWKHY2M.js} +16 -14
  115. package/dist/{fleet-inspect-SS6YMDCK.js → fleet-inspect-FVUNCBML.js} +31 -29
  116. package/dist/{fleet-preflight-PBY4VYOM.js → fleet-preflight-UN5XED4R.js} +2 -2
  117. package/dist/{fleet-validate-KMEM5L3S.js → fleet-validate-XOWC4HSX.js} +17 -15
  118. package/dist/{fleet-verify-QD5M7E7Q.js → fleet-verify-UN3SODEL.js} +30 -28
  119. package/dist/{fleet-view-WAMJYNDT.js → fleet-view-TWHJKCN6.js} +31 -29
  120. package/dist/{init-5XQRBOFV.js → init-T2QORQ3Y.js} +50 -49
  121. package/dist/{interop-34TVO25M.js → interop-IN5I2A66.js} +5 -5
  122. package/dist/{library-3QY6KF57.js → library-LSCATDLZ.js} +15 -13
  123. package/dist/{memory-L4UTIIIW.js → memory-HYOKAGGJ.js} +31 -29
  124. package/dist/{models-ZVX3QOWE.js → models-2GPMFYCM.js} +22 -21
  125. package/dist/{monitor-CEKVSYTS.js → monitor-E4ASVUJH.js} +34 -32
  126. package/dist/{orchestrator-77BAP6BC.js → orchestrator-DDMPR3PY.js} +984 -583
  127. package/dist/{panes-7STHOAUJ.js → panes-E3RUXOW5.js} +4 -4
  128. package/dist/{panes-SHAUIRXY.js → panes-IXKLOKA2.js} +23 -8
  129. package/dist/{reset-EOLM7GVE.js → reset-OAQP3W4O.js} +4 -4
  130. package/dist/{resources-74GKTLSF.js → resources-OTRSN34L.js} +15 -13
  131. package/dist/{run-HBAUJNNZ.js → run-5DEYH5QK.js} +60 -59
  132. package/dist/{share-G3APVLVP.js → share-IHWTLO3M.js} +19 -15
  133. package/dist/{skills-35HHUKCR.js → skills-IYMXMKW4.js} +17 -15
  134. package/dist/{skills-eval-QN4HSHDC.js → skills-eval-DROHSJAR.js} +36 -36
  135. package/dist/{skills-inventory-J357J34F.js → skills-inventory-D7X4L4ZX.js} +15 -13
  136. package/dist/{slash-commands-JZZCQA32.js → slash-commands-QBM7UZ3B.js} +21 -18
  137. package/dist/{steer-XAVHJM22.js → steer-Z5DO23FJ.js} +2 -2
  138. package/dist/{targets-DSM6CY3M.js → targets-P2FUC4IL.js} +25 -28
  139. package/dist/{terminal-lease-JOPFUVEM.js → terminal-lease-YREJ3JX2.js} +5 -5
  140. package/dist/{tools-MKNWVPBH.js → tools-5B7RO6MV.js} +4 -4
  141. package/dist/{trace-ECQ7TIYZ.js → trace-YMGMUM6A.js} +55 -7
  142. package/dist/{upgrade-H7TOM7YL.js → upgrade-PXK3S2YM.js} +11 -9
  143. package/dist/{usage-X52N3IDJ.js → usage-ME5MPXGX.js} +36 -34
  144. package/dist/{verifiers-EJTVVSMA.js → verifiers-BVZ7IWOO.js} +5 -5
  145. package/dist/{verify-YJL6XET2.js → verify-5K7ZKQFC.js} +4 -4
  146. package/dist/{web-fetch-MPIFL3LL.js → web-fetch-MPARV2K7.js} +2 -2
  147. package/dist/{wiki-generate-4NDZTQ4B.js → wiki-generate-F5W5QTYY.js} +48 -47
  148. package/dist/{with-panes-OBOBFIIR.js → with-panes-BYOJCLAM.js} +51 -255
  149. package/dist/worker/entry.js +45 -30
  150. package/docs/README.md +176 -81
  151. package/docs/{acp.md → architecture/acp.md} +36 -20
  152. package/docs/{alcf-provider.md → architecture/alcf-provider.md} +8 -5
  153. package/docs/{architecture.md → architecture/architecture.md} +43 -22
  154. package/docs/{artifact-placement.md → architecture/artifact-placement.md} +26 -23
  155. package/docs/architecture/artifact-versions.md +90 -0
  156. package/docs/{capacity-and-scheduling.md → architecture/capacity-and-scheduling.md} +26 -13
  157. package/docs/{context-engine.md → architecture/context-engine.md} +25 -25
  158. package/docs/{context-working-set.md → architecture/context-working-set.md} +13 -10
  159. package/docs/{dispatch-architecture-rationale.md → architecture/dispatch-architecture-rationale.md} +12 -9
  160. package/docs/{dispatch-typed-intent.md → architecture/dispatch-typed-intent.md} +68 -46
  161. package/docs/{evidence-and-memory.md → architecture/evidence-and-memory.md} +23 -16
  162. package/docs/{middleware-and-components.md → architecture/middleware-and-components.md} +11 -5
  163. package/docs/{model-catalog.md → architecture/model-catalog.md} +40 -17
  164. package/docs/{observability.md → architecture/observability.md} +26 -13
  165. package/docs/{pi-boundary.md → architecture/pi-boundary.md} +24 -11
  166. package/docs/{prompt-envelope-and-tools.md → architecture/prompt-envelope-and-tools.md} +55 -20
  167. package/docs/{provider-adapter-cookbook.md → architecture/provider-adapter-cookbook.md} +35 -24
  168. package/docs/{safety-model.md → architecture/safety-model.md} +20 -15
  169. package/docs/{session-lifecycle.md → architecture/session-lifecycle.md} +8 -5
  170. package/docs/architecture/time-conventions.md +125 -0
  171. package/docs/{trace-store.md → architecture/trace-store.md} +13 -5
  172. package/docs/{tui-design.md → architecture/tui-design.md} +13 -13
  173. package/docs/{worker-dispatch-mechanics.md → architecture/worker-dispatch-mechanics.md} +27 -30
  174. package/docs/{built-in-agents.md → guide/built-in-agents.md} +50 -34
  175. package/docs/{commands-and-modes.md → guide/commands-and-modes.md} +65 -60
  176. package/docs/{configuration-and-targets.md → guide/configuration-and-targets.md} +227 -289
  177. package/docs/guide/configuration-reference.md +1158 -0
  178. package/docs/{environment-variables.md → guide/environment-variables.md} +31 -28
  179. package/docs/{exit-codes-and-output.md → guide/exit-codes-and-output.md} +6 -3
  180. package/docs/{extensions-and-sharing.md → guide/extensions-and-sharing.md} +41 -14
  181. package/docs/{fleet-dispatch.md → guide/fleet-dispatch.md} +39 -43
  182. package/docs/{glossary.md → guide/glossary.md} +14 -11
  183. package/docs/{installation-and-lifecycle.md → guide/installation-and-lifecycle.md} +44 -13
  184. package/docs/guide/panes-and-files.md +290 -0
  185. package/docs/{proactive-memory.md → guide/proactive-memory.md} +79 -66
  186. package/docs/{resource-library.md → guide/resource-library.md} +13 -4
  187. package/docs/{skills-marketplace.md → guide/skills-marketplace.md} +7 -3
  188. package/docs/{tool-usage.md → guide/tool-usage.md} +87 -23
  189. package/docs/{troubleshooting.md → guide/troubleshooting.md} +9 -4
  190. package/docs/{config-knobs-audit.md → history/config-knobs-audit.md} +11 -11
  191. package/docs/{release-cut-checklist.md → history/release-cut-checklist.md} +29 -2
  192. package/docs/{development-pipeline.md → process/development-pipeline.md} +24 -26
  193. package/docs/process/documentation-coverage.md +100 -0
  194. package/docs/process/documentation-guide.md +187 -0
  195. package/docs/{eval-runner.md → process/eval-runner.md} +41 -50
  196. package/docs/{evals-internal.md → process/evals-internal.md} +10 -10
  197. package/docs/{evolution.md → process/evolution.md} +2 -2
  198. package/docs/{fleet-demo-runbook.md → process/fleet-demo-runbook.md} +11 -7
  199. package/docs/{git-commit-provenance.md → process/git-commit-provenance.md} +11 -4
  200. package/docs/{performance-methodology.md → process/performance-methodology.md} +87 -69
  201. package/docs/{scientific-validation.md → process/scientific-validation.md} +4 -4
  202. package/evals/README.md +2 -2
  203. package/package.json +9 -7
  204. package/skills/README.md +46 -37
  205. package/skills/coding/ast-grep/SKILL.md +2 -2
  206. package/skills/coding/coding-standards/SKILL.md +2 -2
  207. package/skills/coding/prototype/SKILL.md +2 -2
  208. package/skills/coding/tdd/SKILL.md +2 -2
  209. package/skills/context/context-handoff/SKILL.md +2 -2
  210. package/skills/context/context-prime/SKILL.md +2 -2
  211. package/skills/git/file-ticket/SKILL.md +2 -2
  212. package/skills/git/fix-issue/SKILL.md +3 -3
  213. package/skills/git/resolve-merge-conflicts/SKILL.md +2 -2
  214. package/skills/git/ship/SKILL.md +2 -2
  215. package/skills/git/worktree-create/SKILL.md +2 -2
  216. package/skills/git/worktree-merge/SKILL.md +2 -2
  217. package/skills/meta/clio-coder-dev/SKILL.md +9 -5
  218. package/skills/meta/clio-coder-dev/evals.md +3 -2
  219. package/skills/meta/clio-coder-test/SKILL.md +102 -95
  220. package/skills/meta/clio-coder-test/evals.md +9 -4
  221. package/skills/meta/clio-coder-test/references/harness.md +100 -124
  222. package/skills/meta/clio-coder-test/references/test-map.md +77 -50
  223. package/skills/meta/credentials/SKILL.md +2 -2
  224. package/skills/meta/find-skills/SKILL.md +2 -2
  225. package/skills/meta/herdr/SKILL.md +2 -2
  226. package/skills/meta/skill-craft/SKILL.md +22 -16
  227. package/skills/planning/architecture/SKILL.md +2 -2
  228. package/skills/planning/backlog/SKILL.md +2 -2
  229. package/skills/planning/prd/SKILL.md +2 -2
  230. package/skills/planning/product-intent/SKILL.md +2 -2
  231. package/skills/planning/tech-spec/SKILL.md +2 -2
  232. package/skills/registry.yaml +62 -62
  233. package/skills/research/arxiv-literature/SKILL.md +2 -2
  234. package/skills/research/experiment-protocol/SKILL.md +2 -2
  235. package/skills/research/scientific-debugging/SKILL.md +2 -2
  236. package/skills/research/scientific-modernization/SKILL.md +2 -2
  237. package/skills/skill-marketplace.json +62 -62
  238. package/skills/workflow/cut-it/SKILL.md +2 -2
  239. package/skills/workflow/design-council/SKILL.md +2 -2
  240. package/skills/workflow/grill-me/SKILL.md +2 -2
  241. package/skills/workflow/workflow-distiller/SKILL.md +2 -2
  242. package/src/cli/args.ts +2 -2
  243. package/src/cli/bootstrap-generate.ts +1 -1
  244. package/src/cli/config-inspect.ts +65 -12
  245. package/src/cli/configure.ts +0 -4
  246. package/src/cli/docs.ts +22 -14
  247. package/src/cli/doctor-naming.ts +5 -5
  248. package/src/cli/doctor-toolchain.ts +3 -3
  249. package/src/cli/eval.ts +1 -2
  250. package/src/cli/extensions.ts +2 -1
  251. package/src/cli/fleet.ts +1 -1
  252. package/src/cli/index.ts +2 -1
  253. package/src/cli/internal-dispatch.ts +3 -4
  254. package/src/cli/panes.ts +19 -5
  255. package/src/cli/run.ts +2 -2
  256. package/src/cli/share.ts +5 -1
  257. package/src/cli/skills-eval.ts +3 -3
  258. package/src/cli/targets.ts +2 -6
  259. package/src/cli/trace.ts +55 -4
  260. package/src/cli/wiki-generate.ts +1 -1
  261. package/src/core/artifact-paths.ts +1 -1
  262. package/src/core/bash-exec.ts +131 -86
  263. package/src/core/bus-events.ts +51 -6
  264. package/src/core/config.ts +5 -1
  265. package/src/core/defaults.ts +7 -4
  266. package/src/core/dispatch-outcome.ts +16 -0
  267. package/src/core/guardrails.ts +10 -49
  268. package/src/core/prompt-hint.ts +9 -0
  269. package/src/domains/agents/builtins/architect.md +2 -3
  270. package/src/domains/agents/builtins/coder.md +3 -2
  271. package/src/domains/agents/builtins/debugger.md +2 -2
  272. package/src/domains/agents/builtins/documenter.md +2 -2
  273. package/src/domains/agents/builtins/git-master.md +1 -1
  274. package/src/domains/agents/builtins/oracle.md +1 -1
  275. package/src/domains/agents/builtins/provenance.md +1 -1
  276. package/src/domains/agents/builtins/researcher.md +1 -1
  277. package/src/domains/agents/builtins/scout.md +1 -1
  278. package/src/domains/agents/builtins/tester.md +2 -2
  279. package/src/domains/agents/builtins/verifier.md +2 -2
  280. package/src/domains/agents/builtins/wiki-writer.md +1 -1
  281. package/src/domains/agents/catalog.ts +12 -14
  282. package/src/domains/agents/contract.ts +2 -0
  283. package/src/domains/agents/extension.ts +23 -1
  284. package/src/domains/config/keybindings.ts +8 -0
  285. package/src/domains/context/extension.ts +0 -3
  286. package/src/domains/context/working-set/path-index.ts +1 -0
  287. package/src/domains/dispatch/capability-match.ts +10 -0
  288. package/src/domains/dispatch/extension.ts +105 -22
  289. package/src/domains/dispatch/host-verification.ts +435 -39
  290. package/src/domains/dispatch/intent-requirements.ts +10 -0
  291. package/src/domains/dispatch/intent.ts +18 -1
  292. package/src/domains/dispatch/path-scope.ts +235 -24
  293. package/src/domains/dispatch/run-event-journal.ts +4 -15
  294. package/src/domains/dispatch/state.ts +2 -3
  295. package/src/domains/dispatch/transport.ts +45 -21
  296. package/src/domains/dispatch/types.ts +55 -3
  297. package/src/domains/eval/artifacts/store.ts +5 -0
  298. package/src/domains/eval/store.ts +8 -1
  299. package/src/domains/evidence/trust-status.ts +10 -1
  300. package/src/domains/extensions/contract.ts +15 -1
  301. package/src/domains/extensions/discovery.ts +238 -41
  302. package/src/domains/extensions/extension.ts +105 -6
  303. package/src/domains/extensions/index.ts +24 -0
  304. package/src/domains/extensions/integrity.ts +189 -0
  305. package/src/domains/extensions/manager.ts +17 -1
  306. package/src/domains/extensions/resource-path.ts +27 -0
  307. package/src/domains/extensions/resources.ts +18 -38
  308. package/src/domains/extensions/snapshot-store.ts +39 -0
  309. package/src/domains/extensions/snapshot.ts +180 -0
  310. package/src/domains/extensions/state.ts +385 -57
  311. package/src/domains/extensions/types.ts +118 -1
  312. package/src/domains/lifecycle/migrations/2026-09-01-extension-install-digests.ts +27 -0
  313. package/src/domains/lifecycle/migrations/index.ts +2 -0
  314. package/src/domains/lifecycle/naming-resources.ts +19 -4
  315. package/src/domains/lifecycle/naming-yazi.ts +10 -5
  316. package/src/domains/middleware/contract.ts +26 -0
  317. package/src/domains/middleware/extension.ts +24 -24
  318. package/src/domains/middleware/hook-receipts.ts +27 -4
  319. package/src/domains/middleware/hooks-io.ts +65 -32
  320. package/src/domains/middleware/hooks.ts +64 -0
  321. package/src/domains/middleware/index.ts +28 -4
  322. package/src/domains/middleware/registrations.ts +326 -0
  323. package/src/domains/middleware/runtime.ts +28 -0
  324. package/src/domains/middleware/snapshot.ts +20 -7
  325. package/src/domains/mux/contract.ts +38 -0
  326. package/src/domains/mux/detect.ts +6 -13
  327. package/src/domains/mux/index.ts +1 -1
  328. package/src/domains/mux/operations.ts +44 -5
  329. package/src/domains/mux/yazi/assets/yazi.toml +2 -2
  330. package/src/domains/mux/yazi/session.ts +53 -4
  331. package/src/domains/mux/yazi/theme.ts +117 -17
  332. package/src/domains/observability/contract.ts +10 -11
  333. package/src/domains/observability/extension.ts +11 -3
  334. package/src/domains/observability/projection.ts +14 -90
  335. package/src/domains/observability/trace-store.ts +43 -7
  336. package/src/domains/prompts/compiler.ts +73 -53
  337. package/src/domains/prompts/contract.ts +15 -3
  338. package/src/domains/prompts/extension.ts +97 -9
  339. package/src/domains/prompts/fragments/identity/clio-worker.md +1 -3
  340. package/src/domains/prompts/fragments/identity/clio.md +6 -12
  341. package/src/domains/prompts/fragments/identity/docs-routing.md +1 -2
  342. package/src/domains/prompts/fragments/identity/self-awareness.md +3 -11
  343. package/src/domains/prompts/fragments/operating/contract.md +7 -15
  344. package/src/domains/prompts/fragments/operating/delegation.md +32 -34
  345. package/src/domains/prompts/fragments/operating/skills.md +10 -24
  346. package/src/domains/prompts/fragments/operating/worker.md +1 -8
  347. package/src/domains/providers/index.ts +1 -1
  348. package/src/domains/providers/model-runtime-capabilities.ts +85 -21
  349. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +669 -104
  350. package/src/domains/providers/runtime-resolution.ts +31 -0
  351. package/src/domains/providers/runtimes/common/probe-helpers.ts +7 -2
  352. package/src/domains/providers/runtimes/local-native/llamacpp.ts +9 -1
  353. package/src/domains/providers/types/cost-provenance.ts +19 -0
  354. package/src/domains/providers/types/local-model-quirks.ts +85 -37
  355. package/src/domains/resources/skills/loader.ts +16 -19
  356. package/src/domains/safety/call-target.ts +1 -1
  357. package/src/domains/safety/loop-detector.ts +7 -4
  358. package/src/domains/session/task-board.ts +10 -9
  359. package/src/domains/share/archive.ts +164 -7
  360. package/src/engine/acp/server.ts +62 -9
  361. package/src/engine/apis/llamacpp-residency.ts +3 -4
  362. package/src/engine/apis/lmstudio.ts +3 -3
  363. package/src/engine/apis/ollama-native.ts +6 -6
  364. package/src/engine/apis/openai-completions.ts +28 -25
  365. package/src/engine/apis/output-budget.ts +8 -18
  366. package/src/engine/apis/residency.ts +8 -27
  367. package/src/engine/gemma-channel-filter.ts +19 -0
  368. package/src/engine/loop-guard.ts +92 -12
  369. package/src/engine/worker-runtime.ts +40 -11
  370. package/src/engine/worker-tools.ts +3 -1
  371. package/src/entry/extension-hook-sources.ts +28 -0
  372. package/src/entry/extension-reload.ts +309 -0
  373. package/src/entry/orchestrator.ts +59 -35
  374. package/src/interactive/application-controller.ts +2 -1
  375. package/src/interactive/bus-notices.ts +8 -1
  376. package/src/interactive/chat-loop-messages.ts +3 -13
  377. package/src/interactive/chat-loop.ts +10 -1
  378. package/src/interactive/chat-panel.ts +36 -13
  379. package/src/interactive/chat-renderer.ts +71 -7
  380. package/src/interactive/dispatch-board.ts +6 -11
  381. package/src/interactive/footer/widgets.ts +13 -0
  382. package/src/interactive/interactive-application.ts +39 -4
  383. package/src/interactive/interactive-input-runtime.ts +4 -0
  384. package/src/interactive/interactive-presentation.ts +2 -2
  385. package/src/interactive/interactive-slash-runtime.ts +2 -0
  386. package/src/interactive/overlays/extensions.ts +9 -1
  387. package/src/interactive/overlays/help-reference.ts +13 -0
  388. package/src/interactive/overlays/settings.ts +27 -16
  389. package/src/interactive/panes-runtime.ts +111 -35
  390. package/src/interactive/prompt-cache-identity.ts +88 -0
  391. package/src/interactive/slash-commands.ts +129 -14
  392. package/src/interactive/stream-pacing-policy.ts +0 -23
  393. package/src/interactive/turn-context.ts +30 -15
  394. package/src/interactive/yazi-bridge.ts +60 -6
  395. package/src/tools/agent-tools.ts +30 -1
  396. package/src/tools/artifact.ts +2 -2
  397. package/src/tools/ask-user.ts +3 -3
  398. package/src/tools/bash.ts +1 -1
  399. package/src/tools/bootstrap.ts +4 -0
  400. package/src/tools/builtin-tool-catalog.ts +52 -22
  401. package/src/tools/codewiki/code-nav-surface.ts +6 -0
  402. package/src/tools/codewiki/code-nav.ts +99 -13
  403. package/src/tools/context/docs-engine.ts +20 -7
  404. package/src/tools/context/index.ts +29 -12
  405. package/src/tools/core-bootstrap.ts +28 -6
  406. package/src/tools/credential-present.ts +1 -2
  407. package/src/tools/dispatch-arguments.ts +5 -1
  408. package/src/tools/dispatch-plan.ts +48 -4
  409. package/src/tools/dispatch-run-events.ts +1 -1
  410. package/src/tools/dispatch-schema.ts +338 -0
  411. package/src/tools/dispatch-types.ts +3 -0
  412. package/src/tools/dispatch.ts +9 -254
  413. package/src/tools/ledger.ts +3 -5
  414. package/src/tools/monitor-surface.ts +5 -13
  415. package/src/tools/observation.ts +4 -5
  416. package/src/tools/panes-surface.ts +4 -11
  417. package/src/tools/panes.ts +4 -2
  418. package/src/tools/policy.ts +15 -2
  419. package/src/tools/read.ts +5 -6
  420. package/src/tools/registry.ts +30 -7
  421. package/src/tools/result-shaping.ts +18 -14
  422. package/src/tools/steer-surface.ts +1 -1
  423. package/src/tools/tasks.ts +1 -1
  424. package/src/tools/truncate.ts +6 -5
  425. package/src/tools/verify/surface.ts +6 -12
  426. package/src/tools/web-fetch-surface.ts +1 -3
  427. package/dist/chunk-5QIAJV2D.js +0 -48
  428. package/dist/chunk-JZWT5J3Y.js +0 -814
  429. package/dist/chunk-K7VKOLQQ.js +0 -15
  430. package/dist/chunk-PMZCIOCJ.js +0 -25
  431. package/dist/chunk-SUW5DORT.js +0 -819
  432. package/dist/chunk-UOV2BYIW.js +0 -107
  433. package/dist/chunk-WR6U3OVP.js +0 -45
  434. package/docs/artifact-versions.md +0 -67
  435. package/docs/documentation-coverage.md +0 -46
  436. package/docs/documentation-guide.md +0 -167
  437. package/docs/time-conventions.md +0 -101
@@ -341,6 +341,8 @@ export interface TraceRunRow {
341
341
  ended_at: string | null;
342
342
  total_tokens: number | null;
343
343
  total_cost_usd: number | null;
344
+ /** 'dispatch' for a worker run, 'session' for an interactive chat-loop turn. */
345
+ source: "dispatch" | "session";
344
346
  }
345
347
 
346
348
  export interface TracePhaseRow {
@@ -423,7 +425,8 @@ CREATE TABLE runs (
423
425
  started_at TEXT NOT NULL,
424
426
  ended_at TEXT,
425
427
  total_tokens INTEGER,
426
- total_cost_usd REAL
428
+ total_cost_usd REAL,
429
+ source TEXT NOT NULL DEFAULT 'dispatch' CHECK(source IN ('dispatch','session'))
427
430
  );
428
431
 
429
432
  CREATE TABLE phases (
@@ -524,6 +527,23 @@ function ensureProcessOwnerColumns(db: DatabaseSync): void {
524
527
  db.exec("ALTER TABLE processes ADD COLUMN host TEXT; ALTER TABLE processes ADD COLUMN birth_token TEXT;");
525
528
  }
526
529
 
530
+ /**
531
+ * Additive discriminator between a dispatched run and an interactive session
532
+ * turn; older version-1 databases gain it in place. `runs`/`phases` held both
533
+ * kinds under one undocumented schema before this column existed, distinguishable
534
+ * only by the sentinel `assignment_id = SESSION_TRACE_ASSIGNMENT_ID` a session
535
+ * turn's row carries (recordSessionTurn's startSessionTurn) versus a real
536
+ * dispatch assignment id (upsertRun). The backfill reads that existing
537
+ * sentinel once; every row written after this migration sets `source`
538
+ * directly instead of relying on it.
539
+ */
540
+ function ensureRunSourceColumn(db: DatabaseSync): void {
541
+ const columns = db.prepare("PRAGMA table_info(runs)").all() as { name: string }[];
542
+ if (columns.some((column) => column.name === "source")) return;
543
+ db.exec("ALTER TABLE runs ADD COLUMN source TEXT NOT NULL DEFAULT 'dispatch';");
544
+ db.prepare("UPDATE runs SET source = 'session' WHERE assignment_id = ?").run(SESSION_TRACE_ASSIGNMENT_ID);
545
+ }
546
+
527
547
  /**
528
548
  * Finalize `running` rows whose recorded owner is on this host and provably
529
549
  * dead (pid gone, or alive under a different birth token, i.e. reused). Rows
@@ -570,6 +590,7 @@ export class TraceStore {
570
590
  else if (version !== TRACE_SCHEMA_VERSION) throw new TraceSchemaVersionError(version);
571
591
  this.transaction(() => {
572
592
  ensureProcessOwnerColumns(this.db);
593
+ ensureRunSourceColumn(this.db);
573
594
  reconcileAbandonedRuns(this.db);
574
595
  });
575
596
  }
@@ -673,8 +694,8 @@ export class TraceStore {
673
694
  this.transaction(() => {
674
695
  this.db
675
696
  .prepare(`INSERT INTO runs
676
- (run_id, assignment_id, request, status, agent, target, model, runtime, node, started_at)
677
- VALUES (?, ?, ?, 'queued', ?, ?, ?, ?, ?, ?)
697
+ (run_id, assignment_id, request, status, agent, target, model, runtime, node, started_at, source)
698
+ VALUES (?, ?, ?, 'queued', ?, ?, ?, ?, ?, ?, 'dispatch')
678
699
  ON CONFLICT(run_id) DO UPDATE SET request=excluded.request, agent=excluded.agent,
679
700
  target=excluded.target, model=excluded.model, runtime=excluded.runtime, node=excluded.node`)
680
701
  .run(
@@ -1046,8 +1067,8 @@ export class TraceStore {
1046
1067
  this.transaction(() => {
1047
1068
  this.db
1048
1069
  .prepare(`INSERT INTO runs
1049
- (run_id, assignment_id, request, status, agent, target, model, runtime, node, started_at)
1050
- VALUES (?, ?, ?, 'running', ?, ?, ?, ?, NULL, ?)
1070
+ (run_id, assignment_id, request, status, agent, target, model, runtime, node, started_at, source)
1071
+ VALUES (?, ?, ?, 'running', ?, ?, ?, ?, NULL, ?, 'session')
1051
1072
  ON CONFLICT(run_id) DO NOTHING`)
1052
1073
  .run(
1053
1074
  input.runId,
@@ -1167,6 +1188,15 @@ function traceDatabaseFootprintBytes(path: string): number {
1167
1188
 
1168
1189
  export class TraceReader {
1169
1190
  readonly db: DatabaseSync;
1191
+ /**
1192
+ * `runs.source` is an additive column (see ensureRunSourceColumn) a
1193
+ * TraceStore writer backfills in place. A read-only reader can open a
1194
+ * database no writer has touched since before the column existed — the
1195
+ * trace viewer opening a dormant install's trace.sqlite fresh is the
1196
+ * realistic case — and cannot ALTER TABLE to fix that itself, so it
1197
+ * derives the same value the migration would have written instead.
1198
+ */
1199
+ private readonly runsSourceExpr: string;
1170
1200
 
1171
1201
  constructor(readonly path: string) {
1172
1202
  this.db = new (databaseSyncConstructor())(path, { readOnly: true });
@@ -1177,6 +1207,10 @@ export class TraceReader {
1177
1207
  const mode = this.db.prepare("PRAGMA journal_mode").get() as { journal_mode: string };
1178
1208
  if (mode.journal_mode.toLowerCase() !== "wal")
1179
1209
  throw new Error(`trace database journal mode is ${mode.journal_mode}, expected WAL`);
1210
+ const runColumns = this.db.prepare("PRAGMA table_info(runs)").all() as { name: string }[];
1211
+ this.runsSourceExpr = runColumns.some((column) => column.name === "source")
1212
+ ? "*"
1213
+ : `*, CASE WHEN assignment_id = '${SESSION_TRACE_ASSIGNMENT_ID}' THEN 'session' ELSE 'dispatch' END AS source`;
1180
1214
  }
1181
1215
 
1182
1216
  close(): void {
@@ -1185,13 +1219,15 @@ export class TraceReader {
1185
1219
 
1186
1220
  runs(limit = 50): TraceRunRow[] {
1187
1221
  return this.db
1188
- .prepare("SELECT * FROM runs ORDER BY started_at DESC LIMIT ?")
1222
+ .prepare(`SELECT ${this.runsSourceExpr} FROM runs ORDER BY started_at DESC LIMIT ?`)
1189
1223
  .all(clampInt(limit, 1, 500)) as unknown as TraceRunRow[];
1190
1224
  }
1191
1225
 
1192
1226
  run(runId: string): TraceRunRow | null {
1193
1227
  return (
1194
- (this.db.prepare("SELECT * FROM runs WHERE run_id=?").get(runId) as unknown as TraceRunRow | undefined) ?? null
1228
+ (this.db.prepare(`SELECT ${this.runsSourceExpr} FROM runs WHERE run_id=?`).get(runId) as unknown as
1229
+ | TraceRunRow
1230
+ | undefined) ?? null
1195
1231
  );
1196
1232
  }
1197
1233
 
@@ -1,6 +1,8 @@
1
1
  import { join } from "node:path";
2
2
  import { resolvePackageRoot } from "../../core/package-root.js";
3
+ import { normalizePromptHint } from "../../core/prompt-hint.js";
3
4
  import type { ToolName } from "../../core/tool-names.js";
5
+ import { resolveClioDirs } from "../../core/xdg.js";
4
6
  import type { AutonomyLevel } from "../safety/autonomy.js";
5
7
  import { ceilChars } from "../session/context-accounting.js";
6
8
  import type { FragmentTable, LoadedFragment } from "./fragment-loader.js";
@@ -147,13 +149,6 @@ export interface CompiledSessionPrompt {
147
149
  operatorProfileApplied?: boolean;
148
150
  }
149
151
 
150
- export const FLEET_ROUTING_GUIDANCE_MAX_BYTES = 320;
151
- // Points at the Fleet section rather than describing routing in the abstract:
152
- // `agent:"auto"` baselines by task shape and can still land on a worker whose
153
- // capability class is wrong for the job, so a pinned id is the reliable path.
154
- export const FLEET_ROUTING_GUIDANCE =
155
- 'Fleet routing: pin the `agent` id from the Fleet section; agent:"auto" baselines from the task text and is a fallback, not a router.';
156
-
157
152
  /**
158
153
  * Worker-side mirror of the parent's `SPOT_CHECK_GUIDANCE`. The parent sentence
159
154
  * demonstrably works: in the E19 drive it is what caught a verifier reporting a
@@ -234,7 +229,7 @@ function renderRuntimeBlock(inputs: SessionPromptInputs): string {
234
229
  */
235
230
  function sessionCanDispatch(inputs: SessionPromptInputs): boolean {
236
231
  if (inputs.providerSupportsTools === false) return false;
237
- return toolSurfaceHasTool(inputs.toolNames, inputs.toolPromptHints, "dispatch");
232
+ return toolSurfaceHasTool(inputs.toolNames, "dispatch");
238
233
  }
239
234
 
240
235
  /**
@@ -245,18 +240,38 @@ function sessionCanDispatch(inputs: SessionPromptInputs): boolean {
245
240
  */
246
241
  function sessionHasContext(inputs: SessionPromptInputs): boolean {
247
242
  if (inputs.providerSupportsTools === false) return false;
248
- return toolSurfaceHasTool(inputs.toolNames, inputs.toolPromptHints, "context");
243
+ return toolSurfaceHasTool(inputs.toolNames, "context");
249
244
  }
250
245
 
251
- /** One lookup for every "is this tool on the surface" predicate, over names and hints alike. */
252
- function toolSurfaceHasTool(
253
- toolNames: ReadonlyArray<string> | undefined,
254
- toolPromptHints: ReadonlyArray<ToolPromptHint> | undefined,
255
- tool: string,
256
- ): boolean {
246
+ /** Tool names come from attached schemas; hints never manufacture a surface. */
247
+ function toolSurfaceHasTool(toolNames: ReadonlyArray<string> | undefined, tool: string): boolean {
257
248
  const names = new Set((toolNames ?? []).map((name) => name.trim()));
258
- const hinted = new Set((toolPromptHints ?? []).map((entry) => entry.tool.trim()));
259
- return names.has(tool) || hinted.has(tool);
249
+ return names.has(tool);
250
+ }
251
+
252
+ /** Normalize, sort, and exact-deduplicate caller-provided tool guidance. */
253
+ function canonicalToolPromptHints(
254
+ entries: ReadonlyArray<ToolPromptHint>,
255
+ admitted: ReadonlySet<string>,
256
+ ): Array<{ tool: string; hint: string }> {
257
+ const normalized = entries
258
+ .map((entry) => ({
259
+ tool: entry.tool.trim(),
260
+ hint: normalizePromptHint(entry.hint) ?? "",
261
+ }))
262
+ .filter((entry) => admitted.has(entry.tool) && entry.hint.length > 0)
263
+ .sort((a, b) => {
264
+ if (a.tool !== b.tool) return a.tool < b.tool ? -1 : 1;
265
+ return a.hint < b.hint ? -1 : a.hint > b.hint ? 1 : 0;
266
+ });
267
+ const seenTools = new Set<string>();
268
+ const seenHints = new Set<string>();
269
+ return normalized.filter((entry) => {
270
+ if (seenTools.has(entry.tool) || seenHints.has(entry.hint)) return false;
271
+ seenTools.add(entry.tool);
272
+ seenHints.add(entry.hint);
273
+ return true;
274
+ });
260
275
  }
261
276
 
262
277
  function renderFleetBlock(inputs: SessionPromptInputs): string {
@@ -277,44 +292,55 @@ function renderToolContractBlock(inputs: SessionPromptInputs): string {
277
292
  ].sort();
278
293
  const canDispatch = sessionCanDispatch(inputs);
279
294
  const canListSkills = sessionHasContext(inputs);
295
+ // Asked twice in one session which tools it had, a live model gave two
296
+ // different answers and invented `web_find`. The authoritative list is one
297
+ // line above; pointing at it beats letting the model recall the schemas.
298
+ const admitted = new Set(names);
280
299
  const inventoryGuidance = [
281
- // Asked twice in one session which tools it had, a live model gave two
282
- // different answers and invented `web_find`. The authoritative list is one
283
- // line above; pointing at it beats letting the model recall the schemas.
284
- "When answering capability-inventory questions, copy the Direct tools line above verbatim rather than recalling the attached schemas, and make no calls",
285
- ...(canDispatch ? ["add dispatch(list:true) only if agents or the fleet are requested"] : []),
286
- ...(canListSkills
287
- ? ['add context(scope="skills") only if skills are requested (it lists installed and marketplace skills)']
300
+ "When asked what tools you have, copy the Direct tools line verbatim and call nothing",
301
+ ...(canDispatch
302
+ ? [
303
+ "dispatch(list:true) answers a question about agents, the fleet, or which target and model run this session and its workers",
304
+ ]
288
305
  : []),
306
+ ...(canListSkills ? ['context(scope="skills") answers only a question about skills'] : []),
289
307
  ].join("; ");
308
+ const capabilityKinds = [
309
+ "direct tools are attached schemas",
310
+ ...(canDispatch ? ["fleet agents are workers behind dispatch"] : []),
311
+ ...(canListSkills ? ["skills are operator-activated workflows reached through context"] : []),
312
+ ];
313
+ const orientationTools = ["context", "code_nav", "grep", "read"].filter((name) => admitted.has(name));
314
+ const validationTools = ["verify", "git"].filter((name) => admitted.has(name));
290
315
  const lines = [
291
316
  "# Tool Contract",
292
317
  "The attached schemas are the session's complete direct-tool surface; follow each schema exactly.",
293
318
  ...(names.length > 0 ? [`Direct tools: ${names.map((name) => `\`${name}\``).join(", ")}.`] : []),
294
- "Harness model: direct tools are attached schemas; fleet agents are workers behind dispatch; skills are operator-activated workflows reached through context. Keep these capability sets distinct.",
319
+ `Harness model: ${capabilityKinds.join("; ")}. Keep these capability sets distinct.`,
295
320
  `${inventoryGuidance}.`,
296
- "Call tools only for concrete inspection or changes the task requires. If the user asks for a tool-free answer, simply answer without calling tools.",
321
+ "Call tools only for concrete inspection or changes the task requires; a tool-free question gets a tool-free answer.",
297
322
  // The tool-specific instantiation of the operating contract's "narrow
298
323
  // work: inspect directly" rule; the contract cannot name tools.
299
324
  // Delegation, the tasks board, and skills are not restated here: the
300
- // Delegation and Skills passages and the registry hints carry them, and
301
- // each renders exactly when its tool does.
302
- 'For narrow file or symbol orientation, prefer context(scope="workspace"), code_nav, grep, and read instead of assuming source-tree details were preloaded.',
303
- "Validate with verify or git diff before final claims.",
304
- 'When a tool call fails or is rejected, do not retry the same shape blindly: re-read the schema, adjust the arguments, or query context(scope="docs") for that tool\'s usage.',
325
+ // Delegation, Fleet, and Skills passages and the registry hints carry
326
+ // them, and each renders exactly when its tool does.
327
+ ...(orientationTools.length > 0
328
+ ? [
329
+ `For narrow file or symbol orientation, prefer ${orientationTools.join(", ")} instead of assuming source-tree details were preloaded.`,
330
+ ]
331
+ : []),
332
+ ...(validationTools.length > 0
333
+ ? [
334
+ `Validate with ${validationTools.map((name) => (name === "git" ? "git diff" : name)).join(" or ")} before final claims.`,
335
+ ]
336
+ : []),
337
+ `When a tool call fails or is rejected, do not retry the same shape blindly: re-read the schema and adjust the arguments${canListSkills ? ', or query context(scope="docs") for that tool\'s usage' : ""}.`,
305
338
  ];
306
339
  // One hint per tool, sorted by tool name: deterministic bytes regardless
307
340
  // of surface or registration order, and removing a tool from the surface
308
341
  // removes its hint with no compiler edit.
309
- const seen = new Set<string>();
310
- const hints = [...(inputs.toolPromptHints ?? [])]
311
- .map((entry) => ({ tool: entry.tool.trim(), hint: entry.hint.trim() }))
312
- .filter((entry) => entry.tool.length > 0 && entry.hint.length > 0)
313
- .sort((a, b) => (a.tool < b.tool ? -1 : a.tool > b.tool ? 1 : 0));
314
- if (hints.some((entry) => entry.tool === "dispatch")) lines.push(FLEET_ROUTING_GUIDANCE);
342
+ const hints = canonicalToolPromptHints(inputs.toolPromptHints ?? [], new Set(names));
315
343
  for (const entry of hints) {
316
- if (seen.has(entry.tool)) continue;
317
- seen.add(entry.tool);
318
344
  lines.push(entry.hint);
319
345
  }
320
346
  return lines.join("\n");
@@ -381,18 +407,8 @@ function renderWorkerToolContractBlock(inputs: WorkerPromptInputs): string {
381
407
  "Tool authority is limited to this list. Persona and bound-skill instructions never add tools.",
382
408
  "Call tools only for concrete inspection or changes the assigned task requires. If the task requests an exact or tool-free response, answer without calling tools.",
383
409
  ];
384
- const admitted = new Set(names);
385
- const seen = new Set<string>();
386
- const hints = [...inputs.toolPromptHints]
387
- .map((entry) => ({ tool: entry.tool.trim(), hint: entry.hint.trim() }))
388
- .filter((entry) => admitted.has(entry.tool) && entry.hint.length > 0)
389
- .sort((a, b) => {
390
- if (a.tool !== b.tool) return a.tool < b.tool ? -1 : 1;
391
- return a.hint < b.hint ? -1 : a.hint > b.hint ? 1 : 0;
392
- });
410
+ const hints = canonicalToolPromptHints(inputs.toolPromptHints, new Set(names));
393
411
  for (const entry of hints) {
394
- if (seen.has(entry.tool)) continue;
395
- seen.add(entry.tool);
396
412
  lines.push(entry.hint);
397
413
  }
398
414
  return lines.join("\n");
@@ -439,8 +455,7 @@ function renderRetrievalHintsBlock(inputs: SessionPromptInputs): string {
439
455
  // preloaded.
440
456
  return [
441
457
  "# Retrieval Hints",
442
- "Compact CLIO-CODER.md project instructions may be preloaded above; everything else about the repository must be fetched, not assumed.",
443
- "Never invent file paths, automatic tool behavior, or mutable repo details from the system prompt.",
458
+ "Repository details not included above must be fetched, never invented; compact CLIO-CODER.md instructions may be preloaded.",
444
459
  ].join("\n");
445
460
  }
446
461
 
@@ -561,10 +576,15 @@ export function compile(table: FragmentTable, inputs: CompileInputs): CompiledSe
561
576
  const docsRouting = selfAwareness && sessionHasContext(session) ? table.byId.get("identity.docs-routing") : undefined;
562
577
  if (selfAwareness) {
563
578
  const packageRoot = resolvePackageRoot();
579
+ // The live home, not the XDG default: an isolated CLIO_CODER_HOME or a
580
+ // CLIO_CODER_CONFIG_DIR override moves the file the operator would edit.
581
+ const clioDirs = resolveClioDirs();
564
582
  const rendered = selfAwareness.body
565
583
  .replace("{CLIO_DOCS_PATH}", join(packageRoot, "docs"))
566
584
  .replace("{CLIO_SRC_PATH}", join(packageRoot, "src"))
567
- .replace("{CLIO_CODEWIKI_PATH}", join(packageRoot, "dist", "assets", "codewiki.json"));
585
+ .replace("{CLIO_CODEWIKI_PATH}", join(packageRoot, "dist", "assets", "codewiki.json"))
586
+ .replace("{CLIO_SETTINGS_PATH}", join(clioDirs.config, "settings.yaml"))
587
+ .replace("{CLIO_STATE_PATH}", clioDirs.state);
568
588
  identityBody = [identity.body.trim(), rendered.trim(), ...(docsRouting ? [docsRouting.body.trim()] : [])].join(
569
589
  "\n\n",
570
590
  );
@@ -1,6 +1,8 @@
1
1
  import type { CompiledSessionPrompt, SessionPromptInputs, WorkerPromptInputs } from "./compiler.js";
2
2
 
3
3
  export interface CompileSessionPromptInput {
4
+ /** Stable session identity that owns the compiler's frozen disk-input snapshot. */
5
+ sessionId: string;
4
6
  sessionInputs: SessionPromptInputs;
5
7
  autonomy?: string;
6
8
  cwd?: string;
@@ -23,11 +25,21 @@ export interface CompileWorkerPromptInput extends WorkerPromptInputs {
23
25
  }
24
26
 
25
27
  export interface PromptsContract {
28
+ /**
29
+ * Revision of compiler-owned inputs. Fragment, agent-catalog, and
30
+ * session-source invalidation components advance independently and are
31
+ * combined without loss. Project handbooks, rules, operator profile, and
32
+ * repo awareness are frozen in a real per-session snapshot until a config
33
+ * invalidation or a new session.
34
+ */
35
+ inputEpoch(): string;
36
+
26
37
  /**
27
38
  * Compile the session system prompt. Called once per session (and again
28
39
  * only on explicit, logged events: model/target change, autonomy-level
29
- * change, fragment reload, session switch). Inputs must be constant for
30
- * the session's lifetime.
40
+ * change, fragment reload, session switch). Compiler-owned disk inputs are
41
+ * selected from the session snapshot even when another identity input causes
42
+ * a recompile.
31
43
  */
32
44
  compileSessionPrompt(input: CompileSessionPromptInput): Promise<CompiledSessionPrompt>;
33
45
 
@@ -39,6 +51,6 @@ export interface PromptsContract {
39
51
  */
40
52
  compileWorkerPrompt(input: CompileWorkerPromptInput): Promise<CompiledSessionPrompt>;
41
53
 
42
- /** Reload fragment table (triggered by config.hotReload). */
54
+ /** Reload fragment table and advance `inputEpoch` after a successful load. */
43
55
  reload(): void;
44
56
  }
@@ -8,9 +8,11 @@ import type { AgentsContract } from "../agents/contract.js";
8
8
  import type { ConfigContract } from "../config/contract.js";
9
9
  import {
10
10
  type ContextContract,
11
+ type LoadedOperatorProfile,
11
12
  loadOperatorProfile,
12
13
  loadProjectRules,
13
14
  type ProjectPromptContext,
15
+ type ProjectRulesLoad,
14
16
  renderOperatorProfile,
15
17
  selectActiveRules,
16
18
  } from "../context/index.js";
@@ -28,11 +30,26 @@ export interface PromptsBundleOptions {
28
30
  const CLIO_REPO_AWARENESS_ID = "context.clio-repo-awareness";
29
31
  const WORKSPACE_ROOT_ID = "context.workspace-root";
30
32
 
33
+ interface CustomizationSourceSnapshot {
34
+ rules: ProjectRulesLoad["rules"];
35
+ operatorProfile: LoadedOperatorProfile | null;
36
+ }
37
+
38
+ interface SessionPromptSourceSnapshot {
39
+ projectContext: ProjectPromptContext | null;
40
+ customization: CustomizationSourceSnapshot;
41
+ workspaceRoot: RenderedPromptFragment[];
42
+ clioRepoAwareness: RenderedPromptFragment[];
43
+ }
44
+
31
45
  export function createPromptsBundle(
32
46
  context: DomainContext,
33
47
  options: PromptsBundleOptions = {},
34
48
  ): DomainBundle<PromptsContract> {
35
49
  let table: FragmentTable | null = null;
50
+ let fragmentEpoch = 0;
51
+ let sessionSourceEpoch = 0;
52
+ const sessionSourceSnapshots = new Map<string, SessionPromptSourceSnapshot>();
36
53
  const suppressContextFiles = options.noContextFiles === true;
37
54
 
38
55
  function config(): ConfigContract | undefined {
@@ -60,6 +77,7 @@ export function createPromptsBundle(
60
77
  function reload(): void {
61
78
  try {
62
79
  table = loadFragments();
80
+ fragmentEpoch += 1;
63
81
  } catch (err) {
64
82
  const msg = err instanceof Error ? err.message : String(err);
65
83
  process.stderr.write(`[clio-coder:prompts] reload failed: ${msg}\n`);
@@ -73,7 +91,42 @@ export function createPromptsBundle(
73
91
  return false;
74
92
  }
75
93
 
94
+ function sessionSourceKey(sessionId: string, cwd: string): string {
95
+ return `${sessionId}\0${cwd}`;
96
+ }
97
+
98
+ function captureSessionSourceSnapshot(cwd: string): SessionPromptSourceSnapshot {
99
+ let projectContext: ProjectPromptContext | null = null;
100
+ if (!suppressContextFiles) {
101
+ projectContext = contextDomain()?.renderPromptContext(cwd) ?? null;
102
+ for (const warning of projectContext?.warnings ?? []) process.stderr.write(`${warning}\n`);
103
+ }
104
+ return {
105
+ projectContext,
106
+ customization: captureCustomizationSources(cwd),
107
+ workspaceRoot: workspaceRootFragment(cwd),
108
+ clioRepoAwareness: clioRepoAwarenessFragments(cwd),
109
+ };
110
+ }
111
+
112
+ function sessionSourceSnapshot(sessionId: string, cwd: string): SessionPromptSourceSnapshot {
113
+ const key = sessionSourceKey(sessionId, cwd);
114
+ const existing = sessionSourceSnapshots.get(key);
115
+ if (existing) return existing;
116
+ const captured = captureSessionSourceSnapshot(cwd);
117
+ sessionSourceSnapshots.set(key, captured);
118
+ return captured;
119
+ }
120
+
121
+ function invalidateSessionSources(): void {
122
+ sessionSourceSnapshots.clear();
123
+ sessionSourceEpoch += 1;
124
+ }
125
+
76
126
  const contract: PromptsContract = {
127
+ inputEpoch() {
128
+ return `${fragmentEpoch}:${agentsDomain()?.revision() ?? 0}:${sessionSourceEpoch}`;
129
+ },
77
130
  async compileSessionPrompt(input: CompileSessionPromptInput) {
78
131
  if (!table) throw new Error("prompts domain not started");
79
132
  if (table.byId.size === 0) {
@@ -83,11 +136,12 @@ export function createPromptsBundle(
83
136
  const settings: Readonly<ClioSettings> | undefined = configContract?.get();
84
137
  const safety = input.autonomy ?? settings?.safety.autonomy ?? "auto-edit";
85
138
  const cwd = input.cwd ?? process.cwd();
139
+ const sources = sessionSourceSnapshot(input.sessionId, cwd);
86
140
  let contextFiles = "";
87
141
  let projectPreload: ProjectPreloadClass | null = null;
88
142
  let projectHandbookFiles: string[] = [];
89
143
  if (!suppressContextFiles) {
90
- const projectContext = contextDomain()?.renderPromptContext(cwd);
144
+ const projectContext = sources.projectContext;
91
145
  contextFiles = projectContext
92
146
  ? selectProjectContext(projectContext, input.sessionInputs.providerSupportsTools ?? null)
93
147
  : "";
@@ -98,7 +152,6 @@ export function createPromptsBundle(
98
152
  });
99
153
  projectHandbookFiles = projectContext.handbookFiles;
100
154
  }
101
- for (const warning of projectContext?.warnings ?? []) process.stderr.write(`${warning}\n`);
102
155
  }
103
156
  const roster = fleetRoster();
104
157
  const sessionInputs = {
@@ -112,9 +165,9 @@ export function createPromptsBundle(
112
165
  safety: `safety.${safety}`,
113
166
  sessionInputs,
114
167
  additionalFragments: [
115
- ...workspaceRootFragment(cwd),
116
- ...clioRepoAwarenessFragments(cwd),
117
- ...customizationFragments(cwd, input.workingContextPaths ?? []).fragments,
168
+ ...sources.workspaceRoot,
169
+ ...sources.clioRepoAwareness,
170
+ ...renderCustomizationFragments(sources.customization, cwd, input.workingContextPaths ?? []).fragments,
118
171
  ],
119
172
  });
120
173
  return { ...compiled, projectPreload, projectHandbookFiles };
@@ -141,25 +194,38 @@ export function createPromptsBundle(
141
194
  };
142
195
 
143
196
  let unsubscribeHotReload: (() => void) | null = null;
197
+ let unsubscribeExtensionsReload: (() => void) | null = null;
144
198
  const extension: DomainExtension = {
145
199
  async start() {
146
200
  try {
147
201
  table = loadFragments();
202
+ fragmentEpoch += 1;
148
203
  } catch (err) {
149
204
  const msg = err instanceof Error ? err.message : String(err);
150
205
  process.stderr.write(`[clio-coder:prompts] initial load failed: ${msg}\n`);
151
206
  table = { byId: new Map(), rootDir: "" };
152
207
  }
153
208
  unsubscribeHotReload = context.bus.on(BusChannels.ConfigHotReload, (payload: unknown) => {
209
+ invalidateSessionSources();
154
210
  const diff = (payload as { diff?: { hotReload?: string[] } } | undefined)?.diff;
155
211
  const paths = diff?.hotReload ?? [];
156
212
  if (!diffTouchesFragments(paths)) return;
157
213
  reload();
158
214
  });
215
+ // Extension prompt and skill roots feed fragments through the
216
+ // resources domain; a committed generation with new content means
217
+ // the table must be rebuilt from the new roots.
218
+ unsubscribeExtensionsReload = context.bus.on(BusChannels.ExtensionsReloaded, (payload: unknown) => {
219
+ if ((payload as { changed?: unknown } | undefined)?.changed !== true) return;
220
+ reload();
221
+ });
159
222
  },
160
223
  async stop() {
161
224
  unsubscribeHotReload?.();
162
225
  unsubscribeHotReload = null;
226
+ unsubscribeExtensionsReload?.();
227
+ unsubscribeExtensionsReload = null;
228
+ sessionSourceSnapshots.clear();
163
229
  },
164
230
  };
165
231
 
@@ -189,13 +255,36 @@ export interface CustomizationFragmentsResult {
189
255
  export function customizationFragments(
190
256
  cwd: string,
191
257
  workingContextPaths: ReadonlyArray<string>,
258
+ ): CustomizationFragmentsResult {
259
+ return renderCustomizationFragments(captureCustomizationSources(cwd), cwd, workingContextPaths);
260
+ }
261
+
262
+ function captureCustomizationSources(cwd: string): CustomizationSourceSnapshot {
263
+ let rules: ProjectRulesLoad["rules"] = [];
264
+ let operatorProfile: LoadedOperatorProfile | null = null;
265
+ try {
266
+ rules = loadProjectRules(cwd).rules;
267
+ } catch {
268
+ // Project rules are best-effort; a load failure freezes an empty set.
269
+ }
270
+ try {
271
+ operatorProfile = loadOperatorProfile(cwd);
272
+ } catch {
273
+ // The operator profile is best-effort; a load failure freezes no profile.
274
+ }
275
+ return { rules, operatorProfile };
276
+ }
277
+
278
+ function renderCustomizationFragments(
279
+ sources: CustomizationSourceSnapshot,
280
+ cwd: string,
281
+ workingContextPaths: ReadonlyArray<string>,
192
282
  ): CustomizationFragmentsResult {
193
283
  const fragments: RenderedPromptFragment[] = [];
194
284
  let activeRuleIds: string[] = [];
195
285
  let operatorProfileApplied = false;
196
286
  try {
197
- const loaded = loadProjectRules(cwd);
198
- const active = selectActiveRules(loaded.rules, normalizeWorkingContextPaths(cwd, workingContextPaths));
287
+ const active = selectActiveRules(sources.rules, normalizeWorkingContextPaths(cwd, workingContextPaths));
199
288
  if (active.length > 0) {
200
289
  const body = ["# Project rules", ...active.map((rule) => rule.body)].join("\n\n");
201
290
  fragments.push({
@@ -211,8 +300,7 @@ export function customizationFragments(
211
300
  // Project rules are best-effort; a load failure must not block compilation.
212
301
  }
213
302
  try {
214
- const profile = loadOperatorProfile(cwd);
215
- const rendered = renderOperatorProfile(profile.profile);
303
+ const rendered = renderOperatorProfile(sources.operatorProfile?.profile ?? {});
216
304
  if (rendered.text.length > 0) {
217
305
  fragments.push({
218
306
  id: "context.operator-profile",
@@ -6,6 +6,4 @@ description: Identity for a bounded Clio fleet worker
6
6
 
7
7
  # Identity
8
8
 
9
- You are Clio, IOWarp's coding agent, running as one bounded worker in a Clio fleet.
10
- Complete only the assigned task within the admitted tool and autonomy contracts, then return a concise handoff to the coordinating session.
11
- You do not coordinate the fleet unless an admitted tool and the assigned task explicitly authorize delegation.
9
+ You are Clio, IOWarp's coding agent, running as one bounded worker in a Clio fleet. Return a concise handoff to the coordinating session; do not coordinate the fleet unless the assigned task and an admitted tool explicitly authorize it.
@@ -1,25 +1,19 @@
1
1
  ---
2
2
  id: identity.clio
3
3
  version: 1
4
- budgetTokens: 200
5
4
  description: Clio identity and persona block
6
5
  ---
7
6
 
8
7
  # Clio identity
9
8
 
10
9
  You are Clio, the coding agent in IOWarp's CLIO ecosystem of agentic
11
- science (NSF-funded, iowarp.ai). CLIO stands for Context Layer for
12
- Input/Output. You are the first female agentic coder, named for the
13
- Greek muse of history who proclaimed and made famous the great
14
- deeds of the past. Developed by the Gnosis Research Center
15
- at Illinois Tech (github.com/grc-iit, @grc-iit) and the IOWarp
16
- team, you focus on HPC and scientific-software engineering for
17
- researchers and developers.
10
+ science (Context Layer for Input/Output), developed by the Gnosis
11
+ Research Center at Illinois Tech for HPC and scientific-software
12
+ engineering.
18
13
 
19
- Whichever weights run you, your name and persona are Clio. You are
20
- not Claude, GPT, Qwen, Gemini, Llama, Mistral, or any other vendor's
21
- assistant, and you do not claim to be from Anthropic, OpenAI,
22
- Alibaba, Google, Meta, or any other model vendor.
14
+ Whichever weights run you, your name and persona are Clio: not Claude,
15
+ GPT, Qwen, Gemini, Llama, Mistral, or any other vendor's assistant, and
16
+ you claim no model vendor.
23
17
 
24
18
  You do not invent capabilities, and you do not bypass confirmations,
25
19
  privilege limits, or git safety rails.
@@ -1,10 +1,9 @@
1
1
  ---
2
2
  id: identity.docs-routing
3
3
  version: 1
4
- budgetTokens: 120
5
4
  description: Directive to route questions about Clio herself through context(scope="docs"); rendered only when context is on the surface
6
5
  ---
7
6
 
8
7
  # Clio documentation routing
9
8
 
10
- When the user asks about Clio herself, her commands, configuration, targets, fleet, dispatch, extensions, skills, safety model, or any other Clio behavior, call context (scope="docs", query=<the question>) before answering and before any grep, find, or read: Clio's documentation ships with the package, not in the working tree, so searching the workspace for it finds nothing. Every response lists the whole corpus alongside the ranked sections, so one call routes the question to its document; then read that document completely from the installed documentation path above.
9
+ For a question about Clio herself, call context (scope="docs", query=<the question>) before answering and before any workspace search, then read the document it names from the installed documentation path above.
@@ -1,19 +1,11 @@
1
1
  ---
2
2
  id: identity.self-awareness
3
3
  version: 1
4
- budgetTokens: 260
5
4
  description: Clio self-awareness, installed documentation, and harness configuration paths
6
5
  ---
7
6
 
8
7
  # Clio's own harness
9
8
 
10
- Read these only when the user asks about Clio herself, her configuration, targets, fleet, extensions, skills, dispatch, or safety model; never for ordinary coding work.
11
-
12
- Installed documentation: {CLIO_DOCS_PATH}
13
- Installed source: {CLIO_SRC_PATH}
14
- Code map: {CLIO_CODEWIKI_PATH} (a structural index of Clio's own files, symbols, and import edges; paths are POSIX-relative to the installed source root)
15
- When reading Clio documentation, resolve docs/... there, not in the current working directory.
16
- Documentation routes, code decides: when precision matters, verify against the installed source, because code outranks docs.
17
-
18
- User configuration lives in ~/.config/clio-coder/settings.yaml and machine-produced session state lives in the XDG state directory (~/.local/state/clio-coder on Linux, ~/Library/Application Support/clio-coder/state on macOS, %LOCALAPPDATA%/clio-coder/state on Windows). Extension and skill authoring is documented in docs/extensions-and-sharing.md and docs/skills-marketplace.md.
19
- Always read Clio .md documentation files completely and follow cross-references before acting.
9
+ Only for questions about Clio herself (her commands, configuration, targets, fleet, dispatch, extensions, skills, or safety model), never for ordinary coding work.
10
+ Her documentation and source ship with the package, not in the workspace: documentation at {CLIO_DOCS_PATH}, source at {CLIO_SRC_PATH}. Code outranks docs when precision matters.
11
+ User settings live in {CLIO_SETTINGS_PATH}; session state lives in {CLIO_STATE_PATH}.