@loompad/cli 0.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (688) hide show
  1. package/ARCHITECTURE.md +96 -11
  2. package/CHANGELOG.md +1054 -0
  3. package/README.md +1473 -44
  4. package/THIRD_PARTY_NOTICES.md +275 -0
  5. package/dist/adapters/antigravity-cli.d.ts +62 -0
  6. package/dist/adapters/antigravity-cli.js +258 -0
  7. package/dist/adapters/antigravity-cli.js.map +1 -0
  8. package/dist/adapters/base.d.ts +61 -9
  9. package/dist/adapters/base.js +266 -15
  10. package/dist/adapters/base.js.map +1 -1
  11. package/dist/adapters/bridges/antigravity.d.ts +9 -12
  12. package/dist/adapters/bridges/antigravity.js +9 -12
  13. package/dist/adapters/bridges/antigravity.js.map +1 -1
  14. package/dist/adapters/echo.d.ts +1 -0
  15. package/dist/adapters/echo.js +59 -3
  16. package/dist/adapters/echo.js.map +1 -1
  17. package/dist/adapters/grok.d.ts +7 -0
  18. package/dist/adapters/grok.js +20 -10
  19. package/dist/adapters/grok.js.map +1 -1
  20. package/dist/adapters/index.d.ts +5 -1
  21. package/dist/adapters/index.js +53 -7
  22. package/dist/adapters/index.js.map +1 -1
  23. package/dist/adapters/model.d.ts +137 -0
  24. package/dist/adapters/model.js +527 -0
  25. package/dist/adapters/model.js.map +1 -0
  26. package/dist/adapters/opencode.d.ts +101 -1
  27. package/dist/adapters/opencode.js +874 -98
  28. package/dist/adapters/opencode.js.map +1 -1
  29. package/dist/cli/doctor.d.ts +32 -0
  30. package/dist/cli/doctor.js +89 -4
  31. package/dist/cli/doctor.js.map +1 -1
  32. package/dist/cli/index.js +2651 -87
  33. package/dist/cli/index.js.map +1 -1
  34. package/dist/cli/tui-model.js +3 -1
  35. package/dist/cli/tui-model.js.map +1 -1
  36. package/dist/cli/tui.js +44 -1
  37. package/dist/cli/tui.js.map +1 -1
  38. package/dist/cli/ui.d.ts +2 -0
  39. package/dist/cli/ui.js +13 -0
  40. package/dist/cli/ui.js.map +1 -1
  41. package/dist/core/ades.d.ts +32 -16
  42. package/dist/core/ades.js +57 -20
  43. package/dist/core/ades.js.map +1 -1
  44. package/dist/core/agent-state.d.ts +14 -0
  45. package/dist/core/agent-state.js +32 -0
  46. package/dist/core/agent-state.js.map +1 -0
  47. package/dist/core/approvals.d.ts +33 -0
  48. package/dist/core/approvals.js +29 -0
  49. package/dist/core/approvals.js.map +1 -0
  50. package/dist/core/backup.d.ts +19 -0
  51. package/dist/core/backup.js +86 -0
  52. package/dist/core/backup.js.map +1 -0
  53. package/dist/core/baton.d.ts +2 -2
  54. package/dist/core/baton.js.map +1 -1
  55. package/dist/core/brain-extract.d.ts +17 -0
  56. package/dist/core/brain-extract.js +28 -2
  57. package/dist/core/brain-extract.js.map +1 -1
  58. package/dist/core/brain-index.d.ts +71 -0
  59. package/dist/core/brain-index.js +204 -5
  60. package/dist/core/brain-index.js.map +1 -1
  61. package/dist/core/brain.d.ts +58 -2
  62. package/dist/core/brain.js +79 -1
  63. package/dist/core/brain.js.map +1 -1
  64. package/dist/core/chat-import.d.ts +71 -0
  65. package/dist/core/chat-import.js +419 -0
  66. package/dist/core/chat-import.js.map +1 -0
  67. package/dist/core/checkpoint.d.ts +107 -0
  68. package/dist/core/checkpoint.js +259 -0
  69. package/dist/core/checkpoint.js.map +1 -0
  70. package/dist/core/claude-cli.js +1 -1
  71. package/dist/core/claude-cli.js.map +1 -1
  72. package/dist/core/continuity/artifacts.d.ts +14 -0
  73. package/dist/core/continuity/artifacts.js +118 -0
  74. package/dist/core/continuity/artifacts.js.map +1 -0
  75. package/dist/core/continuity/capabilities.d.ts +65 -0
  76. package/dist/core/continuity/capabilities.js +129 -0
  77. package/dist/core/continuity/capabilities.js.map +1 -0
  78. package/dist/core/continuity/contracts.d.ts +352 -0
  79. package/dist/core/continuity/contracts.js +117 -0
  80. package/dist/core/continuity/contracts.js.map +1 -0
  81. package/dist/core/continuity/engine.d.ts +55 -0
  82. package/dist/core/continuity/engine.js +504 -0
  83. package/dist/core/continuity/engine.js.map +1 -0
  84. package/dist/core/continuity/store.d.ts +73 -0
  85. package/dist/core/continuity/store.js +438 -0
  86. package/dist/core/continuity/store.js.map +1 -0
  87. package/dist/core/conversations.d.ts +19 -0
  88. package/dist/core/conversations.js +87 -0
  89. package/dist/core/conversations.js.map +1 -0
  90. package/dist/core/crew-coordination.d.ts +6 -0
  91. package/dist/core/crew-coordination.js +24 -0
  92. package/dist/core/crew-coordination.js.map +1 -0
  93. package/dist/core/crew-policy.d.ts +18 -0
  94. package/dist/core/crew-policy.js +40 -0
  95. package/dist/core/crew-policy.js.map +1 -0
  96. package/dist/core/crew-protocol.d.ts +64 -0
  97. package/dist/core/crew-protocol.js +146 -0
  98. package/dist/core/crew-protocol.js.map +1 -0
  99. package/dist/core/crew-requests.d.ts +14 -0
  100. package/dist/core/crew-requests.js +22 -0
  101. package/dist/core/crew-requests.js.map +1 -0
  102. package/dist/core/crew.d.ts +395 -0
  103. package/dist/core/crew.js +1857 -0
  104. package/dist/core/crew.js.map +1 -0
  105. package/dist/core/digest.d.ts +40 -0
  106. package/dist/core/digest.js +94 -0
  107. package/dist/core/digest.js.map +1 -0
  108. package/dist/core/distill.js +3 -5
  109. package/dist/core/distill.js.map +1 -1
  110. package/dist/core/eventlog.d.ts +27 -25
  111. package/dist/core/eventlog.js +97 -150
  112. package/dist/core/eventlog.js.map +1 -1
  113. package/dist/core/events/contracts.d.ts +51 -0
  114. package/dist/core/events/contracts.js +2 -0
  115. package/dist/core/events/contracts.js.map +1 -0
  116. package/dist/core/events/jsonl-store.d.ts +23 -0
  117. package/dist/core/events/jsonl-store.js +90 -0
  118. package/dist/core/events/jsonl-store.js.map +1 -0
  119. package/dist/core/events/sqlite-store.d.ts +37 -0
  120. package/dist/core/events/sqlite-store.js +215 -0
  121. package/dist/core/events/sqlite-store.js.map +1 -0
  122. package/dist/core/forecast.d.ts +44 -0
  123. package/dist/core/forecast.js +46 -0
  124. package/dist/core/forecast.js.map +1 -0
  125. package/dist/core/free-pool.d.ts +65 -0
  126. package/dist/core/free-pool.js +171 -0
  127. package/dist/core/free-pool.js.map +1 -0
  128. package/dist/core/git.d.ts +30 -0
  129. package/dist/core/git.js +50 -2
  130. package/dist/core/git.js.map +1 -1
  131. package/dist/core/github-events.d.ts +53 -0
  132. package/dist/core/github-events.js +227 -0
  133. package/dist/core/github-events.js.map +1 -0
  134. package/dist/core/goal-lanes.d.ts +53 -0
  135. package/dist/core/goal-lanes.js +99 -0
  136. package/dist/core/goal-lanes.js.map +1 -0
  137. package/dist/core/hosted.d.ts +27 -0
  138. package/dist/core/hosted.js +50 -0
  139. package/dist/core/hosted.js.map +1 -0
  140. package/dist/core/http-server.d.ts +5 -0
  141. package/dist/core/http-server.js +8 -0
  142. package/dist/core/http-server.js.map +1 -0
  143. package/dist/core/invite-link.d.ts +31 -0
  144. package/dist/core/invite-link.js +45 -0
  145. package/dist/core/invite-link.js.map +1 -0
  146. package/dist/core/loops.d.ts +37 -0
  147. package/dist/core/loops.js +81 -0
  148. package/dist/core/loops.js.map +1 -0
  149. package/dist/core/mcp-catalog.d.ts +182 -0
  150. package/dist/core/mcp-catalog.js +431 -0
  151. package/dist/core/mcp-catalog.js.map +1 -0
  152. package/dist/core/mcp.d.ts +87 -0
  153. package/dist/core/mcp.js +181 -0
  154. package/dist/core/mcp.js.map +1 -0
  155. package/dist/core/memory.d.ts +1 -0
  156. package/dist/core/memory.js +5 -2
  157. package/dist/core/memory.js.map +1 -1
  158. package/dist/core/model-tools.d.ts +97 -0
  159. package/dist/core/model-tools.js +388 -0
  160. package/dist/core/model-tools.js.map +1 -0
  161. package/dist/core/notify.js +19 -1
  162. package/dist/core/notify.js.map +1 -1
  163. package/dist/core/orchestra.d.ts +635 -0
  164. package/dist/core/orchestra.js +2120 -0
  165. package/dist/core/orchestra.js.map +1 -0
  166. package/dist/core/permissions.d.ts +56 -0
  167. package/dist/core/permissions.js +122 -0
  168. package/dist/core/permissions.js.map +1 -0
  169. package/dist/core/preview-proxy.d.ts +70 -0
  170. package/dist/core/preview-proxy.js +563 -0
  171. package/dist/core/preview-proxy.js.map +1 -0
  172. package/dist/core/preview-shot.d.ts +46 -0
  173. package/dist/core/preview-shot.js +109 -0
  174. package/dist/core/preview-shot.js.map +1 -0
  175. package/dist/core/process.d.ts +36 -0
  176. package/dist/core/process.js +168 -0
  177. package/dist/core/process.js.map +1 -0
  178. package/dist/core/prompt-queue.d.ts +136 -0
  179. package/dist/core/prompt-queue.js +269 -0
  180. package/dist/core/prompt-queue.js.map +1 -0
  181. package/dist/core/prompts.d.ts +53 -0
  182. package/dist/core/prompts.js +127 -0
  183. package/dist/core/prompts.js.map +1 -0
  184. package/dist/core/proof.d.ts +82 -0
  185. package/dist/core/proof.js +216 -0
  186. package/dist/core/proof.js.map +1 -0
  187. package/dist/core/provider-text.d.ts +23 -0
  188. package/dist/core/provider-text.js +66 -0
  189. package/dist/core/provider-text.js.map +1 -0
  190. package/dist/core/providers.d.ts +152 -0
  191. package/dist/core/providers.js +343 -0
  192. package/dist/core/providers.js.map +1 -0
  193. package/dist/core/quota.d.ts +33 -0
  194. package/dist/core/quota.js +74 -0
  195. package/dist/core/quota.js.map +1 -0
  196. package/dist/core/recipes.d.ts +50 -0
  197. package/dist/core/recipes.js +99 -0
  198. package/dist/core/recipes.js.map +1 -0
  199. package/dist/core/registry.d.ts +54 -0
  200. package/dist/core/registry.js +62 -5
  201. package/dist/core/registry.js.map +1 -1
  202. package/dist/core/relay-client.d.ts +67 -0
  203. package/dist/core/relay-client.js +184 -0
  204. package/dist/core/relay-client.js.map +1 -0
  205. package/dist/core/relay-protocol.d.ts +140 -0
  206. package/dist/core/relay-protocol.js +189 -0
  207. package/dist/core/relay-protocol.js.map +1 -0
  208. package/dist/core/replay.d.ts +18 -0
  209. package/dist/core/replay.js +191 -0
  210. package/dist/core/replay.js.map +1 -0
  211. package/dist/core/review-triage.d.ts +41 -0
  212. package/dist/core/review-triage.js +124 -0
  213. package/dist/core/review-triage.js.map +1 -0
  214. package/dist/core/router.js +2 -2
  215. package/dist/core/router.js.map +1 -1
  216. package/dist/core/routes.d.ts +39 -3
  217. package/dist/core/routes.js +137 -4
  218. package/dist/core/routes.js.map +1 -1
  219. package/dist/core/run-command.d.ts +14 -0
  220. package/dist/core/run-command.js +45 -0
  221. package/dist/core/run-command.js.map +1 -0
  222. package/dist/core/runner-setup.d.ts +36 -0
  223. package/dist/core/runner-setup.js +114 -0
  224. package/dist/core/runner-setup.js.map +1 -0
  225. package/dist/core/search.js +0 -0
  226. package/dist/core/search.js.map +1 -1
  227. package/dist/core/semantic.d.ts +92 -0
  228. package/dist/core/semantic.js +227 -0
  229. package/dist/core/semantic.js.map +1 -0
  230. package/dist/core/servers.d.ts +115 -0
  231. package/dist/core/servers.js +305 -0
  232. package/dist/core/servers.js.map +1 -0
  233. package/dist/core/setup.js +64 -6
  234. package/dist/core/setup.js.map +1 -1
  235. package/dist/core/shield.d.ts +17 -0
  236. package/dist/core/shield.js +81 -0
  237. package/dist/core/shield.js.map +1 -0
  238. package/dist/core/shift.d.ts +69 -0
  239. package/dist/core/shift.js +120 -0
  240. package/dist/core/shift.js.map +1 -0
  241. package/dist/core/skill-install.d.ts +125 -0
  242. package/dist/core/skill-install.js +328 -0
  243. package/dist/core/skill-install.js.map +1 -0
  244. package/dist/core/skills.d.ts +116 -0
  245. package/dist/core/skills.js +223 -0
  246. package/dist/core/skills.js.map +1 -0
  247. package/dist/core/step-conditions.d.ts +65 -0
  248. package/dist/core/step-conditions.js +102 -0
  249. package/dist/core/step-conditions.js.map +1 -0
  250. package/dist/core/subagents.d.ts +45 -0
  251. package/dist/core/subagents.js +90 -0
  252. package/dist/core/subagents.js.map +1 -0
  253. package/dist/core/team-canon.d.ts +42 -0
  254. package/dist/core/team-canon.js +121 -0
  255. package/dist/core/team-canon.js.map +1 -0
  256. package/dist/core/team-crypto.d.ts +97 -0
  257. package/dist/core/team-crypto.js +175 -0
  258. package/dist/core/team-crypto.js.map +1 -0
  259. package/dist/core/team-hub.d.ts +514 -0
  260. package/dist/core/team-hub.js +964 -0
  261. package/dist/core/team-hub.js.map +1 -0
  262. package/dist/core/team-landing.d.ts +239 -0
  263. package/dist/core/team-landing.js +504 -0
  264. package/dist/core/team-landing.js.map +1 -0
  265. package/dist/core/team-leases.d.ts +44 -0
  266. package/dist/core/team-leases.js +145 -0
  267. package/dist/core/team-leases.js.map +1 -0
  268. package/dist/core/team-memory.d.ts +42 -0
  269. package/dist/core/team-memory.js +84 -0
  270. package/dist/core/team-memory.js.map +1 -0
  271. package/dist/core/team-policy.d.ts +85 -0
  272. package/dist/core/team-policy.js +191 -0
  273. package/dist/core/team-policy.js.map +1 -0
  274. package/dist/core/thread-md.d.ts +6 -0
  275. package/dist/core/thread-md.js +42 -0
  276. package/dist/core/thread-md.js.map +1 -0
  277. package/dist/core/turn-stats.d.ts +61 -0
  278. package/dist/core/turn-stats.js +124 -0
  279. package/dist/core/turn-stats.js.map +1 -0
  280. package/dist/core/updater.d.ts +73 -0
  281. package/dist/core/updater.js +153 -0
  282. package/dist/core/updater.js.map +1 -0
  283. package/dist/core/usage.d.ts +75 -0
  284. package/dist/core/usage.js +163 -0
  285. package/dist/core/usage.js.map +1 -0
  286. package/dist/core/windows-jobs.d.ts +15 -0
  287. package/dist/core/windows-jobs.js +170 -0
  288. package/dist/core/windows-jobs.js.map +1 -0
  289. package/dist/core/worktree-merge.d.ts +57 -0
  290. package/dist/core/worktree-merge.js +123 -0
  291. package/dist/core/worktree-merge.js.map +1 -0
  292. package/dist/core/worktree.d.ts +5 -0
  293. package/dist/core/worktree.js +45 -5
  294. package/dist/core/worktree.js.map +1 -1
  295. package/dist/core/worktrees.d.ts +6 -0
  296. package/dist/core/worktrees.js +21 -0
  297. package/dist/core/worktrees.js.map +1 -0
  298. package/dist/daemon/app-page.d.ts +0 -17
  299. package/dist/daemon/app-page.js +10 -6346
  300. package/dist/daemon/app-page.js.map +1 -1
  301. package/dist/daemon/auth.d.ts +24 -3
  302. package/dist/daemon/auth.js +66 -7
  303. package/dist/daemon/auth.js.map +1 -1
  304. package/dist/daemon/board.d.ts +7 -0
  305. package/dist/daemon/board.js +12 -1
  306. package/dist/daemon/board.js.map +1 -1
  307. package/dist/daemon/brand-icons.d.ts +6 -1
  308. package/dist/daemon/brand-icons.js +11 -3
  309. package/dist/daemon/brand-icons.js.map +1 -1
  310. package/dist/daemon/client.d.ts +665 -1
  311. package/dist/daemon/client.js +381 -3
  312. package/dist/daemon/client.js.map +1 -1
  313. package/dist/daemon/delivery.d.ts +34 -0
  314. package/dist/daemon/delivery.js +63 -0
  315. package/dist/daemon/delivery.js.map +1 -0
  316. package/dist/daemon/deploys.d.ts +62 -0
  317. package/dist/daemon/deploys.js +159 -0
  318. package/dist/daemon/deploys.js.map +1 -0
  319. package/dist/daemon/landing.d.ts +192 -0
  320. package/dist/daemon/landing.js +992 -0
  321. package/dist/daemon/landing.js.map +1 -0
  322. package/dist/daemon/onboard.d.ts +150 -0
  323. package/dist/daemon/onboard.js +390 -0
  324. package/dist/daemon/onboard.js.map +1 -0
  325. package/dist/daemon/proof.d.ts +70 -0
  326. package/dist/daemon/proof.js +172 -0
  327. package/dist/daemon/proof.js.map +1 -0
  328. package/dist/daemon/push.d.ts +19 -1
  329. package/dist/daemon/push.js +90 -3
  330. package/dist/daemon/push.js.map +1 -1
  331. package/dist/daemon/relay.d.ts +82 -0
  332. package/dist/daemon/relay.js +351 -0
  333. package/dist/daemon/relay.js.map +1 -0
  334. package/dist/daemon/routes/agent-discovery.d.ts +4 -0
  335. package/dist/daemon/routes/agent-discovery.js +29 -0
  336. package/dist/daemon/routes/agent-discovery.js.map +1 -0
  337. package/dist/daemon/routes/agent-settings.d.ts +4 -0
  338. package/dist/daemon/routes/agent-settings.js +94 -0
  339. package/dist/daemon/routes/agent-settings.js.map +1 -0
  340. package/dist/daemon/routes/agents.d.ts +4 -0
  341. package/dist/daemon/routes/agents.js +105 -0
  342. package/dist/daemon/routes/agents.js.map +1 -0
  343. package/dist/daemon/routes/alerts.d.ts +4 -0
  344. package/dist/daemon/routes/alerts.js +137 -0
  345. package/dist/daemon/routes/alerts.js.map +1 -0
  346. package/dist/daemon/routes/approvals.d.ts +4 -0
  347. package/dist/daemon/routes/approvals.js +40 -0
  348. package/dist/daemon/routes/approvals.js.map +1 -0
  349. package/dist/daemon/routes/assets.d.ts +3 -0
  350. package/dist/daemon/routes/assets.js +64 -0
  351. package/dist/daemon/routes/assets.js.map +1 -0
  352. package/dist/daemon/routes/board.d.ts +4 -0
  353. package/dist/daemon/routes/board.js +147 -0
  354. package/dist/daemon/routes/board.js.map +1 -0
  355. package/dist/daemon/routes/brain.d.ts +4 -0
  356. package/dist/daemon/routes/brain.js +270 -0
  357. package/dist/daemon/routes/brain.js.map +1 -0
  358. package/dist/daemon/routes/chats.d.ts +4 -0
  359. package/dist/daemon/routes/chats.js +249 -0
  360. package/dist/daemon/routes/chats.js.map +1 -0
  361. package/dist/daemon/routes/clients.d.ts +4 -0
  362. package/dist/daemon/routes/clients.js +49 -0
  363. package/dist/daemon/routes/clients.js.map +1 -0
  364. package/dist/daemon/routes/cloud.d.ts +4 -0
  365. package/dist/daemon/routes/cloud.js +46 -0
  366. package/dist/daemon/routes/cloud.js.map +1 -0
  367. package/dist/daemon/routes/config.d.ts +4 -0
  368. package/dist/daemon/routes/config.js +35 -0
  369. package/dist/daemon/routes/config.js.map +1 -0
  370. package/dist/daemon/routes/context.d.ts +51 -0
  371. package/dist/daemon/routes/context.js +2 -0
  372. package/dist/daemon/routes/context.js.map +1 -0
  373. package/dist/daemon/routes/crews.d.ts +4 -0
  374. package/dist/daemon/routes/crews.js +149 -0
  375. package/dist/daemon/routes/crews.js.map +1 -0
  376. package/dist/daemon/routes/files.d.ts +3 -0
  377. package/dist/daemon/routes/files.js +253 -0
  378. package/dist/daemon/routes/files.js.map +1 -0
  379. package/dist/daemon/routes/git.d.ts +4 -0
  380. package/dist/daemon/routes/git.js +96 -0
  381. package/dist/daemon/routes/git.js.map +1 -0
  382. package/dist/daemon/routes/history.d.ts +4 -0
  383. package/dist/daemon/routes/history.js +101 -0
  384. package/dist/daemon/routes/history.js.map +1 -0
  385. package/dist/daemon/routes/integrations-project.d.ts +3 -0
  386. package/dist/daemon/routes/integrations-project.js +103 -0
  387. package/dist/daemon/routes/integrations-project.js.map +1 -0
  388. package/dist/daemon/routes/integrations.d.ts +3 -0
  389. package/dist/daemon/routes/integrations.js +111 -0
  390. package/dist/daemon/routes/integrations.js.map +1 -0
  391. package/dist/daemon/routes/logs.d.ts +3 -0
  392. package/dist/daemon/routes/logs.js +40 -0
  393. package/dist/daemon/routes/logs.js.map +1 -0
  394. package/dist/daemon/routes/messages.d.ts +4 -0
  395. package/dist/daemon/routes/messages.js +60 -0
  396. package/dist/daemon/routes/messages.js.map +1 -0
  397. package/dist/daemon/routes/observability.d.ts +4 -0
  398. package/dist/daemon/routes/observability.js +247 -0
  399. package/dist/daemon/routes/observability.js.map +1 -0
  400. package/dist/daemon/routes/onboard.d.ts +12 -0
  401. package/dist/daemon/routes/onboard.js +67 -0
  402. package/dist/daemon/routes/onboard.js.map +1 -0
  403. package/dist/daemon/routes/orchestra.d.ts +4 -0
  404. package/dist/daemon/routes/orchestra.js +110 -0
  405. package/dist/daemon/routes/orchestra.js.map +1 -0
  406. package/dist/daemon/routes/pairing.d.ts +4 -0
  407. package/dist/daemon/routes/pairing.js +155 -0
  408. package/dist/daemon/routes/pairing.js.map +1 -0
  409. package/dist/daemon/routes/preview.d.ts +24 -0
  410. package/dist/daemon/routes/preview.js +122 -0
  411. package/dist/daemon/routes/preview.js.map +1 -0
  412. package/dist/daemon/routes/project-actions.d.ts +4 -0
  413. package/dist/daemon/routes/project-actions.js +53 -0
  414. package/dist/daemon/routes/project-actions.js.map +1 -0
  415. package/dist/daemon/routes/project-team.d.ts +4 -0
  416. package/dist/daemon/routes/project-team.js +201 -0
  417. package/dist/daemon/routes/project-team.js.map +1 -0
  418. package/dist/daemon/routes/projects.d.ts +14 -0
  419. package/dist/daemon/routes/projects.js +138 -0
  420. package/dist/daemon/routes/projects.js.map +1 -0
  421. package/dist/daemon/routes/prompts.d.ts +4 -0
  422. package/dist/daemon/routes/prompts.js +44 -0
  423. package/dist/daemon/routes/prompts.js.map +1 -0
  424. package/dist/daemon/routes/proof.d.ts +4 -0
  425. package/dist/daemon/routes/proof.js +22 -0
  426. package/dist/daemon/routes/proof.js.map +1 -0
  427. package/dist/daemon/routes/providers.d.ts +3 -0
  428. package/dist/daemon/routes/providers.js +60 -0
  429. package/dist/daemon/routes/providers.js.map +1 -0
  430. package/dist/daemon/routes/public.d.ts +4 -0
  431. package/dist/daemon/routes/public.js +64 -0
  432. package/dist/daemon/routes/public.js.map +1 -0
  433. package/dist/daemon/routes/queue.d.ts +4 -0
  434. package/dist/daemon/routes/queue.js +140 -0
  435. package/dist/daemon/routes/queue.js.map +1 -0
  436. package/dist/daemon/routes/routing.d.ts +4 -0
  437. package/dist/daemon/routes/routing.js +61 -0
  438. package/dist/daemon/routes/routing.js.map +1 -0
  439. package/dist/daemon/routes/runtime-handler.d.ts +2 -0
  440. package/dist/daemon/routes/runtime-handler.js +63 -0
  441. package/dist/daemon/routes/runtime-handler.js.map +1 -0
  442. package/dist/daemon/routes/search.d.ts +4 -0
  443. package/dist/daemon/routes/search.js +17 -0
  444. package/dist/daemon/routes/search.js.map +1 -0
  445. package/dist/daemon/routes/servers.d.ts +4 -0
  446. package/dist/daemon/routes/servers.js +133 -0
  447. package/dist/daemon/routes/servers.js.map +1 -0
  448. package/dist/daemon/routes/setup.d.ts +3 -0
  449. package/dist/daemon/routes/setup.js +50 -0
  450. package/dist/daemon/routes/setup.js.map +1 -0
  451. package/dist/daemon/routes/shift.d.ts +4 -0
  452. package/dist/daemon/routes/shift.js +30 -0
  453. package/dist/daemon/routes/shift.js.map +1 -0
  454. package/dist/daemon/routes/specs.d.ts +4 -0
  455. package/dist/daemon/routes/specs.js +57 -0
  456. package/dist/daemon/routes/specs.js.map +1 -0
  457. package/dist/daemon/routes/task-delivery.d.ts +4 -0
  458. package/dist/daemon/routes/task-delivery.js +38 -0
  459. package/dist/daemon/routes/task-delivery.js.map +1 -0
  460. package/dist/daemon/routes/team.d.ts +4 -0
  461. package/dist/daemon/routes/team.js +193 -0
  462. package/dist/daemon/routes/team.js.map +1 -0
  463. package/dist/daemon/routes/terminals.d.ts +4 -0
  464. package/dist/daemon/routes/terminals.js +87 -0
  465. package/dist/daemon/routes/terminals.js.map +1 -0
  466. package/dist/daemon/routes/tools.d.ts +4 -0
  467. package/dist/daemon/routes/tools.js +180 -0
  468. package/dist/daemon/routes/tools.js.map +1 -0
  469. package/dist/daemon/routes/updates.d.ts +4 -0
  470. package/dist/daemon/routes/updates.js +89 -0
  471. package/dist/daemon/routes/updates.js.map +1 -0
  472. package/dist/daemon/routes/voice.d.ts +4 -0
  473. package/dist/daemon/routes/voice.js +53 -0
  474. package/dist/daemon/routes/voice.js.map +1 -0
  475. package/dist/daemon/runner.d.ts +186 -0
  476. package/dist/daemon/runner.js +612 -0
  477. package/dist/daemon/runner.js.map +1 -0
  478. package/dist/daemon/runtime/accounting.d.ts +130 -0
  479. package/dist/daemon/runtime/accounting.js +303 -0
  480. package/dist/daemon/runtime/accounting.js.map +1 -0
  481. package/dist/daemon/runtime/agents.d.ts +16 -0
  482. package/dist/daemon/runtime/agents.js +71 -0
  483. package/dist/daemon/runtime/agents.js.map +1 -0
  484. package/dist/daemon/runtime/briefings.d.ts +134 -0
  485. package/dist/daemon/runtime/briefings.js +329 -0
  486. package/dist/daemon/runtime/briefings.js.map +1 -0
  487. package/dist/daemon/runtime/native-usage.d.ts +21 -0
  488. package/dist/daemon/runtime/native-usage.js +71 -0
  489. package/dist/daemon/runtime/native-usage.js.map +1 -0
  490. package/dist/daemon/runtime/queue.d.ts +94 -0
  491. package/dist/daemon/runtime/queue.js +222 -0
  492. package/dist/daemon/runtime/queue.js.map +1 -0
  493. package/dist/daemon/runtime/relay.d.ts +93 -0
  494. package/dist/daemon/runtime/relay.js +240 -0
  495. package/dist/daemon/runtime/relay.js.map +1 -0
  496. package/dist/daemon/runtime/turns.d.ts +202 -0
  497. package/dist/daemon/runtime/turns.js +663 -0
  498. package/dist/daemon/runtime/turns.js.map +1 -0
  499. package/dist/daemon/runtime-support.d.ts +76 -0
  500. package/dist/daemon/runtime-support.js +134 -0
  501. package/dist/daemon/runtime-support.js.map +1 -0
  502. package/dist/daemon/runtime.d.ts +739 -70
  503. package/dist/daemon/runtime.js +2751 -470
  504. package/dist/daemon/runtime.js.map +1 -1
  505. package/dist/daemon/server.d.ts +82 -55
  506. package/dist/daemon/server.js +674 -1435
  507. package/dist/daemon/server.js.map +1 -1
  508. package/dist/daemon/shift.d.ts +70 -0
  509. package/dist/daemon/shift.js +170 -0
  510. package/dist/daemon/shift.js.map +1 -0
  511. package/dist/daemon/specs.d.ts +92 -0
  512. package/dist/daemon/specs.js +285 -0
  513. package/dist/daemon/specs.js.map +1 -0
  514. package/dist/daemon/system.d.ts +208 -0
  515. package/dist/daemon/system.js +557 -0
  516. package/dist/daemon/system.js.map +1 -0
  517. package/dist/daemon/tasks.js +1 -1
  518. package/dist/daemon/team-brain.d.ts +136 -0
  519. package/dist/daemon/team-brain.js +659 -0
  520. package/dist/daemon/team-brain.js.map +1 -0
  521. package/dist/daemon/team-coordinator.d.ts +78 -0
  522. package/dist/daemon/team-coordinator.js +408 -0
  523. package/dist/daemon/team-coordinator.js.map +1 -0
  524. package/dist/daemon/team.d.ts +339 -0
  525. package/dist/daemon/team.js +1433 -0
  526. package/dist/daemon/team.js.map +1 -0
  527. package/dist/daemon/terminals.d.ts +22 -3
  528. package/dist/daemon/terminals.js +236 -16
  529. package/dist/daemon/terminals.js.map +1 -1
  530. package/dist/hub/client.d.ts +120 -0
  531. package/dist/hub/client.js +228 -0
  532. package/dist/hub/client.js.map +1 -0
  533. package/dist/hub/server.d.ts +32 -0
  534. package/dist/hub/server.js +180 -0
  535. package/dist/hub/server.js.map +1 -0
  536. package/dist/hub/supabase-client.d.ts +220 -0
  537. package/dist/hub/supabase-client.js +843 -0
  538. package/dist/hub/supabase-client.js.map +1 -0
  539. package/dist/observability/ask.d.ts +91 -0
  540. package/dist/observability/ask.js +179 -0
  541. package/dist/observability/ask.js.map +1 -0
  542. package/dist/observability/clickhouse.d.ts +33 -0
  543. package/dist/observability/clickhouse.js +48 -0
  544. package/dist/observability/clickhouse.js.map +1 -0
  545. package/dist/observability/decisions.d.ts +176 -0
  546. package/dist/observability/decisions.js +377 -0
  547. package/dist/observability/decisions.js.map +1 -0
  548. package/dist/observability/index.d.ts +89 -0
  549. package/dist/observability/index.js +348 -0
  550. package/dist/observability/index.js.map +1 -0
  551. package/dist/observability/insights.d.ts +151 -0
  552. package/dist/observability/insights.js +319 -0
  553. package/dist/observability/insights.js.map +1 -0
  554. package/dist/observability/logs-query.d.ts +82 -0
  555. package/dist/observability/logs-query.js +102 -0
  556. package/dist/observability/logs-query.js.map +1 -0
  557. package/dist/observability/logs.d.ts +72 -0
  558. package/dist/observability/logs.js +295 -0
  559. package/dist/observability/logs.js.map +1 -0
  560. package/dist/observability/metrics.d.ts +86 -0
  561. package/dist/observability/metrics.js +303 -0
  562. package/dist/observability/metrics.js.map +1 -0
  563. package/dist/observability/otlp.d.ts +127 -0
  564. package/dist/observability/otlp.js +242 -0
  565. package/dist/observability/otlp.js.map +1 -0
  566. package/dist/observability/snapshots.d.ts +43 -0
  567. package/dist/observability/snapshots.js +129 -0
  568. package/dist/observability/snapshots.js.map +1 -0
  569. package/dist/observability/triage.d.ts +49 -0
  570. package/dist/observability/triage.js +284 -0
  571. package/dist/observability/triage.js.map +1 -0
  572. package/dist/providers/adapter.d.ts +50 -0
  573. package/dist/providers/adapter.js +38 -0
  574. package/dist/providers/adapter.js.map +1 -0
  575. package/dist/providers/agent.d.ts +110 -0
  576. package/dist/providers/agent.js +487 -0
  577. package/dist/providers/agent.js.map +1 -0
  578. package/dist/providers/approvals.d.ts +24 -0
  579. package/dist/providers/approvals.js +78 -0
  580. package/dist/providers/approvals.js.map +1 -0
  581. package/dist/providers/attachments.d.ts +20 -0
  582. package/dist/providers/attachments.js +51 -0
  583. package/dist/providers/attachments.js.map +1 -0
  584. package/dist/providers/claude/adapter.d.ts +99 -0
  585. package/dist/providers/claude/adapter.js +790 -0
  586. package/dist/providers/claude/adapter.js.map +1 -0
  587. package/dist/providers/codex/adapter.d.ts +113 -0
  588. package/dist/providers/codex/adapter.js +881 -0
  589. package/dist/providers/codex/adapter.js.map +1 -0
  590. package/dist/providers/codex/instructions.d.ts +11 -0
  591. package/dist/providers/codex/instructions.js +154 -0
  592. package/dist/providers/codex/instructions.js.map +1 -0
  593. package/dist/providers/codex/rpc.d.ts +36 -0
  594. package/dist/providers/codex/rpc.js +104 -0
  595. package/dist/providers/codex/rpc.js.map +1 -0
  596. package/dist/providers/contracts.d.ts +339 -0
  597. package/dist/providers/contracts.js +19 -0
  598. package/dist/providers/contracts.js.map +1 -0
  599. package/dist/providers/directory.d.ts +70 -0
  600. package/dist/providers/directory.js +95 -0
  601. package/dist/providers/directory.js.map +1 -0
  602. package/dist/providers/errors.d.ts +47 -0
  603. package/dist/providers/errors.js +24 -0
  604. package/dist/providers/errors.js.map +1 -0
  605. package/dist/providers/index.d.ts +18 -0
  606. package/dist/providers/index.js +19 -0
  607. package/dist/providers/index.js.map +1 -0
  608. package/dist/providers/ingestion.d.ts +80 -0
  609. package/dist/providers/ingestion.js +330 -0
  610. package/dist/providers/ingestion.js.map +1 -0
  611. package/dist/providers/live.d.ts +22 -0
  612. package/dist/providers/live.js +56 -0
  613. package/dist/providers/live.js.map +1 -0
  614. package/dist/providers/process.d.ts +29 -0
  615. package/dist/providers/process.js +71 -0
  616. package/dist/providers/process.js.map +1 -0
  617. package/dist/providers/reaper.d.ts +33 -0
  618. package/dist/providers/reaper.js +65 -0
  619. package/dist/providers/reaper.js.map +1 -0
  620. package/dist/providers/service.d.ts +87 -0
  621. package/dist/providers/service.js +256 -0
  622. package/dist/providers/service.js.map +1 -0
  623. package/dist/sdk.d.ts +1 -1
  624. package/dist/sdk.js +1 -1
  625. package/dist/sdk.js.map +1 -1
  626. package/dist/types.d.ts +385 -6
  627. package/dist/types.js +1 -0
  628. package/dist/types.js.map +1 -1
  629. package/dist/version.d.ts +7 -0
  630. package/dist/version.js +16 -0
  631. package/dist/version.js.map +1 -0
  632. package/dist/web/app.css +4646 -0
  633. package/dist/web/app.js +22640 -0
  634. package/dist/web/app.js.map +7 -0
  635. package/dist/web/shell.html +39 -0
  636. package/docs/README.md +21 -0
  637. package/docs/SETUP.md +10 -0
  638. package/docs/adapters.md +21 -8
  639. package/docs/brain-continuity.md +186 -0
  640. package/docs/cloud.md +108 -0
  641. package/docs/crews.md +62 -0
  642. package/docs/design-system.md +31 -2
  643. package/docs/integration-notes.md +128 -20
  644. package/docs/loompad.md +105 -0
  645. package/docs/observability.md +220 -0
  646. package/docs/play-store.md +123 -0
  647. package/docs/proposals/agent-teams.md +249 -0
  648. package/docs/proposals/brain-continuity-implementation.md +468 -0
  649. package/docs/proposals/brain-session-continuity.md +623 -0
  650. package/docs/proposals/t3code-port.md +81 -0
  651. package/docs/proposals/t3code-reference.md +95 -0
  652. package/docs/refactoring/AGENT-TEAMS-PROGRESS.md +88 -0
  653. package/docs/refactoring/BOUNDARIES.md +120 -0
  654. package/docs/refactoring/BRAIN-AUDIT.md +176 -0
  655. package/docs/refactoring/BRAIN-NOTES.md +390 -0
  656. package/docs/refactoring/BRAIN-TODO.md +214 -0
  657. package/docs/refactoring/NOTES.md +129 -0
  658. package/docs/refactoring/T3-PORT-NOTES.md +165 -0
  659. package/docs/refactoring/T3-PORT-TODO.md +123 -0
  660. package/docs/refactoring/TODO.md +46 -0
  661. package/docs/refactoring/brain-benchmark-2026-09-28.json +48 -0
  662. package/docs/refactoring/brain-benchmark-audit-2026-09-28.json +48 -0
  663. package/docs/release-notes/v0.2.0.md +35 -0
  664. package/docs/release-notes/v0.2.1.md +59 -0
  665. package/docs/release-notes/v0.2.3.md +77 -0
  666. package/docs/release-notes/v0.2.4.md +128 -0
  667. package/docs/release-notes/v0.2.5.md +153 -0
  668. package/docs/release-notes/v0.2.6.md +62 -0
  669. package/docs/release-notes/v1.0.0.md +120 -0
  670. package/docs/release-notes/v1.0.1.md +77 -0
  671. package/docs/release-notes/v1.1.0.md +71 -0
  672. package/docs/release-notes/v1.1.1.md +38 -0
  673. package/docs/release-notes/v1.1.2.md +21 -0
  674. package/docs/teams-architecture.md +697 -0
  675. package/docs/teams.md +171 -0
  676. package/docs/windows.md +85 -0
  677. package/package.json +22 -9
  678. package/dist/adapters/claude-code.d.ts +0 -26
  679. package/dist/adapters/claude-code.js +0 -209
  680. package/dist/adapters/claude-code.js.map +0 -1
  681. package/dist/adapters/codex.d.ts +0 -51
  682. package/dist/adapters/codex.js +0 -291
  683. package/dist/adapters/codex.js.map +0 -1
  684. package/docs/img/board-linear.png +0 -0
  685. package/docs/img/board-projects.png +0 -0
  686. package/docs/img/brain.png +0 -0
  687. package/docs/img/settings.png +0 -0
  688. package/docs/img/workspace.png +0 -0
