arco-workbench 0.1.3 → 0.1.5

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 (1441) hide show
  1. package/CONTRIBUTING.md +41 -9
  2. package/README.md +40 -22
  3. package/THIRD_PARTY_NOTICES +789 -0
  4. package/client/dist/assets/{PhosphorBackdrop-CkVIGkeX.js → PhosphorBackdrop-D6cbmLNY.js} +1 -1
  5. package/client/dist/assets/{ThemedBackgroundShaderImpl-DHF7CnpE.js → ThemedBackgroundShaderImpl-2dyerOi4.js} +1 -1
  6. package/client/dist/assets/{XtermView-SY0UcZUS.js → XtermView-AIwo7O3D.js} +2 -2
  7. package/client/dist/assets/galleryEditor-DXAuxS8D.js +702 -0
  8. package/client/dist/assets/index-8j6p-pmQ.js +610 -0
  9. package/client/dist/assets/index-DD9kFGsF.css +1 -0
  10. package/client/dist/index.html +2 -2
  11. package/client/src/App.tsx +46 -55
  12. package/client/src/alerts/desktopAlerts.ts +29 -9
  13. package/client/src/alerts/desktopTest.ts +68 -0
  14. package/client/src/alerts/focusNotice.ts +16 -0
  15. package/client/src/brief/briefFacts.ts +22 -0
  16. package/client/src/brief/briefFromStore.ts +7 -2
  17. package/client/src/buildCheck.ts +42 -2
  18. package/client/src/components/ArchitectureReviewDialog.tsx +98 -0
  19. package/client/src/components/ArtifactModal.tsx +4 -6
  20. package/client/src/components/ArtifactMoveDialog.tsx +68 -0
  21. package/client/src/components/AskUserQuestionNotice.tsx +2 -1
  22. package/client/src/components/AutomaticMessage.tsx +19 -0
  23. package/client/src/components/BriefControl.tsx +42 -49
  24. package/client/src/components/BrowserNotice.tsx +35 -0
  25. package/client/src/components/CatchMeUp.tsx +35 -29
  26. package/client/src/components/ChatMessage.tsx +15 -4
  27. package/client/src/components/ChatModeView.tsx +23 -16
  28. package/client/src/components/ChatPanel.tsx +33 -5
  29. package/client/src/components/CheckpointActions.tsx +97 -29
  30. package/client/src/components/ClusterActivityTab.tsx +4 -2
  31. package/client/src/components/ClusterComposerButtons.tsx +6 -3
  32. package/client/src/components/ClusterMemberPicker.tsx +6 -3
  33. package/client/src/components/ClusterPlanTab.tsx +108 -63
  34. package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +16 -5
  35. package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +31 -16
  36. package/client/src/components/ClusterRightPanel/MailboxModal.tsx +7 -3
  37. package/client/src/components/ClusterRightPanel/MemberRow.tsx +5 -2
  38. package/client/src/components/ClusterRightPanel/MemberSettingsFields.tsx +104 -0
  39. package/client/src/components/ClusterRightPanel/MessageGuardControl.tsx +1 -1
  40. package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +85 -7
  41. package/client/src/components/ClusterRightPanel/index.tsx +90 -36
  42. package/client/src/components/ClusterRightPanel/memberSettings.ts +52 -0
  43. package/client/src/components/ClusterRightPanel/panels.ts +18 -0
  44. package/client/src/components/ClusterRightPanel/types.ts +9 -10
  45. package/client/src/components/ClusterTab.tsx +281 -61
  46. package/client/src/components/ClusterTaskBoardTab.tsx +84 -606
  47. package/client/src/components/CommandPalette.tsx +17 -6
  48. package/client/src/components/ComputerAgentPicker.tsx +1 -1
  49. package/client/src/components/ComputerPanel.tsx +4 -2
  50. package/client/src/components/Connections/Connections.tsx +5 -2
  51. package/client/src/components/Connections/EndpointEditor.tsx +2 -2
  52. package/client/src/components/Connections/connections.css +1 -1
  53. package/client/src/components/Connections/model.ts +5 -1
  54. package/client/src/components/ContextMeter.tsx +15 -4
  55. package/client/src/components/DeepSeekControls.tsx +7 -6
  56. package/client/src/components/DiagnosticsTab.tsx +3 -2
  57. package/client/src/components/DialogShell.tsx +123 -0
  58. package/client/src/components/DocsUpdateDialog.tsx +16 -42
  59. package/client/src/components/FileExplorer.tsx +8 -9
  60. package/client/src/components/FileViewerModal.tsx +37 -12
  61. package/client/src/components/FirstRun.tsx +8 -7
  62. package/client/src/components/ForwardMessages.tsx +28 -32
  63. package/client/src/components/GateApprovalNotice.tsx +4 -2
  64. package/client/src/components/GitDialog.tsx +53 -52
  65. package/client/src/components/GitHubPanel/CodeView.tsx +35 -23
  66. package/client/src/components/GitHubPanel/IssueView.tsx +6 -4
  67. package/client/src/components/GitHubPanel/PullView.tsx +7 -6
  68. package/client/src/components/GitHubPanel/RunView.tsx +7 -5
  69. package/client/src/components/GitHubPanel/shared.tsx +23 -8
  70. package/client/src/components/GitOtherWork.tsx +4 -2
  71. package/client/src/components/HandoffDialog.tsx +19 -45
  72. package/client/src/components/HandoffSeedPill.tsx +5 -5
  73. package/client/src/components/HandoffSource.tsx +54 -0
  74. package/client/src/components/HeaderAuthChip.tsx +22 -1
  75. package/client/src/components/HeaderDropdown.tsx +5 -0
  76. package/client/src/components/HeaderVersionBox.tsx +3 -0
  77. package/client/src/components/HistoryTab.tsx +59 -32
  78. package/client/src/components/Home/AddProject.tsx +1 -1
  79. package/client/src/components/Home/HomeView.tsx +59 -22
  80. package/client/src/components/Home/LocationDialog.tsx +1 -1
  81. package/client/src/components/Home/ProjectCard.tsx +5 -3
  82. package/client/src/components/Home/home.css +11 -4
  83. package/client/src/components/KeepButton.tsx +45 -0
  84. package/client/src/components/LlamacppCatalogEditor.tsx +12 -3
  85. package/client/src/components/LocalRuntimeStatus.tsx +54 -0
  86. package/client/src/components/MdTuneupDialog.tsx +55 -52
  87. package/client/src/components/MemberCard.tsx +47 -42
  88. package/client/src/components/MemberPane.tsx +12 -11
  89. package/client/src/components/ModelHealthPanel.tsx +5 -4
  90. package/client/src/components/NativeSubagentControls.tsx +64 -0
  91. package/client/src/components/NeedsYouBadge.tsx +13 -6
  92. package/client/src/components/NorthStarBar.tsx +5 -3
  93. package/client/src/components/NotificationCenter.tsx +18 -5
  94. package/client/src/components/NotificationChannelsSettings.tsx +50 -24
  95. package/client/src/components/NotificationToasts.tsx +6 -8
  96. package/client/src/components/PendingQuestionsButton.tsx +4 -1
  97. package/client/src/components/PlanBodyRenderer.tsx +1 -0
  98. package/client/src/components/PlanCandidateBanner.tsx +129 -58
  99. package/client/src/components/PlanComposerDialog.tsx +55 -87
  100. package/client/src/components/PlanReviewPicker.tsx +6 -3
  101. package/client/src/components/PreviewTab.tsx +62 -25
  102. package/client/src/components/PrimaryStatus.tsx +20 -74
  103. package/client/src/components/ProjectStateNotice.tsx +60 -0
  104. package/client/src/components/ProjectsSettings.tsx +28 -2
  105. package/client/src/components/ProviderReleasesModal.tsx +13 -3
  106. package/client/src/components/ProvidersPopover.tsx +81 -23
  107. package/client/src/components/PublicProjectBox.tsx +29 -0
  108. package/client/src/components/PurgeConversationModal.tsx +7 -2
  109. package/client/src/components/QueuedMessagesIndicator.tsx +42 -150
  110. package/client/src/components/Recall/RecallResultRow.tsx +4 -2
  111. package/client/src/components/Recall/RecallView.tsx +12 -9
  112. package/client/src/components/ResearchDialog.tsx +16 -25
  113. package/client/src/components/ReviewDialog.tsx +44 -62
  114. package/client/src/components/RightPanel/ActivityTab.tsx +32 -16
  115. package/client/src/components/RightPanel/CodebaseMemorySection.tsx +3 -1
  116. package/client/src/components/RightPanel/ConfigTab.tsx +129 -140
  117. package/client/src/components/RightPanel/GenesisTab.tsx +67 -24
  118. package/client/src/components/RightPanel/HandoffsTab.tsx +4 -0
  119. package/client/src/components/RightPanel/KnowledgeTab.tsx +1 -1
  120. package/client/src/components/RightPanel/LedgerTab.tsx +1 -1
  121. package/client/src/components/RightPanel/McpRegistrySection.tsx +7 -6
  122. package/client/src/components/RightPanel/MoveTargetModal.tsx +6 -3
  123. package/client/src/components/RightPanel/OutputsPanel.tsx +44 -17
  124. package/client/src/components/RightPanel/PlanTab.tsx +131 -111
  125. package/client/src/components/RightPanel/ReviewTab.tsx +7 -4
  126. package/client/src/components/RightPanel/UsageTab.tsx +92 -3
  127. package/client/src/components/RightPanel/format.ts +3 -1
  128. package/client/src/components/RightPanel/index.tsx +10 -2
  129. package/client/src/components/RightPanel/types.ts +4 -2
  130. package/client/src/components/RunAsPicker.tsx +5 -3
  131. package/client/src/components/RuntimeStateBanner.tsx +13 -3
  132. package/client/src/components/SavedClustersList.tsx +30 -3
  133. package/client/src/components/ServicesTab.tsx +17 -34
  134. package/client/src/components/SettingsPanel.tsx +101 -337
  135. package/client/src/components/ShortcutCheatSheet.tsx +6 -4
  136. package/client/src/components/SkillEditorDialog.tsx +40 -74
  137. package/client/src/components/SkillsSettings.tsx +307 -0
  138. package/client/src/components/SpawnDialog.tsx +22 -44
  139. package/client/src/components/SpawnSeedPill.tsx +5 -4
  140. package/client/src/components/StaleBuildBanner.tsx +3 -1
  141. package/client/src/components/StorageWarnings.tsx +23 -0
  142. package/client/src/components/SystemHeader.tsx +19 -12
  143. package/client/src/components/SystemModal.tsx +6 -5
  144. package/client/src/components/TabBar.tsx +20 -10
  145. package/client/src/components/TabContextMenu.tsx +36 -10
  146. package/client/src/components/TaskCard.tsx +16 -11
  147. package/client/src/components/TasksPanel.tsx +13 -11
  148. package/client/src/components/Terminal/XtermView.tsx +2 -0
  149. package/client/src/components/TerminalInput.tsx +251 -446
  150. package/client/src/components/TerminalSessions.tsx +1 -1
  151. package/client/src/components/TidyComposer.tsx +24 -41
  152. package/client/src/components/TokenBadge.tsx +20 -17
  153. package/client/src/components/ToolCallPill.tsx +5 -3
  154. package/client/src/components/ToolboxMenu.tsx +5 -5
  155. package/client/src/components/TranscriptSendDialog.tsx +151 -202
  156. package/client/src/components/TurnTimer.tsx +21 -0
  157. package/client/src/components/UpdateAction.tsx +4 -1
  158. package/client/src/components/UsageBar.tsx +32 -126
  159. package/client/src/components/UserManual/index.tsx +6 -4
  160. package/client/src/components/UtilityAgentPicker.tsx +4 -2
  161. package/client/src/components/VoiceMenu.tsx +5 -1
  162. package/client/src/components/VoiceSetupSettings.tsx +21 -11
  163. package/client/src/components/WorkerCard.tsx +7 -1
  164. package/client/src/components/WorkerDetailModal.tsx +7 -3
  165. package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +6 -6
  166. package/client/src/components/WorkflowCreator/ProjectPicker.tsx +13 -12
  167. package/client/src/components/WorkflowCreator/index.tsx +238 -77
  168. package/client/src/components/WorkflowCreator/types.ts +5 -3
  169. package/client/src/components/WorkflowStatusChip.tsx +93 -13
  170. package/client/src/components/WorkflowView.tsx +59 -25
  171. package/client/src/components/WorkspaceRename.tsx +11 -1
  172. package/client/src/components/activityTime.ts +4 -0
  173. package/client/src/components/clusterNeedsYou.ts +35 -3
  174. package/client/src/components/compare/CompareDialog.tsx +32 -5
  175. package/client/src/components/compare/CompareOverlay.tsx +10 -3
  176. package/client/src/components/composer/submitComposer.ts +191 -0
  177. package/client/src/components/diff/ChangesPanel.tsx +4 -2
  178. package/client/src/components/diff/LiveChangesPanel.tsx +18 -2
  179. package/client/src/components/editor/CodeEditor.tsx +17 -2
  180. package/client/src/components/headerPopoverState.ts +15 -0
  181. package/client/src/components/help/DocViewer.tsx +6 -4
  182. package/client/src/components/help/HelpCard.tsx +3 -2
  183. package/client/src/components/help/HelpPopover.tsx +3 -1
  184. package/client/src/components/media/AudioEditor/AudioOpsPanel.tsx +16 -2
  185. package/client/src/components/media/DirectoryPicker.tsx +18 -11
  186. package/client/src/components/media/ImageEditor/ImageEditor.tsx +2 -2
  187. package/client/src/components/media/MediaModalHost.tsx +7 -15
  188. package/client/src/components/media/MediaStemsControls.tsx +16 -2
  189. package/client/src/components/media/VideoEditor/VideoOpsPanel.tsx +16 -2
  190. package/client/src/components/media/launchers.ts +4 -0
  191. package/client/src/components/plans/PlanChooser.tsx +135 -0
  192. package/client/src/components/plans/PlanRefsSection.tsx +47 -28
  193. package/client/src/components/plans/planBodySave.ts +17 -0
  194. package/client/src/components/plans/planRefs.ts +21 -11
  195. package/client/src/components/plans/startPlanGenesis.ts +37 -0
  196. package/client/src/components/primitives/Panel.tsx +1 -0
  197. package/client/src/components/providerPanelState.ts +17 -0
  198. package/client/src/components/settings/AppVersionSection.tsx +5 -5
  199. package/client/src/components/settings/AppWindowBrowserSection.tsx +88 -0
  200. package/client/src/components/settings/PreviewPortsSection.tsx +31 -0
  201. package/client/src/components/settings/SettingsLayout.tsx +1 -1
  202. package/client/src/components/settings/appWindowBrowserReport.ts +23 -0
  203. package/client/src/components/settings/navigation.ts +5 -1
  204. package/client/src/components/settings/settings.css +6 -0
  205. package/client/src/components/terminalInput/planDraft.ts +34 -5
  206. package/client/src/components/usageVisibility.ts +3 -2
  207. package/client/src/components/utilityResult.ts +5 -1
  208. package/client/src/components/workSurface/WorkSurfaceControls.tsx +125 -10
  209. package/client/src/components/workSurface/workSurface.css +10 -2
  210. package/client/src/explorer/ArtifactsLens.tsx +53 -17
  211. package/client/src/explorer/ExplorerApp.tsx +12 -7
  212. package/client/src/explorer/PlansLens.tsx +140 -39
  213. package/client/src/explorer/RecentsLens.tsx +22 -61
  214. package/client/src/explorer/StorageLens.tsx +281 -0
  215. package/client/src/explorer/changedAttribution.ts +23 -0
  216. package/client/src/explorer/launch.ts +6 -3
  217. package/client/src/explorer/plansGrouping.ts +15 -0
  218. package/client/src/explorer/treeReveal.ts +21 -0
  219. package/client/src/explorer/types.ts +3 -3
  220. package/client/src/help/content/chat.tsx +17 -10
  221. package/client/src/help/content/cluster.tsx +175 -109
  222. package/client/src/help/content/composer.tsx +149 -48
  223. package/client/src/help/content/gitOps.tsx +19 -19
  224. package/client/src/help/content/github.tsx +9 -4
  225. package/client/src/help/content/header.tsx +82 -61
  226. package/client/src/help/content/media.tsx +20 -20
  227. package/client/src/help/content/misc.tsx +475 -156
  228. package/client/src/help/content/recall.tsx +12 -12
  229. package/client/src/help/content/rightPanel.tsx +210 -97
  230. package/client/src/help/content/settings.tsx +120 -47
  231. package/client/src/help/content/shared.tsx +1 -1
  232. package/client/src/help/content/tabbar.tsx +1 -1
  233. package/client/src/help/manualSections/actions.tsx +43 -21
  234. package/client/src/help/manualSections/chat.tsx +28 -5
  235. package/client/src/help/manualSections/clusters.tsx +222 -147
  236. package/client/src/help/manualSections/configuration.tsx +236 -50
  237. package/client/src/help/manualSections/deepseek.tsx +7 -5
  238. package/client/src/help/manualSections/gettingStarted.tsx +74 -12
  239. package/client/src/help/manualSections/maintenance.tsx +84 -15
  240. package/client/src/help/manualSections/media.tsx +14 -12
  241. package/client/src/help/manualSections/plans.tsx +192 -15
  242. package/client/src/help/manualSections/powerFeatures.tsx +146 -51
  243. package/client/src/help/manualSections/providers.tsx +237 -42
  244. package/client/src/help/manualSections/reference.tsx +24 -10
  245. package/client/src/help/manualSections/strata.tsx +6 -6
  246. package/client/src/help/manualSections/troubleshooting.tsx +14 -8
  247. package/client/src/help/manualSections/voice.tsx +12 -7
  248. package/client/src/help/manualSections/workflows.tsx +76 -19
  249. package/client/src/help/manualSections/workspace.tsx +179 -48
  250. package/client/src/help/shortcuts.ts +1 -0
  251. package/client/src/hooks/useWebSocket.ts +49 -25
  252. package/client/src/layout/SlideOut.tsx +77 -0
  253. package/client/src/layout/ToolbarOverflow.tsx +97 -0
  254. package/client/src/layout/keepInWindow.ts +216 -0
  255. package/client/src/layout/layoutRange.ts +129 -0
  256. package/client/src/main.tsx +2 -0
  257. package/client/src/phosphor-demo/Demo.tsx +5 -13
  258. package/client/src/phosphor-demo/demo.css +1 -1
  259. package/client/src/stores/appStore.ts +75 -15
  260. package/client/src/stores/appStore.types.ts +37 -16
  261. package/client/src/stores/docEditStore.ts +13 -21
  262. package/client/src/stores/draftStore.ts +28 -4
  263. package/client/src/stores/knowledgeDistillStore.ts +4 -2
  264. package/client/src/stores/mdTuneupStore.ts +12 -6
  265. package/client/src/stores/memoryTrim.ts +18 -2
  266. package/client/src/stores/notificationChannelsStore.ts +21 -11
  267. package/client/src/stores/planGenesisStore.ts +67 -0
  268. package/client/src/stores/recallStore.ts +6 -0
  269. package/client/src/stores/storageWarningStore.ts +18 -0
  270. package/client/src/stores/terminalStore.ts +1 -1
  271. package/client/src/styles/global.css +72 -0
  272. package/client/src/styles/matrix.css +7 -0
  273. package/client/src/themes/apply.ts +3 -3
  274. package/client/src/themes/bootstrap.ts +3 -0
  275. package/client/src/utils/activeProject.ts +6 -0
  276. package/client/src/utils/activityPresentation.ts +51 -0
  277. package/client/src/utils/browserFamily.ts +22 -0
  278. package/client/src/utils/chatFileLinks.ts +3 -2
  279. package/client/src/utils/chatText.ts +14 -6
  280. package/client/src/utils/checkedJson.ts +11 -0
  281. package/client/src/utils/checkpointChanges.ts +18 -0
  282. package/client/src/utils/clusterCreation.ts +39 -0
  283. package/client/src/utils/clusterNudge.ts +31 -0
  284. package/client/src/utils/displayMessages.ts +45 -7
  285. package/client/src/utils/effortDefaults.ts +4 -3
  286. package/client/src/utils/format.ts +11 -4
  287. package/client/src/utils/gateArgs.ts +3 -2
  288. package/client/src/utils/gitDialogMemory.ts +26 -0
  289. package/client/src/utils/handoffSeeds.ts +13 -0
  290. package/client/src/utils/historyEvents.ts +22 -12
  291. package/client/src/utils/homeModel.ts +38 -3
  292. package/client/src/utils/memberReviewScope.ts +6 -0
  293. package/client/src/utils/outputNavigation.ts +16 -0
  294. package/client/src/utils/outputStyleText.ts +8 -0
  295. package/client/src/utils/publicProject.ts +130 -0
  296. package/client/src/utils/queuedMessageEdit.ts +40 -0
  297. package/client/src/utils/requestGeneration.ts +8 -0
  298. package/client/src/utils/rewindSupport.ts +17 -0
  299. package/client/src/utils/settingsRequests.ts +36 -0
  300. package/client/src/utils/settingsResponse.ts +8 -0
  301. package/client/src/utils/wsSession.ts +12 -5
  302. package/client/src/vendor/odysseus-editor/editor/clipboard-and-drop.js +9 -9
  303. package/client/src/vendor/odysseus-editor/editor/keyboard-shortcuts.js +2 -2
  304. package/client/src/vendor/odysseus-editor/editor/state.js +8 -0
  305. package/client/src/vendor/odysseus-editor/editor.css +13 -5
  306. package/client/src/vendor/odysseus-editor/galleryEditor.d.ts +1 -1
  307. package/client/src/vendor/odysseus-editor/galleryEditor.js +16 -5
  308. package/client/src/voice/executor.ts +4 -3
  309. package/client/src/voice/panels.ts +14 -3
  310. package/client/src/voice/screen.ts +48 -6
  311. package/client/src/voice/setupAudio.ts +5 -3
  312. package/client/src/ws/handleServerMessage.ts +158 -35
  313. package/client/src/ws/operatorQuestions.ts +2 -2
  314. package/docs/ARCHITECTURE.md +95 -55
  315. package/docs/ARCHITECTURE_REVIEW.md +47 -0
  316. package/docs/BACKUP.md +5 -2
  317. package/docs/CHAT.md +48 -37
  318. package/docs/CHECKPOINTS.md +45 -16
  319. package/docs/CLIENT.md +242 -88
  320. package/docs/CODEX_GPT56_CLUSTER_INCOMPAT.md +1 -1
  321. package/docs/DEEPSEEK.md +6 -6
  322. package/docs/DIAGNOSTICS.md +12 -7
  323. package/docs/EXTENDING.md +52 -48
  324. package/docs/FEATURES.md +42 -26
  325. package/docs/GENESIS.md +42 -6
  326. package/docs/GETTING_STARTED.md +63 -29
  327. package/docs/GIT_WORKBENCH.md +15 -9
  328. package/docs/GLOSSARY.md +44 -42
  329. package/docs/GOTCHAS.md +73 -59
  330. package/docs/HTTP_API.md +167 -39
  331. package/docs/INDEX.md +3 -4
  332. package/docs/KNOWLEDGE.md +6 -4
  333. package/docs/LOCAL_SERVICES.md +6 -6
  334. package/docs/LSP.md +4 -3
  335. package/docs/MCP_REGISTRY.md +16 -12
  336. package/docs/MEDIA_STUDIO.md +23 -16
  337. package/docs/NOTIFICATIONS.md +60 -28
  338. package/docs/OPERATIONS.md +237 -120
  339. package/docs/OPERATOR_ACTIONS.md +44 -25
  340. package/docs/OUTPUTS.md +35 -9
  341. package/docs/PERSISTENCE.md +117 -33
  342. package/docs/PHOSPHOR_DEMO.md +4 -4
  343. package/docs/PLAN_OR_BOARD.md +13 -1
  344. package/docs/PREVIEW_VERIFY.md +10 -8
  345. package/docs/PRIMITIVES.md +92 -89
  346. package/docs/PROTOCOL.md +113 -32
  347. package/docs/PROTOCOL_CLUSTER.md +80 -16
  348. package/docs/PROTOCOL_PRIMITIVES.md +9 -9
  349. package/docs/PROVIDERS.md +471 -82
  350. package/docs/RECALL.md +17 -12
  351. package/docs/REMOTE_MANAGEMENT.md +69 -8
  352. package/docs/REPO_LAYOUT.md +1 -1
  353. package/docs/RESUME_INDEX.md +16 -17
  354. package/docs/SERVICE_MODE.md +50 -11
  355. package/docs/SETTINGS.md +66 -13
  356. package/docs/STORAGE_PLAN.md +329 -0
  357. package/docs/STRATA.md +4 -4
  358. package/docs/TASK_LEDGER.md +38 -16
  359. package/docs/TERMINAL.md +14 -12
  360. package/docs/THIRD_PARTY.md +1 -3
  361. package/docs/VOICE.md +15 -7
  362. package/native/darwin-arm64/manifest.json +1 -1
  363. package/native/linux-arm64/manifest.json +1 -1
  364. package/native/win32-arm64/manifest.json +1 -1
  365. package/node_modules/@arco/shared/dist/clusterCoordination.js +15 -7
  366. package/node_modules/@arco/shared/dist/clusterRolePresets.js +8 -6
  367. package/node_modules/@arco/shared/dist/codexChat.d.ts +2 -0
  368. package/node_modules/@arco/shared/dist/codexChat.js +5 -0
  369. package/node_modules/@arco/shared/dist/folderName.d.ts +1 -0
  370. package/node_modules/@arco/shared/dist/folderName.js +18 -0
  371. package/node_modules/@arco/shared/dist/index.d.ts +8 -0
  372. package/node_modules/@arco/shared/dist/index.js +8 -0
  373. package/node_modules/@arco/shared/dist/localRuntimeStatus.d.ts +23 -0
  374. package/node_modules/@arco/shared/dist/localRuntimeStatus.js +47 -0
  375. package/node_modules/@arco/shared/dist/notificationTitle.d.ts +9 -0
  376. package/node_modules/@arco/shared/dist/notificationTitle.js +23 -0
  377. package/node_modules/@arco/shared/dist/outputStyle.d.ts +10 -0
  378. package/node_modules/@arco/shared/dist/outputStyle.js +28 -0
  379. package/node_modules/@arco/shared/dist/outputs.d.ts +1 -0
  380. package/node_modules/@arco/shared/dist/protocol/autoPickup.d.ts +3 -1
  381. package/node_modules/@arco/shared/dist/protocol/autoPickup.js +1 -1
  382. package/node_modules/@arco/shared/dist/protocol/chat.d.ts +4 -0
  383. package/node_modules/@arco/shared/dist/protocol/checkpoints.d.ts +25 -2
  384. package/node_modules/@arco/shared/dist/protocol/checkpoints.js +1 -0
  385. package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +9 -14
  386. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +23 -5
  387. package/node_modules/@arco/shared/dist/protocol/clusters.js +3 -3
  388. package/node_modules/@arco/shared/dist/protocol/connections.d.ts +2 -0
  389. package/node_modules/@arco/shared/dist/protocol/diagnostics.js +1 -1
  390. package/node_modules/@arco/shared/dist/protocol/genesis.d.ts +9 -0
  391. package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
  392. package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
  393. package/node_modules/@arco/shared/dist/protocol/mcp.d.ts +1 -0
  394. package/node_modules/@arco/shared/dist/protocol/mcp.js +8 -5
  395. package/node_modules/@arco/shared/dist/protocol/mdTuneup.d.ts +8 -0
  396. package/node_modules/@arco/shared/dist/protocol/models.d.ts +3 -1
  397. package/node_modules/@arco/shared/dist/protocol/models.js +19 -8
  398. package/node_modules/@arco/shared/dist/protocol/notifications.d.ts +4 -2
  399. package/node_modules/@arco/shared/dist/protocol/notifications.js +18 -5
  400. package/node_modules/@arco/shared/dist/protocol/plans.d.ts +4 -1
  401. package/node_modules/@arco/shared/dist/protocol/remoteManagement.d.ts +6 -0
  402. package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +70 -10
  403. package/node_modules/@arco/shared/dist/protocol/settings.d.ts +16 -4
  404. package/node_modules/@arco/shared/dist/protocol/settings.js +17 -1
  405. package/node_modules/@arco/shared/dist/protocol/storage.d.ts +21 -0
  406. package/node_modules/@arco/shared/dist/protocol/storage.js +3 -0
  407. package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +4 -0
  408. package/node_modules/@arco/shared/dist/protocol/usage.d.ts +1 -0
  409. package/node_modules/@arco/shared/dist/protocol/utilityAgent.d.ts +2 -2
  410. package/node_modules/@arco/shared/dist/protocol/utilityAgent.js +2 -2
  411. package/node_modules/@arco/shared/dist/protocol/workers.d.ts +1 -0
  412. package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +73 -14
  413. package/node_modules/@arco/shared/dist/protocol/workflows.js +66 -0
  414. package/node_modules/@arco/shared/dist/publicGuardrails.d.ts +7 -0
  415. package/node_modules/@arco/shared/dist/publicGuardrails.js +47 -0
  416. package/node_modules/@arco/shared/dist/publicSafetyRules.d.ts +1 -0
  417. package/node_modules/@arco/shared/dist/publicSafetyRules.js +6 -0
  418. package/node_modules/@arco/shared/dist/runtimeVersions.d.ts +2 -0
  419. package/node_modules/@arco/shared/dist/runtimeVersions.js +13 -0
  420. package/node_modules/@arco/shared/dist/shellTool.d.ts +2 -0
  421. package/node_modules/@arco/shared/dist/shellTool.js +9 -0
  422. package/node_modules/@arco/shared/package.json +1 -1
  423. package/node_modules/xlsx/LICENSE +201 -0
  424. package/node_modules/xlsx/dist/cpexcel.js +1506 -0
  425. package/node_modules/xlsx/package.json +69 -0
  426. package/node_modules/xlsx/xlsx.js +28103 -0
  427. package/node_modules/xlsx/xlsx.mjs +28228 -0
  428. package/package.json +23 -3
  429. package/scripts/packaging/arco.mjs +19 -3
  430. package/scripts/packaging/browsers.mjs +366 -0
  431. package/scripts/packaging/launch.mjs +34 -20
  432. package/scripts/packaging/services.mjs +36 -6
  433. package/scripts/packaging/storage.mjs +161 -0
  434. package/scripts/packaging/update.mjs +3 -3
  435. package/server/dist/appBrowsers.d.ts +45 -0
  436. package/server/dist/appBrowsers.js +73 -0
  437. package/server/dist/architectureReview.d.ts +60 -0
  438. package/server/dist/architectureReview.js +347 -0
  439. package/server/dist/architectureSkill.d.ts +8 -0
  440. package/server/dist/architectureSkill.js +70 -0
  441. package/server/dist/arcoHome.d.ts +1 -0
  442. package/server/dist/arcoHome.js +43 -3
  443. package/server/dist/artifactCopy.d.ts +29 -0
  444. package/server/dist/artifactCopy.js +475 -0
  445. package/server/dist/atomicFile.d.ts +1 -0
  446. package/server/dist/atomicFile.js +6 -1
  447. package/server/dist/attention.d.ts +6 -2
  448. package/server/dist/attention.js +37 -29
  449. package/server/dist/auth.d.ts +1 -0
  450. package/server/dist/auth.js +19 -6
  451. package/server/dist/authLoginSession.d.ts +2 -0
  452. package/server/dist/authLoginSession.js +6 -1
  453. package/server/dist/boundedRead.d.ts +26 -0
  454. package/server/dist/boundedRead.js +246 -0
  455. package/server/dist/capabilities.d.ts +4 -1
  456. package/server/dist/capabilities.js +25 -8
  457. package/server/dist/catchUp.d.ts +9 -0
  458. package/server/dist/catchUp.js +66 -24
  459. package/server/dist/checkedFile.d.ts +5 -0
  460. package/server/dist/checkedFile.js +138 -0
  461. package/server/dist/claudeTransport.d.ts +7 -0
  462. package/server/dist/claudeTransport.js +14 -0
  463. package/server/dist/clusterAutoTurn.d.ts +7 -0
  464. package/server/dist/clusterAutoTurn.js +54 -7
  465. package/server/dist/clusterBusyReminder.d.ts +7 -0
  466. package/server/dist/clusterBusyReminder.js +45 -0
  467. package/server/dist/clusterDirector.js +6 -3
  468. package/server/dist/clusterIdleNudger.d.ts +6 -0
  469. package/server/dist/clusterIdleNudger.js +5 -0
  470. package/server/dist/clusterMailbox.d.ts +4 -2
  471. package/server/dist/clusterMailbox.js +104 -24
  472. package/server/dist/clusterPeerOps.d.ts +2 -0
  473. package/server/dist/clusterPeerOps.js +11 -21
  474. package/server/dist/clusterPlanBridge.d.ts +6 -3
  475. package/server/dist/clusterPlanBridge.js +48 -45
  476. package/server/dist/clusterPresets.js +46 -32
  477. package/server/dist/clusterProgress.js +3 -0
  478. package/server/dist/clusterSnapshots.d.ts +1 -1
  479. package/server/dist/clusterSnapshots.js +39 -14
  480. package/server/dist/clusterStore.d.ts +3 -0
  481. package/server/dist/clusterStore.js +23 -13
  482. package/server/dist/clusterTurnTools.d.ts +4 -0
  483. package/server/dist/clusterTurnTools.js +9 -0
  484. package/server/dist/commandShell.d.ts +56 -0
  485. package/server/dist/commandShell.js +278 -0
  486. package/server/dist/compactionCounter.d.ts +6 -0
  487. package/server/dist/compactionCounter.js +73 -0
  488. package/server/dist/compactionReport.d.ts +8 -0
  489. package/server/dist/compactionReport.js +15 -0
  490. package/server/dist/contentSearch.js +16 -6
  491. package/server/dist/contextCalibrator.js +7 -2
  492. package/server/dist/contextEstimator.d.ts +4 -0
  493. package/server/dist/contextEstimator.js +76 -17
  494. package/server/dist/contextRefs.d.ts +1 -0
  495. package/server/dist/contextRefs.js +44 -9
  496. package/server/dist/conversationActivity.d.ts +3 -0
  497. package/server/dist/conversationActivity.js +27 -0
  498. package/server/dist/cursorUsage.js +15 -4
  499. package/server/dist/diagnostics/checks.js +4 -12
  500. package/server/dist/diagnostics/executableLookup.d.ts +2 -0
  501. package/server/dist/diagnostics/executableLookup.js +28 -0
  502. package/server/dist/diagnostics/modelHealth.js +3 -12
  503. package/server/dist/diagnostics/supportBundle.js +5 -13
  504. package/server/dist/eventLog.d.ts +74 -0
  505. package/server/dist/eventLog.js +992 -0
  506. package/server/dist/existingClusterMembers.d.ts +1 -0
  507. package/server/dist/existingClusterMembers.js +9 -0
  508. package/server/dist/explorerArtifacts.js +46 -12
  509. package/server/dist/explorerChanged.d.ts +7 -0
  510. package/server/dist/explorerChanged.js +116 -80
  511. package/server/dist/explorerDocs.d.ts +11 -0
  512. package/server/dist/explorerDocs.js +46 -48
  513. package/server/dist/explorerLaunch.d.ts +8 -1
  514. package/server/dist/explorerLaunch.js +11 -2
  515. package/server/dist/explorerPlans.d.ts +4 -0
  516. package/server/dist/explorerPlans.js +27 -2
  517. package/server/dist/fileAccessPolicy.d.ts +21 -0
  518. package/server/dist/fileAccessPolicy.js +89 -1
  519. package/server/dist/fileContent/decodeSlots.d.ts +1 -0
  520. package/server/dist/fileContent/decodeSlots.js +50 -0
  521. package/server/dist/fileContent/detect.d.ts +2 -0
  522. package/server/dist/fileContent/detect.js +55 -0
  523. package/server/dist/fileContent/externalImage.d.ts +3 -0
  524. package/server/dist/fileContent/externalImage.js +68 -0
  525. package/server/dist/fileContent/icons.d.ts +4 -0
  526. package/server/dist/fileContent/icons.js +58 -0
  527. package/server/dist/fileContent/images.d.ts +15 -0
  528. package/server/dist/fileContent/images.js +182 -0
  529. package/server/dist/fileContent/legacyText.d.ts +3 -0
  530. package/server/dist/fileContent/legacyText.js +19 -0
  531. package/server/dist/fileContent/notebook.d.ts +2 -0
  532. package/server/dist/fileContent/notebook.js +54 -0
  533. package/server/dist/fileContent/office.d.ts +3 -0
  534. package/server/dist/fileContent/office.js +349 -0
  535. package/server/dist/fileContent/pdf.d.ts +2 -0
  536. package/server/dist/fileContent/pdf.js +76 -0
  537. package/server/dist/fileContent/pngRows.d.ts +4 -0
  538. package/server/dist/fileContent/pngRows.js +118 -0
  539. package/server/dist/fileContent/svg.d.ts +3 -0
  540. package/server/dist/fileContent/svg.js +60 -0
  541. package/server/dist/fileContent/types.d.ts +8 -0
  542. package/server/dist/fileContent/types.js +43 -0
  543. package/server/dist/fileContent/worker.d.ts +1 -0
  544. package/server/dist/fileContent/worker.js +68 -0
  545. package/server/dist/fileContent.d.ts +55 -0
  546. package/server/dist/fileContent.js +81 -0
  547. package/server/dist/fileContextReceipts.d.ts +12 -0
  548. package/server/dist/fileContextReceipts.js +53 -0
  549. package/server/dist/fileFetch.d.ts +17 -0
  550. package/server/dist/fileFetch.js +191 -0
  551. package/server/dist/fileVersion.d.ts +10 -0
  552. package/server/dist/fileVersion.js +43 -0
  553. package/server/dist/genesis/creative.js +28 -36
  554. package/server/dist/genesis/prompts.js +4 -0
  555. package/server/dist/genesis/savePlan.d.ts +5 -0
  556. package/server/dist/genesis/savePlan.js +49 -0
  557. package/server/dist/genesis/stages.js +4 -4
  558. package/server/dist/gitDiff.js +25 -5
  559. package/server/dist/gitSnapshots.d.ts +18 -0
  560. package/server/dist/gitSnapshots.js +280 -149
  561. package/server/dist/gitWorking.js +15 -13
  562. package/server/dist/github.js +5 -1
  563. package/server/dist/goalRun.d.ts +1 -1
  564. package/server/dist/goalRun.js +7 -5
  565. package/server/dist/handoffHistory.d.ts +26 -0
  566. package/server/dist/handoffHistory.js +80 -0
  567. package/server/dist/handoffHistoryProtocol.d.ts +59 -0
  568. package/server/dist/handoffHistoryProtocol.js +20 -0
  569. package/server/dist/handoffHistorySupport.d.ts +2 -0
  570. package/server/dist/handoffHistorySupport.js +11 -0
  571. package/server/dist/handoffHistoryTool.d.ts +29 -0
  572. package/server/dist/handoffHistoryTool.js +235 -0
  573. package/server/dist/handoffPrompts.js +6 -4
  574. package/server/dist/handoffReplay.d.ts +9 -0
  575. package/server/dist/handoffReplay.js +14 -0
  576. package/server/dist/handoffSeedCache.d.ts +3 -0
  577. package/server/dist/handoffSeedCache.js +26 -0
  578. package/server/dist/http/appBrowserRoutes.d.ts +3 -0
  579. package/server/dist/http/appBrowserRoutes.js +16 -0
  580. package/server/dist/http/architectureReviewRoutes.d.ts +3 -0
  581. package/server/dist/http/architectureReviewRoutes.js +117 -0
  582. package/server/dist/http/clusterRoutes.js +15 -1
  583. package/server/dist/http/clusterSnapshotRoutes.js +8 -3
  584. package/server/dist/http/connectionsRoutes.js +3 -1
  585. package/server/dist/http/diffRoutes.js +37 -3
  586. package/server/dist/http/explorerRoot.d.ts +3 -0
  587. package/server/dist/http/explorerRoot.js +22 -0
  588. package/server/dist/http/explorerRoutes.js +66 -12
  589. package/server/dist/http/fileRead.js +2 -3
  590. package/server/dist/http/fileWriteRoutes.js +4 -3
  591. package/server/dist/http/gitCompareRoutes.js +4 -6
  592. package/server/dist/http/gitDiffRoutes.js +3 -3
  593. package/server/dist/http/gitOpRoutes.js +3 -5
  594. package/server/dist/http/gitWorktreeRoutes.js +3 -3
  595. package/server/dist/http/handoffHistoryRoutes.d.ts +4 -0
  596. package/server/dist/http/handoffHistoryRoutes.js +59 -0
  597. package/server/dist/http/imageWriteRoutes.js +6 -2
  598. package/server/dist/http/knowledgeRoutes.js +2 -0
  599. package/server/dist/http/mediaOpsRoutes.js +2 -3
  600. package/server/dist/http/originGuard.d.ts +1 -1
  601. package/server/dist/http/originGuard.js +95 -12
  602. package/server/dist/http/outputRoutes.js +31 -6
  603. package/server/dist/http/projectBinding.d.ts +3 -0
  604. package/server/dist/http/projectBinding.js +133 -0
  605. package/server/dist/http/providerThrottleRoutes.d.ts +8 -0
  606. package/server/dist/http/providerThrottleRoutes.js +96 -0
  607. package/server/dist/http/publicProjectRoutes.d.ts +2 -0
  608. package/server/dist/http/publicProjectRoutes.js +109 -0
  609. package/server/dist/http/readConfinement.d.ts +2 -1
  610. package/server/dist/http/readConfinement.js +17 -15
  611. package/server/dist/http/router.js +230 -62
  612. package/server/dist/http/searchRoutes.js +4 -4
  613. package/server/dist/http/sessionTransport.d.ts +2 -0
  614. package/server/dist/http/sessionTransport.js +32 -0
  615. package/server/dist/http/skillManagementRoutes.d.ts +5 -0
  616. package/server/dist/http/skillManagementRoutes.js +166 -0
  617. package/server/dist/http/storageRoutes.d.ts +2 -0
  618. package/server/dist/http/storageRoutes.js +268 -0
  619. package/server/dist/http/usageStatsRoutes.js +3 -12
  620. package/server/dist/http/utilityAgentRoutes.js +27 -5
  621. package/server/dist/http/workflowDataRoutes.js +75 -14
  622. package/server/dist/http/writeConfinement.d.ts +5 -3
  623. package/server/dist/http/writeConfinement.js +37 -11
  624. package/server/dist/http/wsAuth.d.ts +3 -2
  625. package/server/dist/http/wsAuth.js +26 -8
  626. package/server/dist/imageTokens.d.ts +7 -0
  627. package/server/dist/imageTokens.js +85 -0
  628. package/server/dist/index.js +287 -178
  629. package/server/dist/inputDeliveryHistory.d.ts +21 -0
  630. package/server/dist/inputDeliveryHistory.js +146 -0
  631. package/server/dist/keepStore.d.ts +20 -0
  632. package/server/dist/keepStore.js +167 -0
  633. package/server/dist/knowledge/store.js +28 -20
  634. package/server/dist/legacyTarRestore.d.ts +1 -0
  635. package/server/dist/legacyTarRestore.js +240 -0
  636. package/server/dist/llamacppCatalog.d.ts +8 -1
  637. package/server/dist/llamacppCatalog.js +65 -13
  638. package/server/dist/localRuntimeStatus.d.ts +35 -0
  639. package/server/dist/localRuntimeStatus.js +136 -0
  640. package/server/dist/lsp/client.js +28 -9
  641. package/server/dist/lsp/servers.js +2 -2
  642. package/server/dist/managedPath.d.ts +2 -0
  643. package/server/dist/managedPath.js +47 -0
  644. package/server/dist/management/clusterActivity.js +6 -20
  645. package/server/dist/management/hubGuard.d.ts +23 -0
  646. package/server/dist/management/hubGuard.js +118 -0
  647. package/server/dist/management/hubLink.d.ts +4 -1
  648. package/server/dist/management/hubLink.js +8 -1
  649. package/server/dist/management/initHubLink.d.ts +12 -0
  650. package/server/dist/management/initHubLink.js +54 -65
  651. package/server/dist/manualCompactCapability.d.ts +2 -0
  652. package/server/dist/manualCompactCapability.js +7 -0
  653. package/server/dist/mcp/arcoMcpServer.js +4 -0
  654. package/server/dist/mcp/client.d.ts +4 -4
  655. package/server/dist/mcp/client.js +31 -10
  656. package/server/dist/mcp/clusterMcpLoopback.d.ts +4 -0
  657. package/server/dist/mcp/clusterMcpLoopback.js +21 -1
  658. package/server/dist/mcp/clusterMcpTools.js +33 -27
  659. package/server/dist/mcp/fileContent.d.ts +8 -0
  660. package/server/dist/mcp/fileContent.js +55 -0
  661. package/server/dist/mcp/fileMcpServer.d.ts +1 -0
  662. package/server/dist/mcp/fileMcpServer.js +13 -0
  663. package/server/dist/mcp/fileMcpTools.d.ts +2 -0
  664. package/server/dist/mcp/fileMcpTools.js +54 -0
  665. package/server/dist/mcp/handoffHistoryMcpTools.d.ts +3 -0
  666. package/server/dist/mcp/handoffHistoryMcpTools.js +27 -0
  667. package/server/dist/mcp/mcpConfigWriter.d.ts +5 -0
  668. package/server/dist/mcp/mcpConfigWriter.js +44 -12
  669. package/server/dist/mcp/planMcpTools.d.ts +6 -14
  670. package/server/dist/mcp/planMcpTools.js +6 -250
  671. package/server/dist/mcp/planReadMcpServer.d.ts +1 -0
  672. package/server/dist/mcp/planReadMcpServer.js +19 -0
  673. package/server/dist/mcp/registry.js +44 -38
  674. package/server/dist/mcp/registryWiring.js +4 -5
  675. package/server/dist/media/demucs.d.ts +5 -0
  676. package/server/dist/media/demucs.js +16 -4
  677. package/server/dist/media/ffmpeg.js +24 -16
  678. package/server/dist/media/scratch.js +24 -9
  679. package/server/dist/noticeSource.d.ts +2 -0
  680. package/server/dist/noticeSource.js +11 -0
  681. package/server/dist/notifications.d.ts +4 -1
  682. package/server/dist/notifications.js +11 -6
  683. package/server/dist/npmPlatformResolve.d.ts +9 -3
  684. package/server/dist/npmPlatformResolve.js +24 -5
  685. package/server/dist/ntfyTransport.d.ts +2 -1
  686. package/server/dist/ntfyTransport.js +15 -4
  687. package/server/dist/outputGrants.d.ts +9 -0
  688. package/server/dist/outputGrants.js +63 -0
  689. package/server/dist/outputStore.d.ts +1 -0
  690. package/server/dist/outputStore.js +1 -1
  691. package/server/dist/outputs.js +117 -21
  692. package/server/dist/peerRecipientContext.js +22 -5
  693. package/server/dist/planHistory.d.ts +3 -0
  694. package/server/dist/planHistory.js +60 -0
  695. package/server/dist/planStore.d.ts +11 -2
  696. package/server/dist/planStore.js +236 -64
  697. package/server/dist/planTools.d.ts +41 -0
  698. package/server/dist/planTools.js +259 -0
  699. package/server/dist/previewAutoDetect.js +31 -23
  700. package/server/dist/previewPortConfiguration.d.ts +2 -0
  701. package/server/dist/previewPortConfiguration.js +32 -0
  702. package/server/dist/previewPorts.d.ts +1 -0
  703. package/server/dist/previewPorts.js +3 -0
  704. package/server/dist/previewProxy.d.ts +30 -9
  705. package/server/dist/previewProxy.js +226 -183
  706. package/server/dist/primaryBackgroundTracker.d.ts +15 -2
  707. package/server/dist/primaryBackgroundTracker.js +172 -63
  708. package/server/dist/primitives/exportContext.d.ts +3 -0
  709. package/server/dist/primitives/exportContext.js +77 -15
  710. package/server/dist/primitives/localFileContext.d.ts +3 -0
  711. package/server/dist/primitives/localFileContext.js +38 -0
  712. package/server/dist/primitives/reviewContent.d.ts +2 -0
  713. package/server/dist/primitives/reviewContent.js +53 -6
  714. package/server/dist/primitives/runCompare.js +1 -1
  715. package/server/dist/primitives/runDocEdit.js +1 -1
  716. package/server/dist/primitives/runMdTuneup.d.ts +7 -2
  717. package/server/dist/primitives/runMdTuneup.js +59 -32
  718. package/server/dist/primitives/runResearch.js +1 -1
  719. package/server/dist/primitives/runReviewer.d.ts +2 -0
  720. package/server/dist/primitives/runReviewer.js +5 -2
  721. package/server/dist/primitives/seedWorker.d.ts +11 -2
  722. package/server/dist/primitives/seedWorker.js +26 -12
  723. package/server/dist/project/orchestrationProposals.d.ts +1 -0
  724. package/server/dist/project/orchestrationProposals.js +5 -1
  725. package/server/dist/project/taskLedger.d.ts +5 -0
  726. package/server/dist/project/taskLedger.js +36 -11
  727. package/server/dist/projectGlob.d.ts +1 -0
  728. package/server/dist/projectGlob.js +9 -0
  729. package/server/dist/projectIgnore.d.ts +1 -0
  730. package/server/dist/projectIgnore.js +24 -0
  731. package/server/dist/projectScan.d.ts +24 -0
  732. package/server/dist/projectScan.js +101 -0
  733. package/server/dist/projectStateIgnore.d.ts +13 -0
  734. package/server/dist/projectStateIgnore.js +36 -1
  735. package/server/dist/projects.d.ts +11 -3
  736. package/server/dist/projects.js +141 -40
  737. package/server/dist/prompts.js +7 -8
  738. package/server/dist/proportionateTestingSkill.d.ts +7 -0
  739. package/server/dist/proportionateTestingSkill.js +32 -0
  740. package/server/dist/providers/attachmentLabels.d.ts +4 -0
  741. package/server/dist/providers/attachmentLabels.js +9 -0
  742. package/server/dist/providers/attachments.d.ts +1 -3
  743. package/server/dist/providers/attachments.js +58 -173
  744. package/server/dist/providers/claude-native/apiEndpoint.d.ts +2 -0
  745. package/server/dist/providers/claude-native/apiEndpoint.js +8 -0
  746. package/server/dist/providers/claude-native/appendOnlyPrefix.js +21 -1
  747. package/server/dist/providers/claude-native/catalog.js +17 -15
  748. package/server/dist/providers/claude-native/contentBlocks.d.ts +22 -2
  749. package/server/dist/providers/claude-native/contentBlocks.js +31 -8
  750. package/server/dist/providers/claude-native/contextBudget.d.ts +0 -4
  751. package/server/dist/providers/claude-native/contextBudget.js +0 -2
  752. package/server/dist/providers/claude-native/editApply.js +6 -1
  753. package/server/dist/providers/claude-native/fileContent.d.ts +15 -0
  754. package/server/dist/providers/claude-native/fileContent.js +120 -0
  755. package/server/dist/providers/claude-native/filterConfigs/bash-cargo-test.js +2 -0
  756. package/server/dist/providers/claude-native/filterConfigs/bash-jest-vitest.js +2 -0
  757. package/server/dist/providers/claude-native/filterConfigs/bash-pytest.js +2 -0
  758. package/server/dist/providers/claude-native/filterConfigs/index.js +2 -1
  759. package/server/dist/providers/claude-native/foldDigest.js +10 -2
  760. package/server/dist/providers/claude-native/gateReview.d.ts +1 -1
  761. package/server/dist/providers/claude-native/gateReview.js +0 -0
  762. package/server/dist/providers/claude-native/hookIf.d.ts +28 -0
  763. package/server/dist/providers/claude-native/hookIf.js +590 -0
  764. package/server/dist/providers/claude-native/hooks.d.ts +77 -7
  765. package/server/dist/providers/claude-native/hooks.js +344 -52
  766. package/server/dist/providers/claude-native/imageRead.d.ts +15 -0
  767. package/server/dist/providers/claude-native/imageRead.js +108 -0
  768. package/server/dist/providers/claude-native/index.d.ts +4 -1
  769. package/server/dist/providers/claude-native/index.js +32 -2
  770. package/server/dist/providers/claude-native/mediaLimits.d.ts +6 -0
  771. package/server/dist/providers/claude-native/mediaLimits.js +15 -0
  772. package/server/dist/providers/claude-native/mediaRetention.d.ts +11 -0
  773. package/server/dist/providers/claude-native/mediaRetention.js +66 -0
  774. package/server/dist/providers/claude-native/mediaRetirementNotice.d.ts +1 -0
  775. package/server/dist/providers/claude-native/mediaRetirementNotice.js +12 -0
  776. package/server/dist/providers/claude-native/modelParams.d.ts +6 -0
  777. package/server/dist/providers/claude-native/modelParams.js +21 -3
  778. package/server/dist/providers/claude-native/oauth.js +9 -8
  779. package/server/dist/providers/claude-native/outputAccumulator.d.ts +2 -0
  780. package/server/dist/providers/claude-native/outputAccumulator.js +29 -18
  781. package/server/dist/providers/claude-native/peerTools.js +5 -156
  782. package/server/dist/providers/claude-native/pretoolGuards.js +92 -9
  783. package/server/dist/providers/claude-native/registryTools.js +4 -2
  784. package/server/dist/providers/claude-native/resumeSummary.d.ts +23 -2
  785. package/server/dist/providers/claude-native/resumeSummary.js +163 -45
  786. package/server/dist/providers/claude-native/sandboxExecutor.js +26 -19
  787. package/server/dist/providers/claude-native/taskAdmission.d.ts +21 -0
  788. package/server/dist/providers/claude-native/taskAdmission.js +75 -0
  789. package/server/dist/providers/claude-native/toolChecks.d.ts +38 -0
  790. package/server/dist/providers/claude-native/toolChecks.js +96 -0
  791. package/server/dist/providers/claude-native/toolPosture.js +5 -3
  792. package/server/dist/providers/claude-native/toolResultEviction.d.ts +4 -3
  793. package/server/dist/providers/claude-native/toolResultEviction.js +18 -29
  794. package/server/dist/providers/claude-native/tools.d.ts +17 -4
  795. package/server/dist/providers/claude-native/tools.js +248 -135
  796. package/server/dist/providers/claude-native/usageContext.d.ts +30 -0
  797. package/server/dist/providers/claude-native/usageContext.js +70 -0
  798. package/server/dist/providers/claude-native/wireFingerprint.d.ts +2 -2
  799. package/server/dist/providers/claude-native/wireFingerprint.js +2 -2
  800. package/server/dist/providers/claude-native/worker.d.ts +63 -1
  801. package/server/dist/providers/claude-native/worker.js +1103 -324
  802. package/server/dist/providers/claude-native/workerHelpers.d.ts +13 -0
  803. package/server/dist/providers/claude-native/workerHelpers.js +117 -6
  804. package/server/dist/providers/claude-native/workspaceFacts.js +2 -2
  805. package/server/dist/providers/claude.d.ts +1 -0
  806. package/server/dist/providers/claude.js +69 -85
  807. package/server/dist/providers/clusterTaskToolDefinitions.d.ts +11 -0
  808. package/server/dist/providers/clusterTaskToolDefinitions.js +161 -0
  809. package/server/dist/providers/codex-appserver/catalog.js +26 -20
  810. package/server/dist/providers/codex-appserver/index.js +10 -3
  811. package/server/dist/providers/codex-appserver/jsonRpc.d.ts +2 -1
  812. package/server/dist/providers/codex-appserver/jsonRpc.js +11 -3
  813. package/server/dist/providers/codex-appserver/worker.d.ts +5 -0
  814. package/server/dist/providers/codex-appserver/worker.js +119 -81
  815. package/server/dist/providers/codex.js +55 -58
  816. package/server/dist/providers/codexChatBoundary.d.ts +11 -0
  817. package/server/dist/providers/codexChatBoundary.js +60 -0
  818. package/server/dist/providers/codexCodeMode.js +2 -2
  819. package/server/dist/providers/codexContextWindow.js +2 -2
  820. package/server/dist/providers/codexHome.d.ts +1 -0
  821. package/server/dist/providers/codexHome.js +6 -0
  822. package/server/dist/providers/codexImageTool.d.ts +6 -0
  823. package/server/dist/providers/codexImageTool.js +21 -0
  824. package/server/dist/providers/codexVersion.d.ts +1 -0
  825. package/server/dist/providers/codexVersion.js +14 -0
  826. package/server/dist/providers/codexWebSearch.d.ts +2 -0
  827. package/server/dist/providers/codexWebSearch.js +4 -0
  828. package/server/dist/providers/cursor/acpJsonRpc.d.ts +1 -0
  829. package/server/dist/providers/cursor/acpJsonRpc.js +3 -1
  830. package/server/dist/providers/cursor/authState.d.ts +10 -0
  831. package/server/dist/providers/cursor/authState.js +78 -0
  832. package/server/dist/providers/cursor/catalog.js +22 -14
  833. package/server/dist/providers/cursor/chatSandbox.d.ts +11 -0
  834. package/server/dist/providers/cursor/chatSandbox.js +81 -0
  835. package/server/dist/providers/cursor/filePlugin.d.ts +4 -0
  836. package/server/dist/providers/cursor/filePlugin.js +31 -0
  837. package/server/dist/providers/cursor/index.d.ts +1 -0
  838. package/server/dist/providers/cursor/index.js +30 -4
  839. package/server/dist/providers/cursor/modelMap.d.ts +35 -0
  840. package/server/dist/providers/cursor/modelMap.js +180 -0
  841. package/server/dist/providers/cursor/print.js +95 -30
  842. package/server/dist/providers/cursor/worker.d.ts +4 -1
  843. package/server/dist/providers/cursor/worker.js +169 -89
  844. package/server/dist/providers/errorClassifier.js +6 -2
  845. package/server/dist/providers/handoffHistoryBinding.d.ts +11 -0
  846. package/server/dist/providers/handoffHistoryBinding.js +43 -0
  847. package/server/dist/providers/index.d.ts +1 -1
  848. package/server/dist/providers/index.js +18 -18
  849. package/server/dist/providers/llamacpp.d.ts +1 -0
  850. package/server/dist/providers/llamacpp.js +102 -192
  851. package/server/dist/providers/llamacppManager.d.ts +5 -0
  852. package/server/dist/providers/llamacppManager.js +68 -32
  853. package/server/dist/providers/llamacppVersion.d.ts +1 -0
  854. package/server/dist/providers/llamacppVersion.js +5 -0
  855. package/server/dist/providers/lmstudio.d.ts +3 -3
  856. package/server/dist/providers/lmstudio.js +133 -207
  857. package/server/dist/providers/localFileMedia.d.ts +25 -0
  858. package/server/dist/providers/localFileMedia.js +302 -0
  859. package/server/dist/providers/localMcp.d.ts +17 -0
  860. package/server/dist/providers/localMcp.js +85 -0
  861. package/server/dist/providers/localProviderQueue.d.ts +2 -0
  862. package/server/dist/providers/localProviderQueue.js +11 -0
  863. package/server/dist/providers/localShellLifecycle.d.ts +7 -0
  864. package/server/dist/providers/localShellLifecycle.js +33 -0
  865. package/server/dist/providers/localToolDispatch.d.ts +28 -0
  866. package/server/dist/providers/localToolDispatch.js +90 -0
  867. package/server/dist/providers/ollama.d.ts +2 -1
  868. package/server/dist/providers/ollama.js +180 -181
  869. package/server/dist/providers/ollamaDurableCompaction.js +5 -4
  870. package/server/dist/providers/ollamaExecutionHistory.d.ts +1 -1
  871. package/server/dist/providers/ollamaExecutionHistory.js +55 -14
  872. package/server/dist/providers/ollamaFencedTools.js +10 -11
  873. package/server/dist/providers/ollamaResilience.js +9 -13
  874. package/server/dist/providers/ollamaTokens.js +3 -4
  875. package/server/dist/providers/ollamaToolSubset.d.ts +2 -0
  876. package/server/dist/providers/ollamaToolSubset.js +11 -40
  877. package/server/dist/providers/ollamaTools.d.ts +13 -0
  878. package/server/dist/providers/ollamaTools.js +225 -219
  879. package/server/dist/providers/outputStyle.d.ts +2 -1
  880. package/server/dist/providers/outputStyle.js +70 -76
  881. package/server/dist/providers/providerFileContent.d.ts +40 -0
  882. package/server/dist/providers/providerFileContent.js +151 -0
  883. package/server/dist/providers/renderedTranscript.d.ts +1 -0
  884. package/server/dist/providers/renderedTranscript.js +3 -0
  885. package/server/dist/providers/requestDeadline.d.ts +1 -0
  886. package/server/dist/providers/requestDeadline.js +26 -0
  887. package/server/dist/providers/sessionScope.d.ts +2 -0
  888. package/server/dist/providers/sessionScope.js +8 -0
  889. package/server/dist/providers/types.d.ts +1 -0
  890. package/server/dist/publicProject.d.ts +62 -0
  891. package/server/dist/publicProject.js +181 -0
  892. package/server/dist/publicProjectChoice.d.ts +4 -0
  893. package/server/dist/publicProjectChoice.js +46 -0
  894. package/server/dist/quota.d.ts +10 -7
  895. package/server/dist/quota.js +49 -19
  896. package/server/dist/recall/index.js +22 -23
  897. package/server/dist/recall/search.js +9 -32
  898. package/server/dist/recall/transcriptSearch.d.ts +4 -0
  899. package/server/dist/recall/transcriptSearch.js +29 -0
  900. package/server/dist/recentFilesLedger.js +9 -7
  901. package/server/dist/recentProjectActivity.d.ts +11 -0
  902. package/server/dist/recentProjectActivity.js +69 -0
  903. package/server/dist/scanDeadline.d.ts +4 -0
  904. package/server/dist/scanDeadline.js +48 -0
  905. package/server/dist/searchText.d.ts +1 -0
  906. package/server/dist/searchText.js +22 -0
  907. package/server/dist/server/broadcast.d.ts +2 -1
  908. package/server/dist/server/broadcast.js +177 -50
  909. package/server/dist/sessionJsonl.js +45 -19
  910. package/server/dist/settings.d.ts +6 -1
  911. package/server/dist/settings.js +183 -56
  912. package/server/dist/skillManagement.d.ts +125 -0
  913. package/server/dist/skillManagement.js +709 -0
  914. package/server/dist/skillMutation.d.ts +1 -0
  915. package/server/dist/skillMutation.js +6 -0
  916. package/server/dist/skills.d.ts +75 -1
  917. package/server/dist/skills.js +254 -75
  918. package/server/dist/smartPickup.d.ts +1 -0
  919. package/server/dist/smartPickup.js +2 -1
  920. package/server/dist/smartPickupAdapters.d.ts +8 -0
  921. package/server/dist/smartPickupAdapters.js +201 -14
  922. package/server/dist/storageActions.d.ts +50 -0
  923. package/server/dist/storageActions.js +326 -0
  924. package/server/dist/storageArchive.d.ts +24 -0
  925. package/server/dist/storageArchive.js +389 -0
  926. package/server/dist/storageOverview.d.ts +47 -0
  927. package/server/dist/storageOverview.js +197 -0
  928. package/server/dist/storageReport.d.ts +48 -0
  929. package/server/dist/storageReport.js +185 -0
  930. package/server/dist/storageRoot.d.ts +5 -0
  931. package/server/dist/storageRoot.js +38 -0
  932. package/server/dist/storageTurnWatch.d.ts +6 -0
  933. package/server/dist/storageTurnWatch.js +36 -0
  934. package/server/dist/storageWarnings.d.ts +4 -0
  935. package/server/dist/storageWarnings.js +96 -0
  936. package/server/dist/taskDispatcher.js +69 -41
  937. package/server/dist/templates/store.js +75 -59
  938. package/server/dist/terminal/ptyManager.d.ts +3 -1
  939. package/server/dist/terminal/ptyManager.js +44 -37
  940. package/server/dist/terminal/ptyPidRegistry.d.ts +4 -2
  941. package/server/dist/terminal/ptyPidRegistry.js +9 -63
  942. package/server/dist/thirdPartySkills.d.ts +4 -0
  943. package/server/dist/thirdPartySkills.js +80 -0
  944. package/server/dist/toolPath.d.ts +1 -0
  945. package/server/dist/toolPath.js +38 -0
  946. package/server/dist/toolboxWorkflow.js +2 -1
  947. package/server/dist/uploadImages.d.ts +6 -0
  948. package/server/dist/uploadImages.js +155 -0
  949. package/server/dist/voice/computerContext.js +2 -0
  950. package/server/dist/voice/conditionSchema.d.ts +1 -0
  951. package/server/dist/voice/conditionSchema.js +3 -1
  952. package/server/dist/voice/conditions.js +1 -1
  953. package/server/dist/workers/StreamParser.d.ts +3 -0
  954. package/server/dist/workers/StreamParser.js +45 -11
  955. package/server/dist/workers/WorkerManager.d.ts +9 -2
  956. package/server/dist/workers/WorkerManager.js +18 -18
  957. package/server/dist/workers/durablePidRegistry.d.ts +53 -0
  958. package/server/dist/workers/durablePidRegistry.js +289 -0
  959. package/server/dist/workers/limits.js +5 -2
  960. package/server/dist/workers/pidRegistry.d.ts +6 -9
  961. package/server/dist/workers/pidRegistry.js +13 -101
  962. package/server/dist/workers/processActivity.d.ts +6 -0
  963. package/server/dist/workers/processActivity.js +13 -0
  964. package/server/dist/workers/processKill.d.ts +30 -0
  965. package/server/dist/workers/processKill.js +174 -0
  966. package/server/dist/workers/processStartTime.d.ts +21 -5
  967. package/server/dist/workers/processStartTime.js +127 -50
  968. package/server/dist/workflowMeta.d.ts +15 -12
  969. package/server/dist/workflowMeta.js +42 -10
  970. package/server/dist/workflowStore.d.ts +3 -0
  971. package/server/dist/workflowStore.js +275 -88
  972. package/server/dist/workflows/modelTitles.js +4 -3
  973. package/server/dist/workflows/purgeWorkflow.d.ts +1 -0
  974. package/server/dist/workflows/purgeWorkflow.js +15 -2
  975. package/server/dist/workflows/sessionDiscovery.js +5 -17
  976. package/server/dist/workflows/sessionIndex.d.ts +2 -0
  977. package/server/dist/workflows/sessionIndex.js +46 -19
  978. package/server/dist/workflows/types.d.ts +15 -5
  979. package/server/dist/workspace.d.ts +1 -0
  980. package/server/dist/workspace.js +5 -0
  981. package/server/dist/ws/afterTurn.d.ts +9 -0
  982. package/server/dist/ws/afterTurn.js +25 -0
  983. package/server/dist/ws/clusterHandlers.d.ts +7 -2
  984. package/server/dist/ws/clusterHandlers.js +361 -407
  985. package/server/dist/ws/clusterMembers.d.ts +42 -0
  986. package/server/dist/ws/clusterMembers.js +165 -0
  987. package/server/dist/ws/compactHandlers.js +38 -28
  988. package/server/dist/ws/gateHandlers.js +2 -1
  989. package/server/dist/ws/genesisHandlers.js +171 -116
  990. package/server/dist/ws/handoffHandlers.d.ts +3 -1
  991. package/server/dist/ws/handoffHandlers.js +367 -196
  992. package/server/dist/ws/previewCaptureHandlers.js +1 -4
  993. package/server/dist/ws/taskLedgerHandlers.d.ts +6 -1
  994. package/server/dist/ws/taskLedgerHandlers.js +34 -13
  995. package/server/dist/ws/taskLifecycle.d.ts +15 -0
  996. package/server/dist/ws/taskLifecycle.js +39 -0
  997. package/server/dist/ws/turnEngine.d.ts +27 -8
  998. package/server/dist/ws/turnEngine.js +1790 -1637
  999. package/server/dist/ws/turnPrompt.d.ts +17 -0
  1000. package/server/dist/ws/turnPrompt.js +47 -0
  1001. package/server/dist/ws/turnSettings.d.ts +41 -0
  1002. package/server/dist/ws/turnSettings.js +61 -0
  1003. package/server/dist/ws/updatePrimaryConfig.js +63 -40
  1004. package/server/dist/ws/workflowHandlers.d.ts +2 -1
  1005. package/server/dist/ws/workflowHandlers.js +223 -182
  1006. package/server/package.json +1 -1
  1007. package/server/src/appBrowsers.ts +95 -0
  1008. package/server/src/architectureReview.ts +327 -0
  1009. package/server/src/architectureSkill.ts +71 -0
  1010. package/server/src/arcoHome.ts +42 -3
  1011. package/server/src/artifactCopy.ts +320 -0
  1012. package/server/src/atomicFile.ts +6 -1
  1013. package/server/src/attention.ts +33 -27
  1014. package/server/src/auth.ts +20 -6
  1015. package/server/src/authLoginSession.ts +7 -2
  1016. package/server/src/boundedRead.ts +172 -0
  1017. package/server/src/capabilities.ts +26 -9
  1018. package/server/src/catchUp.ts +56 -17
  1019. package/server/src/checkedFile.ts +90 -0
  1020. package/server/src/claudeTransport.ts +14 -0
  1021. package/server/src/clusterAutoTurn.ts +55 -7
  1022. package/server/src/clusterBusyReminder.ts +45 -0
  1023. package/server/src/clusterDirector.ts +6 -3
  1024. package/server/src/clusterIdleNudger.ts +6 -0
  1025. package/server/src/clusterMailbox.ts +96 -26
  1026. package/server/src/clusterPeerOps.ts +11 -19
  1027. package/server/src/clusterPlanBridge.ts +37 -45
  1028. package/server/src/clusterPresets.ts +44 -31
  1029. package/server/src/clusterProgress.ts +3 -0
  1030. package/server/src/clusterSnapshots.ts +36 -15
  1031. package/server/src/clusterStore.ts +25 -14
  1032. package/server/src/clusterTurnTools.ts +11 -0
  1033. package/server/src/commandShell.ts +287 -0
  1034. package/server/src/compactionCounter.ts +69 -0
  1035. package/server/src/compactionReport.ts +20 -0
  1036. package/server/src/contentSearch.ts +8 -3
  1037. package/server/src/contextCalibrator.ts +6 -1
  1038. package/server/src/contextEstimator.ts +71 -16
  1039. package/server/src/contextRefs.ts +41 -11
  1040. package/server/src/conversationActivity.ts +26 -0
  1041. package/server/src/cursorUsage.ts +13 -3
  1042. package/server/src/diagnostics/checks.ts +4 -11
  1043. package/server/src/diagnostics/executableLookup.ts +20 -0
  1044. package/server/src/diagnostics/modelHealth.ts +3 -11
  1045. package/server/src/diagnostics/supportBundle.ts +5 -13
  1046. package/server/src/eventLog.ts +718 -0
  1047. package/server/src/existingClusterMembers.ts +9 -0
  1048. package/server/src/explorerArtifacts.ts +27 -10
  1049. package/server/src/explorerChanged.ts +99 -67
  1050. package/server/src/explorerDocs.ts +37 -31
  1051. package/server/src/explorerLaunch.ts +11 -2
  1052. package/server/src/explorerPlans.ts +22 -2
  1053. package/server/src/fileAccessPolicy.ts +82 -1
  1054. package/server/src/fileContent/decodeSlots.ts +31 -0
  1055. package/server/src/fileContent/detect.ts +28 -0
  1056. package/server/src/fileContent/externalImage.ts +49 -0
  1057. package/server/src/fileContent/icons.ts +37 -0
  1058. package/server/src/fileContent/images.ts +140 -0
  1059. package/server/src/fileContent/legacyText.ts +16 -0
  1060. package/server/src/fileContent/notebook.ts +37 -0
  1061. package/server/src/fileContent/office.ts +234 -0
  1062. package/server/src/fileContent/pdf.ts +59 -0
  1063. package/server/src/fileContent/pngRows.ts +54 -0
  1064. package/server/src/fileContent/svg.ts +42 -0
  1065. package/server/src/fileContent/types.ts +39 -0
  1066. package/server/src/fileContent/worker.ts +43 -0
  1067. package/server/src/fileContent.ts +108 -0
  1068. package/server/src/fileContextReceipts.ts +44 -0
  1069. package/server/src/fileFetch.ts +167 -0
  1070. package/server/src/fileVersion.ts +36 -0
  1071. package/server/src/genesis/creative.ts +27 -33
  1072. package/server/src/genesis/prompts.ts +3 -0
  1073. package/server/src/genesis/savePlan.ts +45 -0
  1074. package/server/src/genesis/stages.ts +4 -4
  1075. package/server/src/gitDiff.ts +20 -5
  1076. package/server/src/gitSnapshots.ts +288 -191
  1077. package/server/src/gitWorking.ts +11 -11
  1078. package/server/src/github.ts +3 -1
  1079. package/server/src/goalRun.ts +7 -4
  1080. package/server/src/handoffHistory.ts +89 -0
  1081. package/server/src/handoffHistoryProtocol.ts +20 -0
  1082. package/server/src/handoffHistorySupport.ts +10 -0
  1083. package/server/src/handoffHistoryTool.ts +192 -0
  1084. package/server/src/handoffPrompts.ts +6 -4
  1085. package/server/src/handoffReplay.ts +20 -0
  1086. package/server/src/handoffSeedCache.ts +22 -0
  1087. package/server/src/http/appBrowserRoutes.ts +17 -0
  1088. package/server/src/http/architectureReviewRoutes.ts +86 -0
  1089. package/server/src/http/clusterRoutes.ts +17 -2
  1090. package/server/src/http/clusterSnapshotRoutes.ts +8 -3
  1091. package/server/src/http/connectionsRoutes.ts +5 -1
  1092. package/server/src/http/diffRoutes.ts +36 -3
  1093. package/server/src/http/explorerRoot.ts +20 -0
  1094. package/server/src/http/explorerRoutes.ts +60 -12
  1095. package/server/src/http/fileRead.ts +2 -1
  1096. package/server/src/http/fileWriteRoutes.ts +3 -2
  1097. package/server/src/http/gitCompareRoutes.ts +4 -5
  1098. package/server/src/http/gitDiffRoutes.ts +3 -2
  1099. package/server/src/http/gitOpRoutes.ts +3 -4
  1100. package/server/src/http/gitWorktreeRoutes.ts +3 -2
  1101. package/server/src/http/handoffHistoryRoutes.ts +42 -0
  1102. package/server/src/http/imageWriteRoutes.ts +5 -1
  1103. package/server/src/http/knowledgeRoutes.ts +2 -0
  1104. package/server/src/http/mediaOpsRoutes.ts +2 -1
  1105. package/server/src/http/originGuard.ts +71 -14
  1106. package/server/src/http/outputRoutes.ts +26 -5
  1107. package/server/src/http/projectBinding.ts +108 -0
  1108. package/server/src/http/providerThrottleRoutes.ts +76 -0
  1109. package/server/src/http/publicProjectRoutes.ts +86 -0
  1110. package/server/src/http/readConfinement.ts +16 -9
  1111. package/server/src/http/router.ts +177 -60
  1112. package/server/src/http/searchRoutes.ts +4 -4
  1113. package/server/src/http/sessionTransport.ts +27 -0
  1114. package/server/src/http/skillManagementRoutes.ts +120 -0
  1115. package/server/src/http/storageRoutes.ts +200 -0
  1116. package/server/src/http/usageStatsRoutes.ts +3 -11
  1117. package/server/src/http/utilityAgentRoutes.ts +19 -5
  1118. package/server/src/http/workflowDataRoutes.ts +68 -16
  1119. package/server/src/http/writeConfinement.ts +31 -12
  1120. package/server/src/http/wsAuth.ts +27 -9
  1121. package/server/src/imageTokens.ts +60 -0
  1122. package/server/src/index.ts +269 -178
  1123. package/server/src/inputDeliveryHistory.ts +122 -0
  1124. package/server/src/keepStore.ts +139 -0
  1125. package/server/src/knowledge/store.ts +27 -19
  1126. package/server/src/legacyTarRestore.ts +177 -0
  1127. package/server/src/llamacppCatalog.ts +47 -12
  1128. package/server/src/localRuntimeStatus.ts +121 -0
  1129. package/server/src/lsp/client.ts +19 -11
  1130. package/server/src/lsp/servers.ts +2 -2
  1131. package/server/src/managedPath.ts +38 -0
  1132. package/server/src/management/clusterActivity.ts +6 -16
  1133. package/server/src/management/hubGuard.ts +135 -0
  1134. package/server/src/management/hubLink.ts +8 -2
  1135. package/server/src/management/initHubLink.ts +54 -75
  1136. package/server/src/manualCompactCapability.ts +8 -0
  1137. package/server/src/mcp/arcoMcpServer.ts +4 -0
  1138. package/server/src/mcp/client.ts +28 -11
  1139. package/server/src/mcp/clusterMcpLoopback.ts +27 -1
  1140. package/server/src/mcp/clusterMcpTools.ts +32 -27
  1141. package/server/src/mcp/fileContent.ts +34 -0
  1142. package/server/src/mcp/fileMcpServer.ts +12 -0
  1143. package/server/src/mcp/fileMcpTools.ts +51 -0
  1144. package/server/src/mcp/handoffHistoryMcpTools.ts +21 -0
  1145. package/server/src/mcp/mcpConfigWriter.ts +43 -12
  1146. package/server/src/mcp/planMcpTools.ts +9 -285
  1147. package/server/src/mcp/planReadMcpServer.ts +19 -0
  1148. package/server/src/mcp/registry.ts +41 -35
  1149. package/server/src/mcp/registryWiring.ts +4 -5
  1150. package/server/src/media/demucs.ts +11 -4
  1151. package/server/src/media/ffmpeg.ts +21 -16
  1152. package/server/src/media/scratch.ts +17 -10
  1153. package/server/src/noticeSource.ts +11 -0
  1154. package/server/src/notifications.ts +10 -5
  1155. package/server/src/npmPlatformResolve.ts +25 -8
  1156. package/server/src/ntfyTransport.ts +12 -4
  1157. package/server/src/outputGrants.ts +53 -0
  1158. package/server/src/outputStore.ts +5 -2
  1159. package/server/src/outputs.ts +84 -17
  1160. package/server/src/peerRecipientContext.ts +16 -5
  1161. package/server/src/planHistory.ts +48 -0
  1162. package/server/src/planStore.ts +201 -55
  1163. package/server/src/planTools.ts +303 -0
  1164. package/server/src/previewAutoDetect.ts +26 -19
  1165. package/server/src/previewPortConfiguration.ts +28 -0
  1166. package/server/src/previewPorts.ts +2 -0
  1167. package/server/src/previewProxy.ts +156 -189
  1168. package/server/src/primaryBackgroundTracker.ts +151 -61
  1169. package/server/src/primitives/exportContext.ts +67 -16
  1170. package/server/src/primitives/localFileContext.ts +31 -0
  1171. package/server/src/primitives/reviewContent.ts +42 -7
  1172. package/server/src/primitives/runCompare.ts +1 -1
  1173. package/server/src/primitives/runDocEdit.ts +1 -1
  1174. package/server/src/primitives/runMdTuneup.ts +45 -25
  1175. package/server/src/primitives/runResearch.ts +1 -1
  1176. package/server/src/primitives/runReviewer.ts +6 -2
  1177. package/server/src/primitives/seedWorker.ts +36 -17
  1178. package/server/src/project/orchestrationProposals.ts +6 -1
  1179. package/server/src/project/taskLedger.ts +37 -11
  1180. package/server/src/projectGlob.ts +9 -0
  1181. package/server/src/projectIgnore.ts +19 -0
  1182. package/server/src/projectScan.ts +76 -0
  1183. package/server/src/projectStateIgnore.ts +40 -1
  1184. package/server/src/projects.ts +114 -36
  1185. package/server/src/prompts.ts +5 -8
  1186. package/server/src/proportionateTestingSkill.ts +31 -0
  1187. package/server/src/providers/attachmentLabels.ts +8 -0
  1188. package/server/src/providers/attachments.ts +52 -174
  1189. package/server/src/providers/claude-native/apiEndpoint.ts +9 -0
  1190. package/server/src/providers/claude-native/appendOnlyPrefix.ts +17 -1
  1191. package/server/src/providers/claude-native/catalog.ts +16 -14
  1192. package/server/src/providers/claude-native/contentBlocks.ts +39 -8
  1193. package/server/src/providers/claude-native/contextBudget.ts +0 -6
  1194. package/server/src/providers/claude-native/editApply.ts +6 -1
  1195. package/server/src/providers/claude-native/fileContent.ts +98 -0
  1196. package/server/src/providers/claude-native/filterConfigs/bash-cargo-test.ts +1 -0
  1197. package/server/src/providers/claude-native/filterConfigs/bash-jest-vitest.ts +1 -0
  1198. package/server/src/providers/claude-native/filterConfigs/bash-pytest.ts +1 -0
  1199. package/server/src/providers/claude-native/filterConfigs/index.ts +2 -1
  1200. package/server/src/providers/claude-native/foldDigest.ts +9 -2
  1201. package/server/src/providers/claude-native/gateReview.ts +0 -0
  1202. package/server/src/providers/claude-native/hookIf.ts +414 -0
  1203. package/server/src/providers/claude-native/hooks.ts +398 -54
  1204. package/server/src/providers/claude-native/imageRead.ts +92 -0
  1205. package/server/src/providers/claude-native/index.ts +32 -1
  1206. package/server/src/providers/claude-native/mediaLimits.ts +14 -0
  1207. package/server/src/providers/claude-native/mediaRetention.ts +49 -0
  1208. package/server/src/providers/claude-native/mediaRetirementNotice.ts +8 -0
  1209. package/server/src/providers/claude-native/modelParams.ts +23 -2
  1210. package/server/src/providers/claude-native/oauth.ts +9 -8
  1211. package/server/src/providers/claude-native/outputAccumulator.ts +29 -17
  1212. package/server/src/providers/claude-native/peerTools.ts +5 -167
  1213. package/server/src/providers/claude-native/pretoolGuards.ts +76 -9
  1214. package/server/src/providers/claude-native/registryTools.ts +4 -2
  1215. package/server/src/providers/claude-native/resumeSummary.ts +168 -44
  1216. package/server/src/providers/claude-native/sandboxExecutor.ts +24 -16
  1217. package/server/src/providers/claude-native/taskAdmission.ts +62 -0
  1218. package/server/src/providers/claude-native/toolChecks.ts +127 -0
  1219. package/server/src/providers/claude-native/toolPosture.ts +5 -3
  1220. package/server/src/providers/claude-native/toolResultEviction.ts +17 -7
  1221. package/server/src/providers/claude-native/tools.ts +228 -130
  1222. package/server/src/providers/claude-native/usageContext.ts +93 -0
  1223. package/server/src/providers/claude-native/wireFingerprint.ts +2 -2
  1224. package/server/src/providers/claude-native/worker.ts +1056 -334
  1225. package/server/src/providers/claude-native/workerHelpers.ts +133 -6
  1226. package/server/src/providers/claude-native/workspaceFacts.ts +2 -2
  1227. package/server/src/providers/claude.ts +65 -93
  1228. package/server/src/providers/clusterTaskToolDefinitions.ts +180 -0
  1229. package/server/src/providers/codex-appserver/catalog.ts +26 -19
  1230. package/server/src/providers/codex-appserver/index.ts +8 -3
  1231. package/server/src/providers/codex-appserver/jsonRpc.ts +9 -2
  1232. package/server/src/providers/codex-appserver/worker.ts +108 -77
  1233. package/server/src/providers/codex.ts +49 -57
  1234. package/server/src/providers/codexChatBoundary.ts +55 -0
  1235. package/server/src/providers/codexCodeMode.ts +2 -2
  1236. package/server/src/providers/codexContextWindow.ts +2 -2
  1237. package/server/src/providers/codexHome.ts +6 -0
  1238. package/server/src/providers/codexImageTool.ts +22 -0
  1239. package/server/src/providers/codexVersion.ts +13 -0
  1240. package/server/src/providers/codexWebSearch.ts +5 -0
  1241. package/server/src/providers/cursor/acpJsonRpc.ts +3 -1
  1242. package/server/src/providers/cursor/authState.ts +72 -0
  1243. package/server/src/providers/cursor/catalog.ts +20 -13
  1244. package/server/src/providers/cursor/chatSandbox.ts +71 -0
  1245. package/server/src/providers/cursor/filePlugin.ts +27 -0
  1246. package/server/src/providers/cursor/index.ts +29 -4
  1247. package/server/src/providers/cursor/modelMap.ts +182 -0
  1248. package/server/src/providers/cursor/print.ts +80 -27
  1249. package/server/src/providers/cursor/worker.ts +156 -84
  1250. package/server/src/providers/errorClassifier.ts +7 -2
  1251. package/server/src/providers/handoffHistoryBinding.ts +40 -0
  1252. package/server/src/providers/index.ts +14 -22
  1253. package/server/src/providers/llamacpp.ts +93 -176
  1254. package/server/src/providers/llamacppManager.ts +62 -33
  1255. package/server/src/providers/llamacppVersion.ts +4 -0
  1256. package/server/src/providers/lmstudio.ts +124 -190
  1257. package/server/src/providers/localFileMedia.ts +229 -0
  1258. package/server/src/providers/localMcp.ts +76 -0
  1259. package/server/src/providers/localProviderQueue.ts +13 -0
  1260. package/server/src/providers/localShellLifecycle.ts +30 -0
  1261. package/server/src/providers/localToolDispatch.ts +111 -0
  1262. package/server/src/providers/ollama.ts +161 -171
  1263. package/server/src/providers/ollamaCtxFallback.ts +1 -2
  1264. package/server/src/providers/ollamaDurableCompaction.ts +5 -4
  1265. package/server/src/providers/ollamaExecutionHistory.ts +40 -13
  1266. package/server/src/providers/ollamaFencedTools.ts +10 -11
  1267. package/server/src/providers/ollamaResilience.ts +10 -13
  1268. package/server/src/providers/ollamaTokens.ts +4 -7
  1269. package/server/src/providers/ollamaToolSubset.ts +14 -2
  1270. package/server/src/providers/ollamaTools.ts +212 -200
  1271. package/server/src/providers/outputStyle.ts +72 -72
  1272. package/server/src/providers/providerFileContent.ts +133 -0
  1273. package/server/src/providers/renderedTranscript.ts +2 -0
  1274. package/server/src/providers/requestDeadline.ts +27 -0
  1275. package/server/src/providers/sessionScope.ts +9 -0
  1276. package/server/src/providers/types.ts +3 -0
  1277. package/server/src/publicProject.ts +183 -0
  1278. package/server/src/publicProjectChoice.ts +39 -0
  1279. package/server/src/quota.ts +48 -23
  1280. package/server/src/recall/index.ts +4 -9
  1281. package/server/src/recall/search.ts +9 -32
  1282. package/server/src/recall/transcriptSearch.ts +27 -0
  1283. package/server/src/recentFilesLedger.ts +10 -8
  1284. package/server/src/recentProjectActivity.ts +56 -0
  1285. package/server/src/scanDeadline.ts +26 -0
  1286. package/server/src/searchText.ts +16 -0
  1287. package/server/src/server/broadcast.ts +166 -48
  1288. package/server/src/sessionJsonl.ts +31 -17
  1289. package/server/src/settings.ts +137 -41
  1290. package/server/src/skillManagement.ts +585 -0
  1291. package/server/src/skillMutation.ts +6 -0
  1292. package/server/src/skills.ts +195 -25
  1293. package/server/src/smartPickup.ts +3 -2
  1294. package/server/src/smartPickupAdapters.ts +157 -13
  1295. package/server/src/storageActions.ts +216 -0
  1296. package/server/src/storageArchive.ts +297 -0
  1297. package/server/src/storageOverview.ts +184 -0
  1298. package/server/src/storageReport.ts +210 -0
  1299. package/server/src/storageRoot.ts +30 -0
  1300. package/server/src/storageTurnWatch.ts +39 -0
  1301. package/server/src/storageWarnings.ts +84 -0
  1302. package/server/src/taskDispatcher.ts +22 -2
  1303. package/server/src/templates/store.ts +72 -57
  1304. package/server/src/terminal/ptyManager.ts +37 -27
  1305. package/server/src/terminal/ptyPidRegistry.ts +10 -58
  1306. package/server/src/thirdPartySkills.ts +79 -0
  1307. package/server/src/toolPath.ts +31 -0
  1308. package/server/src/toolboxWorkflow.ts +2 -1
  1309. package/server/src/uploadImages.ts +124 -0
  1310. package/server/src/voice/computerContext.ts +2 -1
  1311. package/server/src/voice/conditionSchema.ts +3 -1
  1312. package/server/src/voice/conditions.ts +1 -1
  1313. package/server/src/workers/StreamParser.ts +42 -11
  1314. package/server/src/workers/WorkerManager.ts +32 -35
  1315. package/server/src/workers/durablePidRegistry.ts +266 -0
  1316. package/server/src/workers/limits.ts +5 -2
  1317. package/server/src/workers/pidRegistry.ts +15 -89
  1318. package/server/src/workers/processActivity.ts +14 -0
  1319. package/server/src/workers/processKill.ts +175 -1
  1320. package/server/src/workers/processStartTime.ts +137 -49
  1321. package/server/src/workflowMeta.ts +59 -19
  1322. package/server/src/workflowStore.ts +248 -76
  1323. package/server/src/workflows/modelTitles.ts +4 -3
  1324. package/server/src/workflows/purgeWorkflow.ts +12 -3
  1325. package/server/src/workflows/sessionDiscovery.ts +5 -13
  1326. package/server/src/workflows/sessionIndex.ts +29 -12
  1327. package/server/src/workflows/types.ts +20 -10
  1328. package/server/src/workspace.ts +6 -0
  1329. package/server/src/ws/afterTurn.ts +34 -0
  1330. package/server/src/ws/clusterHandlers.ts +198 -276
  1331. package/server/src/ws/clusterMembers.ts +204 -0
  1332. package/server/src/ws/compactHandlers.ts +38 -11
  1333. package/server/src/ws/gateHandlers.ts +2 -1
  1334. package/server/src/ws/genesisHandlers.ts +49 -6
  1335. package/server/src/ws/handoffHandlers.ts +168 -53
  1336. package/server/src/ws/previewCaptureHandlers.ts +1 -4
  1337. package/server/src/ws/taskLedgerHandlers.ts +28 -14
  1338. package/server/src/ws/taskLifecycle.ts +41 -0
  1339. package/server/src/ws/turnEngine.ts +488 -366
  1340. package/server/src/ws/turnPrompt.ts +60 -0
  1341. package/server/src/ws/turnSettings.ts +95 -0
  1342. package/server/src/ws/updatePrimaryConfig.ts +55 -31
  1343. package/server/src/ws/workflowHandlers.ts +190 -160
  1344. package/shared/dist/clusterCoordination.js +15 -7
  1345. package/shared/dist/clusterRolePresets.js +8 -6
  1346. package/shared/dist/codexChat.d.ts +2 -0
  1347. package/shared/dist/codexChat.js +5 -0
  1348. package/shared/dist/folderName.d.ts +1 -0
  1349. package/shared/dist/folderName.js +18 -0
  1350. package/shared/dist/index.d.ts +8 -0
  1351. package/shared/dist/index.js +8 -0
  1352. package/shared/dist/localRuntimeStatus.d.ts +23 -0
  1353. package/shared/dist/localRuntimeStatus.js +47 -0
  1354. package/shared/dist/notificationTitle.d.ts +9 -0
  1355. package/shared/dist/notificationTitle.js +23 -0
  1356. package/shared/dist/outputStyle.d.ts +10 -0
  1357. package/shared/dist/outputStyle.js +28 -0
  1358. package/shared/dist/outputs.d.ts +1 -0
  1359. package/shared/dist/protocol/autoPickup.d.ts +3 -1
  1360. package/shared/dist/protocol/autoPickup.js +1 -1
  1361. package/shared/dist/protocol/chat.d.ts +4 -0
  1362. package/shared/dist/protocol/checkpoints.d.ts +25 -2
  1363. package/shared/dist/protocol/checkpoints.js +1 -0
  1364. package/shared/dist/protocol/clientMessages.d.ts +9 -14
  1365. package/shared/dist/protocol/clusters.d.ts +23 -5
  1366. package/shared/dist/protocol/clusters.js +3 -3
  1367. package/shared/dist/protocol/connections.d.ts +2 -0
  1368. package/shared/dist/protocol/diagnostics.js +1 -1
  1369. package/shared/dist/protocol/genesis.d.ts +9 -0
  1370. package/shared/dist/protocol/index.d.ts +1 -0
  1371. package/shared/dist/protocol/index.js +1 -0
  1372. package/shared/dist/protocol/mcp.d.ts +1 -0
  1373. package/shared/dist/protocol/mcp.js +8 -5
  1374. package/shared/dist/protocol/mdTuneup.d.ts +8 -0
  1375. package/shared/dist/protocol/models.d.ts +3 -1
  1376. package/shared/dist/protocol/models.js +19 -8
  1377. package/shared/dist/protocol/notifications.d.ts +4 -2
  1378. package/shared/dist/protocol/notifications.js +18 -5
  1379. package/shared/dist/protocol/plans.d.ts +4 -1
  1380. package/shared/dist/protocol/remoteManagement.d.ts +6 -0
  1381. package/shared/dist/protocol/serverMessages.d.ts +70 -10
  1382. package/shared/dist/protocol/settings.d.ts +16 -4
  1383. package/shared/dist/protocol/settings.js +17 -1
  1384. package/shared/dist/protocol/storage.d.ts +21 -0
  1385. package/shared/dist/protocol/storage.js +3 -0
  1386. package/shared/dist/protocol/tasks.d.ts +4 -0
  1387. package/shared/dist/protocol/usage.d.ts +1 -0
  1388. package/shared/dist/protocol/utilityAgent.d.ts +2 -2
  1389. package/shared/dist/protocol/utilityAgent.js +2 -2
  1390. package/shared/dist/protocol/workers.d.ts +1 -0
  1391. package/shared/dist/protocol/workflows.d.ts +73 -14
  1392. package/shared/dist/protocol/workflows.js +66 -0
  1393. package/shared/dist/publicGuardrails.d.ts +7 -0
  1394. package/shared/dist/publicGuardrails.js +47 -0
  1395. package/shared/dist/publicSafetyRules.d.ts +1 -0
  1396. package/shared/dist/publicSafetyRules.js +6 -0
  1397. package/shared/dist/runtimeVersions.d.ts +2 -0
  1398. package/shared/dist/runtimeVersions.js +13 -0
  1399. package/shared/dist/shellTool.d.ts +2 -0
  1400. package/shared/dist/shellTool.js +9 -0
  1401. package/shared/src/clusterCoordination.ts +12 -7
  1402. package/shared/src/clusterRolePresets.ts +8 -6
  1403. package/shared/src/codexChat.ts +8 -0
  1404. package/shared/src/folderName.ts +11 -0
  1405. package/shared/src/index.ts +11 -0
  1406. package/shared/src/localRuntimeStatus.ts +53 -0
  1407. package/shared/src/notificationTitle.ts +23 -0
  1408. package/shared/src/outputStyle.ts +35 -0
  1409. package/shared/src/outputs.ts +3 -0
  1410. package/shared/src/protocol/autoPickup.ts +3 -1
  1411. package/shared/src/protocol/chat.ts +5 -0
  1412. package/shared/src/protocol/checkpoints.ts +41 -5
  1413. package/shared/src/protocol/clientMessages.ts +11 -11
  1414. package/shared/src/protocol/clusters.ts +46 -11
  1415. package/shared/src/protocol/connections.ts +6 -0
  1416. package/shared/src/protocol/diagnostics.ts +1 -1
  1417. package/shared/src/protocol/genesis.ts +11 -0
  1418. package/shared/src/protocol/index.ts +1 -0
  1419. package/shared/src/protocol/mcp.ts +12 -7
  1420. package/shared/src/protocol/mdTuneup.ts +9 -2
  1421. package/shared/src/protocol/models.ts +22 -8
  1422. package/shared/src/protocol/notifications.ts +22 -5
  1423. package/shared/src/protocol/plans.ts +7 -7
  1424. package/shared/src/protocol/remoteManagement.ts +10 -3
  1425. package/shared/src/protocol/serverMessages.ts +90 -7
  1426. package/shared/src/protocol/settings.ts +35 -5
  1427. package/shared/src/protocol/storage.ts +35 -0
  1428. package/shared/src/protocol/tasks.ts +7 -0
  1429. package/shared/src/protocol/usage.ts +3 -3
  1430. package/shared/src/protocol/utilityAgent.ts +2 -2
  1431. package/shared/src/protocol/workers.ts +5 -0
  1432. package/shared/src/protocol/workflows.ts +133 -21
  1433. package/shared/src/publicGuardrails.ts +50 -0
  1434. package/shared/src/publicSafetyRules.ts +5 -0
  1435. package/shared/src/runtimeVersions.ts +15 -0
  1436. package/shared/src/shellTool.ts +9 -0
  1437. package/client/dist/assets/galleryEditor-Ca4F8HiM.js +0 -702
  1438. package/client/dist/assets/index-CcNtMA2y.js +0 -546
  1439. package/client/dist/assets/index-Dl8tYsSp.css +0 -1
  1440. package/client/src/components/ConversationMenu.tsx +0 -467
  1441. package/client/src/stores/sessionIndexStore.ts +0 -92
