arco-workbench 0.1.9 → 0.2.0

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 (761) hide show
  1. package/CONTRIBUTING.md +14 -12
  2. package/README.md +5 -3
  3. package/client/dist/THIRD_PARTY_LICENSES.txt +3912 -0
  4. package/client/dist/assets/{PhosphorBackdrop-DRu16-Is.js → PhosphorBackdrop-9jNRO1ZM.js} +1 -1
  5. package/client/dist/assets/{ThemedBackgroundShaderImpl-BLdwwQ4D.js → ThemedBackgroundShaderImpl-tUi3k54Y.js} +1 -1
  6. package/client/dist/assets/XtermView-B7BOSnVo.js +10 -0
  7. package/client/dist/assets/{galleryEditor-CI8ClzBa.js → galleryEditor-Ohc2h9cD.js} +1 -1
  8. package/client/dist/assets/index-CVJVD2Vn.css +1 -0
  9. package/client/dist/assets/index-ILGXWriO.js +638 -0
  10. package/client/dist/index.html +3 -3
  11. package/client/src/App.tsx +42 -9
  12. package/client/src/components/AskUserQuestionNotice.tsx +37 -10
  13. package/client/src/components/AttachmentPill.tsx +3 -2
  14. package/client/src/components/AuthReloginNotice.tsx +25 -6
  15. package/client/src/components/AutomaticMessage.tsx +3 -1
  16. package/client/src/components/CatchMeUp.tsx +4 -1
  17. package/client/src/components/ChatMessage.tsx +43 -5
  18. package/client/src/components/ChatModeView.tsx +20 -4
  19. package/client/src/components/ChatPanel.tsx +5 -0
  20. package/client/src/components/ClusterActivityTab.tsx +9 -3
  21. package/client/src/components/ClusterComposerButtons.tsx +5 -3
  22. package/client/src/components/ClusterPlanTab.tsx +55 -8
  23. package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +38 -99
  24. package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +36 -12
  25. package/client/src/components/ClusterRightPanel/MailboxModal.tsx +61 -8
  26. package/client/src/components/ClusterRightPanel/MemberRow.tsx +46 -14
  27. package/client/src/components/ClusterRightPanel/PhoneMemberList.tsx +56 -0
  28. package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +38 -9
  29. package/client/src/components/ClusterRightPanel/SkillsControl.tsx +6 -5
  30. package/client/src/components/ClusterRightPanel/index.tsx +188 -39
  31. package/client/src/components/ClusterRightPanel/memberSettings.ts +2 -2
  32. package/client/src/components/ClusterRightPanel/panels.ts +1 -0
  33. package/client/src/components/ClusterRightPanel/types.ts +5 -1
  34. package/client/src/components/ClusterRightPanel/useFreshMemberPicker.ts +82 -0
  35. package/client/src/components/ClusterTab.tsx +76 -23
  36. package/client/src/components/ClusterTaskBoardTab.tsx +35 -6
  37. package/client/src/components/Connections/Connections.tsx +5 -8
  38. package/client/src/components/Connections/model.ts +2 -2
  39. package/client/src/components/DialogShell.tsx +4 -0
  40. package/client/src/components/DirectorContinuePrompt.tsx +56 -0
  41. package/client/src/components/FileExplorer.tsx +54 -1
  42. package/client/src/components/FileViewerModal.tsx +39 -7
  43. package/client/src/components/FirstRun.tsx +3 -2
  44. package/client/src/components/ForwardMessages.tsx +6 -3
  45. package/client/src/components/GateApprovalNotice.tsx +7 -4
  46. package/client/src/components/GeminiSkillNotice.tsx +12 -0
  47. package/client/src/components/GeminiSubagentLine.tsx +5 -0
  48. package/client/src/components/GitDialog.tsx +15 -6
  49. package/client/src/components/GitOtherWork.tsx +2 -1
  50. package/client/src/components/HandoffDialog.tsx +3 -2
  51. package/client/src/components/HeaderVersionBox.tsx +6 -2
  52. package/client/src/components/HistoryTab.tsx +127 -108
  53. package/client/src/components/Home/HomeView.tsx +14 -3
  54. package/client/src/components/Home/ResearchLibrary.tsx +107 -0
  55. package/client/src/components/Home/home.css +6 -0
  56. package/client/src/components/LoginFlow.tsx +12 -5
  57. package/client/src/components/MemberCard.tsx +8 -2
  58. package/client/src/components/MemberPane.tsx +12 -4
  59. package/client/src/components/MobileNotices.tsx +26 -0
  60. package/client/src/components/MobileQuestionBar.tsx +35 -0
  61. package/client/src/components/MobileShell.tsx +811 -0
  62. package/client/src/components/MobileTextSize.tsx +27 -0
  63. package/client/src/components/NativeSubagentControls.tsx +12 -1
  64. package/client/src/components/NorthStarBar.tsx +2 -0
  65. package/client/src/components/NotificationToasts.tsx +6 -2
  66. package/client/src/components/OperatorQuestionNotice.tsx +2 -2
  67. package/client/src/components/PendingQuestionsButton.tsx +44 -5
  68. package/client/src/components/PhoneUpload.tsx +4 -2
  69. package/client/src/components/PlanComposerDialog.tsx +7 -7
  70. package/client/src/components/ProjectsSettings.tsx +3 -0
  71. package/client/src/components/ProvidersPopover.tsx +9 -6
  72. package/client/src/components/PurgeConversationModal.tsx +1 -1
  73. package/client/src/components/QueuedMessagesIndicator.tsx +1 -1
  74. package/client/src/components/Recall/RecallView.tsx +31 -8
  75. package/client/src/components/ResearchFolderSetting.tsx +64 -0
  76. package/client/src/components/RightPanel/ActivityTab.tsx +9 -4
  77. package/client/src/components/RightPanel/BlastRadiusTab.tsx +6 -8
  78. package/client/src/components/RightPanel/ConfigTab.tsx +18 -10
  79. package/client/src/components/RightPanel/FilesTab.tsx +34 -19
  80. package/client/src/components/RightPanel/PlanTab.tsx +67 -24
  81. package/client/src/components/RightPanel/UsageTab.tsx +30 -3
  82. package/client/src/components/RightPanel/index.tsx +42 -3
  83. package/client/src/components/RuntimeStateBanner.tsx +8 -0
  84. package/client/src/components/ScratchCloseDialog.tsx +124 -0
  85. package/client/src/components/SettingsPanel.tsx +181 -69
  86. package/client/src/components/SkillActivityIndicator.tsx +93 -0
  87. package/client/src/components/SystemHeader.tsx +2 -7
  88. package/client/src/components/SystemModal.tsx +37 -45
  89. package/client/src/components/TabBar.tsx +52 -8
  90. package/client/src/components/TabContextMenu.tsx +12 -102
  91. package/client/src/components/TaskCard.tsx +13 -17
  92. package/client/src/components/TaskChildComposer.tsx +24 -0
  93. package/client/src/components/TasksPanel.tsx +7 -17
  94. package/client/src/components/Terminal/FloatingTerminalWindow.tsx +11 -3
  95. package/client/src/components/Terminal/FloatingWindow.tsx +36 -14
  96. package/client/src/components/Terminal/XtermView.tsx +19 -2
  97. package/client/src/components/Terminal/phoneKeys.ts +9 -0
  98. package/client/src/components/TerminalInput.tsx +149 -32
  99. package/client/src/components/TranscriptWorkerDialog.tsx +2 -2
  100. package/client/src/components/UpdateAction.tsx +9 -6
  101. package/client/src/components/UsageBar.tsx +118 -10
  102. package/client/src/components/UserManual/MobileManualContent.tsx +58 -0
  103. package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +8 -5
  104. package/client/src/components/WorkflowCreator/PastChatsList.tsx +3 -1
  105. package/client/src/components/WorkflowCreator/ProjectPicker.tsx +3 -3
  106. package/client/src/components/WorkflowCreator/ResearchStartForm.tsx +335 -0
  107. package/client/src/components/WorkflowCreator/index.tsx +124 -36
  108. package/client/src/components/WorkflowCreator/memberProviders.ts +20 -5
  109. package/client/src/components/WorkflowCreator/pendingTemplateApply.ts +20 -0
  110. package/client/src/components/WorkflowCreator/types.ts +18 -0
  111. package/client/src/components/WorkflowStatusChip.tsx +1 -0
  112. package/client/src/components/WorkflowView.tsx +51 -13
  113. package/client/src/components/chatMessageLabel.ts +4 -0
  114. package/client/src/components/clusterActivity.helpers.ts +5 -1
  115. package/client/src/components/clusterNeedsYou.ts +3 -8
  116. package/client/src/components/clusterSurface.helpers.ts +6 -1
  117. package/client/src/components/composer/submitComposer.ts +7 -1
  118. package/client/src/components/help/HelpBanner.tsx +10 -5
  119. package/client/src/components/help/HelpPopover.tsx +5 -0
  120. package/client/src/components/media/MediaModalHost.tsx +13 -8
  121. package/client/src/components/plans/PhonePlanView.tsx +66 -0
  122. package/client/src/components/plans/phonePlanChecklist.ts +45 -0
  123. package/client/src/components/providerIndicator.ts +83 -0
  124. package/client/src/components/research/AddResearcherSection.tsx +50 -0
  125. package/client/src/components/research/ExportResearchDialog.tsx +52 -0
  126. package/client/src/components/research/QuickResearchOverview.tsx +92 -0
  127. package/client/src/components/research/RerunResearchDialog.tsx +61 -0
  128. package/client/src/components/research/ResearchCloseDialog.tsx +98 -0
  129. package/client/src/components/research/ResearchRemoveDialog.tsx +37 -0
  130. package/client/src/components/research/ResearchReopenDialog.tsx +160 -0
  131. package/client/src/components/research/ResearchResultsTab.css +289 -0
  132. package/client/src/components/research/ResearchResultsTab.tsx +207 -0
  133. package/client/src/components/research/ResearchRoundsStrip.tsx +127 -0
  134. package/client/src/components/research/SavedQuickKeep.tsx +58 -0
  135. package/client/src/components/research/SendResearchDialog.tsx +126 -0
  136. package/client/src/components/research/StartResearchProjectDialog.tsx +108 -0
  137. package/client/src/components/research/researchExports.ts +26 -0
  138. package/client/src/components/research/researchLinks.tsx +30 -0
  139. package/client/src/components/research/researchView.ts +64 -0
  140. package/client/src/components/research/researcherRow.tsx +104 -0
  141. package/client/src/components/settings/AppVersionSection.tsx +2 -0
  142. package/client/src/components/settings/SettingsLayout.tsx +23 -4
  143. package/client/src/components/settings/navigation.ts +4 -4
  144. package/client/src/components/settings/settings.css +18 -0
  145. package/client/src/components/usageVisibility.ts +4 -6
  146. package/client/src/components/workSurface/WorkSurfaceControls.tsx +7 -0
  147. package/client/src/explorer/StorageLens.tsx +10 -3
  148. package/client/src/help/content/chat.tsx +5 -8
  149. package/client/src/help/content/cluster.tsx +70 -30
  150. package/client/src/help/content/composer.tsx +13 -8
  151. package/client/src/help/content/header.tsx +17 -24
  152. package/client/src/help/content/media.tsx +2 -2
  153. package/client/src/help/content/misc.tsx +174 -38
  154. package/client/src/help/content/recall.tsx +2 -2
  155. package/client/src/help/content/rightPanel.tsx +8 -8
  156. package/client/src/help/content/settings.tsx +48 -14
  157. package/client/src/help/content/tabbar.tsx +6 -2
  158. package/client/src/help/manualSections/actions.tsx +7 -2
  159. package/client/src/help/manualSections/chat.tsx +16 -15
  160. package/client/src/help/manualSections/clusters.tsx +348 -69
  161. package/client/src/help/manualSections/configuration.tsx +25 -18
  162. package/client/src/help/manualSections/deepseek.tsx +4 -5
  163. package/client/src/help/manualSections/gettingStarted.tsx +30 -26
  164. package/client/src/help/manualSections/maintenance.tsx +9 -5
  165. package/client/src/help/manualSections/plans.tsx +4 -4
  166. package/client/src/help/manualSections/powerFeatures.tsx +51 -18
  167. package/client/src/help/manualSections/providers.tsx +56 -21
  168. package/client/src/help/manualSections/reference.tsx +6 -6
  169. package/client/src/help/manualSections/strata.tsx +8 -8
  170. package/client/src/help/manualSections/workflows.tsx +3 -3
  171. package/client/src/help/manualSections/workspace.tsx +115 -39
  172. package/client/src/hooks/useWebSocket.ts +21 -4
  173. package/client/src/layout/PhoneBottomSheet.tsx +71 -0
  174. package/client/src/layout/PhonePage.tsx +71 -0
  175. package/client/src/layout/SlideOut.tsx +36 -9
  176. package/client/src/layout/layoutRange.ts +41 -4
  177. package/client/src/layout/phoneChip.ts +14 -0
  178. package/client/src/layout/phoneOverlay.ts +81 -0
  179. package/client/src/layout/phonePageActions.ts +40 -0
  180. package/client/src/stores/appStore.ts +36 -10
  181. package/client/src/stores/appStore.types.ts +29 -3
  182. package/client/src/stores/directorContinueStore.ts +22 -0
  183. package/client/src/stores/draftStore.ts +56 -2
  184. package/client/src/stores/phoneStore.ts +196 -0
  185. package/client/src/stores/terminalStore.ts +8 -0
  186. package/client/src/styles/contextual-help.css +10 -0
  187. package/client/src/styles/global.css +293 -0
  188. package/client/src/themes/apply.ts +9 -1
  189. package/client/src/themes/bootstrap.ts +21 -1
  190. package/client/src/themes/providerThemes.ts +1 -0
  191. package/client/src/utils/codexAccountHome.ts +9 -0
  192. package/client/src/utils/format.ts +8 -2
  193. package/client/src/utils/gitBranchMark.ts +3 -0
  194. package/client/src/utils/homeModel.ts +7 -0
  195. package/client/src/utils/longPress.ts +64 -0
  196. package/client/src/utils/modelCatalog.ts +4 -0
  197. package/client/src/utils/providerStatusCheck.ts +30 -0
  198. package/client/src/utils/startupGate.ts +6 -0
  199. package/client/src/ws/handleServerMessage.ts +106 -7
  200. package/docs/ARCHITECTURE.md +63 -37
  201. package/docs/ARCHITECTURE_REVIEW.md +1 -1
  202. package/docs/BACKUP.md +60 -9
  203. package/docs/CHAT.md +15 -11
  204. package/docs/CHECKPOINTS.md +2 -0
  205. package/docs/CLIENT.md +70 -36
  206. package/docs/DEEPSEEK.md +9 -10
  207. package/docs/DIAGNOSTICS.md +8 -7
  208. package/docs/DOCKER.md +16 -2
  209. package/docs/EXTENDING.md +10 -26
  210. package/docs/FEATURES.md +23 -15
  211. package/docs/GENESIS.md +3 -1
  212. package/docs/GETTING_STARTED.md +82 -16
  213. package/docs/GIT_WORKBENCH.md +5 -5
  214. package/docs/GLOSSARY.md +36 -23
  215. package/docs/GOTCHAS.md +102 -67
  216. package/docs/HTTP_API.md +182 -86
  217. package/docs/INDEX.md +1 -0
  218. package/docs/KNOWLEDGE.md +2 -2
  219. package/docs/LOCAL_SERVICES.md +9 -8
  220. package/docs/MCP_REGISTRY.md +18 -13
  221. package/docs/MEDIA_STUDIO.md +7 -11
  222. package/docs/OPERATIONS.md +101 -24
  223. package/docs/OPERATOR_ACTIONS.md +24 -22
  224. package/docs/PERSISTENCE.md +65 -24
  225. package/docs/PHOSPHOR_DEMO.md +1 -4
  226. package/docs/PLAN_OR_BOARD.md +2 -2
  227. package/docs/PRIMITIVES.md +17 -17
  228. package/docs/PROTOCOL.md +60 -9
  229. package/docs/PROTOCOL_CLUSTER.md +92 -22
  230. package/docs/PROTOCOL_PRIMITIVES.md +10 -4
  231. package/docs/PROVIDERS.md +291 -145
  232. package/docs/RECALL.md +40 -31
  233. package/docs/REMOTE_MANAGEMENT.md +27 -51
  234. package/docs/REPO_LAYOUT.md +4 -3
  235. package/docs/RESEARCH.md +189 -0
  236. package/docs/RESUME_INDEX.md +10 -19
  237. package/docs/SERVICE_MODE.md +11 -5
  238. package/docs/SETTINGS.md +18 -13
  239. package/docs/STORAGE_PLAN.md +3 -3
  240. package/docs/STRATA.md +14 -11
  241. package/docs/TASK_LEDGER.md +19 -8
  242. package/docs/TERMINAL.md +14 -10
  243. package/docs/THIRD_PARTY.md +21 -4
  244. package/docs/VOICE.md +16 -28
  245. package/native/linux-arm64/manifest.json +1 -1
  246. package/node_modules/@arco/shared/dist/clusterCoordination.d.ts +1 -0
  247. package/node_modules/@arco/shared/dist/clusterCoordination.js +9 -1
  248. package/node_modules/@arco/shared/dist/clusterRolePresets.js +13 -4
  249. package/node_modules/@arco/shared/dist/index.d.ts +1 -0
  250. package/node_modules/@arco/shared/dist/index.js +1 -0
  251. package/node_modules/@arco/shared/dist/protocol/autoPickup.d.ts +7 -0
  252. package/node_modules/@arco/shared/dist/protocol/autoPickup.js +22 -11
  253. package/node_modules/@arco/shared/dist/protocol/chat.d.ts +1 -1
  254. package/node_modules/@arco/shared/dist/protocol/checkpoints.d.ts +1 -0
  255. package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +18 -3
  256. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +177 -4
  257. package/node_modules/@arco/shared/dist/protocol/clusters.js +48 -2
  258. package/node_modules/@arco/shared/dist/protocol/handoffs.d.ts +1 -0
  259. package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -1
  260. package/node_modules/@arco/shared/dist/protocol/models.js +4 -3
  261. package/node_modules/@arco/shared/dist/protocol/providers.d.ts +3 -2
  262. package/node_modules/@arco/shared/dist/protocol/providers.js +1 -1
  263. package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +28 -3
  264. package/node_modules/@arco/shared/dist/protocol/settings.d.ts +4 -0
  265. package/node_modules/@arco/shared/dist/protocol/settings.js +3 -1
  266. package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +42 -0
  267. package/node_modules/@arco/shared/dist/protocol/tasks.js +17 -0
  268. package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +4 -0
  269. package/node_modules/@arco/shared/dist/protocol/workflows.js +2 -0
  270. package/node_modules/@arco/shared/dist/researchActivity.d.ts +4 -0
  271. package/node_modules/@arco/shared/dist/researchActivity.js +29 -0
  272. package/node_modules/@arco/shared/package.json +1 -1
  273. package/package.json +3 -2
  274. package/scripts/packaging/services.mjs +19 -2
  275. package/scripts/packaging/update.mjs +9 -0
  276. package/server/dist/arcoHome.js +19 -3
  277. package/server/dist/auth.d.ts +4 -2
  278. package/server/dist/auth.js +42 -4
  279. package/server/dist/authLoginSession.d.ts +2 -1
  280. package/server/dist/authLoginSession.js +13 -3
  281. package/server/dist/capabilities.d.ts +2 -2
  282. package/server/dist/capabilities.js +11 -6
  283. package/server/dist/chatMode.d.ts +3 -0
  284. package/server/dist/chatMode.js +25 -2
  285. package/server/dist/checkedFile.d.ts +1 -1
  286. package/server/dist/checkedFile.js +48 -41
  287. package/server/dist/cliUpdateDecision.js +1 -1
  288. package/server/dist/clusterAutoTurn.d.ts +4 -1
  289. package/server/dist/clusterAutoTurn.js +25 -4
  290. package/server/dist/clusterBusyReminder.js +2 -1
  291. package/server/dist/clusterDirector.js +5 -2
  292. package/server/dist/clusterMailTally.d.ts +11 -0
  293. package/server/dist/clusterMailTally.js +29 -0
  294. package/server/dist/clusterMailbox.d.ts +8 -1
  295. package/server/dist/clusterMailbox.js +53 -4
  296. package/server/dist/clusterOpenWork.d.ts +22 -0
  297. package/server/dist/clusterOpenWork.js +85 -0
  298. package/server/dist/clusterPeerOps.d.ts +32 -5
  299. package/server/dist/clusterPeerOps.js +253 -49
  300. package/server/dist/clusterPlanBridge.d.ts +7 -1
  301. package/server/dist/clusterPlanBridge.js +58 -0
  302. package/server/dist/clusterPlanStore.d.ts +6 -0
  303. package/server/dist/clusterPlanStore.js +58 -0
  304. package/server/dist/clusterPresets.js +23 -3
  305. package/server/dist/clusterProgress.js +2 -2
  306. package/server/dist/clusterSkills.js +2 -2
  307. package/server/dist/clusterSnapshots.d.ts +1 -0
  308. package/server/dist/clusterSnapshots.js +7 -1
  309. package/server/dist/clusterStore.d.ts +34 -1
  310. package/server/dist/clusterStore.js +194 -21
  311. package/server/dist/clusterTurnOrigin.d.ts +2 -0
  312. package/server/dist/clusterTurnOrigin.js +19 -0
  313. package/server/dist/connectionCatalog.js +1 -0
  314. package/server/dist/cursorUsage.js +3 -3
  315. package/server/dist/defaults/models.md +11 -14
  316. package/server/dist/directorContinue.d.ts +47 -0
  317. package/server/dist/directorContinue.js +311 -0
  318. package/server/dist/directorContinueHook.d.ts +3 -0
  319. package/server/dist/directorContinueHook.js +16 -0
  320. package/server/dist/effortValidation.d.ts +3 -0
  321. package/server/dist/effortValidation.js +34 -0
  322. package/server/dist/fileAccessPolicy.js +1 -0
  323. package/server/dist/fileFetch.d.ts +7 -1
  324. package/server/dist/fileFetch.js +50 -29
  325. package/server/dist/geminiMembers.d.ts +8 -0
  326. package/server/dist/geminiMembers.js +113 -0
  327. package/server/dist/git.d.ts +3 -0
  328. package/server/dist/git.js +17 -24
  329. package/server/dist/gitOtherWork.js +5 -4
  330. package/server/dist/gitSnapshots.js +66 -5
  331. package/server/dist/http/authLoginRoutes.js +1 -1
  332. package/server/dist/http/clusterRoutes.js +466 -4
  333. package/server/dist/http/diagnosticsRoutes.js +8 -0
  334. package/server/dist/http/fileWriteRoutes.js +11 -3
  335. package/server/dist/http/phoneUploadRoutes.js +2 -1
  336. package/server/dist/http/readConfinement.d.ts +11 -0
  337. package/server/dist/http/readConfinement.js +30 -0
  338. package/server/dist/http/recallRoutes.js +1 -1
  339. package/server/dist/http/router.js +48 -11
  340. package/server/dist/http/storageRoutes.js +114 -7
  341. package/server/dist/http/workflowDataRoutes.js +20 -0
  342. package/server/dist/http/writeConfinement.js +12 -1
  343. package/server/dist/index.d.ts +13 -0
  344. package/server/dist/index.js +353 -56
  345. package/server/dist/initialProviders.js +1 -1
  346. package/server/dist/manualCompactCapability.js +1 -1
  347. package/server/dist/mcp/clusterMcpLoopback.d.ts +1 -0
  348. package/server/dist/mcp/clusterMcpLoopback.js +1 -0
  349. package/server/dist/mcp/clusterMcpServer.js +3 -2
  350. package/server/dist/mcp/clusterMcpTools.d.ts +3 -0
  351. package/server/dist/mcp/clusterMcpTools.js +79 -25
  352. package/server/dist/mcp/mcpConfigWriter.d.ts +1 -0
  353. package/server/dist/mcp/mcpConfigWriter.js +2 -0
  354. package/server/dist/mcp/workerMailBridge.d.ts +17 -0
  355. package/server/dist/mcp/workerMailBridge.js +104 -0
  356. package/server/dist/planStore.js +1 -0
  357. package/server/dist/primitives/seedWorker.d.ts +10 -1
  358. package/server/dist/primitives/seedWorker.js +14 -15
  359. package/server/dist/project/taskLedger.d.ts +3 -0
  360. package/server/dist/project/taskLedger.js +16 -0
  361. package/server/dist/providers/{cursor → acp}/acpJsonRpc.js +1 -1
  362. package/server/dist/providers/acp/permissionGate.d.ts +3 -0
  363. package/server/dist/providers/acp/permissionGate.js +46 -0
  364. package/server/dist/providers/antigravity/index.d.ts +15 -0
  365. package/server/dist/providers/antigravity/index.js +251 -0
  366. package/server/dist/providers/antigravity/researchSignIn.d.ts +24 -0
  367. package/server/dist/providers/antigravity/researchSignIn.js +93 -0
  368. package/server/dist/providers/antigravity/status.d.ts +18 -0
  369. package/server/dist/providers/antigravity/status.js +28 -0
  370. package/server/dist/providers/antigravity/usage.d.ts +7 -0
  371. package/server/dist/providers/antigravity/usage.js +35 -0
  372. package/server/dist/providers/claude/researcherFence.d.ts +7 -0
  373. package/server/dist/providers/claude/researcherFence.js +27 -0
  374. package/server/dist/providers/claude-native/catalog.d.ts +2 -1
  375. package/server/dist/providers/claude-native/catalog.js +4 -0
  376. package/server/dist/providers/claude-native/index.d.ts +1 -0
  377. package/server/dist/providers/claude-native/index.js +9 -1
  378. package/server/dist/providers/claude-native/peerTools.d.ts +1 -0
  379. package/server/dist/providers/claude-native/peerTools.js +26 -4
  380. package/server/dist/providers/claude-native/taskAdmission.d.ts +7 -1
  381. package/server/dist/providers/claude-native/taskAdmission.js +30 -8
  382. package/server/dist/providers/claude-native/tools.d.ts +1 -0
  383. package/server/dist/providers/claude-native/tools.js +47 -18
  384. package/server/dist/providers/claude-native/worker.d.ts +22 -1
  385. package/server/dist/providers/claude-native/worker.js +281 -51
  386. package/server/dist/providers/claude-native/workerHelpers.d.ts +5 -0
  387. package/server/dist/providers/claude-native/workerHelpers.js +95 -5
  388. package/server/dist/providers/claude.d.ts +2 -0
  389. package/server/dist/providers/claude.js +194 -22
  390. package/server/dist/providers/clusterTaskToolDefinitions.js +2 -1
  391. package/server/dist/providers/codex-appserver/heldCommands.d.ts +2 -2
  392. package/server/dist/providers/codex-appserver/heldCommands.js +9 -3
  393. package/server/dist/providers/codex-appserver/index.d.ts +9 -0
  394. package/server/dist/providers/codex-appserver/index.js +106 -5
  395. package/server/dist/providers/codex-appserver/lateCommands.js +1 -0
  396. package/server/dist/providers/codex-appserver/modelAvailability.d.ts +20 -0
  397. package/server/dist/providers/codex-appserver/modelAvailability.js +34 -0
  398. package/server/dist/providers/codex-appserver/worker.d.ts +11 -0
  399. package/server/dist/providers/codex-appserver/worker.js +199 -25
  400. package/server/dist/providers/codex.js +1 -0
  401. package/server/dist/providers/codexVersion.d.ts +2 -0
  402. package/server/dist/providers/codexVersion.js +8 -0
  403. package/server/dist/providers/codexWebSearch.js +1 -1
  404. package/server/dist/providers/cursor/agentEnv.d.ts +20 -0
  405. package/server/dist/providers/cursor/agentEnv.js +93 -0
  406. package/server/dist/providers/cursor/authState.js +2 -1
  407. package/server/dist/providers/cursor/authToken.d.ts +25 -2
  408. package/server/dist/providers/cursor/authToken.js +118 -27
  409. package/server/dist/providers/cursor/catalog.d.ts +6 -0
  410. package/server/dist/providers/cursor/catalog.js +91 -1
  411. package/server/dist/providers/cursor/chatSandbox.d.ts +3 -1
  412. package/server/dist/providers/cursor/chatSandbox.js +24 -8
  413. package/server/dist/providers/cursor/isolated.d.ts +6 -0
  414. package/server/dist/providers/cursor/isolated.js +313 -0
  415. package/server/dist/providers/cursor/isolatedVersion.d.ts +6 -0
  416. package/server/dist/providers/cursor/isolatedVersion.js +35 -0
  417. package/server/dist/providers/cursor/modelMap.js +9 -5
  418. package/server/dist/providers/cursor/print.js +10 -8
  419. package/server/dist/providers/cursor/worker.js +8 -3
  420. package/server/dist/providers/index.js +10 -2
  421. package/server/dist/providers/llamacpp.js +3 -2
  422. package/server/dist/providers/ollama.d.ts +3 -2
  423. package/server/dist/providers/ollama.js +29 -10
  424. package/server/dist/providers/ollamaTools.d.ts +3 -0
  425. package/server/dist/providers/ollamaTools.js +31 -29
  426. package/server/dist/research/exportResults.d.ts +15 -0
  427. package/server/dist/research/exportResults.js +60 -0
  428. package/server/dist/research/isolatedArtifact.d.ts +4 -0
  429. package/server/dist/research/isolatedArtifact.js +56 -0
  430. package/server/dist/research/quickPromotion.d.ts +27 -0
  431. package/server/dist/research/quickPromotion.js +402 -0
  432. package/server/dist/research/quickResearchChat.d.ts +4 -0
  433. package/server/dist/research/quickResearchChat.js +187 -0
  434. package/server/dist/research/researchClose.d.ts +31 -0
  435. package/server/dist/research/researchClose.js +373 -0
  436. package/server/dist/research/researchCopy.d.ts +16 -0
  437. package/server/dist/research/researchCopy.js +180 -0
  438. package/server/dist/research/researchCreate.d.ts +40 -0
  439. package/server/dist/research/researchCreate.js +334 -0
  440. package/server/dist/research/researchDoctrine.d.ts +2 -0
  441. package/server/dist/research/researchDoctrine.js +26 -0
  442. package/server/dist/research/researchFolder.d.ts +23 -0
  443. package/server/dist/research/researchFolder.js +191 -0
  444. package/server/dist/research/researchLibrary.d.ts +54 -0
  445. package/server/dist/research/researchLibrary.js +281 -0
  446. package/server/dist/research/researchRetry.d.ts +25 -0
  447. package/server/dist/research/researchRetry.js +96 -0
  448. package/server/dist/research/researchRounds.d.ts +108 -0
  449. package/server/dist/research/researchRounds.js +996 -0
  450. package/server/dist/research/researchState.d.ts +112 -0
  451. package/server/dist/research/researchState.js +191 -0
  452. package/server/dist/research/researchTools.d.ts +57 -0
  453. package/server/dist/research/researchTools.js +57 -0
  454. package/server/dist/research/researchTripwires.d.ts +18 -0
  455. package/server/dist/research/researchTripwires.js +196 -0
  456. package/server/dist/research/resultSelection.d.ts +27 -0
  457. package/server/dist/research/resultSelection.js +161 -0
  458. package/server/dist/research/savedQuickPromotion.d.ts +19 -0
  459. package/server/dist/research/savedQuickPromotion.js +259 -0
  460. package/server/dist/research/sendToProject.d.ts +36 -0
  461. package/server/dist/research/sendToProject.js +293 -0
  462. package/server/dist/server/broadcast.d.ts +5 -1
  463. package/server/dist/server/broadcast.js +45 -5
  464. package/server/dist/server/updateCheck.js +1 -0
  465. package/server/dist/settings.js +27 -3
  466. package/server/dist/skillActivity.d.ts +11 -0
  467. package/server/dist/skillActivity.js +33 -0
  468. package/server/dist/smartPickup.d.ts +1 -0
  469. package/server/dist/smartPickup.js +12 -4
  470. package/server/dist/smartPickupAdapters.js +3 -2
  471. package/server/dist/smartPickupEvaluator.d.ts +1 -0
  472. package/server/dist/smartPickupObserver.js +47 -14
  473. package/server/dist/storageActions.d.ts +9 -0
  474. package/server/dist/storageActions.js +5 -0
  475. package/server/dist/storageOverview.d.ts +1 -0
  476. package/server/dist/storageOverview.js +12 -5
  477. package/server/dist/taskDispatcher.js +3 -2
  478. package/server/dist/toolboxWorkflow.js +2 -1
  479. package/server/dist/updateCheck.d.ts +3 -2
  480. package/server/dist/updateCheck.js +39 -1
  481. package/server/dist/workers/StreamParser.d.ts +1 -0
  482. package/server/dist/workers/StreamParser.js +23 -1
  483. package/server/dist/workers/WorkerManager.d.ts +4 -0
  484. package/server/dist/workers/WorkerManager.js +5 -1
  485. package/server/dist/workers/antigravityIsolatedLaunch.d.ts +25 -0
  486. package/server/dist/workers/antigravityIsolatedLaunch.js +88 -0
  487. package/server/dist/workers/checkedLinuxWorker.d.ts +38 -0
  488. package/server/dist/workers/checkedLinuxWorker.js +192 -0
  489. package/server/dist/workers/claudeAccessLease.d.ts +24 -0
  490. package/server/dist/workers/claudeAccessLease.js +157 -0
  491. package/server/dist/workers/claudeAccessSource.d.ts +2 -0
  492. package/server/dist/workers/claudeAccessSource.js +27 -0
  493. package/server/dist/workers/claudeIsolatedLaunch.d.ts +19 -0
  494. package/server/dist/workers/claudeIsolatedLaunch.js +104 -0
  495. package/server/dist/workers/cliResearcherDoctrine.d.ts +4 -0
  496. package/server/dist/workers/cliResearcherDoctrine.js +20 -0
  497. package/server/dist/workers/codexAccessLease.d.ts +26 -0
  498. package/server/dist/workers/codexAccessLease.js +208 -0
  499. package/server/dist/workers/codexIsolatedLaunch.d.ts +21 -0
  500. package/server/dist/workers/codexIsolatedLaunch.js +95 -0
  501. package/server/dist/workers/codexIsolatedPolicy.d.ts +5 -0
  502. package/server/dist/workers/codexIsolatedPolicy.js +49 -0
  503. package/server/dist/workers/cursorIsolatedLaunch.d.ts +37 -0
  504. package/server/dist/workers/cursorIsolatedLaunch.js +178 -0
  505. package/server/dist/workers/isolatedCliHome.d.ts +4 -0
  506. package/server/dist/workers/isolatedCliHome.js +107 -0
  507. package/server/dist/workers/limits.js +1 -1
  508. package/server/dist/workers/linuxWorkerSandbox.d.ts +48 -0
  509. package/server/dist/workers/linuxWorkerSandbox.js +192 -0
  510. package/server/dist/workers/processKill.d.ts +2 -0
  511. package/server/dist/workers/processKill.js +28 -2
  512. package/server/dist/workers/providerRuntimeDiscovery.d.ts +13 -0
  513. package/server/dist/workers/providerRuntimeDiscovery.js +126 -0
  514. package/server/dist/workers/researchSandboxAvailability.d.ts +3 -0
  515. package/server/dist/workers/researchSandboxAvailability.js +78 -0
  516. package/server/dist/workers/workerAccessPass.d.ts +12 -0
  517. package/server/dist/workers/workerAccessPass.js +123 -0
  518. package/server/dist/workers/workerHiddenDirectories.d.ts +3 -0
  519. package/server/dist/workers/workerHiddenDirectories.js +16 -0
  520. package/server/dist/workers/workerSocketDirectory.d.ts +2 -0
  521. package/server/dist/workers/workerSocketDirectory.js +16 -0
  522. package/server/dist/workers/workerWebProxy.d.ts +28 -0
  523. package/server/dist/workers/workerWebProxy.js +206 -0
  524. package/server/dist/workflowMeta.d.ts +5 -0
  525. package/server/dist/workflowMeta.js +7 -3
  526. package/server/dist/workflowStore.js +43 -25
  527. package/server/dist/workflows/purgeWorkflow.js +15 -0
  528. package/server/dist/workflows/types.d.ts +6 -0
  529. package/server/dist/workspace.d.ts +1 -0
  530. package/server/dist/workspace.js +8 -0
  531. package/server/dist/ws/clusterHandlers.d.ts +5 -0
  532. package/server/dist/ws/clusterHandlers.js +373 -26
  533. package/server/dist/ws/clusterMembers.d.ts +5 -0
  534. package/server/dist/ws/clusterMembers.js +15 -5
  535. package/server/dist/ws/compactHandlers.js +43 -8
  536. package/server/dist/ws/compareHandlers.d.ts +12 -0
  537. package/server/dist/ws/compareHandlers.js +32 -14
  538. package/server/dist/ws/handoffHandlers.js +39 -3
  539. package/server/dist/ws/operatorQuestionHandlers.d.ts +5 -0
  540. package/server/dist/ws/operatorQuestionHandlers.js +17 -2
  541. package/server/dist/ws/taskLedgerHandlers.js +1 -0
  542. package/server/dist/ws/taskLifecycle.d.ts +25 -1
  543. package/server/dist/ws/taskLifecycle.js +53 -1
  544. package/server/dist/ws/turnEngine.d.ts +18 -1
  545. package/server/dist/ws/turnEngine.js +281 -52
  546. package/server/dist/ws/turnPrompt.js +3 -1
  547. package/server/dist/ws/updatePrimaryConfig.js +11 -3
  548. package/server/dist/ws/workflowHandlers.js +17 -4
  549. package/server/package.json +1 -1
  550. package/server/src/arcoHome.ts +16 -3
  551. package/server/src/auth.ts +50 -6
  552. package/server/src/authLoginSession.ts +10 -5
  553. package/server/src/capabilities.ts +13 -8
  554. package/server/src/chatMode.ts +24 -2
  555. package/server/src/checkedFile.ts +42 -31
  556. package/server/src/cliUpdateDecision.ts +1 -1
  557. package/server/src/clusterAutoTurn.ts +29 -5
  558. package/server/src/clusterBusyReminder.ts +2 -1
  559. package/server/src/clusterDirector.ts +5 -2
  560. package/server/src/clusterMailTally.ts +28 -0
  561. package/server/src/clusterMailbox.ts +49 -4
  562. package/server/src/clusterOpenWork.ts +94 -0
  563. package/server/src/clusterPeerOps.ts +238 -52
  564. package/server/src/clusterPlanBridge.ts +54 -1
  565. package/server/src/clusterPlanStore.ts +59 -0
  566. package/server/src/clusterPresets.ts +17 -3
  567. package/server/src/clusterProgress.ts +2 -2
  568. package/server/src/clusterSkills.ts +2 -2
  569. package/server/src/clusterSnapshots.ts +7 -1
  570. package/server/src/clusterStore.ts +192 -20
  571. package/server/src/clusterTurnOrigin.ts +19 -0
  572. package/server/src/connectionCatalog.ts +1 -0
  573. package/server/src/cursorUsage.ts +3 -3
  574. package/server/src/defaults/models.md +11 -14
  575. package/server/src/directorContinue.ts +309 -0
  576. package/server/src/directorContinueHook.ts +15 -0
  577. package/server/src/effortValidation.ts +31 -0
  578. package/server/src/fileAccessPolicy.ts +1 -0
  579. package/server/src/fileFetch.ts +47 -29
  580. package/server/src/geminiMembers.ts +116 -0
  581. package/server/src/git.ts +20 -22
  582. package/server/src/gitOtherWork.ts +5 -4
  583. package/server/src/gitSnapshots.ts +53 -5
  584. package/server/src/http/authLoginRoutes.ts +2 -2
  585. package/server/src/http/clusterRoutes.ts +314 -6
  586. package/server/src/http/diagnosticsRoutes.ts +9 -0
  587. package/server/src/http/fileWriteRoutes.ts +13 -5
  588. package/server/src/http/phoneUploadRoutes.ts +2 -1
  589. package/server/src/http/readConfinement.ts +30 -0
  590. package/server/src/http/recallRoutes.ts +1 -1
  591. package/server/src/http/router.ts +43 -10
  592. package/server/src/http/storageRoutes.ts +86 -7
  593. package/server/src/http/workflowDataRoutes.ts +20 -0
  594. package/server/src/http/writeConfinement.ts +10 -1
  595. package/server/src/index.ts +295 -18
  596. package/server/src/initialProviders.ts +1 -1
  597. package/server/src/manualCompactCapability.ts +1 -1
  598. package/server/src/mcp/clusterMcpLoopback.ts +2 -0
  599. package/server/src/mcp/clusterMcpServer.ts +3 -2
  600. package/server/src/mcp/clusterMcpTools.ts +83 -27
  601. package/server/src/mcp/mcpConfigWriter.ts +4 -0
  602. package/server/src/mcp/workerMailBridge.ts +99 -0
  603. package/server/src/planStore.ts +1 -0
  604. package/server/src/primitives/seedWorker.ts +19 -14
  605. package/server/src/project/taskLedger.ts +23 -0
  606. package/server/src/providers/{cursor → acp}/acpJsonRpc.ts +3 -3
  607. package/server/src/providers/acp/permissionGate.ts +47 -0
  608. package/server/src/providers/antigravity/index.ts +187 -0
  609. package/server/src/providers/antigravity/researchSignIn.ts +76 -0
  610. package/server/src/providers/antigravity/status.ts +24 -0
  611. package/server/src/providers/antigravity/usage.ts +29 -0
  612. package/server/src/providers/claude/researcherFence.ts +25 -0
  613. package/server/src/providers/claude-native/catalog.ts +5 -0
  614. package/server/src/providers/claude-native/index.ts +8 -1
  615. package/server/src/providers/claude-native/peerTools.ts +24 -4
  616. package/server/src/providers/claude-native/taskAdmission.ts +35 -9
  617. package/server/src/providers/claude-native/tools.ts +39 -19
  618. package/server/src/providers/claude-native/worker.ts +270 -52
  619. package/server/src/providers/claude-native/workerHelpers.ts +88 -5
  620. package/server/src/providers/claude.ts +160 -22
  621. package/server/src/providers/clusterTaskToolDefinitions.ts +2 -1
  622. package/server/src/providers/codex-appserver/heldCommands.ts +7 -3
  623. package/server/src/providers/codex-appserver/index.ts +87 -3
  624. package/server/src/providers/codex-appserver/lateCommands.ts +1 -0
  625. package/server/src/providers/codex-appserver/modelAvailability.ts +40 -0
  626. package/server/src/providers/codex-appserver/worker.ts +155 -25
  627. package/server/src/providers/codex.ts +1 -0
  628. package/server/src/providers/codexVersion.ts +9 -0
  629. package/server/src/providers/codexWebSearch.ts +1 -1
  630. package/server/src/providers/cursor/agentEnv.ts +103 -0
  631. package/server/src/providers/cursor/authState.ts +2 -1
  632. package/server/src/providers/cursor/authToken.ts +137 -31
  633. package/server/src/providers/cursor/catalog.ts +89 -1
  634. package/server/src/providers/cursor/chatSandbox.ts +20 -8
  635. package/server/src/providers/cursor/isolated.ts +282 -0
  636. package/server/src/providers/cursor/isolatedVersion.ts +33 -0
  637. package/server/src/providers/cursor/modelMap.ts +9 -5
  638. package/server/src/providers/cursor/print.ts +10 -8
  639. package/server/src/providers/cursor/worker.ts +8 -3
  640. package/server/src/providers/index.ts +10 -2
  641. package/server/src/providers/llamacpp.ts +3 -1
  642. package/server/src/providers/ollama.ts +30 -11
  643. package/server/src/providers/ollamaTools.ts +33 -27
  644. package/server/src/research/exportResults.ts +47 -0
  645. package/server/src/research/isolatedArtifact.ts +48 -0
  646. package/server/src/research/quickPromotion.ts +325 -0
  647. package/server/src/research/quickResearchChat.ts +147 -0
  648. package/server/src/research/researchClose.ts +340 -0
  649. package/server/src/research/researchCopy.ts +170 -0
  650. package/server/src/research/researchCreate.ts +306 -0
  651. package/server/src/research/researchDoctrine.ts +27 -0
  652. package/server/src/research/researchFolder.ts +202 -0
  653. package/server/src/research/researchLibrary.ts +306 -0
  654. package/server/src/research/researchRetry.ts +86 -0
  655. package/server/src/research/researchRounds.ts +891 -0
  656. package/server/src/research/researchState.ts +309 -0
  657. package/server/src/research/researchTools.ts +59 -0
  658. package/server/src/research/researchTripwires.ts +158 -0
  659. package/server/src/research/resultSelection.ts +127 -0
  660. package/server/src/research/savedQuickPromotion.ts +174 -0
  661. package/server/src/research/sendToProject.ts +220 -0
  662. package/server/src/server/broadcast.ts +39 -5
  663. package/server/src/server/updateCheck.ts +1 -0
  664. package/server/src/settings.ts +22 -5
  665. package/server/src/skillActivity.ts +35 -0
  666. package/server/src/smartPickup.ts +14 -4
  667. package/server/src/smartPickupAdapters.ts +3 -2
  668. package/server/src/smartPickupEvaluator.ts +3 -0
  669. package/server/src/smartPickupObserver.ts +38 -12
  670. package/server/src/storageActions.ts +6 -0
  671. package/server/src/storageOverview.ts +13 -6
  672. package/server/src/taskDispatcher.ts +3 -1
  673. package/server/src/toolboxWorkflow.ts +2 -1
  674. package/server/src/updateCheck.ts +31 -3
  675. package/server/src/workers/StreamParser.ts +20 -1
  676. package/server/src/workers/WorkerManager.ts +10 -1
  677. package/server/src/workers/antigravityIsolatedLaunch.ts +82 -0
  678. package/server/src/workers/checkedLinuxWorker.ts +212 -0
  679. package/server/src/workers/claudeAccessLease.ts +122 -0
  680. package/server/src/workers/claudeAccessSource.ts +20 -0
  681. package/server/src/workers/claudeIsolatedLaunch.ts +91 -0
  682. package/server/src/workers/cliResearcherDoctrine.ts +20 -0
  683. package/server/src/workers/codexAccessLease.ts +146 -0
  684. package/server/src/workers/codexIsolatedLaunch.ts +72 -0
  685. package/server/src/workers/codexIsolatedPolicy.ts +38 -0
  686. package/server/src/workers/cursorIsolatedLaunch.ts +159 -0
  687. package/server/src/workers/isolatedCliHome.ts +75 -0
  688. package/server/src/workers/limits.ts +1 -1
  689. package/server/src/workers/linuxWorkerSandbox.ts +193 -0
  690. package/server/src/workers/processKill.ts +34 -2
  691. package/server/src/workers/providerRuntimeDiscovery.ts +108 -0
  692. package/server/src/workers/researchSandboxAvailability.ts +68 -0
  693. package/server/src/workers/workerAccessPass.ts +96 -0
  694. package/server/src/workers/workerHiddenDirectories.ts +16 -0
  695. package/server/src/workers/workerSocketDirectory.ts +13 -0
  696. package/server/src/workers/workerWebProxy.ts +194 -0
  697. package/server/src/workflowMeta.ts +10 -3
  698. package/server/src/workflowStore.ts +39 -26
  699. package/server/src/workflows/purgeWorkflow.ts +18 -0
  700. package/server/src/workflows/types.ts +13 -0
  701. package/server/src/workspace.ts +8 -0
  702. package/server/src/ws/clusterHandlers.ts +302 -26
  703. package/server/src/ws/clusterMembers.ts +15 -5
  704. package/server/src/ws/compactHandlers.ts +37 -5
  705. package/server/src/ws/compareHandlers.ts +34 -11
  706. package/server/src/ws/handoffHandlers.ts +36 -3
  707. package/server/src/ws/operatorQuestionHandlers.ts +14 -2
  708. package/server/src/ws/taskLedgerHandlers.ts +1 -0
  709. package/server/src/ws/taskLifecycle.ts +58 -4
  710. package/server/src/ws/turnEngine.ts +265 -49
  711. package/server/src/ws/turnPrompt.ts +3 -1
  712. package/server/src/ws/updatePrimaryConfig.ts +10 -3
  713. package/server/src/ws/workflowHandlers.ts +15 -4
  714. package/shared/dist/clusterCoordination.d.ts +1 -0
  715. package/shared/dist/clusterCoordination.js +9 -1
  716. package/shared/dist/clusterRolePresets.js +13 -4
  717. package/shared/dist/index.d.ts +1 -0
  718. package/shared/dist/index.js +1 -0
  719. package/shared/dist/protocol/autoPickup.d.ts +7 -0
  720. package/shared/dist/protocol/autoPickup.js +22 -11
  721. package/shared/dist/protocol/chat.d.ts +1 -1
  722. package/shared/dist/protocol/checkpoints.d.ts +1 -0
  723. package/shared/dist/protocol/clientMessages.d.ts +18 -3
  724. package/shared/dist/protocol/clusters.d.ts +177 -4
  725. package/shared/dist/protocol/clusters.js +48 -2
  726. package/shared/dist/protocol/handoffs.d.ts +1 -0
  727. package/shared/dist/protocol/models.d.ts +6 -1
  728. package/shared/dist/protocol/models.js +4 -3
  729. package/shared/dist/protocol/providers.d.ts +3 -2
  730. package/shared/dist/protocol/providers.js +1 -1
  731. package/shared/dist/protocol/serverMessages.d.ts +28 -3
  732. package/shared/dist/protocol/settings.d.ts +4 -0
  733. package/shared/dist/protocol/settings.js +3 -1
  734. package/shared/dist/protocol/tasks.d.ts +42 -0
  735. package/shared/dist/protocol/tasks.js +17 -0
  736. package/shared/dist/protocol/workflows.d.ts +4 -0
  737. package/shared/dist/protocol/workflows.js +2 -0
  738. package/shared/dist/researchActivity.d.ts +4 -0
  739. package/shared/dist/researchActivity.js +29 -0
  740. package/shared/src/clusterCoordination.ts +12 -1
  741. package/shared/src/clusterRolePresets.ts +13 -4
  742. package/shared/src/index.ts +2 -0
  743. package/shared/src/protocol/autoPickup.ts +28 -11
  744. package/shared/src/protocol/chat.ts +1 -1
  745. package/shared/src/protocol/checkpoints.ts +1 -0
  746. package/shared/src/protocol/clientMessages.ts +14 -0
  747. package/shared/src/protocol/clusters.ts +231 -5
  748. package/shared/src/protocol/handoffs.ts +1 -0
  749. package/shared/src/protocol/models.ts +11 -4
  750. package/shared/src/protocol/providers.ts +6 -3
  751. package/shared/src/protocol/reviews.ts +2 -2
  752. package/shared/src/protocol/serverMessages.ts +28 -3
  753. package/shared/src/protocol/settings.ts +14 -1
  754. package/shared/src/protocol/tasks.ts +73 -0
  755. package/shared/src/protocol/workflows.ts +8 -0
  756. package/shared/src/researchActivity.ts +23 -0
  757. package/client/dist/assets/XtermView-Xk7_9JaH.js +0 -10
  758. package/client/dist/assets/index-BEFgrUJJ.css +0 -1
  759. package/client/dist/assets/index-C7WzZfsr.js +0 -614
  760. package/client/src/components/HeaderAuthChip.tsx +0 -207
  761. /package/server/dist/providers/{cursor → acp}/acpJsonRpc.d.ts +0 -0
