@nchamo/vitki 0.0.0-stage → 0.1.0-next.1.g073b99f

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 (426) hide show
  1. package/ARCHITECTURE.md +3151 -0
  2. package/BETA.md +39 -0
  3. package/LICENSE.md +3 -0
  4. package/README.md +72 -2
  5. package/agents/vitki-builder/AGENT.md +7 -0
  6. package/agents/vitki-builder/agent.yaml +3 -0
  7. package/agents/vitki-builder/skills/design/SKILL.md +235 -0
  8. package/agents/vitki-builder/skills/design/plan-template.html +64 -0
  9. package/agents/vitki-builder/skills/design/serve.py +70 -0
  10. package/agents/vitki-builder/skills/design/skill.yaml +15 -0
  11. package/agents/vitki-builder/skills/implement/SKILL.md +75 -0
  12. package/agents/vitki-builder/skills/implement/skill.yaml +19 -0
  13. package/agents/vitki-builder/skills/prepare-pr/SKILL.md +152 -0
  14. package/agents/vitki-builder/skills/prepare-pr/skill.yaml +18 -0
  15. package/agents/vitki-builder/skills/watch-ci/SKILL.md +101 -0
  16. package/agents/vitki-builder/skills/watch-ci/skill.yaml +18 -0
  17. package/agents/vitki-editor/AGENT.md +3 -0
  18. package/agents/vitki-editor/agent.yaml +3 -0
  19. package/agents/vitki-helper/AGENT.md +3 -0
  20. package/agents/vitki-helper/agent.yaml +3 -0
  21. package/agents/vitki-learner/AGENT.md +3 -0
  22. package/agents/vitki-learner/agent.yaml +3 -0
  23. package/agents/vitki-orchestrator/AGENT.md +9 -0
  24. package/agents/vitki-orchestrator/agent.yaml +3 -0
  25. package/agents/vitki-reviewer/AGENT.md +5 -0
  26. package/agents/vitki-reviewer/agent.yaml +5 -0
  27. package/apps/vitki-claude/app.yaml +4 -0
  28. package/apps/vitki-claude/icon.svg +4 -0
  29. package/apps/vitki-codex/app.yaml +4 -0
  30. package/apps/vitki-codex/icon.svg +5 -0
  31. package/apps/vitki-github/actions/list-open-prs/action.yaml +23 -0
  32. package/apps/vitki-github/actions/list-open-prs/list.py +37 -0
  33. package/apps/vitki-github/actions/open-pr/action.yaml +43 -0
  34. package/apps/vitki-github/actions/open-pr/commitwork.py +92 -0
  35. package/apps/vitki-github/actions/open-pr/open-pr.py +189 -0
  36. package/apps/vitki-github/actions/open-pr/prdoc.py +125 -0
  37. package/apps/vitki-github/actions/publish-comments/action.yaml +24 -0
  38. package/apps/vitki-github/actions/publish-comments/publish-comments.py +149 -0
  39. package/apps/vitki-github/actions/push-update/action.yaml +36 -0
  40. package/apps/vitki-github/actions/push-update/commitwork.py +92 -0
  41. package/apps/vitki-github/actions/push-update/push-update.py +88 -0
  42. package/apps/vitki-github/actions/read-build/action.yaml +25 -0
  43. package/apps/vitki-github/actions/read-build/read-build.py +81 -0
  44. package/apps/vitki-github/actions/ready-pr/action.yaml +25 -0
  45. package/apps/vitki-github/actions/ready-pr/prdoc.py +125 -0
  46. package/apps/vitki-github/actions/ready-pr/ready-pr.py +193 -0
  47. package/apps/vitki-github/app.yaml +3 -0
  48. package/apps/vitki-github/icon.svg +12 -0
  49. package/apps/vitki-github/mcp.yaml +9 -0
  50. package/apps/vitki-github/triggers/issue-assigned/check.py +85 -0
  51. package/apps/vitki-github/triggers/issue-assigned/trigger.yaml +39 -0
  52. package/apps/vitki-github/triggers/issue-labeled/check.py +85 -0
  53. package/apps/vitki-github/triggers/issue-labeled/trigger.yaml +45 -0
  54. package/apps/vitki-github/triggers/issue-opened/check.py +73 -0
  55. package/apps/vitki-github/triggers/issue-opened/trigger.yaml +39 -0
  56. package/apps/vitki-github/triggers/pr-opened/actions/list-pr-authors/action.yaml +23 -0
  57. package/apps/vitki-github/triggers/pr-opened/actions/list-pr-authors/list.py +46 -0
  58. package/apps/vitki-github/triggers/pr-opened/check.py +90 -0
  59. package/apps/vitki-github/triggers/pr-opened/trigger.yaml +49 -0
  60. package/apps/vitki-github/triggers/review-requested/check.py +85 -0
  61. package/apps/vitki-github/triggers/review-requested/trigger.yaml +39 -0
  62. package/apps/vitki-linear/app.yaml +4 -0
  63. package/apps/vitki-linear/icon.svg +2 -0
  64. package/apps/vitki-linear/mcp.yaml +9 -0
  65. package/defaults.yaml +17 -0
  66. package/dist/THIRD-PARTY-LICENSES.txt +1233 -0
  67. package/dist/vitki.mjs +3607 -0
  68. package/fonts/google-families.json +1 -0
  69. package/fonts/vitki-dejavu-mono/DejaVuSansMono-Bold.ttf +0 -0
  70. package/fonts/vitki-dejavu-mono/DejaVuSansMono.ttf +0 -0
  71. package/fonts/vitki-dejavu-mono/font.yaml +58 -0
  72. package/fonts/vitki-editorial/font.yaml +17 -0
  73. package/fonts/vitki-expressive/font.yaml +17 -0
  74. package/fonts/vitki-geist/font.yaml +15 -0
  75. package/fonts/vitki-mono/font.yaml +15 -0
  76. package/fonts/vitki-plex/font.yaml +15 -0
  77. package/harnesses/claude-code/harness.yaml +8 -0
  78. package/harnesses/codex/harness.yaml +10 -0
  79. package/how-it-works/activity.md +56 -0
  80. package/how-it-works/adoption.md +19 -0
  81. package/how-it-works/agents.md +35 -0
  82. package/how-it-works/appearance.md +27 -0
  83. package/how-it-works/apps.md +47 -0
  84. package/how-it-works/board.md +37 -0
  85. package/how-it-works/cli.md +63 -0
  86. package/how-it-works/keyboard.md +98 -0
  87. package/how-it-works/language-servers.md +55 -0
  88. package/how-it-works/learnings.md +31 -0
  89. package/how-it-works/network.md +39 -0
  90. package/how-it-works/notifications.md +44 -0
  91. package/how-it-works/onboarding.md +31 -0
  92. package/how-it-works/panels.md +49 -0
  93. package/how-it-works/permissions.md +66 -0
  94. package/how-it-works/preview-comments.md +37 -0
  95. package/how-it-works/repos.md +58 -0
  96. package/how-it-works/resources.md +27 -0
  97. package/how-it-works/review-passes.md +41 -0
  98. package/how-it-works/runs-on.md +23 -0
  99. package/how-it-works/scripts.md +77 -0
  100. package/how-it-works/sign-in.md +62 -0
  101. package/how-it-works/skills.md +23 -0
  102. package/how-it-works/talk.md +31 -0
  103. package/how-it-works/task-page.md +68 -0
  104. package/how-it-works/tasks-together.md +19 -0
  105. package/how-it-works/triggers.md +41 -0
  106. package/how-it-works/vault.md +45 -0
  107. package/how-it-works/workflows.md +102 -0
  108. package/images/vitki-tools/image.yaml +5 -0
  109. package/language-servers/vitki-bash/server.yaml +8 -0
  110. package/language-servers/vitki-css/server.yaml +10 -0
  111. package/language-servers/vitki-html/server.yaml +8 -0
  112. package/language-servers/vitki-json/server.yaml +8 -0
  113. package/language-servers/vitki-markdown/server.yaml +8 -0
  114. package/language-servers/vitki-noir/server.yaml +8 -0
  115. package/language-servers/vitki-python/server.yaml +8 -0
  116. package/language-servers/vitki-rust/server.yaml +8 -0
  117. package/language-servers/vitki-solidity/server.yaml +8 -0
  118. package/language-servers/vitki-typescript/server.yaml +9 -0
  119. package/language-servers/vitki-yaml/server.yaml +11 -0
  120. package/machine/preview/pin/cookies.js +158 -0
  121. package/machine/preview/pin/dist/pin.js +28 -0
  122. package/machine/sandbox/microvm/image/dist/darwin-arm64/vitki-image +0 -0
  123. package/machine/sandbox/microvm/image/dist/linux-arm64/vitki-image +0 -0
  124. package/machine/sandbox/microvm/image/dist/linux-x64/vitki-image +0 -0
  125. package/machine/sandbox/microvm/mke2fs/SOURCE +28 -0
  126. package/machine/sandbox/microvm/mke2fs/vendor/NOTICE +849 -0
  127. package/machine/sandbox/microvm/mke2fs/vendor/darwin-arm64/mke2fs +0 -0
  128. package/machine/sandbox/microvm/mke2fs/vendor/linux-arm64/mke2fs +0 -0
  129. package/machine/sandbox/microvm/mke2fs/vendor/linux-x64/mke2fs +0 -0
  130. package/machine/sandbox/microvm/mke2fs/vendor/src/README +8 -0
  131. package/machine/sandbox/microvm/mke2fs/vendor/src/e2fsprogs-1.47.4.tar.xz +0 -0
  132. package/machine/sandbox/tool/Dockerfile.template +77 -0
  133. package/machine/sandbox/tool/README.md +151 -0
  134. package/machine/sandbox/tool/brief.md +125 -0
  135. package/machine/sandbox/tool/build.sh +94 -0
  136. package/machine/sandbox/tool/dist/linux-arm64/brief.md +125 -0
  137. package/machine/sandbox/tool/dist/linux-arm64/ld-musl-aarch64.so.1 +0 -0
  138. package/machine/sandbox/tool/dist/linux-arm64/vitki-sandbox +0 -0
  139. package/machine/sandbox/tool/dist/linux-x64/brief.md +125 -0
  140. package/machine/sandbox/tool/dist/linux-x64/ld-musl-x86_64.so.1 +0 -0
  141. package/machine/sandbox/tool/dist/linux-x64/vitki-sandbox +0 -0
  142. package/machine/sandbox/tool/host-templates.json +77 -0
  143. package/machine/sandbox/tool/public_suffix_list.dat +16262 -0
  144. package/package.json +90 -4
  145. package/panels/vitki-my-pull-requests/panel.py +173 -0
  146. package/panels/vitki-my-pull-requests/panel.yaml +24 -0
  147. package/panels/vitki-needs-you/panel.py +150 -0
  148. package/panels/vitki-needs-you/panel.yaml +17 -0
  149. package/panels/vitki-new-learnings/panel.py +69 -0
  150. package/panels/vitki-new-learnings/panel.yaml +12 -0
  151. package/panels/vitki-pull-request/panel.py +325 -0
  152. package/panels/vitki-pull-request/panel.yaml +33 -0
  153. package/panels/vitki-ready-to-start/panel.py +431 -0
  154. package/panels/vitki-ready-to-start/panel.yaml +36 -0
  155. package/panels/vitki-review-requested/panel.py +176 -0
  156. package/panels/vitki-review-requested/panel.yaml +24 -0
  157. package/panels/vitki-runs-this-week/panel.py +76 -0
  158. package/panels/vitki-runs-this-week/panel.yaml +12 -0
  159. package/panels/vitki-task-and-usage/panel.py +140 -0
  160. package/panels/vitki-task-and-usage/panel.yaml +9 -0
  161. package/panels/vitki-weather/actions/find-city/action.yaml +11 -0
  162. package/panels/vitki-weather/actions/find-city/find-city.py +43 -0
  163. package/panels/vitki-weather/panel.py +168 -0
  164. package/panels/vitki-weather/panel.yaml +22 -0
  165. package/panels/vitki-working-now/panel.py +96 -0
  166. package/panels/vitki-working-now/panel.yaml +17 -0
  167. package/skills/vitki-browser/SKILL.md +40 -0
  168. package/skills/vitki-browser/skill.yaml +14 -0
  169. package/skills/vitki-browser/vitki-browser.cjs +394 -0
  170. package/skills/vitki-experts/SKILL.md +61 -0
  171. package/skills/vitki-experts/actions/file-history/action.yaml +21 -0
  172. package/skills/vitki-experts/actions/file-history/file-history.py +129 -0
  173. package/skills/vitki-experts/actions/recent-reviewers/action.yaml +19 -0
  174. package/skills/vitki-experts/actions/recent-reviewers/recent-reviewers.py +86 -0
  175. package/skills/vitki-experts/skill.yaml +8 -0
  176. package/skills/vitki-quiet-tests/SKILL.md +17 -0
  177. package/skills/vitki-quiet-tests/run-quiet.sh +87 -0
  178. package/skills/vitki-quiet-tests/skill.yaml +6 -0
  179. package/skills/vitki-review-change/SKILL.md +231 -0
  180. package/skills/vitki-review-change/scripts/change-manifest.py +161 -0
  181. package/skills/vitki-review-change/skill.yaml +58 -0
  182. package/themes/vitki-carbon/theme.yaml +38 -0
  183. package/themes/vitki-chalk/theme.yaml +38 -0
  184. package/themes/vitki-dusk/theme.yaml +38 -0
  185. package/themes/vitki-glacier/theme.yaml +38 -0
  186. package/themes/vitki-onyx/theme.yaml +38 -0
  187. package/themes/vitki-pearl/theme.yaml +38 -0
  188. package/ui/dist/assets/CodeTab-DoAORGW9.js +8 -0
  189. package/ui/dist/assets/abap-08VXUWAP.js +1 -0
  190. package/ui/dist/assets/abnfDiagram-VCTEODGH-Bu2-iRQD.js +1 -0
  191. package/ui/dist/assets/apex-BWPQTe0t.js +1 -0
  192. package/ui/dist/assets/arc-Pry-7G1_.js +1 -0
  193. package/ui/dist/assets/architecture-7GRP2DOG-B-LjHxJi.js +1 -0
  194. package/ui/dist/assets/architectureDiagram-5GKGNRK7-DusjhTmb.js +36 -0
  195. package/ui/dist/assets/array-BifhSqXX.js +1 -0
  196. package/ui/dist/assets/azcli-Bc_sGQ0U.js +1 -0
  197. package/ui/dist/assets/bat-i0X4ZdIN.js +1 -0
  198. package/ui/dist/assets/bicep-B5-_aFwp.js +2 -0
  199. package/ui/dist/assets/blockDiagram-I7D4REHJ-DTbIVENR.js +129 -0
  200. package/ui/dist/assets/c4Diagram-7LVT6UL2-DzHgjJKT.js +38 -0
  201. package/ui/dist/assets/cameligo-DMUM7wLl.js +1 -0
  202. package/ui/dist/assets/capture.worklet-BKRFcIGI.js +1 -0
  203. package/ui/dist/assets/channel-CEeXeOqY.js +1 -0
  204. package/ui/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  205. package/ui/dist/assets/chunk-4HAMMTFA-D2-PYRaJ.js +62 -0
  206. package/ui/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  207. package/ui/dist/assets/chunk-75Z2AOVW-CffpPwtu.js +2 -0
  208. package/ui/dist/assets/chunk-DU6HZSFF-D_wICj9t.js +125 -0
  209. package/ui/dist/assets/chunk-F27PBJKO-QFWG5BQX.js +1 -0
  210. package/ui/dist/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
  211. package/ui/dist/assets/chunk-GMAD6QVW-C5Q5QXhW.js +72 -0
  212. package/ui/dist/assets/chunk-GVQU2GXP-D-TvLxiX.js +1 -0
  213. package/ui/dist/assets/chunk-IMKFNOWR-BjDYukcC.js +231 -0
  214. package/ui/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  215. package/ui/dist/assets/chunk-L3NEJ4N5-K8S_OV-F.js +1 -0
  216. package/ui/dist/assets/chunk-OSK3NFVY-D65zLrXr.js +10 -0
  217. package/ui/dist/assets/chunk-P2QGCYS3-DyuhNiSM.js +1 -0
  218. package/ui/dist/assets/chunk-POPQ4Y6H-TUhkBln0.js +1 -0
  219. package/ui/dist/assets/chunk-PWAF6VOD-BNXBklTK.js +1 -0
  220. package/ui/dist/assets/chunk-SHT3W25Y-CdL9at47.js +168 -0
  221. package/ui/dist/assets/chunk-SVP7TREG-2GYY1HiO.js +88 -0
  222. package/ui/dist/assets/chunk-TICWLB2K-GwX7zRMK.js +206 -0
  223. package/ui/dist/assets/chunk-XXDRQBXY-DqAYeljN.js +1 -0
  224. package/ui/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  225. package/ui/dist/assets/classDiagram-ZZMXUADV-ZUda01wi.js +1 -0
  226. package/ui/dist/assets/classDiagram-v2-VYDZK3BY-ZUda01wi.js +1 -0
  227. package/ui/dist/assets/clojure-Cm7r79vr.js +1 -0
  228. package/ui/dist/assets/codicon-Brq4_Ui5.ttf +0 -0
  229. package/ui/dist/assets/coffee-Ba7i2nA0.js +1 -0
  230. package/ui/dist/assets/cose-bilkent-JH36ORCC-om8AY0Mc.js +1 -0
  231. package/ui/dist/assets/cpp-C7h46wYY.js +1 -0
  232. package/ui/dist/assets/csharp-BKxtCVv1.js +1 -0
  233. package/ui/dist/assets/csp-bTuwJoIa.js +1 -0
  234. package/ui/dist/assets/css-BsVw1vtW.js +1 -0
  235. package/ui/dist/assets/css-DIMkf-bt.js +3 -0
  236. package/ui/dist/assets/css.worker-DRH2OcAG.js +93 -0
  237. package/ui/dist/assets/cssMode-Cc2Ao7Ks.js +1 -0
  238. package/ui/dist/assets/cynefin-OW5HDTMX-DS9psPR6.js +1 -0
  239. package/ui/dist/assets/cynefinDiagram-5FMLGOSQ-DAaZLCYz.js +62 -0
  240. package/ui/dist/assets/cypher-CVaqCwHa.js +1 -0
  241. package/ui/dist/assets/cytoscape.esm-CGd-uY3x.js +321 -0
  242. package/ui/dist/assets/dagre-GXQ25YYZ-CIp1_9pV.js +4 -0
  243. package/ui/dist/assets/dagre-PrKaheQc.js +1 -0
  244. package/ui/dist/assets/dart-onAF5SnQ.js +1 -0
  245. package/ui/dist/assets/defaultLocale-BFoDCU3G.js +1 -0
  246. package/ui/dist/assets/diagram-S7CK7UJ4-Bb3HiJNu.js +30 -0
  247. package/ui/dist/assets/diagram-UQ7AKVKN-Da_pvPDa.js +41 -0
  248. package/ui/dist/assets/diagram-VSXAHHWV-DJYQ28VJ.js +3 -0
  249. package/ui/dist/assets/diagram-VX7I27RA-X7XSTk_a.js +24 -0
  250. package/ui/dist/assets/diagram-Z3DM3KII-DHWZBN4p.js +24 -0
  251. package/ui/dist/assets/diff-woXpYk--.js +1 -0
  252. package/ui/dist/assets/dist-D3SKIFwd.js +10 -0
  253. package/ui/dist/assets/dist-DXvXGZCt.js +3 -0
  254. package/ui/dist/assets/dist-v5Q1xZ2K.js +1 -0
  255. package/ui/dist/assets/dist-vHStYFkU.js +141 -0
  256. package/ui/dist/assets/docker-IyjqRm3v.js +1 -0
  257. package/ui/dist/assets/dockerfile-DZFCIeNp.js +1 -0
  258. package/ui/dist/assets/ebnfDiagram-PWID7BFC-DFPZxSPi.js +1 -0
  259. package/ui/dist/assets/ecl-D05T4iGw.js +1 -0
  260. package/ui/dist/assets/editor.worker-D9zwrD0f.js +30 -0
  261. package/ui/dist/assets/elixir-6RTg0lbw.js +1 -0
  262. package/ui/dist/assets/erDiagram-RLTQ6QDP-BnCFycsp.js +99 -0
  263. package/ui/dist/assets/eventmodeling-NTZA5JFV-BBri83o4.js +1 -0
  264. package/ui/dist/assets/flow9-C5_-GSwl.js +1 -0
  265. package/ui/dist/assets/flowDiagram-HODETNUW-nB1NFDWy.js +1 -0
  266. package/ui/dist/assets/freemarker2-DLOVSH0w.js +3 -0
  267. package/ui/dist/assets/fsharp-C8Ef5oNN.js +1 -0
  268. package/ui/dist/assets/ganttDiagram-EL5Y4UJY-B2w0Msmu.js +292 -0
  269. package/ui/dist/assets/gitGraph-4MIJSDKK-LWswjhwv.js +1 -0
  270. package/ui/dist/assets/gitGraphDiagram-WWUBYQGX-pGhr3ylo.js +106 -0
  271. package/ui/dist/assets/go-C-y9NEjX.js +1 -0
  272. package/ui/dist/assets/graphlib-DS17s2tU.js +1 -0
  273. package/ui/dist/assets/graphql-fmXr3nnJ.js +1 -0
  274. package/ui/dist/assets/handlebars-CXt3z94W.js +1 -0
  275. package/ui/dist/assets/hcl-CpzslTdj.js +1 -0
  276. package/ui/dist/assets/html-BSfzUjda.js +1 -0
  277. package/ui/dist/assets/html-BY76lXLH.js +1 -0
  278. package/ui/dist/assets/html.worker-DQLddT9h.js +506 -0
  279. package/ui/dist/assets/htmlMode-BOn2YwFY.js +1 -0
  280. package/ui/dist/assets/index-BQocP4ol.css +1 -0
  281. package/ui/dist/assets/index-BcBl6ggh.js +2555 -0
  282. package/ui/dist/assets/info-A6RAGUB7-DMWzOQ2x.js +1 -0
  283. package/ui/dist/assets/infoDiagram-27XIBGKW-Bvl5QQz3.js +2 -0
  284. package/ui/dist/assets/ini-sBoK_t0W.js +1 -0
  285. package/ui/dist/assets/init-C-OQMol4.js +1 -0
  286. package/ui/dist/assets/ishikawaDiagram-5VMMS53U-BXwPVJKR.js +70 -0
  287. package/ui/dist/assets/java-BEtHBSE6.js +1 -0
  288. package/ui/dist/assets/javascript-BT3RaWop.js +1 -0
  289. package/ui/dist/assets/javascript-BgS3c2Ky.js +1 -0
  290. package/ui/dist/assets/journeyDiagram-3NMN7TZE-D9oPQkSR.js +139 -0
  291. package/ui/dist/assets/json.worker-D_Dqrls5.js +62 -0
  292. package/ui/dist/assets/jsonMode-BLtD8jye.js +7 -0
  293. package/ui/dist/assets/jsonc-CYpm1nAK.js +1 -0
  294. package/ui/dist/assets/jsx-Bz0zcwM4.js +1 -0
  295. package/ui/dist/assets/julia-Bri6UV-V.js +1 -0
  296. package/ui/dist/assets/kanban-definition-UXKFOSKX-DYoN21lm.js +89 -0
  297. package/ui/dist/assets/katex-CXMH3UgJ.js +257 -0
  298. package/ui/dist/assets/kotlin-BOotOW0E.js +1 -0
  299. package/ui/dist/assets/less-B9JPFI3C.js +2 -0
  300. package/ui/dist/assets/lexon-CfSJPG6W.js +1 -0
  301. package/ui/dist/assets/line-B-rKdSpE.js +1 -0
  302. package/ui/dist/assets/linear-DmucvK78.js +1 -0
  303. package/ui/dist/assets/liquid-Q_romg-w.js +1 -0
  304. package/ui/dist/assets/lspLanguageFeatures-CHC-7W8j.js +4 -0
  305. package/ui/dist/assets/lua-CsQS60Ue.js +1 -0
  306. package/ui/dist/assets/m3-D-oSqn_W.js +1 -0
  307. package/ui/dist/assets/machineKeys-VaFU4XFb.js +1 -0
  308. package/ui/dist/assets/markdown-BYOwaDjH.js +1 -0
  309. package/ui/dist/assets/markdown-Cimd5fb3.js +1 -0
  310. package/ui/dist/assets/mdx-D_VTI8q8.js +1 -0
  311. package/ui/dist/assets/mermaid-parser.core-q_wFdfmu.js +7 -0
  312. package/ui/dist/assets/mermaid.core-BlhjizCn.js +44 -0
  313. package/ui/dist/assets/mindmap-definition-YA3MSWOX-Di1gHHje.js +96 -0
  314. package/ui/dist/assets/mips-CIPQ_RoX.js +1 -0
  315. package/ui/dist/assets/msdax-DauUninz.js +1 -0
  316. package/ui/dist/assets/mysql-SOo6toE5.js +1 -0
  317. package/ui/dist/assets/noir-Dbk5GliT.js +2 -0
  318. package/ui/dist/assets/objective-c-FvmIjYaQ.js +1 -0
  319. package/ui/dist/assets/ordinal-BDEzSJ7C.js +1 -0
  320. package/ui/dist/assets/packet-AYTQ26CC-AvPxSKEA.js +1 -0
  321. package/ui/dist/assets/pascal-DrH0SRf2.js +1 -0
  322. package/ui/dist/assets/pascaligo-D-ptJ9y-.js +1 -0
  323. package/ui/dist/assets/path-fybaL0A-.js +1 -0
  324. package/ui/dist/assets/pegDiagram-XKGWAZYB-Ddkthi-2.js +1 -0
  325. package/ui/dist/assets/perl-oz_6vUea.js +1 -0
  326. package/ui/dist/assets/pgsql-DTj74zXo.js +1 -0
  327. package/ui/dist/assets/php-nr791fC2.js +1 -0
  328. package/ui/dist/assets/pie-WAS4IAKB-CDI6QU0-.js +1 -0
  329. package/ui/dist/assets/pieDiagram-E7YTZNPT-Dw3XMw87.js +39 -0
  330. package/ui/dist/assets/pipeline-DRnLKr_f.js +1 -0
  331. package/ui/dist/assets/pla-CopQ2nXW.js +1 -0
  332. package/ui/dist/assets/postiats-43DmfD33.js +1 -0
  333. package/ui/dist/assets/powerquery-D3hlyOfw.js +1 -0
  334. package/ui/dist/assets/powershell-DmHpPYUd.js +1 -0
  335. package/ui/dist/assets/preload-helper-Czpn1I53.js +1 -0
  336. package/ui/dist/assets/protobuf-C531GsRP.js +2 -0
  337. package/ui/dist/assets/pug-Z5eAx3Zn.js +1 -0
  338. package/ui/dist/assets/python-BHx8h3JN.js +1 -0
  339. package/ui/dist/assets/python-gzcpVVnB.js +1 -0
  340. package/ui/dist/assets/qsharp-DkqhCAOL.js +1 -0
  341. package/ui/dist/assets/quadrantDiagram-AXDQQJYC-CcJyKty4.js +7 -0
  342. package/ui/dist/assets/r-BwWrilGY.js +1 -0
  343. package/ui/dist/assets/radar-RG4KPBEZ--sPs-sWr.js +1 -0
  344. package/ui/dist/assets/railroad-74A4TZTK-sB7hwKq3.js +1 -0
  345. package/ui/dist/assets/railroad-abnf-HS5TGJTU-B8sNeb68.js +1 -0
  346. package/ui/dist/assets/railroad-ebnf-LZEXJU2U-CVI-fWii.js +1 -0
  347. package/ui/dist/assets/railroad-peg-WCYAUIDC-DF_68D3U.js +1 -0
  348. package/ui/dist/assets/railroadDiagram-O6MQD6OU-BS_0se4S.js +1 -0
  349. package/ui/dist/assets/razor-BdExiajx.js +1 -0
  350. package/ui/dist/assets/redis-ClamHrr6.js +1 -0
  351. package/ui/dist/assets/redshift-DT7zqm-g.js +1 -0
  352. package/ui/dist/assets/requirementDiagram-BXWQKSXE-DoXAp19w.js +84 -0
  353. package/ui/dist/assets/restructuredtext-BYgofb2h.js +1 -0
  354. package/ui/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
  355. package/ui/dist/assets/rough.esm-Dy-Kn_BL.js +1 -0
  356. package/ui/dist/assets/ruby-DezsRK8O.js +1 -0
  357. package/ui/dist/assets/rust-Cfkwpbl8.js +1 -0
  358. package/ui/dist/assets/rust-DdL9SqIa.js +1 -0
  359. package/ui/dist/assets/sankeyDiagram-P5KCCOFB-DN00KMs0.js +40 -0
  360. package/ui/dist/assets/sb-CcwsVR0C.js +1 -0
  361. package/ui/dist/assets/scala-DHpiXF5c.js +1 -0
  362. package/ui/dist/assets/scheme-BeGwcela.js +1 -0
  363. package/ui/dist/assets/scss-gp-XZpBa.js +3 -0
  364. package/ui/dist/assets/sequenceDiagram-WJ2MYXX4-BRwNLOEU.js +162 -0
  365. package/ui/dist/assets/shell-CC2rA5mh.js +1 -0
  366. package/ui/dist/assets/shellscript-CLZ0U2zV.js +1 -0
  367. package/ui/dist/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  368. package/ui/dist/assets/solidity-BEEn4gHE.js +1 -0
  369. package/ui/dist/assets/solidity-Bj7E1mRn.js +1 -0
  370. package/ui/dist/assets/sophia-CRfGWb83.js +1 -0
  371. package/ui/dist/assets/sparql-D_Lu-MrJ.js +1 -0
  372. package/ui/dist/assets/sql-NEE52Syq.js +1 -0
  373. package/ui/dist/assets/src-B6xuSHsQ.js +1 -0
  374. package/ui/dist/assets/st-DbInun42.js +1 -0
  375. package/ui/dist/assets/stateDiagram-D77RDMKH-DDRvG2Lr.js +1 -0
  376. package/ui/dist/assets/stateDiagram-v2-MP3YSRHH-B-2ZDlBV.js +1 -0
  377. package/ui/dist/assets/swift-Bxkupp3x.js +1 -0
  378. package/ui/dist/assets/swimlanes-42K2YHIH-YuWtWROL.js +1 -0
  379. package/ui/dist/assets/swimlanesDiagram-VR7AAH4N-BNVspYTF.js +8 -0
  380. package/ui/dist/assets/systemverilog-Bz4Y3fRF.js +1 -0
  381. package/ui/dist/assets/tcl-DISqw1ZD.js +1 -0
  382. package/ui/dist/assets/timeline-definition-24CTP7MA-CFsl3shb.js +120 -0
  383. package/ui/dist/assets/toml-CcmNWLt0.js +1 -0
  384. package/ui/dist/assets/treeView-Q6P3EWNA-Br0eHsT6.js +1 -0
  385. package/ui/dist/assets/treemap-WGGIJYW6-CfHGR9OZ.js +1 -0
  386. package/ui/dist/assets/ts.worker-DkYoA6bF.js +67738 -0
  387. package/ui/dist/assets/tsMode-CuJlyUxT.js +11 -0
  388. package/ui/dist/assets/tsx-udAQXfEw.js +1 -0
  389. package/ui/dist/assets/twig-De2hgUGE.js +1 -0
  390. package/ui/dist/assets/typescript-DMsCv8Wx.js +1 -0
  391. package/ui/dist/assets/typescript-bsJCZSQ-.js +1 -0
  392. package/ui/dist/assets/typespec-B8J7ngcE.js +1 -0
  393. package/ui/dist/assets/vb-DV3o63ZY.js +1 -0
  394. package/ui/dist/assets/vennDiagram-4TSXK5OY-DwyuAO8Y.js +34 -0
  395. package/ui/dist/assets/wardley-WFR3VGLG-DEWNwl1P.js +1 -0
  396. package/ui/dist/assets/wardleyDiagram-VM6X3IG4-CR7BmAXO.js +78 -0
  397. package/ui/dist/assets/wgsl-DpFanUEy.js +298 -0
  398. package/ui/dist/assets/worker-C2gAz3kA.js +4168 -0
  399. package/ui/dist/assets/workers-BaJqBeE9.js +1 -0
  400. package/ui/dist/assets/xml-DGj_De55.js +1 -0
  401. package/ui/dist/assets/xychartDiagram-S5SC5T6Z-CLa3i4yy.js +7 -0
  402. package/ui/dist/assets/yaml-B83oj0Xv.js +1 -0
  403. package/ui/dist/assets/yaml-rwi0_p6S.js +1 -0
  404. package/ui/dist/index.html +24 -0
  405. package/ui/dist/talk/ort/ort-wasm-simd-threaded.jsep.mjs +125 -0
  406. package/ui/dist/talk/ort/ort-wasm-simd-threaded.jsep.wasm +0 -0
  407. package/workflows/vitki-feature/workflow.yaml +104 -0
  408. package/workflows/vitki-improve/skills/propose/SKILL.md +59 -0
  409. package/workflows/vitki-improve/skills/propose/skill.yaml +10 -0
  410. package/workflows/vitki-improve/triggers/weekly/trigger.yaml +4 -0
  411. package/workflows/vitki-improve/workflow.yaml +31 -0
  412. package/workflows/vitki-learn-reviews/actions/gather-review-comments/action.yaml +31 -0
  413. package/workflows/vitki-learn-reviews/actions/gather-review-comments/actions/list-repo-collaborators/action.yaml +23 -0
  414. package/workflows/vitki-learn-reviews/actions/gather-review-comments/actions/list-repo-collaborators/list.py +50 -0
  415. package/workflows/vitki-learn-reviews/actions/gather-review-comments/gather.py +183 -0
  416. package/workflows/vitki-learn-reviews/skills/distill/SKILL.md +46 -0
  417. package/workflows/vitki-learn-reviews/skills/distill/skill.yaml +6 -0
  418. package/workflows/vitki-learn-reviews/triggers/nightly/check.py +22 -0
  419. package/workflows/vitki-learn-reviews/triggers/nightly/trigger.yaml +19 -0
  420. package/workflows/vitki-learn-reviews/workflow.yaml +44 -0
  421. package/workflows/vitki-review/workflow.yaml +43 -0
  422. package/workflows/vitki-update-deps/skills/upgrade/SKILL.md +107 -0
  423. package/workflows/vitki-update-deps/skills/upgrade/skill.yaml +6 -0
  424. package/workflows/vitki-update-deps/triggers/nightly/check.py +22 -0
  425. package/workflows/vitki-update-deps/triggers/nightly/trigger.yaml +19 -0
  426. package/workflows/vitki-update-deps/workflow.yaml +37 -0