package/docs/GOTCHAS.md CHANGED
@@ -75,8 +75,7 @@ For the architecture map, see [Architecture](ARCHITECTURE.md). For chronological
75
75
  - **Snapshots must never touch the user's real index / HEAD / working tree.** `server/src/gitSnapshots.ts` snapshots via a **unique per-operation `GIT_INDEX_FILE`** (`$TMPDIR/arco-snapshot-<cwd-hash>-<pid>-<uuid>.index`; the shadow repo uses an equally unique index inside its bare gitdir) and only ever writes `refs/arco/<wfid>/<seq>`. The unique name is load-bearing because checkpoint capture is fire-and-forget and multiple workflows can share one cwd; a fixed `snap.index` races on `snap.index.lock`. The repo scratch file must stay outside the worktree too, or one concurrent capture can stage another's scratch when `.arco` is not ignored. No `reset`/`checkout`/`stash`/`add` against the real index - the operator's `git status` must stay byte-identical. The smoke (`npm run smoke:checkpoints`) asserts isolation, cleanup, and concurrency; don't weaken it. All git calls use `execFile` arg arrays (no shell-string interpolation).
76
76
  - **The pre-turn checkpoint hook lives in `turnEngine.handleUserMessage`, not `seedWorker.ts`.** `runPrimaryTurn` is shared by reviewers / handoff seeds / `exportContext` / Task children, which must **not** checkpoint the operator tree. Snapshot only on operator turns, skipped in `armPlanMode`, fire-and-forget so it never blocks/fails the turn. See `docs/CHECKPOINTS.md`.