package/docs/GOTCHAS.md CHANGED
@@ -24,6 +24,8 @@ For the architecture map, see [Architecture](ARCHITECTURE.md). For chronological
24
24
  | [DeepSeek / Xolotl](#deepseek--xolotl) |
25
25
  | [Ollama](#ollama) |
26
26
  | [Cursor](#cursor) |
27
+ | [Antigravity CLI](#antigravity-cli) |
28
+ | [Research isolation](#research-isolation) |
27
29
  | [Chat / UI](#chat--ui) |
28
30
  | [Themes / shaders](#themes--shaders) |
29
31
  | [Cross-platform](#cross-platform) |
@@ -99,12 +101,15 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
99
101
 
100
102
  ## Provider / worker plumbing
101
103
 
102
- - **Provider logins run in Arco's terminal, never spawned by the server.**
104
+ - **Provider logins never open a server-side browser or desktop terminal.**
103
105
  `POST /api/auth-login` returns `{ command }` - each CLI's headless mode
104
- (`claude auth login`, `codex login --device-auth`, `env NO_OPEN_BROWSER=1
105
- cursor-agent login`, `gh auth login --web`) -
106
- and the client's `LoginCommand` pre-fills it into the terminal (§K3 fence:
107
- the operator presses Enter). Don't reintroduce detached `spawn('claude',
106
+ (`claude auth login --claudeai`, `codex login --device-auth`, `env
107
+ NO_OPEN_BROWSER=1 cursor-agent login`, `agy acp --login`, `gh auth login
108
+ --web`) - and the client's `LoginCommand` pre-fills it into the terminal (§K3
109
+ fence: the operator presses Enter). With `inApp=1`, Claude, Codex, Cursor,
110
+ Antigravity CLI and Gemini for research instead run that command in a relayed
111
+ in-app session (`authLoginSession.ts`) that shows the link and accepts a
112
+ pasted code; the browser still opens only on the operator's device. Don't reintroduce detached `spawn('claude',
108
113
  ['auth','login'])` with `stdio:'ignore'` or desktop-terminal launches: with
109
114
  no reachable browser/display they no-op silently, and in remote-access
110
115
  setups a server-side browser launch can open on the wrong device. Return the
@@ -114,8 +119,8 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
114
119
 
115
120
  - **A failed `claude auth status` probe is "unknown", never "logged out".**
116
121
  `getClaudeAuthStatus` retries once, then returns the last known answer with
117
- `probeFailed:true`; only a parsed `loggedIn:false` counts. `HeaderAuthChip`
118
- ignores `probeFailed`, and App.tsx keeps polling while logged out. A failed
122
+ `probeFailed:true`; only a parsed `loggedIn:false` counts. The top-bar
123
+ provider letters (`providerIndicator`) read `probeFailed` as unknown, and App.tsx keeps polling while logged out. A failed
119
124
  probe must preserve the last known authentication state; otherwise polling
120
125
  can stop and leave a false sign-in prompt visible.
121
126
 
@@ -133,11 +138,11 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
133
138
  state.** `chatWebArmed(config, provider)` in `server/src/chatMode.ts` is the
134
139
  single source of truth: unset `chatWebAccess` means armed for a saved Chat and
135
140
  disarmed for Incognito (the query leaves the machine), and only
136
- `CHAT_WEB_PROVIDERS` (claude, codex, ollama, strata, deepseek) can honor it.
141
+ `CHAT_WEB_PROVIDERS` (claude, codex, cursor, ollama, strata, deepseek) can honor it.
137
142
  Every transport states the mode explicitly: CLI Claude passes
138
143
  `--tools WebSearch,WebFetch`; Native uses `buildChatWebTools()` (`web_search`,
139
144
  `web_fetch` and `read_url`) without `code_execution`; Codex sets
140
- `web_search="live"|"disabled"`; Ollama, Strata and DeepSeek use Arco's local
145
+ `web_search="live"|"disabled"`; Cursor print adds its web flags with file, shell and MCP denied; Ollama, Strata and DeepSeek use Arco's local
141
146
  SearXNG-backed `WebSearch` / `WebFetch` pair. Ollama narrows and auto-executes
142
147
  that pair even though Chat has no Agent AUTO toggle. `ollamaToolCallAllowed()`
143
148
  repeats the web-only check at dispatch because a model can invent a known but
@@ -195,8 +200,8 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
195
200
  - **API resilience** (Claude): `StreamParser` catches `{"type":"error"}` envelopes (top-level + text-delta variants) and surfaces them as `system_notice` events. `ClaudeWorkerProcess` retries on pre-result hard exits with 15s/30s/60s backoff, up to 3 attempts, reusing the same session-resume id (idempotent - the prompt never reached the API on pre-result exit). `kill()` clears the retry timer. Don't retry inside the CLI's internal retry window - gate is "exited non-zero without result," not mid-stream.
196
201
  - **Ultracode result-coalescing is load-bearing - under `config.ultracode`, the turn settles on PROCESS EXIT, not the first `result` event.** An ultracode turn runs the harness WorkflowTool's subagent fleet in the **background**, so one `claude -p` process emits **two `result` events**: an early "workflow launched" ack, then the real synthesis when the fleet finishes (the process exits 0 only after the last). WorkerManager settles on the FIRST `result` (its `settled` flag), so without intervention the operator gets the ack and the synthesis is dropped. Fix, gated on the flag, in `claude.ts`: `parser.on('result')` does NOT emit under ultracode - it HOLDS the result in `_heldResult` (emitting a superseded prior as an `[ultracode] workflow checkpoint` progress `system_notice`); the `exit` handler FLUSHES the last held result as the canonical `result`. **Don't move the finalize back onto the first `result`, and don't drop the exit-flush** - either regresses to the ack-as-answer bug. Don't ungate it either: normal CLI turns emit exactly one `result` then exit, and must stay byte-identical (they never hit the hold path). The flush fires on ANY exit when a held result exists (so a workflow that crashed mid-flight surfaces what it has rather than hanging the turn busy). The activity probe is safe for the long quiet gap: its silent-exit killer only fires on `!alive` past a grace window, never on an alive-but-quiet process, and the exit-flush settles the worker before the probe's next tick. See the Claude and Ultracode sections in `docs/PROVIDERS.md`.
197
202
  - **The ultracode FLEET watcher is read-only transient telemetry - `ultracode_fleet_progress` is NEVER persisted.** `server/src/ultracodeFleetWatcher.ts` polls the CLI WorkflowTool's background subagent transcripts (`<sessionId>/subagents/workflows/wf_*/…`) and emits a per-turn snapshot via `broadcastTransient` - it replaces the prior in place (like `context_usage`), so it never lands in events.jsonl. Turn-scoped (baselines pre-existing `wf_*` dirs so only this turn's runs count), started only when `ultracode && wf.primarySessionId`, torn down in the settle `finally`. It never writes run dirs and never steers (four-question test). Don't document it as an events.jsonl record and don't add a persist path.
198
- - **Auth-expired notices use a `[AUTH:<provider>]` content sentinel.** `ClaudeWorkerProcess` special-cases `authentication_error` in the `stream_error` handler (hard stop - does NOT set `_lastTransientError`, retrying doesn't refresh tokens). Cursor ACP is stranger: its long-lived process answers with ordinary assistant text `Please sign in to continue`, so `CursorAcpTurn` holds only that short candidate prefix, recognizes the exact settled response, emits `[AUTH:cursor]`, and retires the cached worker. This retirement is load-bearing - the auth-status poll reads `~/.config/cursor/auth.json` fresh but an already-running ACP child keeps its old auth state and binary. `ChatMessage` detects the prefix via `parseAuthNotice` and renders `AuthReloginNotice` instead of the italic system line; inline **RE-LOGIN** hits `/api/auth-login?provider=<name>`, whose router allowlist must include every supported sentinel provider (especially `cursor`, or it silently falls back to Claude). The same sentinel is emitted client-side by `TerminalInput`'s TUI-only slash-command guard (`/login`, `/logout`). Keep the emitters, parser allowlist, and HTTP router in sync.
199
- - **TUI-only slash commands are intercepted client-side.** `TerminalInput.handleSubmit` checks the first token against `TUI_ONLY_SLASH_COMMANDS` (18 Claude Code TUI commands: login/logout/context/clear/model/config/help/compact/cost/status/doctor/memory/agents/permissions/init/ide/bug/release-notes). Match → drop a local system message instead of sending. Arco runs `claude -p` so these never reach the interactive dispatcher; without the guard they hit the API as literal prompts (and expired `/login` attempts come back as 401s). Toolbox entries pass through - names don't collide.
203
+ - **Auth-expired notices use a `[AUTH:<provider>]` content sentinel.** `ClaudeWorkerProcess` special-cases `authentication_error` in the `stream_error` handler (hard stop - does NOT set `_lastTransientError`, retrying doesn't refresh tokens). Cursor ACP is stranger: its long-lived process answers with ordinary assistant text `Please sign in to continue`, so `CursorAcpTurn` holds only that short candidate prefix, recognizes the exact settled response, emits `[AUTH:cursor]`, and retires the cached worker. This retirement is load-bearing - the auth-status poll reads `~/.config/cursor/auth.json` fresh but an already-running ACP child keeps its old auth state and binary. `ChatMessage` detects the prefix via `parseAuthNotice` and renders `AuthReloginNotice` instead of the italic system line; inline **RE-LOGIN** hits `/api/auth-login?provider=<name>`, whose router allowlist must include every supported sentinel provider (especially `cursor`, or it silently falls back to Claude). The same sentinel is emitted client-side by the composer's TUI-only slash-command guard (`submitComposer.ts`) (`/login`, `/logout`). Keep the emitters, parser allowlist, and HTTP router in sync.
204
+ - **TUI-only slash commands are intercepted client-side.** `submitComposer` (`client/src/components/composer/submitComposer.ts`) checks the first token against `TUI_ONLY_SLASH_COMMANDS` (18 Claude Code TUI commands: login/logout/context/clear/model/config/help/compact/cost/status/doctor/memory/agents/permissions/init/ide/bug/release-notes). Match → drop a local system message instead of sending. Arco runs `claude -p` so these never reach the interactive dispatcher; without the guard they hit the API as literal prompts (and expired `/login` attempts come back as 401s). Toolbox entries pass through - names don't collide.
200
205
  - **Claude effort levels use doc overrides on top of `/v1/models`.** The live Anthropic catalog can lag newly-published model behavior; on 2026-05-30 it reported Opus 4.8 without `xhigh` while the current API and Claude Code docs list `low/medium/high/xhigh/max`. `effortsForModel()` unions live catalog levels with `CLAUDE_MODEL_EFFORTS` for known Claude IDs so pickers match the documented surface. Fable 5 / Mythos 5 and Opus 4.7/4.8 are adaptive-thinking models with `low/medium/high/xhigh/max`; keep 4.6/Sonnet 4.6 at `low/medium/high/max` (no `xhigh`). `ultracode` is intentionally not in `EffortLevel`: it is a Claude Code session setting (`xhigh` plus dynamic workflow permission), not an API effort value.
201
206
  - **ARG_MAX overflow on `--append-system-prompt`** (Claude). Long appendSystemPrompts can push argv past Linux's per-arg limit (~128 KB); the CLI `E2BIG`s the spawn. Mitigation in claude.ts: above `APPEND_SP_ARG_MAX` (64 KB) it writes the value to `/tmp/arco-prompts/append-sp-<id>-<pid>.txt` and passes it via the **separate** `--append-system-prompt-file` flag (a documented peer of `--append-system-prompt` in the CLI's bare help) - not the same flag with a path. If the tmpfile write fails it falls back to inline `--append-system-prompt`. Tmpfiles are cleaned up on settle and on server exit.
202
207
  - **A CLI that is installed but crashing must NOT collapse into "not installed" - `probeVersion` returns `'unknown'` (absent, ENOENT) vs `'broken'` (present, non-zero exit), and the PROVIDERS popover hides only the former.** 2026-09-03: the popover's own codex update command (`npm install -g @openai/codex@latest`, `capabilities.ts` `UPDATE_COMMAND`) silently skipped the 129 MB `@openai/codex-linux-x64` platform binary - it's an **optional** dependency, so npm exited 0 and reported success - leaving a launcher that threw `Missing optional dependency` on every invocation. `probeVersion` caught the throw and returned `'unknown'`, the popover's `version === 'unknown'` filter dropped the row, and CODEX vanished from the UI entirely: no error, no version, nothing to click. Auth compounded it - `getCodexAuthStatus` shells `codex login status`, so every profile reported logged-out despite intact `auth.json` files, sending the operator after a credential problem that did not exist. Three invariants: (1) keep the absent/broken distinction in `probeVersion` - collapsing them is what made the failure invisible; (2) `runCliUpdate` must not infer success from the version string merely *changing* (`'unknown' !== '0.153.1'` read as `updated: true` and rendered `→ vunknown`) - a post-update probe that can't report a version is a **failure**, and `probeFailureReason` re-runs the binary to surface its first `Error:` line; (3) an update failure is sticky in the popover (it survives the 6 s auto-clear) - auto-dismissing the only line that explains the breakage is how this stayed unexplained. Note the recovery trap: capabilities re-probe only at boot and every 4 h (`index.ts periodicCapabilityProbe`), and the sole manual re-probe is clicking the provider row - which is hidden while broken, so a service restart was the only way out.
@@ -229,10 +234,10 @@ Updater exit status and the post-update version are separate evidence. A nonzero
229
234
  - **Operator in-place compact (`native_compacted`) is replay-load-bearing - the live seed and the replay seed MUST be the same helper.** `worker.compactInPlace()` runs one summarization round, replaces `messages[]` with `compactSummarySeed(summary, keptTail)`, and persists a `native_compacted { summary, keptTail? }` event. On restart, `buildMessagesFromReplayEvents` and `summarizeClaudeNativePriorTurns` reset at that marker (same semantics as `handoff_artifact_ready`) and re-seed via the **same** `compactSummarySeed` - so a live worker and a replayed worker land on byte-identical history. If you fork the seed wording between the two sites, the prompt cache splits and a transcript diff shows phantom drift across a reload. `compactSummarySeed` lives in `resumeSummary.ts` (not the worker) precisely so both sites share it; don't inline a copy.
230
235
  - **Manual COMPACT must cold-acquire Native workers.** A restarted service, rehydrated tab, or post-handoff disposal can leave `workersByWorkflow` empty even though `events.jsonl` has completed turns to compact. `compactClaudeNativeWorker(workflowId, config)` must acquire a worker when needed and let `ensureStarted()` replay before `compactInPlace()` runs. Do not regress to a map-only lookup that tells the operator to "run a turn first" for an existing Native transcript.
231
236
  - **Native `inFlight` is per-provider-round, not durable busy state.** `streamOneRound()` installs a fresh `AbortController` for each Anthropic `messages.create`; successful turns and hard API failures MUST clear it before returning idle. `compactInPlace()` uses a non-aborted `inFlight` as the last defense against compacting during a live request, so a stale controller after a completed/terminated turn makes COMPACT falsely fail with "a turn is in flight" even though `wf.busy` and the UI are idle.
232
- - **COMPACT summarizes a clean conversational projection, never raw live tool protocol.** A cancelled/interrupted Native tool loop can leave an assistant `tool_use` without the immediately-following user `tool_result` Anthropic requires. Normal turns call `pruneOrphanToolUse()` before appending the next operator prompt; `compactInPlace()` must do the same before its summary round and emit the same visible `ctx_action`. The summary request then uses `projectCompactSummaryMessages()` so even older completed `tool_use` / `tool_result` blocks are stripped before hitting `messages.create`; replay never reconstructs those protocol blocks either, and the compact summary only needs the visible user/assistant text.
237
+ - **COMPACT summarizes a clean conversational projection, never raw live tool protocol.** A cancelled/interrupted Native tool loop can leave an assistant `tool_use` without the immediately-following user `tool_result` Anthropic requires. Normal turns call `pruneOrphanToolUse()` before appending the next operator prompt; `compactInPlace()` must do the same before its summary round and emit the same visible `ctx_action`. The summary request then uses `projectCompactSummaryMessages()` so even older completed `tool_use` / `tool_result` blocks are stripped before hitting `messages.create`; replay never reconstructs those protocol blocks either. The completed work is not dropped: each tool call (name and input, capped at 500 characters), its result, web search queries with result titles and URLs, and web fetch URLs with the fetched text become plain text, each result capped at `SUMMARY_TOOL_RESULT_MAX_CHARS` (2,000). No tool block or tool id reaches the summarizer. A summary built from visible text alone omits completed tool work. The kept tail still uses the text-only flattening, because it must match replay byte for byte. `compactSplit()` decides what is summarized: the last `keptTail.length` raw messages are left out only when they are exactly the kept tail; when tool messages or collapsed same-role text sit among them, the whole history is summarized and the tail is still kept (it repeats a little of the summary, and the latest messages stay word for word), because cutting by the tail's length dropped a `peer_read` result from both the summary and the tail.
233
238
  - **Arco keep-last-N tail rides the EVENT, not the post-marker event stream.** The kept verbatim tail (last ~3 user/assistant pairs, `projectKeptTail` in `workerHelpers.ts`) consists of messages that occur BEFORE the marker, so replay (which resets at the marker) would lose them - they're persisted in `native_compacted.keptTail` and re-appended via the SAME `compactSummarySeed(summary, keptTail)` at both sites. The projection mirrors replay's own shape: it skips tool_use/tool_result/image-only/empty messages (replay never reconstructs those), collapses consecutive same-role messages to the most recent, and drops any leading assistant so the tail starts on a `user` boundary (the seed ends on an assistant ack - a leading assistant would invert the order Anthropic rejects). Don't persist raw `messages[]` (tool_use blocks) into `keptTail` and don't change the projection on only one of the two sites - the live `messages[]` and the replayed array must consume the SAME persisted `keptTail`. Byte-identity is pinned by `npm run test:resume-summary -w server` ("compact keep-tail: live seed and replay reseed are byte-identical").
234
239
  - ** compaction takeover must always have a clear path - it can't strand.** `native_compacting` (emitted from `compactInPlace` BEFORE the summary round, once for both the manual button and the auto path) flips the client `JobState.compacting` overlay. The flag is cleared on FOUR signals so it can never stick: `native_compacted` (success), a compaction-failure `system_notice` (the no-`native_compacted` path - the empty/failed summary leaves history untouched and emits ONLY a `Compact failed` / `Compaction skipped` notice; matched by `isCompactionFailureNotice`, unit-pinned by `npm run test:compacting-notice -w client`), `primary_turn_started` (a real turn resumed), and `turn_cancelled`. Do NOT clear it on `primary_turn_ended` - the manual COMPACT path fires a transient `primary_turn_ended` right after `native_compacted`, and clearing there would wipe the post-compaction "Continue" affordance the operator hasn't clicked yet. `native_compacting` is advisory on replay (the takeover is live-only; replay never re-opens it).
235
- - **Auto-continue is opt-in and goes through the normal operator path.** `nativeCompactAutoContinue` (default false) is the ONLY thing that makes `maybeAutoContinueAfterCompact` dispatch the continuance turn (`COMPACT_CONTINUE_PROMPT`) after a successful compaction - via `handleUserMessage`, so it's a real, visible turn in `events.jsonl`. It applies only to automatic compactions (`handleCompactWorkflow` with `autoDetail`); the manual COMPACT button never auto-continues. Default is MANUAL (the operator clicks COMPACTED: CONTINUE in the composer) because between-turn compaction ends the turn, so auto-continuing is autonomous continuation (CLAUDE.md autonomy fence). The auto path only fires when `ws`/`session` are in scope (the operator's connection) - the `__debug_native_auto_compact_probe` smoke passes neither, so it never auto-continues (no API spend). Only the automatic path (`handleCompactWorkflow` reached from `maybeAutoCompactPolicy` with `autoDetail`) calls `maybeAutoContinueAfterCompact`; the COMPACT button must not.
240
+ - **Auto-continue is opt-in and goes through the normal operator path.** `nativeCompactAutoContinue` (default false) is the ONLY thing that makes `maybeAutoContinueAfterCompact` dispatch the continuance turn (`COMPACT_CONTINUE_PROMPT`) after a successful compaction - via `handleUserMessage`, so it's a real, visible turn in `events.jsonl`. It applies only to automatic compactions (`handleCompactWorkflow` with `autoDetail`); the manual COMPACT button never auto-continues. Default is MANUAL (the operator clicks COMPACTED: CONTINUE in the composer) because between-turn compaction ends the turn and an automatic continuation requires explicit opt-in. The auto path only fires when `ws`/`session` are in scope (the operator's connection) - the `__debug_native_auto_compact_probe` smoke passes neither, so it never auto-continues (no API spend). Only the automatic path (`handleCompactWorkflow` reached from `maybeAutoCompactPolicy` with `autoDetail`) calls `maybeAutoContinueAfterCompact`; the COMPACT button must not.
236
241
  - **In-turn auto-compaction keeps the in-progress round raw.** `maybeCompactInTurn` runs in the tool loop after the round's `tool_result` message is appended and before the steer drain and the next request. Everything before the round's assistant message is summarized; the round itself (thinking, `tool_use`, `tool_result`) is re-appended after `inTurnCompactedHistory`'s user note, so no tool call loses its result and roles keep alternating. `turnMessageStart` moves to the note, since end-of-turn telemetry and evidence pruning index from it. One compaction per crossing (`inTurnCompact.fired`, cleared by a request below the threshold or a manual COMPACT); do not loop on a compaction that did not bring usage down. Replay resets at the `native_compacted` marker and rebuilds the note from `continueNote` so the rest of that turn's text pairs with it.
237
242
  - **Between-turn auto-compaction uses the manual COMPACT path.** Provider defaults to 90% for Claude Native and Ollama, leaving 10% headroom; explicit policies take precedence. A fresh reading and ownership checks guard Native compaction, and auto-fold consumes the boundary before a second action. Claude API compaction is a separate per-tab beta and stays opt-in.
238
243
  - **OAuth refresh races.** `proper-lockfile` serializes the read-refresh-write cycle on `~/.arco/auth.json`. The lock is **not** held across the SDK call - only across the token rewrite. Two workers refreshing simultaneously: both acquire the lock in turn, the second sees the freshly-written token from the first and skips its own refresh. Don't hold the lock across `messages.create`; you'll deadlock the second worker against a 30-second SDK request.
@@ -265,7 +270,7 @@ Updater exit status and the post-update version are separate evidence. A nonzero
265
270
  - **Capability lookups key on `capModel`, never on a raw alias.** The `opus` / `opus[1m]` aliases are absent from `/v1/models`, so a catalog lookup keyed on the alias returns `null` and silently disables ctx-management/compact gating - the same class of miss that once gave alias tabs `max_tokens: 8192` and a dead effort knob (Opus-5 plan). The worker resolves capabilities through `capModel` (echoed concrete id, persisted to `meta.resolvedModelId`, restored on rehydrate only while `config.model` is still an alias, falling back to the catalog alias resolution before the first echo). Static alias entries in `modelParams.ts` / `models.ts` cover turn 1 before any echo. If you add a new capability decision to the worker, route it through `capModel`, not `this.config.model`. Turn-1 shape pinned by the alias test in `workerParity.test.ts`.
266
271
  - **The request `model:` field must be a CONCRETE id - never a family alias.** The Messages API has no alias resolution: `model: "opus"` returns `not_found_error: model: opus`. Only the Claude Code *CLI* resolves `opus` / `sonnet` / `haiku` / `opus[1m]`, client-side, before calling the API - which is why the aliases are safe on the CLI transport and fatal on Native. Dispatch now goes through `requestModel()` → `resolveClaudeAliasFromCatalog()` (newest in-family id by `created_at`, `CLAUDE_ALIAS_FALLBACK` when the catalog is cold; `ensureStarted` warms the catalog once for alias tabs). The tab's configured model stays the alias, so auto-tracking survives where it actually belongs - in the resolution, not the wire. If you add a new `messages.create` / `countTokens` call site, use `this.requestModel()`, not `this.config.model`.
267
272
  - **A controlled `<select>` whose `value` matches no `<option>` silently renders the FIRST option - and fires no `onChange`.** This is how the alias bug stayed invisible: the creator, CONFIG, and tab-context-menu model pickers all build options from the live catalog (which excludes aliases) while their value came from stored defaults, so a tab on `opus` *displayed* "OPUS 5" everywhere, and re-picking the displayed option in CONFIG was a no-op that couldn't repair it. Creator + context menu now reconcile state to the option list on change; CONFIG renders the unmatched value as an explicit `(unlisted)` option instead of hiding it. Any new picker fed by a live catalog needs one of those two treatments - never assume the stored value is in the list.
268
- - **A refusal is a 200, not an error - and never regex-detect it.** `stop_reason: 'refusal'` arrives on a successful response, so `errorClassifier` (which only sees thrown errors) can never surface it; `runTurn` branches on the stop reason, emits a `system_notice` naming `stop_details.category`/`explanation` (both nullable - guard) and a durable `primary_refusal` event. The malformed turn needs no special pruning: the per-request `scrubEmptyTextContent` / `stripTrailingThinkingBlocks` pass repairs an empty or thinking-terminated assistant message before the next `messages.create`. Do NOT add a text/regex refusal detector - server-side model judgment on content is on the wrong side of the CLAUDE.md § Non-goals fence; `stop_reason` is the structured ground truth.
273
+ - **A refusal is a 200, not an error - and never regex-detect it.** `stop_reason: 'refusal'` arrives on a successful response, so `errorClassifier` (which only sees thrown errors) can never surface it; `runTurn` branches on the stop reason, emits a `system_notice` naming `stop_details.category`/`explanation` (both nullable - guard) and a durable `primary_refusal` event. The malformed turn needs no special pruning: the per-request `scrubEmptyTextContent` / `stripTrailingThinkingBlocks` pass repairs an empty or thinking-terminated assistant message before the next `messages.create`. Do NOT add a text/regex refusal detector - server-side model judgment is not a substitute for the structured provider response; `stop_reason` is the structured ground truth.
269
274
  - **Reviewers / handoff seeds always run on CLI transport.** They leave `claudeTransport` unset, the dispatcher falls through to the CLI provider. Don't thread `claudeTransport` through `handleReviewRequest` / `handleHandoffRequest` / `handleSpawnFromHere` / `runExportContext` - Native sessions are Arco-internal and the handoff destination needs a `--resume`-able CLI session on disk.
270
275
  - **Per-tab toggle does NOT dispose a running worker.** Flipping CONFIG-tab `cli` ↔ `native` mid-turn is a no-op against the in-flight turn. The next operator turn picks up the new transport. Mirrors Codex's contract.
271
276
  - **Plan-mode gates `Write` / `Edit`, NOT `Bash`.** EnterPlanMode flips a per-worker boolean that short-circuits the `Write` and `Edit` dispatchers. `Bash` is intentionally not gated - detecting "write intent" in arbitrary shell commands generically (sed -i, redirection, grep -l & rm pipelines, in-place git operations) would be a regex arms race with high false-positive cost. Operators relying on plan mode as a hard write barrier should rely on the surrounding sandbox or CI contract; the per-tool gate is for the *common* footgun of the model patching files before sketching the plan, not a universal write firewall. Plan-parser advisories surface from `EnterPlanMode` as part of the tool result (warnings only, never reject - model corrects on next turn).
@@ -334,7 +339,7 @@ Updater exit status and the post-update version are separate evidence. A nonzero
334
339
  Manual COMPACT is a valid pressure valve, but it is intentionally lossy: Codex replaces older conversation detail with its compacted summary. Use Handoff or source artifacts when exact historical wording is load-bearing.
335
340
  - **Arco adopts ONLY the turns it starts, and clears Codex's native thread goal on every bootstrap.** Codex persistent goals can start additional turns without an operator request. Two guards prevent this: (1) `turn/started` adopts an id only when `current.startedAt` is set by `beginTurn()` before the `turn/start` RPC. (2) `clearThreadGoal()` sends `thread/goal/clear` after every `thread/start` / `thread/resume` (best-effort, never fails bootstrap), and a `thread/goal/updated` notification re-clears and surfaces a `system_notice`. Only bootstrap failures bump the spawn-failure breaker in `codex-appserver/index.ts`; a `beginTurn` pre-flight throw does not indicate a failed child process.
336
341
  - **Consecutive `agentMessage` items need an explicit `\n\n` separator.** Codex emits a fresh `agentMessage` item for each narration block between tool calls; the `item/agentMessage/delta` deltas within one item are continuous, but Codex inserts NO separator between items. Streaming each delta straight into `appendText` therefore glued the blocks into a wall of text (`…release process.Kernel.org confirms…`). `worker.ts` tracks `current.lastAgentMsgItemId` (from the delta's `itemId`) and appends `\n\n` when the id changes (guarded on prior-text-exists so the first block gets no leading break). Don't drop the tracker - the boundary is the only place the paragraph break can be reconstructed (no delimiter survives downstream to split on). The `exec` transport (`codex-stream.ts`) has the same latent issue but emits whole items rather than deltas; if you see walls there, the fix is the same item-boundary `\n\n`.
337
- - **Effort enum is `none|minimal|low|medium|high|xhigh`, not just `low/medium/high`.** Pre-2026-05 mappers downgraded `xhigh`/`max` → `high` thinking Codex topped out there; the actual ceiling is `xhigh` ("Extra high" in the CLI picker). Pass `xhigh` through to the appserver and `-c reasoning_effort=xhigh` to exec. Arco's `max` (an Arco-only level) collapses to Codex's `xhigh`. **Catalog-aware downgrade**: if the active model's catalog entry doesn't list the requested effort under `supportedReasoningEfforts`, mappers fall back to the highest supported effort instead of letting the appserver 400. See `docs/PROVIDERS.md § Codex § Live model catalog`.
342
+ - **Effort passes through as `low|medium|high|xhigh|max|ultra`.** Pre-2026-05 mappers downgraded `xhigh`/`max` to `high`; both transports' mappers (`baseMapEffort` in `codex-appserver/worker.ts`, `baseMapEffortToReasoning` in `codex.ts`) now pass each level through unchanged, to the appserver and as `-c reasoning_effort=<level>` to exec (see the entry on `max` and `ultra` above). **Catalog-aware downgrade**: if the active model's catalog entry doesn't list the requested effort under `supportedReasoningEfforts`, mappers fall back to the highest supported effort instead of letting the appserver 400. See `docs/PROVIDERS.md § Codex § Live model catalog`.
338
343
  - **Hardcoded `CODEX_MODELS` in `shared/src/protocol/models.ts` is a fallback only** (protocol types now live under `shared/src/protocol/`; `protocol.ts` is a thin re-export barrel). The picker reads from the live `/api/codex/catalog` snapshot; the static list serves only on cold-start or when the appserver isn't reachable. Don't keep the hardcoded list in sync as a primary source of truth - operator-facing model freshness comes from the catalog poll. The `CODEX_MODEL_INFO` static effort table is a tertiary fallback for `effortsForModel` (after live catalog → CODEX_MODEL_INFO → effortsForProvider).
339
344
 
340
345
  ## Media ops FFmpeg wrapper (H6 audio + H7 video)
@@ -424,7 +429,7 @@ The N3 ops (`framegrab` / `gif` / `geometry` / `speed` / `gain` / `spectrogram`
424
429
 
425
430
  ## Ollama
426
431
 
427
- - **Cache prefix invariance.** Ollama's prefix cache hits on byte-identical message stack prefixes. Anything that mutates the system prompt or transcript bytes between turns flushes the cache: timestamps, random ids, switching `effort` mid-workflow (low → high invalidates because `/no_think` toggles), changing `OLLAMA_PRIMARY_SYSTEM_PROMPT`, or per-request `options` overrides. Plan §5.5 deliberately doesn't surface inline `num_ctx`/sampler overrides for this reason - those live in the Modelfile so they stay byte-stable across spawns.
432
+ - **Cache prefix invariance.** Ollama's prefix cache hits on byte-identical message stack prefixes. Anything that mutates the system prompt or transcript bytes between turns flushes the cache: timestamps, random ids, switching `effort` mid-workflow (low → high invalidates because `/no_think` toggles), changing `OLLAMA_PRIMARY_SYSTEM_PROMPT`, or per-request `options` overrides. Ollama ADVANCED PARAMS can override `num_ctx` and sampler settings per tab; changing parameters can invalidate the cached prefix.
428
433
  - **Single-slot, single-model.** `OLLAMA_NUM_PARALLEL=1` and `OLLAMA_MAX_LOADED_MODELS=1` are required for cache reliability. Concurrent workflows hitting the same daemon serialize at the daemon level. Without these, Ollama allocates separate decode slots per request and the prefix cache fragments.
429
434
  - **Polite eviction default.** `keep_alive: '10m'` per request - model evicts 10 minutes after the last Arco turn, freeing VRAM for Resolve / games. `OLLAMA_KEEP_ALIVE` env at the daemon level does NOT win over the per-request value (only matters for non-Arco clients hitting the same daemon).
430
435
  - **`MAX_TOOL_TURNS = 50` default cap.** Hard limit per primary turn, tunable with `ARCO_OLLAMA_MAX_TOOL_TURNS` up to 200. A workflow that hits the cap is suspect; split the task or open an issue. Reset on the next operator turn.
@@ -435,10 +440,10 @@ The N3 ops (`framegrab` / `gif` / `geometry` / `speed` / `gain` / `spectrogram`
435
440
  - **Read tool cap is 32 KB, not 256 KB.** Local model windows are smaller than Claude's; a single big Read can overflow context, and 5 parallel Reads definitely will. Models that need more from a file should use the Claude-shape `offset` (1-based start line) and `limit` (max lines) args. Don't bump the cap without a similar bump to `num_ctx` in every Modelfile.
436
441
  - **Vision support depends on the selected backend.** A model can advertise image input while a backend lacks the matching architecture or projector support. Use a model and loadout the selected backend supports.
437
442
  - **Tool runtime is server-side.** Ollama's `/api/chat` returns `tool_calls`; Arco executes them in `OllamaWorkerProcess.dispatchToolCalls()` (see `ollamaTools.ts`). Path validation lives in the executor, not the loop. v1 allowlist is Read/Glob/Grep/Write/Bash/WebSearch/WebFetch - don't expand without a security pass on the new tool's blast radius.
438
- - **SAFE mode = denial string, not protocol pause.** SAFE mode (operator's `skipPermissions: false`) returns a denial string as the tool result so the loop converges without a new approval-protocol surface. Operator-level cancel still works at any point. This is intentional per plan §5.4 design choice (a).
443
+ - **SAFE mode = denial string, not protocol pause.** SAFE mode (operator's `skipPermissions: false`) returns a denial string as the tool result so the loop converges without a new approval-protocol surface. Operator-level cancel still works at any point.
439
444
  - **Stream EOF drains the trailing buffer.** `streamOneTurn`'s NDJSON loop synthesizes a `\n` and re-splits when `reader.read()` returns `done:true` with non-empty `buf`. Without this, daemons that close the stream right after the final `done:true` envelope (no trailing newline) drop token counts (`prompt_eval_count` / `eval_count`) and `total_duration`, breaking the CTX-bar denominator. Don't simplify the loop back to plain `if (done) break`.
440
445
  - **Malformed tool-arg JSON surfaces an explicit `argError`, not a defaulted `{}`.** When `message.tool_calls[].function.arguments` is a JSON string that fails to parse, the call carries an `argError` and `dispatchToolCalls` short-circuits with `[error] tool "X" arguments rejected: ...`. A silent `args = {}` was firing tools against the wrong target and producing confusing tool results. The model needs to see the parse failure to retry correctly.
441
- - **WebFetch pre-resolves DNS and re-validates resolved IPs.** `dns.lookup({ all: true })` runs before `fetch()` and every resolved IP gets re-checked through `isPrivateOrLoopbackHost`. Hostname-string matching alone is bypassable via DNS rebinding (attacker returns public IPs to our lookup, loopback IPs to fetch's lookup). There's a residual TOCTOU window when fetch re-resolves; documented in the code. Don't drop the pre-resolution.
446
+ - **WebFetch pre-resolves DNS and re-validates resolved IPs.** `fetchFileContent` (`server/src/fileFetch.ts`) runs `dns.lookup({ all: true })` before each request, including each redirect, and re-checks every resolved IP through `isPrivateFetchHost`. Hostname-string matching alone is bypassable via DNS rebinding (attacker returns public IPs to our lookup, loopback IPs to fetch's lookup). There's a residual TOCTOU window when fetch re-resolves; documented in the code. Don't drop the pre-resolution.
442
447
  - **`tool_choice` / `functions` make Ollama HANG - strip them.** litellm's hard-won lesson: Ollama's `/api/chat` does NOT understand the OpenAI-style `tool_choice` / `functions` fields and **hangs** if they're present. `streamOneTurn` has a belt-and-suspenders `delete raw.tool_choice; delete raw.functions` before send. Arco doesn't currently set them, but the guard is there against a future regression; don't remove it, and don't add either field to the request shape.
443
448
  - **`format` and `tools` are mutually exclusive on the wire.** The structured-output `format` field is only sent when **no** tools are advertised (`format && !(tools?.length)` in `streamOneTurn`) - `format` constrains the sampler to JSON and suppresses `tool_calls`, so sending both yields a tool-less turn. The Review path exploits this deliberately: the tool-loop runs free (native tools, no `format`), then ONE schema-constrained synthesis turn sends `format` with tools omitted. Don't "simplify" by always attaching `format`.
444
449
 
@@ -514,7 +519,24 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
514
519
  - **Cursor's separate `Other Models` meter is `apiPercentUsed`, not a share of local event totals.** The X-dot (Cursor) hover renders it as a second bar alongside the blended included-plan gauge. Keep both percentages sourced directly from `/api/usage-summary`; dashboard events are bounded/display-oriented and cannot reconstruct either quota safely.
515
520
  - **Cursor bakes reasoning effort into the model id - the worker IGNORES `config.primaryEffort`.** Catalog ids carry the effort (`grok-4.5-xhigh`, `-low`/`-high`/`-max`), so there is no separate effort surface. The picker (`CursorModelSelect`) moves family×effort×flags coordinates and then LOOKS UP the exact catalog id (`resolveCursorModelId`) - it never concatenates one; effort display parses the effort back OUT of the id (`parseCursorModelId`), never `config.primaryEffort`. The worker maps the bare id to the ACP bracket-param form (`grok-4.5[effort=high,fast=true]`, Auto = `default[]`). Don't synthesize model ids or thread `primaryEffort` into a Cursor turn.
516
521
  - **Cursor COMPACT must send `/compress` as the ENTIRE ACP prompt.** Normal Cursor turns prepend north-star + cluster plan/role/doctrine before `session/prompt`; sending `/compress` through `beginTurn()` therefore bypasses Cursor's slash-command parser and wastes a model turn. `compressConversation()` is the dedicated unprefixed path, gated by the cached `available_commands_update` snapshot when one has arrived. The worker header says `CTX: Cursor-managed` because Cursor ACP still emits no `usage_update` / retained prompt count; dashboard billing totals are not a context-fill signal. No signal means no Cursor threshold auto-handoff - don't manufacture a percentage from bytes or billed tokens.
517
- - **`sandbox: 'read-only'` is the exclusive signal that routes a Cursor turn to the stateless print path - primitives MUST NOT reuse the ACP worker cache.** Reviewer / fresh-summarizer / DOCS / research / compare primitives carry the *initiating* tab's `workflowId`; the ACP worker is cached per `workflowId` (`workersByWorkflow`), so reusing it would run the primitive INSIDE the operator's live Cursor session (transcript pollution, primary model, read-write). The dispatcher routes `name === 'cursor' && config.sandbox === 'read-only'` to `CursorPrintProvider` (`cursor-agent -p --mode ask`, read-only Q&A) instead. Primary turns never set `sandbox: 'read-only'`; the handoff/summarizer spawn does (`exportContext.ts`, load-bearing for this routing). Task-child / spawn-from-here tabs carry their own `workflowId` and no read-only sandbox, so they keep the full ACP worker.
522
+ - **Read-only Cursor primitives use the stateless print path and MUST NOT reuse the ACP worker cache.** Saved Chat and isolated Cursor members also use print paths. Reviewer / fresh-summarizer / DOCS / research / compare primitives carry the *initiating* tab's `workflowId`; the ACP worker is cached per `workflowId` (`workersByWorkflow`), so reusing it would run the primitive INSIDE the operator's live Cursor session (transcript pollution, primary model, read-write). The dispatcher routes `name === 'cursor' && config.sandbox === 'read-only'` to `CursorPrintProvider` (`cursor-agent -p --mode ask`, read-only Q&A) instead. Primary turns never set `sandbox: 'read-only'`; the handoff/summarizer spawn does (`exportContext.ts`, load-bearing for this routing). Task-child / spawn-from-here tabs carry their own `workflowId` and no read-only sandbox, so they keep the full ACP worker.
523
+
524
+ ## Antigravity CLI
525
+
526
+ Antigravity CLI runs Google's own `agy acp` on the operator's sign-in. These traps keep it within that sign-in's terms; see `docs/PROVIDERS.md` (Antigravity CLI) and `docs/PROTOCOL_CLUSTER.md` (Gemini members).
527
+
528
+ - **A Gemini member turn starts only from an operator action.** `isOperatorSendOnlyProvider` (`shared/src/protocol/clusters.ts`) marks `antigravity-cli`. NUDGE or a message typed in its composer mints a single-use ticket bound to the member and the exact text (`server/src/geminiMembers.ts`), and `handleUserMessage` starts a Gemini member turn only with a valid ticket, checked again when a queued message is taken. AUTO-PICKUP, Smart pickup, busy reminders, task dispatch, broadcasts, CONTINUE DIRECTOR, timers and retries carry no ticket. Do not add an automatic wake path for this provider; mail to it waits in its mailbox.
529
+ - **A Gemini replacement starts fresh.** `cluster_member_replace` refuses history for it, because the first NUDGE carries the role and cluster instructions as visible text.
530
+ - **Scheduling requests are refused.** `providers/acp/permissionGate.ts` declines a permission request that names scheduling, cron or automation and posts a notice; scheduling needs unattended execution. The CLI can still act without asking according to its own configuration, so the AUTO/SAFE gate is not a promise that every action is seen.
531
+ - **The Chat working folder is not a fence.** A saved Antigravity Chat works in `ARCO_HOME/chat-workspaces/<chat-id>` (`chatMode.ts`), which is deleted with the Chat. Tools can reach whatever the user's account can reach.
532
+ - **Gemini for research is a separate sign-in.** Its home is `~/.arco/antigravity-research`; for each researcher turn the sign-in file is copied into the researcher's private home inside the Linux worker sandbox (`workers/antigravityIsolatedLaunch.ts`). Never point a researcher at the operator's main Antigravity sign-in.
533
+
534
+ ## Research isolation
535
+
536
+ - **Researchers fail closed.** RESEARCHER is ISOLATED: a private workspace under `~/.arco/clusters/<clusterId>/isolates/<workflowId>/workspace`, mail only with the Research Director. Claude Native, Ollama and llama.cpp have no shell and their file tools are rooted in that workspace. Claude CLI, Codex, Cursor and Gemini researchers run only inside the Linux worker sandbox after their own preflight; a failed preflight stops the turn instead of running unfenced.
537
+ - **CLI versions are pinned for research.** Codex researchers need `RESEARCH_CODEX_VERSION` (`providers/codexVersion.ts`, 0.171.0) and Cursor researchers `ISOLATED_CURSOR_MIN_VERSION` (`providers/cursor/isolatedVersion.ts`, 2026.11.22). Raise them only after the sandbox has been checked against the new CLI.
538
+ - **Researcher files cross by copy, with limits.** `peer_send` `artifact_paths` is accepted only from isolated members: at most 8 regular workspace files and `MAX_ARTIFACT_BYTES` (256 KB) in total; links and hard links are refused (`clusterPeerOps.ts`, `clusterMailbox.ts`).
539
+ - **Arco's storage checks compare real paths.** `arcoHome()` returns the real folder, so a home behind a link or a Windows short name still matches the real paths of Arco's own folders (research conversations, Quick research folders, scratch). Compare against `arcoHome()`, never against a path rebuilt from `HOME`.
518
540
 
519
541
  ## Chat / UI
520
542
 
@@ -560,14 +582,14 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
560
582
  - **Long-session hydration is tail-first**: server splits `loadSessionJsonl` into `earlier` + `tail` (last 200), emits only `tail` as `session_entry`, stores `earlier` on `WorkflowState.pendingEarlierEntries`, sends `SessionHistoryStatusMessage { hasEarlier, earlierRemaining }`. Client renders "↑ LOAD EARLIER MESSAGES" pill; click dispatches on `earlierSource` (`'ws'` for JSONL queue, `'transcript'` for REST paging). Scroll preserved via pre-click `scrollHeight` capture + post-layout shift. `MAX_CHAT_MESSAGES` cap removed from `upsertSessionChat` (would drop oldest-of-tail first under paged inserts). events.jsonl replay on reconnect is deliberately untouched - lastSeq-gated; partial replay risks stranding streaming `primary_text` without matching `primary_complete`.
561
583
  - **Chat renders Claude tool_use blocks inline** as `ToolCallPill` between assistant bubbles. `toSessionEntries` emits `tool_use` entries alongside `message` entries (discriminated `SessionEntryMessage.entry`); `ChatMessage` dispatches on `message.toolUse`. Claude-only (uses session JSONL). Inline pills for Codex would need a rollout-file watcher parallel to Claude's session-JSONL watcher.
562
584
  - **Seed-bubble pills are detection-string-coupled to the server - three consumers.** `HandoffSeedPill` matches `startsWith('[HANDOFF - new session initialized for this tab.')` emitted by `handleHandoffRequest`; `ChatPanel`'s PRIOR-SESSIONS compression uses the same prefix to find handoff boundaries; `server/src/primitives/reviewContent.ts` uses it again to scope the `current-session` Review option. `SpawnSeedPill` matches suffix `\n\n---\n\nNew direction: ` or `\n\n---\n\nRead the handoff above. Acknowledge with "READY"` emitted by `handleSpawnFromHereRequest`. Change the seed string and all four sites go silently dormant - compression stops grouping, Review `current-session` degrades to `full`, pills render as regular long-user messages. Change detection + server strings together.
563
- - **Long-user-message auto-collapse thresholds** (`ChatMessage.tsx`): 800 chars OR 12 lines. Pastes over either threshold route to `LongUserMessage` pill (expandable, same pattern as `HandoffSeedPill`). Attachment chips stay visible on the collapsed pill so operators can see what was sent. Content is always sent verbatim to the agent regardless of render state - only composer transform is `value.trim()` at `TerminalInput.handleSubmit`.
585
+ - **Long-user-message auto-collapse thresholds** (`ChatMessage.tsx`): 800 chars OR 12 lines. Pastes over either threshold route to `LongUserMessage` pill (expandable, same pattern as `HandoffSeedPill`). Attachment chips stay visible on the collapsed pill so operators can see what was sent. Content is always sent verbatim to the agent regardless of render state - only composer transform is the draft `trim()` in `submitComposer` (`client/src/components/composer/submitComposer.ts`).
564
586
  - **Prior-sessions compression collapses everything through the _most recent_ handoff seed** - one pill at the top, not nested per-handoff. Expanding re-inlines the full history with intermediate handoff seeds rendering as their own `HandoffSeedPill` pills (stacked handoffs still navigable). Message count for the label filters out `toolUse` entries so "N messages" reflects real turns, not tool-call rows.
565
587
  - **Operator-message and `LongUserMessage`-expanded text is linkified via `utils/linkify.tsx`**. Operator messages render as plain text (no markdown, intentionally - operator markdown in the composer would be surprising), so the linkifier is the only path that makes URLs clickable there. Assistant messages go through remark-gfm + the `a → target="_blank"` override and don't need it. Linkifier strips trailing punctuation (`. , ; ) ]`) off the URL so "see https://example.com." links the URL and leaves the period.
566
588
  - **Attachment pills open `FileViewerModal`, not a custom viewer.** `AttachmentPill` (used by `ChatMessage` + `LongUserMessage`) opens the uploaded file's absolute path via `/api/file-content`. Uploads live in the configured uploads folder (see `POST /upload`), including the runtime home for a packaged install. The file-content endpoint confines reads to permitted roots and checks spelling and canonical paths. Runtime-home access permits only the uploads directory and direct files in it; nested paths and protected state remain denied, including through aliases.
567
589
  - **Client `sessionChat` is deliberately NOT cleared on `handoff_complete`** - pre-handoff content stays visible above the `[HANDOFF]` marker for continuity.
568
590
  - **`ChatMessage.tsx` ReactMarkdown overrides `a → target="_blank" rel="noopener noreferrer"`** so URLs the primary emits don't navigate the Arco tab away. Other ReactMarkdown sites (modals/dialogs) deliberately unchanged until a concrete report hits them.
569
591
  - **`TerminalInput.isBusy` is a three-way OR**: `(job.busy === true) || hasActiveWorkers || hasStreaming`. Any code path that ends a turn must clear all three, or the composer stays locked in interjection mode. Normal turn-end works because `primary_complete` fires `finalizeMessage` (flips the live message's `isStreaming: false`) and `primary_turn_ended` fires `endPrimaryTurn` (flips `busy: false`). The cancel path skips `primary_complete` - `endPrimaryTurn` therefore also walks `job.messages` and finalizes any `isStreaming: true` entries itself (matches `applyWorkflowSnapshot`'s behavior when it sees `busy: false`). `recordTurnCancelled` does the same defensive clear so the cancel path doesn't depend on a trailing `primary_turn_ended` to unstick the composer. If you add a new "turn ended" event, either route it through `endPrimaryTurn` or replicate the streaming-finalize step explicitly.
570
- - **The composer diagnostic chip (`b·w·s`) is intentional, not debug noise.** Renders next to CANCEL whenever `isBusy` is true. Tells the operator (and the next agent debugging a stuck composer) which of `busy` / `activeWorkers` / `streaming` is keeping the composer in queue mode. If you remove it, you lose the one-glance diagnostic for stuck-composer reports.
592
+ - **The composer diagnostic chip (`b·w·s`) is intentional, not debug noise.** Renders next to CANCEL whenever `isBusy` is true (the mobile view uses `PhoneSendButtons` and shows neither). Tells the operator (and the next agent debugging a stuck composer) which of `busy` / `activeWorkers` / `streaming` is keeping the composer in queue mode. If you remove it, you lose the one-glance diagnostic for stuck-composer reports.
571
593
  - **Late `primary_text` frames must be finalized AND coalesced, not opened as fresh streams nor split one-bubble-per-delta.** The server's turn-settle path resolves on a microtask, so a `worker_text` event dispatched between the parser's `result` and that microtask broadcasts AFTER `primary_turn_ended` has already cleared `isStreaming` and `busy` on the client. The naive `if (!ref[key]) { mintFreshStreamingMessage(...) }` path created a new `isStreaming: true` message that nothing would ever finalize (`primary_complete` already fired), and the composer stayed pinned in queue mode (`b0·w0·s1`) until the next turn. An earlier fix pushed each not-in-progress chunk as its own *finalized* message - which unstuck the composer but introduced a worse symptom: a late burst is rarely one chunk (the final answer can stream as dozens of deltas after `primary_turn_ended`), so the answer fragmented into a stack of one-token `< ARCO :: PASSTHROUGH` rows. That fragmented state then persisted to localStorage and reappeared verbatim on reload, while a clean seq-ordered RESUME replay (where the text sits *before* `primary_turn_ended` on disk) showed it coalesced: a reload looked fragmented while a resume looked correct. Current fix in `handleServerMessage.ts`'s `primary_text` handler: in the not-in-progress branch, reuse `ref[key]` as a coalesce target - first chunk mints ONE `isStreaming:false` bubble, subsequent chunks append. Same path also covers a `rehydrate_workflows` replay whose window opens mid-turn (`clientLastSeq` fell between turn start/end, so the bracketing `primary_turn_started` was never re-sent → `turnInProgress` stays false for the whole replayed burst). Because the late branch now SETS `ref[key]`, `primary_turn_started` must also null the phase refs (it didn't before) so a stale late ref can't leak into the next turn and absorb its text. Don't simplify back to per-delta messages. Regression guard: `client/src/ws/lateText.test.ts` (`npm run test:late-text -w client`).
572
594
  - **Help-mode CSS depends on the `help-system-ui` escape hatch class.** When `body.help-mode` is set, `styles/contextual-help.css` rules disable pointer events on `#root` and re-enable them only on `[data-help]` and `.help-system-ui` elements. The help-system-ui class is the only thing keeping `HelpButton`, `HelpBanner`, `HelpPopover`, and `DocViewer` interactive while help mode is on - rename or drop it without rewriting the CSS and the help system itself goes inert (button click does nothing, no way to exit besides Esc). The class also survives the `[data-help] *` pointer-events:none cascade because the CSS rule applies to `.help-system-ui` and all descendants. Nested native button/select help targets need a noninteractive wrapper:
573
595
  the help-mode CSS deliberately disables native controls inside `[data-help]`.
@@ -585,9 +607,9 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
585
607
  - **No `[style*="..."]` attribute-substring selectors in theme CSS.** An attribute-substring match on `style` is re-matched whenever any element's inline style attribute changes, and the composer's auto-resize writes `style.height` on every keystroke. Prefer class-based sites for the Arch theme's pulse override instead of an attribute-substring match on style.
586
608
  - **The decorative shader and xterm.js are code-split behind lazy gates - don't import them statically.** `ThemedBackgroundShaderImpl.tsx` (three.js 636KB + 120KB of `?raw` GLSL) is reached only via `ThemedBackgroundShader.tsx`, which checks `shaderPreset` *before* touching the heavy module, so `shaderPreset: 'none'` themes never fetch the chunk. `XtermView.tsx` (~290KB) is reached only via `XtermViewLazy.tsx`. A static import from anywhere collapses the split and puts ~866KB back in the main chunk (4,367 → 3,501KB when it was done).
587
609
  - **A new theme needs three coordinated edits - the `VALID_THEME_IDS` allowlist is the always-forgotten one.** A palette theme needs (1) its definition file under `client/src/themes/definitions/`, (2) registration in `client/src/themes/registry.ts` (`THEME_REGISTRY`), and (3) its id added to `VALID_THEME_IDS` in `shared/src/protocol/themes.ts`. Miss (3) and the theme silently reverts to the default on select (the id fails the shared allowlist gate) with no error - the hardest of the three to diagnose because the def + registry look complete. `provider-auto` is a sentinel in the list, not a palette; provider tints (e.g. `PROVIDER_THEMES.cursor`) resolve under it and are NOT separate `VALID_THEME_IDS` entries.
588
- - **Decorative shader rAF loop is throttled and visibility-paused.** `ThemedBackgroundShader` routes per-frame work through `client/src/utils/rafThrottle.ts`, which caps the loop and stops calling rAF while `document.hidden`. Keep both protections so background tabs do not run an unnecessary animation loop.
589
- - **Per-preset fps cap, not a global one.** `LOW_FPS_PRESETS` in `ThemedBackgroundShader.tsx` runs discrete/noisy/slow-atmospheric presets (matrix-rain, amber-crt, blueprint-grid, film-grain, star-drift, aurora, nebula, sentinel, cicada) at 24fps; smooth fast-motion presets (liquid-glass, watercolor) stay at 30. The eye picks up stutter on continuous fast motion but not on cell-quantized or slow content. Theme switches restart the rAF with the right fps. Don't unify back to a single fps without measuring - 24 vs 30 is a real ~20% compositor-upload reduction on the matched presets.
590
- - **The renderer is `alpha: false` (opaque framebuffer).** `ThemedBackgroundShader` clears to `0x000000`; the page background uses the same `--color-bg` token, so an opaque canvas avoids an extra blend without changing the visible result. Do not enable alpha without a concrete requirement.
610
+ - **Decorative shader rAF loop is throttled and visibility-paused.** `ThemedBackgroundShaderImpl` routes per-frame work through `client/src/utils/rafThrottle.ts`, which caps the loop and stops calling rAF while `document.hidden`. Keep both protections so background tabs do not run an unnecessary animation loop.
611
+ - **Per-preset fps cap, not a global one.** `LOW_FPS_PRESETS` in `ThemedBackgroundShaderImpl.tsx` runs discrete/noisy/slow-atmospheric presets (matrix-rain, amber-crt, blueprint-grid, film-grain, star-drift, aurora, nebula, sentinel, cicada, sakura-petals) at 24fps; smooth fast-motion presets (liquid-glass, watercolor) stay at 30. The eye picks up stutter on continuous fast motion but not on cell-quantized or slow content. Theme switches restart the rAF with the right fps. Don't unify back to a single fps without measuring - 24 vs 30 is a real ~20% compositor-upload reduction on the matched presets.
612
+ - **The renderer is `alpha: false` (opaque framebuffer).** `ThemedBackgroundShaderImpl` clears to `0x000000`; the page background uses the same `--color-bg` token, so an opaque canvas avoids an extra blend without changing the visible result. Do not enable alpha without a concrete requirement.
591
613
  - **Do not restore the bloom-overlay companion canvas.** Its second WebGL pipeline and full-screen blur/screen blend forced a compositor read-back each frame for a haze effect rather than useful detail. Per-element glow remains available through CSS `text-shadow` and `box-shadow`.
592
614
  - **A continuous WebGL loop can keep the GPU active while a scene appears idle.** Do not treat utilization alone as evidence that shader work is saturated. Keep render loops throttled and paused while the document is hidden; reducing frame rate alone may not change the graphics stack power state.
593
615
  - **Background-shader rule: no smooth radial gradients on dark themes.** 8-bit alpha compositing produces visible posterization rings on low-amplitude radial vignettes / noise washes / breathing blobs against near-black. Even with per-pixel ±1/255 dithering the bands persist because the gradient lives across only a few alpha bytes. Strip such effects entirely; rely on structural elements (particles, streaks, grids, dots, vein lines, scanlines, hard-edged cells) to carry the theme. Originating pass: 2026-04-27 sweep across Sentinel, Cherenkov, Sonar, Tarkovsky, Bloodmoon, DSKY, Oscilloscope, Cassette Futurism, Noir, Aurora, Nebula, Midnight Tokyo, Abyssal, Cicada, Kintsugi, Night City, Stealth, Concrete, Voyager, Arrakis, Amber CRT, Infrared. Light-mood themes (Solar Paper, Frutiger, Blueprint, Dark Academia, Braun, Holographic, Seismograph) untouched - banding doesn't show against light backgrounds.
@@ -599,7 +621,7 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
599
621
  ## Cross-platform
600
622
 
601
623
  - **Compare existing file and folder paths through `realpath` in tests.** macOS can expose temporary paths through `/var` while Arco stores their resolved `/private/var` paths. Resolve both sides for identity checks. When the test checks that Arco stores a resolved path, compare the stored value directly with the resolved expected path.
602
- - **Arco runs on Linux (primary dev machine) and macOS (secondary).** Any server-side shell-out or spawn needs to work on both. GNU-only flags, Linux-only binaries, and `/proc/` reads without a fallback are the usual traps. Concrete rules:
624
+ - **Arco runs on Linux, macOS and Windows.** Any server-side shell-out or spawn needs to work on all three; the rules below cover the Linux and macOS pair, and Windows needs its own handling (no POSIX signals or process groups, and npm `.cmd` launchers cannot be spawned directly). GNU-only flags, Linux-only binaries, and `/proc/` reads without a fallback are the usual traps. Concrete rules:
603
625
  - **No `setsid` binary.** Not installed by default on macOS. Node's `spawn(..., { detached: true })` already calls `setsid(2)` on POSIX and gives you the same new-session / no-controlling-terminal behavior for free. `nohup` is also redundant once `stdio: 'ignore'` + detach is in place. A restart path that `spawn('setsid', ...)`'d would silently `ENOENT` on Darwin.
604
626
  - **Shell scripts target bash 3.2+.** macOS ships bash 3.2 by default. `set -uo pipefail`, POSIX traps, `||` short-circuits are all fine. Bash-4 features like associative arrays (`declare -A`), `[[ =~ ]]` with `BASH_REMATCH` quirks, `readarray`, or `${var,,}` lowercase-expansion do not round-trip.
605
627
  - **`/proc/` reads need a platform check or a fallback.** `processActivity.ts` is Linux-only by design (gated); copy that pattern for anything else that peeks at `/proc`.
@@ -615,7 +637,7 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
615
637
  - **The snapshot manifests in `clusterSnapshots.ts` are the real exception** - written inside a hidden staging directory that is itself atomically swapped, so a plain `writeFile` there is correct and converting them buys nothing. Same for the `tempDir` paths in that file: those are directory swaps, not file replacements, and `atomicFile.ts` does not apply.
616
638
  - **Any new workflow-creation path MUST `await initWorkflowStore(cwd, wfid)` before first broadcast** - otherwise `seq` restarts from 0 and events.jsonl replay corrupts on next reconnect.
617
639
  - **Calibration `{ratio, overhead, lastGroundTruth}` is persisted to `meta.json`**; `lastContextPercent` and `zonesCalibrated` are in-memory only. Both the `handleRehydrateWorkflows` and `handleCreateWorkflow` resume paths read calibration back into `wf.calibration`. `zonesCalibrated` is deliberately reset on restart so the next zone crossing re-samples against whatever the session has grown into; every successful calibration (auto or manual) calls `writeCalibrationToMeta` to update disk.
618
- - **Two `cwd → ~/.claude/projects/<hash>` encoders must agree**: `resolveSessionJsonlPath` (`server/src/sessionJsonl.ts`) and `encodeProjectDir` (`server/src/http/fileRead.ts`, imported by `workflowDataRoutes.ts` / `purgeWorkflow.ts` / `sessionDiscovery.ts` / `recall/index.ts`). Claude replaces any non-`[A-Za-z0-9-]` char with `-` (so `Sample_Project` → `Sample-Project`). Earlier versions of one or the other only replaced `/`, which silently broke context-fill + session watching + the Resume picker for any project path with `_`, `.`, or whitespace. If you touch one, check the other.
640
+ - **Two `cwd → ~/.claude/projects/<hash>` encoders must agree**: `resolveSessionJsonlPath` (`server/src/sessionJsonl.ts`) and `encodeProjectDir` (`server/src/http/fileRead.ts`, imported by `workflowDataRoutes.ts` / `purgeWorkflow.ts` / `sessionDiscovery.ts` / `recall/index.ts`). Claude replaces any non-`[A-Za-z0-9-]` char with `-` (so `Sample_Project` → `Sample-Project`). Earlier versions of one or the other only replaced `/`, which silently broke context-fill, session watching and Resume's session discovery for any project path with `_`, `.`, or whitespace. If you touch one, check the other.
619
641
  - **Snapshot-only fallback on rotation** (`workflowStore.ts`): when `clientLastSeq + 1 < firstSeq`, events have rotated/fallen off disk and partial replay isn't possible. Server sends `workflow_state_snapshot` with `snapshotOnly: true` and `snapshotReason: 'events-rotated'`; client force-sets its `lastSeq` to the server's head, accepting that some history is lost. Don't try to "be helpful" by falling back to partial replay - it strands streaming events without their completes.
620
642
  - **Worker PID registry persists** to `~/.arco/worker-pids.json` and is read on every boot's `reapOrphanWorkers()`. **H44 - each entry now pairs the pid with its process START TIME (`{ procs: [{ pid, startTime }] }`); `reapProc` (`workers/pidRegistry.ts`) only SIGKILLs when the live process's start time matches the recorded one** (a recycled pid that now belongs to an unrelated process is left alone -> `reused`; a missing pid is `gone`). Never read a start time with a synchronous process probe on the server thread: only the Linux `/proc` read is synchronous; macOS and Windows queries are asynchronous and batched (`durablePidRegistry.ts`), and the result is accepted only while the caller reports the child as not yet exited (until then its pid cannot be reused). Shutdown kills held children without a query. Unknown start-time on either side, including a timed-out query, leaves the process alive and retains its record for a later check. A legacy `{ pids: [...] }` file still reads, but a missing recorded token cannot establish identity. The same start-time-verified reaping applies to the operator-terminal pid registry (`reapOrphanTerminals`). Don't revert to "SIGKILL anything still listed" - a boot can land on a reused pid. Don't disable or skip the reap - orphan workers from a server crash eat CPU until the kernel reaps them, and they hold detached file descriptors on their session JSONLs.
621
643
 
@@ -729,9 +751,9 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
729
751
 
730
752
  ## Goal run (north-star auto-continue)
731
753
 
732
- Operator-armed, per tab, default OFF; while armed, one continuation turn is dispatched after each settled turn. It is the sanctioned answer to "keep working toward the north star", built so a model-owned goal (such as Codex's native `create_goal`) can't recur through Arco's own surfaces. Goal runs require a finite server-enforced iteration budget, decremented before dispatch; no model decision may extend a run. Load-bearing:
754
+ Operator-armed, per tab, default OFF; supported providers dispatch one continuation after each settled turn. GOAL RUN is not offered for Antigravity CLI. It is the sanctioned answer to "keep working toward the north star", built so a model-owned goal (such as Codex's native `create_goal`) can't recur through Arco's own surfaces. Goal runs require a finite server-enforced iteration budget, decremented before dispatch; no model decision may extend a run. Load-bearing:
733
755
 
734
- - **The loop never asks a model whether to continue.** `evaluateGoalRun` is a pure function of facts the server already holds (iterations left, token ceiling, busy, queue depth, last-turn error, throttle, context pct). Continuation is *budget remaining*, termination is *budget spent* - never a completion judgment. A model signal may only ever SHORTEN a run; wiring one that extends a run, routes work, or spawns anything re-creates the archived failure (CLAUDE.md § Non-goals, fence A). Don't add a "the model said it's done" branch, and don't add a "the model said it needs more turns" one either.
756
+ - **The loop never asks a model whether to continue.** `evaluateGoalRun` is a pure function of facts the server already holds (iterations left, token ceiling, busy, queue depth, last-turn error, throttle, context pct). Continuation is *budget remaining*, termination is *budget spent* - never a completion judgment. A model signal may only ever SHORTEN a run; wiring one that extends a run, routes work, or spawns anything would change the deterministic budget contract. Don't add a "the model said it's done" branch, and don't add a "the model said it needs more turns" one either.
735
757
  - **Iteration budget is mandatory and finite** (default 10, `GOAL_RUN_MAX_ITERATIONS` 500, clamped server-side - never trust the client's number). A null budget is the failure this loop exists to prevent.
736
758
  - **`remaining` is decremented BEFORE the dispatch await.** A fast re-entrant settle would otherwise read the pre-decrement count and spend one iteration twice.
737
759
  - **Counters are NOT mirrored to meta.json.** A server restart ends any armed run. This is deliberate: the restart already killed the turn, and a deploy silently resuming an unattended loop is precisely the surprise the feature is designed to avoid. Don't "fix" this by persisting the counters.
@@ -787,7 +809,7 @@ In-tab rewind/branch over the append-only `events.jsonl` . Native-first. Load-be
787
809
  - **Replay walks from the PHYSICAL TAIL, not from the stored `leafSeq` value.** `meta.leafSeq` being set just means "branch mode on"; `replayMessagesWithResumePolicy` starts the walk at the greatest seq present. Each rewind appends a fresh `leaf_move` at the tail and every post-rewind turn appends after it, so the newest event is always on the active branch and the latest redirect is on its ancestry path. This is why post-rewind turns are picked up **without advancing `leafSeq` per turn** - do not add per-turn `leafSeq` bumps.
788
810
  - **Branch mode bypasses the byte-range summary path** (reads the whole file) because the lineage walk needs the full event set to resolve parents/redirects across the tail boundary - the §5 "walk before summarization" rule. `walkBranchSeqs` reports `truncated` when ancestry has rotated off the size-capped log; that surfaces as `ResumeReplayResult.reconstructed` and a loud worker `console.warn` (hygiene-B: never silently degrade a lossless rewind into a lossy one). `inScope` holds only surviving events.
789
811
  - **The rewind disposes the live Native worker** (`disposeClaudeNativeWorker`) so the next turn cold-rebuilds from the branch - reuses the proven post-handoff teardown rather than force-mutating a live `messages[]`. Busy-guarded: rejected mid-turn.
790
- - **Native-only in v1.** `handleRevertToPointRequest` resolves the effective transport (tab override → cascade) and rejects non-Native: on CLI/Codex `meta.leafSeq` is never read, so a rewind would silently no-op. The client hides the button for non-Claude providers. **Named REWIND CONVERSATION, deliberately distinct from `revert_to_checkpoint`** (the git working-tree RESTORE FILES) - two REVERT verbs on one HISTORY tab would confuse.
812
+ - **Native-only in v1.** `handleRevertToPointRequest` resolves the effective transport (tab override → cascade) and rejects non-Native: on CLI/Codex `meta.leafSeq` is never read, so a rewind would silently no-op. The client keeps the button visible but disabled with its reason for every other provider and the Claude CLI transport (`client/src/utils/rewindSupport.ts`). **Named REWIND CONVERSATION, deliberately distinct from `revert_to_checkpoint`** (the git working-tree RESTORE FILES) - two REVERT verbs on one HISTORY tab would confuse.
791
813
  - **Reversible by construction:** abandoned branches stay byte-identical on disk; "undo the undo" is just another `leaf_move`. Contrast Purge, which destroys.
792
814
  - **`branch_summary` is RESERVED + UNEMITTED - forks ship via `leaf_move`, not `branch_summary`.** The `BranchSummaryMessage` type exists in the protocol (declared early so events.jsonl/HISTORY readers recognize the kind without a second schema bump) but NO server path emits it. The fork record is the `leaf_move` redirect event + `meta.leafSeq`. Don't wire `branch_summary` into the rewind path thinking it's the fork marker.
793
815
 
@@ -797,7 +819,7 @@ Operator-armed HITL approval gate. Native-only. When `WorkflowConfig.reviewSafeM
797
819
 
798
820
  - **Two-condition firing, default OFF.** `evaluateGate(armed, …)` returns a proposal ONLY when safe-mode is armed AND the call is sensitive. Safe-mode off ⇒ null ⇒ the hot path is byte-for-byte untouched. The gate slots in AFTER the hardline/config/fact-force guards (a call refused there never reaches it) and sees the EFFECTIVE post-hook-rewrite `input`.
799
821
  - **The standing-approval signature is NON-lossy - never reuse `outputHash`.** `gateSignature` hashes the full canonicalized (sorted-key) tool name + args. `outputHash` strips digits (`\d+→#`) for error-loop detection, so `rm -rf dir1`==`rm -rf dir2` there; reusing it would broaden a standing approval to commands the operator never saw (a nudge toward border-A). Over-prompting (key reorder is canonicalized away, but any value change re-prompts) is the safe direction; under-prompting is forbidden.
800
- - **`gate_required` is written BEFORE the Promise parks** (events.jsonl + the per-workflow sidecar `.arco/workflows/<wfid>/gate-approvals.json`). Writing it after reopens the lost-on-crash hole the whole feature exists to close. Sequential tool dispatch means the for-loop simply suspends on the `await` (plan §4.4); batch-settle for parallel `Task` is deferred (`Task` isn't sensitive).
822
+ - **`gate_required` is written BEFORE the Promise parks** (events.jsonl + the per-workflow sidecar `.arco/workflows/<wfid>/gate-approvals.json`). Writing it after reopens the lost-on-crash hole the whole feature exists to close. Sequential tool dispatch means the for-loop simply suspends on the `await` ; batch-settle for parallel `Task` is deferred (`Task` isn't sensitive).
801
823
  - **Restart-resume is a deliberate discontinuity, NOT a bug (§4.5).** A gate that survived a `systemctl restart` cannot resume the dead in-process tool-loop - the parked Promise is gone. `rehydrateGatesOnce` (Set-guarded, on `rehydrate_workflows`) re-emits `gate_required` from the sidecar so the card reappears regardless of the client's event-replay cursor (the synthetic `gate::<id>` message dedupes, so replay + rehydrate double-delivery is harmless). When the operator then resolves it, `routeClaudeNativeGateReply` finds no live park → `resolveOrphanedGate` clears the sidecar, emits `gate_resolved`, and for approve **feeds the approved action as the next-turn input** (`handleUserMessage`, like `maybeAutoContinueAfterCompact`) - an honest re-issue, not a seamless continuation. If safe-mode is still armed the re-issued call gates AGAIN, live (a fresh park resolved normally) - that second approval is the documented cost of a restart-orphaned gate, not a loop.
802
824
  - **Cancel drains the parked gate AND its sidecar record** (`cancel()` rejects every `pendingGates` entry; the park's catch clears the sidecar) so a cancelled turn's gate doesn't resurrect on the next rehydrate.
803
825
  - **Fence:** operator-armed (default off), deterministic allowlist (no model judgment about what's dangerous), every gate_required/gate_resolved in events.jsonl, reject + disarm + (sub-) revoke make it reversible. The model only *proposes*; the server pauses and waits.
@@ -955,6 +977,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
955
977
  ## Task children
956
978
 
957
979
  - **Depth-1 cap is enforced at construction.** Children spawn with `claudeNativeTaskDisabled: true` in `WorkerConfig`; the worker checks the flag and `getNativeToolDefinitions({ taskDisabled: true })` drops `Task` from the tool registry sent to Anthropic. The dispatcher also early-returns `[error] Task is depth-capped at 1` if the model finds another path. Don't loosen - the explicit non-goals forbid autonomous orchestration trees.
980
+ - **Background `Task` children belong to the tab, not the turn.** A `Task` call with `run_in_background` returns at once; the child keeps its running place across later parent turns, notice turns and INTERRUPT & SEND. STOP, the row's CANCEL or CANCEL ALL, closing the tab, and a server restart end it. After a restart the parent's next Claude Native turn records each stopped background child once (`Stopped by restart.`) and carries one shared notice that the result was not received; the notice does not start a turn by itself. Do not fold background children into per-turn cancellation when adding turn-settle cleanup. Settings `nativeSubagents.background` Off makes every call wait. See [Background sub-agents](PROVIDERS.md#background-sub-agents).
958
981
  - **`tasksByTaskId` map is per-worker, not global.** Only the parent that called `Task` can read its child's accumulated output via `TaskOutput`; cross-tab `TaskOutput` calls return `[error] no such task`. The map drops entries on parent dispose, so a child tab promoted to standalone (rare; operator-only) becomes unaddressable from the parent's side. Don't rebuild this as a global registry - it would let any Native worker peek at any other's children, breaking the depth-1 cap's containment story.
959
982
  - **Parallel `Task` dispatch is `Promise.all` for `Task` blocks, sequential for everything else.** Task children share no filesystem state so concurrent dispatch is safe and substantially faster on fan-out turns. Other tools stay sequential because they often share the cwd's filesystem state (Edit-after-Read invariant, etc.).
960
983
 
@@ -1020,8 +1043,8 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1020
1043
 
1021
1044
  ### Output style
1022
1045
 
1023
- - **Addendum text is checked into the repo - not LLM-generated, not session-modified.** `outputStyleAddendum(level)` (`server/src/providers/outputStyle.ts`) is the single source of truth for the per-level provider-prompt text. Editing it requires a code change + commit; no operator-facing knob can mutate the body. This is the autonomy-test guardrail: an LLM can't curate its own instructions. If a future "let the model self-tune the addendum" idea surfaces, that's the canonical bad pattern from `CLAUDE.md`'s hard fences - reject without a plan-doc update + operator sign-off.
1024
- - **Review / Handoff seed / DOCS / GIT primitives MUST run with `outputStyle: 'normal'` regardless of source-tab pick.** Hard-coded at four sites (plan §6): `runReviewer.ts` (reviewer WorkerConfig), `exportContext.ts` (CLI handoff path, Native handoff path, fresh-summarizer path), and `handleUserMessage` (overrides outputStyle when `UserMessage.primitive === 'docs' | 'git'`, set by the in-tab DOCS / GIT composer dialogs). DOCS / GIT new-tab spawn forces normal client-side via `spawnConfigFromRunAs`. Terse-style reviews regress operator comprehension; terse handoff seeds reduce the *next* worker's input fidelity. Don't make this a per-spawn knob. If a future operator argues for a terse review, treat it as operator data toward changing the default - not as a config-knob escape hatch.
1046
+ - **Addendum text is checked into the repo - not LLM-generated, not session-modified.** `outputStyleAddendum(level)` (`server/src/providers/outputStyle.ts`) is the single source of truth for the per-level provider-prompt text. Editing it requires a code change + commit; no operator-facing knob can mutate the body. This is the autonomy-test guardrail: an LLM can't curate its own instructions. The addendum is not changed by a model during a session.
1047
+ - **Review / Handoff seed / DOCS / GIT primitives MUST run with `outputStyle: 'normal'` regardless of source-tab pick.** Hard-coded at multiple sites: `runReviewer.ts` (reviewer WorkerConfig), `exportContext.ts` (CLI handoff path, Native handoff path, fresh-summarizer path), and `handleUserMessage` (overrides outputStyle when `UserMessage.primitive === 'docs' | 'git'`, set by the in-tab DOCS / GIT composer dialogs). DOCS / GIT new-tab spawn forces normal client-side via `spawnConfigFromRunAs`. Terse-style reviews regress operator comprehension; terse handoff seeds reduce the *next* worker's input fidelity. Don't make this a per-spawn knob.
1025
1048
  - **An unset output style means the default, but only on a tab's own turns.** `resolveTurnSettings` turns an unset `WorkflowConfig.outputStyle` into `DEFAULT_OUTPUT_STYLE` (`shared/src/outputStyle.ts`, `'plain'`); `outputStyleAddendum(undefined)` returns null, so a worker spawned without a level (a primitive, a utility call) gets no addendum. Don't resolve the default inside a worker. Every fallback uses the constant (`resolveOutputStyle`), never a literal `?? 'normal'`; stores write the default as unset (`storedOutputStyle`), so 0.1.4 never meets `'plain'` in `meta.json`, presets or templates, and a later change of the default reaches every tab that never chose.
1026
1049
  - **Spawn-from-here DOES inherit the parent's `outputStyle`.** Different from the four primitives above. `SpawnDialog` spreads `...parentConfig`, so `outputStyle` flows through; the operator can flip in the child tab. Don't add an opt-out at `SpawnDialog` for `outputStyle` - terse → terse is the explicit operator pick on the parent and they kept it for a reason. Inheritance is the right default for a fresh-but-related tab.
1027
1050
  - **Addendum text MUST preserve code blocks / error strings / file paths verbatim AND MUST NOT compress security warnings, irreversible operations, or order-sensitive multi-step sequences.** Each level's text leads with explicit "auto-clarity" rules and a verbatim-preserve list. A new level (e.g., a hypothetical `ultra`) shipped without these rules will silently regress technical correctness - the model will compress a sed command's flags or shorten an error string. Don't ship a new level without the verbatim list; review the existing levels' text as the floor.
@@ -1030,10 +1053,11 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1030
1053
 
1031
1054
  - **BLIND is context isolation, ISOLATED is filesystem isolation.** BLIND
1032
1055
  keeps the project cwd but receives no plan/board/roster/role/focus/efficiency
1033
- or progress context and gets only `peer_send` / `peer_read`. ISOLATED is
1034
- Claude-Native-only, executes in
1035
- `~/.arco/clusters/<clusterId>/isolates/<wfid>/workspace`, removes Bash,
1036
- hooks, project prompts/refs/attachments/settings/skills/knowledge/goal,
1056
+ or progress context and gets only `peer_send` / `peer_read`. ISOLATED uses
1057
+ fenced Native tools or a checked CLI sandbox in
1058
+ `~/.arco/clusters/<clusterId>/isolates/<wfid>/workspace`. Native omits Bash;
1059
+ CLI shell access stays within its sandbox. Isolation removes hooks,
1060
+ project prompts/refs/attachments/settings/skills/knowledge/goal,
1037
1061
  codebase memory and registry MCPs, and still persists events/meta under the
1038
1062
  real project workflow directory. Do not weaken this to a prompt-only rule.
1039
1063
  - **A BLIND member cannot transition its assigned board task; completion returns by mail.** Task assignment/transfer may still point at a BLIND workflow so the operator and STANDARD members can track ownership, but every plan/task tool is intentionally absent and the shared peer-ops layer returns `access_denied` if the member guesses the real REST shim. The member must finish the substantive work, `peer_send` its report, and ask a STANDARD member/operator to update the board. `BLIND_CLUSTER_DOCTRINE` is shared by Native, local, and string-form providers and explicitly forbids probing Arco HTTP APIs/workflow storage to recover hidden state. Keep this centralized: a blind member cannot update task status, so it returns `access_denied` and requires escalation through the supported peer-report path rather than probing routes.
@@ -1041,6 +1065,16 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1041
1065
  that previously saw the project would leak retained context. ISOLATED rejects
1042
1066
  transcript import and task transfer. Replacement keeps the old workflow on
1043
1067
  disk, atomically swaps the cluster slot, and discards its mailbox.
1068
+ - **A held research reply must never reach the Director early.** During an
1069
+ open round a researcher's `peer_send` is stored in Arco state
1070
+ (`~/.arco/clusters/<id>/research.json`) and returns `heldForRound`; it is
1071
+ not enqueued and raises no `peer_message_sent`, which would also wake the
1072
+ Director through AUTO-PICKUP. Nothing about a researcher's outcome,
1073
+ provider or model is written to the research folder before release (or,
1074
+ for providers and models, before reveal): the Director works there.
1075
+ Researchers' workflow folders live under `~/.arco/research/<projectId>/`
1076
+ for the same reason (`ClusterState.memberCwds`); use
1077
+ `clusterStore.memberCwdFor` wherever a member's `meta.json` is read.
1044
1078
  - **Isolated artifacts cross the boundary only through mailbox copies.**
1045
1079
  `peer_send artifact_paths` accepts paths rooted in the isolated workspace,
1046
1080
  at most 8 files / 256 KB total. On drain Arco writes copies under the
@@ -1049,35 +1083,35 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1049
1083
 
1050
1084
  - **Mailbox is per-recipient, not per-cluster - don't index it the wrong way.** Files live at `~/.arco/clusters/<clusterId>/mailbox/<recipientWorkflowId>/<msgId>.json`. `clusterMailbox.enqueue/peek/drain` take a single `wfId` (the recipient) and resolve the cluster via `clusterStore.getClusterIdForWorkflow`. A bug that scans `mailbox/` flat would commingle all recipients' inboxes; a bug that scans every cluster looking for `<msgId>` would cost O(clusters × messages) on every operation. Stick to the per-recipient layout - `peek(wfId)` reads exactly one directory.
1051
1085
  - **Peer tools must be gated on `worker.config.clusterId` - leaking them into non-cluster workflows breaks the no-orchestrator invariant.** `worker.ts:buildToolDefs` returns peer descriptors only when `clusterId !== undefined`; the dispatch branch in `dispatchTool` mirrors the same gate. A workflow that the operator never opted into a cluster has no business seeing `peer_send` in its tool list - the four-question test (operator-opted-in) fails the moment a non-cluster worker can address peers it has no relationship with. If a future change adds a "tool list debug dump" or similar, do not bypass this gate.
1052
- - **Tool names use underscores, not the plan's dotted form.** Anthropic's tool-name regex is `^[a-zA-Z0-9_-]{1,64}$`; `peer.list` would 400 at API call time. Wire-level names are `peer_list / peer_send / peer_read`. Plan §13 carries the decision. When wiring CLI / Codex transports in + via MCP, the namespace prefix (`mcp__arco-cluster__peer_list`) similarly must avoid periods inside the tool-name segment.
1086
+ - **Tool names use underscores, not the plan's dotted form.** Anthropic's tool-name regex is `^[a-zA-Z0-9_-]{1,64}$`; `peer.list` would 400 at API call time. Wire-level names are `peer_list / peer_send / peer_read`. When wiring CLI / Codex transports in + via MCP, the namespace prefix (`mcp__arco-cluster__peer_list`) similarly must avoid periods inside the tool-name segment.
1053
1087
  - **Pre-turn peer-mailbox handling is depth-notice, NOT auto-drain (superseded - see the 2026-05-11 afternoon entry "Peer mailbox no longer auto-drains pre-turn" below for the canonical contract).** The original shape called `drainPeerMailbox` before `user_message_echo` so `peer_message_received` events landed first; that was reverted because the subsequent `peer_read` then returned empty (drain already consumed the files) and the model conflated "nothing to read" with "no work to do." Current code (`server/src/ws/turnEngine.ts`) reads `clusterMailbox.depthFor(workflowId)` on `firstIteration` and folds a `--- PEER MAILBOX ---` notice with the pending count into `appendSystemPrompt`; the actual drain + `peer_message_received` events fire on the worker's `peer_read` call. The drain-destroys-files / events.jsonl-is-the-durable-record invariant still holds - the drain just moved to `peer_read`. Don't re-introduce pre-turn auto-drain.
1054
1088
  - **The `peerMessagesPrologue` system block bypasses prefix cache for that turn.** The prologue text is per-turn variable (different mailbox contents), so it cache-busts the `appendSystemPrompt` block from the operator's pick onward. This is fine - peer messages are new content the model has never seen - but don't try to "stabilize" the prologue by hashing or omitting timestamps. The unique line-per-message + timestamp shape is what makes injection traceable; the cache cost is the price of that traceability.
1055
1089
  - **Drain destroys the mailbox file; the durable record lives in `events.jsonl`.** `clusterMailbox.drain` removes the file after returning the message - the corresponding `peer_message_received` event in events.jsonl is the audit trail. If you want a "view the full mailbox history" UI in a later phase, scan events.jsonl, don't try to re-keep mailbox files. keeping mailbox files post-drain only grows unboundedly with no read path.
1056
1090
  - **The send budget resets per-sender on `primary_turn_started`, not per-cluster or per-message.** `clusterBudget.reset(workflowId)` fires from `seedWorker.runPrimaryTurn` for every member starting a new turn. A member that hits the 15-cap can keep sending again only after the operator advances *its* turn - not after a peer's turn or a wall-clock interval. If you ever add a "system-initiated turn" path (auto-handoff, scheduled refresh) and want it to count against the budget, call `recordSend`; if you want it not to count, leave the counter alone - but don't quietly skip `reset` because the turn was system-initiated.
1057
- - **`peer_send_rejected` MUST emit on every refusal - silent budget violations are a hard fence (plan §6.2).** Three rejection paths: budget exhausted, unknown peer, content too large (and in principle `recipient_not_in_cluster`, though the resolver catches that as `unknown_peer`). All four return an `[error]` string visible to the model AND fire the WS event. If you add a fourth rejection class, follow the same shape: model-visible `[error] <code>: ...` + `peer_send_rejected` event with a stable `reason` code.
1091
+ - **`peer_send_rejected` MUST emit on every refusal - silent budget violations must not pass unnoticed.** Three rejection paths: budget exhausted, unknown peer, content too large (and in principle `recipient_not_in_cluster`, though the resolver catches that as `unknown_peer`). All four return an `[error]` string visible to the model AND fire the WS event. If you add a fourth rejection class, follow the same shape: model-visible `[error] <code>: ...` + `peer_send_rejected` event with a stable `reason` code.
1058
1092
  - **No depth-2 clusters; no cross-cluster membership.** `clusterStore.createCluster` rejects when any candidate workflowId already lives in a cluster (`member_already_in_cluster`). Reversal path is `DELETE /api/clusters/<id>` - clears the membership index, then the same workflowIds are re-clusterable. Don't add a `move-member` API: the right shape is delete + re-create, which makes the change visible at the events.jsonl level.
1059
1093
  - **`createCluster` is the one validation site for the "no nested clusters" fence.** Today it rejects only a wfid already in `memberIndex` (depth-2 / cross-cluster). The cluster tab is keyed by `clusterId`, not a workflow, and although `WorkflowConfig.kind` admits `'cluster'` (skipped by the busy sweep and hub reporting), no server path creates one - so the "member is itself a cluster" case is still forward-compat. If a path ever mints a `kind:'cluster'` workflow, add an explicit reject clause here. The fence belongs at the validation site, not at the peer.send dispatch (where it would silently neuter cross-cluster sends instead of refusing the cluster).
1060
- - **REST endpoints are the only surface - no WS messages yet.** `POST /api/clusters`, `GET /api/clusters/:id`, `DELETE /api/clusters/:id`. Arco adds `cluster_*` WS messages and a UI tab; until then, operator wires clusters via curl. Don't pre-emptively add WS handlers - the shape isn't stable until the UI design lands.
1061
- - **Member display names default to the 8-char workflowId prefix.** `clusterStore.displayNameFor(wfid)` returns `wfid.slice(0,8)`. Editable names are deferred until the UI exists. When added, persist them on the *cluster*'s `meta.json` rather than the member workflow's meta - names are cluster-relative (the same workflow could in principle be re-clustered with a different display name, though the no-cross-cluster fence makes that simultaneous case impossible).
1094
+ - **Cluster REST and WS surfaces share one store.** `POST /api/clusters`, `GET /api/clusters/:id` and `DELETE /api/clusters/:id` remain for scripted use; the cluster tab drives the `cluster_*` WS messages (`shared/src/protocol/clusters.ts`, `docs/PROTOCOL_CLUSTER.md`). Both reach `clusterStore`, so validation such as the nested-cluster fence lives there, never in one transport only.
1095
+ - **Member display names fall back to the 8-char workflowId prefix.** `clusterStore.displayNameFor(wfid)` returns the member's tab name (set with RENAME) and `wfid.slice(0,8)` when none is set. Peer addressing accepts either, plus a unique role text.
1062
1096
  - **Handoffs serialize per-cwd via `cwdHandoffChain`.** A queued handoff waits for the prior handoff before reading Git state. Each slot is released on success, cancellation, or failure.
1063
1097
 
1064
1098
  ### Task board + task peer-tools
1065
1099
 
1066
- - **`done` / `archived` are operator-gated AT THE PEER LAYER - `peerTaskUpdate` rejects them before touching the ledger.** The §D1 invariant ("only the operator's `task_ledger_update` reaches `applyUpdate` with a terminal status") now spans the cluster peer surface. `clusterPeerOps.peerTaskUpdate` returns `{ ok:false, code:'operator_gated' }` when `status === 'done' || status === 'archived'`, so `applyUpdate` never sees those statuses from a worker. This is **not** a global block - the operator's WS path still reaches `applyUpdate(done/archived)` and succeeds. Don't "simplify" by moving the peer-layer check into `applyUpdate` itself: that would also break the operator path, which is the legitimate terminal-status setter. Asserted by `scripts/smoke/task-board.ts` steps (d) + (e); regressing either is a hard fail.
1100
+ - **`done` / `archived` are operator-gated AT THE PEER LAYER - `peerTaskUpdate` rejects them before touching the ledger.** Direct terminal status changes remain operator-only; a Director met sign-off can close a task when Board auto-done is on. `clusterPeerOps.peerTaskUpdate` returns `{ ok:false, code:'operator_gated' }` when `status === 'done' || status === 'archived'`, so `applyUpdate` never sees those statuses from a worker. This is **not** a global block - the operator's WS path still reaches `applyUpdate(done/archived)` and succeeds. Don't "simplify" by moving the peer-layer check into `applyUpdate` itself: that would also break the operator path, which is the legitimate terminal-status setter. Asserted by `scripts/smoke/task-board.ts` steps (d) + (e); regressing either is a hard fail.
1067
1101
  - **The task peer-tools are gated on `clusterId` via `getPeerToolDefinitions()` - same gate as `peer_*` / `cluster_plan_*`.** `cluster_task_list/show/create/claim/update/heartbeat/link/unlink/comment/block/complete` are in `PEER_TOOL_NAMES` and the schema array, both consumed by `worker.ts:buildToolDefs` only when `clusterId !== undefined`. `buildToolDefs` enumerates via the function, not a hand-maintained name list, so the gate covers them automatically. Don't add a separate registration path that bypasses the clusterId check - a non-cluster workflow has no shared cwd ledger to read.
1068
1102
  - **`cluster_task_list` returns a COMPACT model-facing view (`taskLedger.formatBoardForModel`), NOT the raw ledger - don't "simplify" it back to a full dump.** The raw `JSON.stringify(tasks)` dump is all statuses, oldest-first, full notes; the worker's tool result is hard-capped at 64KB (`MAX_TOOL_OUTPUT_BYTES`, applied by `truncateOutput` on Native / the transport on CLI/Codex), so the byte-slice lopped off the NEWEST/active rows and left invalid JSON cut mid-object. On a 128-task board (120 done) the live rows were never visible - a worker couldn't see its own active work. The formatter drops done/archived from `tasks` (counts them in `completedCount`, lists the latest 10 in `recentlyCompleted`; any task still fetchable by id via `cluster_task_show`), strips notes to a one-line preview + length, sorts active newest-updated-first, and bounds to valid JSON under a 48KB budget (dropping oldest from the tail, reporting `omittedActive`). Applied at BOTH model-facing seams - `peerTools.ts` (Native) and the `/task-list` REST endpoint (read by the MCP child for CLI/Codex). The operator UI is untouched: it renders from `task_ledger_snapshot` WS broadcasts, which still carry the full task set. Pinned by `npm run test:board-view -w server`.
1069
1103
  - **`cluster_task_claim` concurrency guard lives INSIDE the per-cwd lock, not before it.** The owner check runs inside the `persistLedgerMutation` mutate callback (which holds the per-cwd lock), so two concurrent claims serialize and the second sees the first's `assignee`. A pre-lock read-then-claim would race: both members would read "unclaimed" and the second would stomp the first. If you refactor the claim path, keep the guard under the lock.
1070
1104
  - **cwd is derived from `clusterStore.readCluster(clusterId).cwd`, NOT the caller's config.** A cluster has one authoritative shared cwd on its record; a member workflow may be unhydrated (`workflows.get(wfid)` misses). The plan-ops resolve cwd the same way. Don't switch the task-ops to `workflowCwds.get(callerWfid)` - that's the workflow-scoped operator path's source and can disagree with the cluster's cwd.
1071
1105
  - **Task mutations broadcast `task_ledger_snapshot` CLUSTER-wide, plan-tick-style - not workflow-scoped.** The operator WS path broadcasts on the originating workflow (its observers look at that cwd); the peer-ops must reach every member's board, so they take a `broadcastCluster` callback exactly like `peerPlanTick`. The durable `task_ledger_event` is still appended to the *acting* member's events.jsonl via `persistLedgerMutation` → `broadcastWorkflow`, so rebuild folds it. Don't drop the cluster-wide snapshot in favor of the per-workflow one - other members' boards would go stale until their next snapshot.
1072
1106
  - **Task comments/runs are source-of-truth event payloads, not only snapshot decoration.** `cluster_task_comment`, `cluster_task_block`, `cluster_task_complete`, and note-bearing `cluster_task_heartbeat` append a `TaskComment` in the `task_ledger_event.payload.comment` field; `cluster_task_heartbeat` also carries `payload.run`. `saveKernel()` materializes them into `tasks.json`, and `loadKernel()` rebuilds them from event payloads when the snapshot is missing/corrupt. If you add more lifecycle tools, carry durable handoff text through `payload.comment` and run state through `payload.run`; otherwise details vanish after snapshot rebuild.
1073
- - **H48: `cluster_task_complete` enforces hallucinated-id + ownership guards INSIDE the per-cwd lock.** A worker can only complete a task that EXISTS in this cluster's ledger AND has `assignee === itself` - both checked inside the `persistLedgerMutation` mutate callback (under the lock, so a concurrent claim can't slip an owner change past the check). An id not in the ledger → `not_found` (stops a member fabricating/guessing an id); another member's / unassigned task → `not_owner` (with a "coordinate via peer_send" / "claim it first" hint). Complete moves `in_progress → review`; the operator's task-ledger update path stays the ONLY `done`/`archived` setter. Mirrors `cluster_task_claim`'s in-lock owner pre-check - don't hoist either guard above the lock.
1107
+ - **H48: `cluster_task_complete` enforces hallucinated-id + ownership guards INSIDE the per-cwd lock.** A worker can only complete a task that EXISTS in this cluster's ledger AND has `assignee === itself` - both checked inside the `persistLedgerMutation` mutate callback (under the lock, so a concurrent claim can't slip an owner change past the check). An id not in the ledger → `not_found` (stops a member fabricating/guessing an id); another member's / unassigned task → `not_owner` (with a "coordinate via peer_send" / "claim it first" hint). Complete moves `in_progress → review`; direct `done` and `archived` changes stay operator-only; a Director met sign-off can close the task when Board auto-done is on. Mirrors `cluster_task_claim`'s in-lock owner pre-check - don't hoist either guard above the lock.
1074
1108
  - **`cluster_dispatch_once` is explicit-assignee-only and persists before prompting.** The dispatcher does not infer from role/tier/focus and does not ask a model to route. It scans ready tasks deterministically, rejects anything without a concrete idle supported assignee, writes `dispatch_fired` with the updated task plus `payload.run` under the per-cwd lock, then starts the synthetic worker turn. `dispatch_skipped` is durable for every ready-task refusal. `rebuildRunsFromEvents()` must keep folding `dispatch_fired.payload.run`; otherwise run history disappears after snapshot rebuild.
1075
1109
  - **The armed task dispatcher daemon is just repeated one-shot dispatch behind a persisted OFF-by-default gate.** `dispatcher.enabled` lives in cluster meta and mirrors on `cluster_state`; absent means OFF. The interval loop may call only the same deterministic dispatch kernel as `cluster_dispatch_once`. Do not add a second routing path, role/tier/focus inference, or model-based assignment in the daemon.
1076
1110
  - **Worktree-required dispatch is also operator-armed.** `LedgerTask.worktreeRequired` is just a task flag. The dispatcher must skip it with `worktree_required` unless the task already has a server-set `worktree` or cluster dispatcher `autoWorktree` is explicitly true. When auto-provisioning, create the managed worktree before `dispatch_fired`, persist the pointer in that same mutation, and include the path/branch in the prompt. Do not silently switch the member workflow cwd; Stage J only prompts the worker to edit in the task worktree.
1077
1111
  - **Daemon sweeps must not double-dispatch open runs, including after restart.** The open-run check belongs inside the persisted dispatch path, not only in daemon memory. A server restart forgets timers but not `dispatch_fired.payload.run`; after replay, a task with a `claimed`/`running` run must be skipped with `active_run`, never fired again.
1078
1112
  - **Disarming the daemon stops new fires only.** `cluster_dispatch_toggle(enabled:false)` clears/sets meta state and cancels future interval work, but it must not complete, fail, reclaim, or delete already-open runs. Worker lifecycle stays on `cluster_task_heartbeat`, `cluster_task_block`, `cluster_task_complete`, and later explicit recovery controls.
1079
- - **The dispatcher is not a terminal-status path.** Fired tasks move `ready -> in_progress`; workers complete via `cluster_task_complete` into `review`; only the operator's task-ledger update path marks `done` / `archived`. Do not add auto-done, quality verdicts, or server-side "is this complete?" checks to the dispatcher.
1080
- - **The cluster BOARD drawer may expose DONE / ARCHIVE only through the operator WS path.** The drawer's status selector calls the same `task_ledger_update` sender as the standalone LEDGER tab, using a cluster member workflowId only to resolve the cwd. Do not route terminal statuses through `cluster_task_update` / peer tools, and do not let Director acceptance auto-apply terminal state. The operator click is the acceptance boundary.
1113
+ - **The dispatcher is not a terminal-status path.** Fired tasks move `ready -> in_progress`; workers complete via `cluster_task_complete` into `review`; a Director met sign-off can close the task when Board auto-done is on. Direct terminal status changes remain operator-only. Do not add auto-done, quality verdicts, or server-side "is this complete?" checks to the dispatcher.
1114
+ - **The cluster BOARD drawer may expose DONE / ARCHIVE only through the operator WS path.** The drawer's status selector calls the same `task_ledger_update` sender as the standalone LEDGER tab, using a cluster member workflowId only to resolve the cwd. Do not route direct terminal status changes through `cluster_task_update` / peer tools. A Director met sign-off can close the task when Board auto-done is on; with it off, the operator accepts the task.
1081
1115
  - **`task_run_recover` mutates exactly one selected run.** Reclaim / terminate / reassign / fail all look up `runId` inside the per-cwd lock and reject if it does not belong to `taskId`. Never "recover the task" by bulk-closing every open run; sibling attempts must stay intact unless the operator targets them too. Reclaim returns the task to `ready` and clears assignee, reassign resolves the target cluster member and sets assignee, terminate blocks immediately, and fail blocks only after the configured consecutive-failure limit. None of these actions may set `done` / `archived`.
1082
1116
  - **Stale reclaim must be checked server-side, not only by the button state.** The BOARD UI disables `RECLAIM` until an open run has no heartbeat for five minutes, but the authoritative guard is `staleOnly` in `handleTaskRunRecover`, using `lastHeartbeatAt ?? startedAt` under the lock. Keep that check even if the UI grows better stale indicators; otherwise a stale-looking row from an old snapshot could reclaim a fresh heartbeat.
1083
1117
  - **Stage I swarm creation is graph construction, not orchestration.** `cluster_swarm_create` should create ordinary ledger tasks and dependencies: root blackboard, N workers, verifier depending on all workers, synthesizer depending on verifier. It must not create a parallel swarm store, infer assignees through a model, or mark non-root tasks `done`. If the operator asks to dispatch after creation, call the existing deterministic dispatcher path and keep the same terminal-status fence; the smoke target is `scripts/smoke/task-swarm.ts`.
@@ -1086,16 +1120,16 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1086
1120
  ### Board interaction overhaul
1087
1121
 
1088
1122
  - **Creation defaults must not become read defaults.** `createCluster` uses Balanced, Warn only at 15, a cluster-local board and Both. `normalizeTaskBoardMode` preserves legacy omitted board fields; omitted stored styles mean Thorough. Snapshot restore resolves legacy guard caps before applying styles. No existing project or cluster tasks move when the creation default changes.
1089
- - **The board's create/edit/delete operator surfaces send `wsSendRaw` task-ledger messages directly - they are NOT new server surface.** `createTask` / `editTask` / `deleteTask` in `ClusterTaskBoardTab` build `task_ledger_create` / `task_ledger_update` / `task_ledger_delete` with `workflowId = taskShowWorkflowId(members)` (first member, cwd-derived) and `boardKey = cluster.taskBoardKey`. Don't add parallel handlers - the existing `handleTaskLedger*` + `applyUpdate` / `removeTask` are the only path. `done` / `archived` are never set through these field edits; they stay on the dedicated status controls (the operator-acceptance boundary).
1123
+ - **The board's create/edit/delete operator surfaces send `wsSendRaw` task-ledger messages directly - they are NOT new server surface.** `createTask` / `editTask` / `deleteTask` in `ClusterTaskBoardTab` build `task_ledger_create` / `task_ledger_update` / `task_ledger_delete` with `workflowId = taskShowWorkflowId(members)` (first member, cwd-derived) and `boardKey = cluster.taskBoardKey`. Don't add parallel handlers - the existing `handleTaskLedger*` + `applyUpdate` / `removeTask` are the only path. `done` / `archived` are never set through these field edits; they stay on the dedicated operator status controls; Director met sign-off is the separate auto-done path.
1090
1124
  - **Create-on-board is a SINGLE board-level composer, deliberately not per-column.** `task_ledger_create` always yields `todo` (operator-confirmed-done invariant), so a per-column "Add a task…" field would mislead - every column's input would still produce a `todo` card. If a future change wants per-column create-into-status, it needs a create→update chain keyed on the server-assigned id (which arrives via snapshot, not a direct response), so it's non-trivial; don't "fix" the single composer into a misleading per-column one.
1091
1125
  - **Drag-to-restatus routes through `onUpdateTaskStatus` (the operator path) with a done/archived confirm - dnd-kit, pointer-only.** `BoardCard` is `useDraggable`, `BoardColumn` is `useDroppable`, `handleDragEnd` → `moveTask(active.id, over.id)`. The 4px PointerSensor activation distance is load-bearing: it lets a plain click still open the drawer (the card is a `<button onClick>` with `{...listeners}`). Touch has no drag path - the drawer status dropdown is the fallback. Don't drop the 4px constraint (clicks would start drags) and don't move terminal-status drops off the confirm.
1092
- - **The editable drawer reuses DEBAG's *visual* edit pattern, not the `GateApprovalNotice` component.** §10.7 said "build against DEBAG's shared proposal component"; in practice the gate card carries approve/reject/remember + arg-parsing semantics that don't fit task authoring. The drawer uses inline `editLabelStyle` / `editInputStyle` (accent-on-dirty) matching the gate look. This was a deliberate, documented call (plan §13 2026-06-26) - not an oversight; don't force a shared component that would couple task editing to gate semantics.
1126
+ - **The editable drawer reuses DEBAG's visual edit pattern, not the `GateApprovalNotice` component.** The drawer uses inline `editLabelStyle` / `editInputStyle` (accent-on-dirty). Gate approval and argument parsing do not belong to task editing.
1093
1127
  - **The plan/peer→task bridges are board-attached-only and reuse `task_ledger_create`.** `PlanBodyRenderer.onPromoteTask` (→ TASK pill on unchecked checkboxes) and `MailboxModal.onMakeTask` (→ TASK per pending peer message) both fire `task_ledger_create` on the first member with `cluster.taskBoardKey`, gated on `cluster.taskBoardMode !== 'none'`. The peer bridge lives on the pending-mailbox surface (it has cluster context); a delivered-chat `PeerMessageBlock` bridge is deferred (needs per-workflow cluster context). Don't wire the bridges when the board is detached - the task would land on a board the operator can't see.
1094
1128
  - **The automation header is collapsed by default.** It contains dispatcher and swarm controls. DRAFT ASSIST is hidden in this version.
1095
1129
 
1096
1130
  ### Director sign-off + per-card actions
1097
1131
 
1098
- - **`LedgerTask.signoff` is ADVISORY and never a terminal-status path.** A director writes `{ state: 'met' | 'not_met' | 'partial', summary? }` via `cluster_task_update`; `peerTaskUpdate` validates the state, **server-stamps `byWorkflowId` + `at`** (the model can't spoof author/time), and threads it into `applyUpdate`. It does NOT move the task to `done`/`archived` - those stay operator-only (the §D1 / H48 fence is untouched; `scripts/smoke/task-peer-lifecycle.ts` step `(d3)` asserts a worker still can't reach `done` through this path). The sign-off is a recommendation the operator reads on the card; the operator click is still the acceptance boundary. Don't let a `met` verdict auto-apply `done`.
1132
+ - **A Director met sign-off closes a task when Board auto-done is on.** `peerTaskUpdate` validates the verdict and server-stamps its author and time. With auto-done off, the task stays in review for the operator. Direct `done` and `archived` status changes remain operator-only; a worker cannot close a task by claiming a sign-off.
1099
1133
  - **The verdict is a field ON the task, written through all three transports.** `cluster_task_update`'s `signoff` arg is wired in `peerTools.ts` (Native input_schema + dispatch), `clusterMcpServer.ts` (zod schema + `callTaskUpdate`), and the `task-update` HTTP op in `clusterRoutes.ts` (read by the MCP child for CLI/Codex). It lives on `LedgerTask` (not a comment) precisely because the board card only has the task list - comments aren't loaded until drill-in, so an at-a-glance chip needs the data on the task. Additive + projection-safe like `assignee`/`worktree`: `normalizeTask` sanitizes it (`sanitizeSignoff`), `rebuildFromEvents` folds it through the carried `ev.task`.
1100
1134
  - **Per-card ACCEPT / RECHECK are operator surfaces, not new server messages.** `✓ ACCEPT` (formerly DONE) reuses `onUpdateTaskStatus` (the operator `task_ledger_update` path, same as MARK ALL DONE and ACCEPT ALL MET) - no confirm, since the labelled click is itself the acceptance. `↩ RECHECK` reuses the existing `operator_peer_send` rail to drop a templated recheck note into the sign-off author's mailbox. Both render only on REVIEW cards; the buttons are `role="button"` spans (NOT `<button>`, because the card is itself a draggable `<button>` - nested buttons are invalid HTML) with `onPointerDown`/`onClick` `stopPropagation` so they neither start a drag nor open the drawer.
1101
1135
  - **RECHECK's sender must differ from the recipient - `operator_peer_send` rejects `from === to`.** `recheckSenderFor` picks the task's assignee (if a member and ≠ the sign-off author), else any other member; if the only member is the author, RECHECK is unavailable (the call site gates on `cluster.members.length >= 2`). Don't send the recheck from the director to itself - the server (`ws/clusterHandlers.ts`, "cannot send to self") will reject it.
@@ -1110,7 +1144,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1110
1144
  - **Sender color is hashed from `senderWorkflowId`, not the displayed name.** djb2-style hash + 8-color palette in `ChatMessage.tsx`'s `hashSenderColor`. Same workflow always renders the same color across reloads, across sender/recipient panes, across cluster compositions. Don't switch to hashing displayName - that breaks the "color tracks identity, not display preference" invariant when lands operator-editable names.
1111
1145
  - **`cluster_state` push gate (`CLUSTER_STATE_TRIGGERS` in `server/src/server/broadcast.ts`) is the single source of truth.** Adding a new workflow-scoped event that should refresh cluster_state means editing that set; don't sprinkle `notifyClusterStateForWorkflow` calls at random emit sites. Today's set is `{ primary_turn_started, primary_turn_ended, peer_message_sent, peer_message_received }` - busy flips on the first pair, mailbox depth flips on the second pair. Streaming `primary_text` chunks deliberately do NOT trigger.
1112
1146
  - **Broadcast's idle-vs-queued split is a local snapshot, not the server's reply.** `ClusterTab`'s composer reads `cluster.members[i].status` at submit time to render the toast. The authoritative split lands in `cluster_broadcast_dispatched` but we don't currently mirror it to the store. The race window is tiny (member flips busy between snapshot and server fan-out) and the toast is informational. If a future surface needs accuracy (e.g. "couldn't reach member X" rendered visually), wire the dispatched event into the store there.
1113
- - **Layout-prop-leak invariant.** `MemberPane` props that are passed to ChatPanel + TerminalInput need to be passed in *every* density/layout variant of MemberPane - if you add a "compact MemberPane" mode, every prop the dense variant threads must also be threaded by the compact variant. Pokegents' AgentCard regression (referenced in plan §7e) was a missing prop in one variant; the bug only surfaced for users who hit that variant. Pattern fix: make the prop list explicit, never spread `{...props}` across variants.
1147
+ - **Layout-prop-leak invariant.** `MemberPane` props that are passed to ChatPanel + TerminalInput need to be passed in *every* density/layout variant of MemberPane - if you add a "compact MemberPane" mode, every prop the dense variant threads must also be threaded by the compact variant. A missing prop in one variant leaves that layout without the corresponding behavior. Pattern fix: make the prop list explicit, never spread `{...props}` across variants.
1114
1148
  - **Right-click context menu is the only such surface in the app.** `TabContextMenu` is scoped to "create cluster from this tab + others." If a future feature wants a tab right-click action (rename, duplicate, move-to-cluster), plug into the same component rather than spawning a parallel context-menu pattern. Resist the urge to make `TabContextMenu` generic until there are actually two consumers.
1115
1149
  - **Cluster tear-down must go through `cluster_delete` (or REST `DELETE /api/clusters/:id`).** Don't add a UI-only "remove cluster from store" path. Removing the local entry without the server-side teardown leaves the mailbox directory + meta.json on disk and the per-member `clusterId` lookup intact - the next peer_send call would still resolve. The autonomy four-question test answer #4 (reversibility) requires a single teardown path; both REST and WS delegate to `clusterStore.deleteCluster`.
1116
1150
  - **`cluster_state` is NOT persisted to events.jsonl - it's a derived snapshot.** Every member has its own events.jsonl with `peer_message_*` events; the cluster meta.json lives on disk; mailbox files live on disk. `cluster_state` is built fresh from those three sources every push. If you find yourself wanting to persist cluster_state for offline replay, you're recreating state that's already on disk in three places. Use those instead.
@@ -1130,7 +1164,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1130
1164
  ### gotchas (primitives + cluster management UX)
1131
1165
 
1132
1166
  - **HANDOFF preserves cluster membership for free - DO NOT add explicit rebind logic.** `clusterStore` keys membership on `workflowId`; HANDOFF rotates the session inside the same `workflowId`. The `clusterId` lookup at `handleUserMessage` turn start re-resolves on every turn, so the post-handoff session sees `peer_*` tools register naturally. Adding "preserve cluster" code in `handleHandoffRequest` would be no-op but would create the impression that membership is tracked elsewhere - and a future contributor might "fix" the no-op by introducing an actual rebind, which races against `clusterStore.memberIndex` and creates duplicate-member bugs.
1133
- - **SPAWN-into-cluster validates Native transport BEFORE creating the new workflow.** Up-front rejection means no orphan tabs on `member_not_native`. A post-create rejection (workflow exists but cluster join refused) is the backstop for genuine race conditions (cluster deleted between validate and join); it surfaces a system_notice rather than tearing down the new tab. Don't reorder - operator getting a created tab they didn't want is worse than a clear up-front error.
1167
+ - **SPAWN-into-cluster validates the target BEFORE creating the new workflow.** `handleSpawnFromHere` (`ws/handoffHandlers.ts`) refuses an unknown cluster, a provider other than Claude or Codex (`member_not_supported`), a disabled provider and a member identity problem (`spawnIdentityProblem`) up front, so no orphan tab is left. A post-create rejection (workflow exists but cluster join refused) is the backstop for genuine race conditions (cluster deleted between validate and join); it surfaces a system_notice rather than tearing down the new tab. Don't reorder - operator getting a created tab they didn't want is worse than a clear up-front error.
1134
1168
  - **REVIEW peer-row serialization is in `extractTurns`, not a separate pass.** Don't try to inject peer rows in `formatTurns` by re-walking events - `extractTurns` is the only place that knows the turn-boundary positions (between `user_message_echo` and `primary_complete`). The `pendingPeerReceived` running buffer is the correct shape; resetting it on every echoed turn (whether or not the turn made it into the output) prevents stale received-rows from leaking forward.
1135
1169
  - **`peer_message_sent` carries only a `contentPreview` (≤200 chars), not the full content.** The recipient's `peer_message_received` event has the full body - that's the durable record. Reviewer sees the preview on the sender side and the full body on the recipient side. Don't try to "rejoin" by msgId in the serializer; the reviewer's window into the conversation is per-workflow.
1136
1170
  - **`createBlankNativeWorkflow` is a minimal pre-replay helper for B3 - don't extend it for resume / rehydrate cases.** It deliberately skips the savedMeta restoration logic (autoHandoff / efficiency toggles / outputStyle / planId / calibration / preview) that `handleCreateWorkflow` performs because B3 only creates *fresh* workflows. If a future surface wants to "fork N workers from a template that has prior state," it should call `handleCreateWorkflow` (so resume + rehydrate hooks fire) and chain the cluster create separately. Mixing the two paths in one helper would silently drop state on the fresh path.
@@ -1141,38 +1175,38 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1141
1175
  ### gotchas (cluster-attached plan + role hints)
1142
1176
 
1143
1177
  - **System-block ordering invariant: FORCED_FIRST_BLOCK → north-star → cluster plan → cluster role → appendSystemPrompt → systemPrompt → output style.** The Native worker's `buildSystemBlocks()` is the single source of truth. The plan + role blocks land AFTER `FORCED_FIRST_BLOCK` (which keeps its `cache_control: ephemeral, ttl: 1h`) and BEFORE the operator's prompts so the model reads them as load-bearing framing. Reordering breaks the prefix-cache strategy AND moves the operator's prompt before the cluster context - that flip would cause the model to read cluster guidance as a mid-prompt aside instead of a frame. Plan + role both carry `cache_control: ephemeral` (no ttl, normal cache shape).
1144
- - **North-star (GOAL_NORTHSTAR_PLAN.md) sits immediately after `FORCED_FIRST_BLOCK`, before the cluster plan, and carries NO cache breakpoint of its own.** `goalBlock(this.config.goal)` is pushed at index 1 in `buildSystemBlocks()` (the most stable per-session block after the identity block, so it rides the plan-boundary / last-block breakpoint's cached prefix). It is null-when-empty (`goalBlock` returns null for blank ⇒ no block, zero extra input tokens). The trailer ("It is context, not an instruction to act autonomously... not trigger unrequested work") is load-bearing - it forecloses the model reading the north-star as license to self-drive; do not soften it. **Injection is per-provider, NOT via the turnEngine `finalAppend` fold:** Native pushes its own block; every other transport folds `goalBlock(config.goal)` inside its own provider (CLI Claude `--append-system-prompt`, both Codex prefixes system array, Ollama/llama.cpp/LM Studio `systemPrompt`, Cursor ACP worker + print path). This is deliberate - reviewers spawn via `manager.spawn` and handoff seeds via `runPrimaryTurn`, both of which bypass the operator-turn `finalAppend` assembly but still carry `config.goal`, so the provider fold is the one place that covers operator turns AND primitive seeds without double-injecting. Don't add a turnEngine `finalAppend`/`finalSystemPrompt` fold "for parity" - it would double-inject on non-Native operator turns.
1178
+ - **North-star (GOAL_NORTHSTAR_PLAN.md) sits immediately after `FORCED_FIRST_BLOCK`, before the cluster plan, and carries NO cache breakpoint of its own.** `goalBlock(this.config.goal)` is pushed at index 1 in `buildSystemBlocks()` (the most stable per-session block after the identity block, so it rides the plan-boundary / last-block breakpoint's cached prefix). It is null-when-empty (`goalBlock` returns null for blank ⇒ no block, zero extra input tokens). The trailer ("It is context, not an instruction to act autonomously... not trigger unrequested work") is load-bearing - it forecloses the model reading the north-star as license to self-drive; do not soften it. **Injection is per-provider, NOT via the turnEngine `finalAppend` fold:** Native pushes its own block; supported transports other than Antigravity CLI fold `goalBlock(config.goal)` inside the provider (CLI Claude `--append-system-prompt`, both Codex prefixes system array, Ollama/llama.cpp/LM Studio `systemPrompt`, Cursor ACP worker + print path). This is deliberate - reviewers spawn via `manager.spawn` and handoff seeds via `runPrimaryTurn`, both of which bypass the operator-turn `finalAppend` assembly but still carry `config.goal`, so the provider fold is the one place that covers operator turns AND primitive seeds without double-injecting. Don't add a turnEngine `finalAppend`/`finalSystemPrompt` fold "for parity" - it would double-inject on non-Native operator turns.
1145
1179
  - **Cluster plan + role are resolved per-turn in `handleUserMessage`, not at worker construction.** They live on `WorkerConfig.clusterPlan` / `clusterRole` and the Native worker reads `this.config.clusterPlan` from `buildSystemBlocks()`. `ClaudeNativeTurn.spawn` calls `worker.updateConfig(this.config)` on every turn, so plan / role changes between turns surface automatically - no callback, no re-construction. The "callback" alternative (worker invokes `clusterContext()` during build) was rejected in §13; don't reintroduce it without a §13 entry explaining why per-turn resolution stopped working.
1146
1180
  - **Editing the plan mid-turn does NOT tear down the running turn.** The worker reads `this.config.clusterPlan` once at `buildSystemBlocks` per `messages.create`; the new body lands on the NEXT `runPrimaryTurn` call. This is the correct shape - in-flight tool dispatch carries on uninterrupted; the next operator prompt picks up the new plan. If you find yourself wanting to push the new plan into an in-flight turn, stop: that path leads to mid-turn system-prompt invalidation, which Anthropic's API doesn't support cleanly.
1147
1181
  - **Plan body cap = 32768 chars (`PLAN_MAX_BYTES`), role cap = 120 chars (`MEMBER_ROLE_MAX`).** Both are server-enforced; the UI soft-warns at 28672 chars. Server returns explicit `{type:'error', message:'cluster_plan_set rejected: body_too_large:N'}` which rides through `NotificationToasts`. Don't loosen these without a §13 entry - the caps exist to bound steady-state per-turn context size.
1148
1182
  - **Model-driven cluster plan writes are additive.** `cluster_plan_write` reads the existing `plan.md` and rejects writes that remove any existing checkbox task text or change its `[ ]` / `[x]` status. New sections, prose, and new checkbox items are fine. Status changes go through `cluster_plan_tick`; destructive replace/clear is operator-only through the PLAN tab. This guard applies to existing clusters because it reads the current persisted plan on every model write.
1149
1183
  - **`cluster_state` push now carries the full plan body inline (up to 32 KB), not a hash + lazy fetch.** Acceptable today (32 KB × N members × push frequency is well under any practical bandwidth concern), but worth noting before adding additional `CLUSTER_STATE_TRIGGERS`. If push frequency grows, switch `state.plan` to a hash + `GET /api/clusters/:id/plan` fetch rather than dropping the field.
1150
1184
  - **Plan block's `cache_control: ephemeral` means editing the plan invalidates the cache for the suffix.** `FORCED_FIRST_BLOCK` keeps its 1h-ttl cache regardless, so at minimum the front-of-prompt cache survives - but `appendSystemPrompt`, operator `systemPrompt`, and the output-style block all lose their hits on the next turn after a plan edit. This is the right trade (plan changes are operator-driven and rare; cache-miss-on-suffix is cheap), but don't add a second `cache_control` after the plan block unless you mean to fragment the cache further.
1151
- - **Role overlay is operator-chosen - presets are editor suggestions, never silent defaults.** Lite §12 open question 4 originally shipped no defaults; `shared/src/clusterRolePresets.ts` now offers presets the operator picks in the editor, and `normalizeClusterRoleText` only upgrades exact older preset strings (never operator-edited text). Defaults imply an opinion about workflow shape, which is a non-goal. If a future surface wants to suggest roles (e.g. "this looks like a director - set role?"), it must surface as an operator-confirmed suggestion, not a silent default. Read `CLAUDE.md`'s "operator-armed surfaces" framing before adding any seeded value.
1185
+ - **Role overlay is operator-chosen - presets are editor suggestions, never silent defaults.** Lite §12 open question 4 originally shipped no defaults; `shared/src/clusterRolePresets.ts` now offers presets the operator picks in the editor, and `normalizeClusterRoleText` only upgrades exact older preset strings (never operator-edited text). Defaults imply an opinion about workflow shape, which is a non-goal. If a future surface wants to suggest roles (e.g. "this looks like a director - set role?"), it must surface as an operator-confirmed suggestion, not a silent default. Keep role suggestions explicit and operator-confirmed.
1152
1186
  - **`getMemberRole(clusterId, workflowId)` is synchronous (in-memory cache only).** Called per-turn in `handleUserMessage`. The cache is populated by `readCluster` on first access; if you ever add a path that calls `getMemberRole` without `readCluster` first (e.g. a fresh-server-process read for a clusterId that hasn't been touched yet), it returns `undefined` silently. The handleUserMessage path is safe because `getClusterIdForWorkflow` already populated the cache, but a different call site might surprise you.
1153
- - **PROMOTE TO CLUSTER copies the plan body into `cluster_plan_set`; it does NOT detach the source plan from the workflow.** The per-workflow plan stays attached to the member that promoted it. Operator can clear the cluster plan independently. This is intentional - the cluster plan is a separate concept from the per-workflow plan, not a "view" of it; treating them as linked would force a re-architecture of `planStore` keying.
1187
+ - **PROMOTE TO CLUSTER copies the plan body into `cluster_plan_set` and detaches the member's local plan.** This leaves the shared cluster plan as the active source rather than a stale per-tab copy. The operator can clear the cluster plan independently.
1154
1188
 
1155
1189
  ### gotchas (CLI transport - MCP wiring)
1156
1190
 
1157
1191
  - **MCP tool names are namespaced on the wire: `mcp__arco-cluster__peer_send`, NOT bare `peer_send`.** Claude CLI surfaces MCP tools with the `mcp__<server-name>__` prefix where `<server-name>` is the top-level key in `mcp-config.json`'s `mcpServers` map. Native registers bare names. Function shapes match so the model treats them identically, but any code that pattern-matches on the wire-level tool name (transcript renderers, hook filters, reviewer serializers) needs to handle both forms. Today's match site is just `isPeerTool` in `peerTools.ts`, which only runs on Native; CLI dispatches through MCP's own routing. If you add a CLI-side hook that fires on peer_* tool calls, match both prefixes. **Codex code-mode adds a third form**: inside the exec code cell the same tools appear as `tools.mcp__arco_cluster__peer_send` - dash → **underscore** in the server-name segment. Three shapes for one tool; never assume one.
1158
1192
  - **Codex code-mode cluster members need the code-mode addendum - don't remove it.** Catalog-marked models including gpt-5.6 sol/terra/luna and gpt-6 astra/sol/luna run OpenAI's own multi-agent harness ("you are `/root`", native `spawn_agent`/`send_message`, tool surface = a JS `exec` code cell). The arco-cluster tools survive but only as `tools.mcp__arco_cluster__<tool>` inside the exec cell - a member told "use peer_send" finds nothing and coordinates through the harness's own (dead-end) tools instead, reporting itself as the director. `turnEngine` folds `codexCodeModeClusterAddendum()` (`server/src/providers/codexCodeMode.ts`) after the role hint for Codex members whose model the Codex `models_cache.json` catalog marks code-mode (`tool_mode`/`multi_agent_version` - the fields that gate the harness client-side). Detection is catalog-driven and fail-open on unknown; the addendum text is conditionally phrased so it's inert on plain function-calling models. App-server also sends the stable role, tool mapping, and Director contract through `developerInstructions`. Verified live on both Codex transports for the original gpt-5.6 fix; the Astra prompt contract is pinned by `npm run smoke:astra-cluster-director`. Full write-up: `docs/CODEX_GPT56_CLUSTER_INCOMPAT.md`.
1159
1193
  - **The string-form cluster fold shrinks ONLY the plan - never the small blocks.** CLI transports retain the 16 KB `APPEND_CLUSTER_MAX`; Codex app-server uses a bounded 48 KB `CODEX_APP_SERVER_CLUSTER_MAX` because JSON-RPC stdin has no argv ceiling and the larger bound admits a maximum-size plan plus role/doctrines. Do not make app-server unlimited: its prefix repeats per turn and consumes thread context. `composeClusterAppend` reserves small blocks plus already-folded bytes first. An over-budget plan folds as a deterministic OUTLINE; `clusterPlanOutline.ts` preserves headings, checkboxes, and sections labelled standing/rules/gates/contract/authority/cadence, with the full body one `cluster_plan_read` call away. The outline header and truncation logging are load-bearing. Regression tests: `npm run test:cluster-fold -w server` and `npm run smoke:astra-cluster-director`.
1160
- - **The MCP child is per-spawn, NOT per-cluster.** Each `claude` CLI invocation launches its own short-lived stdio MCP child via `mcp-config.json`. N CLI members of one cluster CANNOT share one MCP child - stdio is point-to-point and Claude CLI owns the child lifecycle. The shared backing store is Arco's in-memory state, reached by every MCP child over loopback HTTP. Plan §13 (2026-05-10) records the decision. Don't try to refactor to a "per-cluster long-lived MCP server"; that path needs SSE transport and an internal IPC bridge that doesn't pay back its complexity.
1194
+ - **The MCP child is per-spawn, NOT per-cluster.** Each `claude` CLI invocation launches its own short-lived stdio MCP child via `mcp-config.json`. N CLI members of one cluster CANNOT share one MCP child - stdio is point-to-point and Claude CLI owns the child lifecycle. The shared backing store is Arco's in-memory state, reached by every MCP child over loopback HTTP. Don't try to refactor to a "per-cluster long-lived MCP server"; that path needs SSE transport and an internal IPC bridge that doesn't pay back its complexity.
1161
1195
  - **Arco's HTTP port flows to the MCP child via positional argv, NOT env-inherited.** `mcpConfigWriter.writeFor` writes the third argv as `process.env.ARCO_PORT ?? '3001'`. The child does NOT read `process.env.ARCO_PORT` - claude may scrub or mutate env on the way down. If a future surface needs another runtime parameter passed to the child (auth token, cluster-scoped flag), add a fourth argv rather than relying on env.
1162
1196
  - **The MCP child's stdout is the JSON-RPC wire - all logging goes to stderr.** `clusterMcpServer.ts` uses `console.error` exclusively (and the SDK's own logging also routes to stderr). A `console.log` slipping into the child would corrupt the MCP protocol stream and break tool dispatch silently. If you extend the child with new tools, hold this invariant. Operator-visible diagnostics surface as `[mcp:arco-cluster:stderr]` in the claude CLI's transcript.
1163
1197
  - **`mcp-config.json` cleanup is best-effort, but mandatory on member detach.** `handleClusterDelete` and `handleClusterMemberRemove` call `mcpConfigWriter.cleanupFor` for every leaving member. A stale config on a downgraded-to-plain workflow would launch an MCP child on the next CLI spawn - the child would 404 on every tool call (REST surface verifies cluster exists) but the wasted spawn cycle is operator-visible churn. The cleanup uses `fs.rm({ force: true })` so missing files don't throw.
1164
1198
  - **REST `/api/clusters/:id/peer/*` trusts the body's `from`/`workflowId` field - loopback-only assumption.** The MCP child has the workflowId baked into argv at spawn time, and the server binds 127.0.0.1 by default. Any future remote-access mode (tunnel, container exposure on 0.0.0.0) MUST add authentication to these endpoints first - otherwise a remote client could impersonate any cluster member. Memory: Arco remote access architecture says tunneling exists; Arco makes the trust assumption explicit but doesn't gate on it.
1165
1199
  - **CLI cluster member `--append-system-prompt` is soft-capped at 16 KB.** The peer-mailbox prologue + plan + role get combined into `finalAppend` in `handleUserMessage`. The hard kernel limit for argv is ~128 KB (ARG_MAX), and the existing tmpfile fallback (`--append-system-prompt-file`) handles arbitrary sizes - but the 16 KB soft cap surfaces pathological mailbox growth (worst case 50 × 16 KB = 800 KB) early instead of writing that to tmpfs every turn. The cap truncates with a `[... truncated by cluster appendSystemPrompt cap]` sentinel; the truncated content is always at the *end* (peer prologue + plan + role sit at the head).
1166
- - **`assertAllMembersClaude` was renamed to `assertAllMembersClaudeOrCodex` in - but the fence has since widened past its name.** It now gates on `isClusterMemberProvider(provider)` (`shared/src/protocol/clusters.ts` `CLUSTER_MEMBER_PROVIDERS = ['claude', 'codex', 'ollama', 'llamacpp', 'cursor']`), so it accepts Claude (Native + CLI), Codex (`exec` + `appserver`), Ollama, llama.cpp, and Cursor (ACP, peer tools via the loopback HTTP MCP); it rejects unsupported providers (including removed Z.ai / Gemini / Antigravity). The function name is now misleading - don't infer the accepted set from it. Local Ollama / llama.cpp membership is limited by `localClusterCapacity` (Connections; default 1 each); create/add/replace refuse with `local_capacity: <reason>` unless `ARCO_CLUSTER_ALLOW_MULTIPLE_LOCAL=1`. Every cluster-join path goes through `assertAllMembersClaudeOrCodex` - loosening the provider fence further requires an explicit protocol decision.
1200
+ - **`assertAllMembersClaude` was renamed to `assertAllMembersClaudeOrCodex` in - but the fence has since widened past its name.** It now gates on `isClusterMemberProvider(provider)` (`shared/src/protocol/clusters.ts` `CLUSTER_MEMBER_PROVIDERS = ['claude', 'codex', 'ollama', 'llamacpp', 'cursor', 'antigravity-cli']`), so it accepts Claude (Native + CLI), Codex (`exec` + `appserver`), Ollama, llama.cpp, Cursor and Antigravity CLI; it rejects unsupported and retired providers. Antigravity CLI members start only on the operator's NUDGE or typed message. The function name is now misleading - don't infer the accepted set from it. Local Ollama / llama.cpp membership is limited by `localClusterCapacity` (the Ollama or llama.cpp page of the Connections window; default 1 each); create/add/replace refuse with `local_capacity: <reason>` unless `ARCO_CLUSTER_ALLOW_MULTIPLE_LOCAL=1`. Every cluster-join path goes through `assertAllMembersClaudeOrCodex` - loosening the provider fence further requires an explicit protocol decision.
1167
1201
  - **Shared `clusterPeerOps.ts` is the single source of truth for peer-op behaviour.** Native `peerTools.ts` and the REST handlers in `http/clusterRoutes.ts` (the CLI/Codex/Cursor MCP children's backend) both delegate to this module. The events emitted (`peer_message_sent` / `peer_send_rejected` / `peer_message_received`) are identical across transports. If you add a new rejection class, do it in `clusterPeerOps.peerSend`'s return shape (extend `PeerSendRejection.code`) so both transports get it for free. Don't add transport-specific event variants - the peer wire surface stays unified.
1168
- - **MCP SDK version (`@modelcontextprotocol/sdk`) is loosely pinned.** Package.json says `^1.18.0`; npm resolved 1.29.0 at install. The API surface used (`McpServer.registerTool` + `StdioServerTransport`) is stable across this range. If Anthropic's CLI ever returns a protocol-version mismatch error, switch `^` to `=` and pin to the version that matches the CLI's `--version` output.
1202
+ - **MCP SDK version (`@modelcontextprotocol/sdk`) is loosely pinned.** `server/package.json` says `^1.18.0`; the lockfile currently resolves 1.32.2. The API surface used (`McpServer.registerTool` + `StdioServerTransport`) is stable across this range. If Anthropic's CLI ever returns a protocol-version mismatch error, switch `^` to `=` and pin to the version that matches the CLI's `--version` output.
1169
1203
 
1170
1204
  ### gotchas (Codex transport)
1171
1205
 
1172
1206
  - **Codex registers MCP via `-c key=value` argv overrides - there is NO `--mcp-config <path>` flag.** `codex --help` lists `-c <key=value>` (TOML dotted-path override) as the canonical mechanism for layering on top of `~/.codex/config.toml`. `mcpConfigWriter.buildCodexMcpOverrides` returns the two `-c` argv pairs; both `codex.ts` and `codex-appserver/worker.ts` consume that helper. If a future Codex CLI version adds `--mcp-config <path>`, switching is a one-edit change in those two providers - but until then, do NOT introduce a temp config.toml file or a `~/.codex/config.toml` merge layer; the overrides preserve the operator's existing MCP entries without any merge logic.
1173
1207
  - **Codex `app-server`'s MCP child and cluster developer instructions live for the appserver thread bootstrap, not per-turn.** Asymmetric with `codex exec` and Claude CLI (both per-spawn). `currentMcpSignature` includes cluster wiring, account, role, and model. A change recycles the cached child and resumes the same Codex thread; `thread/start` / `thread/resume` then receive the current operator role, code-mode mapping, and derived Director contract through `developerInstructions`. Mutable plan content still rides per-turn input.
1174
1208
  - **No `mcp-config.json` file is written for Codex cluster members.** `mcpConfigWriter.writeFor` is Claude-CLI-only. Arco's smoke explicitly asserts the file's absence for Codex members - if a regression starts emitting it, the cleanup-on-detach path won't be wired for the Codex side and stale configs would accumulate. (And it'd be wasted work - Codex doesn't read the file anyway.)
1175
- - **The Director contract delegates and lands; it never tells the director to keep working until the plan is done.** `clusterDirector.ts` gives a role starting with Director/Coordinator: delegate implementation/builds/tests via peer_send, don't write code, read the full diff + peer gate evidence, then commit/push; edit plan tasks but keep status on the board. The Director delegates, reviews evidence, and does not continue implementation or record progress in the plan. Don't reintroduce continue-until-done or evidence-into-plan wording (CLAUDE.md fence: model proposes/delegates, operator owns "is this done?"). Pinned by `smoke:astra-cluster-director` + `test:codex-code-mode`.
1209
+ - **The Director contract delegates and lands.** `clusterDirector.ts` gives a role starting with Director/Coordinator: delegate implementation/builds/tests via peer_send, don't write code, read the full diff + peer gate evidence, then commit/push; edit plan tasks but keep status on the board. The Director answers first, continues approved coordination, delegates implementation, reviews evidence, and records progress on the board. Do not move progress evidence into the plan body. Pinned by `smoke:astra-cluster-director` + `test:codex-code-mode`.
1176
1210
  - **Cluster plan + role + mailbox prologue ride through `WorkerConfig.appendSystemPrompt` for both Codex transports.** Native still injects forced system blocks. Codex app-server also duplicates the stable role/tool/Director contract at developer level because its built-in `/root` framing otherwise outranks the user-text prefix. The app-server fold cap is 48 KB; CLI stays 16 KB.
1177
1211
  - **Codex CLI's `-c` value is parsed as TOML.** Strings need quoting, arrays use TOML array syntax. We emit via `JSON.stringify` because TOML strings and arrays are a strict superset of JSON's quoting rules for `string | string[]` shapes - handy. If you ever extend `buildCodexMcpOverrides` to emit non-string-non-array values (booleans, integers), JSON.stringify still works for those primitives because TOML accepts the JSON literal forms.
1178
1212
  - **`SpawnDialog` / `TabContextMenu` / `ClusterRightPanel` candidate filters now accept `provider === 'codex'` alongside `'claude'`.** `TabContextMenu` uses the shared `isClusterMemberProvider` less Cursor; do not reintroduce a hand-written provider list there. Cursor stays out on purpose, as in `AddWorkerSection`'s ADD EXISTING: an open Cursor tab's ACP session fixed its `mcpServers` without the loopback peer-tools MCP, so it would join as a member that cannot read or send mail until its worker restarts. A polish pass should rename the still-misleadingly-named `anchorIsNative` local in `TabContextMenu.tsx` to something provider-agnostic; left as-is to keep the diff scoped.
@@ -1194,7 +1228,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1194
1228
  - **Message guards are independent of efficiency.** `clusterPeerOps.peerSend` resolves `getMessageGuard` on each send. Legacy missing guards resolve to hard 15/8/4; `setEfficiency` pins that guard before changing style. Warn-only warnings are claimed after successful enqueue, at most once per primary turn. Failed sends refund reservations; mode edits do not reset counts. No limit does not disable deduplication, size, permissions or automatic-execution fences.
1195
1229
  - **Progress-tracking mode is a per-cluster deterministic doctrine knob whose default (`'both'`) is intentionally NON-empty - unlike efficiency's no-op `'thorough'`.** `clusterProgress.ts` `buildProgressDoctrine(mode, hasPlan, hasBoard)` returns a canned system-prompt clause bundle (`PLAN_CLAUSE`/`BOARD_CLAUSE`/`RECONCILE_CLAUSE`), gated on which surfaces actually exist - `undefined` only when neither exists. Modes `'plan' | 'board' | 'both'`, default `CLUSTER_PROGRESS_DEFAULT = 'both'`. turnEngine resolves it once and threads it as `WorkerConfig.clusterProgressDoctrine`; every transport that folds the cluster plan folds this too (Native pushes it as its own block after the efficiency doctrine, before the delegation contract). Operator entry is `cluster_progress_set { clusterId, mode }`; `ClusterState.progressTracking` persists to cluster meta.json ONLY when non-default (so pre-feature cluster meta stays byte-identical), echoed in `ClusterStatePayload.progressTracking` only when non-default. Because the default is non-empty, a brand-new cluster gets the doctrine - don't "optimize" it to inject nothing by default.
1196
1230
  - **`ClusterActivityTab` derives membership/role/plan events from `cluster_state` diffs, not a server-side audit log.** The diff happens in a `useEffect` snapshot inside the component - if the operator opens the ACTIVITY tab AFTER a membership change, the change won't appear (no diff baseline). This is intentional: a server-side audit log would duplicate state that already lives in `cluster_state` + per-member events.jsonl. If a future surface needs full membership history, it scans events.jsonl, NOT a new audit file.
1197
- - **`ClusterRightPanel` uses the same two-level grouping pattern as `RightPanel`.** Groups are `WORKSPACE` (`members`, `files`), `AGENT` (`activity`, `reviews`, `handoffs`, `plan`, `board`, `mailbox`), `MEMORY` (`history`), and `RUNTIME` (`preview`, `config`, `github`). CONFIG is member-scoped: it renders the existing `ConfigTab` for the selected member and dispatches ordinary per-workflow update wires (`update_primary_config`, codebase-memory, MCP registry). Do not add an implicit "apply to every member" path without an explicit operator confirmation surface and event trail.
1231
+ - **`ClusterRightPanel` uses the same two-level grouping pattern as `RightPanel`.** Groups are `WORKSPACE` (`results` in a research project only, `members`, `files`), `AGENT` (`activity`, `reviews`, `handoffs`, `plan`, `board`, `mailbox`), `MEMORY` (`history`, `usage`), and `RUNTIME` (`preview`, `config`, `github`); the mobile view moves some tabs under `MORE`. CONFIG is member-scoped: it renders the existing `ConfigTab` for the selected member and dispatches ordinary per-workflow update wires (`update_primary_config`, codebase-memory, MCP registry). Do not add an implicit "apply to every member" path without an explicit operator confirmation surface and event trail.
1198
1232
 
1199
1233
  ### Cluster-ops push gotchas
1200
1234
 
@@ -1258,7 +1292,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1258
1292
  - **Operator-only - NEVER wire the model into the PTY.** `ptyManager` is not a tool; nothing in `server/src/providers/*Tools.ts` or any tool registry references it. Agents have their own per-turn Bash within tool-use. Exposing this PTY as a callable tool is the autonomous-shell fence - the exact thing the four-question test exists to reject. If you add a "run a command in the terminal" surface, it must be operator-pre-filled-never-auto-executed (the K3 chip pattern), not a model tool.
1259
1293
  - **Session ≠ connection - closing the window must DETACH, not kill.** `terminalChannel.ts`'s `ws.on('close')` calls `ptyManager.detach`, never `kill`. The shell (and any `npm run dev` / `sleep 30` in it) keeps running; the scrollback ring keeps filling so the next attach repaints. Only `terminal_kill` (operator KILL), `killForWorkflow` (tab close), or `killAll` (shutdown) reap a session. If you ever make window-close kill the shell, you've broken THE acceptance criterion. The smoke (`npm run smoke:terminal`) asserts detach-keeps-alive explicitly.
1260
1294
  - **The raw byte stream is OFF the seq'd `/ws` protocol and OUT of `events.jsonl`.** It rides the dedicated `/terminal` WS path (`terminalChannel.ts`), which never touches `persistAndStampSeq` or `broadcastWorkflow`. Only lifecycle (`terminal_opened` / `terminal_killed`) and command lines (`terminal_command_logged`) are persisted, via `broadcastWorkflow` from `index.ts`. Don't "unify" the channels to simplify - streaming every PTY frame through `events.jsonl` would bloat the log by orders of magnitude (the deliberate granularity choice).
1261
- - **`/terminal` inherits `/ws`'s access posture; it does not add its own.** Both ride the same loopback-bound HTTP server (`HOST=127.0.0.1` by default - `server/src/server/constants.ts`). There is NO per-connection token/origin check on `/ws`; the loopback bind IS the gate. `terminalChannel.handleTerminalUpgrade` is fed from the same `httpServer.on('upgrade')` fan-out, so it's exactly as exposed as `/ws` - no more, no less. If you ever add auth to `/ws`, add the same to `/terminal` in the same change; don't let them drift.
1295
+ - **`/terminal` inherits `/ws`'s access posture; it does not add its own.** Both ride the same HTTP server (`HOST=127.0.0.1` by default - `server/src/server/constants.ts`) and the same session-cookie gate (`server/src/http/wsAuth.ts`, see Operator session-cookie gate); `ARCO_WS_AUTH=off` lifts it for both and is for test servers only. `terminalChannel.handleTerminalUpgrade` is fed from the same `httpServer.on('upgrade')` fan-out, so it's exactly as exposed as `/ws` - no more, no less. If you change the gate for one, change it for the other in the same commit; don't let them drift.
1262
1296
  - **The HTTP server must have exactly ONE `upgrade` listener - the manual fan-out in `index.ts`.** Do NOT build the `/ws` server as `new WebSocketServer({ server: httpServer, path: '/ws' })`: that makes ws attach its OWN `upgrade` listener IN ADDITION to the manual fan-out. Both fire for every upgrade, and for any non-`/ws` upgrade (`/terminal`, preview) the fan-out upgrades the socket first, then ws's listener (path mismatch → `shouldHandle` false) calls `abortHandshake(socket, 400)` on the now-LIVE socket, writing `HTTP/1.1 400 Bad Request` into the raw WS stream. The browser reads the leading `H` (0x48) as a frame header with RSV1 set → "Invalid frame header" and a permanently dead channel. Fix/shape: `wss` is `noServer:true`; the single fan-out routes `/ws` via `wss.handleUpgrade(req, socket, head, (c, r) => wss.emit('connection', c, r))`. If you add another WS endpoint, route it in that SAME fan-out - never give a second `WebSocketServer` the `{ server }` option.
1263
1297
  - **xterm needs LITERAL colours/fonts - CSS custom properties don't resolve in a canvas (2026-06-01).** `XtermView` renders to `<canvas>`, so `theme.background` / `fontFamily` must be concrete strings; `fontFamily: 'var(--font-code)'` silently fell back to monospace and the bg was hardcoded. Read the computed tokens off `:root` - `getComputedStyle(document.documentElement).getPropertyValue('--color-bg' | '--color-fg' | '--color-accent-primary' | '--font-code')` - pass those to the `Terminal` ctor, and re-apply on `settings.themeId` change (apply.ts has written the new vars by then). Never hand `var(--…)` to xterm options. ANSI 16-colour palette is left at xterm's default on purpose so coloured shell output stays legible on every theme.
1264
1298
  - **The `/terminal` WS must be proxied in `client/vite.config.ts` - and the smokes can't catch a regression (§K4).** XtermView connects to `ws(s)://${location.host}/terminal`; in the browser / over a 5173 tunnel that host is Vite, so the `configureServer` upgrade handler must forward `/terminal` upgrades to the Arco server exactly like `/ws`. K1 shipped proxying only `/ws`, so the in-app terminal and the K4 pop-out were both dead in an actual browser - undetected because `scripts/smoke/terminal*.ts` connect to `:3001` directly, bypassing Vite. K4 added `/terminal` to the handler (`wsPath === '/ws' || wsPath === '/terminal' || previewWfid`). It's collision-free: Vite's own HMR upgrade keys off the `vite-hmr` subprotocol, which a bare `new WebSocket('/terminal')` never sends. If you touch that upgrade handler, keep `/terminal` in it; there is no automated test guarding it (browser-only path).
@@ -1372,7 +1406,7 @@ Smoke: `npm run smoke:bakeoff`.
1372
1406
  utterance whose first word was something else (the runtime test pins it).
1373
1407
  Reject later/prefixed mentions, canceled/late candidates and responses after
1374
1408
  disable. The fast-wake partial is HELD until 0.6 s of speech has been heard
1375
- (`recognizer.py`): the forced grammar turned "Can you..." into a
1409
+ (`server/src/voice/recognizer.py`): the forced grammar turned "Can you..." into a
1376
1410
  partial "computer" 250 ms in and chimed; "Can you bring up the plan" now
1377
1411
  stays silent in `scripts/voice/check-phrases.py` while "Computer" still
1378
1412
  chimes as the word ends in that synthetic check - but live it still fired on
@@ -1478,12 +1512,12 @@ Smoke: `npm run smoke:bakeoff`.
1478
1512
  - **Resolve conversational scope before testing ambiguity.** The roster line
1479
1513
  describes the UI, not a replacement for the retained conversation. Explicit
1480
1514
  current targets win, then clear references in recent questions/answers/tool
1481
- results, then the selected cluster when no topic exists. A Relay mail
1482
- answer naming its unique builder establishes "the builder" for a nudge even
1483
- if Comet is selected. Two builders inside the relevant cluster still require
1484
- a scoped question; never choose by mail count/activity/list order. Do not
1485
- restore the old global-roster-count rule or require a previous send before
1486
- conversational references count. Keep this in the shared model prompt, not
1515
+ results, then the selected cluster when no topic exists. A mail summary
1516
+ naming a cluster's only builder establishes "the builder" for a nudge even
1517
+ if another cluster is selected. Two builders in the relevant cluster still
1518
+ require a scoped question. Mail count, activity and list order cannot decide.
1519
+ Keep the scope local to the referenced cluster. A previous send is optional.
1520
+ Keep this in the shared model prompt, not
1487
1521
  client phrase/name heuristics. `smoke:voice-luna` exercises the real Luna LOW
1488
1522
  over multiple turns with actual target resolution and canned worker actions.
1489
1523
 
@@ -1602,8 +1636,9 @@ Smoke: `npm run smoke:bakeoff`.
1602
1636
  'never', read-only profile) with "MCP tool call requires approval, but
1603
1637
  approval policy is never"; the model then reports it "can't see" the
1604
1638
  project. Agent-tab MCP children (arco-cluster) are not affected.
1605
- `npm run smoke:voice-luna` (opt-in, spends Codex quota) boots an isolated
1606
- server against the real Luna and pins tool selection for four utterances.
1639
+ `ARCO_VOICE_LUNA_LOGIN=1 npm run smoke:voice-luna` starts device sign-in in
1640
+ a temporary Codex profile and tests Luna's tool choices against canned
1641
+ workspace responses. It uses Codex quota.
1607
1642
  - **The generic Chat preamble is skipped for the Computer chat** (`turnEngine.ts`,
1608
1643
  `wf.config.voiceOperator`). Folded, its "do not use backend tools… continue
1609
1644
  in an Agent tab" made Luna refuse the arco-voice tools even with the