@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,623 @@
1
+ # Brain rewrite: one conversation across multiple native harnesses
2
+
3
+ Status: design reference; Brain continuity implementation has not started.
4
+ Updated: 2026-09-28. Branch: `dev/Harsha`.
5
+
6
+ For the next approved scope, use the
7
+ [implementation plan](brain-continuity-implementation.md),
8
+ [research/edge-case notes](../refactoring/BRAIN-NOTES.md), and
9
+ [implementation TODO](../refactoring/BRAIN-TODO.md). The implementation plan takes
10
+ precedence over earlier optional model/parallel research below. User review is
11
+ pending; current work changes documentation only.
12
+
13
+ Default for the first milestone: **no embedding model, no vector store and no
14
+ local inference download**. Zod contracts, structured user/discussion state,
15
+ SQLite FTS/entity search and source-backed context packets come first. Cheap
16
+ harness helpers are optional after deterministic continuity passes.
17
+
18
+ ## 1. Product contract and limits
19
+
20
+ A chat belongs to the user and the application, not to the selected model.
21
+ Switching the model/harness changes who handles the next turn; the conversation,
22
+ user requirements, discussions and work history stay with the chat.
23
+
24
+ Continue using Claude Code, Codex, OpenCode and their supported native interfaces.
25
+ They own agent execution, authentication and tools. Brain owns captured evidence,
26
+ conversation state, context assembly and synchronization. We are not building a
27
+ replacement coding-agent loop or making direct hosted-model calls for coding.
28
+
29
+ Three different claims must stay separate:
30
+
31
+ - **Stored:** the application retains captured user messages, assistant output,
32
+ tool events and referenced artifacts, subject to explicit deletion/retention.
33
+ - **Supplied:** particular text or summaries were submitted to a particular
34
+ native session. Track the form and sources, not just a last-event number.
35
+ - **Understood/retained:** what the model actually understood or what its harness
36
+ kept after compaction. We cannot prove this from successful delivery.
37
+
38
+ An incoming model does not inherently know what the user told another model.
39
+ It knows what its own session retains and what we explicitly supply next.
40
+ Retrieval cannot fix a missing detail if neither the assembler nor the agent
41
+ knows to search for it. Therefore user discussions and decisions are first-class
42
+ context inputs, not just optional similarity-search hits.
43
+
44
+ No design can guarantee all details of an arbitrarily long conversation inside
45
+ a small fixed token budget. Compaction is lossy. The contract is recoverable
46
+ captured evidence, strong protection of user intent, explicit overflow behavior,
47
+ and measured continuation quality—not a promise of zero forgetting.
48
+
49
+ ## 2. One chat, multiple native sessions
50
+
51
+ ```mermaid
52
+ flowchart TD
53
+ Chat[One application chat and ordered event history] --> Brain[Brain: user intent, discussion state, task state, evidence]
54
+ Brain --> Assembler[Context assembler]
55
+ Assembler --> Claude[Claude Code native session]
56
+ Assembler --> Codex[Codex native session]
57
+ Assembler --> OpenCode[OpenCode native session]
58
+ Claude --> Chat
59
+ Codex --> Chat
60
+ OpenCode --> Chat
61
+ ```
62
+
63
+ Persist a binding per chat/harness/native-session epoch, with model history,
64
+ workspace identity, delivered context coverage and observed session lifecycle.
65
+ Do not equate a model name with a native session. A supported same-harness model
66
+ change may reuse the session; an incompatible change creates a new one. Discover
67
+ and test that behavior per adapter/version. Never give one provider another
68
+ provider's native resume cursor.
69
+
70
+ Example of sequential switching within one chat:
71
+
72
+ | Moment | Chat history | What the selected session receives |
73
+ | --- | --- | --- |
74
+ | Claude handles initial work | E1–E30 | Initial request and its normal native conversation |
75
+ | Switch to Codex | E1–E30 plus new request | Exact history if it fits; otherwise user-intent/discussion/task checkpoint plus recent evidence |
76
+ | Codex finishes more work | E31–E45 | Its native session records its own turn; Brain records observed results |
77
+ | Switch to OpenCode | E1–E45 plus new request | A fresh reconstruction of this same chat, not merely Codex's last answer |
78
+ | Return to Claude | Claude last participated at E30 | Changes after E30, current active instructions, discussion updates and workspace changes |
79
+
80
+ The E30 boundary describes synchronization history, not certainty that Claude
81
+ still retains every original token. If the native session is missing, incompatible
82
+ or known to have compacted away needed context, use a fuller reconstruction.
83
+ Critical active constraints are included on cross-harness returns even if an
84
+ older version was previously submitted. Corrections identify what they supersede.
85
+
86
+ Do not eagerly send every new message to all idle sessions. Persist once and
87
+ synchronize the target just before its next turn. Switching the picker while idle
88
+ selects the next target; it should not itself spend an agent turn.
89
+
90
+ ## 3. Switching versus genuinely simultaneous work
91
+
92
+ ### Default: one active foreground turn in a chat
93
+
94
+ Support any number of sequential model switches, but one active foreground run
95
+ and one owner of repository mutations in that workspace. This matches a single
96
+ conversation without racing assistants.
97
+
98
+ - Each submitted request captures its target model/harness, request ID and input
99
+ event boundary. Later picker changes do not retarget an already submitted job.
100
+ - Switching during a run offers finish-then-switch or interrupt-then-switch.
101
+ Default to finish-then-switch; the UI shows the pending target.
102
+ - Do not start the replacement writer until the prior run is quiescent. A UI
103
+ cancellation is not evidence that a subprocess stopped writing.
104
+ - User messages arriving during a run are persisted immediately. Deliver steering
105
+ only when supported; otherwise queue it with a visible target and ordering.
106
+ - Rapid picker changes can coalesce unsubmitted selections, never committed
107
+ requests. Queued requests retain their destination unless explicitly changed.
108
+ - Late provider events are tagged with native session, epoch and run ID. Retain
109
+ them in the right run, without overwriting the current session or task state.
110
+ - Show a successful switch only after target startup succeeds. A failed startup
111
+ keeps history and pending instructions intact and reports the actual binding.
112
+
113
+ ### Optional later mode: ask multiple models in parallel
114
+
115
+ Treat parallel work as sibling runs within the same chat, not a shared native
116
+ session. Each run starts from an explicit immutable conversation/workspace
117
+ snapshot. Answers are labeled by model and snapshot. One model does not magically
118
+ observe another model's streaming answer or subsequent user correction.
119
+
120
+ First parallel feature should be compare/review against a fixed snapshot, with
121
+ verified read-only access or isolated copies. Read-only tools against a directory
122
+ being modified by another run do not provide a consistent snapshot.
123
+
124
+ For parallel coding, use separate worktrees and an explicit integration step;
125
+ never two unrestricted writers in the same working tree. A source worktree's
126
+ test result or edit is not automatically true in the destination workspace.
127
+
128
+ A new instruction during parallel work has explicit routing: one run, all runs,
129
+ or the next foreground turn. Record delivery per run. If steering is unsupported,
130
+ stop/restart or queue the update; do not label a stale run as synchronized.
131
+
132
+ Reconcile outputs into the chat as attributed proposals and evidence. Arrival
133
+ order does not turn a conflicting proposal into an accepted decision. User
134
+ acceptance or an explicit task policy determines what becomes shared task state.
135
+ The next foreground run receives reconciled results and unresolved disagreements.
136
+
137
+ ## 4. Preserving what the user said, including small points
138
+
139
+ Do not reduce a conversation to a list of major engineering decisions. Preserve
140
+ preferences, exploratory discussion, rejected options, unanswered questions,
141
+ examples and deferred ideas as well as explicit instructions.
142
+
143
+ ### Exact evidence and protected user intent
144
+
145
+ Every user message remains an exact, source-addressable event. Keep its attached
146
+ artifacts and links to neighboring exchanges. Store explicit active instructions,
147
+ corrections and accepted decisions with their exact source wording and enough
148
+ surrounding context to avoid changing their meaning.
149
+
150
+ Examples from this conversation:
151
+
152
+ | User statement | Representation and treatment |
153
+ | --- | --- |
154
+ | Use existing harnesses; do not build our own agent loop | Active architectural constraint, supplied on switches |
155
+ | Next.js is likely, but the framework is not chosen | Tentative preference; never silently upgraded to a final choice |
156
+ | Haiku/Luna through the harness is an option for summaries | Permitted helper approach, subject to availability; not a mandatory model ID |
157
+ | A small preference such as “keep filenames lowercase” | Exact active preference until superseded, even if unrelated to retrieval keywords |
158
+ | “What about another storage option?” | Discussion/open question, not an accepted storage decision |
159
+
160
+ Instruction extraction is fallible. Do not let a helper classifier be the only
161
+ route by which user text reaches the next model. Include unsummarized new user
162
+ messages verbatim where they fit. Require a source-coverage pass before replacing
163
+ older user exchanges with discussion summaries. A message's appearance in that
164
+ coverage manifest proves processing, not that every nuance survived.
165
+
166
+ Do not require users to pin every important statement. Offer pin/edit/review as
167
+ an additional control. Pins, explicit constraints and the current request have
168
+ mandatory retention; conflicting or ambiguous instructions are carried as such
169
+ rather than silently resolved by a summarizer.
170
+
171
+ ### Conversation/discussion ledger
172
+
173
+ Maintain a versioned topic ledger for the whole chat, separate from task progress.
174
+ Each entry has the point discussed, status (exploring, tentative, accepted,
175
+ rejected, deferred, unanswered or superseded), participants, source events and
176
+ related decisions. Preserve the why, not only the final noun or chosen option.
177
+
178
+ Every user message must have a recorded disposition: included verbatim, represented
179
+ in a source-linked topic/checkpoint, superseded with a reference, or available
180
+ only in the archive. Nothing disappears solely because a similarity score is low.
181
+ A compact topic map lets a new session know that older discussion exists, even
182
+ when its full detail is not inline. If even this map needs hierarchical grouping,
183
+ record that compression and its source coverage; do not imply exact recall.
184
+
185
+ ### Four sources of context, in order
186
+
187
+ 1. Current request, pinned content, active constraints/corrections and accepted
188
+ decisions relevant to the chat; unresolved conflicts remain visible.
189
+ 2. Current task state and conversation/discussion ledger, including preferences,
190
+ unanswered questions and deferred points—not only “work completed.”
191
+ 3. Recent complete exchanges and changes since this session last participated,
192
+ prioritizing exact user wording over verbose assistant narration or logs.
193
+ 4. Retrieved older evidence relevant to the request, files, symbols and topics.
194
+
195
+ A new session needs the discussion checkpoint even if its immediate coding task
196
+ has few matching keywords. A returning session needs changed topic entries and
197
+ newly relevant older evidence as well as the delta. Cross-chat knowledge requires
198
+ explicit project scope; a shared project database is not permission to mix chats.
199
+
200
+ This protects small points better than top-k retrieval alone, but it cannot
201
+ eliminate summary omissions or model forgetfulness. Evaluate small-point recall
202
+ and keep original evidence accessible with source IDs, not just opaque hashes.
203
+
204
+ ## 5. Context budgets and compaction from the first milestone
205
+
206
+ ### Prefer full fidelity when affordable
207
+
208
+ If the captured conversation fits the configured handoff budget, pass the exact
209
+ relevant conversation rather than summarizing it unnecessarily. As it grows,
210
+ compress older assistant narration and oversized tool output before compressing
211
+ user discussion. Preserve important tool outcomes, commands, exit codes and
212
+ current workspace facts; keep raw output retrievable.
213
+
214
+ For long chats, use protected user intent + task/discussion checkpoint + recent
215
+ exchanges + retrieved evidence. Do not replay the entire growing archive on each
216
+ switch. Do not retain only the most recent entries: that can discard the original
217
+ request while preserving a large recent log.
218
+
219
+ Earlier 1–3k return / 3–6k fresh-session estimates are now **soft starting targets**,
220
+ not correctness guarantees or fixed caps. The priority is adequate representation
221
+ of user intent. Set a separate configurable hard ceiling for added context and
222
+ reserve capacity for harness overhead, the user's request and response when known.
223
+ Use target tokenizers where available and label estimates when overhead is hidden.
224
+
225
+ Overflow handling:
226
+
227
+ 1. Remove duplicate evidence and lower-priority tool verbosity.
228
+ 2. Reuse or generate validated source-backed checkpoints for older segments.
229
+ 3. Expand within the configured ceiling if mandatory content needs more room.
230
+ 4. If mandatory material still does not fit, report the conflict and offer a
231
+ larger budget, narrower scope or new focused conversation. Never silently
232
+ discard requirements or return an empty handoff because one entry is huge.
233
+
234
+ ### Two kinds of compaction
235
+
236
+ Brain compaction changes what we supply, while preserving captured originals.
237
+ Harness compaction changes what the native agent retains, often outside our
238
+ visibility. Detect supported signals and keep session retention uncertainty
239
+ separate from submitted coverage. Refresh protected state on return and after
240
+ observable compaction; do not claim a model remembers content just because it
241
+ was submitted earlier.
242
+
243
+ Generate segment summaries and task/discussion checkpoints from source events.
244
+ Keep source coverage, prompt/model revision and validation results. Avoid endless
245
+ summary-of-summary degradation: periodically rebuild from source segments and
246
+ original active instructions. Validate schemas, source IDs, statuses, numbers,
247
+ paths and tool outcomes. Source citations alone do not prove semantic fidelity.
248
+
249
+ A low-cost harness helper may produce summaries in the background. Reuse them
250
+ on switch, avoid an extra acknowledgement turn, and keep a deterministic fallback.
251
+ If a helper is unavailable and missing user content cannot fit without a new
252
+ summary, use the overflow path rather than silently dropping it to stay fast.
253
+
254
+ ### What this does and does not save
255
+
256
+ Example only: replaying 100k tokens ten times adds 1,000,000 tokens. One 5k
257
+ reconstruction plus nine 1.5k deltas adds 18,500, if those packages adequately
258
+ represent that particular task. That arithmetic says nothing about actual total
259
+ billing or subscription allowance savings.
260
+
261
+ The harness may resend its own accumulated history. Its internal instructions,
262
+ tool schemas, native compaction and provider caching affect actual input.
263
+ Caches do not transfer across providers. Local embeddings save remote retrieval
264
+ work; their vectors cannot replace readable text in an agent prompt. Harness
265
+ helper calls also consume allowance, and their summaries consume input tokens
266
+ when delivered. Measure helper usage, added-context estimates and total/cached
267
+ usage separately where reported; otherwise label unknowns.
268
+
269
+ Do not synchronize idle sessions eagerly. Trigger helper work at bounded tail
270
+ thresholds or milestones, deduplicate by source hash and cap concurrency/usage.
271
+ Offer a concise context view: preserved instructions, topic/task checkpoint,
272
+ exact excerpts, omitted detail, sources and estimated overhead. No routine
273
+ confirmation is required unless a real budget/scope conflict remains.
274
+
275
+ ## 6. Evidence delivery and retrieval
276
+
277
+ The synchronization operation persists an immutable package tied to the target
278
+ session epoch, conversation boundary and workspace revision before submission.
279
+ States: prepared -> submitting -> accepted, failed or outcome-unknown. Acceptance
280
+ means the strongest supported transport/session signal, not understanding.
281
+
282
+ After a crash, reconcile using native request IDs/events where possible. Without
283
+ harness idempotency, exactly-once delivery is not guaranteed. Do not blindly
284
+ resubmit an action prompt with unknown outcome; first inspect the session and
285
+ workspace. Never replay recorded tool execution as part of context reconstruction.
286
+
287
+ Keep coverage as exact/summarized/referenced/omitted for each source range, plus
288
+ retention uncertainty after native compaction. A high-water mark alone is not
289
+ proof that the target received all detail. New evidence arriving after the package
290
+ snapshot enters a subsequent delta; it must not race into an already frozen input.
291
+
292
+ Retrieval augments the protected state and topic ledger:
293
+
294
+ 1. Filter by chat/project/workspace and source authority before ranking.
295
+ 2. Combine exact path/symbol matching, SQLite FTS5 and optional semantic results.
296
+ 3. Fuse rankings, deduplicate overlap, prefer valid/current evidence and respect
297
+ the remaining token budget. Semantic recall must not be restricted to lexical
298
+ candidates alone, or synonym matches disappear.
299
+ 4. Resolve references through paginated source reads/search, via supported MCP
300
+ or a local file/CLI export. A reference is not equivalent to supplying its text.
301
+ 5. Bound cumulative retrieval output per turn, with explicit expansion when
302
+ needed. Critical instructions never depend on optional tool reads.
303
+
304
+ Chunk by complete conversational/tool units, splitting oversized content at
305
+ meaningful boundaries. Preserve final outcomes rather than longer partial output;
306
+ include relevant stdout and stderr. Images retain artifacts and capability-aware
307
+ representations; an image reference does not give a text-only model visual access.
308
+
309
+ Start exact vector search over eligible per-project chunks in a worker. Benchmark
310
+ 1k/10k/100k chunks before adding ANN complexity. Cache embeddings by source hash,
311
+ model revision and preprocessing. Respect tokenizer limits; lexical retrieval
312
+ continues if models are cold, unavailable or disabled.
313
+
314
+ ## 7. Storage: SQLite plus files; JSONL for interchange
315
+
316
+ Use the existing per-project `.loom/log.db` as the canonical database, extending
317
+ it with versioned migrations. Preserve existing event IDs and public EventLog
318
+ contracts. Avoid introducing a second authoritative event store.
319
+
320
+ | Data | Storage | Reason |
321
+ | --- | --- | --- |
322
+ | Captured messages, tool lifecycle and task events | SQLite events, with JSON payloads | Ordered history, transactions, filtering and durable references |
323
+ | Instructions, task state, memories, summaries | SQLite tables referencing source events | Provenance, revisions, scope and atomic updates |
324
+ | Native session bindings and handoff delivery state | SQLite tables | Survive crashes, retries and app restarts |
325
+ | Searchable chunks | SQLite tables + FTS5 index | Exact strings and lexical retrieval without a model |
326
+ | Embeddings (future option, outside first milestone) | SQLite BLOBs with model/version metadata | Rebuildable index if a later evaluation justifies it |
327
+ | Large tool output, diffs, images and attachments | Content-addressed files under `.loom/artifacts/` | Keep oversized binary/text payloads out of hot database rows |
328
+ | Export/import and diagnostics | Versioned JSONL + artifact manifest | Portable and inspectable, not a live mirror that can diverge |
329
+ | Optional handoff Markdown | Derived export | Compatibility with harness file reads; not the source of truth |
330
+
331
+ FTS5 is SQLite's full-text-search module; verify it exists in the packaged SQLite
332
+ runtime rather than assume every build enables it. [SQLite FTS5 documentation](https://www.sqlite.org/fts5.html).
333
+
334
+ Use one writer service per project; database work stays outside Electron's
335
+ renderer/main event loop. Start with WAL on a supported local filesystem,
336
+ foreign keys, busy timeout and explicit transactions. Handle another app/daemon
337
+ trying to own the same project. WAL needs checkpoint/backup handling and is not
338
+ appropriate for shared access across machines on network filesystems. Use the
339
+ SQLite backup mechanism or a coordinated checkpointed backup, not a live copy
340
+ of only `log.db`. [SQLite WAL documentation](https://www.sqlite.org/wal.html).
341
+
342
+ Write artifacts to a temporary file, hash and atomically rename before committing
343
+ the referencing database transaction. A crash can leave an unreferenced file;
344
+ clean those after a grace period. A committed reference must never point to an
345
+ unfinished write. Export includes referenced artifacts and checksums.
346
+
347
+ Proposed logical tables (final DDL follows migration design):
348
+
349
+ - `events`: preserve current schema; add versioned payload conventions and
350
+ idempotent harness event identity where available. Coalesce streaming deltas
351
+ into message versions; do not embed every token fragment.
352
+ - `artifacts`: hash, relative path, media type, byte length and capture metadata.
353
+ - `instructions`: exact source span, conversation/project scope, active or
354
+ superseded status, source event and revision. Inferred constraints remain
355
+ proposals; they cannot silently become user instructions.
356
+ - `task_states`: objective, completed/open work and source-backed claims,
357
+ versioned by conversation. A reported test success includes command, outcome
358
+ and workspace revision; later edits invalidate its applicability.
359
+ - `memories`: durable facts, source IDs, confidence, scope, supersession,
360
+ freshness and affected files. Keep contradictory claims visible until resolved.
361
+ - `chunks` / `chunks_fts`: source range, scope, file/symbol entities, text hash.
362
+ - `embeddings`: chunk ID, text hash, model revision, dimension, pooling and
363
+ normalization configuration, vector bytes. Never compare incompatible vectors.
364
+ - `summaries`: coverage manifest of event IDs/ranges, exclusions, source hash,
365
+ model/prompt revision, structured output and validation result.
366
+ - `sessions`: conversation, harness, native session ID, workspace identity,
367
+ epoch and observed lifecycle. A recreated session gets a new epoch.
368
+ - `handoffs`: target epoch, source coverage, workspace revision, package hash,
369
+ estimated tokens, payload and delivery state.
370
+ - `session_coverage`: what was submitted to each native session, with evidence
371
+ strength. Distinguish full evidence, summarized coverage and references.
372
+
373
+ A cursor alone is insufficient: submitting a summary through event 900 does not
374
+ mean the target has the full contents of every event through 900.
375
+
376
+ Default retention preserves captured history. User deletion/retention must also
377
+ invalidate summaries and remove derived indexes; artifact GC follows references.
378
+ Capture normal harness output, not credentials or provider-internal state.
379
+
380
+ ## 8. Historical model research and optional helper policy
381
+
382
+ The candidates below are retained as earlier research, **not scheduled work or
383
+ required downloads**. The lightweight first milestone excludes embeddings and
384
+ local summarizers. FTS/entity search and structured state provide the initial
385
+ retrieval flow; optional harness helpers provide the first generative extension.
386
+
387
+ Research checked 2026-09-27 against publisher model cards. No model was downloaded
388
+ or benchmarked on this machine. Recommendations are candidates for evaluation,
389
+ not claims of measured performance or the best model on every device.
390
+
391
+ Embedding models retrieve text; a separate generative model can summarize it.
392
+
393
+ | Candidate | Verified characteristics | Proposed role |
394
+ | --- | --- | --- |
395
+ | [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B-GGUF) | 0.6B parameters; 32k input context; up to 1,024 dimensions; publisher GGUF Q8_0/F16 variants and Apache-2.0 model-card label | First quality-oriented retrieval candidate; evaluate 512 and 1,024 dimensions with the required query instructions |
396
+ | [EmbeddingGemma-300M](https://huggingface.co/google/embeddinggemma-300m) | 300M parameters; 2,048-token input; 768 dimensions reducible to 512/256/128; Gemma terms linked on card; reference implementation cautions against float16 activations | Smaller multilingual alternative; benchmark 256/512 dimensions and supported runtime/quantization combinations |
397
+ | [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) | 384-dimensional short-text embeddings; default truncation above 256 word pieces | Low-resource baseline; current repository already integrates a quantized conversion optionally |
398
+ | [Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) | Generative model with documented non-thinking mode | Optional local structured-summary candidate; test a pinned 4-bit conversion, bounded input batches and source validation |
399
+
400
+ Current recommendation after the lightweight requirement: **no local model in
401
+ the first milestone**. Use FTS5/exact retrieval, preserve protected user intent
402
+ outside ranking, and optionally use a low-cost harness model for source-backed
403
+ summaries and thread/session metadata. Local embedding/summarization benchmarks
404
+ require separate future scope and evidence that retrieval quality needs them.
405
+
406
+ Qwen3-4B is substantially heavier than an embedding encoder. Four billion
407
+ weights at four bits is approximately 2 GB of weights alone by arithmetic;
408
+ quantization metadata, runtime buffers and KV cache add to this. This is not
409
+ an artifact download size or an observed peak RAM figure. Avoid advertising
410
+ model parameter count as a device memory requirement.
411
+
412
+ Run local inference in a supervised background process. Evaluate a pinned
413
+ llama.cpp runtime for publisher GGUF embeddings and a compatible summarizer;
414
+ retain ONNX as a candidate for MiniLM. Validate pooling, query prefixes,
415
+ normalization and quantization against reference outputs. No Python runtime
416
+ requirement for shipped desktop builds; prototype tools may differ.
417
+
418
+ Model files live in the user's app-data/model cache, shared across projects.
419
+ Downloads are explicit, resumable and checksum-verified; pin model/runtime
420
+ revisions, surface applicable model terms, and function offline afterward.
421
+ Load models lazily, cap threads/RAM, unload idle summarizers, and avoid concurrent
422
+ embedding/summarization work when it degrades the active coding harness.
423
+
424
+ ### Harness-backed helpers: preferred first generative integration
425
+
426
+ The user proposes Haiku or Luna where available through the underlying harness.
427
+ Treat those as selectable model names, not universal provider/model IDs. Discover
428
+ or validate models through each adapter's supported capabilities, persist the
429
+ resolved model identity, and never silently substitute an expensive model. This
430
+ plan does not claim that every harness exposes either name. The inspected T3 Code
431
+ checkout defaults to `gpt-6-luna` for Codex text generation and
432
+ `claude-haiku-4-5` for Claude text generation, using structured, restricted CLI
433
+ calls. Its helper interface covers titles and Git metadata, not shared context
434
+ summaries. See the [pinned reference notes](t3code-reference.md). Model availability
435
+ and usage accounting still need capability tests for the installed harness version.
436
+
437
+ Define a small `ContextHelper` interface with interchangeable harness-backed,
438
+ local and deterministic implementations. Return structured results plus source
439
+ references, helper model/session identity, latency and reported usage.
440
+
441
+ | Job | Harness helper use | Trigger / default policy |
442
+ | --- | --- | --- |
443
+ | Task checkpoint / compaction | Summarize bounded source segments into the validated task-state schema | Background threshold or milestone; reuse on switch |
444
+ | Thread title | Generate a short title from the initial request | Once; never overwrite a user title |
445
+ | Session description / thread recap | Produce display metadata or a source-backed recap | On meaningful change or explicit request; not on every render |
446
+ | Durable-memory candidates | Propose sourced facts/decisions | At completed turns; no authority to overwrite explicit instructions |
447
+ | Query expansion | Suggest alternative terms for FTS5 | Only when lexical retrieval is weak; bounded timeout |
448
+ | Reranking | Rank an already scoped, capped candidate set by ID | Optional quality mode; not required on every turn |
449
+
450
+ A chat helper is not automatically an embedding endpoint. FTS5/entity search can
451
+ work without vectors. If semantic embeddings are enabled, compute them locally
452
+ unless a harness explicitly offers a supported embedding operation. Chat-written
453
+ keywords or relevance scores are not numerical embeddings and should not be
454
+ stored or compared as vectors.
455
+
456
+ Run helper work in an isolated native session, separate from the user's coding
457
+ sessions. Restrict tool access using verified harness capabilities; do not rely
458
+ on a prompt alone to prevent edits. For a harness without an enforceable no-tool
459
+ mode, use a dedicated temporary workspace with minimal filesystem access and
460
+ an explicit capability review before enabling background helpers. Supply only
461
+ the bounded, scoped excerpts needed for the job. Never modify project-wide model
462
+ settings or interrupt the active coding agent to obtain a summary.
463
+
464
+ Keep helper outputs in a maintenance namespace: they cannot recursively trigger
465
+ more extraction/title generation, appear as user instructions, or advance the
466
+ coding session's synchronization coverage. If a tool-free output schema cannot
467
+ be enforced, parse and validate the response and fall back on malformed output.
468
+
469
+ Suggested configurable controls: one concurrent helper job, input/output token
470
+ caps per job, a per-conversation token budget, cooldown, timeouts and cancellation.
471
+ Deduplicate jobs by source hash + task type + model/prompt revision. Prioritize
472
+ foreground coding and pending handoffs over optional titles or reranking.
473
+ Expose the source scope and helper usage in diagnostics. When the account is
474
+ rate-limited or the budget is exhausted, reuse a valid checkpoint or use the
475
+ extractive fallback rather than launching more requests.
476
+
477
+ Lower-cost does not mean quota-free: the helper uses the harness account's
478
+ allowance, and the resulting summary consumes input tokens when delivered to
479
+ the coding model. Measure both overheads where the harness exposes usage; do not
480
+ infer subscription savings from API prices. Local mode avoids hosted helper
481
+ usage, but the context delivered to the coding harness still consumes input.
482
+ A provider-down switch must not depend on asking that same provider to summarize
483
+ first. Maintain checkpoints ahead of time; if fallback cannot preserve mandatory
484
+ content within budget, surface the overflow rather than silently dropping it.
485
+
486
+ ## 9. Architecture and migration boundaries
487
+
488
+ | Module | Ownership |
489
+ | --- | --- |
490
+ | BrainStore | Captured events, artifact references, migrations and transactional state |
491
+ | ConversationState | Exact user intent, decisions, topic ledger, task progress and source-backed checkpoints |
492
+ | ContextAssembler | Token-aware exact replay, reconstruction and deltas with coverage manifests |
493
+ | SessionSync | Target binding, run/switch serialization, delivery tracking and crash recovery |
494
+ | Retrieval | Scoped lexical/entity/semantic search and rebuildable indexes |
495
+ | ContextHelper | Budgeted harness/local summary and metadata jobs with deterministic fallback |
496
+ | LocalModels | Optional inference process and embedding lifecycle |
497
+
498
+ Keep the current EventLog API and native adapters. Move existing responsibilities
499
+ out of `core/projection.ts`, `core/distill.ts`, `core/memory.ts` and
500
+ `daemon/runtime/briefings.ts` behind these modules, then remove redundant paths.
501
+ Native instruction-file import remains a sourced input, not a private transcript
502
+ import. Team memory and bridge exports use the same explicit scoping rules.
503
+
504
+ Add `runs` and parent snapshot/branch relationships for eventual parallel work,
505
+ `topics` and source dispositions for discussion coverage, and versioned workspace
506
+ observations to the proposed tables above. Helper maintenance events cannot pollute
507
+ user conversation state or recursively trigger extraction.
508
+
509
+ Migrate existing SQLite events/Brain memory events without renumbering sources.
510
+ Import old JSONL with an idempotent manifest and count/hash reconciliation. If
511
+ both stores contain distinct data, require an explicit merge policy; never assume
512
+ one is empty. Back up before cutover and version new schemas/exports. Rollback
513
+ must include events captured after cutover, not simply restore yesterday's backup.
514
+ Use a feature flag and shadow-build packages before changing the sole context
515
+ producer. Do not submit duplicate prompts during shadow evaluation.
516
+
517
+ Retire fixed character truncation, volatile pendingBriefings and vectors.json
518
+ rewrites only after compatibility coverage passes. Test the existing semantic
519
+ loader's explicit offline path before reusing it: its current `allowRemoteModels`
520
+ assignment appears inconsistent with offline=true.
521
+
522
+ ## 10. Implementation order and TODO
523
+
524
+ The prerequisite module refactor is complete and committed. Brain continuity
525
+ itself remains unimplemented. Use the reviewed scope and phase gates in
526
+ [the implementation plan](brain-continuity-implementation.md); maintain progress
527
+ in [BRAIN-TODO.md](../refactoring/BRAIN-TODO.md), not duplicate checklists here.
528
+
529
+ Order: P0 contracts/capabilities; P1 evidence/storage; P2 deterministic sequential
530
+ continuity; P3 long-chat fidelity/performance; P4 optional harness helpers;
531
+ P5 integration and removal of superseded context paths. No local model or
532
+ parallel coding feature is required by this sequence.
533
+
534
+ Do not claim seamless long-chat support before user-intent coverage, compaction,
535
+ resumable overflow and unknown-delivery recovery are verified.
536
+
537
+ ## 11. Acceptance criteria
538
+
539
+ Deterministic CI uses fake harnesses and replay fixtures. Live harness evaluation
540
+ is separate, explicitly enabled, and can consume the user's account allowance.
541
+ Evaluate actual task continuation as well as question answering about history.
542
+
543
+ | Scenario | Required behavior |
544
+ | --- | --- |
545
+ | Small chat, new model | Exact supplied conversation fits; no unnecessary summarization |
546
+ | Small preference far back in history | Preserved in active intent/discussion state, even without keyword overlap |
547
+ | Tentative discussion | Remains tentative; not promoted to an accepted decision |
548
+ | User changes their mind | New instruction explicitly supersedes old one; source history remains available |
549
+ | Return after two other models worked | Receives intervening work and discussion updates from both |
550
+ | Newest event is larger than the budget | Nonempty valid package or explicit overflow, never silent context loss |
551
+ | Too many active instructions | Budget/scope conflict surfaced; no silent requirement truncation |
552
+ | Helper omits a user point | Coverage/fidelity evaluation catches known fixture omissions; originals recoverable |
553
+ | Native session compacted or lost | Bounded reconstruction; submitted coverage is not mistaken for retained memory |
554
+ | Tool failed without assistant narration | Exit code and relevant output remain in task evidence |
555
+ | Attachment-only request | Artifact preserved and handled according to target modality support |
556
+ | Switch during tool execution | No replacement writer until the old one is safely quiescent |
557
+ | Late event / duplicate event | Routed to the correct run/epoch and deduplicated without overwriting current state |
558
+ | Two models run concurrently | Explicit common snapshot, isolated mutations and attributed conflicting outputs |
559
+ | New user correction during parallel runs | Delivery recorded separately; stale output not accepted as current state |
560
+ | Provider/account unavailable | Checkpoint/fallback works without requiring that provider to summarize first |
561
+ | Crash after submitting an action | Reconcile unknown outcome; no blind duplicate execution |
562
+ | Multiple chats in one project | No accidental cross-chat context leakage |
563
+
564
+ Measure instruction/decision retention, small-point recall, unsupported additions,
565
+ source fidelity, task completion, unnecessary re-investigation, latency and total
566
+ reported token usage. Set factual quality gates using a labeled conversation set;
567
+ a checklist or source citation alone does not prove arbitrary semantic fidelity.
568
+
569
+ Performance targets, not measurements: warm deterministic package assembly under
570
+ 250 ms p95 at 10k chunks on an agreed reference machine; optional semantic retrieval
571
+ under 500 ms p95. Exclude harness/network startup from those measurements and
572
+ report total user-visible switch latency separately. Measure peak RSS, CPU/battery,
573
+ model cold start/download size and storage growth at 1k/10k/100k chunks. Compare
574
+ 8 GB CPU-only and 16 GB Apple Silicon evaluation profiles before promising support.
575
+
576
+ ## Implementation foundation
577
+
578
+ The prerequisite module separation is tracked in
579
+ [Brain-ready boundaries](../refactoring/BOUNDARIES.md). Event persistence,
580
+ conversation metadata, native adapter state/lifecycle, context preparation and
581
+ client delivery now have distinct owners. The existing storage formats and
582
+ context-selection policy remain in place; this foundation is not completion of
583
+ the continuity phases above.
584
+
585
+ ## 12. T3 Code reference and what we adopt
586
+
587
+ The local checkout at `/Volumes/Programming Vault/t3code`, inspected at commit
588
+ `de251fc2971a884cb5b1305ba4daf309dc8cccb0`, remains a read-only reference.
589
+ Its current command reactor rejects cross-driver continuation and incompatible
590
+ resume identities. The earlier PR's handoff implementation is therefore not
591
+ evidence that this checkout supports our proposed switching behavior.
592
+ [Reference notes](t3code-reference.md) record verified helper, persistence,
593
+ streaming and desktop patterns with pinned source links.
594
+
595
+ Carry these constraints into implementation: identify native sessions by provider
596
+ instance and resume compatibility, not model name alone; isolate helper work from
597
+ foreground sessions; coalesce UI projections without dropping canonical history;
598
+ keep database and harness work outside the Electron renderer. These observations
599
+ do not establish measured performance or replace Loom's capability tests.
600
+
601
+ Inspected on 2026-09-27: [PR #3799](https://github.com/pingdotgg/t3code/pull/3799),
602
+ head `853c8d5e306ad1cd7489197ca025599ae0eb2448`, was closed without merging. The
603
+ maintainer referred it to [orchestration V2 #2829](https://github.com/pingdotgg/t3code/pull/2829).
604
+ These are reference observations, not claims that the feature shipped.
605
+
606
+ Adopt the separation of app conversation from native provider resume state,
607
+ fresh-session fallback, actual tool outcomes, and success notices after startup.
608
+ Its [handoff renderer](https://github.com/pingdotgg/t3code/blob/853c8d5e306ad1cd7489197ca025599ae0eb2448/apps/server/src/orchestration/providerHandoffTranscript.ts)
609
+ uses an 80k-character recent-history cap and 600-character tool-output excerpts.
610
+ A newest entry over budget can leave the selection empty. Use these as regression
611
+ fixtures; replace blind recent-history selection with the fidelity-first policy
612
+ above. Source inspected, PR not executed locally.
613
+
614
+ ## 13. Remaining product decisions
615
+
616
+ Default to sequential switching; parallel work is an explicitly selected later
617
+ mode. Confirm allowed helper models and budgets, reference hardware, maximum
618
+ handoff overhead, retention controls and whether a larger package is preferable
619
+ to narrowing scope when intent exceeds budget. Preserve the user's option to
620
+ inspect/pin/correct context without making manual curation necessary for every turn.
621
+
622
+ Framework selection and the Electron UI redesign remain separate work. This
623
+ proposal changes context ownership and continuity, not the native agent harnesses.