77
77
  - **Checkpoints are never exposed to the LLM** - no tool, no system-prompt mention. Pure operator infra.
78
- - **The non-git fallback's size caps are load-bearing in BOTH directions - and size is not stable.** The shadow store (bare repo at `~/.arco/checkpoints/<cwd-hash>/git`) writes `<wfid>.<seq>.skipped.json` beside each ref. Revert excludes target-skipped paths from its seed even if they later shrink; if a currently over-cap path overlaps the target tree, it aborts before any write because the safety snapshot cannot preserve those bytes. A same-caps walk alone is insufficient: a large-at-capture file can shrink and be deleted, while a small-at-capture file can grow and be overwritten. Don't remove the sidecar/pruning/purge paths or weaken the abort. Don't reintroduce tar creation either: a tar per turn copies the entire cwd with zero sharing (a 318 GB ComfyUI cwd accrued 302 GB of timeout-truncated partial tars, twice - 2026-08-18/19); the legacy tar READER stays only for pre-shadow checkpoints. See `docs/CHECKPOINTS.md`.
79
- - **Revert's seed must be `add -A` + `rm --cached -- .arco`, not an exclude pathspec.** `add -A -- ':!.arco' ':!.git'` makes git treat matched-but-ignored dirs as explicitly requested; with a global `**/.arco/` ignore rule (the operator's `~/.config/git/ignore`) the add REFUSES and every revert in a repo containing `.arco` fails (found 2026-08-19; pinned by `npm run smoke:checkpoint-revert`).
78
+ - Shadow-checkpoint isolation depends on unique temporary indexes outside the project tree. Keep per-operation index files separate and remove them after use.
80
79
 