@@ -0,0 +1,390 @@
1
+ # Brain research and edge-case notes
2
+
3
+ Updated: 2026-09-28. The user approved implementation. The deterministic
4
+ native path is implemented behind an opt-in flag; remaining gates are tracked in
5
+ [BRAIN-TODO](BRAIN-TODO.md).
6
+ The following are verified documentation observations or explicitly proposed
7
+ Loom behavior, not results from live harness tests.
8
+
9
+ ## Implementation receipt — 2026-09-28
10
+
11
+ User approval: “Alright, implement it”; subsequent instruction: update architecture
12
+ and docs as well. Work remains on `dev/Harsha`, with no new commit or push requested.
13
+
14
+ Implemented `core/continuity/` for strict Zod 4.6.5 contracts, transactional SQLite
15
+ state on the existing event connection, scoped sources and reviewed item revisions,
16
+ FTS/backfill/fallback, immutable packets, exact render hashes, per-chat native bindings,
17
+ workspace fencing, receipt transitions and conservative unknown-outcome recovery.
18
+ `RuntimeTurns` integrates sequential sends/queues, frozen models/targets, preparation
19
+ cancellation and cleanup. Codex/Claude inject ordinary turn context, use explicit
20
+ scoped IDs, correlate native events and await process close on interruption.
21
+
22
+ Design refinements from the proposal:
23
+
24
+ - Packet sections use one typed `items` union (`instruction`, `decision`, `correction`,
25
+ `topic`, `pending`) instead of parallel arrays. Status/revision/source evidence and
26
+ supersession remain explicit. This is the first wire version, not a migration
27
+ of an already published packet interface.
28
+ - Native retention remains unknown. Unprocessed user intent and reviewed current
29
+ items are repeated; return deltas reduce optional native/agent observations.
30
+ This deliberately favors fidelity over speculative subscription savings.
31
+ - Source-backed deterministic compaction requires explicit user review. No implicit
32
+ classifier decides that a tiny preference or unresolved question can be dropped.
33
+ - Immutable local source JSON is the harness retrieval path, alongside scoped
34
+ authenticated HTTP for clients. It needs no daemon credential in the prompt and
35
+ works through normal local file tools. Private filesystem isolation is not claimed.
36
+ - Activation uses `VACUUM INTO` before migration, avoiding an unsupported assumption
37
+ about newer Node backup APIs. No WAL/network-share durability claim is made.
38
+ - Runtime profiles are conservative checked CLI versions. Unknown versions,
39
+ attachments, OpenCode/bridges and parallel coding are explicitly unsupported.
40
+ Optional helpers stay disabled rather than launching an unverified account mode.
41
+
42
+ Migration: `loom brain:migrate` is offline, backed up, restartable/idempotent and
43
+ preserves event IDs. Distinct ID collisions/torn records fail before partial import.
44
+ The original JSONL remains readable. Returning to an older JSONL reader requires
45
+ explicit reconciliation of later SQLite writes; automatic downgrade is not shipped.
46
+ Artifacts finalize before packet references; orphan GC/deletion remains pending.
47
+
48
+ Verification so far:
49
+
50
+ - 27 new core/storage/HTTP/artifact tests passed, plus two native adapter regressions.
51
+ - Latest affected group: 93 tests passed across continuity, storage, HTTP, lifecycle,
52
+ event stores and Codex/Claude adapters. No authenticated model calls.
53
+ - Full non-DOM suite: 1,384 passed, 17 skipped before the final two adapter tests;
54
+ affected tests re-run after subsequent edits.
55
+ - Browser suite initially: 124 passed, one board-control timing failure before the
56
+ modal opened. Existing `ready()` helper now waits for the board control to be wired;
57
+ rerun passed all 125 tests across 12 browser suites.
58
+ - Build/typecheck pass. Whitespace checks pass; final affected checks are recorded below.
59
+
60
+ [Recorded benchmark](brain-benchmark-2026-09-28.json): Node 24.3.0, macOS arm64,
61
+ Apple M4/16 GiB, 10,001 source events, 20 buried user points, 30 preparations, no Git
62
+ and no paid calls. Added context 3,034 heuristic tokens versus exact replay 258,978.
63
+ All buried points included; the legacy last-400 slice omitted the first point.
64
+ Preparation p50 19.0 ms / p95 25.6 ms; retrieval p95 0.76 ms; event-loop p95 19.5 ms;
65
+ process RSS ~114 MiB; benchmark project disk ~4.61 MiB. Native understanding/usage
66
+ is not measured. This is a daemon benchmark, not an Electron or end-to-end provider benchmark.
67
+
68
+ Initial same-hardware regression thresholds for this frozen corpus: preparation
69
+ p95 <100 ms, retrieval p95 <5 ms, loop p95 <25 ms, all 20 protected points included,
70
+ and no inference process/helper calls. Git-heavy workspaces, 100k+ events, cold-start
71
+ migration, pathological mandatory overflow and real native continuation quality
72
+ still need separate baselines. Current evidence does not justify introducing a
73
+ worker with a synchronous bridge; revisit after those measurements.
74
+
75
+ Current architecture and user behavior are documented in
76
+ [ARCHITECTURE.md](../../ARCHITECTURE.md), [native continuity](../brain-continuity.md)
77
+ and [CONTRIBUTING.md](../../CONTRIBUTING.md). Remaining checklist items are intentional
78
+ release gates, not represented as complete by the implementation or UI.
79
+
80
+ ## 1. Evidence ledger
81
+
82
+ | Source checked | Verified observation | Loom implication / remaining check |
83
+ | --- | --- | --- |
84
+ | [Codex CLI reference](https://developers.openai.com/codex/cli/reference/) | Explicit exec resume IDs, newline-delimited JSON output, output-schema and ephemeral options are documented. | Bind a specific native ID; do not use most-recent selection. Verify accepted-event evidence and version-specific flags in fixtures. |
85
+ | [Codex app-server](https://developers.openai.com/codex/app-server/) | A documented application integration interface exists alongside CLI execution. | Evaluate against receipt/event requirements in P0; its existence is not a decision to replace Loom's working transport. |
86
+ | [Claude CLI reference](https://code.claude.com/docs/en/cli-reference#system-prompt-flags-in-resumed-conversations) | Resumed conversations may reuse recorded system prompt text; changes to prompt flags need not apply immediately. Built-in tool restriction does not alone remove MCP tools. | Do not rely on changed append-system prompts for corrections. Verify dynamic channel and helper isolation by installed version. |
87
+ | [Claude SDK sessions](https://code.claude.com/docs/en/agent-sdk/sessions) | Native sessions preserve conversations, not filesystem snapshots. Resume and fork are distinct operations. | Workspace identity/revision is app-owned. SDK behavior alone is not proof of CLI compatibility. |
88
+ | [Claude hooks](https://code.claude.com/docs/en/hooks) | PreCompact and PostCompact lifecycle hooks are documented. | Compaction can be observable on supported integrations. Determine whether our actual adapter can receive these signals without overwriting user hooks. |
89
+ | [Claude costs](https://code.claude.com/docs/en/costs) | Context size affects token usage; caching and native compaction are optimizations. | Measure native and added-context usage separately; do not promise subscription savings from packet size alone. |
90
+ | [OpenCode SDK](https://opencode.ai/docs/sdk/) | Session prompts support context-only noReply; session abort/summarize and message reads are documented. | An optional injection path exists, but current Loom's legacy API must be reconciled first. NoReply is not free context. |
91
+ | [OpenCode server](https://opencode.ai/docs/server/) | Published session endpoints cover prompt, abort and message operations. | Pin supported server protocol; avoid inferring support from endpoint reachability alone. |
92
+ | [Zod schemas](https://zod.dev/api) | Strict objects and discriminated unions are available. | Use versioned backend contracts and inferred types; runtime shape checks do not establish truthful content. |
93
+ | [Zod JSON Schema](https://zod.dev/json-schema) | Schema conversion supports dialect selection; some Zod types/checks cannot be represented. | Simple helper schemas only; test provider-supported subsets and run semantic validation locally. |
94
+ | [Claude structured output errors](https://code.claude.com/docs/en/agent-sdk/structured-outputs#error-handling) | Structured output generation can fail, including exhausted validation retries. | Bound helper retries and retain deterministic fallback; partial output cannot become a validated checkpoint. |
95
+ | [SQLite FTS5](https://sqlite.org/fts5.html) | BM25 ranks lexical matches; external-content indexes need explicit consistency maintenance. | Search without an embedding model. Test initial backfill, update/delete/rebuild, query escaping and packaged runtime support. |
96
+ | [SQLite WAL](https://sqlite.org/wal.html) | WAL has same-host/local-filesystem constraints and separate checkpoint behavior. | Do not use network-share WAL or copy only a live database file for backup. |
97
+ | [SQLite backup](https://sqlite.org/backup.html) | A supported online backup interface exists. | Select a safe backup route and test recovery rather than relying on ordinary file copying. |
98
+ | [Node SQLite](https://nodejs.org/api/sqlite.html) | The current Node docs expose DatabaseSync and a backup function with version history. | Feature-probe against Loom's minimum Node version and bundled runtime; current web docs describe a newer runtime than that minimum. |
99
+
100
+ Sources were read on 2026-09-28. No account entitlement, provider ToS clearance,
101
+ installed version compatibility or real token accounting was established by this
102
+ research. The implementation remains within supported native interfaces; test
103
+ model availability and account-supported helper use before enabling it.
104
+
105
+ The earlier [T3 notes](../proposals/t3code-reference.md) remain pinned to their
106
+ inspected commit. T3's helper pattern is useful; it is not evidence that Loom
107
+ already has cross-harness continuation or measured performance.
108
+
109
+ ## 2. Baseline code observations before implementation
110
+
111
+ Base commit: `584a3b6a86bfa9af2a0a8ecbeac57e6aa4578e7a`.
112
+
113
+ - `SendInput` has text/briefing/model/MCP but no conversation binding, run epoch,
114
+ receipt correlation or explicit session selection.
115
+ - `AgentStateStore` separates access but native IDs remain in per-instance slots.
116
+ It does not yet provide multiple native sessions per app conversation.
117
+ - Claude injects briefing through append-system-prompt; the documented resume
118
+ snapshot behavior requires a verified alternative for changing context.
119
+ - Codex resumes an explicit instance-level thread; OpenCode speaks older
120
+ `/api/session/.../prompt` shapes rather than assuming the modern SDK contract.
121
+ - The legacy briefing wrapper labels all carried context authoritative. The new
122
+ renderer must distinguish user instructions from assistant/external evidence.
123
+ - `RuntimeAgents` ignores retired callbacks and waits for stop promises, but
124
+ swallows stop errors. That is not verified quiescence. A failed stop must not
125
+ permit a new writer in the continuity flow.
126
+ - Some pinned-thread execution bypasses the baton. A chat pin is not a read-only
127
+ guarantee, so a workspace execution lease must cover that path too.
128
+ - Live event ordering, run identity and late-event capture need an explicit
129
+ ingest path; project event IDs alone do not correlate native retries.
130
+ - DatabaseSync/EventLog currently run synchronously in the daemon. A transparent
131
+ worker wrapper would either change contracts or block; design an asynchronous
132
+ internal boundary first. Bounded queries/backpressure and responsiveness tests
133
+ are required; isolate ownership further if those measurements require it.
134
+ - The boundary refactor is now committed. Its recorded 1,482 passing tests are a
135
+ useful baseline, not proof of the new continuity behavior.
136
+
137
+ ## 3. Edge-case matrix
138
+
139
+ Each ID becomes a named fixture or documented platform/capability check. The
140
+ expected responses below are design requirements, not implemented behavior.
141
+ No finite list proves that every possible edge case has been found.
142
+
143
+ ### User meaning and scope
144
+
145
+ | ID | Trigger | Required handling / assertion |
146
+ | --- | --- | --- |
147
+ | E01 | Small preference buried early in a long conversation | Protected state or exact unresolved source survives; retrieval rank cannot drop it. |
148
+ | E02 | User says an alternative might work | Keep tentative/exploratory status; no accepted decision without supporting user evidence. |
149
+ | E03 | User corrects an earlier decision | Supersede the matching scoped revision; send the correction and current state on return. |
150
+ | E04 | Instructions appear contradictory but apply to different tasks | Preserve scopes; do not blindly let the newest sentence win. |
151
+ | E05 | Ambiguous or conflicting governing instruction | Keep evidence and unresolved conflict visible; clarify only when execution depends on resolving it. |
152
+ | E06 | Rejected alternative or unresolved question | Retain topic disposition; do not summarize it as a chosen approach or completed task. |
153
+ | E07 | Edited/deleted message already supplied to a provider | Record revision/deletion and invalidate derived state; do not claim the native session forgot the original. |
154
+ | E08 | New user message arrives during assembly/helper work | Persist immediately; invalidate unsent governing context or queue steering for the captured run target. |
155
+
156
+ ### Native sessions and execution
157
+
158
+ | ID | Trigger | Required handling / assertion |
159
+ | --- | --- | --- |
160
+ | E09 | Same configured agent used in two chats | Separate native bindings; never resume chat A's cursor for chat B. |
161
+ | E10 | Switch to another provider with a similarly named model | Resolve actual instance/harness identity; never transfer provider resume IDs. |
162
+ | E11 | Same-harness model/permission/auth configuration changes | Validate compatibility fingerprint; resume only when supported, otherwise reconstruct a new epoch. |
163
+ | E12 | Native session missing, expired, manually cleared or corrupted | Preserve app evidence; mark binding unavailable and reconstruct safely. |
164
+ | E13 | Return to a native session that compacted | Submitted coverage remains history; retained confidence changes and protected state is refreshed. |
165
+ | E14 | Compaction signal unavailable or lost | Record unknown retention; use conservative reconstruction policy without pretending exact memory. |
166
+ | E15 | Repeated resume ignores a changed system prompt | Fixture catches it; deliver dynamic context through a verified per-turn channel. |
167
+ | E16 | Workspace moved, branch/worktree changed or non-Git project | Revalidate workspace identity and observations; no clean/compatible assumption from the native session alone. |
168
+
169
+ ### Switching and concurrency
170
+
171
+ | ID | Trigger | Required handling / assertion |
172
+ | --- | --- | --- |
173
+ | E17 | Rapid idle picker changes | Coalesce selection locally; no provider request or helper job required. |
174
+ | E18 | Picker changes after request submission | Frozen request target remains unchanged; later selection affects subsequent work only. |
175
+ | E19 | Switch while a writer is active | Default finish-then-switch; explicit interrupt path waits for quiescence. |
176
+ | E20 | Interrupt acknowledgement but child process still writes | Hold writer lease; no replacement writer until stop is verified. |
177
+ | E21 | Stop fails, times out or an approval dialog remains | Surface stopping/failed-stop state; do not swallow it and continue editing elsewhere. |
178
+ | E22 | Late event from previous run after a switch | Attach to the original run; never advance the new run's coverage/current task state. |
179
+ | E23 | Concurrent sends, queued prompts or two pinned chats | Idempotent requests, explicit order, one foreground chat run and one workspace writer. |
180
+ | E24 | Route/orchestra/bridge/helper shares a workspace | Enforce capabilities and ownership across entrypoints; helper/bridge cannot silently become an authorized writer. |
181
+
182
+ ### Submission and crash recovery
183
+
184
+ | ID | Trigger | Required handling / assertion |
185
+ | --- | --- | --- |
186
+ | E25 | Crash after prepared packet, before external call | No submission recorded; safely continue the prepared attempt after revalidation. |
187
+ | E26 | Crash after marking submitting but before/around native acceptance | Outcome unknown unless correlated evidence resolves it; do not infer rejection. |
188
+ | E27 | Native accepts but response/ack is lost | Reconcile session messages/request IDs if supported; otherwise explicit unknown recovery, no automatic replay of edits. |
189
+ | E28 | Process spawned but prompt rejected | Spawn is not acceptance; distinguish startup from native input acknowledgement. |
190
+ | E29 | Accepted request ends in error, quota exhaustion or cancellation | Preserve acceptance/coverage separately from run outcome; no false completed-work claim. |
191
+ | E30 | Duplicate/reordered native events or client retries | Use source IDs/idempotency where available; dedupe only provable duplicates, preserve valid repeated text. |
192
+ | E31 | App restart while old CLI remains alive | Reconcile live ownership before dispatch; do not create a second writer. |
193
+ | E32 | Two app processes, stale lease or reused PID | Validate owner identity/fencing and quiescence; heartbeat expiry/PID alone cannot authorize takeover. |
194
+
195
+ ### Packet validity and evidence quality
196
+
197
+ | ID | Trigger | Required handling / assertion |
198
+ | --- | --- | --- |
199
+ | E33 | Schema version unknown, malformed JSON, extra keys or huge nesting | Bound parsing; reject/quarantine without partial state mutation or silent field loss. |
200
+ | E34 | Helper invents source ID/span/hash or references another project | Semantic validation rejects it before state or retrieval output changes. |
201
+ | E35 | Summary drops a small point or promotes agent opinion | Preserve originals, dispositions and authority; schema-valid is not semantically complete. |
202
+ | E36 | Unicode, CJK, emoji, CRLF or code delimiters in user text | Exact capture, safe UTF-8 spans and rendering; token estimation and query handling must not corrupt text. |
203
+ | E37 | Tool emitted success-looking stdout then failed/timed out | Final exit/outcome controls work claims; preserve stderr and partial output. |
204
+ | E38 | Interrupted streaming message, missing final event or partial tool result | Mark partial/unknown; never reconstruct it as a complete successful response. |
205
+ | E39 | Tests passed before subsequent file changes | Record workspace revision; mark applicability stale rather than reporting current verification. |
206
+ | E40 | Packet becomes stale before send | Revalidate epoch, protected state, permissions and workspace; rebuild or fail before invoking native work. |
207
+
208
+ ### Budget, retrieval and helpers
209
+
210
+ | ID | Trigger | Required handling / assertion |
211
+ | --- | --- | --- |
212
+ | E41 | Mandatory instructions/current request exceed soft/native budget | Visible overflow and resumable expansion/narrowing; no silent truncation or empty packet. |
213
+ | E42 | Returning session has summarized/referenced coverage holes | Delta reconstructs necessary missing evidence; high-water mark alone cannot skip it. |
214
+ | E43 | FTS unavailable, index stale/corrupt or rebuilding | Bounded exact/entity fallback, rebuild diagnostics and transactional index consistency. |
215
+ | E44 | Search wording differs, FTS syntax/path tokens are unusual | Escaped bounded queries, aliases and broader source reads; no claim of universal semantic recall. |
216
+ | E45 | MCP unavailable, exported file unreadable or unsupported attachment | Necessary content inline or explicit limitation; reference alone is not delivered content. |
217
+ | E46 | Helper unavailable, invalid output, quota limit or expensive fallback | Deterministic flow/originals remain; bounded failure cooldown and no silent model substitution. |
218
+ | E47 | Helper finishes after correction, deletion, shutdown or model/policy change | Recheck hashes/revisions/lifetime; discard stale result and do not advance coverage. |
219
+ | E48 | Many chats trigger summaries/titles simultaneously | Global/project bounded scheduling, deduplication and foreground priority; no recursive helper jobs. |
220
+
221
+ ### Persistence, migration and artifacts
222
+
223
+ | ID | Trigger | Required handling / assertion |
224
+ | --- | --- | --- |
225
+ | E49 | Disk full, permission error or failed DB transaction | Fail before acknowledging durable capture; no memory-only cursor advancement or silent fallback store. |
226
+ | E50 | SQLite busy, long reader or growing WAL | Bounded retry/checkpoint/backpressure; UI remains responsive and capture order is preserved. |
227
+ | E51 | Network filesystem or unsupported SQLite/Node feature | Explicit supported mode/failure; no unsupported WAL or pretending continuity is available. |
228
+ | E52 | Crash between artifact finalize and referencing transaction | Orphan cleanup after grace period; committed references only point to finalized verified artifacts. |
229
+ | E53 | Artifact missing/corrupt or media/decompression bomb | Integrity/capability checks and bounded parsing; preserve diagnostics without fabricating evidence. |
230
+ | E54 | Backup taken during writes, migration interrupted or rollback requested | Safe backup/atomic migration; restore includes all post-cutover evidence via export, no unnoticed history loss. |
231
+ | E55 | JSONL torn tail, colliding IDs or both SQLite/JSONL have distinct histories | Manifest/count/hash reconciliation; retain sources and require explicit conflict policy before cutover. |
232
+ | E56 | Legacy session cursor has ambiguous chat ownership | Leave unassigned until verified; do not clone it into every chat or discard it silently. |
233
+
234
+ ### Privacy, trust and product integration
235
+
236
+ | ID | Trigger | Required handling / assertion |
237
+ | --- | --- | --- |
238
+ | E57 | Private/team/external memory appears relevant across scopes | Scope filtering before ranking/reads/export; no relevance-based permission bypass. |
239
+ | E58 | Retrieved text contains instructions or forged briefing delimiters | Label/escape evidence; preserve origin and native permissions, never replay embedded commands automatically. |
240
+ | E59 | User instruction files change or imported memory conflicts | Fingerprint/refresh sources; do not overwrite user files or elevate all imports to system authority. |
241
+ | E60 | Explicit data deletion with derived summaries/artifacts/backups/native sessions | Invalidate app dependencies and jobs; clearly distinguish hiding, app deletion and external retained copies. |
242
+ | E61 | Offline/provider-down switch, unavailable model or authentication changes | Preserve pending request and history; no dependence on the failed provider's helper or automatic fallback execution. |
243
+ | E62 | Text-only target receives images, binary files or large attachments | Capability-aware representations; attachment pointer is not visual understanding, no guessed content. |
244
+ | E63 | UI disconnect, stale command version or duplicate submission | Canonical state persists independently; scoped replay/version checks and idempotent client request IDs. |
245
+ | E64 | Diagnostics/logging/export includes credentials or private source text | Capture documented output only; redact sensitive diagnostic fields, apply scopes and explicit export policy. |
246
+
247
+ ## 4. Historical planning questions / decisions to preserve
248
+
249
+ - Historical: proposed defaults were awaiting review; user approved implementation on 2026-09-28.
250
+ - Installed harness versions, account helper models, native idempotency/ack
251
+ evidence, compaction visibility and stop guarantees have not been live-tested.
252
+ - CLI vs app-server/SDK selection remains a P0 capability decision; changing
253
+ transport must solve a concrete missing requirement.
254
+ - Need a documented minimum supported Node/harness matrix and migration backup
255
+ route before SQLite cutover. No changes to dependencies were made in research.
256
+ - Token targets are configurable soft targets. Reference hardware, output reserve,
257
+ performance thresholds and long-history evaluation corpus must be frozen before
258
+ advertising latency/RAM/continuation quality.
259
+ - Existing embedding candidates are historical optional research only; no local
260
+ model is required or planned for the first milestone.
261
+ - No private transcript edits, prompt proxying or API pricing assumptions are
262
+ required by this design. Native usage/account behavior still needs verification.
263
+
264
+ ## 5. Session receipt for this planning work
265
+
266
+ - [x] Reviewed current code and committed boundary baseline.
267
+ - [x] Read primary harness, Zod, SQLite and Node documentation.
268
+ - [x] Wrote actionable plan, edge-case matrix and implementation checklist.
269
+ - [x] User reviewed/approved the plan.
270
+ - [x] Implementation started; current release gaps are listed in BRAIN-TODO.
271
+
272
+ Research changed documentation only. No code, dependency, model download, paid
273
+ harness call, runtime fixture or application server was run. Local document links,
274
+ code-fence balance, tracked/new-file whitespace and all 64 unique edge-case IDs
275
+ were checked successfully. Runtime tests were not rerun for documentation changes.
276
+
277
+ ## Final verification receipt
278
+
279
+ - `npm run build` and `npm run typecheck`: passed.
280
+ - Full daemon/non-DOM regression: 1,384 passed, 17 skipped; no model calls.
281
+ - All 12 browser suites rerun after the board readiness fix: 125 passed.
282
+ - Final affected group after adapter/dispatch refinements: 105 passed across
283
+ 8 suites (continuity, storage, HTTP, native adapters, chat API, events, lifecycle).
284
+ - Initial sandbox-only integration failures were localhost `listen EPERM`;
285
+ authorized reruns with networking passed.
286
+ - Source artifact tests verify full output preservation, integrity, unsafe paths
287
+ and immutable references; previews are labelled truncated when originals are
288
+ stored as artifacts. Known pre-launch rejection produces `failed`; lack of
289
+ native evidence stays `outcome_unknown`.
290
+ - No commit/push, installed account probe beyond fake fixtures, or paid harness turn.
291
+
292
+ The complete approved release plan is not claimed finished. Optional helpers,
293
+ OpenCode parity, automatic retention/deletion/GC, native compaction observation,
294
+ real account/token/continuation measurements and broader platform/fault-injection
295
+ gates remain in BRAIN-TODO. The implemented mode remains opt-in.
296
+
297
+ Final artifact checks: `npm pack --dry-run` includes the continuity JavaScript,
298
+ contracts/types, implementation guide and benchmark JSON (561 files, ~6.67 MiB
299
+ unpacked). Documentation relative links and `git diff --check` passed. The
300
+ additional strict HTTP submission tests reject string booleans/unknown keys before
301
+ request capture or harness invocation. Native live/account and cross-platform
302
+ packaged execution remain unverified.
303
+
304
+ ## Cleanup audit receipt — 2026-09-28
305
+
306
+ User requested removal of obsolete Brain paths, races and bad logic, followed by
307
+ comparison with the approved implementation plan and research matrix. Applied the
308
+ code-review and codebase-design skills. Two independent review axes and all E01–E64
309
+ implementation statuses are recorded in [BRAIN-AUDIT](BRAIN-AUDIT.md).
310
+
311
+ The cleanup fixes cancellation, source coverage/authority, exact queued capture,
312
+ atomic recovery, native descendant containment, app-owned post-turn writes and
313
+ artifact/index consistency. Current-request bytes now count toward the conservative
314
+ turn-input budget. Remaining native usage is still unknown. No paid native tests or
315
+ new commit/push were requested or performed. Legacy compatibility APIs remain while
316
+ native execution skips their injection/mining/extraction; unsafe queue edits and
317
+ unverified autonomous routes now fail explicitly instead of appearing supported.
318
+
319
+ Additional primary-source check: [Claude tool-call result format](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls)
320
+ documents tool-use IDs and error flags. This supports a future result normalizer,
321
+ but does not verify that every checked CLI profile emits those results. The Claude
322
+ normalization gate remains open rather than inferring success from assistant text.
323
+
324
+ Verified after cleanup:
325
+
326
+ - `npm run build` and `npm run typecheck`: passed.
327
+ - Final focused core/native group: 87 passed across five suites.
328
+ - `npm test`: 1,408 non-DOM tests and all 125 browser tests passed; 17 existing skips.
329
+ The full suite ran outside the filesystem/network sandbox because localhost
330
+ listeners are required. No paid provider calls were made.
331
+ - `git diff --check` and documentation links: passed; all 64 unique matrix IDs have audit rows.
332
+ - Packaging dry run with already-built output: new compiled modules, audit and
333
+ benchmark artifacts included. No package published.
334
+ - [Audit benchmark](brain-benchmark-audit-2026-09-28.json): same M4/Node24.3 corpus,
335
+ all 20 buried user points retained; preparation p95 13.85 ms, retrieval p95
336
+ 0.224 ms, event-loop p95 18.12 ms; 3,047 heuristic turn-input tokens including
337
+ the current request. Native token usage and understanding remain unmeasured.
338
+
339
+ Standards: eight initial/follow-up correctness findings addressed; the original
340
+ worst issue was Stop racing with launch. Spec: ten initial/follow-up findings
341
+ addressed in the supported path; full descendant/platform containment remains
342
+ partial. Neither verdict is release certification for every matrix row.
343
+
344
+ ## OpenCode (2026-09-29)
345
+
346
+ Enabled as a native harness after its protocol and acceptance fixtures passed.
347
+
348
+ Protocol, recorded from a live `opencode serve` 1.18.31 (`/doc` OpenAPI plus a captured `/event` stream):
349
+
350
+ - A bound session that no longer exists answers `GET /api/session/{id}` with 404
351
+ `SessionNotFoundError`. The adapter raises NativeSessionMissing before sending
352
+ anything, so the engine moves the binding to a new epoch.
353
+ - `POST /api/session/{id}/prompt` returns 200 at once with an admission
354
+ (`admittedSeq`, message id, `delivery: "steer"`). That admission is the
355
+ acceptance evidence (`native_turn_accepted`). Any other status before admission
356
+ is NativeDispatchRejected; a network failure mid-request stays "outcome unknown".
357
+ - `/api/session/{id}/wait` still answers 503 ("not available yet"), so it can't
358
+ prove a turn is over. `GET /api/session/active` lists the session as
359
+ `{type: "running"}` for the whole turn and drops it when the turn ends, so the
360
+ turn is over, and quiescent, when the session leaves that list. A session still
361
+ listed at the timeout is NativeQuiescenceUnknown.
362
+ - `POST /api/session/{id}/model` switches the model of an existing session, so a
363
+ model change keeps the native session, as with Codex and Claude.
364
+ - Streamed events are `session.next.*`: text/reasoning deltas, `tool.called` /
365
+ `tool.success` / `tool.failed` (reported as tool calls), and
366
+ `compaction.started` / `compaction.ended` plus `session.compacted` (reported once
367
+ as `native_compacted`, which marks the binding compacted).
368
+
369
+ Verification:
370
+
371
+ - `test/opencode-continuity.test.ts` (11 cases) runs the real adapter and engine
372
+ against a fake server with those shapes. The cases: acceptance and correlation,
373
+ delta resume on the same session, in-place model switch, a lost session then
374
+ rebuild, a refused prompt with no lease left behind, a stuck session with
375
+ unknown quiescence, a failed turn, tool and compaction events, the baseUrl
376
+ health probe, and a runtime-level turn. A mutation that drops the lost-session
377
+ check fails it.
378
+ - Live (opencode 1.18.31, free `opencode/big-pickle`), through a daemon with
379
+ continuity on:
380
+ 1. The first turn is a reconstruction, which creates the session.
381
+ 2. The second is a delta on the same session and recalls a planted fact.
382
+ 3. After restarting the daemon and its OpenCode server, the third is a delta on
383
+ the same session and still recalls the fact.
384
+ All three receipts are `accepted/complete`. An ordinary (non-continuity)
385
+ OpenCode turn still works.
386
+
387
+ Limits: prompts carry no client message id yet (the API accepts `id: msg_…`, which
388
+ could make a lost acknowledgement retry-safe). There is no context-window meter
389
+ for OpenCode. Attachments and `extraArgs` stay refused, as for the other harnesses.
390
+
@@ -0,0 +1,214 @@
1
+ # Brain implementation TODO
2
+
3
+ Status: deterministic native mode implemented; release gates remain. Updated: 2026-09-28.
4
+ Plan: [brain-continuity-implementation.md](../proposals/brain-continuity-implementation.md).
5
+ Evidence and case IDs: [BRAIN-NOTES.md](BRAIN-NOTES.md).
6
+
7
+ Check an item only after its implementation and required verification pass.
8
+ Record actual results, revisions and unresolved limitations in BRAIN-NOTES.md.
9
+ Do not infer user approval from elapsed time or an unchecked question.
10
+
11
+ ## Planning receipt
12
+
13
+ - [x] Read committed boundary implementation and previous continuity proposal.
14
+ - [x] Browse primary sources for native continuation, injection, schema and storage.
15
+ - [x] Make embeddings/local model runtimes unnecessary for the first milestone.
16
+ - [x] Define packet/render/receipt separation and non-silent overflow/recovery policy.
17
+ - [x] Identify 64 edge-case fixtures/checks with explicit required outcomes.
18
+ - [x] User reviews and authorizes implementation (2026-09-28).
19
+
20
+ ## P0 — Contracts and capabilities
21
+
22
+ - [x] Add/pin Zod; define versioned JSON-compatible domain contracts and inferred types.
23
+ - [x] Implement semantic source/scope/authority/epoch/coverage validation; E33–E36, E40.
24
+ - [x] Define protocol limits and unknown-version/error behavior for imports and IPC/HTTP.
25
+ - [x] Define asynchronous internal commands for potential worker isolation; preserve legacy synchronous semantics in their owner.
26
+ - [x] Record supported Node/harness versions and compatibility profiles.
27
+ - [ ] Verify Claude dynamic context on resume, Codex explicit resume and OpenCode API shape; E09–E16.
28
+ OpenCode API shape verified against opencode 1.18.31 (2026-09-29): see BRAIN-NOTES "OpenCode".
29
+ - [x] Establish native acceptance evidence and idempotency limits; E25–E30.
30
+ - [x] Define process/run quiescence and project/workspace ownership; E19–E24, E31–E32.
31
+ - [x] Choose a read-only retrieval route for each supported harness; E45.
32
+ - [x] Write fake CLI/local server fixtures; run focused adapter/schema tests without paid calls.
33
+
34
+ Gate: all assumptions needed by P1/P2 have explicit tested capabilities or a
35
+ visible unsupported path. Stop errors cannot be swallowed into a new writer.
36
+
37
+ ## P1 — Canonical evidence and storage
38
+
39
+ - [x] Finalize ordered DDL/migrations, foreign keys, IDs and transactional write paths.
40
+ - [ ] Back up and import existing SQLite/JSONL/state.json with manifests and conflict rules.
41
+ - [ ] Preserve Main/pre-chat history and original event IDs; handle ambiguous native slots; E55–E56.
42
+ - [x] Implement idempotent user requests and exact capture; E08, E30, E63.
43
+ - [ ] Implement message/queue revision and deletion dependencies; E07. Native action edits are gated.
44
+ - [ ] Normalize streaming/tool outcomes without destroying captured observations; E37–E39.
45
+ - [x] Implement instructions, decision supersession, topic ledger and source dispositions; E01–E06.
46
+ - [ ] Implement artifact finalization, integrity and scoped references; E52–E53, E62.
47
+ - [ ] Build/backfill FTS/entity indexes with query escaping and rebuild fallback; E43–E44.
48
+ - [ ] Test disk-full/busy/crash/backup/network-filesystem failures; E49–E54.
49
+ - [ ] Test rollback including post-cutover events and older-reader behavior.
50
+ - [ ] Implement project ownership/fencing and bounded database queues; E32, E50–E51.
51
+
52
+ Gate: source history is recoverable, migrations are restartable, no empty-store
53
+ fallback or silent merge, and no mandatory user intent depends on FTS ranking.
54
+
55
+ ## P2 — Deterministic sequential continuity
56
+
57
+ - [x] Implement per-chat/per-workspace native bindings and epochs.
58
+ - [x] Implement frozen snapshots and source-level exact/summary/reference/omission coverage.
59
+ - [x] Assemble reconstruction/return deltas with protected intent and exact current request.
60
+ - [x] Render origin-labeled context; remove blanket authority framing in the new path; E58–E59.
61
+ - [x] Persist immutable packet/render hashes and revalidate before submission; E40, E42.
62
+ - [x] Implement delivery attempts/receipts and correlated native event ingest; E25–E30.
63
+ - [x] Implement finish/interrupt switching, queued target capture and writer leases; E17–E24.
64
+ - [x] Recover after restart without blindly replaying unknown action prompts; E26–E27, E31–E32.
65
+ - [x] Run Claude → Codex → Claude fixture, including correction and app restart.
66
+ - [ ] Verify unavailable targets/offline operation and scoped source access; E45, E57, E61–E64.
67
+
68
+ Gate: deterministic continuity works across sessions with visible coverage and
69
+ recovery state; no duplicate action execution or cross-chat session reuse.
70
+
71
+ ## P3 — Long conversations and lightweight performance
72
+
73
+ - [x] Implement source-backed checkpoints and deterministic compaction/fidelity policy.
74
+ - [x] Handle native compaction (both harnesses report it); E13. Retention after an
75
+ uncompacted resume stays "unknown"; E14.
76
+ - [ ] Measure tokenizer/heuristic budgets and retrieval/helper/native overhead separately.
77
+ - [x] Implement resumable mandatory overflow UX; E41.
78
+ - [ ] Test buried small preferences, rejected alternatives and unresolved user dispositions.
79
+ - [ ] Verify indexed/paginated database work meets daemon responsiveness thresholds.
80
+ - [ ] If measurements require isolation, route all writers through one worker/process owner with bounded messaging and recovery.
81
+ - [x] Freeze initial 10,001-event no-Git benchmark/reference hardware and proposed
82
+ thresholds; Git-heavy/native quality comparisons remain pending.
83
+ - [ ] Compare exact replay/current Loom/new assembler for correctness, added tokens and latency.
84
+ - [x] Verify no local model download or always-loaded inference process is needed.
85
+
86
+ Gate: long-history performance and fidelity are measured; no "seamless" claim
87
+ from only small packets, schema success or provider acceptance.
88
+
89
+ ## P4 — Optional cheap harness helpers
90
+
91
+ - [ ] Validate available models and account-supported helper mode; no expensive substitution.
92
+ - [ ] Implement isolated no-tools/restricted helper execution and schema subset checks.
93
+ - [ ] Validate source evidence and authority; reject invented references and false work claims.
94
+ - [ ] Add cache keys, global/project concurrency, timeout/output/usage caps and cooldowns.
95
+ - [ ] Discard stale/cancelled/deleted-source results; E34–E35, E46–E48.
96
+ - [ ] Evaluate summary quality against exact sources and preserve original evidence.
97
+ - [ ] Add optional title/topic jobs without contaminating foreground history/coverage.
98
+
99
+ Gate: helpers improve measured overhead/quality and deterministic operation remains
100
+ usable when helpers are disabled or unavailable. Embeddings are outside scope.
101
+
102
+ ## P5 — Integrate and cut over
103
+
104
+ - [x] Enable OpenCode only after its protocol/acceptance fixtures pass. `test/opencode-continuity.test.ts`
105
+ (fake `opencode serve` recorded from 1.18.31) plus a live three-turn run with a daemon restart; 2026-09-29.
106
+ - [ ] Integrate queue, pinned chats, routes and worktree/orchestra ownership.
107
+ - [ ] Apply explicit team/private/bridge context rules; E24, E57–E60.
108
+ - [ ] Remove redundant legacy injection/extraction paths after parity; prevent double briefings.
109
+ - [x] Add diagnostics for packet contents, sources, coverage, estimates and receipt outcomes.
110
+ - [ ] Test supported platforms, daemon reload, worker recovery and packaged retrieval access.
111
+ - [ ] Run build/typecheck, affected integration tests, full regression suite and packaging checks.
112
+ Build/typecheck, 1,384 non-DOM, 125 browser and 105 final affected checks passed;
113
+ cross-platform packaged execution remains unverified.
114
+ - [x] Update contributor/user docs with capability, retention and cost limitations.
115
+ - [ ] Record final results, remaining gaps and optional separately authorized live smoke tests.
116
+
117
+ Release gate: P0–P3 and integration safeguards pass. P4 is optional. Parallel model
118
+ coding, Electron redesign and local embeddings require separate future scope.
119
+
120
+ ## Implementation receipt and deliberate gates
121
+
122
+ - [x] Zod pinned to 4.6.5; contracts use shape checks plus semantic validation.
123
+ - [x] Existing SQLite connection retained; activation backup and explicit offline
124
+ JSONL migration preserve originals and refuse conflicts/torn imports.
125
+ - [x] Scoped reviewed checkpoint artifacts finalize atomically and verify hashes.
126
+ - [x] Native initialization is separated from acceptance; errors do not release
127
+ foreground preparation barriers before process/send settlement.
128
+ - [x] Scoped request/packet/source HTTP routes and overflow/checkpoint UI exist.
129
+ - [x] 10,001-event daemon benchmark recorded without paid calls; all buried
130
+ user points included. See `brain-benchmark-2026-09-28.json`.
131
+ - [ ] Release certification for every E01–E64 case and platform. Grouped regressions
132
+ cover core cases; they do not certify every matrix row.
133
+ - [ ] Native compaction hooks/actual retention, tokenizer and actual quota accounting.
134
+ - [ ] Complete tool-result normalization across both harnesses (Claude outcomes
135
+ remain pending when no final result is exposed); bounded large-output behavior.
136
+ - [ ] Automatic artifact GC/deletion/retention and complete downgrade/export tooling.
137
+ - [ ] Genuine OS disk-full/network-filesystem and process-orphan fault injection.
138
+ - [ ] Isolated cheap helpers/account model discovery. (OpenCode protocol parity: done 2026-09-29.)
139
+ - [ ] Native continuation quality and Git/worktree-heavy performance corpora.
140
+
141
+ Unsupported profiles/features return explicit errors rather than silently using
142
+ legacy native sessions, parallel execution or unverified helper calls. The default
143
+ remains off until the remaining release gates are reviewed.
144
+
145
+ ## Cleanup audit follow-up
146
+
147
+ See [BRAIN-AUDIT](BRAIN-AUDIT.md) for both review axes and all 64 case statuses.
148
+
149
+ - [x] Fix Stop/submission race and bounded pre-intent reassembly.
150
+ - [x] Preserve exact queued text and captured targets/models.
151
+ - [x] Fix checkpoint revision holes, authority and receipt link validation.
152
+ - [x] Make reconciliation atomic, addressable beyond latest 100 and single-use.
153
+ - [x] Start inherited-group cleanup at parent exit; fence unknown termination.
154
+ - [x] Prevent app-owned turn commits from overlapping the next native writer.
155
+ - [x] Roll back config/mode ownership on failed atomic config saves; fence unresolved leases across legacy restart.
156
+ - [x] Gate unsupported route/orchestra work before side effects and guard mode changes.
157
+ - [x] Remove unused runtime forwarding and native legacy decision/extractor paths.
158
+ - [x] Harden artifacts and add transactional FTS maintenance/rebuild.
159
+ - [ ] Certify escaped children, Windows, real native quality and the remaining partial/gated rows.
160
+
161
+ Cleanup validation: build/typecheck, 1,408 daemon tests, 125 browser tests, 87 focused
162
+ checks, documentation links/64 audit rows, whitespace and packaging dry run passed.
163
+ The 17 skips and all partial/gated matrix rows remain visible release limitations.
164
+
165
+ ## Validation follow-up — 2026-09-28
166
+
167
+ An independent review reproduced four defects against the committed implementation;
168
+ all are fixed with regressions in `test/continuity.test.ts`.
169
+
170
+ - [x] Return deltas examined only the latest 50 events; older work by another agent
171
+ got no coverage and was never revisited (E42). Deltas now cover every observation
172
+ since their basis packet.
173
+ - [x] Queued, overflowed or pre-launch-failed requests were rendered as history in
174
+ earlier turns and made unsent packets stale (E08, E23). Only requests with a
175
+ submitting/accepted/unknown receipt are conversation history.
176
+ - [x] The harness check ran after capture, and a retried request ID silently no-oped.
177
+ Reachability is checked before capture; an unsent request re-runs on retry.
178
+ - [x] Superseding a checkpoint left its originals hidden. Only current checkpoints
179
+ replace originals.
180
+ - [x] Exact CLI version pinning removed. Any reachable version runs; a 20 s
181
+ `HarnessMonitor` probe reports reachability transitions and gates dispatch.
182
+ - [x] Usage-aware switching: resumed sessions receive only what they lack; new or
183
+ compacted sessions get a bounded packet (recent exact tail, older headlines, full
184
+ text on file). Model changes within a harness keep its native session.
185
+ - [x] Claude `compact_boundary` marks the binding compacted; the next packet rebuilds
186
+ state into the same resumed session (E13 for Claude).
187
+ - [x] User-authority writes (reviewed items, checkpoints) are refused while a turn runs.
188
+
189
+ Transport (app-server / Agent SDK):
190
+
191
+ - [x] Codex on `codex app-server` JSON-RPC and Claude Code on the Claude Agent SDK,
192
+ following t3code. The `exec --json` / `-p` transports and the MCP approval shim
193
+ are removed; "ask" is real approvals on both, answered in-process.
194
+ - [x] Lost native session (`NativeSessionMissing`): receipt failed, binding moves to
195
+ a new epoch, next packet reconstructs.
196
+ - [x] Context in use, model window, compaction progress and provider usage limits
197
+ reported by both adapters and shown in the composer.
198
+ - [x] Live smoke turn per harness (codex-cli 0.153.4, claude 2.1.278).
199
+ - [ ] Cap packet size by the remaining context window. Not done: the per-agent
200
+ reading can't tell which chat's session it measured, and the 6,000-token default
201
+ is ~3% of current windows. Revisit for small-window models.
202
+
203
+ Later:
204
+
205
+ - [x] Linux argv limit: resolved by the transport change. Both harnesses now receive
206
+ the prompt over stdin (Agent SDK user message, app-server `turn/start`), so the
207
+ 128 KiB `MAX_ARG_STRLEN` cap no longer applies. Linux is still untested live.
208
+ - [x] Codex compaction signal: `codex app-server` reports `contextCompaction` items;
209
+ the binding is marked compacted like Claude's.
210
+ - [ ] Optional cheap-model summaries of referenced history (P4); headlines are the
211
+ deterministic default.
212
+ - [ ] Local admin-token exposure: any same-user process can fetch it from
213
+ `/api/bootstrap`. The idle guard narrows the Brain window; a per-client or
214
+ UI-confirmed authority token is the durable fix.