@@ -0,0 +1,3151 @@
1
+ # Vitki — architecture and contracts
2
+
3
+ Vitki is a local web workbench: parallel tasks, each in its own container with
4
+ its own Claude session, reviewed in the browser with threaded comments the
5
+ session answers, plus a learnings loop that feeds the next session.
6
+
7
+ This file is the contract every component codes against. If you change a
8
+ contract here, change every consumer in the same commit.
9
+
10
+ ## Components
11
+
12
+ ```
13
+ vitki/
14
+ hub/ Node 20+ / TypeScript / Fastify. The server's state, routes and
15
+ task domain: the database, people, the API, tasks.
16
+ `hub/people/` owns the person: `person.ts` is the acting
17
+ person that work outside a route reads.
18
+ Three import rules hold these boundaries
19
+ (`tools/dependency-cruiser.cjs`): nothing imports a person
20
+ module under `hub/tasks/` (people-not-under-tasks), a top-level
21
+ `hub/` or `machine/` file other than `hub/tasks.ts` imports
22
+ nothing under `hub/tasks/` (toplevel-not-tasks), and the
23
+ registry imports nothing under `hub/tasks/`
24
+ (registry-no-domain). The imports that broke them when they
25
+ came in sit in `tools/known-imports.json`, which may only
26
+ shrink. `hub/link/` is the hub's end of the link: the
27
+ conversation (the transcript and the live stream), live (the
28
+ newest fill and plan limits of each task) and jobs, the client
29
+ that opens, feeds and cancels the machine's jobs.
30
+ `hub/tasks/sandbox.ts` asks every look and act of a task
31
+ sandbox as a `vm` or `vm-exec` job, and holds each running
32
+ task's VM as a long-lived `task` job. `hub/sessions.ts` feeds
33
+ each session write to the task's job as a call once the job
34
+ said ready, and sends it as a one-off `session` job while no
35
+ job is ready. The ready job's `session` events carry each
36
+ hook and a snapshot of the task's sessions, which
37
+ `hub/link/sessionMirror.ts` keeps for every read of the
38
+ facade, and its asks (the launch login, the turn's sign-in,
39
+ a failed sign-in) get the hub's reply as
40
+ feed. The `session-agents` kind names the machine's
41
+ harnesses. `hub/tasks/taskNeed.ts`
42
+ declares the task's sandbox as a need, values with no host
43
+ path. A `vm-stream` job runs a command that stays running, its
44
+ stdin fed in order. `hub/link/previews.ts` holds each task's
45
+ preview proxy as a long-lived `preview` job.
46
+ machine/ What runs tasks. The TypeScript that drives sandboxes,
47
+ sessions, previews, language servers, the egress wall
48
+ (`machine/wall/`), images and repos on disk. It opens no
49
+ database. sandbox/tool/ is the Vitki container layer:
50
+ Dockerfile template, the `vitki-sandbox` program (the `vitki`
51
+ client CLI and the guest start step), hooks. sandbox/microvm/
52
+ holds the drivers and builds the microVM image and mke2fs.
53
+ `machine/link/` holds the job runner, which hears the hub's
54
+ job control and reports through the session manager's one
55
+ outbox. `machine/jobs/` holds the handlers of the job kinds.
56
+ `machine/jobs/repo.ts` runs the `repo` kind (a repo's git
57
+ calls, its image build, the looks at and removal of its
58
+ image, and the clone reads `ref`, `branches`, `set-url`
59
+ and `count`) and the `repo-probe` kind (Add repo's look at a
60
+ source), and `hub/link/repos.ts` is their hub caller, the
61
+ repo's sign-in a grant on the unkept lane.
62
+ `machine/jobs/task.ts` turns a task's need into its spec with
63
+ what only the machine knows, keeps or makes the VM, prepares
64
+ and seeds it, removes it at sleep or cancel, and runs each
65
+ session call fed after ready. `machine/jobs/session.ts` runs
66
+ the one-off `session` kind and those calls on the session
67
+ manager, wires the machine's job handlers, and routes the
68
+ manager's hooks and asks to the task's open job.
69
+ `machine/jobs/wall.ts` runs the long-lived `wall` kind: the
70
+ hub opens it once with its copy of the rules
71
+ (`hub/link/rules.ts`), feeds it every change and every
72
+ answer, and hears each act and ask as an event it places
73
+ from its own records (`hub/link/wallAsks.ts`). The proxy
74
+ decides every connection from that copy
75
+ (`machine/link/rules.ts`).
76
+ `machine/jobs/script.ts` runs the `script` kind, one script
77
+ run or one command of a run with a secret in a one-shot
78
+ sandbox (`hub/link/scripts.ts` opens it). The run's secret
79
+ and file copies come as one-use grants it redeems from
80
+ `hub/link/secretLane.ts`, and it masks the output before
81
+ the result leaves the machine. The run's folder is a `disk`
82
+ of its need, `run-<run id>` at /vitki/review, made on the
83
+ machine's own disk from what the job carries (the item's
84
+ files, items.json, the inputs) with an empty creds/, tmp/
85
+ and output/ (`machine/jobs/runFolder.ts`). The report files
86
+ and the output file come back masked on the result, and the
87
+ folder goes once the run is over. A folder already there is
88
+ refused, and the machine sweeps every leftover run-* folder
89
+ when its script jobs start.
90
+ `machine/jobs/mcp.ts` runs the long-lived `mcp` kind, one
91
+ task's local MCP server. `hub/mcp/connections.ts` opens it
92
+ on the server's first call, its secret inputs as one-use
93
+ grants on the same lane, feeds each call under an id, and
94
+ hears the masked answer as an event under that id.
95
+ `machine/jobs/lsp.ts` runs the long-lived `lsp` kind: a
96
+ task's language servers in its sandbox (one `LspPool` per
97
+ job), or the Library editor's servers of one person.
98
+ `hub/link/languageServers.ts` opens it for the task's owner
99
+ with the servers each repo has on and the owner's Library
100
+ entries, feeds the latest task row as `context`, keeps the
101
+ page sockets and the owner check, and feeds each page's
102
+ frames under a page id. The machine sends each event masked
103
+ with the job's mask set from the lane, asks the hub which
104
+ store entries the sandbox holds, and has the hub place a
105
+ save check's files beside it. `stopTask` cancels the job.
106
+ A task's or run's job also carries the verbs its sandbox
107
+ files: `machine/wall/cli.ts` reads each off the channel
108
+ and sends it as a `verb` event, and `hub/link/verbs.ts`
109
+ hands it to the listener and feeds the answer back. An
110
+ answer that carries a value the run masks rides the feed
111
+ with its words masked and the whole answer as a one-use
112
+ grant for the job and its person, which the machine redeems
113
+ and writes into the run's creds/ as `res-<id>.json`. A press
114
+ on any ask of a run (secret, yes or no, verb) whose run no longer waits, or whose machine the
115
+ hub cannot reach, fails in words and the card stays open.
116
+ `machine/sandbox/calls.ts` holds the backend calls the
117
+ machine's own modules make directly.
118
+ `machine/jobs/preview.ts` runs the `preview` kind, a task's
119
+ preview proxy listening on the machine. The proxy asks the hub
120
+ about each request on the unkept lane (`preview-check`,
121
+ `preview-theme`, `preview-hold`), and `hub/link/previewLane.ts`
122
+ answers by the job's id alone.
123
+ shared/ Helpers no service owns, such as the reason line in
124
+ `shared/core/words.ts`, and `shared/contract/`, the API's
125
+ schemas the ui reads too. `shared/link/` holds the link's
126
+ messages, its transport (a WebSocket the machine dials,
127
+ `shared/link/socket.ts`, with the three wires over it in
128
+ `shared/link/mux.ts`), and the one
129
+ generic outbox and inbox. The link has two directions. The
130
+ machine sends five groups to the hub: the conversation, the
131
+ state, usage, the job reports and the agents group (each
132
+ agent binary noted or dropped, and the running fetches). The hub sends one group to
133
+ the machine: the job control (start, input, cancel).
134
+ Beside the groups, `shared/link/unkept.ts` is the unkept
135
+ lane: a request from the machine and the hub's reply, never
136
+ kept or resent, failing in words while the wire is down.
137
+ Secrets ride only this lane. So do the Library bodies the
138
+ machine reads by hash (`shared/link/library.ts`): the
139
+ machine keeps them in a cache of its own
140
+ (`machine/link/library.ts`), and on a miss the hub's
141
+ `LibraryLane` (`hub/link/library.ts`) serves only a hash it
142
+ offered the job, for the job's person.
143
+ The hub asks where servers stand in the machine's
144
+ server store as a `server-install` job
145
+ (`hub/link/servers.ts`, `machine/jobs/servers.ts`), and
146
+ builds, looks at or removes a Library image's item image
147
+ as an `item-image` job (`hub/link/itemImages.ts`,
148
+ `machine/jobs/itemImage.ts`), keeping the build's record
149
+ and the failure memory itself (`hub/itemImages.ts`).
150
+ A person's account image is made or looked at by their
151
+ Library editing sandbox as a `library-sandbox` job
152
+ (`hub/link/librarySandbox.ts`, `machine/jobs/librarySandbox.ts`),
153
+ and the same kind uses, reads and forgets that sandbox. The
154
+ sandbox's build records are the hub's, one set per person.
155
+ The version check's public fetch is a one-off `fetch` job
156
+ (`machine/jobs/fetch.ts`) that carries a URL and one Accept
157
+ value, and the wall's `request` event is a task's network
158
+ activity, kept by the hub (`hub/link/wallFacts.ts`). The
159
+ wall's `proxy` event says whether the egress proxy runs and
160
+ whether the server started it, told as the job opens and on
161
+ each change, and the hub refuses a sandbox from that fact.
162
+ A need's `network.proxy` and a `vm-exec`'s `proxy` user ask
163
+ the machine for the proxy env, which the machine fills and
164
+ masks, so `hub/` never reads the proxy. A `vm-exec`'s
165
+ `task` names the task the sandbox is for, and the machine
166
+ masks that task's token out of the output with or without
167
+ a proxy user, and a `vm-stream`'s `task` the same in each
168
+ chunk. A job's error leaves the machine with every proxy
169
+ token it holds masked. The hub's script
170
+ runs reach the one-shot sandbox only through the `script`
171
+ job, whose place the machine builds (`machine/jobs/script.ts`).
172
+ Vitki's own text calls on a person's agent are a long-lived
173
+ `model` job, and the models a Codex login lists a one-off
174
+ `models` job (`hub/link/models.ts`, `machine/jobs/model.ts`).
175
+ Claude Code's sign-in and a login's renewal are a long-lived
176
+ `sign-in` job (`hub/link/signIn.ts`, `machine/jobs/signIn.ts`).
177
+ The store of agent binaries is one-off `agents` jobs, a look,
178
+ a fetch and a prune (`hub/link/agents.ts`,
179
+ `machine/jobs/agents.ts`), and the hub writes a task's agent
180
+ versions into its need.
181
+ A fetch of Vitki's own that carries a token (Google's
182
+ exchange, the forge client, an MCP sign-in's token calls) is
183
+ a one-off `own-fetch` job (`hub/link/fetch.ts`, beside the
184
+ public kind in `machine/jobs/fetch.ts`). Each login and each
185
+ request rides a one-use grant, and what the machine gets
186
+ back goes to the hub on the unkept lane, never in a frame:
187
+ a packed login as `login-hand`, a response as `fetch-hand`,
188
+ a space login's renewed set as `space-login-hand`,
189
+ taken once by `hub/link/secretLane.ts` while the job is open.
190
+ A space login renews on the member's machine, under the
191
+ hub's lease and renewal count (`hub/spaceLogins.ts`).
192
+ `shared/link/jobs.ts` holds the job frames and
193
+ `shared/link/jobKinds.ts` the table of job kinds, each with
194
+ its input, events and result as schemas, one-off or
195
+ long-lived. The kinds: `key-holder` and `vault-key` (the
196
+ machine's keys), `vm`, `vm-exec`, `vm-stream` and `task` (a
197
+ task's sandbox and its run), `session` and `session-agents`,
198
+ `wall` (the egress wall), `script`, `preview` and
199
+ `preview-end`, `repo` and `repo-probe`, `server-install`
200
+ and `lsp`, `item-image` and `library-sandbox`, `mcp`,
201
+ `fetch`, `own-fetch` and `ssh-sign`, `model`, `models`,
202
+ `sign-in` and `agents` (logins and model calls), and
203
+ `talk-models`. `shared/sandbox/` holds the backend's types, the
204
+ names both sides use and the need (`need.ts`), the shape a job
205
+ kind that makes a sandbox declares it with. Nothing here imports from hub/,
206
+ machine/ or cli/. The pure helpers both sides call sit here too:
207
+ the places and Docker names (`sandbox/places.ts`, `sandbox/names.ts`),
208
+ the host git calls (`git.ts`), the image picks (`imagePicks.ts`),
209
+ the run file names (`runFiles.ts`) and the build record (`builds.ts`).
210
+ cli/ `cli/vitki.ts`, the composition root that starts the server.
211
+ Nothing imports it. Plain `vitki` runs the hub and spawns
212
+ `vitki machine --local` on the same home, `vitki hub` and
213
+ `vitki machine --hub <url>` run one each. `cli/hub.ts` puts
214
+ the hub together with no machine code. `cli/machine.ts`
215
+ puts the machine's side together: the session manager that
216
+ serves the hub's jobs, the backend, the work copies and the
217
+ wall the proxy runs against. `runMachine`
218
+ dials the hub over one socket with the outbox and job inbox
219
+ on kept files, and `startMachine` builds the same side over
220
+ three in-process pairs for the tests. The hub declares what
221
+ it needs in `hub/link/machine.ts` (`useMachine`,
222
+ `machineOnLink`) and holds only the ends of the wires, so
223
+ no hub file imports the machine and no machine file the hub.
224
+ The work copies, the reap, the cache drop, the
225
+ store's volumes and image removal are `vm` job ops.
226
+ test/ The server's tests (vitest).
227
+ ui/ React + Vite + TypeScript. Talks only to the server.
228
+ skills/ The shipped skills.
229
+ ```
230
+
231
+ ### Processes
232
+
233
+ ```
234
+ vitki (hub process) vitki machine (machine process)
235
+ ┌──────────────────────────┐ WebSocket ┌───────────────────────────┐
236
+ │ Fastify, SQLite, people, │ /api/machines │ session manager, jobs, │
237
+ │ tasks, the hub's ends: │◄───── /link ───┤ sandboxes, wall, egress │
238
+ │ control, report, lane │ machine dials │ proxy, kept outbox and │
239
+ └──────────────────────────┘ and signs in │ job inbox (machine/link/) │
240
+ └───────────────────────────┘
241
+ ```
242
+
243
+ The machine dials, signs the hub's origin and a nonce with its Ed25519 key,
244
+ and once signed in sends `{ready: true}`. Every later frame crosses as
245
+ `{w, f}`, the wire's name (`control`, `report`, `lane`) and the frame. The
246
+ hub's own machine signs in by its key alone, the one setup wrote its row
247
+ by. The hub takes one machine at a time.
248
+
249
+ `cli/hub.ts` is the hub's composition alone and imports no machine code
250
+ (the `hub-entry-no-machine` rule). Plain `vitki` runs it on one home with
251
+ direct previews and spawns its machine on that home. `vitki hub` runs it
252
+ with each preview relayed over its job (`hub/link/previewRelay.ts`), for a
253
+ `vitki machine --home <dir> --port <n>` on its own home: the hub's home
254
+ holds the database, the people and their items, the machine's its key,
255
+ `machine/link/`, its sandbox store, `agents/` and `servers/`. The machine
256
+ still reads the task folders, the profile's skills and scripts,
257
+ the Library editing folder and the repo's own tree from the hub's home by
258
+ path, so a machine on its own home runs no task until those move behind
259
+ jobs.
260
+
261
+ ### Source layout of the four big concerns
262
+
263
+ `hub/tasks.ts` is `TaskService`: its fields, constructor, startup/shutdown,
264
+ state hooks, and one thin delegator per method whose body lives under
265
+ `hub/tasks/`. Each module there exports plain functions taking the
266
+ service as `svc` (`export function wake(svc: TaskService, ...)`), grouped by
267
+ concern: `shared.ts` (helpers, constants and public types, re-exported from
268
+ `tasks.ts` so every `from '../tasks.js'` import still resolves), `startupPass.ts`
269
+ (the per-task startup pass), `lifecycle.ts` (create/setup/message/stop/resume/
270
+ teardown), `review.ts` (summaries, transcript, review watcher), `needs.ts` (vault,
271
+ need bindings, secret requests, inventories), `requests.ts` (secret/network/
272
+ script asks and decisions), `launch.ts` (session and one-shot sandbox launch, one-shot sandbox
273
+ creds), `messages.ts` (attention, task-to-task messages, overlaps),
274
+ `workflowConfig.ts` (definitions and per-workflow settings), `grants.ts`
275
+ (allowances, take-need, pins, skill reaches), `readiness.ts`,
276
+ `triggers.ts` (rows, cron clock, loop), `triggerRuns.ts` (wake/check/settle,
277
+ trigger scripts), `bundles.ts`, `runs.ts` (creating and advancing runs, step
278
+ reports, checkpoints), `runStatus.ts` (status/outputs/previews), `runAsks.ts`
279
+ (write-learnings/close-task/questions) and `runActions.ts` (publish,
280
+ script and action steps). Every internal
281
+ call still goes through the delegator (`svc.check(...)`), so tests that poke
282
+ or patch a method on the instance keep working; members those modules reach
283
+ are no longer `private`.
284
+
285
+ `ui/src/pages/Settings.tsx` is the tab shell plus the Repos table; each tab
286
+ and repo panel is one file under `ui/src/pages/settings/` (`AccountSection`,
287
+ `AgentsSection` with `AgentUpdateDialog`,
288
+ `AppearanceSection`, `NotificationsSection`, `KeyboardSection`, `RulesSection`,
289
+ `SecretsSection` with `NeedPanel` and `SecretRow`, `VariablesSection`,
290
+ `ResourcesSection`, `StateSection`, and the repo card's `RepoRow` with
291
+ `RepoNetwork`, `RepoSecrets` and `RepoLanguageServers`). The Library sections that used to
292
+ live there are under `ui/src/pages/library/` (`ScriptsSection` with
293
+ `ScriptRow`, `TriggersSection` with `TriggerRow`, `SkillsSection`,
294
+ `DuplicateDialog`).
295
+
296
+ `ui/src/components/AddSecretDialog.tsx` is the Add a secret dialog. It draws a Claude or Codex
297
+ login's `ConnectFlow` or `DeviceFlow`, which sit beside it, so the pickers that open it import no page.
298
+
299
+ `ui/src/pages/library/WorkflowsSection.tsx` is the pane entry (list, composer/run/proposals
300
+ wiring); everything else is under `ui/src/pages/workflows/`: `WorkflowRow`
301
+ (the open card), `CardSections` (How it runs with its verdict line and strip, Model, Secrets, the
302
+ workflow's files, runs link),
303
+ `StepCard`, `StepScript` (a carried script's step card) and `PromoteDialog`
304
+ (move to the Library),
305
+ `TriggerSection` (the card's Starts when rows and `Triggers`), `TriggerChips`
306
+ (the run-state chip and `ArmDoor`), `TriggerSettings` (the configure
307
+ dialog),
308
+ `triggerWords.ts` (pure wording helpers), `RunDialog`, `Composer`,
309
+ `Proposals`, `ExportEntity`, `jump.ts`.
310
+
311
+ `ui/src/lib/rows.ts` is a barrel over `ui/src/lib/rows/`, one file per row
312
+ family: `secrets` (the secret row ladder, repo secret rules, need picks,
313
+ policy rows), `hosts`, `runs` (caller ledger), `scripts` (allow words, skill
314
+ script rows, script status/standing, scope words), `carried` (bundle import
315
+ rows), `links` (`DESTINATION`, caller links), `actions`, `notify`, `triggers`
316
+ (when words, trigger rows/defs, arm refusals) and `explain`. Every importer
317
+ keeps `from '../lib/rows'`.
318
+
319
+ The Library's folder stores (sandbox images, themes, fonts, language servers, agents, apps, panels) extend one base,
320
+ `LibraryStore` in `hub/libraryStore.ts`, each driven by its kind's table entry (`IMAGE_KIND`, `THEME_KIND` and the like),
321
+ and `shared/libraryKinds.ts` is the table of each Library kind and the folder its items sit in. The repo item paths, the bundle,
322
+ the learnings, `vitki library`, the repos route and the Library editor's sandbox read it, and so do the profile folders
323
+ (`PersonHome.profileDirOf` in `config.ts`), the shipped roots in `shippedRoots.ts` and the item edit manifests in
324
+ `tasks/itemEdits.ts`. Your actions sit at `<own>/actions`, outside the profile. The item edit surface keys are keys, not folders.
325
+
326
+ The parse of bytes Vitki ships is kept once per process in `hub/shippedParse.ts`. A script, trigger, panel, workflow or app
327
+ reader hands `keptParse` the files it read and its own arguments. The parse is kept only when every file is, byte for byte, a
328
+ file of the Library folders or `harnesses` at `shippedRoot()`, and its key is that root, the reader, its arguments and
329
+ `hashFiles` over the files. A person's edited copy, or a shipped file edited on disk, is parsed on every read, and a new root
330
+ empties the set and the map. A kept step calls only a parser of its own arguments, never `knownFaults`, `withSyntaxProblems`,
331
+ `withChoicesProblems` or an agent's `lookups()`, which run on the value handed out on every call. A trigger's check faults and
332
+ a panel's choices and faults stay outside the kept step, and agents never use it. Every value handed out is a
333
+ `structuredClone`, and the map holds at most 2000 parses, the oldest dropped first.
334
+
335
+ Trust model: the container holds nothing that outlives the task. No git
336
+ secrets, no keys. The server never executes code from a path a container
337
+ can write to. Container input is data.
338
+
339
+ ## Host state — `~/.vitki/`
340
+
341
+ ```
342
+ ~/.config/vitki/
343
+ db.key the database key, 64 hex digits, 0600, made at the first start
344
+ (VITKI_DB_KEY_FILE names another file). A folder Vitki makes for
345
+ it is 0700, and a folder others can write is refused. A key
346
+ inside the home is refused. Transcript and thread lines are
347
+ sealed under a key made from it (hub/lineSeal.ts)
348
+
349
+ ~/.vitki/
350
+ vitki.db SQLite registry (see Registry), 0600 with its -wal and
351
+ -shm, the whole file encrypted with the key in
352
+ ~/.config/vitki/db.key, outside the home (hub/dbKey.ts).
353
+ Also holds the people, the browser sessions
354
+ (hashed ids) and the server's settings (the model list the
355
+ provider last served)
356
+ config.yaml port and auth.google_client_id[/secret] only (see Login)
357
+ users/<login>/
358
+ (a person's identity, the Google account (if any) bound
359
+ to this workbench (see Login), is a row of the
360
+ people table of vitki.db. A person's settings, guide chats, the interview,
361
+ trigger notes, secret uses and the marks on the
362
+ allows onboarding wrote are rows of vitki.db with
363
+ their owner, D526: user_settings, chat_turns,
364
+ chat_staged, interview_topics, trigger_notes,
365
+ secret_uses, hub/usersettings.ts)
366
+ profile/
367
+ workflows/, triggers/, panels/, themes/, fonts/, language-servers/,
368
+ apps/, agents/,
369
+ images/ your own Library folders, one folder per item
370
+ skills/<name>/ user skills, one folder each: skill.yaml beside
371
+ SKILL.md (the instructions only) and any carried
372
+ actions/<n>/ folders. Seeded into every task's
373
+ claude/skills/ as the standard SKILL.md, front
374
+ matter written from skill.yaml, carried scripts
375
+ left out
376
+ The files your file inputs hold are BLOB rows
377
+ of value_files beside the value, removed with it
378
+ (D438), and no container mounts them
379
+ agents/<agent>/<version>/<arch>/<binary>
380
+ Claude Code and Codex, one native binary each,
381
+ made into a read-only agent disk for each task
382
+ that pins it (D396, D681). Each
383
+ download is a row of agent_binaries, and the
384
+ versions a task started with are task_agents rows
385
+ shipped/ the copies of what Vitki ships, one per server start
386
+ actions/<name>/ your automation scripts, one folder each:
387
+ action.yaml beside the file its run: names and
388
+ any helpers (see Scripts). The allows pinned to
389
+ each folder's hash live in the registry
390
+ (a task's worktree, its git, its agent state and
391
+ its review folder are on its task disk inside the
392
+ VM, and the host keeps no folder for them, D680, D686,
393
+ but a copy of each session's conversation file, D1646)
394
+ tasks/<task-id>/
395
+ transcript.jsonl every stream-json event from the session
396
+ session-log/ a byte copy of each session's own conversation file,
397
+ claude/ path for path as /home/vitki/.claude and codex/
398
+ as /home/vitki/.codex/sessions (sessions/sessionLog.ts)
399
+ review/
400
+ snapshots/<sha> reviewed-file snapshots
401
+ runs/<run-id>/ one empty dir per script run, the mark that its id
402
+ ran. The run's own folder is made on the machine's
403
+ disk (see Scripts)
404
+ ```
405
+
406
+ ## Registry (SQLite, `~/.vitki/vitki.db`)
407
+
408
+ The schema at the latest version is one script, `SCHEMA` in `hub/schema.ts`, which a fresh home runs once.
409
+ The database carries its schema version in `user_version`. `MIGRATIONS` in `hub/migrations.ts` moves an older
410
+ home forward, one entry per version, all in one transaction at start after a copy of the database to
411
+ `vitki.db.bak-v<version>-<time>` beside it. Version 1 is `test/fixtures/schema-v1.sql`, frozen, and a home
412
+ marked with that text's hash is at version 1. A home at a newer version, with another mark, or with tables and
413
+ no mark is refused at start. A change to a table edits `SCHEMA` and appends a migration in the same commit, and
414
+ `test/schemaChain.test.ts` holds the two equal.
415
+
416
+ Tables (all ids are UUID4 strings, timestamps ISO-8601 UTC):
417
+
418
+ - `tasks(id PK, title, slug, model, state, created_at, updated_at, workspace,
419
+ image TEXT NULL, container_name, session_id, last_error TEXT NULL,
420
+ run_items TEXT, run_ended TEXT NULL, repos TEXT)` (run_items: v40, the run's checklist, see Scripts. run_ended: null while a run goes, else
421
+ how it ended, one of `you`, `could-not-start`, `steps-done` or `closed`, the `RunEnded` type in `registry.ts`). `workspace` is the folder every repo of
422
+ the task sits in, a path inside the guest alone. `image` is the task's own image
423
+ pick: `-image-<id>` for a Library image, `-library` for the account's, NULL to
424
+ follow the space's pick, else the account's (`shared/imagePicks.ts` taskImage).
425
+ `repos` is the task's zero or more repos as JSON, the checkouts Vitki clones
426
+ from the git endpoint for its image's repos: each repo's ID, folder, branch, base,
427
+ `baseSet`, `prUrl` and `keptStat`, in the order they joined. The hub keeps no
428
+ repo of its own. `space` is the space the
429
+ task started in, NULL for You, and never changes. `shared` is 1 for a task
430
+ shared with the members of its space, set at the start, its starter staying
431
+ its owner. `asks_to` (`starter` or `members`) says whose Needs you its asks
432
+ reach, copied from the start that made it. `parent` names the task that
433
+ started a subtask, NULL for a task a person started, and `view_of` the task
434
+ whose working tree a view subtask reads read only (`vitki task start
435
+ --own|--view`). Closing or removing a task takes every task below it, the
436
+ deepest first (`hub/tasks/lifecycle.ts`).
437
+ - `approvals(id PK, task_id, intent, payload JSON, state{'pending','approved',
438
+ 'rejected','expired'}, created_at, decided_at)` — pending secret asks
439
+ (`intent: 'credential'`, payload `{name, reason, command, cwd}`; the row id
440
+ is the request id). Every intent (`credential`, `variable`, `network`, `script`, `action`, `learn`, `ask`,
441
+ `notify`, `session-verb`, `preview`, `show`) parks, lists and is answered through `tasks/asks.ts` (`parkAsk`,
442
+ `pendingOf`, `settleAsk`, and `rememberAnswer` for the rule a remembered answer leaves), and its payload reads
443
+ through its row in `tasks/askPayloads.ts`, so a new intent is one row there. The egress proxy parks its own
444
+ network rows. A few marks still write the row by hand, each one a withdrawal or a sweep rather than an answer to
445
+ the card: a saved rule settling the preview asks it now decides (`rules.ts`, in the acting person's rows),
446
+ words put on a card (`talk.ts`, `talkBackVerb` in `verbs.ts`), a script's own card expiring or refused
447
+ (`scriptVerbs.ts`), and the asks a stopped task takes back (`takeBackAsks` in `lifecycle.ts`). The asks an ended run
448
+ takes back on a task go through `settleAsk` (`runOnTask.ts`). Moving the rest onto `settleAsk` is a follow-up.
449
+ - `rules(owner, layer_kind{'account','space','task','script','panel','trigger','app'},
450
+ layer_id, action, params JSON, answer{'allow','deny'}, pin, created_at,
451
+ PK(owner, layer_kind, layer_id, action, params))` — every rule, the one table
452
+ that replaced `grants` (whose stored rules its migration dropped). `action` is a
453
+ key of `RULE_ACTIONS` (`shared/contract/ruleSpec.ts`), which gives each action its
454
+ params and their types (`argv`, `host`, `path`, `package`, `token`), the layers
455
+ it sits at, the pin its allow carries and the params that take a wildcard.
456
+ `params` is the JSON of every param of the action with sorted keys, so one
457
+ rule is one row. Account rows have `layer_id = ''`, a script's or a trigger's
458
+ is its full path, an app's card's the app's key, and a workflow is no layer (the
459
+ CHECK refuses it). The app layer holds `list-tools` alone. `pin` is what an
460
+ allow counts for (a script's body, a trigger folder and workflow version, a
461
+ panel's folder, an app's mcp.yaml), empty on a never. `writeRule` (`tasks/rules.ts`)
462
+ is the one writer and `decide` (`tasks/decide.ts`) the one reader: any never,
463
+ then any allow whose pin still holds, else ask, with the off switch (a never at
464
+ your account on `use-secret` for every command) read first. The rules routes
465
+ speak the action and its params: `POST /api/rules` and `PUT /api/rules/:key`
466
+ take `{ layer, action, params, answer, shown? }`, where a param given as a list
467
+ saves one rule per value, `GET /api/rules` rows carry `params` and `names` (an
468
+ entity for each param value that names a thing, so a row shows a name while the
469
+ rule stores an id), and `POST /api/rules/test` takes `{ where, callers, request:
470
+ { action, params, need? } }`. The UI words every rule through `ruleWords`
471
+ (`ui/src/lib/rows/ruleWords.ts`), one verb per key of `RULE_ACTIONS`. Asks,
472
+ shipped allows and renewals still speak a slot and a pattern, read through
473
+ `fromSlot` and `toWire` (`tasks/ruleParams.ts`).
474
+ - `scripts(name PK, description, approved_hash NULL, created_at, updated_at)` —
475
+ the installed scripts' descriptions (v12; see Scripts). `approved_hash` is
476
+ the pre-v39 pin, no longer read. The
477
+ script itself is the folder `~/.vitki/actions/<name>/`.
478
+ - v13 adds `owner TEXT DEFAULT ''` to repos/tasks/scripts/grants/approvals/
479
+ net_denies. v69 dropped every row whose owner was `''` (D429), and nothing
480
+ backfills an owner.
481
+ - `learning_candidates` existed until v3; learnings now go straight to files
482
+ (see Learnings).
483
+ - `spaces(owner, id, name, created_at, agent_picks, parent, shared, key_due, archived_at, PK(owner, id))`: a space, in its
484
+ owner's rows. `parent` is NULL for a space under You, else the space it sits under, set at the make and never changed.
485
+ `agent_picks` holds the space's own model picks whole, and its image pick is a pick like an input's (`IMAGE_PICK_PARAM`). `shared` is 1 for a space with members,
486
+ set at the make, and a space under a shared one is shared. `archived_at` is set while its owner keeps it archived:
487
+ its Library items and Context are read only and read by no task in it or below it. The chain a task reads, its space
488
+ and every space above it nearest first, is walked by one owner, `shared/spaceChain.ts`. A space's Library items sit
489
+ in a folder of its own beside yours (`hub/spaceLibrary.ts`).
490
+ - `space_members(owner, space, person, added_at, PK(space, person))`: the members of a shared space beside its owner,
491
+ who is the `spaces.owner` column and never a member row. Removing a member takes them out of every space below and
492
+ stops the tasks they started there (`hub/tasks/spaceMembers.ts`). `space_news(id, owner, space, kind{'rule','message'},
493
+ by, task, task_title, rule, at)`: what members did in a shared space, for Activity. `join_links(id, token_hash,
494
+ kind{'open','email','domain'}, target, owner, space, made_by, made_at, expires_at, held_by, used_at)`: an
495
+ organization's invite links on a hosted hub, the token kept only as its hash.
496
+ - `space_keys(owner, space, version, public_key, chain_sig, by, created_at, PK(space, version))`: a shared space's key
497
+ chain. Each version's Ed25519 public key is signed by the version before it, the first by itself, over
498
+ `spaceKeyMessage(space, version, pub)`. `space_key_seals(owner, space, version, holder_kind{'person','machine'}, holder,
499
+ sealed)`: the space key's seed sealed for one holder's vault key, newest version only. `space_secrets(owner, space, name,
500
+ title, description, kind{'text','file'}, file_name, size, key_version, sealed, by, exposed, created_at, updated_at,
501
+ PK(space, name))`: a shared space's own secrets, sealed for the space key, their full name `<space>/<name>`.
502
+ `spaces.key_due` marks a space a member left until its owner sets the next key. All in the space owner's rows (see
503
+ Vault, Space keys).
504
+
505
+ Every state machine (states, invariants, transition tables) is documented in `docs/state-machines.md`.
506
+
507
+ `tasks.state` is one of the seven below, and the moves between them are the table in `docs/design/tasks.md`, held to
508
+ `shared/core/taskState.ts` by a test:
509
+
510
+ ```
511
+ creating worktree/container being set up
512
+ working a turn is running
513
+ waiting a card of this task is open (a question, an ask, a checkpoint): it needs the user
514
+ idle the session finished a turn, no card open
515
+ stopped asleep: container gone, worktree and disk kept; a message wakes it
516
+ done the task ended; branch kept, and the disk until Remove
517
+ failed the session or a wake failed; see last_error
518
+ ```
519
+
520
+ An open card holds an awake task on waiting, and the state the session has is kept for when the last card closes
521
+ (`holdOrSet` in `tasks.ts`). A wake under an open card writes waiting in one write, judged as two moves: to Idle, then Idle
522
+ to Waiting. A turn that ends on a question reads Idle, since only a card makes a task wait (D841).
523
+
524
+ **Sleep.** `stopped` is not a user-facing state: the UI shows it as Asleep,
525
+ and there is no Pause/Resume — the only lifecycle actions are Stop (and Retry
526
+ from `failed`). No timer puts an idle task to sleep, and no other task's start does. A task
527
+ sleeps only at Stop, and a message to a
528
+ sleeping task restarts container and session before sending; the composer notes that the
529
+ first message takes a few seconds.
530
+
531
+ **No built-in task flow (D313).** A plain task has no phase and no fixed road.
532
+ The session launches with its edit tools on and is told nothing about design,
533
+ approval or build. Design first, approval, build and review are what a workflow
534
+ says, like Build a feature, never what every task does, and no `implement` or
535
+ `phase` route exists. No review runs on its own: a review skill starts when you
536
+ press Enter on its slash command in the composer. A review skill is a skill
537
+ like any other: skill.yaml has no `review-pass` key (D495), and no drawer press
538
+ or palette entry runs one. The command goes to the task's own session, so the
539
+ skill runs on the task's model and agent with no settings of its own. The skill
540
+ asks what to review and how and posts its findings as new threads with
541
+ `vitki review post`. The server signs each thread it writes for the session
542
+ (`signPost` in `tasks/verbs.ts`): the author is the `--author` the session
543
+ gave. `signPost` fills only a missing one, with the title of the skill whose
544
+ command started the turn the thread was posted in (`turnCommand` in
545
+ `sessions/manager.ts`), or else the agent. There is no apply step: fixing a finding is the
546
+ session's work, answered in the thread with
547
+ `vitki review reply --action applied`, and a review with its own model or agent
548
+ is a workflow step.
549
+
550
+ Task-to-task state (v14/v15): `tasks.attention` + `attention_at` hold the
551
+ session's one-line reason it needs the user (`vitki task set waiting`), cleared by
552
+ the user's next message. `task_msgs` holds the relayed notes
553
+ (pending/delivered/denied/held, and scheduled/cancelled for a note sent with
554
+ `--in`, which carries `delay_min` and, once let through, `deliver_at`). The standing delivery allows are `msg` rows
555
+ in `rules` (the `msg_rules` table became them), and the `proposals` table of
556
+ the dropped `vitki propose` verb is unused.
557
+
558
+ ## Container layer (`machine/sandbox/tool/`)
559
+
560
+ A task runs in a microVM with its own kernel, made through `SandboxBackend`
561
+ (`machine/sandbox/backend.ts`). No host folder is shared into any sandbox
562
+ (D672, D676). Everything the host and a guest say to each other rides vsock, and
563
+ everything a guest has on disk is a block device the VMM hands it. Linux runs
564
+ Firecracker (`sandbox/microvm/firecracker.ts`, KVM, D677). macOS runs vfkit
565
+ (`sandbox/microvm/vfkit.ts`), the same VM and the same guest program on
566
+ Virtualization.framework: vfkit takes its VM from a command line, the host dials one Unix
567
+ socket for each guest port with no handshake (`sandbox/microvm/vsock.ts`), its REST API has a VM
568
+ state and no balloon call, and a VM has the machine's memory with the guest cgroup holding
569
+ the limit. A Mac stays untested until `make check-vm` passes on one (the checklist is
570
+ "The first Mac" in docs/design/open.md), and the requirements line and `doctor()` say
571
+ "macOS: untested". Only `machine/sandbox/microvm/index.ts` is imported from outside that folder, and the rule vm-drivers-behind-index in tools/dependency-cruiser.cjs fails any other import.
572
+ The pick is by platform, in `sandbox/home.ts`. No other runtime is kept, and
573
+ microsandbox is gone. Image builds, agent calls and local MCP
574
+ servers take the host port of the proxy from the active proxy, not from the guest relay's env, and the
575
+ guest redials a vsock connect that Firecracker resets. No other code calls a VMM.
576
+
577
+ A person needs KVM on Linux (or Hypervisor.framework on a Mac with Apple silicon) and no Docker.
578
+ `mke2fs`, which writes each disk, comes with Vitki: `machine/sandbox/microvm/mke2fs/vendor` holds a static one for Linux
579
+ x64 and arm64 and one for darwin arm64, built from pinned e2fsprogs source (`machine/sandbox/microvm/mke2fs/SOURCE`), and
580
+ `sandbox/microvm/ext4.ts` falls back to the host's own. Firecracker v1.17.0 and Firecracker's own CI
581
+ kernel (6.1.155, x86_64 and aarch64, virtio-mmio and virtio-pci both on) are fetched on
582
+ first start through `downloadThroughProxy`, checked against sha256 values pinned in code
583
+ (`sandbox/microvm/vmFetch.ts`) and cached per user under `~/.cache/vitki/vm`, shared by every
584
+ home. A Mac fetches vfkit v0.6.4 (the release binary, signed with the virtualization
585
+ entitlement, which `sandbox/microvm/vfkitAssets.ts` checks and re-signs a copy of when it is missing) and the arm64
586
+ kernel the same way. The kernel's config is checked before it boots (`sandbox/microvm/kernelConfig.ts`) for both
587
+ virtio transports, what Docker needs and `VSOCKETS_LOOPBACK` off, and a kernel that fails
588
+ is refused. That kernel has no FUSE, TUN, DUMMY or `NETFILTER_XT_MARK`, so AppImage, sshfs,
589
+ rclone mount, rootless podman and VPN clients do not work in a task (D677).
590
+
591
+ Each VM is spawned detached in its own session, so it outlives the server, and lives in
592
+ a folder `<vitki home>/fc/vm/<12 character id>/` with its config, its state (pid, name,
593
+ labels, drives), its API socket and its vsock socket. A server that starts again finds a VM
594
+ by that folder, the pid in it, a cmdline that names its API socket and the id the socket
595
+ answers. The id is short so every socket path stays under 108 bytes, which holds the
596
+ store path to 79 bytes (`storeTooLong`). A VM boots in about 0.6 s. Seccomp stays on and
597
+ there is no jailer, since it needs root. Each VM also runs in a `systemd-run --user
598
+ --scope` that holds its memory and CPU to the machine's, a backstop for a guest root that
599
+ leaves its cgroup, and `doctor()` says whether it is on.
600
+
601
+ Image (`Dockerfile.template`, `{{from}}` and `{{image_lines}}` substituted):
602
+
603
+ - `FROM {{from}}`: the sandbox image's base (D395), `<base>@<digest>` when
604
+ the image pins a digest. The sandbox image's own lines follow, one `RUN` for
605
+ its apt packages, then its packages of other sources. After every package come the image's build steps, as root: one
606
+ `RUN` per run-shell line, and per run-action step one `RUN` that binds the
607
+ action's files from the build context's `steps/<n>/` and sources its inputs
608
+ from `steps/<n>.env` (`buildLines` in `shared/images/recipe.ts`). The hub
609
+ resolves each action to its script by the owner's rules (`hub/imageSteps.ts`)
610
+ and sends the files with the job.
611
+ - The image runs as it is. The template adds no `gh`, `git`, `python3`, `jq`,
612
+ `iproute2` or `musl` (the sandbox image lists what its tasks need, and `vitki-sandbox`
613
+ and the start step bring the rest), and it sets no `PATH`, `SHELL` or `ENTRYPOINT`:
614
+ the image's own `PATH` stands, its lines run under `/bin/sh -c`, and the runtime
615
+ runs no entrypoint. Vitki puts its folders on `PATH` when a run starts (`devcontainer.ts`
616
+ for a task, `SANDBOX_PATH_FIRST` in `sandboxMount.ts` for every other exec path: a script or
617
+ command one-shot sandbox, a local MCP server, the Library editor and its language servers). What the template does hold is `HOME=/home/vitki` and the lines that run as uid 1000 (the package and language server lines,
618
+ with `HOME=/home/vitki`). A line that fetches binds the sandbox tools folder of the build
619
+ context and points every tool at the root bundle there (`FETCH_MOUNT` and `FETCH_ROOTS`
620
+ in `packages.ts`), so the image keeps no copy of the roots. The language
621
+ servers are not in the image: they install once on the host into the server store (D696). The image holds no user of Vitki's: user `vitki` is
622
+ made when a sandbox starts (see `vitki-sandbox prepare` below). The image installs no Docker, no Node,
623
+ no agent, no firewall and no host list. gh comes with the shipped
624
+ Vitki tools image (`images/vitki-tools`), the default, which the shipped items that call gh name
625
+ (`image: vitki-tools`), so they run on it whatever the task's or repo's image. An item can name an image (`image:` in action.yaml, panel.yaml and under
626
+ a check, resolved by `runImagePart` in `shared/imagePicks.ts`: the item's own, else the task's,
627
+ else the repo's, else the account's). A run that names an image builds it from the Library
628
+ image alone, through the proxy, the first time it is needed (`ensureItemImage`), under the
629
+ repo part `-image-<id>`. A script that calls a tool the image lacks declares
630
+ `install <package>` under `may:` and asks through `vitki install` (D623). A repo gets Docker the way
631
+ it gets any tool, from the sandbox image it runs on,
632
+ and that Docker runs inside the task's VM with its data on the task's disk.
633
+ - The `vitki.recipe` and `vitki.image` labels the server
634
+ reads to say an image needs a rebuild. The recipe (`imageRecipe`) hashes the
635
+ inputs and the steps Vitki writes into the build: the sandbox image,
636
+ the pinned metadata label, and
637
+ `vitkiBuildSteps` (the home line, the template's user and
638
+ home lines, the wrapper of a feature's RUN) with the hand-bumped `TEMPLATE_EPOCH`. The
639
+ template text alone is not in it, so a comment edit never makes an image need a rebuild.
640
+ - The tools come on a read-only tools disk, an ext4 file that `volumes.fromFolder` makes
641
+ from `machine/sandbox/tool/dist/linux-<arch>` and `ca.pem` and makes again when the
642
+ folder's hash changes, so an edit lands on the next start with no rebuild. The kernel
643
+ boots it as the root file system with `init=/vitki-sandbox`, and init binds it read only
644
+ at `/vitki/sandbox` (`sandboxToolDir()` in `shared/sandbox/places.ts`). It holds
645
+ `vitki-sandbox`, one static Go program (source in `machine/sandbox/tool`, no module
646
+ required) that answers to the name it is run by: `vitki` (the client CLI) and
647
+ `vitki-script` are links in `/vitki/sandbox/bin`, which is first on the PATH of a
648
+ sandbox. No MCP server reaches a session: an app's MCP action is called by Vitki from
649
+ the host (`callMcpAction` in `hub/tasks/mcpCalls.ts`). Its other names are `prepare`, `probe`, `proxy-forward`,
650
+ `release`, `cgexec`, `cgmount`, `seed`, `serve`, `export`, `apply`, `layer` and
651
+ `claude-login`. Nothing is mounted over a path of the image.
652
+ - A Claude session's login is the task copy of Claude Code's login file, with the refresh token void. No host folder
653
+ reaches a VM, so the host writes it through the guest agent's own write op (tmp, then rename), root owned, mode 0444,
654
+ into the session's config folder, before the session starts and again when a renewal lands while it runs. The same
655
+ op writes it on Firecracker and vfkit alike.
656
+ - The agents are not in the image: Claude Code and Codex are kept on the host, one native
657
+ binary per agent, arch and pinned version (`agentBinaries.ts`, D396), and each version
658
+ is made once into a read-only agent disk (`/opt/vitki/agents/<id>`) that a task gets
659
+ with its folders first on `PATH`.
660
+ - `vitki-sandbox prepare` runs as root, from init (`machine/sandbox/tool/init_linux.go`,
661
+ D676), in every VM that runs as the guest user (a task, a script or command one-shot sandbox, an
662
+ MCP server, the Library editor), before anything runs as that user.
663
+ `prepareGuest` (`sandbox/prepare.ts`) runs it again as an exec, which is safe. The image holds no user of
664
+ Vitki's. `prepare` makes user `vitki` (uid 1000, home `/home/vitki`) by
665
+ editing `/etc/passwd`, `/etc/group` and `/etc/shadow` as text. A base's own
666
+ uid 1000 user is renamed `vitki`, its groups kept, and each entry of its old
667
+ home linked into `/home/vitki` with nothing copied. `vitki` leaves the
668
+ `sudo`, `wheel` and `admin` groups, every file of `/etc/sudoers.d` goes,
669
+ `/etc/sudoers` keeps only root's own lines, and the `Plugin` lines of
670
+ `/etc/sudo.conf` go, so `vitki` has no sudo whatever the base says. The
671
+ `docker` group stays: root in the guest cannot write a read only disk
672
+ (`readOnlyVm.test.ts`). Every path `prepare` writes as root is refused when
673
+ it is a symlink, a hard link or not the kind of file expected. It also writes a minimal
674
+ `~/.claude.json`, the codex folder, the review config and the task disk's
675
+ owner. It sets no network up. On the CI kernel it also switches `iptables` and `ip6tables` to their legacy alternatives when the image has both, so Docker runs in a task (D681). A task's `PATH` starts from the `PATH` of the
676
+ image's config, since a spec `PATH` replaces the image's own.
677
+ - `prepare` also brings the agents' runtime and the root certificates (NL P3).
678
+ It links `/lib/ld-musl-<arch>.so.1` to the loader in `/vitki/sandbox`
679
+ (Alpine's musl, pinned in `machine/sandbox/tool/vendor`), only when that path is
680
+ missing, so an image with a musl of its own keeps it. It merges the bundle
681
+ Vitki puts at `/vitki/sandbox/ca.pem` (Node's roots and the host's, written
682
+ beside each vitki-sandbox in the copy of the shipped folders) with the image's own
683
+ bundle into `/run/vitki/ca.pem`, each certificate once, and writes the same
684
+ file at `/etc/ssl/certs/ca-certificates.crt` when that path is free. Every
685
+ guest-user spec sets `SSL_CERT_FILE`, `CURL_CA_BUNDLE`, `GIT_SSL_CAINFO`,
686
+ `REQUESTS_CA_BUNDLE`, `PIP_CERT`, `NODE_EXTRA_CA_CERTS` and
687
+ `CARGO_HTTP_CAINFO` to `/run/vitki/ca.pem`. Vitki has no CA of its own: the
688
+ egress proxy ends no TLS.
689
+ - `vitki-sandbox probe` prints one JSON line about the image it runs in: a shell,
690
+ bash, git and python3 with their versions, the os, the arch, glibc, a CA
691
+ bundle, the image's uid 1000 entry and dpkg's package list. After each
692
+ build the server runs it in a sandbox of the built image (no network, as
693
+ nobody) and keeps the facts in `contents.probe` of the build record. The
694
+ repo's `imageProbe` is the newest build's, null until it ends.
695
+
696
+ A builder is a microVM too (`sandbox/builder.ts`, D613): it runs the pinned BuildKit
697
+ image, which `images.pull` fetches through the proxy as Vitki's own request (`vitki-image
698
+ pull`, D681), builds the repo's image through the proxy and writes it as an archive on
699
+ the exec's stdout. `images.load` pipes that stream into `vitki-image ext4`, which applies
700
+ the layers with their whiteouts and writes one read-only ext4 with root owners and modes
701
+ kept, with no root and no archive on the host. Labels, env, user and workdir go to a
702
+ `config.json` beside it. `vitki-image` is a host-only Go program in its own module
703
+ (`machine/sandbox/microvm/image/`, built by `make image-tool`), so the guest's `go.mod` requires nothing.
704
+ Each repo keeps a cache disk for the builder, removed with the repo. Docker is used by no
705
+ build.
706
+
707
+ The task's sandbox is made from a `SandboxSpec` (`taskSpecOnDisks` in
708
+ `sandbox/spec.ts`; no spec carries a writable host mount), never from a rendered config file:
709
+
710
+ ```
711
+ name vitki-<person>-h<home>---task-<slug>
712
+ image the task's sandbox image in the store, a read-only ext4
713
+ labels vitki.kind=task, vitki.task=<id>, vitki.owner=<person>, vitki.home=<hash>
714
+ user 1000:1000 (named vitki by vitki-sandbox prepare)
715
+ cpus, memory every CPU and the machine's memory less 2 GiB (`sandboxSize`), fixed for the VM's life
716
+ disks the tools folder, which the backend turns into the tools disk, the VM's root, read only
717
+ the image disk, read only
718
+ the task disk, read and write -> /vitki/disk, its work/ folder bound at the workspace's path
719
+ an agent disk per pinned agent version (made from the agent folder), read only -> /opt/vitki/agents/<id>
720
+ ports none: the preview proxy dials the guest's port 4000 over vsock (backend.dialPreview)
721
+ network none: no device, the proxy reached over vsock
722
+ env VITKI_TASK, VITKI_AUTHOR, VITKI_REVIEW_DIR, VITKI_WORKSPACE (the workspace root),
723
+ VITKI_PREVIEW_PORT=4000, PATH (agent folders first), the proxy env,
724
+ the repo's container env
725
+ ```
726
+
727
+ No host path is in a spec. The kernel command line names the drives by role
728
+ (`vitki.drives=image:vdb,task:vdc,servers:vdd,agent.claude:vde`) and init checks each drive's
729
+ file system label (`vitki-` and the role, 16 bytes at most) before it mounts it. A task has no repo disk:
730
+ each repo is a checkout on the task disk (The task disk, below). A one-shot sandbox's one copy disk is the
731
+ role `copy` at `/vitki/copy`. A script's one-shot sandbox that reads several repos has each repo's copy as the
732
+ role `copy.<n>`, and `vitki.repos=<folder>,<folder>` names the folder of each, so init mounts `copy.<n>` at
733
+ `/vitki/copies/<folder>`. A repo drive is refused. The other
734
+ keys are `vitki.upper` (`task` or `tmpfs`), `vitki.net` (`relay` or `none`), `vitki.time`
735
+ (the epoch, since x86 Firecracker has no RTC), `vitki.version`, `vitki.digest` and
736
+ `vitki.work`. A VM boots with at most 14 drives (`vmStore.ts` MAX_VM_DRIVES, measured on
737
+ Firecracker 1.17 x86_64, where the VMM gives up at 15 beside the vsock, the balloon and the memory
738
+ hotplug device), and a spec past that is refused in words. The kernel line, with the line Firecracker
739
+ adds per device, stays under 2048 bytes (`fcConfig.ts` bootLineRefusal), which long copy folder names
740
+ can reach first. Init mounts the image disk read only, puts an overlay over it whose upper is the
741
+ task disk's `root/<image digest>/` folder (a tmpfs for one-shot sandboxes, the Library editor and agent
742
+ calls), pivots into it, moves the tools disk to `/vitki/sandbox`, runs `prepare`, binds the task
743
+ disk's folders and starts the control agent. Packages installed as root last until the image
744
+ changes, since a wake with another digest drops the other uppers. An image switch (`PUT /api/tasks/:id/image`, TM11) is such a wake:
745
+ an idle awake task is stopped and resumed through `resumeAdmitted` under the `wakingTasks` mark with `task.image` set to a sandbox image of
746
+ your Library, or null for the space's or the account's image, so the disk and the conversation stay and what root installed goes.
747
+ A wake that makes a new sandbox (`bringBackOnce`) sets the `task_sandbox` key `wake_note` to `1` when no key stands, and a switch
748
+ sets it to `imageSwitchedLine`. The next `TaskService.message` ends with `WAKE_NOTE`, then the image line when there is one, and drops the key once sent.
749
+ `GET /api/tasks/:id/image` answers where the image comes from and the Library image it is.
750
+
751
+ **The task disk** is one sparse ext4 (`mke2fs -t ext4 -i 8192`), made at the first start with
752
+ the size it keeps for the task's life (D614) and removed with the task. Its folders:
753
+
754
+ - `work/` is bound at the task's workspace (`tasks.workspace`), a path inside the guest
755
+ alone, and each repo lives in its folder of it (`task_repos.folder`) with its own `.git`,
756
+ cloned there by Vitki before the image's start steps (docs/design/tasks.md, Repos join a task).
757
+ Execs start in the first repo's folder, or the workspace for a task with no repo.
758
+ - `agent/claude` is bound at `/home/vitki/.claude` and `agent/codex` at
759
+ `/home/vitki/.codex/sessions`, so `--resume` keeps working across sleeps. The transcript
760
+ Vitki shows is still written by the host from the exec's stream. The host copies each
761
+ session's conversation file to `tasks/<id>/session-log/` through the sandbox (a turn's
762
+ end, once a minute in a turn, the session's exit, Stop and Done before the destroy), and
763
+ a launch that resumes writes back what a guest that lost the file lacks (sessions/sessionLog.ts).
764
+ - `review/` is bound at `/vitki/review`, a folder of the guest alone that the CLI reads
765
+ (`config.json`, `run/available.json`, `previous.json`), written by the seeds and by
766
+ `files.write`.
767
+ - `user/` is bound at `/vitki/disk` (D614), and `root/<digest>/{upper,work}` is the
768
+ overlay upper above.
769
+
770
+ The Disk row of Resources counts the whole disk, the worktree included.
771
+
772
+ **The git layout.** The host keeps no clone of a task's repo, and no repo disk exists. Vitki
773
+ clones each repo of the image, before the start steps, into its folder of the workspace on the task disk, on the task's one branch.
774
+ Each checkout's remote is `http://vitki.internal/git/<host>/<repo path>`, the git endpoint the machine
775
+ serves behind the wall, so the agent types plain `git fetch` and `git push`. The endpoint decides each
776
+ call by the task owner's rules and puts the sign-in the hub hands it on the forge request alone, so no
777
+ secret enters the task's VM (docs/design/tasks.md, A checkout fetches and pushes through the machine's
778
+ git endpoint).
779
+
780
+ **The control protocol** (`sandbox/microvm/agentClient.ts`, `machine/sandbox/tool/agent_linux.go`, D676).
781
+ The host dials vsock port 5000 and sends one JSON line naming the verb and the user, then
782
+ reads frames of one type byte and a 4 byte big-endian length: to the host 1 stdout, 2
783
+ stderr, 3 exit code, 8 error, 9 started (the pid), from the host 4 stdin, 5 stdin end, 6
784
+ signal, 7 resize. Every request ends with frame 3, a failure sends frame 8 first, a file
785
+ error starts with an errno name (`ENOENT:`), and a timeout sends 8 `timeout` and exits 137.
786
+ The verbs are `hello`, `exec`, `write`, `read`, `stat`, `settime`, `limits`, `metrics`,
787
+ `dropcaches` and `halt`. Every call names a user, and root file calls and binds never follow
788
+ a link, since the guest user owns the home they land in. An exec runs in a cgroup
789
+ namespace rooted at the work cgroup, whose leaf is `work/exec`, so a nested Docker stays under
790
+ the task's limits, while init, the agent and the relays run in `vitki/system`. Stdin an exec
791
+ has not read is held up to 128 MiB for one request and 256 MiB for all, and past either cap the
792
+ request gets frame 8. The client connects with a 2 s budget and retries three times
793
+ with backoff, only on a connect that got no answer, and an exec that started is never
794
+ retried (`sandbox/microvm/vsock.ts`). A sustained failure reads "The sandbox is not answering." on the
795
+ task, with Retry.
796
+
797
+ **vsock.** Port 5000 is control. Port 4000 is the preview: nothing listens for it on the
798
+ host. The task's preview proxy asks the backend's `dialPreview` for one vsock connection to the
799
+ guest's port 4000 per request or websocket, and the guest dials `127.0.0.1:4000`, then `[::1]:4000`, so
800
+ a server on the loopback alone is a preview (D624) and no forward program runs. Port 5100 is
801
+ egress, guest to host: the guest's relay listens on `127.0.0.1:3128` and on `100.64.233.1`
802
+ (put on `lo` by init, since the CI kernel has no dummy driver, so nested containers reach it
803
+ too), and each connection on the VM's `v.sock_5100` is joined to the egress proxy's loopback
804
+ listener (`sandbox/microvm/fcEgress.ts`). The relay holds at most 256 connections for one VM and
805
+ 2048 for all VMs together. Each costs the server 3 descriptors (the guest's, the dial and the
806
+ proxy's accepted socket), so the total costs 6144, under a Mac's `kern.maxfilesperproc` of
807
+ 10240 with room for the API, since vfkit caps no guest (Firecracker caps each VM at 1023).
808
+ One past a VM's bound gets 429. At the total, the VM holding the most gets 429 and any other
809
+ gets in by closing that VM's newest connection. The proxy answers a request head that does
810
+ not arrive in 30 seconds with 408 and closes it. No guest has a network device, so a direct
811
+ connection and a DNS lookup fail at once. A VM made with `vitki.net=none`, like the probe, has no relay.
812
+
813
+ **Reads of a task's files** go through the sandbox alone (`tasks/worktreeReader.ts`, D680,
814
+ D684). One `vitki-sandbox serve` exec per awake task, started in the task's workspace, answers
815
+ `changes`, `diff`, `cat`, `tree`, `grep` and `stat` as a line protocol, runs git with
816
+ `GIT_OPTIONAL_LOCKS=0`, opens each file with no link followed and caps every reply. Every path
817
+ in a request and a reply starts at the workspace, which holds a folder for each repo: the verbs
818
+ that read one repo's git (`mergebase`, `changes`, `diff`, `stat` and `cat` at a revision) name
819
+ its `folder`, `tree` and `grep` go over the `folders` named, and `cat` of the work tree reads any
820
+ path of the workspace, or stays in one folder when it names it. A folder is one plain name of the
821
+ workspace and never a link, and a path through a repo's own `.git` is never read or written. A `changes` reply names the
822
+ remote's default branch as the clone's `origin/HEAD` names it, which the hub keeps on the task's repo as `defaultBase`: a repo
823
+ with no base of its own is diffed against it, and the repo's head in Changes reads "from <base>" only off it. A read that runs out of its budget (5 s,
824
+ 20 s for a search) fails on the view with "The task's sandbox is busy. Try again.". Changes, a
825
+ file view, the open-anything box, a search, the `@` picker, a script run, a save and a message
826
+ wake a sleeping task first. The task page, the board, the overlap warning,
827
+ the `/` menu and Run a workflow never wake it: they read values written while the task was
828
+ awake, the columns `kept_stat` and `kept_skills` of each repo of the task (each repo against its own base, the
829
+ task's numbers being the repos added together), `kept_at` of the task row, and the repos' item snapshots,
830
+ one folder for each repo in that repo's home. Those values are exact, since a sleeping task cannot change. A write goes through the sandbox
831
+ too, with `files.write` and the guest verb `vitki fileput` (D609 is superseded), and a write to a
832
+ sleeping task wakes it.
833
+ `tools/check-worktree-reads.mjs` in `tools/gates.sh` fails when `task.worktree` or `task.workspace` reaches an `fs`
834
+ call, a `runGit` or `execFile` cwd or a `-C` argument in `hub/`, `machine/`, `shared/` or `cli/`.
835
+
836
+ **The door to a stored secret** (`core/grant.ts`, `tasks/decide.ts`). A `SecretGrant` names one secret of one person and
837
+ is the only key the openers of `SecretsStore` take (`secret`, `token`, `secretFileBytes`, `signInSet`, `renewSignIn`),
838
+ each refusing a grant for another person or one `decide.ts` did not mint. `decide.ts` keeps every grant it
839
+ mints in a module-private `WeakSet` and opens the door of `core/grant.ts` once as it loads, so a parsed, cast or copied object
840
+ opens nothing. `decide()` mints one on an allow of a secret request,
841
+ `secretGrant()` on a press or a decision over the caller's stack (a never there refuses it, and a press records the use), and
842
+ `SecretsStore.hostToken()` (through `ownCallGrant`) for Vitki's own clone, fetch and API read. That one makes and spends its
843
+ grant inside the store and names only the text secret the host's pick points at for the repo. The forge's doors
844
+ (`repoApiToken`, `repoAuthProvider`) refuse any source but a store `profile.ts` made, which it registers once through
845
+ `openStoreDoor`. A secret you name on Add repo or Check is your press, and `forge/press.ts` opens it through `secretGrant()`
846
+ over your account. `tools/check-secret-reads.mjs` in `tools/gates.sh` fails a door named outside its files (an import, an
847
+ alias, a `.call`, an element access, a namespace import or an `export *` of its module included), `hostToken()` outside
848
+ `forge/index.ts`, `Vault.open` outside
849
+ `profile.ts`, an `any` where a grant goes, a login opener outside its files and a cast to any type that is a `SecretGrant`
850
+ outside `tasks/decide.ts`.
851
+
852
+ **Copies for one-shot sandboxes and secret commands** (`sandbox/workCopy.ts`, D683, D611). A one-shot sandbox never
853
+ shares its caller's disk. The caller's guest streams its files as a tar
854
+ (`vitki-sandbox export`) straight into `vitki-image ext4 --from-tar`, which writes a
855
+ read-only ext4, with no git on the host and no archive kept. The copy holds the tracked and
856
+ untracked files and a `.git` of Vitki's own, written from an allowlist with no hooks, no agent
857
+ alternates and no worktree or module links. The caller's guest names the state of the work (a
858
+ tree id from a temporary index) and the host caches the disk per state, so a second call on
859
+ work that did not change reuses it. A copy is capped at 32 GiB and needs room on the host. The
860
+ one-shot sandbox gets the copy read only and a writable layer of its own per call. When
861
+ the command ends, the layer is the change set, and the caller's `vitki-sandbox apply` writes each
862
+ file only while the caller's file still has the content the copy started from, and moves a ref
863
+ only from its start value. A file the caller changed meanwhile is named in the result. One-shot sandboxes
864
+ run git with its config forced (`GIT_CONFIG_NOSYSTEM=1`, `GIT_CONFIG_GLOBAL=/dev/null`,
865
+ `GIT_CEILING_DIRECTORIES`, `safe.bareRepository=explicit` and the rest in `workCopy.ts`) as a
866
+ second wall. File inputs go into a tmpfs as a tar and are never written to a disk file (D438).
867
+
868
+ **Sleep, wake and Remove.** There is no idle timer, and no task sleeps to make room for
869
+ another: a create, a resume and a wake start at once. A sleeping task is Asleep, with a line saying why. A sleep stops the
870
+ VM and keeps the task disk. A wake makes a new VM from the current spec on the same disk.
871
+ The guest's init mends the task drive before it mounts it (`e2fsck -p` of the image's own, run in
872
+ a chroot of the image, and an image with none skips it, so the kernel replays the journal at the
873
+ mount), so no file system tool reads a guest-written disk on the host, and the task reads
874
+ "Waking the task" while that happens and the sandbox is made. The repo is made on the task disk once and
875
+ never again over an existing repo. The liveness sweep records a sandbox that vanished as stopped. After about 15 minutes idle the host sends `dropcaches` (sync, then drop
876
+ the page cache) so the memory comes back and the task stays awake. Stop puts the task to sleep
877
+ (`stopByYou`: the turn and the runs end, `slept.kind` is `stopped`), and a run's end leaves the task done. Both stop
878
+ the VM and keep the disk until Remove. A done task wakes over its kept disk (`resume` accepts `done`) and stays
879
+ done while `doneAwake` holds it, and a message sets it idle. Remove takes a last look at the changes while the task
880
+ is awake (`machine/repos/unpushed.ts`, an `unpushed` repo read, from the values kept while it was awake and the forge branches in
881
+ the clone), then deletes the task and its disk, and its dialog says when the branch has work
882
+ that no push carried. A task found gone after a crash or a reboot is
883
+ Asleep too. A server restart leaves the VMs running, and the next start finds each by its
884
+ folder and sends `settime`.
885
+
886
+ **Memory and CPUs** are the same on both platforms (D672). Vitki sets no limit of its own: a VM
887
+ gets every core and the machine's memory less 2 GiB (`sandboxSize` in `shared/resourcelimits.ts`), held in the
888
+ guest's work cgroup, `memory.max` and `cpu.max`, through the `limits` verb at boot, and that size holds for the VM's life. On Firecracker, virtio-mem
889
+ plugs memory by use (D685, `sandbox/microvm/memoryPlug.ts`): the VM boots with a quarter of its limit (512
890
+ MiB to 4 GiB), the host grows the plug in steps when the guest's `MemAvailable` falls short or its
891
+ memory pressure rises, and gives it back after 3 minutes of room. Each plugged GiB costs about 50
892
+ MiB of guest kernel memory, which is why the limit is not plugged whole. The guest allows
893
+ overcommit so a large allocation does not fail before the plug grows. macOS backs only the pages a
894
+ guest touches, so VZ1 plugs nothing. The memory banner reads `memory.events` of the work cgroup
895
+ through the `metrics` verb.
896
+
897
+ Anything the session serves on guest port 4000 is reachable on the host only
898
+ through the task's preview proxy (`preview/proxy.ts`), which listens on a port
899
+ the server picks from 41000-41999, keeps across a stop and a resume while the
900
+ server runs, and dials the guest through the sandbox backend for each request
901
+ (`dialPreview`, the same on Firecracker and vfkit). The Preview view iframes the
902
+ proxy's URL. No other socket on the host leads into a guest, so Vitki's cookies,
903
+ which the browser sends to every port of 127.0.0.1, reach no dev server: the
904
+ proxy reads them to gate and takes them out (D334, D341, D1516). The task row
905
+ holds no preview port. The server keeps each proxy's port in memory alone.
906
+ The proxy runs on the machine as a `preview` job, and the hub hands it the
907
+ ports to pick from, holds the port it took and answers each request's session,
908
+ access and theme under the job's id.
909
+
910
+ Names carry the owner. A sandbox, an image and a disk are named
911
+ `vitki-<person>-h<home>--<repo>...`, with the person and a hash of the home
912
+ (`ownedName`, set by `useDockerHome` at start), and carry the `vitki.owner` and
913
+ `vitki.home` labels, so removing a person purges their sandboxes, disks and
914
+ images and two homes never meet.
915
+
916
+ Every host git invocation runs with
917
+ `-c core.hooksPath=/dev/null -c core.fsmonitor=false -c protocol.ssh.allow=never
918
+ -c protocol.ext.allow=never` and `GIT_CONFIG_NOSYSTEM=1`, as the clone is data a
919
+ repo's own config must never turn into code on the host. No guest can write the host's
920
+ clone, since it is never mounted.
921
+
922
+ ## Network — sandbox egress
923
+
924
+ Every task sandbox, script run and image build reaches only Vitki's egress
925
+ proxy (`machine/wall/egress.ts`). Each connection is a request that
926
+ `decide` answers with the stack of whoever opened it: a session's account,
927
+ repo and task, and a script run's workflow and script too. Reaching a host is
928
+ one action in the one rules model (`action/reach`, the host as the pattern,
929
+ `*` for every host): any never refuses, otherwise any allow lets the
930
+ connection through, and a host nothing answers parks one ask card per
931
+ (owner, host) while the connection waits, five minutes at most. There is no
932
+ allowlist file, no group rule and no default: a fresh account has no host
933
+ rule, and onboarding's host groups (`machine/sandbox/tool/host-templates.json`, read by
934
+ `network.ts`) each write one ordinary reach row per host when you continue,
935
+ and are used for nothing else (D402).
936
+
937
+ **Holding the network.** A sandbox has no network device (D607, D672), so the one way
938
+ out is vsock. The guest's relay, started by init, listens on `127.0.0.1:3128` and on
939
+ `100.64.233.1` (put on `lo`, so nested containers reach it too). Each connection it
940
+ takes goes over vsock port 5100 to the host, where `sandbox/microvm/fcEgress.ts` joins it to the
941
+ loopback listener the proxy opens for sandboxes. The sandbox's env holds the proxy URL
942
+ (`proxyEnvFor(ref, 'vm')`), the guest never sets its own network up, and the token rides
943
+ `HTTPS_PROXY`, so the proxy tells tasks apart without a network address. A sandbox that
944
+ cannot be made leaves none, and the task fails with "This task has no network: <the
945
+ reason>." Retry makes the sandbox again. A start waits for `create`, so no session runs
946
+ without the relay.
947
+
948
+ **The Vitki channel** (`machine/wall/channel.ts`, D678, D682). A guest talks to Vitki itself
949
+ through the same proxy: it opens `CONNECT vitki.internal:<service>` with its token. The
950
+ proxy recognises the reserved name before any rule is read, finds the task or run the
951
+ token belongs to, never forwards the stream upstream, never counts it as the task's
952
+ network activity and hands it to the service. The name resolves nowhere, and a request
953
+ that names it any other way (a port number, a plain http request off the git and model
954
+ endpoints' paths) is refused before a rule or an ask card sees it, so no rule, an allow
955
+ on every host included, opens it to the internet. One service exists: `cli` carries the `vitki` CLI's requests
956
+ (see Review store and the CLI verbs): the request is one JSON line and the answer comes
957
+ back on the same connection, with no polling and no file. The machine's half
958
+ (`machine/wall/cli.ts`) reads and bounds the line and sends it as a `verb` event of the job
959
+ that holds the task or run. The hub's half (`hub/link/verbs.ts`) hands it to the listener and
960
+ feeds the waiting line, the answer and the handler's end back as the job's input. A read fails
961
+ at once while the link is down, and a write waits for it. A redial gets the answer the machine kept for
962
+ its id, unless the answer came on the route of an earlier job.
963
+
964
+ **Around the proxy.** A tool that ignores the proxy variables has no other way
965
+ out. There is no device to send it on, so the tool fails with its own
966
+ error at once (no route, or a name that does not resolve, since the guest runs
967
+ no resolver). Vitki runs no
968
+ resolver, no redirect listener and no firewall, keeps no count of such
969
+ attempts and writes no quiet line about them. This drops D347's quiet line
970
+ against "Nothing fails or waits in silence": a failure is the tool's own error
971
+ and happens at once.
972
+
973
+ An image build is watched and not blocked (D395). The builder sandbox
974
+ reaches the proxy as a task does and nothing else, every fetch goes through the proxy and is let
975
+ through to the internet with no rule and recorded in the build record by host
976
+ and step, and only a host on this machine or inside a local network needs an
977
+ allow rule. A build never raises an ask, and a fetch around the proxy fails its
978
+ step at once (D613).
979
+
980
+ **Vitki's own calls** (`proxy/own.ts`, D828). What the server reaches for
981
+ itself goes through the same proxy, as a run registered with `only`, the
982
+ host:port list the run reaches over CONNECT and no other, as an agent call
983
+ does (D415). No rule decides such a run and it parks no card: a press started
984
+ it, and `secretUses.ts` records the press for Activity. `ownFetch(hosts,
985
+ owner)` is `state.http`, the fetch the forge drivers, the model list and the
986
+ Codex sign-in read, and Google's sign-in has its own, on oauth2.googleapis.com
987
+ alone (`auth.ts`), acting for Vitki itself (`OWN_MACHINE`) while nobody is signed in, since
988
+ nobody exists before setup. `registerRun` refuses that name to any run but one
989
+ of `only`, so no rule is ever read for it. Each own fetch
990
+ refuses a URL whose host is not in its list (`OWN_HTTP_HOSTS` for `state.http`: each
991
+ forge's `api`, the model list's host and the Codex sign-in's), then sends the
992
+ request through `fetchOnRun` and hands back a `Response`, following a move
993
+ only to the same host and port, at most `OWN_MOVES` times. Each run acts for
994
+ the owner given, else the acting person, so on a machine of several people a
995
+ call that names nobody fails closed. While no proxy runs, `proxyGitEnv(null)`
996
+ turns git's http and https transports off and a fetch rejects, so nothing goes
997
+ around the proxy.
998
+
999
+ ## Harnesses (`machine/sessions/driver.ts`, `claude.ts`, `codex.ts`)
1000
+
1001
+ **The host seat** (`hub/seat.ts`, `hub/api/seatGate.ts`,
1002
+ `machine/codexHost.ts`). Every host-side text call the workbench makes for
1003
+ itself (the Docs ask and the teammates ask, chat
1004
+ theming, Explain it, the guide's turns and `POST /api/guide/create` (a
1005
+ streamed guide turn in a provisional `create:<kind>:<id>` scope, see below),
1006
+ the onboarding interview) runs on a `Seat`: `{provider, token, model}`, in a
1007
+ throwaway sandbox of its own and never a process on this machine
1008
+ (`agentSandbox.ts`, D415): a microVM with its own kernel, the user nobody,
1009
+ the one agent binary your account pins mounted read only, and a network closed
1010
+ to everything but Vitki's egress proxy, which lets the call reach its model
1011
+ host over CONNECT on 443 alone. The sandbox is removed after the call.
1012
+ `seatOrNull(state, undefined, person, place)` builds the seat from the pick of
1013
+ the agent that fills the call's place (`ownAgentOf()` in `ownAgents.ts`, D817),
1014
+ else the account's main agent row (`ownCall()` in `tasks/modelChain.ts`, D418):
1015
+ no fixed model and no other login, and no row means no seat. `withRole()` leads a
1016
+ request with that agent's role (`ownPrompt()`), the request following byte for byte, so a person with only Codex uses those features on
1017
+ Codex;
1018
+ `requireSeat` maps a locked vault to 423 and no seat to the 409 sentence
1019
+ `ui/src/store/toast.ts` matches; `seatState` feeds `askState`. `hostRun` /
1020
+ `streamSeat` dispatch to `claudeHost.runClaude/streamClaude` or
1021
+ `codexHost.runCodex/streamCodex`, which share the prompt-in, text-out contract:
1022
+ `codex exec --json --ephemeral --ignore-user-config --skip-git-repo-check
1023
+ --sandbox read-only` with `CODEX_HOME` on the sandbox's tmpfs, the key piped
1024
+ into `codex login --with-api-key` there on every call (the auth file goes with
1025
+ the sandbox), the last `agent_message` as stdout, `turn.failed` as a non-zero
1026
+ rc. Codex emits no text deltas, so `streamCodex` hands the message
1027
+ over as one delta. The route-level test seam (`setHostAsk`)
1028
+ takes a `HostPrompt` or null. Still Claude-only: task-title interpretation
1029
+ (`interpret.ts`), learnings extraction (`learnings/extract.ts`, skipped without
1030
+ a token), and token validation, each a `claude -p` call in the same kind of
1031
+ sandbox.
1032
+ The UI gate is `useSeatGate` (`ui/src/store/gate.ts`, `seatConnected`):
1033
+ disconnected only when neither model is connected, and its copy says "Connect
1034
+ a model"; the Connect controls themselves stay provider-named.
1035
+
1036
+ **Creating from words** (`hub/api/create.ts`, `EditSurface.tsx`). New
1037
+ on one of the six `CREATE_KINDS` mints a provisional scope,
1038
+ `create:<kind>:<id>` (`CREATE_SCOPE_RE`, `mintCreateScope`), and the Edit
1039
+ surface opens on it at once with no ask and no files: the surface draws the
1040
+ first line (`createAskLabel`) and the example presses itself, and the
1041
+ person's first message, typed or pressed, is the first turn. `createScope`
1042
+ lists `files: () => []`, so a typed edit of a staged file stays a draft and
1043
+ the guide's removal of its own file drops that draft, and carries `land`. Its
1044
+ spec is the kind's spec, the inventory and `createBrief(kind, drafted)`, read
1045
+ each time the scope is built, so once a draft stands the guide is told to
1046
+ change it. On a scope with `land` the guide's prompt lists `overlaid(files(),
1047
+ staged)` under Current files (`hub/guide.ts`, the same overlay
1048
+ `parsedDrafts` checks on a save), so every turn sees the draft. `POST
1049
+ /api/guide/create {kind, ask, scope}` is SSE through `createTurns`:
1050
+ `Guide.turn` streams and stages through the one path an edit uses, and a
1051
+ turn that staged anything ends with the whole draft through `planCreation`
1052
+ (slug from the title, `-2…-9` on a clash, the 409 sentence after) and
1053
+ `checkCreation` (the id rules and the parse check `landCreation` runs before
1054
+ it writes, writing nothing). The stream stages and checks and never lands. A
1055
+ draft that will not load goes back once as a user turn (`retryText`,
1056
+ `create-retry` event), the guide built again so its brief reads the draft,
1057
+ and a second miss, or a clash, ends with `create-failed {error, status}` with
1058
+ the draft kept, so a follow-up message is another `/api/guide/create` on the
1059
+ same scope. Create is the staged apply, `POST /api/guide/staged {decision:
1060
+ 'apply'}`, as for a starter kind below: `land` plans the checked set,
1061
+ `landCreation` writes it through the kind's store, the staged rows clear, the
1062
+ chat moves to the real scope (`ChatRows.moveTo`), and the answer carries
1063
+ `created`. Cleanup: a cut stream keeps what it staged, as any guide turn does,
1064
+ leaving the surface before Create calls `DELETE /api/guide/create?scope=`
1065
+ (`abandonCreation`), and `sweepCreations` at boot drops any `create:*` chat a
1066
+ stopped server left. A new workflow's draft reads through `workflowDraft` too,
1067
+ under the name its manifest gives, so the Pipeline draws it before Create.
1068
+
1069
+ **A new item before Create** (`createScope` in `hub/api/create.ts`,
1070
+ `starter` in `hub/api/libraryRoutes.ts`). New theme, Add font files, New
1071
+ sandbox image, New language server and New panel mint a `create:<kind>:<id>`
1072
+ scope too (`STARTER_KINDS`), with no stream of their own: the scope lists the
1073
+ starter the kind's table entry installed (`starterOf`, `hub/api/starters.ts`), checks with the kind's own
1074
+ check, and its `write` refuses, so only `land` writes. Typing and the guide's
1075
+ turns stage over the starter as in any edit. Create is the one staged apply,
1076
+ `POST /api/guide/staged {decision: 'apply'}`: the set `parsedDrafts` checked
1077
+ goes whole to `land`, which saves it through the entry's `save` (a font moves
1078
+ its held files in) under `idFor(title)`, clears the staged rows and moves the
1079
+ chat to the real scope (`ChatRows.moveTo`), and the answer carries `created`
1080
+ with the real scope. A new panel's Preview and waiting routes take the scope
1081
+ and run the draft under the id it would land as: the entry's `idFor` of the
1082
+ draft's title line (`starterIdOf`), the id `land` saves it under.
1083
+
1084
+ Every scope that can write a `workflow.yaml` (the workflow scope and a
1085
+ workflow creation) reads `tasks.triggerInventory(def)` beside the action
1086
+ inventory (`inventory.ts`): every trigger by exact name with its outputs
1087
+ and its inputs, the Library's plus the ones the workflow carries, and the door
1088
+ apart. `WORKFLOW_SPEC` names no trigger itself. `workflows.triggerIssues(def,
1089
+ known)` is the one reading of a manifest's `triggers:` against what exists: an
1090
+ `unknown` name is refused wherever a manifest is written (the guide's check
1091
+ and write, `planCreation`) with the sentence
1092
+ that lists the real names; a trigger that exists but cannot supply the inputs
1093
+ (`unable`, the arm refusal's own sentence via `inputsRefusalWords`) is refused
1094
+ at creation only and otherwise lands, and the workflow JSON carries both kinds
1095
+ as `triggerIssues` so the card draws a warn row per name with no switch.
1096
+
1097
+ **How a workflow runs** is one pure derivation, `readRunState` in
1098
+ `ui/src/lib/rows/runState.ts` (matrix-pinned over every combination in
1099
+ `rows.runstate.test.ts`), read through `runStateInputOf(WorkflowInfo)`: the
1100
+ triggers it can name (`triggerDefs[kind]` carries the check's `standing` and
1101
+ its `needs` with what each may take, from `WorkflowContext.takes`), the repos
1102
+ each trigger fires on (`armedOn`) and the repos whose start rule allows it
1103
+ (`allowedOn`, the rows whose `startRule` reads `allow`), the secret needs its
1104
+ step scripts name (`needs: [{need, script, answered, rule}]` on the workflow
1105
+ JSON, from `workflowScriptNeeds` + `needAnswers` + `takesNeed`), the scripts
1106
+ its steps run (`impl.standing`) and `triggerIssues`. The kind is one of five
1107
+ (`RunStateKind`: `own`, `asks`, `manual`, `triggersOff`, `cannot`), the
1108
+ verdict of the rows in the one precedence every "Can it run" reads
1109
+ (`readCanRun`): cannot, then asks. The chip is a separate word,
1110
+ `startsChip(state, triggers)`, and says only when the workflow starts: Cannot
1111
+ run for a workflow a step, a secret or a host keeps any run from getting
1112
+ through, Manual only with no trigger at all, Starts on n repos when some row
1113
+ fires, Allowed, not firing when a start rule allows a repo and no row fires,
1114
+ and No start rule when the workflow has triggers and no repo allows one. The
1115
+ same derivation draws the chip and aside on every list row (`RunStateChip`)
1116
+ and the rows behind the chip (`runStateCues`, the `?` panel's cues). The
1117
+ server's `readiness()` list still rides on the detail JSON (bundles and the
1118
+ learning loop read its helpers) but no UI surface draws it.
1119
+
1120
+ **A trigger's start is a rule, not a switch (D426, D433, D461).** A trigger row
1121
+ (`wf_triggers`, `TriggerRowJson`) holds one start's settings for a trigger on a
1122
+ workflow, keyed on the workflow, the space ('' for none) and the trigger
1123
+ (D724), and nothing in the row says whether the trigger starts anything. The
1124
+ repos a start watches are its `repo[]` inputs, stored as row picks
1125
+ (`trigger-row` place `workflow|space|kind`).
1126
+ That is a start-workflow rule: `decide` answers the action `start-workflow`
1127
+ over the stack account, space, trigger, from the `start-workflow` rows of
1128
+ `rules`, whose params name the trigger and the workflow. `grants.startRule(svc, kind, def, space, hash?)` reads
1129
+ it as `allow`, `deny` or `ask` (the UI words are Allow, Never and No rule,
1130
+ `START_RULE_WORDS`), and `setStartRule` writes it at one scope. An allow is
1131
+ pinned (`rememberStartPin`) to the trigger's folder hash and to the workflow's
1132
+ version (`def.hash`), so an edit to either reads as No rule until Approve
1133
+ again (`renewal` and `renewWorkflow` in `tasks/renew.ts`, `GET
1134
+ /api/workflows/:name/renewal` and `POST .../renew`) renews the start. The same
1135
+ allow lets the trigger's check run with nobody watching, since the check sits
1136
+ inside the pinned folder: the check has no allow of its own. `rowFiresWhy` is
1137
+ the one answer to whether a row fires, `no-rule` and `never` among its
1138
+ reasons, and `armedOn` lists the spaces where it answers none. Adding a start
1139
+ (`setTrigger`, `POST /api/workflows/:name/triggers` with `{space, kind, config?, repos?}`) stores settings and
1140
+ checks nothing about the steps: it refuses only for what leaves the row
1141
+ useless (`ArmRefusal`: `inputs`, `engine`, `forge-secret`, `check-missing`,
1142
+ `check-problem`, `param-unset`), and the UI opens the matching door
1143
+ (`ArmDoor`, "Configure and add") then. What a step would stop on shows on the
1144
+ card's On each start and in the start allow's dialog. The route's `:space` segment is `none` for a start in no space (`NO_SPACE_SEGMENT`). A check reads its repo inputs as `VITKI_<NAME>` JSON (`withRepoObjects`), `VITKI_REPO` is gone from `checkEnv`, and an item's `repo[]` field (`itemRepos`) names the repos `createRun` gives its task.
1145
+
1146
+ **The trigger queue (D422).** A check's items wait per start in `trigger_queue`,
1147
+ and a start is already decided once queued: a later edit to the trigger or its
1148
+ check leaves the item alone, and the item takes the workflow version current
1149
+ when it starts. `startQueued` (`tasks/triggerRuns.ts`) starts the head of a
1150
+ row while fewer than `TRIGGER_IN_FLIGHT_CAP` runs from it are in flight, under
1151
+ the row's own turn (`onQueueTurn`), so Remove and Clear all never land
1152
+ mid-start. A row the start rule stops keeps its queue and says why in its
1153
+ waiting note (`NO_RULE_WAIT`, `NEVER_WAIT`), and the first pass after an allow
1154
+ starts it (`setStartRule` also spawns `startQueuedRuns`). `api/triggerQueue.ts`
1155
+ serves the row's view (`GET /api/workflows/:name/triggers/:space/queue`, the
1156
+ `trigger` query naming the trigger by its full path) and the two removals
1157
+ (`DELETE .../queue/:seq` and `DELETE .../queue`), and never removes a running
1158
+ item.
1159
+
1160
+ **Save refuses code that does not parse (D423, D431, D491).** `syntaxCheck.ts`
1161
+ reads each file of a script, a check or a status bar for its language
1162
+ (`languageOf`: bash, sh, Python, Node) and checks it with that language's own
1163
+ parser in a throwaway sandbox (`checkSyntax`, `CHECK_SLOTS` checks at once),
1164
+ never on the host. `unparsedRefusal(files)` is the one refusal, answered
1165
+ with `UNPARSED_STATUS` (422) at the save routes (`api/scripts.ts`,
1166
+ `api/create.ts`, `bundle.ts` import, Move to the Library in
1167
+ `api/workflows.ts`). A run start checks nothing and awaits no sandbox: a file
1168
+ that arrived another way fails where its run reaches it, with the
1169
+ interpreter's own error. It shows under its card's problems through
1170
+ `knownFaults` and `faultProblems` (`scripts.ts`). A language no parser reads, or a sandbox that cannot run,
1171
+ saves unchecked today, and D431's language-server check in the Library editor
1172
+ (run from your account's image, D561) is still to land.
1173
+
1174
+ **A run keeps its version (D424).** `stageRunWorkflow` copies the workflow's
1175
+ files, as `def.hash` read them, into a staging folder before the task exists,
1176
+ and `placeRunWorkflow` moves the copy whole into the task's folder
1177
+ (`runWorkflowDir`). `workflowOf(svc, task)` in `tasks/workflowConfig.ts` is
1178
+ the one reader for a task's workflow: the run's copy when it has one, the
1179
+ workflow on disk for an older run or a lookup by name, and no workflow (never
1180
+ the disk) for a copy that is damaged (`RUN_COPY_DAMAGED`) or could not be
1181
+ placed (`copyNotPlaced`, the `workflow-not-placed` marker). Every
1182
+ `svc.workflowOf(task)` reader gets the copy, so an edit, a rename or a delete
1183
+ reaches only runs started after it.
1184
+
1185
+ **Start checks (D425).** `startChecks` in `tasks/lifecycle.ts` is shared by
1186
+ creating a task and resuming one: the vault is open, the repo is there, its
1187
+ image is not building and the pick can sign in, all before anything is made. A
1188
+ resume starts with the machine's size and the current agent version.
1189
+
1190
+ **Fail fast on a refused step (D420, D430).** A rule that denies a step the
1191
+ run must take makes the workflow Cannot run (`stepCanRun`, `deniedDecider` in
1192
+ `ui/src/lib/rows/stepCanRun.ts`), built-in steps included. A deny on an item
1193
+ with a `when` weighs as an ask, since only runs that ask for the item stop
1194
+ there. `refuseOffScript` (`tasks/runActions.ts`) is the guard on the script
1195
+ press: only a run standing on a script step, or the checkpoint in front of one,
1196
+ can press it, so a repeat press never runs a finished step again.
1197
+
1198
+ The two built-in actions a workflow owns, `write-learnings` and `close-task`,
1199
+ carry their standing rule as an allow | ask | deny (the step titles are
1200
+ `BUILTIN_TITLES` in `rows/actions.ts`): a rule on the workflow through
1201
+ `/api/rules` writes `write-learnings`, and `PUT
1202
+ /api/workflows/:name/close-grant` takes `{allow: true | false | null}`, null
1203
+ deleting the rule so the run asks, and returns the rule as it stands
1204
+ (`autoApproves` / `closesTask`, `boolean | null`). The workflow
1205
+ card's extra-files fold reads `isExtraFile(path)` (`rows/carried.ts`): the
1206
+ manifest, a skill's `SKILL.md` and anything under `triggers/<name>/` have
1207
+ their own rows and are never "other files".
1208
+
1209
+ The Edit surface's Pipeline draws the draft: `workflowDraft` (`api/guide.ts`)
1210
+ overlays the staged set on the directory, parses the staged manifest with the
1211
+ staged skills (each skill folder's `skill.yaml` through `parseSkillSettings`)
1212
+ and returns the same shape `GET
1213
+ /api/workflows/:name` does (`workflowDetail`), or `{error}` when the manifest
1214
+ will not parse, as `draft` on `GET /api/guide` and both staged routes;
1215
+ `ui/src/lib/pipeline.ts` (`diffPipeline`, `diffTriggers`) marks it against the
1216
+ published workflow.
1217
+
1218
+ Tasks pick an agent at creation (`tasks.agent`, from the main agent row
1219
+ unless the dialog picks; `claude` or `codex`). A step may name the other agent
1220
+ and then runs in that agent's own session in the same task. Everything agent-specific lives behind `AgentDriver`: how to launch
1221
+ the CLI in the container, which secret it needs, and how to parse its
1222
+ output. Everything downstream — the transcript file, the task stream, state
1223
+ tracking, summaries, the UI — consumes only the normalized session-event
1224
+ contract (`machine/sessions/events.ts`): `system`/`user`/`assistant`/
1225
+ `stream_event`/`result` events with text / thinking / tool_use / tool_result
1226
+ blocks. The contract is the stream-json subset Claude Code emits, frozen as the
1227
+ agent-neutral format, so the claude driver is a pass-through and the codex
1228
+ driver (`machine/sessions/codex.ts`) maps into it.
1229
+
1230
+ Codex specifics:
1231
+
1232
+ - A session is one long-lived `codex app-server` in the task's sandbox, spoken
1233
+ to over stdio JSON-RPC (`machine/sessions/appServer.ts`, the client the
1234
+ Codex menu's `model/list` uses too). It is spawned at the session's first
1235
+ turn, after the sign-in and the skills are in place, and lives until the
1236
+ session stops. The thread opens with `thread/start`, or `thread/resume` of
1237
+ the stored handle, with approvals `never` and sandbox `danger-full-access`,
1238
+ Codex's "externally sandboxed" mode, which a microVM held to the proxy is.
1239
+ Each turn is a `turn/start`. Its argv carries the marker
1240
+ `-c vitki_session="<task>/<slot>"`, which the manager's leftover `pkill`
1241
+ matches, since the thread id is not in the argv.
1242
+ - A plain message sent while a turn runs goes into that turn with
1243
+ `turn/steer`, under the message's uuid as `clientUserMessageId`, and is read
1244
+ at once. A later message waits for that steer's answer, so the oldest is
1245
+ read first. A steer Codex refuses (a review or compact turn) or answers "no
1246
+ active turn" waits in the session's own line with `turnEnd` on its queued
1247
+ lifecycle, so its card reads "Read at the end of this turn". When a turn
1248
+ ends, every plain message waiting goes in together as one next turn, joined
1249
+ by a blank line, and a slash command runs as a turn of its own. A steer Codex
1250
+ took whose turn ended with no `userMessage` item of that client id runs as
1251
+ the next turn, drawn read once.
1252
+ - The notifications map onto the contract as `codex exec --json` maps them
1253
+ (Codex's `event_processor_with_jsonl_output.rs`). A turn's usage is the
1254
+ thread's total at its last `thread/tokenUsage/updated` minus the total
1255
+ before its first request, so the result counts the whole turn. Codex's
1256
+ plan updates (`turn/plan/updated`) are one TodoList call. A failed turn ends
1257
+ the session with exit 1, as a failed exec turn did. A session that ends on
1258
+ its own ends its app-server, SIGTERM then SIGKILL after a grace, and leaves
1259
+ the steers Codex took but never read in its `unread`. The manager keeps
1260
+ them per session key and sends them, oldest first, to the next session of
1261
+ that slot right after the message that launches it. A stop drops them, and
1262
+ so does a launch of another slot of the task.
1263
+ - A message Codex sends that the driver does not read (an unknown method or
1264
+ item type, a non-object line, a line that is not JSON, another thread's
1265
+ notification) becomes one `{type:'system', subtype:'harness_raw', harness,
1266
+ raw}` record, the message whole up to 64 KB, and the Claude driver keeps its
1267
+ non-JSON and non-object lines the same way. A request of Codex's own is
1268
+ answered at once with error -32601 and kept the same way. A failure with no
1269
+ words reads "Codex ended the turn with an error and no words. What Codex
1270
+ sent: <the JSON>" and carries the message as `raw`.
1271
+ - The thread id from `thread/start` is persisted into `tasks.session_id` as
1272
+ the resume handle. Until then the column is `''` for Codex tasks.
1273
+ - **Auth:** Codex signs in with ChatGPT (D400). Before every turn the driver
1274
+ writes the turn's login's `auth.json` into `CODEX_HOME` over stdin, never
1275
+ argv, with an empty refresh token. A running app-server keeps the sign-in
1276
+ it read at launch, and its own 401 recovery reaches for a refresh Vitki
1277
+ never hands it. So a turn whose login carries a new access token ends the
1278
+ app-server between turns and starts it again on the thread
1279
+ (`thread/resume`), and a turn on the same token keeps it.
1280
+ - Rules, hooks and skills: no project is trusted and no hook trust is
1281
+ bypassed, so a repo's rules and hooks stay off. App-server trusts the folder
1282
+ of a thread started with full access when that folder's trust is not set,
1283
+ and writes the trust to config.toml, so the launch sets the working folder
1284
+ untrusted (`-c projects={"<folder>"={trust_level="untrusted"}}`). The seed
1285
+ removes the user rules folder each turn. Each turn the session turns off, in the running
1286
+ thread (`config/batchWrite` with `reloadUserConfig`), every skill Codex lists
1287
+ outside the home's own skills folder, and a skill still on stops the turn.
1288
+ - Cost is not reported (Codex gives token usage, no USD), an interrupt is
1289
+ `turn/interrupt`, which closes the turn with an `interrupted` result, and
1290
+ there is no per-block streaming: messages appear whole (`item/completed`).
1291
+ - The Codex version is pinned in `harnesses/codex/harness.yaml` to the
1292
+ app-server protocol the driver was verified against. A check-vm test
1293
+ (`runtimeVm`) gates the pinned binary's schema against
1294
+ `CODEX_APP_SERVER_METHODS`, and the image carries no agent (D396).
1295
+ - Internal brain calls (interpret, summaries, learnings extraction) stay on
1296
+ Claude regardless of the task's agent. Codex egress is a reach rule like any
1297
+ other host's.
1298
+
1299
+ `GET /api/config` lists the registered agents (id, label, models,
1300
+ defaultModel) for the task composer.
1301
+
1302
+ ## Session
1303
+
1304
+ One agent process per task (the claude driver), started with `backend.exec`
1305
+ straight into the running task sandbox, as user `vitki` in the worktree, with
1306
+ its env passed as a map:
1307
+
1308
+ ```
1309
+ env VITKI_TASK=<id> VITKI_AUTHOR=<login>
1310
+ claude -p --verbose --input-format stream-json --output-format stream-json \
1311
+ --include-partial-messages --replay-user-messages \
1312
+ --permission-mode bypassPermissions --model <model> \
1313
+ --session-id <session_id> # first launch
1314
+ --resume <session_id> # relaunch (never both)
1315
+ ```
1316
+
1317
+ The Claude token comes from the user's profile (see Profile) and is passed in
1318
+ the exec's env map: it is never on a command line, in the sandbox's spec, or in
1319
+ a file. Nothing is flushed before a turn: no folder is shared, so the agent reads what the
1320
+ host sent through the sandbox (D603 is superseded).
1321
+
1322
+ A task holds one session per agent of the Library, and one of them runs at a
1323
+ time (D417, D782). The task's chat runs the agent in `tasks.agent_item`, set at
1324
+ create from New task's pick, else `defaults.yaml` `agent` (`tasks/sessionAgents.ts`
1325
+ `chatAgentOf`), '' for a chat that runs none. A step with `agent:` runs in that
1326
+ agent's session, a step with none in the chat agent's (`runningStepPick` sets
1327
+ `agentItem` on the launch pick). `sessionKey(taskId, agentItem)` in
1328
+ `sessions/manager.ts` keys a live session. The chat agent's resume handle on the
1329
+ task's own harness is `tasks.session_id`, and every other session's rides in
1330
+ `tasks.agent_sessions` under `handleKey`, `<agent>/<harness>` (the harness alone
1331
+ for a chat that runs no agent), so a later step with the same agent resumes its
1332
+ own conversation and an agent moved to the other harness starts fresh. A session
1333
+ that launches fresh after the task has a history opens on the task brief
1334
+ (`freshAgent`). `sendsTo` names the session a message sent now reaches, and each
1335
+ reply of a session carries `sessionAgent`, its agent's id.
1336
+
1337
+ Each session runs in a home of its own (`sessions/seed.ts` `sessionHomeOf`).
1338
+ The chat agent's is the claude folder, `/home/vitki/.claude`, and `~/.codex`.
1339
+ A step agent's is `/home/vitki/.claude/homes/<agent>/`, passed as
1340
+ `CLAUDE_CONFIG_DIR`, and `CODEX_HOME=/home/vitki/.codex/homes/<agent>` in the
1341
+ tmpfs, whose `sessions` links to `~/.codex/sessions/homes/<agent>` on the task
1342
+ disk. The seed (`seedClaudeDir`, `buildSeedTar`, `seededParts`) writes each home's
1343
+ `settings.json`, `CLAUDE.md` (the one line `@/vitki/sandbox/brief.md`, Claude
1344
+ Code's own import of the Vitki brief from the user scope, D873), `vitki/role.md`
1345
+ (the agent's AGENT.md, passed with `--append-system-prompt-file` and copied as
1346
+ Codex's `AGENTS.md` before each turn, after the line "Read
1347
+ /vitki/sandbox/brief.md before you start.", which a home with no role gets
1348
+ alone) and `skills/`: Vitki's and yours that are on, the ones the agent lists whatever
1349
+ Off says (D783), the run's workflow skills, and the agent's embedded skills as
1350
+ `<agent>-<skill>`. A step agent's home also gets `.claude.json`. The seed
1351
+ replaces those parts and keeps each home's `projects/`, where its conversations
1352
+ are. The first seed of a run copies each agent its sessions run into
1353
+ `<runWorkflowDir>/agents/<id>/`, and later seeds of the run read that copy.
1354
+
1355
+ A session's inputs are then: the role (above), the Vitki brief
1356
+ (`machine/sandbox/tool/brief.md`, copied beside `vitki-sandbox` by
1357
+ `machine/sandbox/tool/build.sh` and so read only at `/vitki/sandbox/brief.md`:
1358
+ the verbs and `vitki --help`, the ask rule, refusals, copy rules, secrets,
1359
+ waiting, learnings), the skills, each repo's `CLAUDE.md` through `--add-dir`,
1360
+ and the first message (`sessions/prompt.ts` `taskPrompt`), which holds only
1361
+ the task's own: the words typed, the branch, the workspace and each repo's
1362
+ line, the signing line, the script inventory and the memory index (D873).
1363
+
1364
+ - The server writes user turns to stdin as
1365
+ `{"type":"user","message":{"role":"user","content":[{"type":"text","text":"..."}]}}`
1366
+ followed by a newline.
1367
+ - `POST /interrupt` writes a stream-json control request to the same stdin
1368
+ (`{"type":"control_request","request_id":"ctl-<n>","request":{"subtype":"interrupt"}}`):
1369
+ the current turn stops with a `result` event, the session stays alive. The
1370
+ chat binds Esc and Ctrl+C (when nothing is selected) to it.
1371
+ - Every stdout line is a JSON event; the server appends it verbatim to
1372
+ `transcript.jsonl` and broadcasts it on the task's WebSocket.
1373
+ - State derivation from events (server side, `sessions/state.ts`):
1374
+ - any `assistant` event with a `tool_use` block, or a `stream_event`
1375
+ content delta → `working`
1376
+ - `result` event → `idle`. A task reads `waiting` from a session only
1377
+ through `vitki ask` or `vitki task set waiting`, never from the words or
1378
+ tools of the last message (D841)
1379
+ - process exit non-zero → `stopped` with `last_error`
1380
+ - every state write goes through `TaskService.setState`, which refuses a move the table in `core/taskState.ts` does not hold. That module holds the `TaskState` union and the named questions of a state (`isUp`, `isClosed` and the rest), and every `updateTask` publishes the row it wrote to the boards (D915, D916)
1381
+ - Restart policy: if the process exits and the task is not `done`, the next
1382
+ user message relaunches with `--resume <session_id>` (and no `--session-id`).
1383
+ - Server restart: no session survives it. A clean stop first writes the
1384
+ `interrupt` control to a Claude session mid-turn and waits up to 5 s for
1385
+ its `result`, which leaves the task `working` so the next start resumes it
1386
+ with the recovery message. Tasks in `working|waiting`
1387
+ become `idle` when their container is still running, else `stopped`;
1388
+ `creating` becomes `failed`. `resume` is also allowed from `failed` when the
1389
+ container exists.
1390
+ - The first user message is the task prompt:
1391
+ ```
1392
+ # Task: <title>
1393
+ <task text as entered>
1394
+ Branch: <branch> (base <base>). Repo: <repo>.
1395
+ Work in <worktree>.
1396
+ Read what this task reads of my learnings with `vitki learn read`, one teammate's
1397
+ with `--about @<login>` and every teammate's with `--about '@*'`.
1398
+ Plan before editing; ask me with `vitki ask` when a decision is mine, and never end a turn on a question alone.
1399
+ You are running inside a sandboxed environment with limited access: no GitHub
1400
+ secrets (`gh`, the GitHub API and `git push` will not work), ... no sudo, and
1401
+ no host files beyond this worktree. Work from the local clone and leave the work uncommitted: the pull request step commits it.
1402
+ ...the preview, show, secret, message, report and ask verbs, each with when to use it
1403
+ When you learn a rule worth keeping, write it in the scope it is about: ...
1404
+ `--about <item>` for a skill, workflow, script or agent by its full path, like skills/<id>.
1405
+ Read an item's learnings with `vitki learn read --about <item>`.
1406
+ ```
1407
+
1408
+ No learnings are copied into the task: the prompt names the command and the
1409
+ rules decide what the read returns (see Learnings).
1410
+
1411
+ The `~/.vitki/tasks/<id>/claude/` seed contains:
1412
+ - `settings.json` with `{"permissions":{"defaultMode":"bypassPermissions"}}`
1413
+ - `skills/` — your skills, your copies of the ones Vitki ships among them.
1414
+
1415
+ ## Review store — the `review_threads` rows
1416
+
1417
+ The server is the only writer (D605). A task's threads are rows of the task's
1418
+ owner in the registry (D526), one row per thread in the review's order
1419
+ (`review_threads`, keyed on owner, task and position), so no sandbox reads or
1420
+ writes them. The web UI's thread actions land there (`POST
1421
+ /tasks/{id}/review/send`, `.../review/threads/{tid}/state`, `.../disposition`),
1422
+ and so do the session's `vitki review post` and `vitki review reply`, as
1423
+ requests. Every write is one transaction inside `ReviewStore.update()`
1424
+ (`ReviewRows.updateThreads` in `hub/review/state.ts`), which writes only
1425
+ the rows of the threads it changed. A review with no rows has no threads. The
1426
+ watcher polls the threads' revision, which every write moves. No threads.json
1427
+ is read or written (test data: threads from before start empty once).
1428
+
1429
+ Five more records only Vitki reads are rows of the task's owner too (AUD-DB2,
1430
+ D526), each written per row, and a task or a run that goes takes them
1431
+ (`REVIEW_TABLES` and `TASK_RECORD_TABLES` in `registry.ts`): what the session
1432
+ was last told of each thread (`review_watermark`, written after a send got
1433
+ through), the rule threads Vitki filed under write-learnings (`review_filed`),
1434
+ the MCP servers a task started with (`task_mcp`, `task_mcp_servers`,
1435
+ `task_mcp_tools`), a run's pins and its on-task mark (`run_pins`,
1436
+ `run_on_task`), the spec of the task's sandbox (`task_sandbox`
1437
+ key `spec`), and the outputs a run's commands printed
1438
+ (`run_outputs`). No file of these is read (test data). A repo's items read, its
1439
+ list and the items gone from it, its items pick and the picked rows, and the
1440
+ tools an MCP server last listed are rows of their owner too (`repo_item_reads`,
1441
+ `repo_items`, `repo_items_gone`, `repo_item_picks`, `repo_item_picked`,
1442
+ `mcp_tools`), and a removed repo or server takes them.
1443
+
1444
+ The session's writes are requests of the `reviews` kind on the Vitki channel's
1445
+ `cli` service (`review/cli.ts`, D682), which the watcher answers like every other
1446
+ kind (`onReviewRequest` in `tasks/verbs.ts`). The id
1447
+ is the new thread's for a post and the new comment's for a reply. A post
1448
+ carries `kind: "post"`, `author`, `body`, then either `file`, `side`, `line`,
1449
+ `endLine` and `code` (the anchor lines the CLI read in the sandbox) or `page:
1450
+ {path, at}`, and optional `weight`, `choices` with `recommend`, `reason` and
1451
+ `waitUntil`. A reply carries `kind: "reply"`, `thread`, `action`
1452
+ (`reply|applied`), `author` (`VITKI_AGENT`, "agent" when unset), `body`,
1453
+ `reason` and `waitUntil`. The server reads the request against its own copy
1454
+ (`reviewWrite` in `review/requests.ts`): a thread that is not there answers
1455
+ `decision: "missing"` (the CLI exits 2), a malformed request answers `error`.
1456
+ Then the rule on reviews decides, with the file as the target: an allow writes
1457
+ the thread or the reply (`applyWrite`), a never answers `denied`, and with
1458
+ neither one card holds the write until the owner answers. A page thread's pin
1459
+ is numbered when the server writes it, on from the last pin the store holds.
1460
+ The CLI waits for the answer on the connection that carried the request (D605
1461
+ holds: the server stays the only writer, and the mechanism is the channel, not files).
1462
+
1463
+ ```jsonc
1464
+ {
1465
+ "version": 1,
1466
+ "base": "<sha of merge-base at last reconcile>",
1467
+ "threads": [
1468
+ {
1469
+ "id": "<uuid4>",
1470
+ "filePath": "relative/to/worktree.ts",
1471
+ "side": "after", // "after" (working tree) | "before" (base)
1472
+ "anchor": { "code": "exact source line(s) the comment was written on" },
1473
+ "line": 42, // 1-based hint only; anchor is authoritative
1474
+ "state": "open", // open | resolved
1475
+ "disposition": null, // null | "queued" | "skipped" (for threads not authored by the viewer)
1476
+ "applied": false, // true once the session applied it; viewer resolves
1477
+ "raisedBy": "vitki-review-change", // the skill id of the run's agent step whose session posted it, absent on a person's or a script's thread
1478
+ "comments": [
1479
+ { "id": "<uuid4>", "author": "<VITKI_AUTHOR|claude|codex|learnings|team|external>",
1480
+ "body": "markdown", "createdAt": "ISO" }
1481
+ ],
1482
+ "createdAt": "ISO", "updatedAt": "ISO"
1483
+ }
1484
+ ]
1485
+ }
1486
+ ```
1487
+
1488
+ Suggestions are a body convention: a fenced ```` ```diff ```` block whose `-`
1489
+ lines are the verbatim original and `+` lines the replacement.
1490
+
1491
+ Canned bodies the Code surface writes on triage actions (the server and the
1492
+ session parse these, keep them exact):
1493
+ - `✅ Queue for apply` — sets `disposition: "queued"`
1494
+ - `🚫 Skip` — sets `disposition: "skipped"`
1495
+
1496
+ Line anchoring: `anchor.code` carries the source line a comment was written
1497
+ on; `line` is a 1-based hint. The Code surface currently places threads by
1498
+ `line`; the anchor stays authoritative for consumers that re-locate threads
1499
+ after the file changes.
1500
+
1501
+ Reviewed-file watermark: `snapshots/<git hash-object sha>` holds the content
1502
+ at the time the viewer marked a file reviewed (written by the retired
1503
+ embedded-editor extension; kept for compatibility, currently unused).
1504
+
1505
+ ### Comment → session
1506
+
1507
+ The server watches the threads. For each new comment whose author is the
1508
+ viewer (`VITKI_AUTHOR`) and which is the last comment in its thread, and for
1509
+ each thread your Queue press just made `queued` (a `queued` disposition the session writes into the file is ignored), it sends one user message
1510
+ to the session (batched over 20 s):
1511
+
1512
+ ```
1513
+ # Review comments
1514
+ ## Thread <id> — <filePath> (<side>)
1515
+ Anchor:
1516
+ ```
1517
+ <anchor.code>
1518
+ ```
1519
+ <author> wrote:
1520
+ <body>
1521
+ [disposition: queued] ← only on your Queue press
1522
+
1523
+ Reply in-thread with: vitki review reply <thread-id> --action reply|applied --body "<markdown>"
1524
+ Use `applied` only after making the change; the viewer resolves the thread.
1525
+ ```
1526
+
1527
+ ### `vitki review reply <thread-id> --action reply|applied --body <md>`
1528
+
1529
+ Files a request for a comment `{author: VITKI_AGENT ("claude" or "codex",
1530
+ "agent" when unset), body}` on the thread. Once the rule on reviews lets it,
1531
+ the server appends the comment, and `applied` also resolves a thread made in
1532
+ Vitki, by the agent (D342). The server never writes to threads authored by
1533
+ nobody.
1534
+
1535
+ ### `vitki task set status|pinned|waiting|step|base|pr|review-sections`
1536
+
1537
+ One action, Organize the task (`action/task`), the target naming what is set
1538
+ (D542, D544). Each call is a `taskset` request on the channel with a `kind`
1539
+ (`set-status`, `set-pinned`, `set-waiting`, `set-step`, `set-base`, `set-pr`,
1540
+ `set-review-sections`), read by `onSessionAction` in `tasks/verbs.ts`; a script
1541
+ run sends the same kinds on the channel connection of its own run. The call is checked first
1542
+ (`taskSetRefusal`), then ruled by `verbAnswer(…, 'task', <target>)`: an allow
1543
+ does it, a never refuses it back to the CLI, and with neither one card waits.
1544
+ `waiting "<why>"` stores the first line (200 chars) as `tasks.attention` +
1545
+ `attention_at`, the reason shown on the board's Needs-you strip, until the
1546
+ user's next chat message to the task (`TaskService.message` with `fromUser`)
1547
+ clears it. `status "<line>"` is the run's `now`, the line beside the run
1548
+ strip, and a task with no workflow refuses it. `step <id>` takes back
1549
+ the last settled agent step, named by its manifest `id:`
1550
+ (`stepRefusal` in `tasks/taskSet.ts`, never a checkpoint) and goes through
1551
+ `TaskService.onStepReport`. `pinned -` reads JSON lines on stdin, each checked
1552
+ by the display vocabulary's block validator (`blockOf`), and stores them as
1553
+ JSON in `tasks.pinned` as ordered groups `{key, blocks}` (D574): a call with
1554
+ `--key` (a short slug, none is the group `""`) replaces only its key's group in
1555
+ place or adds it last, an empty input removes only its key's group, and
1556
+ `taskJson` carries them flat in group order (`GET /api/tasks/:taskId` and the
1557
+ board's task events) as `pinned`; a settled step clears every group. Sessions are prompted to run `task set waiting` before ending any
1558
+ turn that needs the user's input. `vitki notify "<message>"` puts one sentence
1559
+ in the bell and stays its own verb. `base <repo> <ref>` and `pr <repo> <url>`
1560
+ name the repo first (TM7): the request carries `repo`, a request with none is a
1561
+ parse error, and a repo the task does not hold is refused listing the task's
1562
+ repos. `taskRepoOf` matches the repo ID, then the folder, and `canonicalCall`
1563
+ rules, shows and remembers the call by the repo ID. The base lands in that
1564
+ repo's `baseSet` on the task's `repos` and the link in its `prUrl`, checked
1565
+ against that repo's own host and owner/name.
1566
+
1567
+ Each verb is one table row (D939). A session's verbs are `SESSION_VERBS` in `tasks/verbs.ts`: what the verb does in words, the `taskset` request kinds that call it with their readers, its perform, and where its refusal is answered. Every request opens through `withRequest`, and a refusal is `deny(dir, reqId, error)`. A script run's verbs are `SCRIPT_VERBS` in `tasks/scriptVerbs.ts`: the request kinds, the parse, the slot, the target, the denied name, the card and the perform. A new verb is a row plus its perform.
1568
+
1569
+ ### `vitki task agent start|message`
1570
+
1571
+ `agent-start` (agent, name, model, effort, login, prompt) and `agent-message`
1572
+ (name, text) on the `taskset` channel go to `onTaskAgent` in `tasks/verbs.ts`,
1573
+ one action, Organize the task (`action/task`), with `agent` as its target. The
1574
+ checks in `tasks/agentStarts.ts` refuse first: a name that is not a slug or is
1575
+ `main`, one that runs already, an agent the Library lacks or holds broken, a
1576
+ login the space's row for the harness does not name, and a message to a name
1577
+ that does not run. `verbAnswer` then rules it like `task set`. A start resolves
1578
+ its pick (`startPick`: the model's harness, else the agent's `pickFor` chain),
1579
+ reads the sandbox's free memory against `AGENT_START_MEMORY_FLOOR` (1 GiB of the
1580
+ sandbox's `sandboxSize`, less the backend's `metrics().memoryBytes`), seeds the
1581
+ agent's home (`reseedSession(task, [agent])`, `sessionHomesFor` adding every
1582
+ started agent), and calls `SessionManager.startAgent`. A started session is
1583
+ keyed by `sessionKey(task, name)` in its own map, so `launch` and a relaunch on a
1584
+ pick switch never stop it, and only the task's `stop` does. Its events go to
1585
+ `AgentBook.heard` and never to the transcript, and `GET /api/tasks/:taskId/agents`
1586
+ lists it with `runsOn` (name, agent, model, effort). A message to `main` goes
1587
+ through `TaskService.message` as a note that is not from the user, any other
1588
+ through `messageAgent`. A script run starts and messages no agent (the CLI
1589
+ refuses it). A started session that ends calls `onStartedEnd`, which
1590
+ `agentEnded` answers: an exit while the task runs sends main
1591
+ `agentEndedText` through `TaskService.message` at once, with the error its last
1592
+ `result` event carried, and an end the task's `stop` caused (Stop,
1593
+ `stopAll` at a restart) keeps the words in `join_notes`, which the next
1594
+ message to main carries once.
1595
+
1596
+ A thread on a chat message (`tasks/threads.ts`, routes in `api/threads.ts`) is a
1597
+ started agent named `thread.<id>`, a name `NAME_RE` refuses, so no session can
1598
+ message or stop it. Its row is in `chat_threads` (owner, task, the transcript
1599
+ line it hangs on, the session handle, the harness and pick, the replies, the
1600
+ summary and the files its edit tools wrote), and its conversation is
1601
+ `threads/<id>.jsonl` beside the task's transcript. A reply goes through
1602
+ `readyForTurn` (`tasks/lifecycle.ts`), the chat message's checks, then
1603
+ `launchStarted` with the row's handle as `resume`, after the session log replay.
1604
+ Its events go to `AgentBook.onThread`, never to the transcript or the agents
1605
+ list. A reply sent while a turn of the thread runs waits in the run's queue on the
1606
+ server (`waitForTurn` in `sessions/manager.ts`), never in the session, and the
1607
+ waiting replies go together, oldest first, at that turn's `result`. Remove takes
1608
+ one out before then. The session gets `THREAD_SUMMARY_PROMPT` at a turn's end
1609
+ with no reply waiting and the cap not holding, and the summary turn's `result`
1610
+ stops it. The session goes out as the proxy user
1611
+ `task-<id>~thread-<threadId>` on the task's own token: the owner the proxy reads
1612
+ is the task's, with `thread` added, and `withThread` carries the tag through a
1613
+ CLI request to `parkAsk`, which puts `thread` on a card's payload while the row
1614
+ stands (`liveThreadOf`). `waitLinkOf` opens the thread whose card waits first, unless the run stands on a checkpoint or a question of the task's own session waits.
1615
+ Send summary and close sends `threadSummaryMessage` through
1616
+ `TaskService.message` with no correction read, and Close stops the session,
1617
+ takes back the thread's cards and deletes the row, the file, the host mirror and
1618
+ the guest's own file (`removeLog`). Each change is a `thread` event on the board.
1619
+
1620
+ ### `vitki show <path> [--name "<name>"]`
1621
+
1622
+ Puts a file from the worktree on the task page as a view (D311), a design
1623
+ document included: the session writes the file, then shows it. The document
1624
+ view reads the file again whenever its `updatedAt` moves.
1625
+
1626
+ ### `vitki preview [--path /] [--clear]`
1627
+
1628
+ Sends `{path, at}` as a `preview` request (`--clear` withdraws it), which the
1629
+ server keeps as the task's announcement: the session announces that something is
1630
+ being served on port 4000. The
1631
+ Preview view polls `GET /api/tasks/{id}/preview` — which probes the guest's
1632
+ port 4000 through the backend's dial for liveness — and shows the page once something listens.
1633
+
1634
+ ### `vitki run cmd --with <input> [--reason <line>] [--timeout <s>] -- <command...>`
1635
+
1636
+ The request side of Secrets (see that section), inside an action only: a script run
1637
+ sends the request on its run's channel, waits on the same connection for the result,
1638
+ replays output, exits with the command's exit code
1639
+ (4 = denied). In a session the CLI refuses before anything is sent, exit 2 with
1640
+ `A session never holds a secret. Run an action that declares it: vitki run action --list`.
1641
+ A name no secret or pick answers needs `--reason`: without one the server writes the error `Nothing answers <NEED> yet, so the command needs --reason "<why>" to ask for a secret.` and parks no card (`bindNeed`). With one the card picks a secret, and its Not now answers `No secret was given for <NEED>.`
1642
+
1643
+ ### `vitki learn read` and `vitki learn write`
1644
+
1645
+ `learn read [--about me|@<login>|@*|<item>]... [--items]` is described under
1646
+ Learnings (What a session sees): one `learn` request per source,
1647
+ one decision each on the `learn-read` action, with every item `--about` in one
1648
+ request. The client alone reads the `@` words: `me` sends `from: me`, `@<login>`
1649
+ sends `from: <login>` and `@*` sends `teammates: true`, so the server's request
1650
+ keys stay as they were. `--about <item>` and `--items`
1651
+ are ruled as a read of yours (D848): the first answers each item's learnings, the
1652
+ second every item learning with its id and seen count. A learning about an
1653
+ item (the `item` column, a full path) is left out of a read of yours, and a
1654
+ learning about a space (the `space` column) is read only by a task of that space.
1655
+ A first message adds `What was learned about the apps here: vitki learn read --about apps/<id> ...`
1656
+ for each app the session loads, by an MCP server or an action, that holds a learning (`loadedApps`). A step
1657
+ prompt adds `What was learned about this step: vitki learn read --about ...`
1658
+ for the step's skill, agent and workflow that hold learnings (D850). `learn write "<rule>"` files
1659
+ one standing learning as a `learn-write` request of the `taskset` kind,
1660
+ `--about` naming me, a teammate as `@<login>`, the task's space, a repo of the task, or an item of the owner's Library by
1661
+ its full path (`learnableItems`, refused in words when it names nothing), each mapped to a login and a scope by `locate` (`learnings/about.ts`), ruled
1662
+ by `write-learnings` at filing (`onLearnWrite`): an allow files it as a rule
1663
+ thread marked `filed`, a never refuses it, and with neither one card files it
1664
+ on an allow. What was filed is decided, so the workflow's own
1665
+ `write-learnings` step lands it without a second ask, and a thread the
1666
+ session wrote into the store itself never lands.
1667
+
1668
+ ### `vitki item edit` (D851, D852)
1669
+
1670
+ `item edit <item> <file> --replace <words> --with <words> --because <id>...`
1671
+ files an `item-edit` request of the `taskset` kind, the action `edit-item`
1672
+ with the item's full path as its target (`onItemEdit`, `tasks/itemEdits.ts`).
1673
+ The item is found through the Edit surface's own scope (`resolveScope` in
1674
+ `api/guide.ts`, reached as `TaskService.itemScope`, which AppState wires), as
1675
+ the task's owner: `skills/<id>` is `account-skill:<id>`, a workflow, a script
1676
+ and an agent their own keys, a workflow's skill `skill:<wf>/<id>`, and a skill
1677
+ or script an agent or workflow embeds a folder of its carrier. A repo's item
1678
+ and one the owner's Library does not hold are refused in words before any
1679
+ rule is read (an item Vitki ships is copied first, below), and so are words that do not stand once, a manifest
1680
+ edit beyond its `title` and `description`, a file the save check refuses,
1681
+ and a `--because` id that is not the owner's learning about the item. An allow
1682
+ writes the file through the scope's `check` and `write` and answers at once.
1683
+ With no rule one card parks with no deadline, the request is answered at
1684
+ once, and the card's allow (`decideVerb`, with `shown`, the hash of the file
1685
+ the card drew) writes the edit only on the version the ask read or the one
1686
+ the card drew (D445). End run (`takeBackRunAsks`) takes a waiting card back.
1687
+ Each act of a task is a `task_acts` row (`noteAct` in `registry.ts`, the types in `core/acts.ts`): the
1688
+ action and its canonical params, the steps it happened in, the answer, how it was answered (`ActHow` in
1689
+ `shared/contract/run.ts`), the rule that answered by its layer and params, the card's id, reason, asker and times, a count and
1690
+ the first and last time. One action, answer, how and rule is one row whose count rises, and an allow by the rule a
1691
+ card just wrote folds into that card's row. A rule site records through `decideAct` or `noteRuleAct` in
1692
+ `tasks/decide.ts`, in the task owner's rows, and every card settles through `updateApproval` or `expireApproval`,
1693
+ which record the card's act in the same transaction (`settlingAs` marks a card a saved rule answered). Each task keeps
1694
+ its newest 500 rows, kept with the run's row and dropped with the task. `GET /api/tasks/:id/acts` lists them newest
1695
+ first, with the task's presses from `secret_uses` and each rule as the rules route draws it now.
1696
+ Each edit is an `item_edits` row: the item, the file, both words, the file's
1697
+ hash before and after, the learning ids, the state and the card, kept with the
1698
+ run's row. `GET /api/tasks/:id/item-edits` lists them with their lines and
1699
+ quoted learnings, and `POST /api/tasks/:id/item-edits/:editId {decision: undo}`
1700
+ writes the old words back while the file hashes to what the edit wrote. A
1701
+ learning a made edit rests on is left out of `learn read --about` and
1702
+ `--items` while the edit stands. A run reads its own copy of the workflow, so
1703
+ the edit reaches the next run.
1704
+
1705
+ Your copy of an item Vitki ships (D853, D1426) is an item of yours: the edit
1706
+ lands in the copy under its `vitki-` id like any edit, and the row's `copies`
1707
+ column stays, written as an empty list. Take Vitki's on the copy moves the
1708
+ file under a waiting card, so its press is refused as stale.
1709
+
1710
+ ### `vitki item read` (D858)
1711
+
1712
+ `item read <item> <file>` files an `item-read` request of the `taskset` kind,
1713
+ the action `item-read` with the item's full path as its target (`onItemRead`,
1714
+ `itemFileOf` in `tasks/itemEdits.ts`). The item is found as an edit finds it,
1715
+ your copy of an item Vitki ships read like any of yours, and a repo's item, one
1716
+ the owner's Library does not hold and a file the item does not hold are
1717
+ refused in words before any rule is read. The rule is read like a learn read:
1718
+ an allow answers at once with `text`, the file as it reads then, a never
1719
+ refuses, and with neither one card parks with the action's deadline, whose
1720
+ allow reads the file again. `mayRules` never writes it, so Allow what came
1721
+ leaves a read of your Library off.
1722
+
1723
+ ### `vitki tasks`, `vitki learnings`, `vitki repos` and `vitki library`
1724
+
1725
+ A read of your data, the action `read-data` with the thing read as the target
1726
+ (`tasks`, `learnings`, `repos`, `library`). A session sends `read-<what>` as a
1727
+ `taskset` request and `onSessionRead` rules it: an allow answers with the
1728
+ data, a never refuses, and with neither one card asks. `library`
1729
+ is a session's alone: `read-library` carries `of`, a kind of the Library or '', and
1730
+ answers `{ items: [{ kind, id, title, description, source }] }` read as the task's
1731
+ owner (`readLibrary`), an unknown kind refused before anyone is asked. A
1732
+ panel or a script run sends the same kinds on its own channel connection. `tasks` answers
1733
+ `{ tasks, held_starts }`. A task carries `since`, the time it began to need
1734
+ you, and a held start carries `since` too: the ISO time the oldest item
1735
+ waiting in its trigger queue was queued. A task also carries `created_at`, the ISO time it was created.
1736
+ `repos` answers `[{ name, forge, slug, source, default_branch }]`, `forge` and `slug` as a repo input gives them, both '' on a host Vitki has no driver for.
1737
+
1738
+ ### `vitki ask <question>`
1739
+
1740
+ One question to the user from a session stuck mid-step, blocking until it is
1741
+ answered. The request arrives as an `asks` request on the channel, the watcher hands it to
1742
+ `TaskService.onAskRequest`: a pending `approvals` row of intent `ask`, the
1743
+ question as the task's `attention`, a `run-parked` notification keyed
1744
+ `ask:<id>`, and the task set to `waiting`. No grant gates it, because asking
1745
+ has no effect outside Vitki, and there is no deny: the card carries the same
1746
+ deadline `expireAsks` gives a learnings card. `answerAsk` answers
1747
+ the held request with `decision: answered` plus the text, marks the row
1748
+ approved, and clears the attention once no question is left on the task; an
1749
+ expiry answers `decision: expired` instead. Either way the CLI unblocks, prints
1750
+ what it got (or one line saying no answer arrived) and exits 0, and the
1751
+ session carries on from inside the step it never left, so no pointer moves.
1752
+
1753
+ ### `vitki msg <task-id|self> --body <text> [--in <minutes>]`
1754
+
1755
+ A one-shot plain-text note to another of the user's task sessions, relayed by
1756
+ the server (containers cannot reach each other). The task id comes from
1757
+ `vitki tasks`. The
1758
+ request arrives as a `msgs` request on the channel, the watcher hands it to
1759
+ `TaskService.onMsgRequest`: validation (target exists and is live, not self,
1760
+ non-empty, at most 3 pending per sender), then either immediate delivery when
1761
+ a standing rule allows it or a pending `task_msgs` row the user decides from
1762
+ the Needs-you strip (Deliver with an optional remember-rule, or Deny). Rules
1763
+ are `msg` rows in `rules` (account, space or task layer) and only ever
1764
+ match same-repo pairs — cross-repo notes always ask. Delivery injects the note into
1765
+ the target session prefixed with a relay preamble that marks it as
1766
+ task-authored, approved-by-the-user, and carrying no authority. The sender's
1767
+ CLI waits on its connection for delivered/denied.
1768
+
1769
+ `self` (or the task's own id) names the sending task, and the rule is then
1770
+ asked with `to: self`. `--in <minutes>` (5 to 1440, required for `self`) makes
1771
+ a pending row with `delay_min`. Once let through, by rule or Deliver, the row
1772
+ turns `scheduled` with `deliver_at` = now + delay, one timer per row
1773
+ (`tasks/scheduledMsgs.ts`, armed again at startup, a past time fires at once),
1774
+ and the sender reads "scheduled to go in after <n> minutes". A pair holds one
1775
+ such row at a time. At `deliver_at` the timer acts as the row's owner, reads
1776
+ the rules again (a never drops the note as `denied` and keeps the act), then
1777
+ delivers through the same claim and chain. Stop, Done, Remove and a failure
1778
+ cancel the task's scheduled rows. The task wire carries them as
1779
+ `scheduled: [{id, at, body, self}]`.
1780
+
1781
+ ## Profile — connecting a Claude account
1782
+
1783
+ Vitki never reads the host's `~/.claude`. Each dev connects their own account,
1784
+ and the login is a Sign in secret. The shipped apps `apps/vitki-claude`
1785
+ (`sign-in: harnesses/claude-code`) and `apps/vitki-codex` (`sign-in: harnesses/codex`)
1786
+ are listed by `GET /api/profile/sign-in/apps` with `harness: claude|codex`:
1787
+
1788
+ 1. `POST /api/profile/sign-in {app, again?, held?}` for the Claude app starts
1789
+ Claude Code's own sign-in, `claude auth login --claudeai`, in a throwaway login
1790
+ sandbox under a pty, with `CLAUDE_CONFIG_DIR=/tmp/.claude` and
1791
+ `BROWSER=true` (202 → `{harness, ...status snapshot}`). For the Codex app it
1792
+ starts the device flow (202 → `{harness, status, url, userCode, error, expiresAt}`,
1793
+ then `GET /api/profile/codex/connect/events`).
1794
+ 2. `GET /api/profile/claude/connect/events` (SSE) streams
1795
+ `{"type":"log","line"}`, `{"type":"status","status":"starting|awaiting_code|done|failed","url","error"}`,
1796
+ `{"type":"done"}`, `{"type":"failed","error"}`. The UI shows `url` and a
1797
+ code field once status is `awaiting_code`.
1798
+ 3. `POST /api/profile/claude/connect/code {code}` forwards the pasted code.
1799
+ 4. Claude Code exits 0 with its login file written. `vitki-sandbox claude-login
1800
+ pack` in the same sandbox prints the file and its task copy (the refresh token
1801
+ set to `vitki-void`), both base64, the access token's end and the refresh
1802
+ token's end (null when the file names none). The server never
1803
+ parses the file: it holds the pack for the person, sealed in a `secrets` row
1804
+ shape (form `sign-in`, `harness` claude, the account in `login`) in memory only
1805
+ (`heldSignIns.ts`, 10 minutes, one person's), and the status snapshot and the
1806
+ `done` event carry the hold's id as `held`. `POST /api/profile/sign-in/held/:id/save
1807
+ {title, description}` writes the row under the name given, `DELETE
1808
+ /api/profile/sign-in/held/:id` drops the hold, and another person's id reads as
1809
+ none (404). A non-zero exit fails the flow with Claude Code's last lines,
1810
+ masked. Before a login ends (`RENEW_BEFORE_MS`, 30 min), a run that needs it
1811
+ renews it in the person's login sandbox (`claudeLogin.ts`): the file goes in over
1812
+ stdin, `claude-login due` moves its expiry 2 min ahead, inside the 3 min before
1813
+ its end where Claude Code renews, and Claude Code runs bare under a terminal
1814
+ (`script`, as the sign-in runs), nothing typed and its stdin left open.
1815
+ `claude-login ends` reads the expiry every 2 s until it moves or 60 s pass, then
1816
+ the terminal is stopped and its exit awaited (at most 10 s), then `claude-login
1817
+ pack` runs, so nothing packs a file Claude Code may still write. A pack whose
1818
+ expiry moved is saved while the sign-in's generation is unchanged, whatever came
1819
+ before it: a dropped renewal would leave a spent refresh token stored. Every saved
1820
+ renewal reaches every live Claude session of that person on that login, whatever
1821
+ started it, and a session takes only a copy that ends later than the one it
1822
+ holds. One renewal per login is in flight, none within 5 min of the last good one
1823
+ (`RENEW_GAP_MS`: an ask in that window takes the vault copy as it is, and a
1824
+ session that failed on that copy gets it written back, past its newer-only take), and one
1825
+ login sandbox per person runs at a time. A session's owner is read once at its
1826
+ launch, and a renewal reaches a session by that record. A renewal the provider refuses leaves the file with no expiry (Claude
1827
+ Code clears its tokens and prints nothing on the login), and only that sets the
1828
+ secret's `needs_reconnect`. A login past its refresh token's end
1829
+ (`refreshTokenExpiresAt`, which `pack` reports) reads `needs_reconnect` with no
1830
+ renewal tried. A Codex
1831
+ login's row holds its tokens sealed, and a session gets the access token
1832
+ alone. A second `POST /api/profile/sign-in` under the same name while one waits gets that one, and under another
1833
+ name ends it and starts its own. Renaming the secret moves every Runs on pick that names it. Log lines never contain
1834
+ it (redacted to `sk-ant-oat01-<redacted>`).
1835
+ 5. `GET /api/profile` → `{login, claudeAccounts:[{id, label, account, connectedAt, needsReconnect}], codexAccounts:[...]}`.
1836
+ `DELETE /api/profile/secrets/{name}` forgets the login.
1837
+
1838
+ ## Login & identity (`hub/auth.ts`)
1839
+
1840
+ A hub is local or hosted, a `server_settings` row written at the first start (`hub/people.ts` `mode()`). Hosted (`--hosted <url> --admin <email>`) sets `AppState.origin`: `hub/origin.ts` holds Origin and Host to it exactly, Fastify trusts 127.0.0.1 as the proxy, cookies carry Secure, and `cli/vitki.ts` refuses the mismatched flags (`START_REFUSALS`). `People.mayJoin(proof, link?)` is the one check for every way in, the first-run code, a setup link and a Google address with its `hd`, read against the `join_rule` row, the listed rows and the `domains` table through `domainAdmits`. `PUT /api/people/join-rule` writes the rule, Admin only, 404 on a local hub. A hosted hub's previews (`hub/link/previewOrigin.ts` picks the base, `hub/link/previewHosts.ts` holds `preview_labels` and the relayed listener on port+1 and the certificate ask on port+2) relay through `previewRelay` with no port of their own, matched by the exact Host of a person's label.
1841
+
1842
+ Several people sign in to one Vitki, against a list the Admin keeps
1843
+ (`hub/people.ts`). Every `/api` request needs a session; `/api/auth*`,
1844
+ `/api/health` and the join and setup routes are the only public ones, and the
1845
+ gate lives in the app-level onRequest hook (main.ts), which also resolves
1846
+ `request.person`. Each person has an ID that never changes (folders, sandbox
1847
+ names and rows carry it) and a name they change on Account (`PUT
1848
+ /api/account/name`), so a rename keeps the ID and refuses a name another person
1849
+ has, ignoring case and spaces.
1850
+
1851
+ - **One door per person**: there is no machine-wide sign-in mode. A `door` column
1852
+ of the `people` table holds `passphrase` or `google` for each person, set when
1853
+ the Admin lets them in or when they join. The sign-in screen lists nobody.
1854
+ `GET /api/auth` answers which doors exist (`methods`), whether setup is open
1855
+ and who is signed in. Every miss at the passphrase door reads the same, and a
1856
+ name nobody has, or a Google person's name, gets a challenge like a real one,
1857
+ so the door never tells who exists.
1858
+ - **Passphrase door** (name + vault passphrase): `POST /api/auth/local/challenge`
1859
+ hands out a challenge with the KDF parameters, the browser derives a sign-in
1860
+ key from the passphrase (HKDF split from the vault key) and signs the
1861
+ challenge, `/local/verify` checks the signature against the stored public key,
1862
+ and `/local/finish` spends a one-time ticket and opens the session. Verify
1863
+ also names the machine's box key, and finish takes the vault key sealed for
1864
+ it, 409 when the machine started since. The
1865
+ passphrase never leaves the browser, and one press signs in and unlocks the
1866
+ vault. Failures are rate limited per name (15 minute lockout).
1867
+ - **The vault key after proof**: the wrapped key leaves the server only after
1868
+ the person signs a fresh `vault` challenge with the sign-in key
1869
+ (`/api/vault/key`), and the vault status carries no `wrapped`. A sign-in
1870
+ challenge fails there and the other way round, and wrong proofs count per
1871
+ name.
1872
+ - **Google door** (`auth.google_client_id` set, optional `google_client_secret`):
1873
+ `GET /api/auth/google` returns the authorization URL (PKCE S256, state cookie,
1874
+ loopback redirect to `/api/auth/google/callback`). The callback exchanges the
1875
+ code, validates the id_token (audience and `iss`) and signs in a Google person
1876
+ by the stable Google account id (`google_sub`, tied at first sign-in). A
1877
+ Google person's passphrase only unlocks the vault, which stays locked after a
1878
+ Google sign-in until something needs a secret.
1879
+ - **Domains and Join**: the `domains` table lists Google Workspace domains the
1880
+ Admin allows (`POST /api/people` with a `domain`, `DELETE
1881
+ /api/people/domains/:domain`). A domain matches the id_token's `hd`, which
1882
+ must equal the address's domain, and gmail.com and googlemail.com are refused
1883
+ by name. A first sign-in from an allowed domain ends on the Join card: the
1884
+ callback sets a Join ticket in the HttpOnly `vitki_google_join` cookie (never
1885
+ in a URL, bound to that browser), `GET /api/auth/google/ticket` reads it, and
1886
+ `POST /api/auth/google/join` begins and then finishes in two calls, which
1887
+ makes the row, the vault and the session in one step. The server takes at most
1888
+ 5 new people per address per hour and 50 people per Vitki. An address on no
1889
+ list, and another Google account at an address already tied, are refused with
1890
+ a sentence that names the way out.
1891
+ - **Setup**: the first run prints a setup code in the server log. `POST
1892
+ /api/auth/setup` takes the code and either a name (passphrase door, then
1893
+ `/setup/finish` stores the wrapped vault) or `via: google`, which ends on the
1894
+ Join card in the same `vitki_google_join` cookie. Setup on a home that already
1895
+ has a vault is refused, so no wrapped key leaves there, and the person who sets
1896
+ up becomes the Admin. Setup sets nothing about anyone else.
1897
+ - **Add a person**: the Admin alone (`POST /api/people`). A passphrase person
1898
+ gets a one-time setup link valid 24 hours (`POST /api/auth/join` begins and
1899
+ finishes it, and opening it is that person's first sign-in). A Google person is
1900
+ added by name and address and reads Not signed in yet until the first
1901
+ sign-in. The Admin sends a new setup link to a passphrase person only
1902
+ (`POST /api/people/:id/reset`, a Google person answers 409 because a link would
1903
+ be a way in without Google), and the old vault is wiped only when the new
1904
+ passphrase is set, with the old passphrase working until then. The Admin also
1905
+ signs a person out everywhere (`POST /api/people/:id/sign-out`) and removes
1906
+ people (`DELETE /api/people/:id`: tasks stop, images, secrets
1907
+ and settings are deleted, sessions end).
1908
+ - **Recovery**: `--recover` at server start prints a one-time setup link for
1909
+ the Admin, and the vault is wiped when the new passphrase is set. A Google
1910
+ person has no setup link: they sign in with Google and reset their own vault
1911
+ on Account.
1912
+ - **Delete account**: everyone but the Admin can remove their own account
1913
+ (`DELETE /api/account`) after a signed `delete` challenge, or by typing their
1914
+ name when there is no vault. The person comes from the session only, the
1915
+ Admin gets 409, and the removal is the one `DELETE /api/people/:id` runs.
1916
+ - **Sessions and sockets**: every open socket closes when the session behind
1917
+ it ends, whether by sign out, removal or a reset.
1918
+
1919
+ **Everything has an owner.** Every repo, task, rule, secret, setting, Library
1920
+ item, trigger and queue row carries one owner (registry `owner` columns, per
1921
+ person homes `PersonHome`, `registry.of(person)`), and another person's row
1922
+ reads as a missing one. The Admin keeps machine-wide state only
1923
+ (`server_settings` rows, and the `people` and `domains` tables) and has no access
1924
+ to anyone's data. Every `owner` column refers to `people(id)` and deletes with
1925
+ the person, so removing a person is one delete. Sandbox, image and disk names
1926
+ carry the person and a hash of the home (`ownedName`, set by `useDockerHome`
1927
+ at start), so two homes never share an image or a sandbox,
1928
+ and only the Admin's commits are signed today. Sharing is
1929
+ export and import.
1930
+
1931
+ Sessions are 32-byte random ids, stored hashed in the `sessions` table (each row
1932
+ refers to its person and goes with them, read from the table on every request),
1933
+ sent as an HttpOnly SameSite=Lax cookie.
1934
+
1935
+ ## Onboarding (`hub/onboarding.ts`, `ui/src/pages/Onboarding.tsx`)
1936
+
1937
+ First run (no model connected, or no repos, and not done) renders the flow
1938
+ instead of the board, and `?onboarding=1` replays it for an account past it.
1939
+ The flow is data in `ui/src/lib/onboarding.ts`: `STEPS` (the cursor is an
1940
+ index into it), `stepsFor(path)`, `resumeAt`, `neighbours`, `progressFor`, the
1941
+ concept copy (`SLIDES`: `{id, title, lede, does[3], caption}`, no chapter
1942
+ field), the per-step `UNLOCKS` column, the setup gates (`readSetupGate`), the
1943
+ clone-auth sentence (`readCloneAuth`), all under matrix tests. Two blocks, two paths: the
1944
+ welcome's "Show me how it works" walks Tasks → Actions → Scripts → Secrets →
1945
+ Workflows → Triggers; "Just set it up" skips that block. Every concept screen
1946
+ is the same two-column frame (`.ob-screen.ob-two`, 300-460px | 1fr, stacking
1947
+ under 860px): left the title, the lede and three "what you do" lines
1948
+ (`ul.ob-does`), right an `Inert` frame (`ui/src/components/Glimpses.tsx`, with `StartsGlimpse`, `StepsGlimpse` and `RulesGlimpse`) that
1949
+ renders the product's OWN component inert from a fixture
1950
+ (`ui/src/lib/onboardingFixtures.ts`, generated from real JSON with allows and
1951
+ bindings cleared): Tasks = `TaskHeader` + `NetworkAskCard` + `MessageView`,
1952
+ Actions = `ActionsSection`, Scripts = `ScriptRow` (the GitHub app's publish-comments), Secrets =
1953
+ `SecretsDiagram`, Workflows = `Pipeline` (Review a PR, with its source node),
1954
+ Triggers = `TriggerRow` (the GitHub app's pr-opened). The frame carries the HTML `inert`
1955
+ attribute and `pointer-events: none`, and the components take an `inert` prop
1956
+ that drops their links and presses. Nothing in onboarding links to or names
1957
+ the chapters: the docs come after it (`Onboarding.test.tsx` walks the DOM for
1958
+ anchors). The choice is `onboarding.path` (`'' | 'full' | 'short'`,
1959
+ `usersettings`, `PUT /api/onboarding {path}`), so a resume lands on the same
1960
+ path. The configuration block takes the same frame, form left and an
1961
+ `UnlocksColumn` right: Vault (`VaultCreateForm`, then the optional forge-token
1962
+ line opening `SecretsEditor` prefilled) → Connect a model (blocked without a
1963
+ vault, with a press that opens the vault step) → Notifications
1964
+ (`NotificationsSection` itself) → Firewall (one sentence over `NetRulesEditor`)
1965
+ → Make it yours → How you work (the interview, blocked without an agent with a
1966
+ press back to Connect) → First repo (`AddRepoModal inline` with
1967
+ `cancelLabel="Later"`; token access with nothing stored says `NEEDS_TOKEN` on
1968
+ the form). Every setup step can be left with Later and names where it lives
1969
+ (`LATER`); the last step's Later or Finish marks the flow done and lands on the
1970
+ board. The header lists the current block's steps only. `vitki` itself probes
1971
+ prereqs before listening (Node, Git and the microVM runtime from the sandbox
1972
+ doctor, each fatal with the fix printed, claude CLI a
1973
+ warning — it only gates connecting Claude, state dir).
1974
+
1975
+ **The interview** is a host-side, no-tools agent call per turn
1976
+ (`claudeHost.runClaude` — pure text, isolated HOME, the connected account's
1977
+ token). The model works through the decided 10-topic script (branching, diff
1978
+ hygiene, dependencies, scope, definition of done, verification bar, docs &
1979
+ comment density, autonomy & approvals, correction scope, never-touch list,
1980
+ plus a catch-all) and returns only JSON `{say, actions, done}`. Vitki's own
1981
+ code applies the actions, and only one kind exists: `rule` (a Learnings
1982
+ bullet, source `onboarding`). The answer about branch names is a rule too,
1983
+ which the call that names each new task reads with the owner's other
1984
+ learnings for the repo, and that call names the branch, `<person>/<slug>` by
1985
+ default, checked before git sees the name (D471). Firewall and secrets stay out of its reach.
1986
+
1987
+ **Appearance** (`hub/themes.ts`, `ui/src/themes.ts`): themes are
1988
+ token sets over the ~20 CSS custom properties in styles.css — never free-form
1989
+ CSS, so approval cards stay legible and UI updates never fight a user
1990
+ stylesheet. Presets (Vitki/Ember/Moss/Dusk/Tide/Frost/Paper) and chat
1991
+ theming emit the same object: `POST /api/profile/appearance/describe {text}`
1992
+ runs a no-tools host agent call that returns a full validated token map
1993
+ (unknown keys and structural characters refused), applied and stored in one
1994
+ step via `PUT /api/profile/appearance` (the last designed palette is
1995
+ remembered in `appearance.custom`, so the picker's permanent Custom card
1996
+ survives preset switches). A stored theme is applied as
1997
+ inline `:root` overrides, deliberately one fixed look over both OS themes.
1998
+ Fonts and text size are separate choices on the same object.
1999
+ `appearance.font` names a font, a Library item (D344): a folder holding
2000
+ `font.yaml` and the font files it names, shipped under `fonts/<id>/` or
2001
+ yours under the profile's fonts folder, read by `FontStore`
2002
+ (`hub/fonts.ts`) and served by `hub/api/fonts.ts`, with each font
2003
+ file at `/api/fonts/<id>/files/<file>`. An id that names no font that loads
2004
+ reads as Plex. `font.yaml` names a family for each of four jobs
2005
+ (headings, interface, reading, code), each from Google Fonts, from files in
2006
+ the folder, or by name alone. The UI (`ui/src/lib/fonts.ts`) paints the font
2007
+ in use as the four font tokens (`--display`/`--sans`/`--reading`/`--mono`),
2008
+ each job's family leading that job's stock stack, loads Google faces from
2009
+ one css2 link and registers each font file as a `FontFace`. `ui/index.html`
2010
+ loads only the stock two families (IBM Plex Sans, IBM Plex Mono),
2011
+ the fallback for a face that does not load and all the
2012
+ sign-in page paints. `appearance.size` stores one of the scale ids mapped to
2013
+ the `--fs-*` tokens (`themes.SIZE_PRESETS`). Both apply alongside the
2014
+ palette, and a PUT that omits either keeps the stored choice, so a theme
2015
+ switch never resets them.
2016
+
2017
+ ## Vault — secrets encrypted at rest (`hub/vault.ts`)
2018
+
2019
+ Optional but recommended: a passphrase-locked envelope over everything in
2020
+ the database (the `vault_keys` and `secrets` tables: the Claude and Codex sign-ins and every named
2021
+ credential), so the disk — and any backup, snapshot, or copied `~/.vitki` —
2022
+ holds nothing decryptable. Designed VPS-first: the local deployment runs the
2023
+ identical model.
2024
+
2025
+ **Sign in secrets.** A `secrets` row of `form = 'sign-in'` names its app in `app` and seals one JSON token set (access,
2026
+ refresh, expiry, client id and secret, token endpoint, the address it signed in at). `hub/mcp/signin.ts` runs the
2027
+ sign-in: `POST /api/profile/sign-in` discovers the app's authorization server from its mcp.yaml address, registers Vitki and
2028
+ answers the authorization address and an id, `GET /api/profile/sign-in/:id` says waiting, saved or refused,
2029
+ `DELETE /api/profile/sign-in/:id` cancels, and `GET /api/profile/sign-in/callback` exchanges the code and writes the
2030
+ secret. The callback is the one route besides Google's that the request gate takes from another site (`CROSS_SITE_ROUTES`
2031
+ in `hub/origin.ts`, GET only), since the app's page sends the tab back, and a second callback for a sign-in already
2032
+ finishing changes nothing. `POST /api/profile/secrets/:name/rename` renames any secret, its grants, picks
2033
+ and uses moving in one transaction (`renameSecretRow`), and a login's every Runs on place too, sessions' picks included, from the one `loginPlaces` list the Runs on count reads. `SecretsStore.secret()` and `token()` answer a Sign in secret with its access token alone, so a command's one-shot sandbox
2034
+ and a local server's env never hold the refresh token. A Claude or Codex login (a row with a `harness`) answers null to
2035
+ both, to `signInSet()` too, and `pickRefusal` refuses it on every pick route, so its token reaches no input, no command and
2036
+ no forge call: only `claudeFor` and `codexFor` open it, for the harness launch. Only `signInSet()` opens the whole set, for the host's renewal
2037
+ (`refreshSignin`), which writes back through `renewSignIn()` only while the row is still a Sign in secret. A remote MCP server's header that takes a Sign in secret is written with the access token at each call
2038
+ (`remoteClient` in `hub/mcp/remoteClient.ts`, its calls an `own-fetch` job through the machine's proxy), renewed first once the token has ended and once after a 401, and only for the
2039
+ origin the secret signed in at.
2040
+
2041
+ **Envelope.** Each value is a libsodium sealed box (X25519 +
2042
+ XSalsa20-Poly1305) under the vault's public key, stored as `{sealed: <b64>}`
2043
+ where the plaintext string used to be. Sealing needs only the public key, so
2044
+ **writes always work**, locked or not — connect flows and secret saves
2045
+ never prompt. The private key is wrapped **in the browser**: the UI derives a
2046
+ KEK from the passphrase (Argon2id via hash-wasm; 64 MB, t=3) and AES-GCM-wraps
2047
+ the key; the server stores `kdf` + `wrapped` as opaque JSON and never sees the
2048
+ passphrase. Unlock = the browser unwraps and POSTs the private key, which the
2049
+ server keeps only in libsodium guarded memory (mlocked, guard-paged, excluded
2050
+ from dumps, zeroed on lock). Setup is two-step (`/setup` mints the keypair and
2051
+ returns the private key once; `/finish` stores the wrapped blob, re-seals all
2052
+ existing secrets, and leaves the vault unlocked until restart) with an echo
2053
+ check so a stale client can't store a wrap of the wrong key.
2054
+
2055
+ **Space keys** (`shared/contract/spaceKeys.ts`, `ui/src/api/spaceCrypto.ts`, `hub/tasks/spaceKeys.ts`,
2056
+ `machine/wall/spaceKeys.ts`). A shared space has one key: a 32 byte seed, its Ed25519 pair from
2057
+ `crypto_sign_seed_keypair` and its box pair converted from that. Only a browser makes one. A member's seal is
2058
+ `crypto_box_seal` of `{v, space, version, seed}` for the member's vault public key. A space secret is `crypto_box_seal` for
2059
+ the space's box key of a 64 byte Ed25519 signature followed by the JSON envelope `{v, space, name, kind, version, hosts, by,
2060
+ value}`, signed over a fixed context and the JSON. The hub keeps chains, seals and sealed rows, never a seed.
2061
+ `POST /api/spaces/:id/keys` (the owner alone) takes the next version, a seal for every holder with a vault and every space
2062
+ secret sealed again in one transaction, and refuses a skipped version, a bad chain signature, a missing seal or a missing
2063
+ secret. `PUT /api/spaces/:id/secrets/:name` refuses a key version that is not the newest and a space that is key due.
2064
+ Removing a member (`keysAfterLeaving`) drops their seals, marks the space and the spaces below key due and marks the
2065
+ secrets they could read `exposed`. A member added to a keyed space brings the owner browser's seal on the add. The browser
2066
+ pins each space's newest version and public key and each member's vault public key in local storage
2067
+ (`vitki.space-pins.<person>`), refuses a chain that does not reach from its pin, and asks before sealing for a changed
2068
+ member key. It holds the vault private key in tab memory (`ui/src/store/vault.ts`) from the unlock dialog until the vault
2069
+ locks. A picked space secret reaches the machine as a sealed part with `space` (`SpacePart`, `shared/link/sealed.ts`): the
2070
+ chain, the person's seal and the sealed value. The machine opens the seal with that person's vault key, checks the chain
2071
+ against its pins in `<home>/space-keys.json`, then the signature, space, name, kind and version of the envelope, and
2072
+ refuses a value whose host list is not empty, since no caller passes a host yet.
2073
+
2074
+ **Leases.** How long the key stays is a lease, and every unlock names one:
2075
+
2076
+ - `once:<req>` — rides an approval gesture; released as soon as the approved
2077
+ work has the value (5-min expiry as backstop). The ask cards grow a
2078
+ passphrase field while locked: approving and unlocking are one gesture.
2079
+ - `run:<id>` — a script run's lifetime: acquired at launch while unlocked (or
2080
+ from the unlock riding the launch approval), released when the run ends, so
2081
+ a global lease expiring mid-run never strands the script's `vitki run cmd --with`.
2082
+ - `global` — a deliberate standing unlock: for N hours or until restart
2083
+ (board banner, Settings → Vault, or the lease select on any ask card).
2084
+ Expiry is absolute, never sliding — activity does not renew it.
2085
+
2086
+ When the last lease goes, the key is zeroed; a server restart always comes up
2087
+ locked (re-login/unlock re-arms everything). Locked behavior fails closed and
2088
+ queues rather than errors: a pre-approved use becomes a `preApproved` ask card
2089
+ ("unlock to run"); an actual ask carries the passphrase field; task create and
2090
+ resume refuse with HTTP 423 and a clear message; background jobs (sync,
2091
+ learnings extraction) skip quietly. The CLI's own wait timeout is the
2092
+ max-wait — a run that never got its unlock reports the timeout in the
2093
+ transcript.
2094
+
2095
+ **Custody per secret.** A named secret is `vault` (default) or `open`
2096
+ — stored plaintext, working while locked, honestly labeled in Settings. `open`
2097
+ is for the narrow always-on automation token (a fine-scoped PAT a 3 a.m.
2098
+ script needs); the powerful secrets stay `vault`. Flipping vault→open is a
2099
+ decrypt and therefore needs an unlocked vault. Redaction of command output
2100
+ covers every value decryptable at the time; a sealed-and-locked value was
2101
+ never injected, so it cannot appear in fresh output.
2102
+
2103
+ **Limits, stated plainly.** The server holds plaintext values in memory at use
2104
+ time (that is what injection is), root can read process memory, and losing the
2105
+ passphrase means re-entering tokens — there is deliberately no escrow. The
2106
+ "make it a script?" nudge is adjacent: after 3 approved asks for the same
2107
+ secret + command head, the ask card suggests Settings → Scripts, steering
2108
+ repeated secret use toward the reviewed, pattern-bound path.
2109
+
2110
+ ## Secrets — `vitki run cmd --with`
2111
+
2112
+ Named secrets an action's script can request for one command at a time, without ever
2113
+ holding them. A session never holds one: no secret enters the task's VM except the
2114
+ model's access token, the session's review watcher has no `creds` channel, and its
2115
+ `vitki run cmd` exits 2 before anything is sent. A session uses a secret only by
2116
+ running an action that declares it. The user creates them in Settings → Inputs, on its Secrets side: a name like
2117
+ `gh:read-only`, the value, a description, what need it answers,
2118
+ and an ask policy (`always`/`never`, shown in the UI as the ask/allow default
2119
+ for when no saved rule matches). They live
2120
+ as rows of the `secrets` table, one per secret, sealed
2121
+ ciphertext (see Vault). **The name is a label, not enforcement**: nothing verifies that a token called read-only
2122
+ is; scope it where it was created (a fine-grained PAT, a restricted API key)
2123
+ and name it honestly — the ask card shows the description, not a verified
2124
+ scope. The API is write-only: values can be set and replaced, never read back.
2125
+
2126
+ Flow (all on the Vitki channel, D682, and the value never crosses it):
2127
+
2128
+ 1. The script runs `vitki run cmd --with <input> [--reason <line>] -- <command...>`.
2129
+ The CLI sends a request `{id, with, reason, command, cwd, at}` on the run's
2130
+ channel and waits on that connection for the result (default 900 s, and a
2131
+ redial after a lost connection sends the same request, which the server
2132
+ does not run twice). A name no secret answers needs a reason.
2133
+ No `creds/available.json` is written.
2134
+ 2. The server dispatches each request as it arrives (a request whose
2135
+ approval row exists is a replay and is ignored). After validating the untrusted
2136
+ request (`credentials.parse_request`), the server resolves the command against
2137
+ the credential's rules (`credentials.resolve`): **any matching deny wins
2138
+ outright**; otherwise the most specific scope (task > repo > account) with
2139
+ a matching pattern, longest pattern within it; nothing matching falls
2140
+ through to the secret's own ask policy.
2141
+ 3. `deny` → `res` `{decision:"denied", error:"denied by rule …"}` (CLI exits
2142
+ 4). `allow` → the server runs the command itself, in a microVM made for
2143
+ that one command (`secretOneshotSpecOnDisks` in `sandbox/spec.ts`, D688: the task's image,
2144
+ a read-only copy of the caller's files with a writable layer in memory over it,
2145
+ the task's egress proxy identity, no network device).
2146
+ The call copies the script run's own folder. The session's processes never share that
2147
+ sandbox. The value rides the env map of that one exec and the proxy token
2148
+ rides the sandbox's env, so no argv and no spec holds the value, and a
2149
+ `{name}` placeholder in the command is filled inside the one-shot sandbox from that
2150
+ variable (`sessions/oneshot.runWith`, 10-min timeout, output capped at
2151
+ 100 KB per stream). No one-shot sandbox starts while the egress proxy is down. When
2152
+ the command ends the layer's change set goes back through the caller's
2153
+ `vitki-sandbox apply` and the one-shot sandbox is removed. A file is written only while the caller's file still has
2154
+ the content the copy started from (the start is hashed on the host from the copy), refs and HEAD move
2155
+ only from their start, and a refused file is named on the command's stderr. Files that hold a masked
2156
+ value and ignored paths are named and never given back. The git state (refs, HEAD, index) goes in
2157
+ whole or not at all: when any part cannot go in, none of it moves and the note says which part and why.
2158
+ Every git object of a change set is scanned for masked values, and a pack arrives as loose
2159
+ objects. An object that cannot be checked holds the git state and is reported as not checked, never
2160
+ as a secret. A nested repo's `.git` folder travels whole or not at all. `export` runs closed to the
2161
+ agent's own processes: it starts as root, drops to the guest user and is non-dumpable, since the
2162
+ Firecracker kernel has no Yama. The server then writes `{decision:"allowed",
2163
+ exit, stdout, stderr, note?}` — `note` cites the rule on a pre-approved run
2164
+ and the CLI echoes it to stderr, so silent allows stay auditable in the
2165
+ transcript. Every known secret value is masked to `***` in stdout/stderr
2166
+ before the result is written (Actions-style redaction), so an echoed secret
2167
+ never reaches the result or the transcript. `ask` → an `approvals` row, a `vitki.credential` stream
2168
+ event, and `state=waiting` (amber tab).
2169
+
2170
+ The ask card (polled via `GET /cards/secrets`, shown on every task
2171
+ tab) is a two-step keyboard modal. Step one is just **Allow / Deny /
2172
+ Create rule…** (↑↓ or 1-3, Enter; Allow/Deny act on the exact command,
2173
+ once, nothing saved). Create rule… opens step two: ↑↓ picks where the rule
2174
+ lives (this task / this repo / everywhere / Never allow · don't ask again),
2175
+ ←→ slides the pattern breadth across the command's leading non-flag tokens
2176
+ (`gh *` ↔ `gh pr *` ↔ `gh pr create *`, shown highlighted on the command
2177
+ itself), Esc goes back. Confirming an allow-rule also resolves the pending
2178
+ command — save and run in one Enter. The server re-checks that a submitted
2179
+ pattern covers the pending command. Rules are listed (pattern + outcome +
2180
+ scope) and revoked in Settings → Rules.
2181
+
2182
+ The injected command runs in a one-shot sandbox on the task's own proxy identity, so the sandbox still applies —
2183
+ including the egress allowlist: granting `gh:full` does not open
2184
+ `api.github.com`; add the domain to the repo's network panel too. And any
2185
+ command that runs with a secret in its environment can read it, so a granted
2186
+ secret is only as safe as its own scope — which is the point of the
2187
+ read-only/full split.
2188
+
2189
+ ## Learnings
2190
+
2191
+ Rules are rows of the registry, one set per GitHub login under the owner (`learnings`,
2192
+ `learning_quotes`, `learning_seen`, `learning_visits`, `learning_notes`, `learning_tombstones`,
2193
+ each carrying `owner`, written per row and gone with the person) — whether or not that person uses Vitki. Vitki users get rules from their own
2194
+ sessions (chat corrections, resolved review threads, triage verdicts, the
2195
+ interview and notes), and everybody whose review comments the Learn from
2196
+ reviews workflow reads gets rules distilled from them. There is no repo-level file: repo rules live
2197
+ in the repo's own `CLAUDE.md`, which Claude Code already loads.
2198
+
2199
+ Every learning lands under the write-learnings rule (D404): an allow writes
2200
+ it at once, a never drops it, and with no rule one card asks. A new account
2201
+ starts with the allow, and the owner prunes afterwards. Three things make that safe:
2202
+
2203
+ - **Provenance**: every rule records where it came from, verbatim, in its
2204
+ `sources` column, which the UI shows. Sessions never see it.
2205
+ - **Tombstones**: deleting a rule stores its headline and sources in
2206
+ a `learning_tombstones` row, in the same transaction that removes the rule
2207
+ and its quotes. A new rule that near-matches a tombstoned
2208
+ headline (token-Jaccard ≥ 0.7) or cites one of its sources is dropped.
2209
+ Editing a rule keeps its provenance.
2210
+ - **Notes**: `POST /api/learnings/rules/derive` reads a note the owner typed
2211
+ for the standing learnings it carries (seat run, closed theme list). The note
2212
+ is kept whole in a `learning_notes` row and cited by the rules it produced
2213
+ as `note:<date>-<4hex>`. The list itself sorts newest added first.
2214
+
2215
+ `vitki learn read` and the page's `markdown` field render the rows as markdown, never
2216
+ read it back:
2217
+
2218
+ ```markdown
2219
+ # Learnings
2220
+
2221
+ ## <Theme>
2222
+
2223
+ - **<Self-contained headline rule>** (seen Nx), detail <!-- added 2026-08-29; src task:<slug>, pr:<repo>#<n>; repo <name> -->
2224
+ ```
2225
+
2226
+ `repo <name>` is a scope tag: the rule is rendered only for tasks in that
2227
+ repo. Extraction sets it when the model judges the rule repo-specific; chat
2228
+ corrections default to global. Adding a rule whose headline near-matches an
2229
+ existing bullet bumps `(seen Nx)` and merges the sources instead of appending.
2230
+
2231
+ ### Teammates
2232
+
2233
+ A teammate is anyone but the owner who holds a learning, under their GitHub login among the owner's rows. `GET /api/learnings/reviewers` lists them with the count of
2234
+ their learnings, most first, and keeps no ranking, review count or pin: who a
2235
+ task should read comes fresh from the `vitki-experts` scripts (`file-history`,
2236
+ `recent-reviewers`), never from a stored list (D399).
2237
+
2238
+ ### What a session sees
2239
+
2240
+ Nothing is seeded. The Vitki brief tells the session to read the
2241
+ owner's learnings with `vitki learn read`, and a session reads a
2242
+ teammate's with `--about @<login>` or every teammate's with `--about '@*'`. Each source of a read is
2243
+ its own `learn` request and its own decision on the `learn-read`
2244
+ action (`tasks/verbs.ts`): an allow answers at once, a never refuses with exit
2245
+ 4, and with neither the owner is asked on the task page. A new account starts
2246
+ with allows on `me` and `teammates` (`seedNewAccount`). A never on one login
2247
+ beats the allow on `teammates`. The answer is the target's rules for the
2248
+ task's repo (global plus tagged for it), rule text only with no provenance or
2249
+ counts, capped at 60 bullets for the owner and 18 for a teammate
2250
+ (`renderOwner`, `renderReviewers`). Learnings are never filtered by age, and
2251
+ `seedClaudeDir` removes the `learnings.md` and `reviewers.md` older tasks had
2252
+ copied in.
2253
+
2254
+ ### Extraction (server, `learnings/extract.ts`)
2255
+
2256
+ Triggered when
2257
+ - a thread authored by the viewer is resolved and has ≥1 agent reply (`claude`, `codex` or `agent`), or
2258
+ - a chat user message matches a correction pattern
2259
+ (`^(no|nope|don't|do not|instead|go back|actually|stop|why did you)\b`, case-insensitive)
2260
+
2261
+ The server calls `claude -p --model claude-haiku-4-5` on the host with the
2262
+ thread (or the last assistant message + the correction) and asks for
2263
+ `{"generalizable": bool, "scope": "personal"|"repo", "theme", "rule", "detail"}`.
2264
+ Non-generalizable → dropped silently. Otherwise the rule is added to the
2265
+ owner's file at once (scope `repo` becomes the `repo <name>` tag), source
2266
+ `task:<slug>`, subject to tombstones and dedupe.
2267
+
2268
+ ## Learn from reviews
2269
+
2270
+ Reading other people's review comments is a workflow, built from the same
2271
+ blocks as any other (`workflows/vitki-learn-reviews/`), with no sync service, no
2272
+ reviewer stats and no per-repo cursor of Vitki's own. Its first step is the
2273
+ script `gather-review-comments`, which reads the review comments left on the
2274
+ repo's pull requests since where the script stopped (its own `state:`), skips
2275
+ bots, short replies and a pull request author's own comments, and hands the
2276
+ batch on as `reviews.json`. The `distill` step writes learnings with
2277
+ `vitki learn write`, the `write-learnings` step lands them under the
2278
+ rule, and `close-task` closes the run's task. The workflow starts on its own
2279
+ `nightly` trigger, on each repo whose start rule allows it, and `new-task: false` keeps its runs off
2280
+ the board unless one needs you. Whose comments are read is the script's
2281
+ optional `Teammates` variable, every reviewer when unset.
2282
+
2283
+ ## Network asks (the egress proxy's cards)
2284
+
2285
+ A session behind the proxy asks for nothing up front: it connects, and the
2286
+ proxy decides (see Network). `vitki reach` is refused everywhere and files
2287
+ nothing. A connection to a host no rule answers parks one ask
2288
+ card per (owner, host), the connection waits, and every connection the same
2289
+ task or run makes to that host joins the card (`proxy/held.ts`). A card with
2290
+ no port came from a tool that went around the proxy.
2291
+
2292
+ The card answers one request and saves nothing: Allow once lets exactly the
2293
+ waiting connections through and Deny once refuses them (`decideNetwork`,
2294
+ `POST /api/tasks/{id}/cards/network/{req_id}` `{decision}`), and the next
2295
+ connection to the host asks again. Create a rule writes an `action/reach` row
2296
+ at the layer the card offers (account, repo or task), through the one rules
2297
+ table, and a rule saved there answers every waiting card it covers. A card
2298
+ nobody answers expires after five minutes and refuses its connections. A run
2299
+ nobody watches, like a trigger's check, gets no card: anything but an allow
2300
+ refuses. Domains are bare hostnames, `*` for every host. Endpoint:
2301
+ `GET /api/tasks/{id}/cards/network`.
2302
+
2303
+ ## Scripts — `vitki run`
2304
+
2305
+ Automation scripts sessions can trigger but never touch: the generalization of
2306
+ "pre-build an intent into Vitki" into "the user allows a concrete piece of
2307
+ code, and the grant attaches to that code". A script is a folder (Library →
2308
+ Scripts): `action.yaml` holds the settings (`SCRIPT_FIELDS`: title,
2309
+ description, `run`, needs, reaches, may, state, one at a
2310
+ time) beside the file `run:` names and any helper files, stored at
2311
+ `actions/<name>/` in the user's home or the bundled `actions/` dir. The run
2312
+ file carries no comment header. One name is one script across
2313
+ both homes: a name already taken is refused (409), never overridden.
2314
+
2315
+ **Every Library item is a folder (D236, D238).** A script, a trigger, a skill
2316
+ and a workflow are each a folder with a YAML manifest (`action.yaml`,
2317
+ `trigger.yaml`, `skill.yaml` beside `SKILL.md`, `workflow.yaml`) beside the
2318
+ files the item runs, and a workflow's own scripts, skills and triggers are the
2319
+ same folders under `actions/`, `skills/` and `triggers/` in the workflow's
2320
+ folder. `itemdir.ts` is the one reader: `itemFiles(dir)` lists every file by
2321
+ relative path, sorted, generated files (`isGenerated`: `__pycache__`, `*.pyc`
2322
+ and the like) left out at any depth, a symlink or special file refused with
2323
+ `ItemDirError`, capped at `ITEM_FILE_CAP` files and `ITEM_BYTE_CAP` bytes a
2324
+ file (`RUN_FILE_BYTE_CAP` for the run file). `hashFiles` over that list, the
2325
+ same as `hashItemDir`, is the hash every allow pins, for workflows, scripts
2326
+ and triggers alike. A run gets the snapshot the hash was taken over, written
2327
+ under the run dir's `item/` by `launch.writeRunItem`, never the folder as it
2328
+ stands by then. Duplicate, export and import all move whole folders through
2329
+ the same reader.
2330
+
2331
+ **Two layers, and only two.** Layer one is "may the agent run this script":
2332
+ one `rules` row per decision, action `run-action` with params `{action: <full
2333
+ path>, args}`, at your account, a space or a task, and a `pin` holding the
2334
+ folder hash the user read. Resolution is the ordinary `decide`: any never wins,
2335
+ then any allow, and an allow whose pin is not the folder on disk is filtered
2336
+ out first, so an edit to any file of the folder or a Vitki update leaves every
2337
+ allow behind and the next run asks again on the new folder. Layer two is secrets, untouched: which secret answers each declared
2338
+ need, asked and remembered the way every secret is. Revoking deletes the
2339
+ layer-one rows only. Deleting a script also deletes the rules at its own layer.
2340
+
2341
+ **Inputs in, output out.** A script writes into Vitki only through the verbs a
2342
+ script run may use (`notify`, `review post` and `reply`, `msg`, `run action`,
2343
+ `ask`, `state` and `task set`). A script prints what it did, and whoever invoked it reads that.
2344
+ The one fact a script hands back is the pull request it opened: the script
2345
+ runs `vitki task set pr <url> [--title <t>]`, and `recordPull` (`tasks/verbs.ts`)
2346
+ accepts the link only as the change's own address on the repo's host and
2347
+ owner/name, ASCII, nothing after the number, stores it as Vitki builds it
2348
+ (never as the run gave it) in `tasks.pr_url`. The task has no pull request
2349
+ view, and the Pull request panel links the number to this URL. A task that
2350
+ already has its pull request keeps that one. Nothing polls the host for a pull request or for the comments a script
2351
+ posted, so a pull request a human opened by hand is not joined to a task.
2352
+ A script that posts keeps what it posted in its own `state:` (D204), so a later
2353
+ run never posts an item twice.
2354
+
2355
+ **A run is a checklist (v40).** `tasks.run_items` holds one entry per manifest
2356
+ step as JSON (`{items: [{state, at, again?, fails?, prompted?, reached?, asked?, skipped?}],
2357
+ now}`), and `hub/runstate.ts` is the whole model: `readRunState` (a row
2358
+ with no items reads as its pointer's derivation, before it done, from it open),
2359
+ `pointer` (the first open item, which is what `tasks.step_index` is now kept as,
2360
+ derived and never set), `isHeld`/`holdingCheckpoint` (a checkpoint holds everything after
2361
+ it, wherever the work has got to), `reopen` (an item taken back puts every checkpoint
2362
+ after it that had passed into `again`), `displayOf` (done / in-progress /
2363
+ waiting / waiting-again / on-hold / not-yet) and a `FAIL_CAP` of 3.
2364
+
2365
+ Each item has exactly one source: an agent step is settled by the session
2366
+ (`vitki task step done [--output <name>=<value>]...`, a `step-done` request
2367
+ whose outputs `verbs.ts` checks against the step's `outputs:` kinds (`stepIO.ts`)
2368
+ and keeps as run values by name, and `vitki task set step <id>`, both sent
2369
+ as `taskset` requests and routed by `TaskService.onStepReport`), a checkpoint by the user's press, a script step
2370
+ by an observed rc 0. `advanceRun` (idle) settles nothing any more: it parks a
2371
+ checkpoint whose work is declared, nudges a lone script step once, or asks the session
2372
+ to declare where it stands. `afterSettle` is the one place that reads the whole
2373
+ list and does what it implies: finish when everything is settled, park a checkpoint,
2374
+ prompt an unheld agent step once (`prompted`), or settle a bare action. A step prompt
2375
+ held behind a blocking ask waits in memory, so its step index is kept as the
2376
+ `task_sandbox` key `held_step` until it goes in or the task drops it. At boot
2377
+ `promptHeldStep` clears that step's `prompted` and runs `afterSettle` again, which
2378
+ holds the prompt again while a blocking ask is open.
2379
+
2380
+ **A run on a task (RW6).** `GET /api/tasks/:id/workflows` lists the workflows the task can run, as the Library
2381
+ rows plus `changed`, the names whose files or repo scripts the branch changed against main's read. The task's own
2382
+ repo is listed from its worktree (`worktreeItems` names the items with one `ls-files`, a read opens each file with
2383
+ no-follow and checks the opened file's real path in `repos/itemsSafe.ts`, and the item loaders read a snapshot of
2384
+ what was read, never the worktree itself). `POST /api/tasks/:id/runs {workflow, inputs?}` is `startRunOnTask`
2385
+ (`tasks/runOnTask.ts`): one run at a time (409 while `workflow` is set and `outcome` is ''), the run columns reset,
2386
+ the copy staged with the pins taken from the worktree and marked as a run on the task (`run_on_task`), then the opening message to the
2387
+ task's own session. `runRoot` says where a run reads its repo items: the worktree for a marked run, main's read for
2388
+ every other. `POST /api/tasks/:id/run/end` is End run: outcome "You ended the run", the run's asks taken back, and
2389
+ `afterSettle`, `advanceRun`, `onStepReport` and the idle advance go no further (`runEndedByYou`).
2390
+ `POST /api/tasks/:id/run/checkpoint {decision: approve|changes, reason?}` answers a confirm checkpoint. Changes
2391
+ (Request changes, D768) sends `changesAskedMessage` ("Changes asked at step <n>." then the reason) to the session as
2392
+ your message and keeps the reason in `checkpoint_reasons` at the step, a row a removed run keeps. The run status reads
2393
+ `checkpoint.changes` while a reason was asked at the waiting checkpoint since the step began, and `reasons`. `RunTurns` notes
2394
+ each message sent to a session in order, so an idle that ends a turn of the person's own chat is not read as a step
2395
+ stopping (D580).
2396
+
2397
+ **Workflow steps are agent-driven.** A run-action step with no checkpoint in front of
2398
+ it is not fired by the engine: `enterStep` messages the session
2399
+ (`runScriptStepPrompt`) and the run waits there. The session invokes it with the
2400
+ ordinary `vitki run action`, gated by layer one exactly as any other invocation.
2401
+ When the task is a workflow run and the script is one of its run-action steps,
2402
+ `executeScript` prepares the step's inputs (`stepItems` + `stepLaunch`: the
2403
+ run's `VITKI_*` env, the read-only checkout with the WIP refusal,
2404
+ the approved-items file) and, on rc 0, calls `afterAction` to settle that item.
2405
+ Enforcement is at execution rather than at advancement: `stepRefusal` turns the
2406
+ invocation down when a checkpoint before that step has not passed, or when the item is
2407
+ settled. Three failures on one
2408
+ item park the run, and the strip's press clears the count. A refusal writes the reason to the CLI and parks the
2409
+ run on the step; the run strip's press there re-messages the session rather than
2410
+ running anything. A step behind a checkpoint is unchanged: its checkpoint's press still performs it
2411
+ server-side (`publishRun` → `runScriptImpl`).
2412
+
2413
+ **Triggers are their own half of the Library (v41).** A check is the file a
2414
+ trigger folder's `check.run` names. `ScriptStore.get` falls through to
2415
+ `locateCheck`, which reads the whole trigger folder as a `ScriptInfo` with
2416
+ `trigger: true`, its settings from the `check` map of `trigger.yaml` and its
2417
+ hash over every file of the folder, so an edit to `trigger.yaml` stales every
2418
+ allow on the check too.
2419
+ `ScriptStore.actions()` and `.triggers()` split the one
2420
+ store, `GET /api/scripts` and `GET /api/triggers` serve one each, and nothing
2421
+ ever lists both: `available.json` carries no trigger, `resolveScript` returns
2422
+ null for one (so a step naming a check is a `scriptProblems` line), and arming a
2423
+ check on an action script is refused. Bundled triggers ship in `triggers/` at
2424
+ the checkout root, beside `actions/`, and a workflow's bundle carries the
2425
+ folder of the trigger it is turned on with (`bundleFor`'s `triggers`), landing
2426
+ under the import's usual collision and rename handling.
2427
+
2428
+ **Checks and whens (v42).** Every automatic start is a trigger script the
2429
+ platform runs, so the closed `TRIGGER_KINDS` enum is gone: `TriggerKind` is a
2430
+ name, a `wf_triggers.kind` is the Library trigger the row runs (or `new-task`,
2431
+ the door), and the CHECK constraint on the column goes with the enum. The
2432
+ kinds Vitki used to watch for itself are bodies the shipped GitHub app carries in
2433
+ `apps/vitki-github/triggers/` that you can read: `pr-opened`, `review-requested`, `issue-opened`, `issue-assigned`,
2434
+ `issue-labeled`, each named by its full path, `apps/vitki-github/triggers/<id>`, which is also its row kind. A red build starts nothing any more: the bell for one on a run's
2435
+ own pull request stays, as a notification `syncHostFacts` raises. A manifest's `triggers:` list names triggers.
2436
+
2437
+ **Trigger directories (v45, v46, v48).** A trigger is a folder: `trigger.yaml`
2438
+ (`title, description, when:{cron}, check?, inputs?, outputs?`,
2439
+ where `check` is a map, `{run, needs?, reaches?, state?, one at a time?}`,
2440
+ read by `readSettings` with `CHECK_SETTINGS_SPEC`) beside the file `check.run`
2441
+ names and any helper files. A trigger with no check is `trigger.yaml` alone,
2442
+ and `TriggerStore.saveFolder` refuses anything else in that folder. A `needs`,
2443
+ `reaches` or `state` at the top level beside a check is a problem at its line,
2444
+ and a string `check:` is refused as not a map. Yours live in `profile/triggers/<name>/`, a workflow's own under `workflows/<wf>/triggers/`,
2445
+ and an app's under `apps/<app>/triggers/`, read by `TriggerStore` through its apps dir (`appTriggers()`, home `'item'`, named by full path).
2446
+ A row's `config` is `{when?, params?}` (the stored key `params` stays, the card calls them inputs), absent meaning "as the trigger says".
2447
+ The key was `wake` first: v48 re-keys every row's override.
2448
+ `daily.py` is gone: `vitki-update-deps` and `vitki-learn-reviews` carry `nightly`
2449
+ (`0 3 * * *`, no check, one run per fire). v45 rewrites every row's config and
2450
+ renames the `daily` kind to `nightly`. The five shipped GitHub
2451
+ checks live in the GitHub app (`apps/vitki-github/triggers/pr-opened` and so on), whose ID carries the host, and every ID Vitki ships starts with `vitki-` (D445). v46 renames the
2452
+ kind on rows, the check's approval pin, its need bindings and its grants, and
2453
+ the row's notes follow. v42 maps every armed row onto its body, carrying the filters
2454
+ on it: a `schedule` row becomes `daily` with its hour and teammates, a `custom`
2455
+ row becomes the trigger it named (and one that named none could never fire, so
2456
+ it does not survive). Those rows now point at bodies nothing allows yet, which
2457
+ is deliberate: a check runs with nobody watching, so the workflow reads as not
2458
+ ready until each is allowed once, through the same `allowedUnattended` gate a
2459
+ step's script goes through.
2460
+
2461
+ A trigger is two separable concerns, and the code says so:
2462
+
2463
+ - **The check** is the file `check.run` names, run with the rest of the
2464
+ trigger folder under the run dir's `item/`, and prints the items the trigger
2465
+ fires.
2466
+ `TaskService.check` runs it in the ordinary one-shot sandbox with no worktree and a
2467
+ network dir written for the repo (`runTriggerScript`, under
2468
+ `<profile>/trigger-runs/`), handing the row's filters over as the environment
2469
+ it reads (`triggerEnv`: `VITKI_AUTHORS`, `VITKI_HOUR`, `VITKI_WEEKDAY`,
2470
+ `VITKI_TEAMMATES`, `VITKI_TZ`). Its own `vitki run cmd` requests are served
2471
+ from standing rules alone (`serveTriggerSecret`), resolved for that workflow
2472
+ and repo: nobody is watching, so anything that would raise a card is refused
2473
+ in those words.
2474
+ - **The when** is whatever decides it is worth looking. `TaskService.wake` is
2475
+ the one entry every source calls (kept under that name: it is the seam that
2476
+ runs a check now, and `when` names the manifest key): a poke arriving while a check is in flight
2477
+ folds into it (`waking`, keyed by workflow, repo and trigger), and one
2478
+ arriving inside the floor is dropped, so no source can spin a container faster
2479
+ than `TRIGGER_EVERY_MIN` however noisy it is. An events feed or a webhook
2480
+ receiver would be another caller and nothing else.
2481
+
2482
+ The clock is Croner (pinned), one job per turned-on row, built by
2483
+ `scheduleTriggers` and keyed exactly the way a check is keyed. A daily row is a
2484
+ calendar job: its hour and minute, its weekday when it is weekly, on
2485
+ `serverTimeZone()` through Croner's `timezone`; `every` means nothing there
2486
+ and is not read. Every other row is a cadence, and a cadence can be longer
2487
+ than an hour, so the job ticks every minute with Croner's `interval` spacing
2488
+ it out. The jobs are the rows: `setTrigger` and `deleteTrigger` reschedule,
2489
+ an unchanged row keeps its own job so a save elsewhere never moves when it
2490
+ next fires, `shutdown` stops every one, and the host-facts job re-derives the
2491
+ set on its own pass so a workflow edited on disk stops firing by itself.
2492
+
2493
+ **A missed fire is missed.** There is no catch up and no startup sweep: on
2494
+ boot a row gets its job and the next fire is the next scheduled moment. A
2495
+ daily check the server slept through simply runs at its hour tomorrow, and a
2496
+ cadence check loses nothing because it fires again on the next interval.
2497
+
2498
+ The item contract is fixed for every check and about identity: a check adds
2499
+ each item with `vitki-script output add --id --title [--url] [--<output>]`
2500
+ (`triggers.itemOf` against the check's `outputs:`, `scriptOutputs.itemRefusal`
2501
+ for the caps), and stdout is only the run's log. The items land with the
2502
+ check's state in `commitCheck` on exit 0 and drop on any other end.
2503
+ `TaskService.settle` holds **current-set** semantics: a run starts for each
2504
+ added id the ledger does not have (capped at `CHECK_ITEMS_MAX` per run),
2505
+ and the ledger then becomes exactly the added set, minus anything the cap left
2506
+ for next time. An id that stops matching is dropped, so it fires again if it
2507
+ comes back; the ledger stays the size of the current set instead of growing
2508
+ forever; and `daily` is unaffected because dates never return. The item is handed
2509
+ over as `review/input/trigger.json`, or as the workflow's own input when the
2510
+ trigger's `outputs:` in `trigger.yaml` names one. Failures set a line on the trigger row
2511
+ (`triggerError`) and start nothing. What a check can supply is
2512
+ `missingParams`, which reads the trigger's `outputs:` and the item's own id and title, so `canTrigger` needs the Library in
2513
+ hand (`WorkflowContext.triggers`) and nothing is offered from a static table.
2514
+
2515
+ The native polling loops are gone with the kinds, and so is every other
2516
+ background read that used a secret (D410): Vitki runs no poll that joins a
2517
+ pull request to a task or watches a build, and the repo scan is gone with the
2518
+ reviewer sync. A secret use is one you start with a press (`secretUses.ts`),
2519
+ recorded for Activity: Add repo, Rebuild, a pick on Sandbox image, Use this
2520
+ image, Create task (only when the task continues a branch) and Run, plus the
2521
+ New task and Run dialogs' pull request listing. What reads review comments is
2522
+ the Learn from reviews workflow's own gather script, on its own trigger.
2523
+
2524
+ **Bodies a workflow carries (v6 of the Library's shape, no migration).** A
2525
+ workflow directory may hold `actions/<name>/` and `triggers/<name>/` folders,
2526
+ built the way Library ones are, beside its `skills/<name>/` folders, and `ScriptStore.locate` resolves a name the way the
2527
+ container resolves a skill: the workflow's own first, then the Library. Every
2528
+ lookup is therefore bound to one workflow (`TaskService.scriptsOf(def)`,
2529
+ `WorkflowContext.scripts(name, def)`, `lookupIn`), so `notify` in one workflow
2530
+ is never `notify` in another. `ScriptInfo.home` gains `'workflow'` with the
2531
+ workflow's name beside it; `list()`, `actions()` and `triggers()` still see only
2532
+ the Library, so no tab lists an embedded body, and the workflow's own detail
2533
+ carries them (`embeddedOf` → `embedded: scriptJson[]`). They are allowed exactly
2534
+ like any other body: `scriptAllowance` derives the workflow from the scope id it
2535
+ was asked with and pins that workflow's body, so an ask card about a run of that
2536
+ workflow decides about the body that run would execute. `declaredNeeds` walks
2537
+ them too, so a secret can be bound before that run stops on it, and
2538
+ `writeAvailableScripts` prepends them for the run's own session. Bundles need
2539
+ nothing new: `workflowDirFiles` already carries the directory through
2540
+ `itemFiles`, every folder whole with generated files left out, and
2541
+ `bundleFor` skips an embedded name from the `actions:` list so it does not
2542
+ travel twice.
2543
+
2544
+ `ScriptStore.promote(wf, name, to)` moves one up into the Library
2545
+ (`POST /api/workflows/:name/embedded/:script/promote`, 409 + inline rename on a
2546
+ taken name, exactly like an import). Nothing in the manifest is rewritten: with
2547
+ the local folder gone the same resolution order finds the Library copy. Allows are
2548
+ pinned to the folder hash, so a move that keeps the name and every file keeps the allow,
2549
+ and a rename leaves the new identity unallowed until the first run asks.
2550
+
2551
+ **Scripts a skill carries.** A skill directory (yours under the profile's skills
2552
+ dir, your copies of the shipped `skills/<skill>/` among them) may hold `actions/<name>/` folders, each
2553
+ built the way a Library script is. Such a script is invoked by its full path `vitki run action skills/<skill>/actions/<name>`
2554
+ (`skillScriptPath`, parsed by `splitPath`, accepted by `parseRunRequest` beside `SCRIPT_NAME_RE`):
2555
+ `ScriptStore.locate` sends a `skills/<skill>` parent to `locateCarried`, which looks
2556
+ in the user's skill dir and nowhere else, and a bare name
2557
+ never reaches into a skill, so a carried script can never shadow a Library name.
2558
+ Any other item's embedded script is offered the same way: `locateEmbedded` reads it in that item's
2559
+ folder (`itemFolder`, home `'item'` with `embeddedIn`, a workflow's own keeping home `'workflow'`), and the
2560
+ rules at that script's own layer answer whoever runs it.
2561
+ `ScriptInfo.home` gains `'skill'` with `skill` beside it; no row, no Library tab,
2562
+ `carriedBy(skill)` feeds the skill's card (`GET /api/profile/skills` →
2563
+ `carries: scriptJson[]`) and `carriedBySkills()` feeds `available.json`, the
2564
+ prompt's action inventory and `everyBody()` (needs panel). Allows, takes and host
2565
+ rules are keyed by the full path (`action/run-action` pattern
2566
+ `skills/<skill>/actions/<name> *`, script-scope rows under that id), every `/api/scripts/:name`
2567
+ route takes it URL-encoded, and the pin stales on edit like any body. The
2568
+ seeded skill dirs exclude `actions/` (`seed.withoutCarriedScripts`) so the
2569
+ session never holds a copy it could run around the allow. A session-invoked
2570
+ run (no workflow step) gets no step env, and the repo it reads comes in a Repo
2571
+ input filled at the launch (TM15), with no WIP refusal (nothing leaves the host). The guide's `account-skill`
2572
+ scope lists and writes `skill.yaml`, `SKILL.md` and the folders under
2573
+ `actions/` beside them, and `marksOf`
2574
+ shares `skills.SCRIPT_CALL_RE` so the full-path invocation lights the same line
2575
+ on the card and in the editor. A skill's bundle carries these folders inside
2576
+ the skill's own folder, never as separate `actions:` entries.
2577
+
2578
+ **What changed since the allow (v47).** `script_bodies(hash, body, seen_at)` is
2579
+ content addressed: `TaskService.pinOf(info)` writes the folder under its hash
2580
+ (`registry.rememberFiles`, every file by relative path as JSON in the body
2581
+ column) wherever a pin is written (decideScript, allowScript, setTakeNeed,
2582
+ setTakeHost), never deleting, and `pinnedFiles(hash)` reads a folder back.
2583
+ `scriptJson.previous` is the folder of
2584
+ the first stale allow's pin (null with nothing stale or an allow older than the
2585
+ store), and the card (`ScriptBody`, `readStaleLine`) offers "What changed" as
2586
+ the shared read-only `LineDiff` the edit screen's What changed also renders.
2587
+
2588
+ **The run file is named for its language.** `action.yaml`'s `run:` names the
2589
+ file, and `bodyExt` picks `.py` or `.sh` by shebang where a creation names the
2590
+ file. The
2591
+ one-shot sandbox execs the run file itself (`oneshot.scriptRunCommand`, written 0755 under
2592
+ `item/`), so the shebang decides the interpreter, with bash as the fallback for a
2593
+ file that has no shebang. The settings live in `action.yaml`, so a run file in
2594
+ any language works, comment syntax aside. Every shipped
2595
+ body is Python now, stdlib only, with `vitki run cmd ...` written as the literal
2596
+ line it is so the reach scan still reads it; the interpreter comes from the
2597
+ image, since the shipped images list `python3` and a script declares `install python3`. A script in `actions/`
2598
+ whose `action.yaml` declares no `title:` is a tool of the checkout's, not a
2599
+ shipped script, and a folder in `triggers/` with no `trigger.yaml` is no
2600
+ trigger. Checkout tools live in `dev/`.
2601
+
2602
+ **Skill to script, derived.** `skills.skillReaches` scans a skill's body for the
2603
+ literal `vitki run action <name>`, cached with the file's mtime and size beside
2604
+ the parsed skill. It is identity matching, so prose that mentions a script reads
2605
+ like prose that instructs one, and every surface built on it words itself as an
2606
+ observation: `Skill.reaches` on the payload, `TaskService.reachesOf` adding where
2607
+ each stands, a "Reaches for" section on the skill, skill rows in the script's
2608
+ "Used by", and a `readiness` line at `asks` severity, never blocking.
2609
+
2610
+ **A need can answer per script.** `secretForNeed` reads one chain,
2611
+ `pickForNeed(need, where, script?)`, innermost first: script, workflow, task,
2612
+ repo, then account, and the pick says the tier that answered it. `needPicks`
2613
+ (`GET /api/needs/:need/picks`) lists every layer's own pick for one need,
2614
+ and `PUT /api/needs/:need/bindings` writes a pick at one scope, `scope:
2615
+ 'script'` included, so a script's own pick outranks every other layer.
2616
+
2617
+ **Sharing is one format with a root.** `vitkiBundle` gained
2618
+ `root: {kind, name}` and one list per kind (`files` for a workflow's directory,
2619
+ `actions`, `triggers`, `skills`), each item `{name, files: [{path, content}]}`,
2620
+ the whole folder as `itemFiles` reads it, generated files left out. A skill
2621
+ travels in the standard form, `SKILL.md` with front matter from `skill.yaml`
2622
+ (`standardSkill`), with its carried `actions/<n>/` folders. `landingFiles`
2623
+ splits that standard `SKILL.md` into `skill.yaml` and `SKILL.md` through
2624
+ `splitStandardSkill`, and a script or trigger with no folder of its own lands as
2625
+ that one bare file instead, since it is not a script or trigger until
2626
+ `action.yaml` or `trigger.yaml` sits beside it. A bundle with no root is refused.
2627
+ `TaskService.bundleFor(kind, name)` walks the closure over the edges pass 6 made
2628
+ real and nothing else: a workflow's steps' scripts, the skills those steps
2629
+ resolve to, the triggers `triggerNamesOf` says it is on with, and the scripts
2630
+ those skills reach for. A skill brings its reached-for scripts, and a script or
2631
+ a trigger brings its folder alone. A script or trigger a workflow carries itself
2632
+ is skipped, because the directory already carries its folder.
2633
+ `GET /api/library/:kind/:name/bundle` serves any root, and the workflow route
2634
+ stays for the link that already exists.
2635
+
2636
+ Import is the same door and the same machinery: `reviewBundle` reports one
2637
+ `entities` list with a `kind` per row and the same new/reused/conflict states,
2638
+ `landBundle` resolves every name before the first byte and writes each folder
2639
+ whole through `saveScript`, `saveTrigger` (`TriggerStore.saveFolder`) and
2640
+ `saveSkill`, a skill landing as `skill.yaml` beside `SKILL.md`.
2641
+ `rewriteManifest` now rewrites renamed skills on `agent:` lines as well as
2642
+ renamed scripts on `run-action:` ones: a rename has to reach the manifest or the
2643
+ workflow would name a body that is not there. Nothing account shaped is in a
2644
+ bundle by construction, because `bundleFor` reads bodies and files and never
2645
+ touches a grant, a `wf_triggers` row, a binding or a secret.
2646
+
2647
+ **Access and run approval are two questions (pass 10).** A script's panel
2648
+ answers exactly one of them per section, and so does the store.
2649
+
2650
+ - **Access** is about the body: may it take what answers a declared need,
2651
+ whenever it runs, whoever started it. One row per script on the secret its
2652
+ need picks for the script, scope `script`, scope id the script's name,
2653
+ pattern `*`, pinned to the folder hash. No scope dimension:
2654
+ the question has nothing to do with the caller. `TaskService.takesNeed`
2655
+ answers it and `setTakeNeed` writes it; `takesOf` puts one row per declared
2656
+ need on the script payload as `takes`. The seam is in
2657
+ `onOneshotSecretRequest`, after `bindNeed` has resolved the need to a
2658
+ credential and after the deny check, so a deny at any scope still wins, an
2659
+ unbound need still parks the pick card, and a need `action.yaml` never
2660
+ declared is never covered. A card's "always allow for this script" writes this row
2661
+ instead of a command-pattern rule when the card came from a declared need;
2662
+ "never allow" still writes the rule, because a deny has to keep denying. The
2663
+ pattern rules written before this exist stay honoured, read-only, and nothing
2664
+ writes new ones for a declared need.
2665
+ - **Run approval** is about the caller: who may start it without asking. That
2666
+ is the `RUN_SCRIPT_SLOT` rows that were always there, scoped account, repo,
2667
+ task and workflow, written and removed through the one rules table
2668
+ (`POST /api/rules`, `DELETE /api/rules/:key`, `tasks/rules.ts`), where a
2669
+ run-action rule stores the script's full path (D397) and a save carries the
2670
+ hash of the body the card drew (`shown`), refused with the newer body when
2671
+ the script changed since (D398). There is no per-script allow route.
2672
+ `scriptJson` lists denies beside the allows so the ledger can render them.
2673
+
2674
+ Two orthogonal grant gates, both rows in the existing `grants` table:
2675
+
2676
+ - **Invocation** — who may pull the lever, with which arguments. Stored under
2677
+ the reserved slot `action/run-action` (contains `/`, impossible as a real
2678
+ secret name), pattern over `[name, ...args]`, scopes account/repo/task and
2679
+ workflow (scope id `name@hash`). `vitki run <name> [args]` sends
2680
+ a `run` request on the channel; the watcher answers it; no allow covering
2681
+ it → a script ask card (intent `'script'`, `GET
2682
+ /api/tasks/{id}/cards/scripts`, `POST .../cards/scripts/{req_id}`) carrying the
2683
+ body and whether an allow went stale, with the same two-step rule builder as
2684
+ secrets — ←→ pins argument positions (`watch-ci *` ↔ `watch-ci 7 *`), and
2685
+ the scope row offering task/repo/workflow/account. The same card opens with
2686
+ no run in scope from a workflow step's chip or the run strip, and saves
2687
+ through `POST /api/rules` like any card. A saved rule answers a waiting
2688
+ script ask only when it covers the body the card drew (D398).
2689
+ `vitki run --list` prints
2690
+ `run/available.json` (every installed script).
2691
+ - **Script secrets** — what the running script may do. The script itself
2692
+ calls `vitki run cmd --with <cred> -- <command>` inside the one-shot sandbox; the server
2693
+ resolves it against grants scoped `('script', <script-name>)` plus account
2694
+ rules (account denies still win; script beats account otherwise), falls back
2695
+ to the secret's ask policy, and asks on the invoking task. The card names
2696
+ the script and offers "Allow · for script <name>" (scope `script`). The
2697
+ secret value is injected per command in the env of that one exec — it never
2698
+ sits in the one-shot sandbox's environment for the run's lifetime.
2699
+
2700
+ **The one-shot sandbox** (`sessions/oneshot.runScript`): an ephemeral microVM named
2701
+ `vitki-run-<run-id>` (`scriptOneshotSpec`) from the invoking task's repo image.
2702
+ Deliberately NOT the task's sandbox — the session shares that uid and could read a sibling
2703
+ process's environment, which would let it steal any standing grant. A run in
2704
+ a task gets a read-only copy of one repo's folder at the folder's own path in the
2705
+ workspace, cached per state (`sessions/oneshotDisks.ts`, D688): the repo its first
2706
+ `repo` input names, else the task's only repo, else none (`tasks/repoInputs.ts`
2707
+ `fillTaskRepoInputs`, TM15). `VITKI_WORKSPACE` names the workspace. A `repo`
2708
+ input reaches the run as the repo as it stands in the task (`TaskRepoValue`:
2709
+ name, slug, forge, source, folder, path, branch, base, pr, clone), a `repo[]`
2710
+ input as every repo of the task, and no `VITKI_BRANCH/BASE/TASK_PR/FORGE/CLONE`
2711
+ or `VITKI_WORKTREE` is set. The review folder's `config.json` holds each repo's
2712
+ base by its folder (`{"bases": {...}}`), written at every start (`writeReviewConfig`). The hub
2713
+ keeps `tasks/<id>/runs/<run-id>/` empty, the mark that the id ran. The run's folder is a `disk`
2714
+ mount of the run's need, made on the machine's disk from the job's input (`runFolderOf` in
2715
+ `hub/tasks/launch.ts`): `item/`, the folder snapshot the allow was read against, `items.json`,
2716
+ `input/`, an empty `output/` when the step hands a file on, `creds/` and `tmp/`. The machine puts it
2717
+ into the one-shot sandbox as a tar at the start, at `/vitki/review`, takes it out as a tar before the
2718
+ sandbox is destroyed, and hands back `report/` and the output file masked on the job's result
2719
+ (`machine/jobs/runFolder.ts`). File inputs go into the one-shot sandbox's memory and never to a disk (D438 holds).
2720
+ The one-shot sandbox has no network device and reaches the proxy as a task does, and a run whose sandbox cannot be made never runs
2721
+ and exits 97 with the reason (`noNetworkRun` in `sessions/oneshot.ts`).
2722
+ It then execs `/vitki/review/item/<run>`, the file `action.yaml`'s `run:` names
2723
+ (`ScriptRunSpec.entry`), through its shebang or with bash when it has none.
2724
+ The server answers the run's `vitki run cmd --with` requests on the run's own
2725
+ channel connection while the sandbox lives, routes approved commands into a fresh sandbox of
2726
+ their own on a copy of the run folder (the changes go back to the one-shot sandbox by swap), and
2727
+ answers the task-side CLI's `run` request with the final result (rc, stdout/stderr, capped
2728
+ and secret-redacted like credentials) on that connection (30-min run
2729
+ timeout; a timed-out one-shot sandbox is killed and removed). Script args come from the
2730
+ session, so a narrow grant is only as narrow as the script's own input
2731
+ handling — patterns pin argument positions, the allowed body validates the
2732
+ rest; that split is the design, surfaced on the ask cards.
2733
+
2734
+ ## Server API (Fastify, `http://127.0.0.1:8470`)
2735
+
2736
+ The API's shape is the zod schemas in `shared/contract/`, one file per resource (`task.ts`, `run.ts`, and
2737
+ `status.ts` for the display vocabulary a task carries), with `index.ts` naming them all. The server serializes the
2738
+ task, the task list, the board stream's task rows and the run routes to the schemas' inferred types, and the route tests
2739
+ parse each of those replies with `wire()` in `test/client.ts`, which fails with the field's path on a field missing
2740
+ and on a field the schema never declared. The UI imports its task and run types from the same schemas, type only, and
2741
+ its task and run calls go through `typed()` in `ui/src/api/client.ts`, which parses the reply in tests and on the dev
2742
+ server. Both sides read zod from their own install (a tsconfig path, and Vite's dedupe), so `shared/contract/` has no install
2743
+ and the bundle is built as before. A resource joins the contract as a new file there, and the client calls still
2744
+ outside it are counted by `uncheckedApiCasts` in `tools/ratchet.mjs`, which may only fall.
2745
+
2746
+ Loopback only. Requests whose `Host` is not `127.0.0.1`/`localhost` (any port)
2747
+ get 400. Vitki's own origins are exact: `http://127.0.0.1:<port>` and
2748
+ `http://localhost:<port>` for the port the request reached, and the same two
2749
+ names on each built-in dev server port (5173, 5174, 5175, the
2750
+ Vite dev servers, whose proxy keeps the browser's Origin). A WebSocket upgrade
2751
+ whose `Origin` is missing or not one of them is closed (1008). A request other
2752
+ than GET, HEAD or OPTIONS that carries an `Origin` outside them gets 403
2753
+ before the session gate, and one with no `Origin` (curl, the CLI) passes. A
2754
+ task's preview proxy on `127.0.0.1:41000-41999` is the same site as Vitki and
2755
+ gets the session cookie, which it takes out before the dev server, and in local mode a cookieless request is the
2756
+ owner, so the origin is the gate that keeps preview code out (D334). Every `/api` route except `/api/auth*` and `/api/health` sits behind
2757
+ the session gate (see Login & identity): implicit owner auth in local mode,
2758
+ cookie required in google mode, 401 otherwise. Host `claude -p` calls (interpret, learnings extraction, token
2759
+ validation) run in a throwaway sandbox (D415) and take the prompt on stdin with
2760
+ `--tools "" --setting-sources ""`, the sandbox's own home as `HOME`, and the
2761
+ profile token when connected.
2762
+ Every `RuntimeError` is no longer a 409: only `ConflictError` (no free port,
2763
+ profile-flow misuse) maps to 409. `VaultLockedError` maps to 423 (Locked):
2764
+ the operation needs a sealed secret and no vault lease is live.
2765
+
2766
+ REST (JSON):
2767
+
2768
+ ```
2769
+ GET /api/health
2770
+ GET /api/config {login, defaultModel, models[]}
2771
+ GET /api/repos [Repo]
2772
+ POST /api/repos RepoCreate → Repo (kicks off clone+build; progress on /api/repos/{name}/events)
2773
+ GET /api/repos/{name}
2774
+ PUT /api/repos/{name} a typed `source` fixes the row (`setSource`: 422 on a source `sourceProblem` refuses, 409 while the repo builds)
2775
+ DELETE /api/repos/{name} refuses if tasks exist
2776
+ GET /api/repos/{name}/events SSE: {"type":"log","line":..} / {"type":"done","ok":bool}
2777
+ GET /api/repos/{name}/branches [{name, isBase}]
2778
+ GET /api/repos/{name}/pulls [{number, title, body, branch, base, url, author}] open PRs; [] for non-GitHub sources
2779
+
2780
+
2781
+ GET /api/auth {mode:"local"|"google", signedIn, user} (public)
2782
+ POST /api/auth/local sign in as the owner; 403 in google mode; sets the session cookie
2783
+ GET /api/auth/google {url} — authorization URL (PKCE); browser navigates there
2784
+ GET /api/auth/google/callback code exchange + id_token validation; sets cookie; redirects to /
2785
+ POST /api/auth/logout drop the session; sets the signed-out marker cookie → 204
2786
+
2787
+ GET /api/onboarding {active, cursor, done, path, asked, claudeConnected, openaiConnected, githubConnected, repoCount}
2788
+ PUT /api/onboarding {cursor?, done?, path?} — flow cursor, path ('' | full | short), mark done
2789
+ GET /api/onboarding/interview {turns: [{role, text}]} — resumable transcript
2790
+ POST /api/onboarding/interview {message} → {say, saved:[...], done} (host no-tools agent turn; '' opens)
2791
+ GET /api/profile/appearance {preset, tokens, custom, font, size} (per-login theme)
2792
+ PUT /api/profile/appearance {preset, tokens, custom?, font?, size?} — token keys/values validated, 400 otherwise; absent font/size = keep
2793
+
2794
+ GET /api/tasks [Task]
2795
+ POST /api/tasks TaskCreate{repo,prompt,base?,model?,title?,slug?,branch?} → Task (202; the server
2796
+ interprets the prompt into title/slug/branch when not given, the branch named by the agent from the owner's learnings and checked by `checkedBranch`; slugs always get a
2797
+ 4-hex random suffix so worktrees/branches never clash; setup runs in background;
2798
+ a branch that already exists is adopted: the task continues it, named from its
2799
+ open PR when visible, and prUrl is set up front)
2800
+ GET /api/tasks/summaries {"<id>": Summary} for every non-done task (the board polls this)
2801
+ Summary{lastText, lastActivity, turns, costUsd, currentTool:{name,input}|null (input holds only the fields the conversation's running line reads, shared/contract/toolNow.ts), diff:{files,insertions,deletions}|null, threads:{open,needsYou,queued,applied,resolved}}
2802
+ GET /api/tasks/{id}
2803
+ POST /api/tasks/{id}/message {text} → 202
2804
+ POST /api/tasks/{id}/interrupt stop the current turn (stream-json control_request); session stays alive → 202
2805
+ GET /api/tasks/{id}/skills [{name, description, source:"vitki"|"repo"}] for the composer's `/` autocomplete
2806
+ GET /api/tasks/{id}/files ?q=&limit= → ranked worktree paths (git ls-files) for the composer's `@` autocomplete
2807
+ GET /api/tasks/{id}/preview {port, up, path, at, url} — preview-port status (probes liveness)
2808
+ POST /api/tasks/{id}/resume start container + session with --resume (from stopped, or failed with a container); a message to a stopped task resumes implicitly
2809
+ POST /api/tasks/{id}/teardown {keepBranch: true} → state=done
2810
+ DELETE /api/tasks/{id} remove a done task's record + stored artifacts (409 unless done) → 204
2811
+ DELETE /api/tasks/done {ids} delete the done tasks among the ids the board counted (board "Clear all") → {deleted}
2812
+ GET /api/tasks/{id}/transcript the jsonl as an array (paged: ?after=<n>)
2813
+ GET /api/tasks/{id}/cards/{kind} the cards of one kind waiting on you, kind = secrets | variables | network | scripts | actions | learn | asks | close | notify | verbs (AN2). secrets: [{id, name, reason, command, cwd, preApproved, suggestScript, createdAt}], scripts: [{id, name, args, reason, createdAt}]. Another kind answers 404
2814
+ POST /api/tasks/{id}/cards/{kind}/{reqId} answer one card, kind = the ten above plus preview | show. The body is the kind's entry in `CardAnswerIn` (hub/models.ts), mirrored in ui/src/api/types/cards.ts. Every kind but asks, variables and network takes {decision:"allow"|"deny"} and the kind's own fields:
2815
+ secrets {remember?:"task"|"repo"|"account"|"script", pattern?, priv?, lease?:"once"|"restart"|hours, credential?, bind?} → 202 (remember + pattern writes a rule; "script" only for a one-shot sandbox ask; priv+lease = the unlock riding the approval, see Vault)
2816
+ scripts {remember?:"task"|"repo"|"account", pattern?, priv?, lease?, shown?} → 202, or 409 with the newer body when it moved
2817
+ actions {remember?:"workflow", shown?} → {published, script}, or 409 as scripts
2818
+ learn, close, notify {remember?} and verbs {remember?, wide?} (wide is accepted and no press sends it) → {decision}; preview, show {remember?: scope} → {ok}
2819
+ network {decision} → 202; variables {decision:"set", value, bind} | {decision:"refuse"} → 202; asks {answer, attachments?} | {answers, note} → the question
2820
+ GET /api/tasks/{id}/review {version, base, threads} from the review_threads rows
2821
+ GET /api/tasks/{id}/overlaps {overlaps:[{taskId,title,branch,files}]} — other live same-repo tasks changing the same files (30s cache)
2822
+ GET /api/inbox {messages:[{id, fromTitle, toTitle, body, self, inMinutes}]} — pending `vitki msg` notes for the Needs-you strip
2823
+ POST /api/inbox/msgs/{id}/deliver {rule?:"task"|"space"|"all"|"self-task"|"self"} → {ok}; rule = standing allow at that scope, self-task and self only on a note a task sends itself (400 otherwise)
2824
+ POST /api/inbox/msgs/{id}/deny → {ok}
2825
+ POST /api/inbox/msgs/{id}/cancel → {ok}; removes a scheduled note, 409 while it goes in, 404 for another person's
2826
+ GET /api/how-it-works {chapters:[{slug,title}], askReady, askState:"ready"|"locked"|"disconnected"} — in-repo user docs (how-it-works/*.md)
2827
+ GET /api/how-it-works/{slug} {slug, title, markdown}
2828
+ POST /api/here/ask {question, here, turns?} → {answer, from, doors}; host `claude -p` grounded on the chapters + this file, closed world
2829
+ WS /api/tasks/{id}/stream server→client: every stream-json event + {"type":"vitki.state","state":..}
2830
+ client→server: {"type":"user","text":"..."}
2831
+
2832
+ GET /api/tasks/{id}/code/changed {base, mergeBase, files:[{path, status, adds, dels, untracked?}]} vs merge-base, working tree included
2833
+ GET /api/tasks/{id}/code/file ?path=&rev=work|base → {path, rev, binary, size, truncated?, content} (2MB cap; base = merge-base blob)
2834
+ GET /api/tasks/{id}/code/files ?q= → {files:[...]} fuzzy-ranked worktree paths (same ranking as the chat's @-files)
2835
+ GET /api/tasks/{id}/code/search ?q= → {matches:[{path, line, text}], truncated} fixed-string git grep, tracked + untracked
2836
+ GET /api/tasks/{id}/code/defs ?symbol= → same shape; definition-shaped lines only (declaration-keyword heuristic, not a language server)
2837
+ POST /api/tasks/{id}/review/threads/{tid}/state {state: open|resolved} → Thread
2838
+ POST /api/tasks/{id}/review/threads/{tid}/disposition {disposition: queued|skipped|null} → Thread (writes the canned body)
2839
+
2840
+ GET /api/profile {login, claudeAccounts:[{id, label, account, connectedAt, needsReconnect}], codexAccounts:[...]}
2841
+ DELETE /api/profile/sign-in/harness/{claude|codex} → 204: Cancel ends that harness's sign-in, which saves nothing later
2842
+ GET /api/profile/claude/connect/events SSE (see Profile), after POST /api/profile/sign-in for the Claude app
2843
+ POST /api/profile/claude/connect/code {code}
2844
+ GET /api/profile/codex/connect/events SSE, after POST /api/profile/sign-in for the Codex app
2845
+ GET /api/profile/secrets [{name, env, ask, description, createdAt, runsOn?}] — never the value; runsOn only on a login: {account, spaces, sessions: [{workflow, workflowTitle, session, space}]}, the Runs on picks that name it (`loginRunsOn`), which its removal also returns
2846
+ PUT /api/profile/secrets/{name} {value?, ask?, description, need?, env?}; need is the input the dialog was opened for, never stored; value omitted = keep stored; ask omitted keeps the stored policy, a new secret asks; env is only still taken for rows saved with one (injectAs derives it otherwise)
2847
+ DELETE /api/profile/secrets/{name} → 204
2848
+ GET /api/spaces/{id}/keys SpaceKeyState: the chain, your seal of the newest key, the holders with their vault keys, the space's secrets, keyDue and whether you own it
2849
+ POST /api/spaces/{id}/keys SpaceKeySetIn {version, pub, sig, seals, secrets} → SpaceKeyState: the next key version in one write, the owner alone
2850
+ PUT /api/spaces/{id}/secrets/{name} SpaceSecretIn {title, description, kind, fileName, size, keyVersion, sealed} → SpaceSecretJson
2851
+ DELETE /api/spaces/{id}/secrets/{name} → {removed}: the secret with every rule and pick that names it
2852
+ POST /api/spaces/{id}/members {person, sealed}: sealed is the space key sealed for the person, null when the space has no key or they have no vault
2853
+
2854
+ POST /api/machines/codes {code} → 204: the code a machine printed, kept 10 minutes, adds that machine for you once it signs in
2855
+ GET /api/machines [{id, name, enrolledAt, lastSeenAt, revokedAt, on, default}]: your own machines alone
2856
+ PUT /api/machines/default {id | null} → your machines: the one your calls outside any task run on, null for any of yours that is on; 404 for a machine that is not yours or was revoked
2857
+ POST /api/machines/{id}/revoke → the machine: closes its sockets, refuses its next sign-in, fails its tasks; 404 for a machine that is not yours
2858
+ GET /api/machines/link WebSocket, no session: the machine signs a nonce over the hub's origin with its key (shared/link/machineSignIn.ts), 4401 on a refusal
2859
+
2860
+ GET /api/vault {configured, locked, leases:[{id,label,expiresAt}], kdf, holder} — kdf is the client-side opaque blob, holder the machine's box key an unlock seals for (null while the machine does not answer)
2861
+ POST /api/vault/finish {pub, kdf, wrapped, signInPub} — the browser made the key pair: persists the `vault_keys` row, vault locked until the browser unlocks it
2862
+ POST /api/vault/unlock {sealedKey, holder, lease:"restart"|hours} — the key sealed for the machine's box key goes to the machine's ring, arms the global lease (409 when the box key changed: read it and seal again; a key the machine refuses locks the vault)
2863
+ POST /api/vault/lock drop every lease, the machine drops the key
2864
+ POST /api/vault/wrapped/challenge {sealed} — a fresh nonce sealed for the vault's public key, for a passphrase change
2865
+ PUT /api/vault/wrapped {answer, kdf, wrapped, signInPub} — passphrase change (the client unwrapped with old, opened the nonce, rewrapped with new)
2866
+ GET /api/profile/skills [{name, description, content}] — account-level skills
2867
+ PUT /api/profile/skills/{name} {content}: the standard SKILL.md, landed as the folder, skill.yaml beside SKILL.md. New tasks pick it up at seed
2868
+ DELETE /api/profile/skills/{name} → 204
2869
+ GET /api/vitki-actions/skills {skills:[{id,title,may:[{action,target}]}]}: the skills that run for you and name one of Vitki's own actions, by full path, from five homes (your Library skills, the own skills a step of your workflow runs, your agents' skills, and the same of each repo workflow and repo agent your repo's pick uses), with no repo standalone skill
2870
+ GET /api/library/counts {workflows, triggers, scripts, agents, skills, apps, sandbox-images, language-servers, panels, themes, fonts}: each page's count, the length of the rows its list route answers (no row's JSON made), null for a kind that cannot be read
2871
+ GET /api/scripts [scriptJson]: each with files (the folder file by file, the run file marked), run, body (the run file's text), declared and headerProblems (action.yaml's, by line)
2872
+ PUT /api/scripts/{name} {files, description}: the whole folder by relative path, action.yaml included. Writes only, allowing is a separate press (see Scripts)
2873
+ PUT /api/triggers/{name} {files}: the whole trigger folder (TriggerStore.saveFolder), trigger.yaml included. Writes only
2874
+ POST /api/triggers/{name}/duplicate {name}: copies the whole folder (itemFiles) under the new name → 201, 409 on a taken name or a symlink
2875
+ DELETE /api/scripts/{name} → 204 (also deletes script-scoped grants)
2876
+
2877
+ GET /api/learnings {login, rules: [Rule], markdown} the viewer's own file
2878
+ Rule{id, theme, headline, detail, seen, sources[], repo|null, added|null}
2879
+ DELETE /api/learnings/rules/{id} tombstones the rule → {rules: [...]}
2880
+ PUT /api/learnings/rules/{id} {text} → Learnings; rewrites that rule's headline in the owner's exact words (counter, detail, provenance untouched)
2881
+ POST /api/learnings/rules/derive {text} → Learnings + {note, derived: [Rule]}; a seat run reads the note for the standing learnings it carries
2882
+ GET /api/learnings/reviewers {reviewers: [{login, rules}]} — everyone with learnings but you, most first, no review counts (D336, D399)
2883
+ GET /api/learnings/people/{gh-login} {login, rules: [Rule]} read-only view of anyone's file
2884
+ DELETE /api/learnings/people/{gh-login}/rules/{ruleId} → same shape; tombstones so the same evidence never proposes it again
2885
+ GET /api/events SSE for the board: {"type":"task","task":Task}; deletions arrive as {type:"task.deleted", id}
2886
+ ```
2887
+
2888
+ Errors: `{"error": "<message>"}` with a 4xx/5xx.
2889
+
2890
+ The Library kinds that keep one folder per item (fonts, themes, sandbox images, language servers, agents, apps, panels) register their read one, save, create, duplicate and remove routes through `installLibraryRoutes` (`hub/api/libraryRoutes.ts`), one table entry each, and their stores share `list` in `LibraryStore`.
2891
+
2892
+ Every Library page's list route answers rows (`ListRow`: an id and a function that makes the row's JSON) from one exported function per kind (`workflowRows`, `triggerRows`, `fontRows` and the like), and `GET /api/library/counts` counts the same rows with no JSON made. Each list answer and the counts answer run inside `inOneRead` (`hub/oneRead.ts`): while that synchronous call runs, each folder a store reads through `readOnce` (a trigger, a script, a Library kind's folder, a workflow home and their name lists) is read from disk once, and nothing is kept past the call.
2893
+
2894
+ `Task` JSON = the registry row, camelCased.
2895
+ `Repo` JSON = the registry row, camelCased (incl. `imageId`),
2896
+ plus `buildState`, `imageStatus`.
2897
+
2898
+ ## UI
2899
+
2900
+ The task page is one conversation slot that grows with the run (D310, D311).
2901
+ A view is one thing to look at (a conversation, a document, a preview, the
2902
+ changes, a pull request or a file), and a slot
2903
+ shows one view at a time. Up to 3 columns of up to 3 slots, on any screen,
2904
+ dividers drag, and the layout is kept per task. There are no tabs and no phase.
2905
+
2906
+ Routes: `/` board, `/tasks/:id` (a view opens with `?view=<id>` once the
2907
+ views load, from `GET /api/tasks/{id}/views`). One store (zustand) fed by
2908
+ `/api/events` SSE for tasks and the task WebSocket for the open task, with
2909
+ each task's views in `store/views.ts`.
2910
+
2911
+ The task store (`ui/src/store/tasks.ts`) holds one row per task id. Its machine is section 32 of `docs/state-machines.md`.
2912
+
2913
+ - States: a row present or absent per id, plus the tick of the newest row delivered for that id.
2914
+ - Invariants: a fetch never overwrites a row delivered after the fetch began, and a notify fires once each time the
2915
+ stored row turns needs-you.
2916
+
2917
+ | from | event | guard | to | where |
2918
+ |---|---|---|---|---|
2919
+ | any | SSE `task` row | none | row replaced, tick bumped, notify if newly needs-you | `upsert` |
2920
+ | any | `load()` resolves | per id: no row delivered since the fetch began | list rows replace the map, newer rows stay, no notify | `load` |
2921
+ | any | page fetch resolves | no row for that id delivered since it began | `upsert` | `upsertSince`, `TaskPage.tsx` |
2922
+ | any | SSE `task.deleted` | none | row dropped, tick bumped | `remove` |
2923
+
2924
+ The chat socket's `vitki.state` frame does not patch the store: the board channel sends the whole row in the same tick.
2925
+ Each chat socket catches up on its first frame, the `vitki.state` the node sends in the tick it subscribes the socket,
2926
+ never on its open, so a line written before the subscribe still reaches the page. A fetch still in flight at that frame
2927
+ read the file before the subscribe: `ChatTab.tsx` drops what that fetch buffered, since every buffered line is in the
2928
+ file already, and runs one owed catch-up from the fetch's own count when it returns. A closed repo row on Settings reads the repos list every 3 seconds while a build it started runs, and drops its
2929
+ own building flag once the list has said `building` and then something else.
2930
+
2931
+ Chat rendering of stream-json: text deltas streamed; `tool_use` blocks
2932
+ collapsed with name + first line of input; `tool_result` collapsed under
2933
+ their `tool_use`; `AskUserQuestion` rendered as a form (options → buttons,
2934
+ "Other" → text input) whose answer is sent as a user message in the exact
2935
+ shape Claude Code expects for that tool (`{"type":"user", ... }` with the
2936
+ tool_result? — NO: in `-p` mode AskUserQuestion is answered by a plain user
2937
+ text turn; render buttons that send the option label as text).
2938
+
2939
+ Composer shortcuts (terminal parity): Esc / Ctrl+C (nothing selected) interrupt
2940
+ the running turn; `/` on an otherwise empty composer opens skill autocomplete
2941
+ (`GET /tasks/{id}/skills`); `@` opens file autocomplete over the worktree
2942
+ (`GET /tasks/{id}/files?q=`); ↑ in an empty composer recalls previous messages.
2943
+
2944
+ Tab status (`lib/tabstatus.ts`, mounted as `<TabStatus/>`): the favicon is
2945
+ redrawn on canvas from the board aggregate — filled amber disc when any task
2946
+ is `waiting` (needs-you outranks all), white-on-red cross when one is `failed`,
2947
+ hollow accent ring while any is busy, the bare tile otherwise — and
2948
+ `document.title` shows `(N) Vitki` (N = waiting tasks) or, on a task page,
2949
+ a `●`/`✕`/`◌` glyph plus the task title. In-app state markers
2950
+ (`components/StatePill.tsx`) use the same shape+color language via lucide
2951
+ icons (spinner while working, amber question when waiting, cross on failed);
2952
+ `stopped` renders identically to `idle`. Desktop notifications on the
2953
+ `waiting` transition already come from the tasks store (`lib/notify.ts`).
2954
+
2955
+ Document view: any file from the worktree through `api.codeFile`
2956
+ (`ui/src/tabs/DocView.tsx`), rendered as markdown and read again whenever the
2957
+ view's `updatedAt` moves. Updates morph in place (morphdom over the rendered
2958
+ blocks, `lib/design.ts` picks the changed ones by content) with a brief
2959
+ highlight and a scroll to the first change; ```mermaid fences render as
2960
+ diagrams (`lib/mermaid.ts`, lazy-loaded, diagrams survive morphs).
2961
+
2962
+ Preview view: opens when `GET /tasks/{id}/preview` reports the port live (the
2963
+ slot owns the liveness poll and hands the result to `PreviewTab` via its
2964
+ `data` prop). The preview iframe is
2965
+ `<iframe src="http://127.0.0.1:<port><path>">`, where `<port>` is the preview
2966
+ proxy's port that the route reports. The session serves on guest port 4000 and
2967
+ announces with `vitki preview`.
2968
+
2969
+ Review in the Changes view, with no Review threads view: the file list, the
2970
+ threads and triage. Opening a thread opens the file on its line.
2971
+
2972
+ ### Code surface (the file and Changes views)
2973
+
2974
+ Vitki's own editor view over the task's worktree, in place of the embedded
2975
+ OpenVSCode that used to be iframed here. Monaco (the editor widget only, no
2976
+ server, no extension host; its own lazy chunk so the rest of the app does not
2977
+ pay for it), read-only, backed by the `/code/*` endpoints, which run on the
2978
+ host against the worktree — no container involvement, so the surface works on
2979
+ stopped tasks too:
2980
+
2981
+ - Changed files (left rail) open as base-vs-work diffs; a diff/file toggle
2982
+ shows the whole working file. Any file opens via the go-to-file box (the
2983
+ same fuzzy ranking as the chat's @-files).
2984
+ - Navigation: Cmd/Ctrl+click on an identifier jumps to its definition
2985
+ (`/code/defs`, a git-grep declaration heuristic; one match jumps, several
2986
+ land in the results panel). The search box (`/code/search`) covers
2987
+ references and free text.
2988
+ - Review threads render as gutter glyphs plus a right-hand thread panel with
2989
+ reply, resolve/reopen, Queue for apply and Skip (the canned bodies from the
2990
+ Review store). Clicking a line number opens the composer; new threads carry
2991
+ the line's text as `anchor.code`. All writes go through the server's
2992
+ thread endpoints, so the watcher batches them to the session like any other
2993
+ comment.
2994
+ - The Monaco theme follows the app theme live (`vs`/`vs-dark`).
2995
+
2996
+ ### Needs-you strip (the board)
2997
+
2998
+ `ui/src/lib/feed.ts` derives one row per task that has something only the
2999
+ user can move: waiting (reason = `task.attention` or a generic line), failed
3000
+ (first error line), review threads awaiting the user's reply, and
3001
+ reviewed-but-unshipped. Rows are derived state — acting on the task clears
3002
+ them, no read/unread bookkeeping — ordered by kind then recency, deep-linking
3003
+ to the right tab. Pending `vitki propose` / `vitki msg` items from
3004
+ `GET /api/inbox` render in the same strip with their action buttons. The rail
3005
+ badge counts waiting + failed tasks. Task pages additionally show an overlap
3006
+ banner (`GET /tasks/{id}/overlaps`) when another live same-repo task changes
3007
+ the same files.
3008
+
3009
+ ### Docs (`how-it-works/*.md`, `ui/src/pages/HowItWorks.tsx`)
3010
+
3011
+ User-facing chapters shipped in-repo and served by the API; the page renders
3012
+ them with the standard markdown pipeline, interleaving hand-built figures
3013
+ (`@figure <name>` lines resolved via `ui/src/components/figures.tsx`, shared
3014
+ with the onboarding steps), and ends each chapter with an action row
3015
+ (`CHAPTER_ACTIONS`) linking to the surface it explains. Its header opens the
3016
+ `?` panel (`POST /api/here/ask`, disabled with a hint until a Claude
3017
+ account is connected). Surfaces link into chapters contextually ("How review
3018
+ passes work", the New task dialog's adoption link). Changing behavior a
3019
+ chapter describes means updating that chapter in the same diff — the chapters
3020
+ are the user-facing contract the `?` panel answers from.
3021
+
3022
+ ## Ship — sign, push, PR (scripts under rules)
3023
+
3024
+ Sessions cannot push (no secrets, restricted egress), and the task page has no
3025
+ Branch view and no push or pull request route (D403). Shipping is done by the
3026
+ GitHub app's scripts `apps/vitki-github/actions/open-pr`, `push-update` and `ready-pr` as steps of a workflow,
3027
+ each an ordinary script in its own one-shot sandbox under your rules: the one-shot sandbox reaches `github.com` and the host API through the
3028
+ proxy, and the forge secret arrives per command through `vitki run cmd --with`.
3029
+
3030
+ - `open-pr` pushes the run's branch and opens the pull request with the title
3031
+ and body from `.vitki-tmp/pr.md` (as a draft when pr.md says so, with no
3032
+ reviewers asked), or updates the title and body of the pull request the
3033
+ branch already has. It then records the link with `vitki pr` (see Scripts).
3034
+ - Before a step's script gets the checkout (`stepLaunch` in
3035
+ `tasks/runActions.ts`), the host refuses a dirty worktree (409).
3036
+ No `signing_key` is read from config.yaml (a config.yaml holding one logs one unknown key). Open a new pull request and Push the branch take an optional `GitSigningKey` file secret. When a pick answers it, `vitki-script input read GitSigningKey` exits 0 and `commitwork.py` commits with `-S` in the script's own sandbox, with `gpg.ssh.program=vitki-sign` and `user.signingkey=GitSigningKey`, else unsigned. `vitki-sign` (machine/sandbox/tool/sign.go) sends the bytes git signs on the run's channel as `{id, with, sign}`, and refuses anything but `-Y sign -n git` and a session. The server accepts `sign` only from a script, only a commit or a tag object (else "Vitki signs only a commit or a tag"), sets the command to `ssh-keygen -Y sign -n git` and the reason to "sign the commit: <subject>" read from the bytes, decides it as a `use-secret` like any secret command, and on an allow signs on the machine in an `ssh-sign` job, the key a file grant the job redeems, with `ssh-keygen` (`machine/jobs/sign.ts` `sshSign`, the key in a 0600 file in a fresh 0700 folder, zeroed and removed when the signing ends, since ssh-keygen reads the key's path twice). A parked ask keeps the bytes, so Allow once, a pick and the vault's unlock replay sign them too. The key enters no VM, not even the script's.
3037
+
3038
+ ## Dev workflow
3039
+
3040
+ ```
3041
+ make dev # server (tsx watch) + ui (vite) concurrently
3042
+ make check # tsc 7 + oxlint + vitest (server), tsc 7 + oxlint (ui)
3043
+ ```
3044
+
3045
+ Server: `package.json` at the checkout root, pnpm. Node 22+. Dependencies: fastify,
3046
+ better-sqlite3-multiple-ciphers, ws, undici, zod, yaml, jsonwebtoken. Keep the list
3047
+ short.
3048
+
3049
+ ## Mechanics kept from the design rules
3050
+
3051
+ The design rules state behaviour. The sizes, code names and install mechanics they used to carry are kept here, as each rule read before the 2026-10-12 cut.
3052
+
3053
+ From `docs/design/base.md`, A status chip means status:
3054
+
3055
+ - **A status chip means status**: A status chip means how something stands. A kind chip names a kind inside an entity and nowhere else. The status chip is 20px high, radius 6, 11px weight 500, and the tones are run-own faint, asks ink-2, partial warn, cannot crit, faint ink-3. The met chip is faint grey on rows. (D25)
3056
+
3057
+ From `docs/design/base.md`, Kind words:
3058
+
3059
+ - **Kind words**: A kind standing alone is an eyebrow word, 11px weight 500, uppercase, letter-spacing 0.06em, ink-3, no box. Kinds are words, not icons. (D26)
3060
+
3061
+ From `docs/design/base.md`, Links F:
3062
+
3063
+ - **Links F**: Every link app-wide, prose included, is a quiet solid underline: weight 400, ink-2, a 1px solid underline in ink at 28%, offset 4px, ink on hover, no accent. Dotted underlines are drift. Linked names and entity chips wear F too, and inside an EntityChip the underline sits under the title only. (D35, D36)
3064
+
3065
+ From `docs/design/base.md`, Small button:
3066
+
3067
+ - **Small button**: A press is a small button, 12px weight 500, 24px high, padding 0 8px, radius 6, 1px hair-2 border, s1 fill, ink text. Pressed shows an ink fill with s1 text. Going somewhere is a link, changing state is a small button. (D42)
3068
+
3069
+ From `docs/design/base.md`, Value tint:
3070
+
3071
+ - **Value tint**: Hosts, patterns, commands, branches and logins wear the code tint, 12px ink-2 on ink at 6%, radius 4, padding 1px 5px, in rows, dialogs and columns alike. A comma or other mark right after a tint hugs it, so the tint keeps no right padding there (D592). (D48, amended D587: secret names are chips)
3072
+
3073
+ From `docs/design/base.md`, Counts are words:
3074
+
3075
+ - **Counts are words**: A count is muted words, 12px ink-3 ("3 answers"). The rail count uses warn at normal weight. (D49)
3076
+
3077
+ From `docs/design/base.md`, Warning line:
3078
+
3079
+ - **Warning line**: A warning sentence is one warn-ink 12px line with a 14px triangle icon, no box and no fill. (D51)
3080
+
3081
+ From `docs/design/library.md`, Every Library item is a folder with YAML settings:
3082
+
3083
+ - **Every Library item is a folder with YAML settings**: a script, a trigger and a workflow are each a folder with a manifest (`action.yaml`, `trigger.yaml`, `workflow.yaml`) beside the files the item runs. A skill is a folder with `skill.yaml` (name, title, description, variables, may) and `SKILL.md` holding only the instructions. When Vitki seeds a skill into a session, Vitki writes SKILL.md's front matter from skill.yaml, so the session sees a standard skill. A repo's own skills (`.claude/skills` in the worktree) keep the standard front matter, read with the same YAML reader. Import turns a standard skill into the folder form and Export writes one back. Whether a skill is on is a pick, never a skill.yaml field. Scripts carry no comment header. A trigger with no check has no body file. An allow pins the folder's hash: every file's relative path and contents, sorted, generated files (`__pycache__` and the like) left out, a symlink refused. Workflows, scripts and triggers share the one hashing function. A skill's card and its Edit surface list every file of the folder, a script beside SKILL.md included, as a script's do. The scripts under `actions/<name>/` keep their own section. (D236, D238, amended by D439, D564 and D586)
3084
+
3085
+ From `docs/design/library.md`, Language servers are a Library kind:
3086
+
3087
+ - **Language servers are a Library kind**: A language server is a folder `language-servers/<id>/` holding `server.yaml`: title, description, `languages` (each with its file extensions, keyed by the name people read, as in `TypeScript: [...]`, and every place that names a language uses the key whose extensions match), `server` (the server's own name as the row shows it, such as vtsls, nargo lsp or Pyright, required), `source` (npm: or github: releases), `version` and `run`. The file declares no hosts, and a `reaches` key is refused like any unknown key (D608). No code knows a server by name. The tab sits after Appearance. A row reads the icon, the name, the language marks (every extension of the language as written, the rule everywhere, D351), the server and its version, then Export and the strip every kind of yours has, Edit and Remove, with no chip saying where it is on. The card reads Description, Languages, Version, Used by (repo names, each opening that repo's card at Language servers) and the files, with no may-do section and no note about hosts. The check for a newer version and the install are Vitki's own requests: they go through the proxy, and no rule decides them (D557, D608). `source`, `version` and `run` are the long form of the install contract, which a local MCP server shares (D563): both install into the server store (D696). Vitki ships TypeScript and JavaScript (vtsls), JSON, HTML, CSS, Markdown (vscode-langservers-extracted), YAML (yaml-language-server), Rust (rust-analyzer), Python (Pyright), Noir (nargo lsp), Solidity (Nomic Foundation's server) and Bash (bash-language-server with ShellCheck, D431). Which a repo gets follows its files when it is added (D388), not a default on the server. Every server, Noir and Rust included, installs its pinned version once for the machine into the server store (`machine/serverStore.ts`), in a throwaway sandbox from the pinned Node image, through the proxy (D365, D557, D696). The store is `<home>/servers/<cpu>/<package folder>/<version>/`, a sandbox mounts it read only at `/opt/vitki/servers`, and an npm server runs with its bin folder and the store's one Node first on PATH for its process alone. Rust runs the rust-analyzer release binary of `github:rust-lang/rust-analyzer` alone, its pin a date tag, and Noir its GitHub release of `noir-lang/noir`, both the glibc file the `vitki-sandbox release` picker takes over a musl one. Cargo comes from the repo's image, and Bash runs ShellCheck when the image lists shellcheck, which the shipped Vitki tools image does. There is no account-level setting. Sketch https://claude.ai/artifact/EVFdNEveTyPBBVZX4yKasb v5. (D386, 2026-10-03, amended 2026-10-03, Nico: "Include cargo", amended by D395, D557 and D563)
3088
+
3089
+ From `docs/design/library.md`, Sandbox images are a Library kind:
3090
+
3091
+ - **Sandbox images are a Library kind**: A sandbox image is a folder `images/<id>/image.yaml`: title, description, base, an optional digest pin, packages (package lines, each naming its source as `apt:git`), repos, and build and start steps (`run-shell` or `run-action` with `with`). Vitki ships one image, Vitki tools, and no image made for one space (D547, D560). The tab is Sandbox images, after Language servers, and the repo card's row is Sandbox image, picked with a press like Model. The image runs as it is: Vitki adds nothing of its own on top except the one language server tools step, which the card tells in one plain line and no section. The template installs no gh, no Node and no browser (D479), bakes no allowlist, and its image labels are never shown. The image card has no Vitki's layers section, and the template text alone never makes an image need a rebuild, while a fix to a step Vitki writes into the build does. The image is the shared base and only the Library edits one. Sketch https://claude.ai/artifact/FVMCFk2nYR8cwMcjYGLy7J v1, A. (D395, amends D386, amended by D479, D559, D563, D619 and D623)
3092
+
3093
+ From `docs/design/library.md`, One package line:
3094
+
3095
+ - **One package line**: One line `source:name@version` names a package, and every line names its source, like `apt:git`. The sources are apt, npm, pypi, github and crates. The same line is taken by `vitki install` and image.yaml `packages`. server.yaml's `source`, `version`, `install` and `run` stay the long form, for language servers and local MCP servers. Each package from another source installs as the vitki user into ~/.packages/<source>-<name>, with its commands linked into ~/.packages/bin, which comes first on PATH. The install goes through the proxy and needs its tool in the image. A missing tool fails naming the fix, like "npm:prettier needs npm in the image. Ask for nodejs and npm first." A line with no version is pinned to the newest on save. A pinned package gets the Update check, which is Vitki's own request and takes no rule. (D563, D557)
3096
+
3097
+ From `docs/design/library.md`, Library rows sort by title, then ID:
3098
+
3099
+ - **Library rows sort by title, then ID**: Every Library group lists its rows by the title the row shows, the ID standing in where a row has none, then by ID, one comparator for every kind (`byTitleThenId`). Shipped items still come first, then yours, and each part sorts by title. No row leads for being a default: the panel a fresh status bar holds is the one the shipped defaults.yaml names (D627). Home's Add a panel sorts both its groups the same way. A list a person reads never sorts by ID alone, since the ID is not what the row says (P2-16, D582).
3100
+
3101
+ From `docs/design/appearance.md`, Fonts are read from their files:
3102
+
3103
+ - **Fonts are read from their files**: A face in `font.yaml` names a family and nothing about weight, italic or files. Vitki reads every font file in the font's folder (woff2, ttf or otf, capitals kept), takes the family name from the name table (the typographic family first), the weight from the OS/2 weight class and the italic flag from OS/2 or head, and serves a face with the files whose family matches, each at its own weight and style. A family no file in the folder holds is a family name alone, found on the machine or shown as found nowhere in the card's Faces. A Google face asks Google for the weights and italics Vitki's own stylesheets use for its job, one list in code that a test checks against every stylesheet, matched against what the family offers from Google's public list, so a weight the family lacks is asked for as the nearest one it has, never as a request Google refuses. A removed key such as `weights:`, `italics:` or `files:` reads as any unknown field, with no words of its own (D510), and `axes:` stays. (D497, D510)
3104
+
3105
+ From `docs/design/rules.md`, One source vocabulary:
3106
+
3107
+ - **One source vocabulary**: An unset level offers plain Inherit to go back to the level above, everywhere. A source reads "picked by your account", "picked by Oxide", "picked by this task", the same phrase wherever a pick comes from, on the Test a pick line too. Skill and MCP server rows read "On, picked by your account" or "Off, picked by this repo", and Where it resolves rows read "picked by this repo" or "picked by this card", all through the one `pickedBy` helper. Inherit stays plain. (D591) Sketch https://claude.ai/artifact/8b7Jj3mZqRxnpZf6NyoqJ1 v3, call 9. (D253, D303, D373, 2026-10-02)
3108
+
3109
+ From `docs/design/rules.md`, A connection around the proxy fails at once:
3110
+
3111
+ - **A connection around the proxy fails at once**: A tool that ignores the proxy variables never waits and never gets in. The host holds each sandbox's network to the proxy's one port, so a connection opened around the proxy is refused at once and the tool fails with its own error, and a name outside Vitki does not resolve. Vitki runs no resolver and no redirect, and keeps no count, card or quiet line for such a connection, since the tool's own words say what happened. Only a tool that follows the proxy variables reaches a host, and every such connection is decided by the rules. The test is a real sandbox that tries a direct connection and asserts it fails at once (`egressVm.test`). (D347, dropped in part by D621, which retires D592's folding of that line)
3112
+
3113
+ From `docs/design/rules.md`, Onboarding allows what ships, never who runs it:
3114
+
3115
+ - **Onboarding allows what ships, never who runs it**: One onboarding press, Allow what came with Vitki, writes an ordinary allow per shipped item at the item's own layer, pinned to the version shown: each shipped panel, choices search and script may reach the hosts and take the actions it declares, and the shipped panels may read your tasks, repos and learnings. A skill a shipped workflow runs takes the actions it declares under may, allowed at the workflow's layer since a skill has none. It writes no allow to run a script, so a workflow and an agent in a task each ask once before they first run one. The one start it writes is each start a shipped workflow brings, listed under Starts on a schedule and written as Allow on that Starts row writes it: the row stored and the start rule at your account pinned to the trigger folder shown (D871). The press sits above a folded What this allows listing every row it writes, and Ask me each time writes nothing. What it writes is computed from the shipped manifests, and a test fails when a shipped item declares a reach, action or read the press would not write. The allows cover your copies from Vitki you never edited, and the start a workflow from Vitki brings stays on its Starts row once you edit the copy. A shipped item changed by an update loses its allow, and Home says so once, with Allow the changes and Review. Sketch https://claude.ai/artifact/7j9jJvcmdVHL9hQ467iufL v2, C. (D523, amends D111, amended by D871)
3116
+
3117
+ From `docs/design/rules.md`, A host rule names one host, or a domain on purpose:
3118
+
3119
+ - **A host rule names one host, or a domain on purpose**: A host rule names one host exactly, or `*.<domain>` for the domain and every name under it. Allow on a refused host writes the exact host; a second small button, "All of <domain>", writes the wide form for the host's registrable domain, its hover saying every name under it is covered. Wherever a person reads a wide rule (a rule row, a card's rule chip, a may-do row, an ask card, Home waiting, a blocked line, a refusal) it reads "All of <domain>", through one words function in `ui/src/lib/rows/hostWords.ts` and `hostWords` in `hub/hosts.ts`, and only files write `*.<domain>`. The rule dialog's host field takes a host and a switch, "This domain and every name under it", on only when the host has a registrable domain; opening a wide rule shows the domain with the switch on, and typing `*.x` turns it on. (D570) A wide rule over a public suffix (the Public Suffix List Vitki ships: github.io, vercel.app, com) is refused with words saying its names belong to different owners. (D535)
3120
+
3121
+ From `docs/design/workflows.md`, Step marks and the strip:
3122
+
3123
+ - **Step marks and the strip**: A step's disk shows its kind's icon (skill, script, action, a flag for a checkpoint), and its colour says the state: green runs on its own, amber asks you (a rule you can set), red cannot run (a rule denies it), and a checkpoint sits on an ink disk (a stop the workflow plans). A stop never needs opening to be seen: the folded row carries why the step waits, how many more asks, and the pressable No rule chip when no rule answers. The verdict line counts the stops by kind, like "Stops 5 times. 3 checkpoints the workflow plans, and 2 asks you can allow." The strip sits on the folded Library row, one cell per step, and draws three kinds: a skill as a pale bar in `--step-skill` (a mist lavender, Paper #7a74a8, drawn at about a third of its strength), a checkpoint as a dot in `--ink-2`, and an action, the only kind with a state. On a workflow that starts on some repo an action is a semaphore read as the worst case over the repos its start is allowed on, the same outcomes On each repo reads: green (`--add`) runs on every one, amber (`--warn`) asks on some, red (`--crit`) refused on some, refused beating asks. On a workflow that starts on no repo no repo is known, so an action is hollow. A cell's hover reads "<n> · <title> · <kind>", then on a workflow that starts on some repo the repos ("asks on oxide, refused on verdandi") and otherwise "depends on the repo". No rule words and no script or notify split. After the bar comes the count: "3 checkpoints", "1 checkpoint", "No checkpoints", then on a workflow that starts on some repo what the repos add ("1 checkpoint · asks on oxide"), in the warn tone when a repo refuses. Every colour theme defines `--step-skill`, a lavender kept off its own accent, green, amber and red. A checkpoint needs no token of its own. The step rows' number disks take the same colours as their strip cells: a skill's disk lavender, an action's disk its semaphore (a hollow ring on a workflow that starts on no repo), and a checkpoint a solid `--ink-2` disk carrying a light Flag icon (lucide), never the hand. The flag carries a "Checkpoint" tooltip and label. How a step row lays out its number and its kind follows **A step row reads its number, then its kind** (D304). Sketch https://claude.ai/artifact/R6VeVtAZtS3xXfBNxK6tdh v2, option A. Sketch https://claude.ai/artifact/3UaN43brBnERxjDatUt5qU v3. (D276, D299, D300, D304, amended by D414 and D433)
3124
+
3125
+ From `docs/design/workflows.md`, Step titles:
3126
+
3127
+ - **Step titles**: A step's title comes from one function, stepCardTitle, on the workflow card and on the task page's run checklist alike. (D202, D213)
3128
+
3129
+ From `docs/design/tasks.md`, Messages wait in a queue on the box:
3130
+
3131
+ - **Messages wait in a queue on the box**: A message sent while the session works is not drawn in the conversation until the session reads it. Each waiting message is a card on the composer, outside the conversation's scroll, oldest first, under "Waiting for Codex · <n>", naming the session's agent, saying when it is read ("Read at the end of this step", or "at the end of this turn" for a slash command the session runs only then, and for a message Codex could not take into its running turn, which waits with every such message for the turn's end and goes in with them as the next turn). Up from an empty box selects the newest card, Up and Down move, Down past the last or Esc returns to the box. The selected card shows its presses with their keys: Edit (E or Enter) takes the message back from the session at once and puts its text in the box, and sending puts it back in its place, Esc leaves it as it was. Remove (Del), Send now (Ctrl+Enter). The mouse uses the same presses on hover. Queue cards are the one place presses wait for hover or selection: everywhere else a row shows its presses, but these cards sit where you type (D589). A card leaves the queue the moment the session reads it, and its bubble appears in the conversation there. If the session reads a message while you edit it, the text stays in the box as a new message and the box says "Codex already read it. Your edit stays here as a new message". While a question waits, the box is the answer box and Up moves the choices, so the queue is reached by mouse only. Vitki writes each message to the session at once and takes it back through Claude Code's own queue (cancel, send now, the read signal), so a plain message still reaches the session mid-turn. Slash commands queue like any message and run when the turn ends, since the CLI runs every one of them then (checked live on 2.1.287). Replaces the waiting line under a sent bubble. Sketch https://claude.ai/artifact/9bDej5HWLMjBUoMVatxUZc v2, A. (D348, amended by D407)
3132
+
3133
+ From `docs/design/task-views.md`, Views and slots, never tabs:
3134
+
3135
+ - **Views and slots, never tabs**: The task page has no Design, Review or Ship tabs, no phase dot and no task phase. A view is one thing you can look at: a conversation, a document, a preview, the changes, a pull request or a file. A slot is a place on the page that shows one view at a time. Views come from what the session makes and what you open, never from the workflow: showing a file is an action under the rules like serving a preview, the first changed file adds Changes to the switcher, closed, a pull request for the task's branch adds itself, and pressing a file in the conversation opens it as a file view. Changes never opens a slot on its own: you open it from the switcher, or the session shows a file. How each kind draws is Vitki's, fixed in code, never HTML the agent writes. A document is named by its first heading or the name the session gives it, with its path quiet beside it as its ID. The conversation announces each view with Open, Open beside and Open below, and a view already in a slot with one quiet line, not a card with presses. A slot's head has no rule and no box: the view's name, a small switcher with its count once there are two or more views (grouped by the step that made them, newest step first, conversations first), Close and Remove. A slot alone on the page shows its head, the view's name and the switcher with no Close, whenever the task has two or more views, so a closed or removed view can always be opened again. Close empties the slot and keeps the view in the switcher. Remove takes the view off the switcher until the session updates it or you open it again, and the file stays in the branch. A conversation has Close only. The page opens as one conversation slot. Up to 3 columns, each up to 3 slots stacked, the conversation one of them, on any screen, with no size floor: each slot scrolls on its own. Dividers drag, and dragging a slot's head onto an edge places it left, right, above or below. The newest view, and a checkpoint that starts waiting, go only to the slot you last used without arranging it. A slot you placed keeps its view. A task with several agents shows each conversation as its own view. A closed conversation that gets an ask comes back in the slot you did not arrange, or shows a badge in the page head when every slot is one you placed. The layout is kept per task. A checkpoint never names a view: a confirm checkpoint opens the one input it names under `inputs:` or its `file:`, and a triage checkpoint opens the review threads. The checkpoint's line on the strip carries a press that opens the thing, Read for a document or file (Read the design) and Open for anything else, which brings back a removed view, and says "<path> is no longer in the branch" when the file is gone. The strip's Read press hides while its view is shown. A question the session asks with `vitki ask` is its last message in the conversation, marked amber under the session's agent ("Codex asks you"), never a card above the slots or on the strip. A quiet line over a conversation's composer shows "/ commands" and "@ files" at its right (D504). While the question waits, the composer is the answer box, with a line over it saying what it answers, that the session waits inside the step, and the time left. The Bash row that ran `vitki ask` is not drawn. A conversation that is not on the page comes back for the question like for any ask, or the page head raises the badge. The sidebar's right edge drags like a slot divider, 180px to 420px, kept in this browser like the collapsed state. Dragging past the narrow end collapses the sidebar, a double click on the edge sets 240px again, and the focused edge takes the arrow keys. The Changes file list's right edge drags the same way, 200px to the view's width minus 320px, kept in this browser, a double click sets 230px, and the focused edge takes the arrow keys. The list stops at its narrow end and never collapses, and the edge hides while the list stacks over the diff. The task page has three surfaces. The page ground (the theme's s2) holds the head and the run strip with no box. Each slot is a raised card on s1 with a hairline, a small radius and a gap between slots, and a document view is the lightest paper. The head is the title and the status bar in use (D339), with size and turns behind an info icon, and the strip is one line under it. The head has no back press, ever, since Tasks sits in the sidebar. The title, both lines of the status bar, the step strip and the slots below share one left edge. The vault is a lock chip in the head while nothing waits on the vault, and the banner returns only when an ask or a run is blocked on the vault. In the conversation, a stretch of thinking and tool rows folds to one line and stays folded while it runs, reading Working · 1 edit · 1 read while a step still runs and Worked 2m 36s · 2 edits · 2 reads · 1 command once done (D504). The line counts what the stretch did by kind and the time, and a quiet line under it says what it is doing now, the newest command's description or the newest thinking that has words. Opened, each command reads as the description the session wrote for it, and pressing the step shows the command and its output. Vitki's own CLI rows and the `cd` into the worktree are not drawn, and a command with no description shows itself in mono. Thinking with no words is not drawn, and thinking with words is an italic line between the steps. A loaded skill is one quiet line, "Loaded the design skill", never its text. The line sits at the left like the conversation, on a faint tint of the skill colour (--step-skill), with the Library's skill icon and the skill's name in the skill colour opening its card, and a short pulse when it arrives (none under reduced motion). Prose in the conversation and in documents is set in the font pairing's reading face, code and IDs in its mono. A document draws standard GitHub Markdown blocks its own way: `> [!IMPORTANT]` as a "You are approving" panel in the accent tint, `> [!NOTE]` as a quiet aside, `- [ ]` task lists as a checklist, the first paragraph as a larger lede, and a diagram fitted to the column with a key when it marks things that go. The agent writes plain Markdown, and the same file reads sensibly on GitHub. Sketch https://claude.ai/artifact/Tx1vCVviSvggfXpcrb4w7w v4. Sketch https://claude.ai/artifact/UKqoHaXG64TYnqGUe9MsjB option B. Sketch https://claude.ai/artifact/XTovr64WJmQ1D75RBwviST, After with C. Sketch https://claude.ai/artifact/DXvQEWpRimZmmiGmX7zHEX v1, A without the arrow. Sketch https://claude.ai/artifact/PJZNU2kwZYvKcj17MnNs84 v1, A. Sketch https://claude.ai/artifact/HQ4HQ8bb2rJtWCBNpAqzJT. Sketch https://claude.ai/artifact/F5G9Xt5Wf3vSVLKtk8LnpF v1, A. (D311, D316, D317, D318, D319, D323, D331, D339, 2026-10-01, 2026-10-02, amended by D403 and D407)
3136
+
3137
+ From `docs/design/task-views.md`, Changes reads like an editor:
3138
+
3139
+ - **Changes reads like an editor**: The code in Changes uses the editor's own features: unchanged stretches fold into "n hidden lines | <class> › <function>" bars that name the symbol the folded lines sit in, like "13 hidden lines | AnchorBlockStore › constructor" (3 lines of context, a bar opens 10 at a time), found by a TypeScript symbol service that runs while Changes is open, sticky scroll pins the class and method the view is in, fold arrows, bracket pair colours with the active pair's guide, indent guides, the current line marked, and the gutter on its own ground. The breadcrumb bar heads the diff, with no path line, and the overview rulers are off. It sits on the code theme's chrome and reads the folders, the language mark and the file, then the symbol the cursor is in, with "+1 −7 · 1 chunk" at its right. Vitki ships a Modern theme matching VS Code's Default Dark Modern and a DejaVu Sans Mono font, for the Code theme and Code font picks (D363). Sketch https://claude.ai/artifact/ShR7QPaRSCjhmn9XuYWF1M v6, E. Sketch https://claude.ai/artifact/8b7Jj3mZqRxnpZf6NyoqJ1 v3, call 1. (D364, D366, D484, 2026-10-02)
3140
+
3141
+ From `docs/design/task-views.md`, Text size reaches the code:
3142
+
3143
+ - **Text size reaches the code**: The Settings Text size scales the Changes editor with the rest of the app, as it scales every code block: 12px on small, 13px on normal, 15px on large, following --fs-mono, and the editor follows a change at once. Code is not bigger than the app's text, and there is no separate code size. (D383, 2026-10-02)
3144
+
3145
+ From `docs/design/task-views.md`, Changes knows the code:
3146
+
3147
+ - **Changes knows the code**: Changes asks the repo's language servers, running in the task's sandbox, for go to definition (F12, Ctrl+click), peek (Alt+F12, and Ctrl+Shift+F10 on Linux), references (Shift+F12) and hover, as VS Code does. Every server on for the repo starts when you open the task, so they are ready by the time you reach Changes, they share the sandbox's memory, and they stop when the sandbox sleeps. A server never keeps a task awake. Node bridges each server over the task stream's gates with a method allowlist. The breadcrumb bar says a server's state and shows nothing when ready: starting, indexing with its progress, failed with Log, stopped while the sandbox sleeps with Wake, off for this repo with Add it, not in the image yet with Rebuild, no server for the language with Add one. The state names a language by the `languages` key whose extensions match the file, and its mark is the extension as written. "No language server for" shows only for paths the language table knows, named by the row's `alias`, else Monaco's own name for the language (Dockerfile), never for files such as LICENSE or lockfiles. On the base side, removed and changed lines read "The old lines are not indexed." Until a server answers, Ctrl+click and F12 fall back to today's search and say they guessed: "Guessed definitions of x" for several matches, "Guessed: x in <path>:<line>" for one (the jump, plus a one-row results list under that head), and "No definition found. Matches of x" for none. When a server answers with targets that are all outside the repo, the client says "The definition is outside the repo." Proposal https://claude.ai/artifact/LZndJKqgSfTxvYMQFadGJT, Sketch https://claude.ai/artifact/EVFdNEveTyPBBVZX4yKasb v5. (D389, 2026-10-03, amended 2026-10-03)
3148
+
3149
+ ## State machines
3150
+
3151
+ Every machine, its states, invariants and transition tables are in `docs/state-machines.md`.