81
80
  ## A2 checkpoints vs I3 real git mutation (keep the code paths separate)
82
81
 
@@ -90,11 +89,11 @@ For the architecture map, see [Architecture](ARCHITECTURE.md). For chronological
90
89
 
91
90
  These guardrails bound worker memory use and prevent a runaway subprocess from destabilizing the server. Do not loosen them without reviewing the risk.
92
91
 
93
- - `MAX_WORKER_OUTPUT_BYTES = 5MB` per-worker (capped in per-provider accumulators).
92
+ - `MAX_WORKER_OUTPUT_BYTES` = 50 MB per worker by default (`ARCO_MAX_WORKER_OUTPUT_BYTES`; capped in per-provider accumulators).
94
93
  - `RSS_KILL_BYTES = 32GB` tree-RSS auto-kill via `WorkerManager.startActivityPoll`. Per-workflow opt-out exists via `meta.json` `disableRssGuard` for legitimate heavy jobs (kernel compiles, big LTO links). Reviewers and handoff reflections always run under the global cap regardless.
95
94
  - Subprocesses spawn `detached: true`; `killProcessTree` takes down descendants on cancel.
96
95
  - Linux `/proc`-based activity probe (`processActivity.ts`, polled 1.5s) drives the CPU-pulse UI + silent-exit supervision. See `server/src/workers/limits.ts`.
97
- - **Operator-terminal (PTY) reaping mirrors worker reaping, but with NO RSS auto-kill (§K2).** node-pty children are *not* `detached`, so a clean exit reaps them - but a hard kill reparents them to init and leaks them. So they get the same durable-registry treatment: `server/src/terminal/ptyPidRegistry.ts` persists pids to `~/.arco/terminal-pids.json` (a **separate** file from `worker-pids.json`, so the two reap sets can't clobber each other), and `reapOrphanTerminals()` runs right after `reapOrphanWorkers()` before `listen()`, SIGKILLing stale pids via the shared `forceKillPid`. **Crucial difference: do NOT add an RSS auto-kill of operator shells.** A worker is autonomous and bounded by `RSS_KILL_BYTES`; a terminal runs processes the *operator started intentionally* (dev server, build, REPL), so SIGKILLing their shell on a memory threshold would be destructive and violate the operator-in-control fence. Orphan reaping (a *prior crashed run's* leak) is safe; killing a *live* operator session on a heuristic is not. Any future guard must default to observation-only. Two windows can attach to one session (multi-listener `Set` in `PtySession`); closing one window disposes only its listener, not the co-viewer's.
96
+ - **Operator-terminal (PTY) reaping mirrors worker reaping, but with NO RSS auto-kill (§K2).** node-pty children are *not* `detached`, so a clean exit reaps them - but a hard kill reparents them to init and leaks them. So they get the same durable-registry treatment: `server/src/terminal/ptyPidRegistry.ts` persists pids to `~/.arco/terminal-pids.json` (a **separate** file from `worker-pids.json`, so the two reap sets can't clobber each other), and `reapOrphanTerminals()` runs alongside `reapOrphanWorkers()`, awaited before `listen()`, SIGKILLing stale pids via the shared `forceKillPid`. **Crucial difference: do NOT add an RSS auto-kill of operator shells.** A worker is autonomous and bounded by `RSS_KILL_BYTES`; a terminal runs processes the *operator started intentionally* (dev server, build, REPL), so SIGKILLing their shell on a memory threshold would be destructive and violate the operator-in-control fence. Orphan reaping (a *prior crashed run's* leak) is safe; killing a *live* operator session on a heuristic is not. Any future guard must default to observation-only. Two windows can attach to one session (multi-listener `Set` in `PtySession`); closing one window disposes only its listener, not the co-viewer's.
98
97
  - **The §3.1 stuck-worker breaker pauses a worker that keeps FAILING THE SAME WAY - error-persistence, not action-pattern.** `workers/stuckBreaker.ts` keys per workflow on the signature `toolName|inputHash|outputHash` (the watchdog's NORMALIZED `outputHash` from `providers/outputSignature.ts`, so "the same error" with drifting digits/timestamps collapses to one signature) and counts a streak of FAILING results (`failed` status OR non-zero `exitCode` OR an `[error]` sentinel) with no success interleaved: ≥`DETECT_AT` (3) → `nudge`, ≥`ESCALATE_AT` (5) → recommend a reversible `pause`; any success or different signature → `recovered`. It NEVER kills/prompts a worker itself - it returns a verdict `seedWorker` turns into a visible `worker_stuck` event. A model may legitimately repeat an action pattern, so detection requires repeated failures. Cross-turn + cross-provider (consumes `worker_tool_use` from any transport carrying `outputHash` - claude-native + codex today). Composes with the in-turn Native H9 guard.
99
98
  - **H46 RSS/heap trend logging is OFF by default and observation-only.** `memoryMonitor.ts` samples `process.memoryUsage()` every ~5 min (plus a `boot` baseline and a `shutdown` high-water line) into a file log ONLY when file logging is enabled - a cheap trend the operator greps, never a kill trigger. The `RSS_KILL_BYTES` tree-RSS guard above stays the only auto-kill. Don't wire an action onto the trend.
100
99
 
@@ -130,19 +129,17 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
130
129
  gets only `WebSearch` / `WebFetch`. Codex/Cursor must remain
131
130
  read-only and isolated. Removed providers remain rejected server-side even if a stale client crafts a create request.
132
131
 
133
- - **Web access is the ONE tool a Chat tab may hold, and it is per-tab operator
132
+ - **Web access is the only tool category a Chat tab may hold, and it is per-tab operator
134
133
  state.** `chatWebArmed(config, provider)` in `server/src/chatMode.ts` is the
135
134
  single source of truth: unset `chatWebAccess` means armed for a saved Chat and
136
135
  disarmed for Incognito (the query leaves the machine), and only
137
- `CHAT_WEB_PROVIDERS` (claude, codex, ollama, strata) can honor it. Every transport
138
- states it
139
- outright rather than inheriting a provider default - CLI Claude
140
- `--tools WebSearch,WebFetch`, Native `buildChatWebTools()` (web_search +
141
- web_fetch only; NOT `buildClaudeServerTools`, whose `code_execution` would
142
- hand a projectless chat an interpreter nobody armed), Codex exec + app-server
143
- `web_search="live"|"disabled"`; Ollama advertises only its local
144
- SearXNG-backed `WebSearch` / `WebFetch` pair and auto-executes that narrowed
145
- pair even though Chat has no Agent AUTO toggle. `ollamaToolCallAllowed()`
136
+ `CHAT_WEB_PROVIDERS` (claude, codex, ollama, strata, deepseek) can honor it.
137
+ Every transport states the mode explicitly: CLI Claude passes
138
+ `--tools WebSearch,WebFetch`; Native uses `buildChatWebTools()` (`web_search`,
139
+ `web_fetch` and `read_url`) without `code_execution`; Codex sets
140
+ `web_search="live"|"disabled"`; Ollama, Strata and DeepSeek use Arco's local
141
+ SearXNG-backed `WebSearch` / `WebFetch` pair. Ollama narrows and auto-executes
142
+ that pair even though Chat has no Agent AUTO toggle. `ollamaToolCallAllowed()`
146
143
  repeats the web-only check at dispatch because a model can invent a known but
147
144
  unadvertised tool name; never rely on `tools[]` alone as the Chat boundary.
148
145
  Ollama Chat transcript replay must use `preserveThinking:false`: hidden
@@ -203,11 +200,14 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
203
200
  - **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.
204
201
  - **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.
205
202
  - **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.
206
- - **Provider updates resolve an installable version BEFORE installing - `@latest` is not automatically installable.** `npmPlatformResolve.ts` (`resolveInstallableVersion`, called from `runCliUpdate`) asks the registry whether the `latest` wrapper's **self-published** platform build exists for this `platform-arch` and, if it doesn't, walks back to the newest version that has one and reports a `notice`. This closes the 2026-09-03 / 2026-09-04 codex breakage at the cause rather than after the fact. The cause is a **publish race**, which is why it recurs: upstream moves the `latest` dist-tag when the wrapper is published and the six platform tarballs land separately. Observed directly on 2026-09-04 - at 19:12 local `@openai/codex@0.153.3` was `latest` with no `0.153.3-linux-x64` in the registry (the `linux-x64` dist-tag still read `0.153.2`); by 19:35 the build had appeared and the identical install succeeded. Anyone clicking update inside that window gets a broken codex; clicking again later silently fixes it. Three invariants: (1) **the `ownPackage` narrowing in `findPlatformDep` is load-bearing** - some CLIs optionally depend on third-party platform packages and run fine without them. Resolve only a platform build published by the CLI package itself; do not downgrade a working CLI based on an unrelated optional dependency. (2) **Never infer success from npm's exit code** - a skipped optional dep exits 0; success is "the binary runs afterwards," which is why `runCliUpdate` still probes and still keeps the post-flight `--force` retry for the case where npm skips a build that *does* exist. (3) **A walk-back is a downgrade, not a fix** - it is capped at `MAX_WALK_BACK` (25) so a package that genuinely stopped shipping this platform fails loudly instead of silently installing something ancient, and the operator-facing notice says to re-run once upstream finishes publishing. Registry lookups are pure HTTP against `registry.npmjs.org`; the abbreviated packument (~4 MB for codex) is fetched **only** on the walk-back path, and any registry failure returns null so the updater falls back to plain `@latest` rather than blocking an update on a network blip. Parser shape pinned by `npmPlatformResolve.test.ts`.
203
+ - **Provider updates resolve an installable version BEFORE installing - `@latest` is not automatically installable.** `npmPlatformResolve.ts` (`resolveInstallableVersion`, called from `runCliUpdate`) asks the registry whether the `latest` wrapper's **self-published** platform build exists for this `platform-arch` and, if it doesn't, walks back to the newest version that has one and reports a `notice`. This closes the 2026-09-03 / 2026-09-04 codex breakage at the cause rather than after the fact. The cause is a **publish race**, which is why it recurs: upstream moves the `latest` dist-tag when the wrapper is published and the six platform tarballs land separately. Observed directly on 2026-09-04 - at 19:12 local `@openai/codex@0.153.3` was `latest` with no `0.153.3-linux-x64` in the registry (the `linux-x64` dist-tag still read `0.153.2`); by 19:35 the build had appeared and the identical install succeeded. Anyone clicking update inside that window gets a broken codex; clicking again later silently fixes it. Three invariants: (1) **the `ownPackage` narrowing in `findPlatformDep` is load-bearing** - some CLIs optionally depend on third-party platform packages and run fine without them. Resolve only a platform build published by the CLI package itself; do not downgrade a working CLI based on an unrelated optional dependency. (2) **Never infer success from npm's exit code** - a skipped optional dep exits 0; success is "the binary runs afterwards," which is why `runCliUpdate` still probes and still keeps the post-flight `--force` retry for the case where npm skips a build that *does* exist. (3) **A walk-back is a downgrade, not a fix** - it is capped at `MAX_WALK_BACK` (25) so a package that genuinely stopped shipping this platform fails loudly instead of silently installing something ancient, and the operator-facing notice says to re-run once upstream finishes publishing. Registry lookups are pure HTTP against `registry.npmjs.org`; the abbreviated packument (~4 MB for codex) is fetched **only** on the walk-back path, and an unknown registry result before a missing build is established returns null for the existing `@latest` fallback. Once the registry confirms a missing platform build, an unreadable or unusable fallback list defers the update without running npm or replacing the working CLI. Parser shape pinned by `npmPlatformResolve.test.ts`.
207
204
  - **Multiple Codex CLI installs can coexist.** Arco invokes bare `codex` from `PATH`, so path order determines which binary runs. The provider updater installs through npm global; after an update, confirm that `codex` still resolves to the intended executable before removing or reordering installs.
208
205
 
209
206
  ## Claude Native transport
210
207
 
208
+ - **Ripgrep stdout mixes matches and binary warnings.** Native Grep parses each newline-delimited record before looking for its NUL filename separator. A binary warning has no separator and must be skipped by itself; consuming through the next separator would discard the following text match. The bounded-read regression sorts filenames so the binary warning precedes a readable file.
209
+
210
+ - **Agent shell commands and hooks go through `commandShell()`.** `server/src/commandShell.ts` returns `/bin/sh` on Linux and macOS, Git Bash on Windows and PowerShell on Windows without Git Bash; never spawn `/bin/sh` or `bash` directly for the Bash tools, hooks or sandbox shell scripts, and build the arguments with `shellInvocation()` (PowerShell gets an encoded command, or a temporary script that `cleanup()` removes). Start such children with `spawnShellChild()` and kill them with `signalChildTree()` from `server/src/workers/processKill.ts`: `process.kill(-pid)` does not exist on Windows, `taskkill /T` misses an MSYS background job whose forked parent has exited (the child's `ARCO_PROCESS_TREE` tag finds it through Git Bash's `/proc`), and Node's own argument quoting halves a pair of backslashes on the way into Git Bash (`msysQuote()` with a verbatim command line does not). A hook that cannot start never blocks (`notRun`).
211
211
  - **Cache discipline is load-bearing.** The forced first system block (`"You are Claude Code, ..."`) is byte-stable across every Native tab; the appendSystemPrompt block is byte-stable across iterations within a turn. Never insert per-turn-variable content (timestamps, request IDs, operator name) above the cache marker - that invalidates every prior turn's cache on every tab. System-block ordering is fixed (canonical list in the `buildSystemBlocks` header comment: FORCED_FIRST_BLOCK → north-star → cluster plan → role → efficiency/progress doctrine → delegation contract → sandbox nudge → env note → turn discipline → workspace facts → appendSystemPrompt → systemPrompt → output style; a Chat tab short-circuits to FORCED_FIRST_BLOCK → chat prompt); reordering on a deploy invalidates every active tab's cache. The hardcoded `FORCED_FIRST_BLOCK` constant in `worker.ts` is the single source of truth - operator overrides were intentionally rejected (§14 Q4). On the OAuth subscription path, requests and diagnostics must include the identity block; omitting it can produce a rate-limit error.
212
212
  - **Stateless Native helpers live in siblings, re-exported from `worker.ts` (P0 carve-out).** To stay under the 2000-line cap, the pure leaf helpers were moved to `modelParams.ts` (token/thinking/effort/ctx), `contentBlocks.ts` (content-block types + image/message/server-tool/context-mgmt/strip-thinking helpers), and `workerHelpers.ts` (`replayMessagesFromEvents`, `mergeUsage`, `truncateOutput`, `planParserAdvisories`, `sleepWithSignal`). `worker.ts` re-exports the previously-public names so `from './worker.js'` imports (including the test files) keep working - **add new pure helpers to the sibling modules, not back into `worker.ts`**; only stateful class logic belongs there. The `FORCED_FIRST_BLOCK` constant stays in `worker.ts` (single source of truth, see cache-discipline bullet above).
213
213
  - **Replay-on-restart is the canonical recovery path.** On `ensureStarted` the worker tail-reads `events.jsonl` and reconstructs `messages[]` from `user_message_echo` + `primary_text` entries. Tool_use / tool_result events are NOT replayed (the model gets a clean USER/ASSISTANT view; reconstructing tool ids with full fidelity is deferred - §14 Q7). Don't add a periodic snapshot path without first measuring whether replay cost actually bites. The reconstruction logs to stderr under `[claude-native:<wfid>]`; that's the forensic surface.
@@ -221,19 +221,20 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
221
221
  - **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.
222
222
  - **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").
223
223
  - ** 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).
224
- - **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`. Default is MANUAL (the operator clicks ▸ 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). Both the manual (`compactHandlers`) and auto (`turnEngine`) paths call the SAME `maybeAutoContinueAfterCompact`; keep them in sync.
224
+ - **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.
225
+ - **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.
225
226
  - **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.
226
227
  - **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.
227
228
  - **Anthropic SDK pins `authToken` at construction; rebuild on rotation.** `new Anthropic({ authToken })` captures the token by value - refreshing the token file on disk does NOT update an existing client. A long-lived Native worker that survived a RE-LOGIN keeps its stale token and 401s every subsequent call until the tab closes. `ClaudeNativeWorker.ensureStarted()` stamps `clientTokenObtainedAt` from `ensureLiveTokens()` and rebuilds the SDK client on mismatch (logs `tokens rotated - rebuilding Anthropic client`). The rotation path skips `discoverHooks` and the `init` emit - both are first-time-wiring concerns. Don't pin the SDK client across a token rotation; the auto-refresh path inside `ensureLiveTokens` benefits from the same rebuild.
228
229
  - **Callback port (53692) EADDRINUSE.** When the local OAuth callback server can't bind, `oauth.ts` falls back to manual-paste mode automatically and surfaces a flag the UI shows. Don't try a different port - Anthropic's redirect URI is registered against the constant.
229
230
  - **H10: the Native worker honors Anthropic's OWN retry timing on 429/529/overload - and with the SDK's internal retries off (`maxRetries:0`) this ladder is the ONLY backoff.** `rateLimit.ts resolveRateLimitWait` reads `retry-after` (delta-seconds or HTTP-date) first, else the soonest `anthropic-ratelimit-*-reset` RFC-3339 timestamp; `classifyRateLimit` distinguishes a genuine rate limit from an overload. When no usable header is present (mid-stream SSE errors carry none) it falls back to the fixed 15/30/60s ladder. Don't re-enable SDK `maxRetries` to "help" - you'd double the backoff and lose the header-honoring wait.
230
- - **Wire fingerprint pin is deliberate, not tracked.** `claude-cli/2.1.280` today (`wireFingerprint.ts`; 2.1.75 from Pi → 2.1.257 for Fable 5.1 → 2.1.280 for Opus 5.5). Bumping is a deliberate revalidation against an observed Anthropic-side rejection - not a routine `npm update` or `claude update`. Same rule for `@anthropic-ai/sdk@^0.91.1` (verify `Anthropic({ authToken })` field name + stream-event shape on bumps).
231
+ - **Wire fingerprint pin is deliberate, not tracked.** `claude-cli/2.1.319` today (`wireFingerprint.ts`; 2.1.75 from Pi -> 2.1.257 for Fable 5.1 -> 2.1.280 for Opus 5.5; 2.1.319 for Fable 5.2, which requires at least 2.1.290). Bumping is a deliberate revalidation against an observed Anthropic-side rejection - not a routine `npm update` or `claude update`. Same rule for `@anthropic-ai/sdk@^0.91.1` (verify `Anthropic({ authToken })` field name + stream-event shape on bumps).
231
232
  - **`anthropic-dangerous-direct-browser-access` IS sent on Claude Native OAuth requests.** Current Pi sends it on the SDK `authToken` path together with `x-app: cli`; Arco follows that wire fingerprint. Older Arco docs said Pi did not send it - that was stale after re-checking `earendil-works/pi` on 2026-05-31.
232
233
  - **Native web search/fetch are Anthropic server tools, and their response `usage` is NOT the CTX bar.** `buildToolDefs()` appends Anthropic `web_search_20260209` / `web_fetch_20260309` plus `code_execution_20260120` (required for the efficient 2026 dynamic-filtering path). The response usage fields can include internal search/fetch processing tokens from a single request; those are real billing/processing telemetry but they can be hundreds of thousands of tokens larger than the retained conversation context. Do not drive `CTX: N / window` from `response.usage` on server-tool turns. Worker code prunes completed-turn server-tool evidence / citation metadata / hidden thinking from retained Native history, then uses `messages.countTokens()` with client tools only to estimate the next-turn prompt footprint. Do not add local `WebSearch` / `WebFetch` to `tools.ts` unless the product goal changes to operator-owned search providers; that would route browsing through Arco's dispatcher instead of Claude's native server-tool path.
233
- - **Never edit the LATEST assistant message - not its thinking blocks, not the blocks around them.** Anthropic freezes the last assistant message in `messages[]`: *"`thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response."* This is a much wider rule than the whole-prefix binding `enforcesPreservedThinking()` gates on (Fable/Mythos 5.1) - Opus 4.8 enforces it too - so protection must be unconditional, not model-keyed. The trap: Anthropic server tools return their evidence INSIDE the same assistant message that carries the final answer, so `pruneServerToolEvidenceAfterTurn` (which deletes `server_tool_use` / `*_tool_result` blocks and appends a retained-history note) was rewriting exactly that message. It now skips the latest assistant message; mid-turn assistant messages are still prunable. **The one intentional opt-out is `scrubServerToolEvidenceOnAbort` (`protectLatestAssistant: false`)** - an aborted round leaves a partial assistant message Arco assembled from a truncated stream, and its dangling `server_tool_use` is itself a guaranteed 400, so there the edit is mandatory. Same helper, opposite requirement; `npm run test:orphan-tooluse -w server` pins the abort side and `test:append-only` pins the settled side. **Symptom when regressed (2026-09-05, workflows `1f308e4c` / `b27a3dce` on opus-4-8):** the prune logs normally, `count_tokens` 400s ~150ms later, and the tab is then dead - every subsequent turn replays the same rejected history, and COMPACT can't rescue it because `generateCompactSummary` replays that history too. REWIND / rehydrate is the escape hatch (replay never reconstructs thinking blocks). **Protecting that message is necessary but not sufficient - see the mirror invariant below.** The same rule constrains `stripTrailingThinkingBlocks`, which mutates `this.messages` in place across the whole unsent tail - it has never actually fired in production (0 occurrences in 1466 opus-4-8 turns; `display:'omitted'` rarely ends a message on thinking), so it was left alone, but it is a live source of the identical 400 if that changes.
234
+ - **Never edit the LATEST assistant message - not its thinking blocks, not the blocks around them.** Anthropic freezes the last assistant message in `messages[]`: *"`thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response."* This is a much wider rule than the whole-prefix binding `enforcesPreservedThinking()` gates on (Fable/Mythos 5.2 / 5.1) - Opus 4.8 enforces it too - so protection must be unconditional, not model-keyed. The trap: Anthropic server tools return their evidence INSIDE the same assistant message that carries the final answer, so `pruneServerToolEvidenceAfterTurn` (which deletes `server_tool_use` / `*_tool_result` blocks and appends a retained-history note) was rewriting exactly that message. It now skips the latest assistant message; mid-turn assistant messages are still prunable. **The one intentional opt-out is `scrubServerToolEvidenceOnAbort` (`protectLatestAssistant: false`)** - an aborted round leaves a partial assistant message Arco assembled from a truncated stream, and its dangling `server_tool_use` is itself a guaranteed 400, so there the edit is mandatory. Same helper, opposite requirement; `npm run test:orphan-tooluse -w server` pins the abort side and `test:append-only` pins the settled side. **Symptom when regressed (2026-09-05, workflows `1f308e4c` / `b27a3dce` on opus-4-8):** the prune logs normally, `count_tokens` 400s ~150ms later, and the tab is then dead - every subsequent turn replays the same rejected history, and COMPACT can't rescue it because `generateCompactSummary` replays that history too. REWIND / rehydrate is the escape hatch (replay never reconstructs thinking blocks). **Protecting that message is necessary but not sufficient - see the mirror invariant below.** The same rule constrains `stripTrailingThinkingBlocks`, which mutates `this.messages` in place across the whole unsent tail - it has never actually fired in production (0 occurrences in 1466 opus-4-8 turns; `display:'omitted'` rarely ends a message on thinking), so it was left alone, but it is a live source of the identical 400 if that changes.
234
235
  - **The 400-recovery matcher must cover BOTH preserved-thinking wordings.** `isThinkingBindingError` originally matched only the signature form (*"Invalid `signature` in `thinking` block"* / *"bound to a different conversation"* / `prefix_mismatch_behavior`). The latest-assistant-message form shares none of that vocabulary, so it fell through to the fatal branch and wedged the tab instead of triggering the one-shot `stripAllThinkingBlocks` retry. Any new Anthropic wording for "you edited history we froze" belongs in that matcher - the recovery is the same either way. Relatedly, `bindingStripUsed` re-arms per turn (`runTurn`), not per worker lifetime: it exists to stop a strip-retry loop within a round (already bounded by `attempt`), and a worker that self-healed once must not spend the rest of its life unable to recover again.
235
236
  - **Edit refuses if file wasn't Read this turn.** Mirrors Claude Code's "blind edit" footgun - operators sometimes report "the model wrote a file it never looked at" on CLI; Native enforces the discipline at the dispatcher level. Per-turn read-set is reset at the top of `runTurn`. Reads from a prior turn don't carry over.
236
- - **Background Bash → KillShell registry.** `Bash(run_in_background:true)` returns a `shellId` and registers `{kill, backgrounded:true}` on the worker's per-turn shell map. Foreground Bash also registers (cleared on close) so KillShell can interrupt a stuck foreground command. The map is per-worker (not per-turn) so a background shell started in turn N is killable from turn N+5. Operator cancel + tab close also iterate the map and kill everything.
237
+ - **Background Bash → KillShell registry.** `Bash(run_in_background:true)` returns a `shellId` and registers `{kill, backgrounded:true}` on the worker's per-turn shell map. Foreground Bash also registers (cleared on close) so KillShell can interrupt a stuck foreground command. The map is per-worker (not per-turn) so a background shell started in turn N is killable from turn N+5. Operator cancel + tab close also iterate the map and kill everything; `dispose()` then awaits each registration's `ended` promise (process closed and tree kill finished, capped at 15 s), so nothing keeps the project folder open on Windows.
237
238
  - **Hooks fire inside the dispatcher; they're not the steer-drain hook.** `PreToolUse` / `PostToolUse` fire around each tool call inside `dispatchTool(...)`. The steer-drain hook fires between tool-result append and the next API round-trip in the agent loop. Both can fire on the same iteration without conflict - they have separate purposes (settings.json hooks observe individual tool calls; steer drain delivers operator-typed mid-turn input).
238
239
  - **Handoff disposes the cached worker.** After `handoff_complete`, `disposeProviderResources(workflowId)` is called which tears down the cached `ClaudeNativeWorker`. The next operator turn rebuilds the messages array from the post-handoff transcript. Don't skip this - the worker's in-memory `messages[]` array would otherwise still reference the pre-handoff thread.
239
240
  - **Original-worker handoff may fall back to fresh-summarizer.** Native original-worker reflection can fail after a long/expensive turn when Anthropic terminates the stream (`Anthropic HTTP 0: terminated`) or the source session is otherwise degraded. `runExportContext` keeps the same handoffId/artifactName and falls back to the configured fresh summarizer when original-worker returns an error. It also enforces a bounded original-worker reflection timeout (`ARCO_HANDOFF_ORIGINAL_WORKER_TIMEOUT_MS`, default 180s, clamped 30s-600s) so a degraded old session cannot hold Handoff for minutes before the fallback path starts. This is still operator-initiated Handoff, not an autonomous second-LLM loop: the operator clicked the primitive, the fallback is visible as a system notice, and the final artifact flows through the normal `handoff_artifact_ready` / `handoff_complete` path. Client upsert must clear a prior handoff error if the same handoffId later succeeds.
@@ -273,10 +274,10 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
273
274
  - **The Native system prompt carries a standing turn-discipline block - don't remove it as "prompt bloat."** The forced first block is only the one-line Claude Code identity; the real CLI ships extensive turn-completion doctrine that Native historically lacked, which is why a model could checkpoint mid-task ("Continuing now." → end_turn → idle) where Claude Code would keep working. `buildSystemBlocks` appends the doctrine after the env note and before operator prompts: keep working until done or blocked, never end a turn on a status update/promise, report failed Task delegations explicitly. Cache-stable, unconditional, no cache breakpoint of its own.
274
275
  - **Adaptive-thinking display defaults to `omitted` - a long Fable/Opus think is invisible by design.** `buildThinkingParams` sends `thinking: {type: 'adaptive', display: 'omitted'}` (Claude Code parity), so during an adaptive-thinking stretch the SSE stream carries only `ping` events - nothing bumps `lastPrimaryEventAt` and the client's 30s stuck banner fires on a perfectly healthy worker (a long adaptive-thinking stretch can be legitimately silent for minutes). The per-tab CONFIG `THINKING VISIBILITY` picker (`claudeNativeThinkingDisplay`, `'omitted' | 'summarized'`) flips to `summarized`, streaming thinking deltas into the Activity tab (`primary_thinking` rows) which also refresh the stuck clock. The stream pipeline (`thinking_delta` → `emit('thinking')` → `primary_thinking`) already existed for budget-thinking models - don't "optimize" it away for adaptive ones. Primitives (reviewers / handoff seeds / DOCS / GIT) leave the field unset ⇒ omitted, mirroring outputStyle's forced `'normal'`.
275
276
  - **Interleaved-thinking beta is skipped for adaptive-thinking models by default.** Current Pi comments that adaptive-thinking models have interleaved thinking built in, so it appends `interleaved-thinking-2025-05-14` only for non-adaptive Anthropic thinking paths. Arco mirrors that by default. The CONFIG tab has a Native-only debug toggle (`claudeNativeForceInterleavedThinkingBeta`) that forces the legacy beta anyway on the next turn for A/B testing if a future model starts repeating searches or missing tool-result evidence. Keep the default off unless a fresh failing transcript justifies the experiment.
276
- - **Image attachments build proper content blocks.** `buildUserMessageContent` reads `.png/.jpg/.jpeg/.gif/.webp` files and base64-encodes them into Anthropic image content blocks; non-image attachments fold to `[attached file: <path>]` text refs (matches exec-mode codex behavior). Anthropic supports png/jpeg/gif/webp via base64; up to 5 MB per image, up to 20 images per request. **Replay-after-restart limitation:** `replayMessagesFromEvents` reconstructs from `user_message_echo` text only; past-turn images aren't re-attached on resume because attachment paths aren't persisted on the echo event. Lower-priority follow-up.
277
+ - **Attachment labels accompany decoded content.** Native prepares images, PDFs, Office documents and notebooks through the shared decoder. Local and CLI adapters prepare fitted images and document text; unsupported binaries provide a note. Source-path labels identify each attachment alongside its content. Saved Native context retains file receipts and attachment references; use Read again for exact detail after reload or compaction.
277
278
  - **Tool-loop iteration cap is a runaway-loop safety net, not an expected workload boundary.** Default `MAX_TOOL_TURNS = 1000` (override via `ARCO_CLAUDE_NATIVE_MAX_TOOL_TURNS` up to 10000). CLI is unbounded; the cap exists purely to catch a stuck model burning tokens indefinitely on a multi-tab Arco. Real workloads top out in the low hundreds; if you ever see this fire on a legitimate task, the cap should go away entirely.
278
- - **The §2.3 budget meter (`context_budget`) reads against the EFFECTIVE window, not the raw one.** `contextBudget.ts` computes `pct = usedTokens / (windowSize − reservedOutput)` - the reserved output tokens (`chooseMaxTokens`) are unusable for input, so a percent against the raw window under-reports how close the prompt is to the wall the API enforces. Pure + LLM-free (the worker passes three ground-truth numbers: `lastPromptTokens`, `KNOWN_CTX`, `chooseMaxTokens`). This meter - NOT the CTX bar's `context_usage` - is the signal the Fold/auto-fold trigger reads. Emitted alongside every `primary_complete`; transient (derived per turn, not persisted).
279
- - **§2.1 Fold (`context_folded`) is a deterministic in-place trim - and like COMPACT it MUST re-seed from the SAME helper at the live and replay sites.** `foldClaudeNativeWorker` replaces a mid-history prefix with a deterministic `foldDigest` (NO model call - task / files / cmds / searches / errors / recent-asks / open-todos extracted from the folded prefix + the live todo list) plus a verbatim token-bounded tail, persists `context_folded { summary, keptTail }`, and continues the SAME session. Replay resets at that marker and re-seeds via `compactSummarySeed(summary, keptTail)` - the exact dual-site byte-identity rule as `native_compacted` (don't fork the wording between sites). It is a DISTINCT event from `native_compacted` so the UI/transcript can tell an instant deterministic Fold from an LLM `/compact`. Manual via the composer FOLD button (`fold_workflow`, idle + Native-gated); auto via the per-tab `autoFold` config (default OFF, set through `update_primary_config`) whose `foldAt` sits BELOW `autoHandoff.warnAt` so the cheap Fold is tried before a handoff is recommended. Anti-thrash: a fold whose `byteDelta < MIN_EFFECTIVE_FOLD_BYTES` increments `foldIneffectiveCount`; ≥2 ineffective folds (`MAX_INEFFECTIVE_FOLDS`) stop auto-fold.
279
+ - **The §2.3 budget meter (`context_budget`) reads against the EFFECTIVE window, not the raw one.** `contextBudget.ts` computes `pct = usedTokens / (windowSize - reservedOutput)` - the reserved output tokens (`chooseMaxTokens`) are unusable for input, so a percent against the raw window under-reports how close the prompt is to the wall the API enforces. Pure + LLM-free (the worker passes three ground-truth numbers: `lastPromptTokens`, `KNOWN_CTX`, `chooseMaxTokens`). This meter - NOT the CTX bar's `context_usage` - is the signal the Fold/auto-fold trigger reads. Emitted alongside every `primary_complete`; transient (derived per turn, not persisted).
280
+ - **§2.1 Fold (`context_folded`) is a deterministic in-place trim - and like COMPACT it MUST re-seed from the SAME helper at the live and replay sites.** `foldClaudeNativeWorker` replaces a mid-history prefix with a deterministic `foldDigest` (NO model call - task / files / cmds / searches / errors / recent-asks / open-todos extracted from the folded prefix + the live todo list) plus a verbatim token-bounded tail, persists `context_folded { summary, keptTail }`, and continues the SAME session. Replay resets at that marker and re-seeds via `compactSummarySeed(summary, keptTail)` - the exact dual-site byte-identity rule as `native_compacted` (don't fork the wording between sites). It is a DISTINCT event from `native_compacted` so the UI/transcript can tell an instant deterministic Fold from an LLM `/compact`. Manual via the composer FOLD button (`fold_workflow`, idle + Native-gated); auto via the per-tab `autoFold` config (default OFF, set through `update_primary_config`) whose `foldAt` is **FOLD AT** on the budget meter. A Fold is not counted toward auto-handoff (which fires after N compactions). Anti-thrash: a fold whose `byteDelta < MIN_EFFECTIVE_FOLD_BYTES` increments `foldIneffectiveCount`; ≥2 ineffective folds (`MAX_INEFFECTIVE_FOLDS`) stop auto-fold.
280
281
  - **`tool_evicted` (§2.2 aggregate spill) is DISTINCT from `tool_filtered` (per-pack tool-result trim) - don't conflate them.** `toolResultEviction.planTurnSpill` fires only when a turn's SUMMED tool-result token cost exceeds the turn budget, then replaces the largest results with a semantic 1-liner receipt (`[Bash] npm test → exit 0 · 47 lines`) largest-first until the retained sum is back under budget. Operator-armed via the `ARCO_TOOL_EVICT` env var (`toolEvictEnabled()` - `on`/`1`/`true`; a per-tab CONFIG toggle is the planned layer on top of this floor). Cache-safe: rewrites only the just-finished turn's results before they form a cache breakpoint. The cross-turn `planTailEviction` (which DOES rewrite prior turns - a deliberate cache break) runs ONLY inside the §2.1 Fold path. Both gzip the raw output to `rawArtifactPath` (fully reversible), same convention as `tool_filtered`.
281
282
  - **§4.1 tool posture filters `buildToolDefs()` to a DETERMINISTIC bundle; `toolPosture.ts` is the single source of truth (clusterEfficiency.ts pattern).** `full` (default) is a no-op (byte-identical tab). `coding`/`review`/`chat` keep a curated CORE set - but tools OUTSIDE the known universe (operator-opted-in `mcp__*` / `peer_*` / `ctx_*` dynamic tools) ALWAYS pass through: a posture must never silently strip an explicit operator opt-in. Two guards: a non-empty fallback (a bundle that would empty the set falls back to `full` + logs, so a turn never bricks on zero tools) and `scrubCrossRefs` (drops "X is still available" clauses in surviving descriptions that name a now-removed tool). Session-local on `WorkflowState` (NEVER meta.json - a reload returns to `full`), but the pick IS broadcast/persisted in events.jsonl via `tool_posture_set` for review. Flipping posture re-breaks the cached `tools[]` prefix once, then re-warms. Native-only; `set_tool_posture` takes effect next turn.
282
283
  - **H50 fuzzy Edit apply NEVER writes back the model's drifted `old_string` - it splices the file's ACTUAL bytes.** `editApply.ts` runs an exact-first chain (`exact` → `escape-drift` → `trailing-ws` → `indent`); each fuzzy strategy must be UNAMBIGUOUS (exactly one match) unless `replace_all`, and the splice replaces the matched region's real bytes (so a one-space / re-indent / over-escaped-`\n` drift applies cleanly instead of returning "old_string not found" and burning a turn). On total no-match it returns a "closest lines" hint so the model corrects without re-Reading. MultiEdit/batch is out of scope. Don't let a fuzzy strategy write the drifted string - that would corrupt the file with the model's mis-remembered whitespace.
@@ -285,17 +286,17 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
285
286
  - **DD2 Bash output NEVER kills on the cap - it spills the COMPLETE output to a tempfile and keeps a bounded RAM tail.** `outputAccumulator.ts` decodes with a streaming `TextDecoder` (UTF-8 chars don't straddle pipe-chunk boundaries → no mojibake), keeps a bounded tail in RAM, and once total output exceeds the cap spills the full stream from byte 0 to a tempfile the model can re-read. The spill sink is INJECTED (the bash tool wires a real tempfile; tests wire an in-memory sink) so the accumulator does no I/O itself. Don't restore a kill-on-cap path - a truncated-and-killed command loses the very tail (compiler/test errors land at the end) the operator and model need.
286
287
  - **DD3: Native Write/Edit serialize per real file path through a MODULE-LEVEL mutation queue - the fix for silent lost writes between cluster members on one cwd.** `file-mutation-queue.ts` keys `withFileMutationLock` by `realpath()` (symlink aliases collapse to one queue), and the queue `Map` is module-level so every Native worker in the process (all members of one cluster) serializes against each other, not just a worker against itself - distinct files still run in parallel. The enqueue critical section (async `realpath` + tail read/write) is itself serialized via `registrationTail` to close a registration race for a brand-new path. Emits `file_mutation_queued` ONLY when a write actually waited (its presence in events.jsonl IS the contention signal). NOT proper-lockfile (that's cross-process; DD3 is in-process - CLI claude edits in a child and is out of scope).
287
288
  - **H62: a Write after only a PARTIAL Read of the file this turn surfaces a non-blocking warning (cluster-correctness).** A `Write` replaces the whole file; if the model Read only a slice (`offset`/`limit`) it never saw the tail, and the write silently destroys the unseen lines. The worker's `partialReadSet` (paths Read with offset/limit this turn; a later FULL Read of the same path clears it) drives a warning note on the tool result + a `tool_gate_triggered` event - NOT a gate (a wholesale rewrite is sometimes intended). `Edit` is exempt (targeted splice). Reset per turn alongside `readSet`.
288
- - **H30: a Task child inherits the parent's `outputStyle` - thread it through `runPrimaryTurn`, NOT `derivePrimaryConfig`.** `derivePrimaryConfig` drops `outputStyle`, so the child silently ran `normal` regardless of the parent's OUTPUT STYLE pick until the child turn passed `outputStyle: parent.config.outputStyle` explicitly. The Task tool description also instructs the child to END with a verifiable self-report (files changed / verify commands + outcome / anything undone) so the parent can trust the result without re-deriving it.
289
+ - **H30: a Task child inherits the parent's `outputStyle` - thread it through `runPrimaryTurn`, NOT `derivePrimaryConfig`.** `derivePrimaryConfig` drops `outputStyle`, so the child silently ran `normal` regardless of the parent's OUTPUT STYLE pick until the child turn passed the parent's level explicitly (now `resolveOutputStyle(parent.config.outputStyle)`, so a parent with no saved style passes the default). The Task tool description also instructs the child to END with a verifiable self-report (files changed / verify commands + outcome / anything undone) so the parent can trust the result without re-deriving it.
289
290
  - **H9 in-turn tool-loop guard (`toolLoopGuard.ts`, Native) is warnings-only by default; hard-stop is opt-in.** Two per-turn signals (reset at `primary_turn_started`): identical-repeat (same `tool`+`argsHash` N×, higher threshold - paging/polling is legitimate) and no-progress (same `tool`+`argsHash`+normalized `outputHash` - the model re-calls on a byte-identical result, lower threshold). Default `warn` emits a `tool_loop_warning` + `system_notice`; `ARCO_TOOL_LOOP_GUARD=stop` aborts the loop on first trip; `off` disables detection. Event metadata is `{toolName, argsHash}` ONLY - never raw args (secrets / large pastes). Sibling of the cross-turn §3.1 stuck breaker (see § Worker safety) - the two compose: H9 catches a tight same-turn spin in a few iterations, §3.1 catches a worker failing the same way across turns.
290
291
  - **H8 aggregate `@`-ref budget gate (`contextRefs.ts`, all providers) soft-warns at ~25% and HARD-REFUSES any ref past ~50% of the window.** The per-ref 64 KB cap bounds ONE ref; H8 sums estimated tokens across every `@file:` / `@diff` / `@git` ref in a turn and, once the running aggregate would cross the hard ceiling, refuses that ref AND every ref after it - so a stack of pastes can't bury the operator's actual instruction. Conservative default window (200k) for unknown models so the gate still bites. Runs at the send path in `handleUserMessage`, not in a provider - so it's transport-agnostic.
291
292
 
292
- - **The Native request prefix is FROZEN per worker and only ever extended.** Claude Fable 5.1 binds every thinking block's signature to the top-level `system`, the name-sorted `tools` set, and every earlier message; editing any of them invalidates every later block (`drop_block` degradation applies when the request opts in - Arco opts in). `resolvePrefixForRequest()` snapshots `system` + `tools` on the worker's FIRST `messages.create` and puts that snapshot on the wire forever after. `buildSystemBlocks()` / `buildToolDefs()` still run per request, but their output is DIFFED (`appendOnlyPrefix.ts`), not sent: a changed system block set becomes an appended `{role:'system'}` message (`ctx_action system_delta`), a changed tool set becomes `tool_addition` / `tool_removal` blocks (`ctx_action tool_set_change`, beta `mid-conversation-tool-changes-2026-07-01`; newly-seen tools are appended to the frozen array with `defer_loading:true`, never inserted). Models without `role:'system'` support (Sonnet 5, Opus 4.7 and older) keep the old rebuild-per-request path - they don't enforce binding. **Never "fix" a stale system prompt by rebuilding it mid-worker, and never reset the freeze on a config change** - `resetPrefixFreeze()` is only for a conversation restart (Fold, Compact, replay, seed). Description-text changes on a still-present tool (posture `scrubCrossRefs`, `webSearchMaxUses`) are ignored while frozen and logged.
293
+ - **The Native request prefix is FROZEN per worker and only ever extended.** Claude Fable 5.2 / 5.1 binds every thinking block's signature to the top-level `system`, the name-sorted `tools` set, and every earlier message; editing any of them invalidates every later block (`drop_block` degradation applies when the request opts in - Arco opts in). `resolvePrefixForRequest()` snapshots `system` + `tools` on the worker's FIRST `messages.create` and puts that snapshot on the wire forever after. `buildSystemBlocks()` / `buildToolDefs()` still run per request, but their output is DIFFED (`appendOnlyPrefix.ts`), not sent: a changed system block set becomes an appended `{role:'system'}` message (`ctx_action system_delta`), a changed tool set becomes `tool_addition` / `tool_removal` blocks (`ctx_action tool_set_change`, beta `mid-conversation-tool-changes-2026-07-01`; newly-seen tools are appended to the frozen array with `defer_loading:true`, never inserted). Models without `role:'system'` support (Sonnet 5, Opus 4.7 and older) keep the old rebuild-per-request path - they don't enforce binding. **Never "fix" a stale system prompt by rebuilding it mid-worker, and never reset the freeze on a config change** - `resetPrefixFreeze()` is only for a conversation restart (Fold, Compact, replay, seed). Description-text changes on a still-present tool (posture `scrubCrossRefs`, `webSearchMaxUses`) are ignored while frozen and logged.
293
294
  - **Per-turn text goes on the USER message, never in `system` (`WorkerConfig.turnNotice`).** The peer-mailbox notice and the plan-mode arm nudge used to be `firstIteration`-gated folds into `appendSystemPrompt`, which flipped the system prompt between consecutive requests of one auto-continued turn. On Native they now ride `turnNotice` → `appendTextToLastUserMessage` (a trailing `text` block on the operator's message, kept in history for good - deleting it next turn would be the same edit). CLI / Codex still get them inside `appendSystemPrompt`. Don't add a new per-turn reminder to `buildSystemBlocks()`; add it to `turnNoticeParts` in turnEngine.
294
- - **Thinking blocks are never deleted from history; on binding-enforcing models the end-of-turn evidence prune is skipped.** `pruneServerToolEvidenceAfterTurn` keeps `thinking` / `redacted_thinking` on every model (the pre-2026-09 shape deleted them, so no reasoning ever crossed a turn and Fable/Opus 5 started every turn cold). On `fable-5-1` / `mythos-5-1` / `opus-5-5` the whole prune is skipped after a normal turn - removing server-tool evidence from the turn's own messages would invalidate that turn's later thinking. The abort-path `scrubServerToolEvidenceOnAbort` still runs everywhere (an orphan `server_tool_use` is a guaranteed 400 - correctness beats cache). Pre-request scrubs (`scrubEmptyTextContent`, `stripTrailingThinkingBlocks`) walk only `unsentTail()` - messages past `sentThrough`, which advances after every accepted request.
295
+ - **Thinking blocks are never deleted from history; on binding-enforcing models the end-of-turn evidence prune is skipped.** `pruneServerToolEvidenceAfterTurn` keeps `thinking` / `redacted_thinking` on every model (the pre-2026-09 shape deleted them, so no reasoning ever crossed a turn and Fable/Opus 5 started every turn cold). On `fable-5-2` / `fable-5-1` / `mythos-5-2` / `mythos-5-1` / `opus-5-5` the whole prune is skipped after a normal turn - removing server-tool evidence from the turn's own messages would invalidate that turn's later thinking. The abort-path `scrubServerToolEvidenceOnAbort` still runs everywhere (an orphan `server_tool_use` is a guaranteed 400 - correctness beats cache). Pre-request scrubs (`scrubEmptyTextContent`, `stripTrailingThinkingBlocks`) walk only `unsentTail()` - messages past `sentThrough`, which advances after every accepted request.
295
296
  - **A `role:'system'` message directly followed by a user message is a 400.** `runTurn` calls `popTrailingSystemMessages` before pushing the operator turn; `resolvePrefixForRequest` only appends when the last message is a user turn (else the delta waits a round and logs `pending`). Arco's own system messages carry a private `arco:` marker that `toWireMessages` strips - Fold / Compact / replay projections already skip non-user/assistant roles, so they never leak into a summary seed.
296
- - **Binding controls are on for Fable 5.1 / Mythos 5.1 / Opus 5.5 (`enforcesPreservedThinking`): `thinking.block_binding.prefix_mismatch_behavior:'drop_block'` + beta `thinking-binding-controls-2026-08-01`.** Opus 5.5 (2026-09-22) ships the same preserved-thinking check as Fable 5.1; Opus 5 does NOT and 400s on `block_binding` - every gate keys on `opus-5-5` explicitly because `includes('opus-5')` matches both (pinned in `appendOnlyPrefix.test.ts`). Every `message_start` then carries `input_transformations`; the worker logs `input_transformations=N` per round and emits `ctx_action { action:'thinking_dropped_by_api', trigger:'api' }` when N>0. **Empty on every round is the proof the harness is append-only** - a `prefix_binding_mismatch` entry is a bug to chase (something before `path` changed since the previous request); `model_binding_mismatch` right after a live model swap is expected and unbilled. Two 400 recoveries in `handleApiError`: a signature/binding rejection strips every thinking block once and retries (`strip_thinking_binding_mismatch`); a rejection naming `tool_addition` / `tool_reference` / `role 'system'` / `block_binding` / `clear_at` THAWS the worker (`prefixThawed`, Arco system messages removed, rebuild-per-request for the rest of its life) and retries - worst case is the pre-plan behaviour, never a dead tab.
297
- - **`claudeNativeThinkingDisplay:'updates'` is a third display mode (Fable 5 / 5.1 / Mythos 5.1 / Opus 5.5 only).** On Opus 5.5 the between-tool-call notes Opus 5 returned as `text` come back as thinking blocks, so under the default `omitted` an Opus 5.5 tab's Activity goes quiet during long tool loops - use `summarized` (or try `updates`). Sends `display:'updates'` + beta `thinking-display-updates-2026-08-18`; the model's between-tool-call progress notes come back as non-empty `thinking` blocks (reasoning stays hidden) and stream through the existing `primary_thinking` rows. `resolveThinkingDisplay` degrades it to `omitted` on any other model so an unknown enum value never 400s. Echo them back unchanged like any thinking block. The stream handler forwards non-empty `thinking_delta` values; the provider may return empty blocks.
298
- - **The Claude-Code wire fingerprint (`user-agent: claude-cli/<ver>`) is model-gated by Anthropic - `wireFingerprint.ts` is the single source of truth.** Fable 5.1 requires CLI version 2.1.251 or newer. The pin prevents a local CLI update from silently changing the wire fingerprint. Update the constant rather than its call sites (worker `messages.create`, `catalog.ts` `/v1/models`, and the diagnostic probe), and validate supported models.
297
+ - **Binding controls are on for Fable 5.2 / 5.1 and Mythos 5.2 / 5.1 / Opus 5.5 (`enforcesPreservedThinking`): `thinking.block_binding.prefix_mismatch_behavior:'drop_block'` + beta `thinking-binding-controls-2026-08-01`.** Opus 5.5 (2026-09-22) ships the same preserved-thinking check as Fable 5.1; Opus 5 does NOT and 400s on `block_binding` - every gate keys on `opus-5-5` explicitly because `includes('opus-5')` matches both (pinned in `appendOnlyPrefix.test.ts`). Every `message_start` then carries `input_transformations`; the worker logs `input_transformations=N` per round and emits `ctx_action { action:'thinking_dropped_by_api', trigger:'api' }` when N>0. **Empty on every round is the proof the harness is append-only** - a `prefix_binding_mismatch` entry is a bug to chase (something before `path` changed since the previous request); `model_binding_mismatch` right after a live model swap is expected and unbilled. Two 400 recoveries in `handleApiError`: a signature/binding rejection strips every thinking block once and retries (`strip_thinking_binding_mismatch`); a rejection naming `tool_addition` / `tool_reference` / `role 'system'` / `block_binding` / `clear_at` THAWS the worker (`prefixThawed`, Arco system messages removed, rebuild-per-request for the rest of its life) and retries - worst case is the pre-plan behaviour, never a dead tab.
298
+ - **`claudeNativeThinkingDisplay:'updates'` is a third display mode (Fable 5 / 5.1 / 5.2 / Mythos 5.1 / 5.2 / Opus 5.5 only).** On Opus 5.5 the between-tool-call notes Opus 5 returned as `text` come back as thinking blocks, so under the default `omitted` an Opus 5.5 tab's Activity goes quiet during long tool loops - use `summarized` (or try `updates`). Sends `display:'updates'` + beta `thinking-display-updates-2026-08-18`; the model's between-tool-call progress notes come back as non-empty `thinking` blocks (reasoning stays hidden) and stream through the existing `primary_thinking` rows. `resolveThinkingDisplay` degrades it to `omitted` on any other model so an unknown enum value never 400s. Echo them back unchanged like any thinking block. The stream handler forwards non-empty `thinking_delta` values; the provider may return empty blocks.
299
+ - **The Claude-Code wire fingerprint (`user-agent: claude-cli/<ver>`) is model-gated by Anthropic - `wireFingerprint.ts` is the single source of truth.** Fable 5.2 requires CLI version 2.1.290 or newer. The pin prevents a local CLI update from silently changing the wire fingerprint. Update the constant rather than its call sites (worker `messages.create`, `catalog.ts` `/v1/models`, and the diagnostic probe), and validate supported models.
299
300
 
300
301
  ## Codex
301
302
 
@@ -303,7 +304,7 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
303
304
  - **Codex context size has a conservative default and a larger catalog maximum.** As of 2026-09-11, Astra and the GPT-5.6 workers (and GPT-6 Sol / Luna from 2026-09-22) advertise `context_window:272000`, `max_context_window:872000`, and `effective_context_window_percent:95`, producing 258.4K STANDARD or 828.4K MAX. Arco defaults per-tab `codexContextPolicy` to MAX and reads these values from the selected account's live `$CODEX_HOME/models_cache.json`; never hardcode the override because model/account entitlements can change. Both exec and app-server must receive the same policy. Changing policy/model/account must change the app-server bootstrap signature so the child recycles and resumes the durable thread on the next turn. Missing metadata omits the override and fails safe to Codex's own default. The stream-reported `model_context_window` still wins in the CTX bar.
304
305
  - **No concurrent-writer guard for Codex rollouts (yet).** Claude's JSONL watcher detects foreign `claude --resume <uuid>` writes and refuses turns for 60s. Codex doesn't have an equivalent. Probe (2026-04-26): every rollout file at `~/.codex/sessions/<y>/<m>/<d>/rollout-*.jsonl` carries a unique UUID in its filename - strong evidence that each `codex exec` and `codex exec resume <uuid>` invocation creates a NEW rollout file rather than appending to the existing one (the long 1k-line rollouts in the wild are from the interactive `codex` TUI, not from `exec --json`). If that holds for current Codex CLI versions, two concurrent `exec resume` calls against the same `thread_id` produce two separate rollout files and there's no interleaved-write corruption to worry about. **Caveat: this hasn't been verified by triggering the race directly.** If a future Codex CLI version flips to append-mode, port the Claude pattern from `sessionJsonl.ts` (entrypoint-detection + 60s refusal). For now, the operator-self-inflicted concurrent-resume risk is treated as acceptable and the guard is deferred.
305
306
  - **Codex `cached_input_tokens` is a SUBSET of `input_tokens`, not disjoint.** OpenAI and Anthropic report cache fields with opposite semantics. For **Anthropic/Claude**, `input`, `cacheRead`, and `cacheCreate` are disjoint and sum to the total prompt - Arco's ctx for Claude is `input + cacheCreate`. For **OpenAI/Codex**, `input_tokens` IS the full prompt size and `cached_input_tokens` is informational ("of those input_tokens, this many were served from cache"). Confirmed against real rollout: `input=8402, cached=7296, total=8641` - math only checks out if cached is a subset of input. Arco's ctx for Codex is therefore just `input`. Adding cacheRead would double-count the cached portion. The client's `contextTokens(usage, provider)` branches accordingly; don't unify the formula and don't flip Codex back to a sum.
306
- - **GPT-5.5's "400K window" is misleading - it splits 272K input + 128K output.** Codex itself reports ~258K via `model_context_window` (272K × 0.95 effective-window multiplier). Confirmed against a real rollout's `model_context_window: 258400` field and tracked in upstream Codex issues #19319, #19409, #19208. Arco now captures the stream-reported value directly: `codex-stream.ts` parses both `turn.completed` envelopes and `event_msg::token_count` payloads, forwards `model_context_window` as `result.modelContextWindow`, which `WorkerManager` puts on `worker_complete.modelContextWindow`, which `seedWorker` puts on `primary_complete.modelContextWindow`, which the client store keeps as `JobState.modelContextWindow`. The ContextMeter prefers this observed value over the hardcoded fallback (`client/src/utils/format.ts:codexModelWindow()`, default 272K). The dot indicator next to the percentage flips ● (reported) vs ○ (estimate). When OpenAI ships a Codex model with a different window, the stream value picks it up automatically - only update the hardcoded default if a fresh-spawn-pre-first-turn estimate matters. Auto-handoff for Codex app-server must use the post-settle rollout `last_token_usage` snapshot, not aggregated `turn.completed.usage`. Explicit compact must clear `wf.lastContextPercent` so a pre-compact percentage cannot fire later.
307
+ - **Use the Codex-reported context window when available.** Propagate the observed value to the context meter instead of relying on a fallback estimate, and keep per-call context usage separate from aggregate billing usage.
307
308
  - **TokenUsage carries Codex-only fields too.** `reasoningOutput` is a subset of `output` representing the model's hidden reasoning trace (high-effort GPT-5.x turns can put significant tokens here, and they roll forward into the next turn's prompt - explains why session ctx grows faster than visible chat would suggest). `total` is the provider-reported total when present. Both are captured from `turn.completed.usage.reasoning_output_tokens` / `total_tokens` and from `event_msg::token_count.info.last_token_usage` if Codex emits the TUI envelope. Don't sum them with input/output manually - they're informational subsets/totals, not additive.
308
309
  - **`codex exec --json`'s `turn.completed.usage` aggregates across internal LLM calls within an operator turn - that's a billing number, not a context-window-fill number.** GPT-5.5 high is agentic: one operator turn can drive 5+ internal model calls (think → tool → think → tool → respond). The `usage` block on `turn.completed` reports `input_tokens` summed across all those internal calls. For a 60-character prompt that triggered a heavy investigation, this can land at 400k while the model's actual per-call context fill was ~80k. To recover the per-call reality, the server tails `~/.codex/sessions/<y>/<m>/<d>/rollout-*-<thread_id>.jsonl` after `turn.settled` and reads the latest `event_msg::token_count.info.last_token_usage` (per-call snapshot) and `model_context_window` (the only honest source - exec --json doesn't surface it). Broadcast as `codex_token_snapshot`; client overrides `lastTurnTokens` so the CTX bar reflects per-call reality. `totalTokens` (cumulative billing) keeps the aggregated number - that's the right metric for "you've burned X input tokens this turn" reporting. The post-settle read is awaited before `maybeAutoHandoff()` so threshold checks use the fresh percentage. Code: `server/src/workflows/transcripts.ts` + the post-settle path in `server/src/ws/turnEngine.ts`. Don't simplify back to using `turn.completed.usage` for the CTX bar.
309
310
  - **Original-worker Handoff on a near-full Codex thread will fail at `exec resume`.** Arco's reflection prompt is fixed-length (a few KB), so prompt size isn't the bottleneck. The risk is the thread itself: `codex exec resume <thread_id>` loads the full prior context internally, and if that context already saturates the model's window, the resume errors out before reflection runs. Not original-worker-specific - any `exec resume` on a near-full thread has the same limit. Mitigation if it bites: fall back to `fresh-summarizer` mode (renders the transcript through a fresh Codex worker, which sees only the rendered text + summary prompt). The mode picker exposes both; operator picks. No automatic threshold-based fallback today.
@@ -341,9 +342,9 @@ These guardrails bound worker memory use and prevent a runaway subprocess from d
341
342
 
342
343
  `server/src/media/ffmpeg.ts::resolveMediaInput` / `resolveMediaOutputDir` widen the studio from "cwd-only" to a general tool - **carefully**. The fence is the security core; don't loosen a tier or skip a gate.
343
344
 
344
- - **Three tiers, in order:** (1) inside the workflow cwd → always; (2) inside Arco's `media-scratch` (`server/src/media/scratch.ts::isWithinScratch`) → always; (3) anywhere else → **only** when `mediaUnconfined !== false`. A path clearing none throws `bad-path`. The output dir is gated by the **same** `gate()`.
345
+ - **Three tiers, in order:** (1) inside the workflow cwd → always; (2) inside Arco's `media-scratch` (`server/src/media/scratch.ts::isWithinScratch`) → always; (3) inside a folder listed in `mediaAllowedRoots` → **only** when `mediaUnconfined === true`. A path clearing none throws `bad-path`. The output dir is gated by the **same** `gate()`.
345
346
  - **`unconfined: false` MUST reproduce the pre-N2 fence exactly** (cwd + scratch only). The positional `runMediaOp(cwd, path, spec)` form passes no `opts`, so `unconfined` defaults to `false` - this is what keeps the `audio-ops`/`video-ops` smokes' path-escape assertions (`/etc/hosts`, `../../`) green. Don't flip the default to open.
346
- - **Default-OPEN is deliberate but tunnel-sensitive.** `mediaUnconfined` undefined ⇒ open (`!== false`); the route reads it per-op from the cascade (`readSettings(cwd)`) so a project `.arco/settings.json` can pin it. The operator switches to CONFINED on an exposed instance - keep the Settings toggle + the `bad-path` message that points at it.
347
+ - **Default-CONFINED, and global settings only.** `mediaUnconfined` undefined ⇒ confined (the routes test `=== true`), and outside access also needs the folder in `mediaAllowedRoots` (at most 32). The routes read both from the global settings (`readSettings()` without a cwd), so a project `.arco/settings.json` cannot widen access. Keep the Settings controls + the `bad-path` message that points at them.
347
348
  - **Scratch is always allowed but bounded.** Upload writes to a **fresh per-upload dir** under a **sanitized** basename (can't escape regardless of `?name=`), with a per-upload byte cap, a 24h TTL, and a total-size cap (oldest evicted). `isWithinScratch` is a pure path-containment check - we wrote the bytes, so no symlink-following is needed. Don't gate uploads behind `mediaUnconfined` (imported-file conversion must work even when CONFINED).
348
349
  - **Operator-chosen output never escapes the never-overwrite invariant.** `outputBasenameFor` keeps the stem but **forces** the op's target ext (`targetOutputExt`); `uniqueBasename` + the `outputAbs === inputAbs` refusal + ffmpeg `-n` still hold. `relPath` is returned **only** for an in-cwd output (drives REVEAL IN FILES); out-of-cwd returns the absolute `outputPath` only.
349
350
 
@@ -420,7 +421,7 @@ The N3 ops (`framegrab` / `gif` / `geometry` / `speed` / `gain` / `spectrogram`
420
421
  - **Think-tag streaming, two paths.** Native-parser models (qwen3.5/qwen3.6 with `RENDERER qwen3.5` / `PARSER qwen3.5`, qwen3-vl-thinking, deepseek3, gpt-oss) emit reasoning in `message.thinking` separate from `message.content`. `ollama.ts` reads both: `message.thinking` is forwarded straight to the `thinking` event channel; `message.content` runs through `ThinkSplitter` for legacy non-native-parser models (heretic-tools, qwopus) that still embed `<think>...</think>` in content. Native-parser models also need `think: true` in the request body - `ollama.ts` sends this as `effort !== 'low'`. Don't reintroduce a hand-rolled TEMPLATE that omits the qwen3.5 RENDERER/PARSER directives - capability detection breaks (no `thinking` advertised) and reasoning silently disappears.
421
422
  - **`config.tools` is now an allowlist for Ollama.** Reviewer spawns pass `READ_ONLY_OLLAMA_TOOLS = ['Read','Grep','Glob','WebSearch','WebFetch']` to restrict the registry. Primary spawns pass `tools: undefined` to get the full kit. The Ollama reviewer also overrides `skipPermissions: true` so tools execute (SAFE mode would otherwise return denial strings, defeating the purpose of a code-reading reviewer). Allowlist is the safety net; AUTO/SAFE doesn't apply when no destructive tools are on the menu.
422
423
  - **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.
423
- - **Vision routing trap.** When a model has a vision projector blob (CLIP `mmproj`), Ollama routes loads through llama.cpp instead of its Go-side runner. llama.cpp's vendored snapshot is older than upstream master and may not know the model's architecture (current case: `qwen35`). The fix for Qwen3.6-27B was to strip the projector by `FROM`-ing the text-only blob directly - see `<local-llm-tools>/models/qwen3.6-27b-coder.Modelfile` for the worked example. Vision-capable workflows should pick a model whose arch IS in the vendored llama.cpp (qwen3vlmoe, llava, mllama, etc.).
424
+ - **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.
424
425
  - **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.
425
426
  - **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).
426
427
  - **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`.
@@ -478,7 +479,7 @@ The utility/summarizer call is `stream:false`, and two non-obvious facts make it
478
479
 
479
480
  **MEASURE, don't guess.** Max-num_ctx capacity depends on the daemon's KV-cache quant (`OLLAMA_KV_CACHE_TYPE` - f16/q8_0/q4_0 swing it ~4×) and flash attention, which a static arch formula can't know. Two earlier static approaches were both wrong: a param-count heuristic (off ~50% on GQA), then an exact-arch f16 calc (still 4×+ low for an operator running q4_0 KV, which is the *normal* "maximize context" setup). The only reliable signal is the model's actual VRAM.
480
481
 
481
- - **`estimateMethod: 'measured-live'` is the trusted path.** When the model is loaded, `/api/ps` gives its real `size_vram` at its real `context_length`. Back out KV/token = `(size_vram − weights) / context_length` (base = on-disk weights, NOT weights+overhead - overhead falls into the slope, which keeps it conservative and, critically, never negative so a tiny q4_0 KV doesn't false-negative to 'needs-load'). Then `maxNumCtx = (totalVram − weights) / kvPerTok`, capped at `contextMax`. This reflects q4_0/q8_0/flash-attention automatically. ONLY this path drives SET TO FIT + the warning.
482
+ - **`estimateMethod: 'measured-live'` is the trusted path.** When the model is loaded, `/api/ps` gives its real `size_vram` at its real `context_length`. Back out KV/token = `(size_vram - weights) / context_length` (base = on-disk weights, NOT weights+overhead - overhead falls into the slope, which keeps it conservative and, critically, never negative so a tiny q4_0 KV doesn't false-negative to 'needs-load'). Then `maxNumCtx = (totalVram - weights) / kvPerTok`, capped at `contextMax`. This reflects q4_0/q8_0/flash-attention automatically. ONLY this path drives SET TO FIT + the warning.
482
483
  - **`'needs-load'`** - dense model not loaded. Don't fabricate a number (can't know the KV quant). Tell the operator to run a turn so it can be measured. No warning.
483
484
  - **`'sliding-window'`** (gemma: `*.attention.sliding_window` in `model_info`) - KV is window-bounded, context isn't the VRAM limiter; report the full trained `contextMax`, never warn. (gemma also omits `head_count_kv`, so even a dense calc is impossible.)
484
485
  - **`'unknown'`** - no GPU / no metadata. Informational only.
@@ -489,14 +490,16 @@ The utility/summarizer call is `stream:false`, and two non-obvious facts make it
489
490
 
490
491
  Cursor is an ACP provider (`cursor-agent acp`). Current transport details are summarized in `docs/PROVIDERS.md`; these are the load-bearing traps.
491
492
 
493
+ - **`cursor-agent acp` ignores `--model`; select the model over ACP and confirm it.** A new session reports `default[]` whatever was passed, and only the advertised ids (one per model, with the Cursor CLI's saved settings) are accepted by `session/set_config_option` / `session/set_model`. Never record a model as applied without a confirmed `currentValue`, and never map a catalog variant by model name alone: effort, fast and thinking must match (`modelMap.ts`). Anything else gets a notice naming both models. A successful selection also rewrites the Cursor CLI's saved default model.
494
+ - **Sign-in failures are not start failures.** `Authentication required` (session/new, stderr) must not bump the start-failure breaker, or signing in again leaves the tab blocked. A failed start must also end its child (`ensureStarted` catch), and a worker ignores exit events from a child it already let go of.
492
495
  - **Cluster peer tools ride a loopback HTTP MCP, never stdio.** Cursor ACP advertises `mcpCapabilities:{http:true,sse:true}` and **no stdio** - the stdio child Claude-CLI/Codex members spawn is silently ignored (a stdio `mcpServers` entry is accepted but its tool never called). Cursor members get peer tools from an in-process loopback **StreamableHTTP** MCP server (`server/src/mcp/clusterMcpLoopback.ts`). Don't try to route Cursor through `mcpConfigWriter` / the stdio child.
493
496
  - **`clusterMcpTools.ts` is the single source of truth for the tool set.** The stdio child (`clusterMcpServer.ts`) and the loopback both call `registerClusterTools(server, ctx)`. Don't fork tool names / descriptions / REST wiring between transports - edit the factory once.
494
- - **Fresh-only membership - the exclusion is deliberate.** `mcpServers` is fixed at `session/new`, so the loopback URL can only be injected at worker bootstrap. A Cursor member must be spawned already inside the cluster (cluster creator / FRESH-spawn). A standalone Cursor tab is excluded from `AddWorkerSection`'s EXISTING candidates on purpose - joining it would produce a mute member (session opened without the MCP). **Do not "fix" this by adding cursor to the EXISTING candidates without also solving ACP session re-attach** (session/load with a populated `mcpServers`, preserving the transcript) - otherwise you ship a peer-toolless member.
497
+ - **Fresh-only membership - the exclusion is deliberate.** `mcpServers` is fixed at `session/new`, so the loopback URL can only be injected at worker bootstrap. A Cursor member must be spawned already inside the cluster (cluster creator / FRESH-spawn). The server refuses existing Cursor sessions in cluster creation and add-existing requests, including HTTP cluster creation. A standalone Cursor tab is excluded from `AddWorkerSection`'s EXISTING candidates on purpose - joining it would produce a mute member (session opened without the MCP). **Do not "fix" this by adding cursor to the EXISTING candidates without also solving ACP session re-attach** (session/load with a populated `mcpServers`, preserving the transcript) - otherwise you ship a peer-toolless member.
495
498
  - **The loopback listener is per-member, not per-cluster.** `peer_send` stamps `from: workflowId`, so each member bakes its own identity + can't share a URL. It's torn down on `dispose` (`closeClusterLoopbackMcp`); the ctx is refreshed each `beginTurn` so a mid-life task-board attach/detach lands.
496
499
  - **`resolveClusterOverrideProvider` skips the mismatch check for explicit `cursor` picks.** Cursor proxies the claude-\*/gpt-\*/glm-\* model families, so a Cursor member on `claude-4-opus` is legitimate - inferring `claude` from the id and rejecting it would be wrong. Only bare `auto` + `grok-*` infer to `cursor`. The reverse (requesting `claude` with a grok id) still trips the mismatch, correctly.
497
500
  - **`GET /api/usage-summary` is the ONLY endpoint carrying the included-allocation denominator - don't re-derive it.** The "Included in Pro" gauge (`CursorIncludedGauge`) needs a used/limit denominator that the other dashboard endpoints don't expose for individual accounts: `get-hard-limit` returns only `{noUsageBasedAllowed}`, the legacy `/api/usage` has `maxRequestUsage: null` on usage-based plans, and the endpoint list can't be scraped from the JS bundle (paths built dynamically; the authed page 307s through a separate web-auth). `/api/usage-summary` (GET, session cookie, no CSRF) → `individualUsage.plan.{used,limit,remaining}` cents + `{total,auto,api}PercentUsed` + billing-cycle bounds. `fetchIncludedUsage` is **non-fatal** - if it drifts, `included` is absent and the card falls back to the charged-$ line; don't make it throw.
498
501
  - **The gauge bar fills from Cursor's `totalPercentUsed`, NOT `used/limit` - don't "fix" it.** Cursor weights first-party vs API usage differently, so `totalPercentUsed` (0.23 with used=44¢, limit=2000¢) is deliberately not `44/2000`. Filling the bar from `used/limit` would disagree with cursor.com's own Spending page. The dollar caption uses `used`/`limit`; only the *fill* uses the blended percent. `fmtPct` shows `<1%` for a real-but-sub-1% value rather than rounding live usage to `0%`.
499
- - **Cursor's separate `Other Models` meter is `apiPercentUsed`, not a share of local event totals.** The R-dot 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.
502
+ - **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.
500
503
  - **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.
501
504
  - **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.
502
505
  - **`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.
@@ -517,13 +520,13 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
517
520
  - **Passthrough-bubble dedup has two paths, not one.** Exact-prefix match against `sessionAssistantConcat` is the fast path; when it fails (whitespace drift between streamed deltas and JSONL writes, or a `tool_use` interleave collapsing a gap in the concat), a whitespace-normalized coverage check decides whether to drop the streaming bubble or keep it pinned. Dropping when normalized `sessionChat` covers ≥90% of the streaming content loses a few in-flight tokens for one frame (until `primary_complete` flips `isStreaming: false`) but avoids rendering the whole turn twice, which is what the old pin-to-bottom fallback did. Don't simplify back to exact-prefix-only.
518
521
  - **Optimistic user `timestamp` is carried onto the sessionChat echo**, not just `attachments`. The optimistic add uses client `Date.now()`; the sessionChat echo uses Claude's JSONL wall-clock (different clock, can land seconds later). Sorting by the echo's timestamp caused large pastes to visually reorder relative to streaming/system messages already above them. Same content-prefix + 5s proximity key used for the attachments merge.
519
522
  - **Both render paths sort by timestamp.** The merged path (sessionChat + extras) sorts at the end. The early-return path (when `sessionChat` is empty - non-Claude providers, or fresh workflow before JSONL is populated) **also** sorts. Without this, frames that arrive out of order on the wire (long pauses between text chunks, reconnect replay) render in arrival order and the chat looks scrambled. Both branches must stay sorted.
520
- - **The queue strip's source of truth is `job.queue`, not `job.messages.queued`.** introduced server-authoritative queue snapshots: the server emits `queue_update` on every mutation (enqueue / drain / cancel-one / cancel-all), and the strip in `QueuedMessagesIndicator.tsx` renders directly from `job.queue.steering` + `job.queue.followUp`. The optimistic `ChatMessage.queued` flag is still set on the originating tab so the operator sees their own send echoed instantly, but the strip's render no longer reads from there. This gives replay-on-reconnect coherence (the latest `queue_update` in events.jsonl is the definitive state) AND survives the 30 s `onRehydrateStorage` rule that prunes stale optimistic queued messages on reload.
523
+ - **PENDING's source of truth is `job.queue`, not `job.messages.queued`.** The server emits `queue_update` on every mutation (enqueue / drain / cancel-one / cancel-all), and `QueuedMessagesIndicator.tsx` renders a **PENDING** chip in the composer status line from `job.queue.steering` + `job.queue.followUp`. Opening PENDING shows the list and cancel controls; there is no per-message chip row with its own × above the composer. The optimistic `ChatMessage.queued` flag is still set on the originating tab so the operator sees their own send echoed instantly, but PENDING no longer reads from there. This gives replay-on-reconnect coherence (the latest `queue_update` in events.jsonl is the definitive state) AND survives the 30 s `onRehydrateStorage` rule that prunes stale optimistic queued messages on reload.
521
524
  - **Interrupt and send preserves the primary claim through provider teardown.** `kind:'interrupt'` is a priority entry in the steering bucket, excluded from `drainSteerForWorker`; its correction runs separately before older queued messages. Never implement this as client CANCEL + resend: CANCEL clears the queue and revokes the claim before asynchronous teardown. CLI interrupt waits for actual child exit; Native waits for `runTurn` and carries forward a correction cancelled before `turnInputAccepted`; Codex app-server deduplicates concurrent interrupt/STOP waiters. STOP/removal must still prevent a queued correction from starting. Interrupted work never arms or extends Goal Run. Queued picks, refs, attachments and IDs follow their own instruction. Pinned by `test:interrupt-send` + isolated `smoke:interrupt-send`.
522
525
  - **Steer vs follow-up delivery depends on transport.** Claude Native and local loops drain between tool results and the next API request; Codex app-server drains on `item/completed`. Single-shot transports drain after completion. The server orders pending interrupts first, then remaining steering before follow-ups. A normal steer never aborts an API request to arrive sooner.
523
526
  - **Mid-turn steer delivery boundaries (Ollama + llama.cpp).** The hook lives in `OllamaWorkerProcess.run` / `LlamacppWorkerProcess.run` between `messages.push(...toolResults)` and the next `streamOneTurn`. Server-side `drainSteerForWorker` *splices* the whole steering bucket (drain-all, not shift-one) and broadcasts `queue_update` + `queued_messages_drained`; the originator's `user_message_echo` was emitted at enqueue time in `handleUserMessage` (shape, unchanged) and is the authoritative transcript record - the drain hook does not re-echo. Three invariants here that future edits must not break:
524
527
  - **Splice is destructive; same-iteration re-call returns `[]`.** This is the only mechanism preventing double-deliver under llama.cpp's auto-continue path (which fires on the same iteration after the drain). If you replace `splice(0)` with a non-destructive read, you must also gate the call site against re-entry.
525
528
  - **Recovery arms in llamacpp.ts (`reasoning_runaway` / `stall` / `wall_clock` / `empty_completion`) `continue` *before* reaching the drain hook.** They inject their own synthetic user message and intentionally don't see the queue; they're conversation-repair flows, not normal-flow delivery points. If a future recovery arm wants to flush pending steers, it must call the drain hook explicitly - placing the hook above the recovery branches would cause their injected messages to interleave incorrectly.
526
- - **Mid-turn steer attachments fold to text references (`[attached file: <path>]`), not re-encoded binaries.** The post-turn merged drain still encodes attachments via the provider's normal `buildMessages` path, so a follow-up-with-image queued on a busy tab continues to work as before. Mid-turn image re-encoding for Ollama's `images: [...]` / llama.cpp's `image_url` parts is deferred until a real ask.
529
+ - **Mid-turn steering uses the same attachment preparation as initial messages.** Documents and notebooks provide decoded text alongside their path labels; other binaries provide a note. Fitted images use Ollama `images` or OpenAI `image_url` parts when the serving model reports vision support, and an image note otherwise.
527
530
  - Steer pending while a worker is mid-API-call delivers on the *next* iteration. Arco does not abort in-flight provider calls to land a steer faster - same posture as the post-turn drain.
528
531
  - **Pinned Arco skills store references, never body snapshots.** `WorkflowConfig` / `meta.json` carry only `{scope, slug}`; `turnEngine` re-runs `resolvePinnedSkills` and rebuilds the standing system block every primary turn. This is what makes SKILL.md edits immediate and lets pins survive Native Fold/compaction, Handoff, reload, and restart. Keep one-shot `pickedSkills` in the user-prompt path and pinned skills in the system-prompt path. Pin replacement is bounded (`MAX_PINNED_SKILLS` + aggregate byte cap), persisted before `pinned_skills_set`, and project pins intentionally bypass DD7 discovery suppression because clicking PIN is the operator's explicit vouch. Missing/deleted skills are skipped visibly, never silently auto-unpinned.
529
532
  - **The composer's busy-Enter / Alt+Enter / Alt+↑ / Esc bindings are load-bearing.** `TerminalInput.tsx` `handleKeyDown` checks `isComposing` (IME guard - Enter inside an open candidate window must commit, not submit) and disambiguates by modifier:
@@ -535,7 +538,7 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
535
538
  - `Alt+↑` → recall most recent queued message into the editor (last follow-up else last steer)
536
539
  - Busy + `Esc` → cancel turn; if queue non-empty, `window.confirm("Drop N queued messages?")` first
537
540
  - Busy + `Shift+Esc` → force-cancel without the prompt
538
- - Idle + `Esc` (empty composer) → cancel last queued message (legacy muscle-memory; rare since the strip's [×] is the primary path)
541
+ - Idle + `Esc` (empty composer) → cancel last queued message (legacy muscle-memory; rare since PENDING's list cancel is the primary path)
539
542
 
540
543
  Cancelling an in-flight turn drops the queue too - this matches today's behaviour but is now made explicit (the confirm prompt names the count). Don't add additional Enter behaviours without rechecking IME composition + modifier disambiguation.
541
544
  - **Queued interjections are hidden from the chat log, not just tagged.** `ChatPanel.tsx` filters `m.queued === true` out of `displayMessages` in both the normal extras pipeline AND the `sessionChat.length === 0` early-return path (both filters must stay - the early-return window covers fresh workflows, post-reload replay gaps, and non-Claude providers that never emit `session_entry`). Queued entries surface only in the composer-adjacent `QueuedMessagesIndicator` (pill + preview modal) until the corresponding `session_entry` (Claude's JSONL user-turn write) arrives - at that point the `session_entry` case in `client/src/ws/handleServerMessage.ts` removes every queued optimistic whose 120-char content prefix appears as a substring anywhere in the drained prompt, and lets the sessionChat entry render as the sole visible copy. Removal-on-`session_entry`, not flip-on-echo: the server's `user_message_echo` fires at enqueue time, minutes before Claude actually processes the drained prompt, so using it to flip `queued:false` would (a) surface the message in chat during the wait, and (b) leave the later sessionChat entry to double-render once the 5s content-prefix dedup proximity window blows. The match rule is **substring, not equality**, because the server merges the entire queue into one `\n\n`-joined follow-up turn - a single `session_entry` can resolve N queued optimistic entries at once. Scanning is `queued:true`-only, so a regular (non-queued) send that happens to quote an old queued prefix can never accidentally remove one. Do NOT route queued messages through the 5s sessionChat dedup by unhiding them and relying on proximity; that window cannot span an arbitrary queue wait. The one-turn merge and its client-side matching rules must be changed together.
@@ -553,7 +556,7 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
553
556
  - **`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.
554
557
  - **`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.
555
558
  - **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.
556
- - **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. The first fix (commit `435f060`) 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 - the exact divergence operators reported ("reload looks shattered, resume looks fine"). 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`). (Originating fix: commit `435f060`; coalesce fix: this branch.)
559
+ - **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`).
557
560
  - **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:
558
561
  the help-mode CSS deliberately disables native controls inside `[data-help]`.
559
562
  ProvidersPopover's outside-click handler must ignore `.help-system-ui` so
@@ -601,7 +604,7 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
601
604
  - **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.
602
605
  - **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.
603
606
  - **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.
604
- - **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`). Windows queries run once with an eight-second limit. 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.
607
+ - **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.
605
608
 
606
609
  ## Server-authoritative workspace (mirrored tabs)
607
610
 
@@ -618,10 +621,11 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
618
621
  ## Plans
619
622
 
620
623
  - **`handleNativeEnterPlanModeSet` must NEVER write the shared cluster plan.** For a cluster member it emits `plan_candidate_ready` and lets the operator pick via `PlanCandidateBanner` (save-to-worker / attach-to-cluster / discard); ATTACH TO CLUSTER routes to `cluster_plan_set` → `handleClusterPlanSet`. `plan_set` still fires either way for the events.jsonl audit.
621
- - **Why this is load-bearing:** from 2026-05-19 (`683bbb3`) to 2026-09-01 this branch called `setClusterPlanBody()` directly, which bypassed every guard the deliberate model-driven path enforces. `peerPlanWrite` (the `cluster_plan_write` peer tool) denies mailbox-only members and rejects a destructive body with `destructive_write_requires_operator` via `validatePlanWritePreservesCheckboxes` - doctrine: a model may author or non-destructively restructure the plan but "must preserve existing checkbox tasks and their status". EnterPlanMode did a wholesale body replace with none of that, so one member could wipe every task and its status for every other member - the cluster plan is folded into all of their system prompts.
624
+ - **Why this is load-bearing:** an earlier version called `setClusterPlanBody()` directly, which bypassed every guard the deliberate model-driven path enforces. `peerPlanWrite` (the `cluster_plan_write` peer tool) denies mailbox-only members and rejects a destructive body with `destructive_write_requires_operator` via `validatePlanWritePreservesCheckboxes` - doctrine: a model may author or non-destructively restructure the plan but "must preserve existing checkbox tasks and their status". EnterPlanMode did a wholesale body replace with none of that, so one member could wipe every task and its status for every other member - the cluster plan is folded into all of their system prompts.
622
625
  - It was collateral in a plan-storage refactor, not a decision: the same commit updated `PlanCandidateBanner.tsx`'s ATTACH TO CLUSTER semantics, `plan_candidate_ready` survived only in the `catch` block, and the function's own doc comment still described the gate. `scripts/smoke/phase-2.6.ts` caught it (17/18); it is back to 18/18.
623
626
  - The two legitimate write paths are the operator's (`cluster_plan_set`) and the guarded peer tool (`peerPlanWrite`). Do not add a third.
624
- - **`cluster_plan_changed` is an audit record and must persist.** `broadcastCluster` is live-push only (no seq, no events.jsonl), which is fine for `cluster_state` but silently made plan rewrites untraceable - despite the client handler and `peerTools.ts` both documenting that it lands in events.jsonl. `broadcastCluster` now special-cases this one type and mirrors it to each member via `broadcastWorkflow`. The client handler is a no-op, so the duplicate delivery is inert. Don't route it around that helper.
627
+ - **Never open `events.jsonl` directly; read through `eventLog.ts`.** Since 0.1.4 older records live in sealed `events.<first>-<last>.jsonl.br` segments and the live file holds only the newest part (plus a copy of the newest sealed record). A direct `readFile` or tail read silently misses history; byte offsets into the live file reset when it is sealed (`outputs.ts` keeps a `seq` cursor for that reason).
628
+ - **`cluster_plan_changed` is an audit record and must persist.** `broadcastCluster` is live-push only (no seq, no events.jsonl), which is fine for `cluster_state` but silently made plan rewrites untraceable - despite the client handler and `peerTools.ts` both documenting that it lands in events.jsonl. `broadcastCluster` now special-cases this one type and mirrors it to each member via `broadcastWorkflow`. The mirrored copy carries `bodySha256` instead of the body, which `planHistory.rememberPlanBody` stores once under `plans/.history/`. The client handler is a no-op, so the duplicate delivery is inert. Don't route it around that helper.
625
629
 
626
630
 
627
631
  - **Deleted plan files leave the attachment dangling.** If `<cwd>/.arco/plans/<planId>.md` is removed externally, the next turn's `buildPlanPrefix()` returns empty and the agent runs without the brief. No error surfaced - graceful degradation. Operator notices when the agent stops referencing the plan. The trade-off is intentional (don't break a turn because of file-system drift), but worth knowing.
@@ -649,7 +653,7 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
649
653
 
650
654
  ## Handoff prompt overrides
651
655
 
652
- - **The `[HANDOFF - ` seed-prefix is load-bearing across four call sites.** Three of them are detection-only (`HandoffSeedPill` `startsWith` match, `ChatPanel` PRIOR-SESSIONS compression, `reviewContent.ts` `current-session` scope) and the fourth (`server/src/index.ts` `handleHandoffRequest`) is the *emitter* that produces the seed turn. The literal string is also exported from `server/src/handoffPrompts.ts` as `HANDOFF_SEED_PREFIX` and exposed to operator-edited prompts as the `{{seedPrefix}}` substitution variable so a custom prompt referencing the prefix doesn't fork the constant. **Do not let the prompt editor rewrite the seed itself** - only the *reflection / summarizer* prompts are operator-editable; the seed-prompt assembly lives in `handleHandoffRequest` and stays hard-coded. Changing the prefix means coordinated edits at all five sites; left it untouched.
656
+ - **The `[HANDOFF - ` seed-prefix is load-bearing across four call sites.** Three of them are detection-only (`HandoffSeedPill` `startsWith` match, `ChatPanel` PRIOR-SESSIONS compression, `reviewContent.ts` `current-session` scope) and the fourth (`server/src/index.ts` `handleHandoffRequest`) is the *emitter* that produces the seed turn. The literal string is also exported from `server/src/handoffPrompts.ts` as `HANDOFF_SEED_PREFIX` and exposed to operator-edited prompts as the `{{seedPrefix}}` substitution variable so a custom prompt referencing the prefix doesn't fork the constant. **Do not let the prompt editor rewrite the seed itself** - only the *reflection / summarizer* prompts are operator-editable; the seed-prompt assembly lives in `handleHandoffRequest` and stays hard-coded. Changing the prefix means coordinated edits at all five sites; left it untouched.
653
657
  - **Handoff prompt validation is advisory.** The editor warns when an original-worker override omits `[HANDOFF_COMPLETE]`; saves are not blocked. Arco collects the read-only writer reply and writes the handoff artifact. An empty reply fails the handoff.
654
658
  - **Empty / whitespace-only override files are treated as absent.** `loadEffectivePrompt` falls through to the next tier (project → global → default) when a file exists but `body.trim().length === 0`. Saving an empty body via the UI is therefore *not* the way to "blank out" an inherited prompt - use [RESET TO DEFAULT] (which calls DELETE on the override file) instead. This rule exists so an accidental empty save can't silently strip the agent's instructions and produce empty handoff documents.
655
659
  - **`runExportContext`'s `ctx.cwd` is the override-resolution cwd in both Handoff and Spawn paths.** For Handoff this is the workflow being rotated; for Spawn-from-here it's the *new* workflow's cwd, which is normally the same as the parent's (Spawn doesn't change cwd). If a future feature lets Spawn target a different cwd, the override resolution will follow the new cwd - that's the desired behaviour, but worth knowing.
@@ -681,7 +685,7 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
681
685
  ## Plan-review parsing invariants
682
686
 
683
687
  - **H2 closes plan sections.** An `##` header inside a plan section ends that section; intervening content (until the next `###`) is silently discarded. Without this, headers like `## Open Questions / Blockers` between plan sections leak into the preceding section's preamble and corrupt review bodies. If prose must appear between sections, place it inline in the preceding section, not as an H2 section.
684
- - **Numbered-bullet fallback recognizes naked numbered tasks.** `parsePlan()` treats `- **N.M** Task` (no checkbox) as an unchecked task. This is a foot-gun mitigation - agents (especially Qwen) sometimes strip checkboxes when "updating" a plan, and review surfaces would otherwise break silently. Indented variant ` - **1**` is a subtask. Plain indented bullets (` - Some text` with no checkbox or numbered prefix) are continuation prose, not separate tasks. Don't tighten the regex to require checkboxes - that re-introduces the foot-gun.
688
+ - **Numbered-bullet fallback recognizes naked numbered tasks.** `parsePlan()` treats `- **N.M** Task` (no checkbox) as an unchecked task. This is a foot-gun mitigation - agents (especially Qwen) sometimes strip checkboxes when "updating" a plan, and review surfaces would otherwise break silently. Indented variant ` - **1**` is a subtask. Plain indented bullets (` - Some text` with no checkbox or numbered prefix) are continuation prose, not separate tasks. Don't tighten the regex to require checkboxes - that re-introduces the foot-gun.
685
689
  - **Preamble is reviewable in VERIFY mode.** A phase with zero `[x]` items but containing prose (e.g., " Completed: we did X, Y, Z") renders the prose for the reviewer. Completion-claims-as-prose is a valid claim. Decision rule: render phase if `taskCount > 0 OR preambleLength > 0`; don't reject only because there are no checked items. Only reject VERIFY scope when both the checked-task count AND the preamble are empty.
686
690
  - **Item ID instability.** `${phaseIdx}/${taskIdx}` IDs are stable across check-state toggles but break on reorder/delete. If the operator edits a plan between selecting items in the picker and dispatching the review, unresolvable IDs trigger a reject naming the missing items. Don't try to "rescue" by fuzzy-matching surviving items - operator must re-pick.
687
691
  - **Mode doesn't filter `plan-items`.** VERIFY/CRITIQUE filtering (show only `[x]` vs show all) applies only to `plan-whole` and `plan-phase`. For `plan-items`, the operator's explicit selection is authoritative; mode only affects the reviewer's framing/instructions. All selected items render regardless of check state.
@@ -701,11 +705,13 @@ Cursor is an ACP provider (`cursor-agent acp`). Current transport details are su
701
705
 
702
706
  ## Operator session-cookie gate (WS + HTTP)
703
707
 
708
+ - **Browser approval uses exact origins, not hostname classes.** Scheme, host and port must match a served local origin, enabled development frontend or explicitly configured remote origin. `ARCO_ALLOWED_HOSTS` wildcards apply to Host validation only. Custom proxy ports use `ARCO_ALLOWED_ORIGINS`. Same-site browser subresources without Origin cannot use the API.
709
+
704
710
  - **`/ws`, `/terminal`, `/upload` and every non-agent `/api/*` route need the browser session cookie** (`server/src/http/wsAuth.ts`). Origin guard alone admitted every Origin-less local process - a local script could otherwise drive `cluster_dispatch_once` and `update_primary_config { goalRun }` over a Node `ws` connection with every automation toggle OFF. Don't add an Origin-less or cookie-less bypass for convenience; scripted clients use a test server with `ARCO_WS_AUTH=off`.
705
711
  - **The signing key is memory-only and per-boot.** Never persist it or put it in env/a file - anything an agent can `cat` defeats the gate. Consequence: every restart invalidates cookies, so every client connect path must `await ensureWsSession()` first (both `useWebSocket.ts` and `XtermView.tsx` do). A new socket opener that skips it works until the first deploy, then 401-loops.
706
712
  - **Mint requires browser fetch metadata** (`Sec-Fetch-Site: same-origin`, `Sec-Fetch-Mode: cors|same-origin`, `Sec-Fetch-Dest: empty`, `Origin`). Not an OS sandbox: a same-user process that forges those headers can mint. The gate makes scripting the control plane deliberate circumvention, and logs every refusal.
707
713
  - **Cookie name carries the server port** (`arco_session_<port>`) - cookies ignore ports, so dev and prod on one host would otherwise clobber each other.
708
- - **Agent tool routes stay open** - `/api/clusters/:id/peer/<op>` (CLI/Codex/Cursor MCP children bridge) and `/api/plans` + `/api/plans/attach` (plan MCP tools) are called from agent processes by design (`isAgentToolRoute`). A new MCP tool that calls back into Arco over HTTP must be added there or it 401s; never widen the exemption to a prefix.
714
+ - **Agent plan exceptions name both method and exact path.** `GET/POST /api/plans`, `POST /api/plans/attach`, `GET/PUT /api/plans/refs` and `GET /api/plans/refs/body` serve the six MCP plan tools without a browser cookie. PATCH and DELETE remain operator-session operations, including requests on the attach path. Cluster peer operations and the voice relay retain their own guards. A new MCP callback must declare its intended method/path pair; never exempt a prefix or every method on a plan path.
709
715
  - **Cookie is session-only (no `Max-Age`)** so it never lands in the on-disk cookie DB. The client keeps it alive itself: `installSessionFetch` (401 → re-mint → retry once), `startSessionRefresh` (20 min + on tab focus), both called from `main.tsx` before any window renders. `<a href>`/`<img>` loads of `/api/*` can't retry - they rely on the refresh.
710
716
 
711
717
  ## Goal run (north-star auto-continue)
@@ -717,8 +723,9 @@ Operator-armed, per tab, default OFF; while armed, one continuation turn is disp
717
723
  - **`remaining` is decremented BEFORE the dispatch await.** A fast re-entrant settle would otherwise read the pre-decrement count and spend one iteration twice.
718
724
  - **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.
719
725
  - **Busy / queued is a skip, not a stop** - no iteration consumed, next settle re-evaluates. Only the six reasons in `GOAL_RUN_STOP_TEXT` end a run, and each one is announced with its reason.
720
- - **`maybeGoalRun` runs LAST** among the post-settle armed actions (after auto-fold, auto-handoff, native auto-compaction). Each of those reshapes the context the tick would run against.
726
+ - **`maybeGoalRun` runs LAST** among the post-settle armed actions (after auto-handoff, auto-fold, native auto-compaction; a due auto-handoff replaces the other two at that boundary). Each of those reshapes the context the tick would run against.
721
727
  - **Arming requires a north star**, and clearing the north star mid-run stops it (`no_north_star`) - otherwise the loop dispatches turns pointing at nothing.
728
+ - **Codex goal budgets count cached input once.** Codex input already includes cached tokens; the goal counter adds output without adding the cache subset again. Claude reports uncached input and cache categories separately, so those categories are added.
722
729
  - **Operator messages don't disarm.** Steering mid-run is expected; stopping is always explicit (the chip or `/goal run stop`). The chip renders only while armed, so an unattended loop can never be running without a visible counter and a one-click stop above the composer - don't hide it behind a panel.
723
730
 
724
731
  ## Project trust
@@ -803,7 +810,7 @@ Operator-armed HITL approval gate. Native-only. When `WorkflowConfig.reviewSafeM
803
810
  ## LSP diagnostics
804
811
 
805
812
  - **The post-write hook is fire-and-forget and MUST NOT be able to break a Write/Edit.** `claude-native/tools.ts` calls `try { ctx.onFileWritten?.(abs); } catch { /* best-effort */ }` AFTER the successful `fs.writeFile` in both `Write` and `Edit` - never awaited, never allowed to throw into the write path (the write path is P0). The worker's wiring additionally `void`s the returned promise and `.catch()`es it so an async rejection can't surface as an unhandled rejection. Don't make the hook awaited, don't move it before the write, and don't let any LSP error propagate to the tool's return.
806
- - **Absent language server = silent no-op.** When no LSP server is on PATH for the changed file's language, `resolveServer` returns null and the subsystem does nothing - NO error, NO crash, NO chat notice. This is intentional (bring-your-own-upstream, same as the caveman output style). Don't "helpfully" surface an error when a server is missing; that would spam every operator who hasn't installed `typescript-language-server` et al. `tsserver` is NOT a candidate - it speaks the TSServer protocol, not LSP.
813
+ - **Absent language server = silent no-op.** When no LSP server is on PATH for the changed file's language, `resolveServer` returns null and the subsystem does nothing - NO error, NO crash, NO chat notice. This is intentional (bring-your-own-upstream). Don't "helpfully" surface an error when a server is missing; that would spam every operator who hasn't installed `typescript-language-server` et al. `tsserver` is NOT a candidate - it speaks the TSServer protocol, not LSP.
807
814
  - **0-based → 1-based conversion happens exactly once, in `mapPublishDiagnostics` (`server/src/lsp/client.ts`).** LSP positions are 0-based; the protocol `DiagnosticItem.line/column` are 1-based (`+1` at that boundary). The client never re-converts. If you add another consumer of LSP positions, convert at the same boundary - don't push raw 0-based numbers across the wire.
808
815
  - **Server lifecycle mirrors `llamacppManager`: one process per `(cwd, languageId)`, dedup, idle-reap, shutdown-kill.** `lspManager.shutdown()` is wired into the server's SIGTERM/SIGINT handler (`server/src/index.ts`) and SIGTERM+SIGKILLs every live child. Idle-reap evicts after `ARCO_LSP_KEEPALIVE_MS` (default 5 min). **Orphan gap (noted, accepted):** unlike worker subprocesses, LSP servers have NO durable pid registry / boot-sweep - a hard `kill -9` of the Node server can leak a language-server child until the OS reaps it. Acceptable because they burn no API tokens and idle-reap bounds them; if it ever matters, mirror `pidRegistry.ts`. See `docs/LSP.md`.
809
816
  - **An empty `items[]` clears the file's diagnostics.** `store.setDiagnostics` drops the per-file key on an empty array, so "fix the error → badge drops" just works. Don't change `diagnostics` to accumulate - each message is the authoritative full set for its `file`.
@@ -828,6 +835,8 @@ Operator-armed HITL approval gate. Native-only. When `WorkflowConfig.reviewSafeM
828
835
  ## HISTORY tab
829
836
 
830
837
  - **Lifecycle events re-broadcast on rehydrate regardless of `clientLastSeq`.** `task_started` / `task_status` and `operator_label` are persisted on the parent workflow but the client-side state they drive (`taskChildren`, the HISTORY filter) is rebuilt from the events themselves. A workflow whose only Task fan-out happened pre-refresh would otherwise come up showing `0s · RUNNING` forever (events sit below the seq cutoff). Re-broadcast is safe because the corresponding store actions are idempotent - `recordTaskStarted` / `recordTaskStatus` on `taskId`, and `operator_label` flows through `narrativeEventFromMessage` → `appendHistoryEvent`, which dedupes on `seq`. Don't add a "skip if seq <= clientLastSeq" gate to lifecycle replay - it'll silently regress the refresh path.
838
+ - **Task statuses outlive the turn that started them.** STOP revokes the parent turn synchronously (`revokeBusy`), and `turnEngine`'s `dispatchCurrent()` gate then drops that turn's messages. A child's cancelled status that arrives in a later microtask used to be dropped there, leaving the card RUNNING with a ticking timer forever. `ClaudeNativeWorker.cancel()` now reports unsettled children before the revoke, and the gate lets `task_status` through (`deliverAfterTurnRevoked`). Don't add other message types to that exception: they would leak a stopped turn's output into the next one.
839
+ - Claude Native Task cancellation treats a streaming SDK abort as cancellation when the worker was explicitly stopped; the card shows CANCELLED while its siblings continue.
831
840
  - **Pinned label anchors are by `targetEventSeq`, not by chat-row id.** A label pins to the seq of an event in `events.jsonl`; if the chat-row id changes (e.g. session JSONL renames it), the label still resolves because HistoryTab reads `event.seq → row` rather than chasing the row id. Don't try to "stabilize" labels by switching to row ids - the seq is the load-bearing identity.
832
841
  - **`since-event` Review framing names the operator label.** When `anchorEventSeq` points at an `operator_label` event, `buildReviewContent` lifts the label's `text` into the framing (`research checkpoint` becomes the named anchor); otherwise the framing falls back to the bare seq. If you change the label-event shape, update `buildReviewContent` too - silent fallback to the bare seq is honest but loses operator context.
833
842
  - **Spawn cutoff is honored in fresh-summarizer + Native original-worker, IGNORED in CLI original-worker.** `cutoffEventSeq` filters the rendered transcript and stops Native pre-warm replay at the cutoff; CLI `--resume` carries the parent's full session and there's no clean way to retroactively trim its view. The dialog tells the operator to choose fresh-summarizer when a hard cutoff matters; don't try to enforce the cutoff CLI-side without rebuilding the resume mechanism.
@@ -876,6 +885,7 @@ Load-bearing invariants - relaxing any one re-opens the §1 trust boundary:
876
885
  The live Arco *service* reporting workflows + applying reply/stop/continue. `server/src/management/{hubLink,initHubLink,identity}.ts` + the hub's service socket. Invariants:
877
886
 
878
887
  - **INERT unless `ARCO_HUB_URL` is set.** `initHubLink` returns immediately with no env - an ordinary `npm run dev` / production boot must stay byte-unchanged. Never make the hub link connect by default.
888
+ - **A home in the temporary folder never joins the hub.** Every hub user reads the URL through `hubUrlForServer()` in `server/src/management/hubGuard.ts`, never from `process.env` directly. When the Arco home resolves inside `os.tmpdir()` (both through `realpath`), the URL is withheld and one log line names `ARCO_ALLOW_TEMP_HOME=1` (the older `ARCO_HUB_ALLOW_TEMP_HOME=1` still works). A server started for a check with a temporary home therefore stays off the hub even when the shell sets `ARCO_HUB_URL`; still start such servers with a cleared environment.
879
889
  - **Two connections, one card.** The agent (lifecycle, role `agent`) and the service (workflows, role `service`) both register under the SAME `instanceId` (shared `~/.arco/instance-id`). The hub keeps `agentSockets` + `serviceSockets` separately but ONE registry entry. Lifecycle commands route to the agent socket; workflow actions to the service socket. Don't collapse the two socket maps.
880
890
  - **The local instance re-validates - the hub only routes.** `initHubLink.applyAction` looks up the live workflow and checks state (stop requires `busy`; reply requires non-empty body) BEFORE applying. The hub's `routeWorkflowAction` never decides validity. Keep validity logic server-side.
881
891
  - **Apply via the existing turn primitives, synthetic ws+session.** stop → `handleCancel`; reply/continue → `handleUserMessage` with a `readyState: CLOSED` fake ws + a synthetic `Session` (mirrors the cluster auto-turn dispatch in `clusterAutoTurn.ts` - persistence runs, socket writes skip, events land in the workflow's events.jsonl). Don't invent a parallel turn path.
@@ -894,6 +904,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
894
904
  - **The SSH path is NOT Ed25519-signed - that's intentional.** The agent path is signed because the agent verifies; over SSH there's no agent, so the **tailnet + ACLs are the auth** and `nonce:'ssh'` is a sentinel (it correlates nothing). Don't try to sign the SSH path or route it through `pending`.
895
905
  - **Same allowlist template, wrapped - never a shell string.** `renderSshLifecycle` calls the SAME `renderLifecycleCommand` and passes the remote argv after `ssh … -- `, so there's no interpolation surface. It returns `null` for an off-platform/off-allowlist command (e.g. `arco-agent.restart` on macOS) and the hub reports `instance-offline` rather than running anything. Don't build the remote command as a string.
896
906
  - **Targets are operator-supplied, never discovered, never committed.** `~/.arco/hub/ssh-targets.json` keyed by instanceId OR friendly name (`sshTargetFor` tries id then name). `parseSshTargets` drops malformed entries / bad platforms / non-JSON → empty map (no SSH fallback). The file holds host/user identity → keep it out of git.
907
+ - **A macOS SSH target needs `uid`.** launchctl addresses `gui/<uid>/<label>` and the hub cannot learn the remote user id, so without `uid` every macOS command renders `null` and the hub reports `instance-offline` instead of addressing another user's domain. The label defaults to the packaged `arco-workbench`; set `macLabel` for a hand-maintained job.
897
908
  - **`systemctl --user` over SSH needs the owning user session.** Connect as the account that owns the Arco user units, not root, so `systemctl --user` reaches that account's bus. An active session or `enable-linger` must keep the user manager available; root would target the system manager instead.
898
909
 
899
910
  ## ntfy external transport
@@ -901,6 +912,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
901
912
  `server/src/ntfyTransport.ts` + the `registerNoticeTransport` seam on `server/src/notifications.ts`. Invariants:
902
913
 
903
914
  - **INERT unless `ARCO_NTFY_URL` is set.** `initNtfyTransport` returns `false` and registers nothing with no env - an ordinary `npm run dev` must stay byte-unchanged (same gating contract as `initHubLink`). Never push by default.
915
+ - **A home in the temporary folder ignores inherited ntfy settings.** `initNtfyTransport` and `resolvePhoneTarget` in `attention.ts` ask `environmentNtfyAllowed()` in `server/src/management/hubGuard.ts` before using `ARCO_NTFY_URL`; anything new that sends to ntfy from environment settings must ask it too. A phone address saved in Settings is not inherited and is never held back. `ARCO_ALLOW_TEMP_HOME=1` is the override.
904
916
  - **Mute is enforced UPSTREAM - never re-check it in the transport.** `emit()` returns `null` for a muted category *before* the transport fan-out, so a transport only ever sees surviving notices. This is the load-bearing single-chokepoint promise: muting an in-app category suppresses the push for free. Don't add mute logic to `ntfyTransport.ts`.
905
917
  - **Transports are fire-and-forget; they can never break the in-app path.** `emit()` calls each transport in a try/catch (sync throws caught) and swallows async rejections (`.catch(()=>{})`). A slow/down ntfy must not delay or fail the `workbench_notice` broadcast. Don't `await` transports inside `emit()`.
906
918
  - **ntfy header values are ascii-safe + single-line.** `headerSafe()` transliterates em/en-dashes + smart quotes to ASCII, strips remaining non-ascii, collapses whitespace, caps 200 chars - because ntfy `Title`/etc. are latin-1 HTTP headers and a unicode title (Arco uses em-dashes liberally) would otherwise break the request. The body (POST payload, not a header) keeps unicode. Don't pass raw titles as headers.
@@ -936,9 +948,8 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
936
948
  ## Preview tab
937
949
 
938
950
  - **Stale `vite.config.js` shadows `vite.config.ts`.** Vite resolves `.js` before `.ts`. A stray `tsc` run that compiles `client/vite.config.ts` to `vite.config.js` (and `.d.ts`/`.js.map`) means every subsequent edit to the `.ts` is silently ignored - Vite loads the frozen `.js`. The three artifacts are gitignored but easy to forget. Symptom: Vite changes don't take effect even after restart; `npx vite --debug config` shows the old shape. If you see this, delete `client/vite.config.{js,js.map,d.ts}`. The repo's typecheck script must use `tsc --noEmit`; don't introduce a build step that emits next to the source.
939
- - **Vite's bypass needs the bless map for transitive imports.** When `/src/main.ts` imports `/src/render/foo.ts`, the browser's Referer for the sub-import is `http://localhost:5173/src/main.ts` - NOT the iframe URL. A naive Referer regex (`/api/preview/<wfid>/`) misses the entire transitive import graph and they fall through to Arco's own Vite, which 404s as text/html → empty MIME → blocked module. Fix: every URL the bypass proxies gets blessed (path → wfid, 60 s TTL); subsequent requests whose Referer points at a blessed path also resolve. Bless by **pathname only** - Vite's pre-bundled deps include `?v=hash` query strings but the lookup uses `URL(ref).pathname`. Don't store `path?query` as the bless key.
940
- - **The bypass rewrites `req.url` to include the explicit `/api/preview/<wfid>/` prefix.** Once a request is identified as preview-bound, it's forwarded with the rewritten URL so the server's `PREFIX_RE` matcher catches it without needing Referer. The browser still sees the response on its original request, so its module URL stays `/src/main.ts` - keeping the import graph consistent.
941
- - **Preview proxy responses set `cache-control: no-store` + `connection: close` + drop the upstream `etag`.** Earlier symptoms were "iframe stays white after restart": Firefox had cached previous empty-MIME failures (when the proxy or port wasn't ready) under the canonical URL, then Etag-revalidated to 304 against Vite's index.html and kept the bad cached body. `no-store` prevents future caching, dropping etag prevents revalidation reuse, `connection: close` prevents response-boundary misalignment on parallel keep-alive fetches through the double-proxy chain (5173 → 3001 → 5181). All three together. If you remove any, expect a regression. The proxy also strips RFC 7230 hop-by-hop headers (`connection`, `keep-alive`, `transfer-encoding`, `upgrade`, `proxy-*`, `te`, `trailer`) in both directions - forwarding them confuses HTTP parsers.
951
+ - **Preview content must stay on separate listeners.** No prefix proxy or Referer fallback runs on Arco's control address or its Vite frontend. HTTP assets and HMR use the allocated preview address. Arco cookies and Authorization never reach the app. Cross-port cookie sharing requires explicit Origin and fetch-site checks between previews.
952
+ - **Preview ports are leased by mounted views.** Keep asynchronous acquisition and release scoped to the original workflow. Multiple observers share one listener; closing one must preserve the others. Refuse service workers so a reused port cannot retain the previous app's worker.
942
953
  - **Iframe is given a fixed logical viewport (width 1920, height per operator-selected aspect ratio: 1440 / 1200 / 1080 for 4:3 / 16:10 / 16:9), CSS-scaled to the largest fitting box-of-that-ratio.** Don't change the iframe to `width: 100%; height: 100%`; the dev server inside renders to its viewport size and most apps assume a desktop-class width. The fixed logical size + scale is what gives "no clipping at any pane size." `ResizeObserver` on the wrapper recomputes scale on every pane resize AND on aspect change. Aspect choice persists to localStorage `arco.preview.aspect` (global, not per-workflow). Width was originally 1280 - bumped to 1920 on 2026-04-28 because real desktop apps overflowed at 1280. Frame is centered in the pane both axes (`alignItems: center`); top-aligning leaves a tall black band below short content.
943
954
  - **`previewAutoDetect` never overrides `manual: true`.** When the operator types a port and hits BIND, the binding is sticky - Layer 1 / Layer 2 detection still runs (in case the agent later spins up a fresh server) but cannot replace a manual entry. Don't unify the paths; the operator's choice always wins.
944
955
  - **`freshlyBound: true` only on real binds, not hydration replay.** The auto-flip-to-PREVIEW UX hinges on this flag: replays stamp `false`. If you ever broadcast `preview_set` from a path that isn't a fresh operator/auto bind (e.g. a periodic refresh), set `freshlyBound: false` or the user gets yanked into the preview tab on every server restart.
@@ -957,8 +968,9 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
957
968
 
958
969
  ## Efficiency behavior
959
970
 
960
- - **Hook stdout parser is tolerant - never throws.** `parseHookOutput` (`server/src/providers/claude-native/hooks.ts`) treats non-JSON, malformed JSON, and non-object top-levels as `{}`. A hook that prints log lines to stdout is safe; only well-formed JSON whose top level is an object yields recognized fields. Don't wrap the parser in try/catch in callers - that's the contract; surface-area regressions break rtk integration.
961
- - **`hook_rewrote_input` must fire on every PreToolUse rewrite.** Without the event, transcript review can't tell why a tool input differs from what the model emitted - looks like a model hallucination of the input. The chain is: `parseHookOutput(stdout).hookSpecificOutput.updatedInput` non-empty → `workflowEventBroadcast({type: 'hook_rewrote_input', ...})` → `broadcastWorkflow` → `events.jsonl`. If you add a new rewrite-capable surface (e.g. PostToolUse input rewrites in a future revision), emit the same event.
971
+ - **Hook results are read in one place.** `evaluateHooks()` (`server/src/providers/claude-native/hooks.ts`) turns exit codes and stdout into a verdict as Claude Code's hooks reference describes; callers act on the verdict and never read `exitCode` or stdout themselves. Stdout that is not one JSON object is plain text, never an exception: a hook that prints log lines is safe. Exit 1 is a non-blocking error on every event; only exit 2, a JSON blocking decision or an `onFailure` failure blocks. A handler's `if` rule is checked in `fireHooks()` before it starts (`hookIf.ts`, best-effort like Claude Code's: a command it cannot take apart runs the hook).
972
+ - **The shell tool has two names.** On Windows without Git Bash the model's shell tool is `PowerShell`, elsewhere `Bash`. Any check, card or summary that special-cases the shell tool uses `isShellToolName()` from `@arco/shared`, never `=== 'Bash'`, or the PowerShell tool slips past it.
973
+ - **`hook_rewrote_input` must fire on every PreToolUse rewrite.** Without the event, transcript review can't tell why a tool input differs from what the model emitted - looks like a model hallucination of the input. The chain is: `evaluateHooks(...).rewrites` non-empty → `workflowEventBroadcast({type: 'hook_rewrote_input', ...})` → `broadcastWorkflow` → `events.jsonl`. If you add a new rewrite-capable surface (e.g. PostToolUse input rewrites in a future revision), emit the same event.
962
974
  - **Last-write-wins across multiple hooks for `updatedInput`.** `{ ...input, ...updatedInput }` is applied in hook iteration order; each rewrite emits its own `hook_rewrote_input` event so the operator can see the chain. Matches Claude Code's documented behavior - don't switch to first-write-wins or deep-merge.
963
975
  - **`config-protection` matches by basename, not regex on the full path.** `checkConfigProtection` (`pretoolGuards.ts`) resolves the input path against `cwd` then matches `basename()` against `PROTECTED_BASENAMES` plus a small regex set for `tsconfig.*.json`. A nested package's `tsconfig.json` is just as protected as the root's. Don't over-broaden the patterns (regression risk: blocking a source file named `eslint.config.ts` in user code). Don't use absolute-path globs unless we're explicitly carving out an exception path - they hide where the gate fires.
964
976
  - **`config-protection` is per-tab relaxable via `efficiencyConfigProtection` - default ON, opt-out is explicit.** The gate now reads `(this.config.efficiencyConfigProtection ?? 'on') === 'on'` in `worker.ts:dispatchTool` before calling `checkConfigProtection`. Absent field ⇒ gate ON (safety default), so a missing value never silently disables it; only an operator flip to `'off'` (CONFIG-tab → CONFIG-PROTECTION GATE, Native-only) relaxes it. Wired exactly like `efficiencyFactForce` (protocol → meta.json → updatePrimaryConfig live-set + rehydrate restore → turnEngine per-turn resolve → seedWorker/WorkerManager) **except** there is NO new-tab default stamp: fact-force explicitly stamps `'off'` for new tabs so the workflow-created echo and saved metadata agree, while config-protection's `?? 'on'` fallback means its default is uniform and needs no stamping. Don't add a config-protection stamp - it would make an absent field and an explicit `'on'` indistinguishable on disk for no behavior gain. The gate is Native-only because `checkConfigProtection` only runs in the in-process Native `dispatchTool` (same protocol limit as fact-force - see the Codex note below); `turnEngine` hard-zeros non-Native transports to `'off'` so the flag is never a meaningless no-op flag on a CLI/Codex tab.
@@ -982,9 +994,9 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
982
994
  - **Fact-force defaults OFF (2026-09-02).** It is a cognitive nudge, not a verifier: the synthetic failed tool result makes the model recite importers, API surface, and the operator instruction, but Arco does not check whether those statements are true. The per-file failure, prose and retry add content to the transcript and append-only context. New workflows explicitly stamp `'off'`; absent values also resolve off; a saved or newly supplied explicit `'on'` remains honored. Keep it available as a per-tab CONFIG opt-in, but do not restore a default-on path without measured operator evidence.
983
995
  - **Pre-tool-use guard order is load-bearing: config-protection first, fact-force second.** Two reasons: (1) config-protection is a cheap path-shape check (no state), so running it first short-circuits without touching the fact-force state. (2) If both rules fire on the same path (e.g. operator armed fact-force AND the model edits `tsconfig.json`), the operator gets the more specific config-protection message - "fix your code instead of weakening the config" beats "list importers and re-issue." Don't reverse the order; the model's re-issued edit after fact-force would then bounce off config-protection on the second pass, which is twice the synthetic-result churn.
984
996
  - **Fact-force is Native-only at first ship - CLI parity is F4 deferred.** The gate lives inside `claude-native/dispatchTool`, which only runs on the Native transport. CLI Claude reaches the same surface via the `.arco/<wfid>/hooks.json` shim when this parity path is enabled. Don't add a CLI codepath inside `pretoolGuards.ts`; the canonical site for CLI parity is the hooks shim, not the gate function. If operator data shows CLI tabs need it before F4 ships, prefer the shim over a parallel implementation - the gate semantics MUST match Native exactly or transcript review on cross-transport sessions will be confusing.
985
- - **Fact-force (and most other Native-only efficiency knobs) being absent for Codex is a protocol limit, not an oversight - don't "port" it.** The Native gate works because tool dispatch is synchronous and in-process: Arco returns a synthetic `tool_result` *before* the edit lands. Codex gives no equivalent pre-execution gate - `exec` only surfaces tool calls in the final aggregated output (no mid-turn hook at all), and `appserver` *has* approval bindings (`FileChangeRequestApprovalParams`, `CommandExecutionRequestApprovalParams`) but they're dropped in `onNotification`'s `default` case and there is **no approval-response RPC path** wired to send a denial back. Wiring it is ~500 LOC against an undocumented approval-response shape (needs a live Codex harness to pin down) and would bolt a pre-execution gate onto Codex's async-after-completion event model. Same root reason server-side compaction, interleaved-thinking beta, tool-result filter, and sandbox tools can't exist for Codex today: they all mutate the in-process Anthropic request (body / beta headers / `tools[]` / system blocks), which an external subprocess doesn't expose. Output style is the narrow exception for Codex app-server because Arco owns the stable per-turn input prefix there. If fact-force on Codex ever becomes worth it, it's a standalone initiative starting from the approval protocol, not a parity shim. (The F4 hooks shim above is for **Claude CLI**, which Codex does not read.)
997
+ - **Fact-force (and most other Native-only efficiency knobs) being absent for Codex is a protocol limit, not an oversight - don't "port" it.** The Native gate works because tool dispatch is synchronous and in-process: Arco returns a synthetic `tool_result` *before* the edit lands. Codex gives no equivalent pre-execution gate - `exec` only surfaces tool calls in the final aggregated output (no mid-turn hook at all), and `appserver` *has* approval bindings (`FileChangeRequestApprovalParams`, `CommandExecutionRequestApprovalParams`) but they're dropped in `onNotification`'s `default` case and there is **no approval-response RPC path** wired to send a denial back. Wiring it is ~500 LOC against an undocumented approval-response shape (needs a live Codex harness to pin down) and would bolt a pre-execution gate onto Codex's async-after-completion event model. Same root reason server-side compaction, interleaved-thinking beta, tool-result filter, and sandbox tools can't exist for Codex today: they all mutate the in-process Anthropic request (body / beta headers / `tools[]` / system blocks), which an external subprocess doesn't expose. Output style is the narrow exception for Codex because Arco owns the stable prompt prefix on both transports. If fact-force on Codex ever becomes worth it, it's a standalone initiative starting from the approval protocol, not a parity shim. (The F4 hooks shim above is for **Claude CLI**, which Codex does not read.)
986
998
  - **`ctx_action` sentinels must be emitted from every code path that mutates `messages[]` in a way the operator should see during transcript review.** Today's emit sites (`worker.ts`): `prune_orphan_tool_use` (trigger: recovery) on the orphan-drop at the top of `runTurn`, and `compact` (trigger: auto-threshold) inside `maybeEmitAutoThreshold`. Normal turn-flow pushes (operator message, assistant message, tool_results, drainSteer items) do NOT emit ctx_action - they're additions, not reshapes. `seedMessages` (Spawn-from-here init), `replayMessagesFromEvents` (rehydrate), and `dispose` (tear-down) are lifecycle paths that also don't emit. Server-side `compact_20260112` mutates Anthropic's prompt prefix, not our local `messages[]`, so it doesn't emit ctx_action from Arco either - it rides as a per-turn body field, not an event. Same rule applies if `clear_thinking` / `clear_tool_uses` ever return behind an explicit operator action. Forgetting the sentinel on a NEW path that does mutate local `messages[]` (e.g. a future "cancel-the-last-turn-and-reissue" surface) breaks transcript review silently; the operator sees turn N+1 without knowing turn N was rewound.
987
- - **`primary_tool_counter` is the worker-authoritative chip signal - don't recount from events.** shipped the chip reading `JobState.toolCallsSinceHandoff` (a client-side recount of `primary_tool_use` events). The worker counter adds `JobState.toolCallsSinceCompact` mirrored from the worker's `toolCallCountSinceCompact`. The chip prefers the worker mirror; the recount stays as the audit fallback for non-Native tabs and for the first paint before the worker emits. Worker rebuild after `handoff_complete` is the implicit reset (the new worker starts at counter=0); the client also eagerly zeroes the mirror on `handoff_complete` to avoid a stale paint between the handoff and the first post-handoff tool dispatch. Auto-threshold compact firing inside `maybeEmitAutoThreshold` emits a follow-up counter=0 event after the reset; without it, the chip would stay at `n` until the next tool dispatch.
999
+ - **`primary_tool_counter` is worker-authoritative.** `JobState.toolCallsSinceCompact` mirrors the worker counter. Worker rebuild and auto-threshold compaction reset it; the separate client recount remains available.
988
1000
  - **The per-tab sandbox database MUST be cleared on tab close (`remove_workflow`) or the operator's explicit Clear-DB click.** `destroySandbox(cwd, wfId)` closes the cached `better-sqlite3` handle and unlinks `sandbox.db` + `sandbox.db-wal` + `sandbox.db-shm`. Skipping the tear-down on tab close would leak per-tab state across workflows that share a cwd - defeating the per-tab opt-in contract. The teardown path is in `handleRemoveWorkflow` (`server/src/index.ts`) and the operator clear hits `POST /api/workflows/:wfId/sandbox/clear`. Both fire WS events (`sandbox_db_cleared`) so transcript review can see the truncation. If a future code path adds another lifecycle endpoint that should also clear (e.g. a hypothetical "reset workflow"), call `destroySandbox` from there too.
989
1001
  - **Sandbox subprocess executor MUST kill the process group on timeout, not just the immediate child.** `sandboxExecutor.ts` spawns with `detached: true` so the child becomes the process-group leader, and the timeout path calls `process.kill(-child.pid, 'SIGTERM')` (negative PID - the kernel interprets that as the process group) with a 1 s SIGKILL escalation. A python script that forks workers or a shell script that `&`-launches background jobs would leak grandchildren past a naive `child.kill('SIGTERM')`. Don't refactor to the simpler form - the test that surfaced this on context-mode's PolyglotExecutor (the inspiration) was a `python -c "import multiprocessing; multiprocessing.Pool(4).map(time.sleep, [60]*4)"` script that leaked 4 sleepers per call.
990
1002
  - **`node:sqlite` (Node 22+ builtin) has NO FTS5 module - the sandbox uses `better-sqlite3` instead.** The plan brief listed `node:sqlite` as a fallback option; in practice Node 22.14.0's bundled SQLite is compiled without FTS5 so `CREATE VIRTUAL TABLE … USING fts5(…)` returns `Error: no such module: fts5`. Don't switch back to `node:sqlite` without verifying FTS5 availability on the target Node version. The `SandboxStore` class encapsulates the choice; if a future Node release lights up FTS5 (or someone wants a loadable-extension build), swapping is a single-file refactor.
@@ -997,6 +1009,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
997
1009
 
998
1010
  - **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.
999
1011
  - **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.
1012
+ - **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.
1000
1013
  - **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.
1001
1014
  - **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.
1002
1015
 
@@ -1055,7 +1068,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1055
1068
  - **`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`.
1056
1069
  - **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.
1057
1070
  - **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`.
1058
- - **Stage K orchestration assist is proposal-only until explicit accept.** Assist requests may draft task graphs, assignments, swarm layouts, recovery actions, synthesis comments, and provider/model/effort suggestions, but they must not mutate task state, dispatcher settings, member config, or worktrees by themselves. Reject is audit-only. Accept selected items by calling the normal task-kernel mutation path so ordinary `task_ledger_event` rows are emitted; provider/model/effort suggestions stay inert unless their own selected items are accepted. Smoke target: `scripts/smoke/task-orchestration-assist.ts`.
1071
+ - **Stage K orchestration assist is proposal-only until explicit accept.** Assist requests may carry supplied task, assignment, recovery, synthesis, swarm, and provider suggestions; they do not invoke a model, but they must not mutate task state, dispatcher settings, member config, or worktrees by themselves. Reject is audit-only. Accept selected items by calling the normal task-kernel mutation path so ordinary `task_ledger_event` rows are emitted; provider/model/effort suggestions stay inert unless their own selected items are accepted. Smoke target: `scripts/smoke/task-orchestration-assist.ts`.
1059
1072
 
1060
1073
  ### Board interaction overhaul
1061
1074
 
@@ -1065,7 +1078,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1065
1078
  - **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.
1066
1079
  - **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.
1067
1080
  - **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.
1068
- - **The automation header (DISPATCH / SWARM / ASSIST / DISPATCHER) is collapsed by default behind `▸ AUTOMATION`.** `automationOpen` defaults `false`; the task count + toggle stay visible. The `assistOpen` panel is now gated on `automationOpen && assistOpen`. This is a UX de-emphasis only - the controls and their fences are unchanged. Don't default it open "for discoverability"; the whole point is the board reads "groom tasks," not "run a swarm."
1081
+ - **The automation header is collapsed by default.** It contains dispatcher and swarm controls. DRAFT ASSIST is hidden in this version.
1069
1082
 
1070
1083
  ### Director sign-off + per-card actions
1071
1084
 
@@ -1149,7 +1162,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1149
1162
  - **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`.
1150
1163
  - **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.
1151
1164
  - **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.
1152
- - **`SpawnDialog` / `TabContextMenu` / `ClusterRightPanel` candidate filters now accept `provider === 'codex'` alongside `'claude'`.** 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.
1165
+ - **`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.
1153
1166
 
1154
1167
  ### gotchas (Polish - rehydrate · detach · activity · idle nudger)
1155
1168
 
@@ -1206,7 +1219,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1206
1219
  - **A cluster tab is only a browser mirror; the live record is server-durable.** A lost localStorage entry must be recovered by listing `GET /api/clusters` and sending the normal `cluster_subscribe` for the original id - never by restoring an older snapshot (which forks new ids). Conversely, a genuinely missing id returns structured `cluster_not_found`; the client prunes that one stale mirror so it cannot emit "Unknown cluster" forever.
1207
1220
  - **Restore replay MUST stay compacted - never replay raw streaming granularity.** `restoreSnapshot` pipes each member's captured `events.jsonl` through `truncateToLastNTurns` then `compactRestoredEvents` (`server/src/clusterSnapshots.ts`) before writing the target-cwd copy the WS handler replays. A live turn records token-ish `primary_text` deltas (the large majority of a raw log), started/completed `primary_tool_use` pairs, and per-call `primary_tool_counter` / per-file `diagnostics` state events. Replaying that raw flooded the client one WS message + one store update at a time: the tab stalled for minutes, missed heartbeats, and reconnect-looped under the SYNCING overlay (`snapshotReceived` never settling). Compaction merges adjacent same-phase text runs (the client coalesces replayed text into one bubble anyway), drops transient tool-status rows whose call settles later in the log, and keeps only the last counter / last diagnostics-per-file (both client handlers are last-write-wins). Verify size limits with synthetic fixtures. Do NOT "restore full fidelity" - delta boundaries are invisible once the turn is history.
1208
1221
  - **Codex call identity is `itemId`, not `toolUseId`.** Codex mints a fresh `toolUseId` per status event (started and completed carry different ones); only `itemId` (`call_…`) is stable across a call's lifecycle. `compactRestoredEvents` keys settled-call detection on `itemId ?? toolUseId`. Keying on `toolUseId` alone silently stops compacting Codex members (the 2026-06-12 first-pass bug).
1209
- - **Snapshot-shaped event types are latest-wins in compaction - `task_ledger_snapshot` especially.** Each one is a FULL copy of the cwd's task ledger and a busy cluster re-broadcasts it on every mutation: a large workflow can carry many of them, dominating the total size. Text-delta coalescing alone left that untouched (UI froze per batch, WS backpressure stalled the socket, the server's zombie-socket heartbeat terminated the client mid-delivery, reconnect into a half-ingested cluster). Compaction now also: keeps only the last `task_ledger_snapshot` per workflowId (rule 5), truncates `primary_tool_use` input/output at 16 KB (rule 6 - the client's display cap; Native provider-context replay skips tool events so the model loses nothing), and keeps only the newest 300 tool rows per workflowId (rule 7 - the client trims chat at 500 messages / activity at 500 entries, so older rows were ingested and immediately discarded). Restore compacts text deltas, transient status rows, and superseded state snapshots before replay. If you add a new broadcast type that re-sends whole-state snapshots into `events.jsonl`, add it to the latest-wins set here.
1222
+ - **Snapshot-shaped event types are latest-wins in compaction - `task_ledger_snapshot` especially.** Each one is a FULL copy of the cwd's task ledger and a busy cluster re-broadcasts it on every mutation: a large workflow can carry many of them, dominating the total size. Text-delta coalescing alone left that untouched (UI froze per batch, WS backpressure stalled the socket, the server's zombie-socket heartbeat terminated the client mid-delivery, reconnect into a half-ingested cluster). Compaction now also: keeps only the last `task_ledger_snapshot` per workflowId (rule 5), truncates `primary_tool_use` input/output at 16 KB (rule 6 - the client's display cap; Native provider-context replay skips tool events so the model loses nothing), and keeps only the newest 300 tool rows per workflowId (rule 7 - the client trims chat at 500 messages / activity at 500 entries, so older rows were ingested and immediately discarded). Restore compacts text deltas, transient status rows, and superseded state snapshots before replay. If you add a new broadcast type that re-sends whole-state snapshots into `events.jsonl`, add it to the latest-wins set here. Better: do not persist it at all. Since 0.1.4 `task_ledger_snapshot` goes out through `sendWorkflowLive` and never reaches the log; rule 5 only matters for older logs.
1210
1223
  - **The client persist layer must stringify LAZILY - never per `set()`.** `client/src/stores/persistence.ts` (`debouncedJSONStorage`) holds the partialized state object and JSON.stringifies once per debounced flush. Wrapping `createJSONStorage(...)` instead serializes the entire multi-MB jobs slice on EVERY store update - the debounce only delayed the disk write, not the serialization - which is what compounded a replay_batch ingest (thousands of `set()` calls in one task) into a minutes-long main-thread freeze. The freeze is what stops the browser draining the socket and gets the client heartbeat-terminated. Quota overflows at flush are logged (`persist flush failed`), not silent.
1211
1224
  - **`cluster_created` is sent BEFORE any member history streams.** The restore handler (`handleClusterSnapshotRestore` in `server/src/ws/clusterHandlers.ts`) registers all members, sends `cluster_created`, and only then sends per-member `workflow_created` + event replay. Members-first ordering left the restored workers rendering as standalone tabs for the whole replay window (and permanently, if the operator closed the tab mid-flood). The cluster must exist client-side before any member does.
1212
1225
  - **Each member's history is delivered as ONE `replay_batch` message - never a stream of N live events.** The client persists `lastSeq` + the last 200 chat messages on a debounce and reconnect asks for "events since lastSeq". Streaming history as live events races that model: an interrupt mid-flood (reload, heartbeat-miss disconnect) persisted `lastSeq≈head` with no chat, and replay-since-seq then had nothing left to resend - the member rendered as a **permanently blank worker** (2026-06-12). The batch is ingested by the client in one synchronous task (`case 'replay_batch'` in `handleServerMessage.ts` re-dispatches each inner event through the same reducer), so run-to-completion makes it all-or-nothing, React batches one render, and the debounced persist fires once. Do NOT revert to per-event `ws.send` loops for restore delivery. The reconnect path got the same treatment: `rehydrateOneWorkflow` (`handoffHandlers.ts`) ships a gap larger than 200 events as one `replay_batch` too (small gaps keep the per-event path), so a client that disconnects mid-restore can't be re-flooded by its own catch-up replay.
@@ -1221,7 +1234,7 @@ The live Arco *service* reporting workflows + applying reply/stop/continue. `ser
1221
1234
  - **The server's `workflows` map does NOT register cluster members on boot - it fills lazily from client `rehydrate_workflows`.** So `workflows.get(memberWfid)` returns `undefined` after a restart for any member no connected client rehydrated. The first-pass fix (a `cluster_member_rehydrate` message that only sent `workflow_created` for a member already in `workflows`) therefore bailed silently on exactly the stuck case. The shipped handler (`handleClusterMemberRehydrate`) now reconstructs the member's `WorkflowConfig` from its persisted `meta.json` (config is stored field-by-field there - `primaryProvider`/`primaryModel`/`primaryEffort`/`cwd`/`name`/`providerAccountRef`/`efficiencyToolFilter` - NOT under a `config` key; `skipPermissions` defaults `true`) and registers the `WorkflowState` (WorkerManager + `derivePrimaryConfig` + `deriveAutoHandoff` + restored `cliSessions` primarySessionId) before sending `workflow_created` + `rehydrateOneWorkflow(…, 0)`. Per-branch `console.log` on every early return - the silent bail cost a debug round-trip; keep the logging.
1222
1235
  - **The client request is deduped by `workflowId` and cleared ONLY on `workflow_created` (`requestedMemberRehydrate` in `handleServerMessage.ts`).** A failed attempt (server bailed, no `workflow_created`) leaves the guard set, so a plain WS auto-reconnect won't retry - a **page reload** is required to reset the module-level Set. This is why the recovery needs a hard refresh after a fix-deploy, not just a reconnect. If you make this retry on reconnect, clear the guard on a timeout or on `cluster_state` instead.
1223
1236
  - **Eager boot-time member registration is now the primary fix (2026-07-10 followup).** `registerAllClusterMembersOnBoot` (`handoffHandlers.ts`, fired failure-isolated in the `index.ts` listen() epilogue alongside the recall backfill) walks `clusterStore.loadAllClustersFromDisk()` and registers every member's `WorkflowState` from `meta.json` so the `workflows` map never drifts across a restart - no more lazy-fill gap. It also warms `clusterStore`'s `memberIndex` (via `readCluster` per cluster) so a member's first post-restart turn resolves its `clusterId` for peer-tool wiring. `cluster_member_rehydrate` stays as the client-driven job-materialization channel (boot registration makes the server side complete; the client still needs `workflow_created` to build its job) AND the dynamic-add path (a member added mid-session that this browser has no job for).
1224
- - **Config reconstruction lives in ONE mapper - `workflowConfigFromMeta` (`workflowMeta.ts`).** Shared by the boot path and the on-demand handler (via `materializeMemberFromMeta`) so they can't drift. It carries EVERY turn-relevant persisted field, NOT just provider/model/effort - dropping `claudeTransport`/`codexTransport` alone silently runs a Native member on CLI / an appserver Codex member on exec (the latent bug the first pass shipped). Falsy-but-valid values must use type checks, not truthiness: `webSearchMaxUses: 0` (`typeof === 'number'`), `claudeNativeCompact: false` (`!== undefined`), efficiency `'off'` (truthy string). `caveman` outputStyle is aliased to `terse` in the mapper (the config type dropped the legacy value).
1237
+ - **Config reconstruction lives in ONE mapper - `workflowConfigFromMeta` (`workflowMeta.ts`).** Shared by the boot path and the on-demand handler (via `materializeMemberFromMeta`) so they can't drift. It carries EVERY turn-relevant persisted field, NOT just provider/model/effort - dropping `claudeTransport`/`codexTransport` alone silently runs a Native member on CLI / an appserver Codex member on exec (the latent bug the first pass shipped). Falsy-but-valid values must use type checks, not truthiness: `webSearchMaxUses: 0` (`typeof === 'number'`), `claudeNativeCompact: false` (`!== undefined`), efficiency `'off'` (truthy string). Legacy outputStyle values are aliased in the mapper (`lite` to `plain`, `caveman` to `terse`; `normalizeOutputStyle`).
1225
1238
  - **`meta.json` cannot carry client-only config fields - `advanced` (fallbackModel / additionalDirectories), `fastMode`, `allowedProviders`, `skipPermissions`.** A boot/on-demand materialization forces `skipPermissions: true` (the cluster-member default) and resets the rest. Two load-bearing consequences: (1) a member materialized from meta is marked `wf.bootMaterialized = true`, and the `existing` branch of `handleRehydrateWorkflows` REPLACES that placeholder config with the client's full one + re-derives `primary` when the client reconnects (`!busy` guarded) - this is what restores a SAFE-mode member's `skipPermissions: false` and a `fallbackModel`. Without it, boot registration wins the race against the client reconnect and the client's authoritative config is silently discarded. (2) A **boot-only member** (no client ever reconnects with its config - e.g. an armed dispatcher fires a turn on a browserless member) still runs with `skipPermissions: true`; the durable fix is to persist `skipPermissions`/`advanced` into `WorkflowMeta` (deferred follow-up).
1226
1239
  - **`materializeMemberFromMeta` re-checks `workflows.get()` AFTER its `await readMeta` (TOCTOU).** The boot scan runs fire-and-forget concurrently with client reconnects; the top-of-function guard fires before the await, so a concurrent `rehydrate_workflows` could register the member in the window and the unconditional `workflows.set` would clobber it - dropping the client's observer (→ the exact frozen-pane symptom) and resetting an in-flight `WorkerManager` (→ defeated busy guard, double-turn). The post-await re-check closes it. Never remove it.
1227
1240
  - **Dynamic membership (frequent add/remove) is handled by the existing paths, not by this fix.** Every add/remove path (add-existing, spawn-join, fresh-workers, detach/remove) already registers/deregisters in the `workflows` map at the moment of the change AND pushes a fresh `cluster_state`, so `requestMissingMemberJobs` materializes a runtime-added member and a removed member drops from the roster. Boot registration + the on-demand message only close the RESTART gap; both key off the atomically-maintained `members[]`, so add/remove between restarts is reflected automatically. Known minor edges (follow-ups): a client job for a removed member lingers (no `workflow_removed`; `cluster_member_removed` is a client no-op), and the `requestedMemberRehydrate` dedup guard clears only on `workflow_created` (a genuinely-unreadable-meta member stays stuck for the session).
@@ -1739,3 +1752,4 @@ Smoke: `npm run smoke:bakeoff`.
1739
1752
  - [WebSocket protocol](PROTOCOL.md)
1740
1753
  - [Operations](OPERATIONS.md)
1741
1754
  - [Documentation style](STYLE.md)
1755
+