@turmind/halo 0.1.9

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 (296) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +143 -0
  3. package/admin-out/404.html +1 -0
  4. package/admin-out/_next/static/IBP_mwBDf-cPwZSZZGpi8/_buildManifest.js +1 -0
  5. package/admin-out/_next/static/IBP_mwBDf-cPwZSZZGpi8/_ssgManifest.js +1 -0
  6. package/admin-out/_next/static/chunks/1d2d5650-810a3ca1ae20cab5.js +18 -0
  7. package/admin-out/_next/static/chunks/200.3b8f8a74f005a134.js +1 -0
  8. package/admin-out/_next/static/chunks/220.3dc41cd6269b88e6.js +1 -0
  9. package/admin-out/_next/static/chunks/298-d6b224b569da4de0.js +1 -0
  10. package/admin-out/_next/static/chunks/304eda7d.b1ee7f523653e027.js +1 -0
  11. package/admin-out/_next/static/chunks/330.3b784cf0dcd69163.js +1 -0
  12. package/admin-out/_next/static/chunks/442.f4302087bddb1ec1.js +1 -0
  13. package/admin-out/_next/static/chunks/443.d1b289781793f8de.js +25 -0
  14. package/admin-out/_next/static/chunks/503-7c6d9935df6e0cea.js +1 -0
  15. package/admin-out/_next/static/chunks/533.5f2d4bfe3d076095.js +1 -0
  16. package/admin-out/_next/static/chunks/579.a2718ddd395a2f3a.js +1 -0
  17. package/admin-out/_next/static/chunks/635-3dd0043ed0520b9d.js +1 -0
  18. package/admin-out/_next/static/chunks/65.859665ba6717967a.js +1 -0
  19. package/admin-out/_next/static/chunks/661.a4fe93f3f2a5e871.js +1 -0
  20. package/admin-out/_next/static/chunks/688.4e014ac6cfc7e152.js +1 -0
  21. package/admin-out/_next/static/chunks/868.0c95dfe283400a00.js +1 -0
  22. package/admin-out/_next/static/chunks/app/_not-found/page-8e35399c8fd5016d.js +1 -0
  23. package/admin-out/_next/static/chunks/app/layout-58f773336e6fce61.js +1 -0
  24. package/admin-out/_next/static/chunks/app/page-cc8043335282d745.js +1 -0
  25. package/admin-out/_next/static/chunks/db534642.09d3c650ff587175.js +1 -0
  26. package/admin-out/_next/static/chunks/fb4ec4d6-3fa44f69484f91b9.js +1 -0
  27. package/admin-out/_next/static/chunks/framework-c3031ae54a63fe16.js +1 -0
  28. package/admin-out/_next/static/chunks/main-14b48e3c2588354f.js +1 -0
  29. package/admin-out/_next/static/chunks/main-app-483b436873410ddc.js +1 -0
  30. package/admin-out/_next/static/chunks/pages/_app-b2fc6e5f920d1b1a.js +1 -0
  31. package/admin-out/_next/static/chunks/pages/_error-f3696a8f3d67d150.js +1 -0
  32. package/admin-out/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  33. package/admin-out/_next/static/chunks/webpack-8bd7ef88a6527feb.js +1 -0
  34. package/admin-out/_next/static/css/659eccb5db697b76.css +1 -0
  35. package/admin-out/_next/static/css/8fce4e1a54dac12a.css +3 -0
  36. package/admin-out/_next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
  37. package/admin-out/_next/static/media/21350d82a1f187e9-s.woff2 +0 -0
  38. package/admin-out/_next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
  39. package/admin-out/_next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
  40. package/admin-out/_next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
  41. package/admin-out/_next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
  42. package/admin-out/_next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
  43. package/admin-out/favicon.ico +0 -0
  44. package/admin-out/icon.svg +18 -0
  45. package/admin-out/index.html +1 -0
  46. package/admin-out/index.txt +23 -0
  47. package/admin-out/monaco/vs/_commonjsHelpers-CT9FvmAN.js +1 -0
  48. package/admin-out/monaco/vs/abap-D-t0cyap.js +1 -0
  49. package/admin-out/monaco/vs/apex-CcIm7xu6.js +1 -0
  50. package/admin-out/monaco/vs/assets/css.worker-HnVq6Ewq.js +93 -0
  51. package/admin-out/monaco/vs/assets/editor.worker-Be8ye1pW.js +26 -0
  52. package/admin-out/monaco/vs/assets/html.worker-B51mlPHg.js +470 -0
  53. package/admin-out/monaco/vs/assets/json.worker-DKiEKt88.js +58 -0
  54. package/admin-out/monaco/vs/assets/ts.worker-CMbG-7ft.js +67731 -0
  55. package/admin-out/monaco/vs/azcli-BA0tQDCg.js +1 -0
  56. package/admin-out/monaco/vs/basic-languages/monaco.contribution.js +1 -0
  57. package/admin-out/monaco/vs/bat-C397hTD6.js +1 -0
  58. package/admin-out/monaco/vs/bicep-DF5aW17k.js +2 -0
  59. package/admin-out/monaco/vs/cameligo-plsz8qhj.js +1 -0
  60. package/admin-out/monaco/vs/clojure-Y2auQMzK.js +1 -0
  61. package/admin-out/monaco/vs/coffee-Bu45yuWE.js +1 -0
  62. package/admin-out/monaco/vs/cpp-CkKPQIni.js +1 -0
  63. package/admin-out/monaco/vs/csharp-CX28MZyh.js +1 -0
  64. package/admin-out/monaco/vs/csp-D8uWnyxW.js +1 -0
  65. package/admin-out/monaco/vs/css-CaeNmE3S.js +3 -0
  66. package/admin-out/monaco/vs/cssMode-CjiAH6dQ.js +1 -0
  67. package/admin-out/monaco/vs/cypher-DVThT8BS.js +1 -0
  68. package/admin-out/monaco/vs/dart-CmGfCvrO.js +1 -0
  69. package/admin-out/monaco/vs/dockerfile-CZqqYdch.js +1 -0
  70. package/admin-out/monaco/vs/ecl-30fUercY.js +1 -0
  71. package/admin-out/monaco/vs/editor/editor.main.css +1 -0
  72. package/admin-out/monaco/vs/editor/editor.main.js +5 -0
  73. package/admin-out/monaco/vs/editor.api-CalNCsUg.js +903 -0
  74. package/admin-out/monaco/vs/elixir-xjPaIfzF.js +1 -0
  75. package/admin-out/monaco/vs/flow9-DqtmStfK.js +1 -0
  76. package/admin-out/monaco/vs/freemarker2-Cz_sV6Md.js +3 -0
  77. package/admin-out/monaco/vs/fsharp-BOMdg4U1.js +1 -0
  78. package/admin-out/monaco/vs/go-D_hbi-Jt.js +1 -0
  79. package/admin-out/monaco/vs/graphql-CKUU4kLG.js +1 -0
  80. package/admin-out/monaco/vs/handlebars-OwglfO-1.js +1 -0
  81. package/admin-out/monaco/vs/hcl-DTaboeZW.js +1 -0
  82. package/admin-out/monaco/vs/html-Pa1xEWsY.js +1 -0
  83. package/admin-out/monaco/vs/htmlMode-Bz67EXwp.js +1 -0
  84. package/admin-out/monaco/vs/ini-CsNwO04R.js +1 -0
  85. package/admin-out/monaco/vs/java-CI4ZMsH9.js +1 -0
  86. package/admin-out/monaco/vs/javascript-PczUCGdz.js +1 -0
  87. package/admin-out/monaco/vs/jsonMode-DULH5oaX.js +7 -0
  88. package/admin-out/monaco/vs/julia-BwzEvaQw.js +1 -0
  89. package/admin-out/monaco/vs/kotlin-IUYPiTV8.js +1 -0
  90. package/admin-out/monaco/vs/language/css/monaco.contribution.js +1 -0
  91. package/admin-out/monaco/vs/language/html/monaco.contribution.js +1 -0
  92. package/admin-out/monaco/vs/language/json/monaco.contribution.js +1 -0
  93. package/admin-out/monaco/vs/language/typescript/monaco.contribution.js +1 -0
  94. package/admin-out/monaco/vs/less-C0eDYdqa.js +2 -0
  95. package/admin-out/monaco/vs/lexon-iON-Kj97.js +1 -0
  96. package/admin-out/monaco/vs/liquid-DqKjdPGy.js +1 -0
  97. package/admin-out/monaco/vs/loader.js +1368 -0
  98. package/admin-out/monaco/vs/lspLanguageFeatures-kM9O9rjY.js +4 -0
  99. package/admin-out/monaco/vs/lua-DtygF91M.js +1 -0
  100. package/admin-out/monaco/vs/m3-CsR4AuFi.js +1 -0
  101. package/admin-out/monaco/vs/markdown-C_rD0bIw.js +1 -0
  102. package/admin-out/monaco/vs/mdx-DEWtB1K5.js +1 -0
  103. package/admin-out/monaco/vs/mips-CiYP61RB.js +1 -0
  104. package/admin-out/monaco/vs/monaco.contribution-D2OdxNBt.js +1 -0
  105. package/admin-out/monaco/vs/monaco.contribution-DO3azKX8.js +1 -0
  106. package/admin-out/monaco/vs/monaco.contribution-EcChJV6a.js +1 -0
  107. package/admin-out/monaco/vs/monaco.contribution-qLAYrEOP.js +1 -0
  108. package/admin-out/monaco/vs/msdax-C38-sJlp.js +1 -0
  109. package/admin-out/monaco/vs/mysql-CdtbpvbG.js +1 -0
  110. package/admin-out/monaco/vs/nls.messages-loader.js +1 -0
  111. package/admin-out/monaco/vs/nls.messages.cs.js.js +17 -0
  112. package/admin-out/monaco/vs/nls.messages.de.js.js +17 -0
  113. package/admin-out/monaco/vs/nls.messages.es.js.js +17 -0
  114. package/admin-out/monaco/vs/nls.messages.fr.js.js +15 -0
  115. package/admin-out/monaco/vs/nls.messages.it.js.js +15 -0
  116. package/admin-out/monaco/vs/nls.messages.ja.js.js +17 -0
  117. package/admin-out/monaco/vs/nls.messages.js.js +10 -0
  118. package/admin-out/monaco/vs/nls.messages.ko.js.js +25 -0
  119. package/admin-out/monaco/vs/nls.messages.pl.js.js +17 -0
  120. package/admin-out/monaco/vs/nls.messages.pt-br.js.js +6 -0
  121. package/admin-out/monaco/vs/nls.messages.ru.js.js +17 -0
  122. package/admin-out/monaco/vs/nls.messages.tr.js.js +15 -0
  123. package/admin-out/monaco/vs/nls.messages.zh-cn.js.js +17 -0
  124. package/admin-out/monaco/vs/nls.messages.zh-tw.js.js +15 -0
  125. package/admin-out/monaco/vs/objective-c-CntZFaHX.js +1 -0
  126. package/admin-out/monaco/vs/pascal-r6kuqfl_.js +1 -0
  127. package/admin-out/monaco/vs/pascaligo-BiXoTmXh.js +1 -0
  128. package/admin-out/monaco/vs/perl-DABw_TcH.js +1 -0
  129. package/admin-out/monaco/vs/pgsql-me_jFXeX.js +1 -0
  130. package/admin-out/monaco/vs/php-D_kh-9LK.js +1 -0
  131. package/admin-out/monaco/vs/pla-VfZjczW0.js +1 -0
  132. package/admin-out/monaco/vs/postiats-BBSzz8Pk.js +1 -0
  133. package/admin-out/monaco/vs/powerquery-Dt-g_2cc.js +1 -0
  134. package/admin-out/monaco/vs/powershell-B-7ap1zc.js +1 -0
  135. package/admin-out/monaco/vs/protobuf-BmtuEB1A.js +2 -0
  136. package/admin-out/monaco/vs/pug-BRpRNeEb.js +1 -0
  137. package/admin-out/monaco/vs/python-Cr0UkIbn.js +1 -0
  138. package/admin-out/monaco/vs/qsharp-BzsFaUU9.js +1 -0
  139. package/admin-out/monaco/vs/r-f8dDdrp4.js +1 -0
  140. package/admin-out/monaco/vs/razor-BYAHOTkz.js +1 -0
  141. package/admin-out/monaco/vs/redis-fvZQY4PI.js +1 -0
  142. package/admin-out/monaco/vs/redshift-45Et0LQi.js +1 -0
  143. package/admin-out/monaco/vs/restructuredtext-C7UUFKFD.js +1 -0
  144. package/admin-out/monaco/vs/ruby-CZO8zYTz.js +1 -0
  145. package/admin-out/monaco/vs/rust-Bfetafyc.js +1 -0
  146. package/admin-out/monaco/vs/sb-3GYllVck.js +1 -0
  147. package/admin-out/monaco/vs/scala-foMgrKo1.js +1 -0
  148. package/admin-out/monaco/vs/scheme-CHdMtr7p.js +1 -0
  149. package/admin-out/monaco/vs/scss-C1cmLt9V.js +3 -0
  150. package/admin-out/monaco/vs/shell-ClXCKCEW.js +1 -0
  151. package/admin-out/monaco/vs/solidity-MZ6ExpPy.js +1 -0
  152. package/admin-out/monaco/vs/sophia-DWkuSsPQ.js +1 -0
  153. package/admin-out/monaco/vs/sparql-AUGFYSyk.js +1 -0
  154. package/admin-out/monaco/vs/sql-32GpJSV2.js +1 -0
  155. package/admin-out/monaco/vs/st-CuDFIVZ_.js +1 -0
  156. package/admin-out/monaco/vs/swift-n-2HociN.js +3 -0
  157. package/admin-out/monaco/vs/systemverilog-Ch4vA8Yt.js +1 -0
  158. package/admin-out/monaco/vs/tcl-D74tq1nH.js +1 -0
  159. package/admin-out/monaco/vs/tsMode-CZz1Umrk.js +11 -0
  160. package/admin-out/monaco/vs/twig-C6taOxMV.js +1 -0
  161. package/admin-out/monaco/vs/typescript-DfOrAzoV.js +1 -0
  162. package/admin-out/monaco/vs/typespec-D-PIh9Xw.js +1 -0
  163. package/admin-out/monaco/vs/vb-Dyb2648j.js +1 -0
  164. package/admin-out/monaco/vs/wgsl-BhLXMOR0.js +298 -0
  165. package/admin-out/monaco/vs/workers-DcJshg-q.js +1 -0
  166. package/admin-out/monaco/vs/xml-CdsdnY8S.js +1 -0
  167. package/admin-out/monaco/vs/yaml-DYGvmE88.js +1 -0
  168. package/bin/halo.js +9 -0
  169. package/bundled-docs/design/agent.md +145 -0
  170. package/bundled-docs/design/architecture.md +270 -0
  171. package/bundled-docs/design/background-dispatch.md +151 -0
  172. package/bundled-docs/design/command.md +58 -0
  173. package/bundled-docs/design/cron.md +88 -0
  174. package/bundled-docs/design/evolution.md +383 -0
  175. package/bundled-docs/design/express-self.md +145 -0
  176. package/bundled-docs/design/feishu.md +224 -0
  177. package/bundled-docs/design/halo-city.md +112 -0
  178. package/bundled-docs/design/prompt-system.md +411 -0
  179. package/bundled-docs/design/session.md +321 -0
  180. package/bundled-docs/design/slack.md +212 -0
  181. package/bundled-docs/design/storage.md +578 -0
  182. package/bundled-docs/design/telegram.md +161 -0
  183. package/bundled-docs/design/web.md +222 -0
  184. package/bundled-docs/design/wechat.md +146 -0
  185. package/bundled-docs/design/ws.md +144 -0
  186. package/bundled-docs/dev/acp-adapter.md +337 -0
  187. package/bundled-docs/dev/add-channel.md +376 -0
  188. package/bundled-docs/dev/add-model-provider.md +386 -0
  189. package/bundled-docs/dev/api.md +686 -0
  190. package/bundled-docs/dev/deploy.md +198 -0
  191. package/bundled-docs/dev/desktop-packaging.md +327 -0
  192. package/bundled-docs/dev/env.md +158 -0
  193. package/bundled-docs/dev/logging.md +85 -0
  194. package/bundled-docs/dev/previews.md +225 -0
  195. package/bundled-docs/dev/tools.md +331 -0
  196. package/bundled-docs/guide/README.md +29 -0
  197. package/bundled-docs/guide/agents.md +264 -0
  198. package/bundled-docs/guide/channels/README.md +62 -0
  199. package/bundled-docs/guide/channels/acp.md +150 -0
  200. package/bundled-docs/guide/channels/feishu.md +154 -0
  201. package/bundled-docs/guide/channels/slack.md +156 -0
  202. package/bundled-docs/guide/channels/telegram.md +112 -0
  203. package/bundled-docs/guide/channels/web.md +149 -0
  204. package/bundled-docs/guide/channels/wechat.md +110 -0
  205. package/bundled-docs/guide/chat.md +112 -0
  206. package/bundled-docs/guide/cli.md +197 -0
  207. package/bundled-docs/guide/getting-started.md +93 -0
  208. package/bundled-docs/guide/secrets-and-credentials.md +161 -0
  209. package/bundled-docs/guide/sessions.md +104 -0
  210. package/bundled-docs/guide/skills.md +302 -0
  211. package/bundled-docs/guide/testing-agents-and-skills.md +136 -0
  212. package/bundled-docs/guide/workspace.md +131 -0
  213. package/bundled-docs/plans/cron-tasks.md +362 -0
  214. package/bundled-docs/plans/design-suggestions.md +203 -0
  215. package/bundled-docs/plans/issue-session-deep-nesting.md +208 -0
  216. package/bundled-docs/plans/launch-plan.md +111 -0
  217. package/bundled-docs/plans/md-and-agent-refactor.md +197 -0
  218. package/bundled-docs/plans/remote-mac-worker.md +196 -0
  219. package/bundled-docs/plans/roadmap.md +40 -0
  220. package/bundled-docs/plans/self-evolution.md +1379 -0
  221. package/bundled-docs/plans/todo.md +32 -0
  222. package/bundled-docs/plans/weixin-channel.md +255 -0
  223. package/bundled-docs/requirements/agent.md +92 -0
  224. package/bundled-docs/requirements/chat.md +81 -0
  225. package/bundled-docs/requirements/command.md +130 -0
  226. package/bundled-docs/requirements/editor.md +82 -0
  227. package/bundled-docs/requirements/explorer.md +89 -0
  228. package/bundled-docs/requirements/overview.md +62 -0
  229. package/bundled-docs/requirements/session.md +73 -0
  230. package/bundled-docs/requirements/settings.md +224 -0
  231. package/bundled-docs/requirements/skill.md +125 -0
  232. package/bundled-docs/requirements/source-control.md +82 -0
  233. package/bundled-docs/requirements/terminal.md +118 -0
  234. package/bundled-docs/requirements/workspace.md +80 -0
  235. package/bundled-docs/test/docs-seeding.md +101 -0
  236. package/bundled-docs/test/session.md +374 -0
  237. package/dist/index.js +26750 -0
  238. package/package.json +67 -0
  239. package/templates/INSTRUCTIONS.md +25 -0
  240. package/templates/agents/__apply_agent__/AGENT.md +229 -0
  241. package/templates/agents/__apply_agent__/agent.yaml +30 -0
  242. package/templates/agents/__evo_agent__/AGENT.md +323 -0
  243. package/templates/agents/__evo_agent__/agent.yaml +29 -0
  244. package/templates/agents/__score__/AGENT.md +177 -0
  245. package/templates/agents/__score__/agent.yaml +29 -0
  246. package/templates/agents/deep-executor/AGENT.md +60 -0
  247. package/templates/agents/deep-executor/agent.yaml +25 -0
  248. package/templates/agents/default/AGENT.md +38 -0
  249. package/templates/agents/default/agent.yaml +51 -0
  250. package/templates/agents/executor/AGENT.md +38 -0
  251. package/templates/agents/executor/agent.yaml +25 -0
  252. package/templates/aliases.yaml +26 -0
  253. package/templates/canvas/self.html +660 -0
  254. package/templates/config.yaml +69 -0
  255. package/templates/models/anthropic.yaml +47 -0
  256. package/templates/models/aws-bedrock-claude-invoke.yaml +156 -0
  257. package/templates/models/aws-bedrock-mantle.yaml +89 -0
  258. package/templates/models/deepseek.yaml +62 -0
  259. package/templates/models/doubao.yaml +137 -0
  260. package/templates/models/hunyuan.yaml +56 -0
  261. package/templates/models/kimi.yaml +41 -0
  262. package/templates/models/mimo-token-plan-china.yaml +61 -0
  263. package/templates/models/minimax.yaml +80 -0
  264. package/templates/models/openai.yaml +51 -0
  265. package/templates/models/qwen.yaml +78 -0
  266. package/templates/optional-skills/tavily-web-search/SKILL.md +91 -0
  267. package/templates/optional-skills/tavily-web-search/config.yaml +10 -0
  268. package/templates/prompts/all/TOOL_GUIDELINES.md +35 -0
  269. package/templates/prompts/all/TOOL_SHELL.md +4 -0
  270. package/templates/prompts/all/TOOL_SHELL.windows.md +7 -0
  271. package/templates/prompts/bootstrap/BOOTSTRAP.md +26 -0
  272. package/templates/prompts/root/WORKSPACE_MEMORY.md +11 -0
  273. package/templates/schema.sql +30 -0
  274. package/templates/skills/acp/SKILL.md +236 -0
  275. package/templates/skills/acp/templates/SKILL.md.tmpl +74 -0
  276. package/templates/skills/acp/templates/ask.py +176 -0
  277. package/templates/skills/acp/templates/config.yaml.tmpl +33 -0
  278. package/templates/skills/agent/SKILL.md +128 -0
  279. package/templates/skills/aws-knowledge/SKILL.md +82 -0
  280. package/templates/skills/aws-knowledge/scripts/aws_kb.py +61 -0
  281. package/templates/skills/cron/SKILL.md +217 -0
  282. package/templates/skills/cron/manage-cron.py +434 -0
  283. package/templates/skills/halo/SKILL.md +98 -0
  284. package/templates/skills/nova-web-search/SKILL.md +65 -0
  285. package/templates/skills/self/SKILL.md +139 -0
  286. package/templates/skills/send-file/SKILL.md +28 -0
  287. package/templates/skills/send-file/feishu.md +16 -0
  288. package/templates/skills/send-file/slack.md +7 -0
  289. package/templates/skills/send-file/telegram.md +9 -0
  290. package/templates/skills/send-file/web.md +6 -0
  291. package/templates/skills/send-file/wechat.md +8 -0
  292. package/templates/skills/skill/SKILL.md +131 -0
  293. package/templates/skills/workspace/SKILL.md +28 -0
  294. package/templates/skills/workspace/setup-tidy.md +265 -0
  295. package/templates/skills/workspace/share.md +187 -0
  296. package/templates/skills/workspace/stage.py +487 -0
@@ -0,0 +1,197 @@
1
+ # Refactor plan: drop is_default + working_dir + MD-load simplification + externalise system prompts
2
+
3
+ **Status**: shipped (2026-04 / 2026-05). All phases A–F landed: `priority` field replaced `is_default`, `agent_sessions.working_dir` column added, MD-loader simplified (INDEX.md root-only, INSTRUCTIONS.md stacks per directory level), system prompts externalised under `prompts/{bootstrap,all,root}/`. This doc is kept as a design log — see the reference state in [design/prompt-system.md](../design/prompt-system.md).
4
+ **Filed**: 2026-04-27
5
+
6
+ This doc preserves every design decision, rationale, and trade-off so we can rapidly recover context if it's lost.
7
+
8
+ ---
9
+
10
+ ## Background
11
+
12
+ Halo uses `is_default` as a synonym for "root agent", which has bad knock-on effects:
13
+ - Prompt injection logic, tool behaviour, and UI default selection all bind to this field
14
+ - User-defined "direct-chat agents" can't receive USER.md, PLATFORM_KNOWLEDGE, or other root-only prompts
15
+ - Hard-coded system prompts (BOOTSTRAP / TOOL_GUIDELINES / PLATFORM_KNOWLEDGE / ORCHESTRATOR_GUIDELINES) live in source — users wanting to customise must edit source
16
+ - INDEX.md reserves a subdirectory-loading interface but never calls it (dead code)
17
+ - INSTRUCTIONS.md only supports two layers (global + project); no subdirectory granularity
18
+
19
+ ---
20
+
21
+ ## Core decisions
22
+
23
+ ### 1. Drop `is_default`
24
+
25
+ - The `is_default` field is deprecated. YAML uses `priority: number` instead — default 0, higher first.
26
+ - The `default` agent seed stays, `priority: 99` (remains the initial default selection).
27
+ - All `isDefault`-semantic branches become `!parentId` ("root agent") checks.
28
+ - `list_agents` no longer filters `default`; agents can spawn themselves (same agent_id, independent session instances).
29
+ - Delete protection: at least 1 agent in the global scope; workspace scope can be emptied.
30
+ - UI default selection: sort by `priority desc, name asc`, pick the first.
31
+ - Remove the "default" badge.
32
+
33
+ ### 2. Add `working_dir`
34
+
35
+ - New `working_dir` argument on `start_session`
36
+ - Accepts absolute or workspace-relative paths
37
+ - Default: `workspaceRoot` (project root)
38
+ - Enforce resolved path within workspace (reject traversal)
39
+ - Non-existent directory → reject spawn
40
+ - `agent_sessions` gets a `workingDir TEXT` column (null = project root)
41
+ - On resume, DB → `buildAgentInstance`
42
+
43
+ ### 3. INDEX.md — project-root-only
44
+
45
+ - `<ws>/.halo/INDEX.md` is the sole source, injected for every agent
46
+ - Sub-directory `INDEX.md` files are **not auto-loaded**; user / agent uses `file_read` on demand
47
+ - Drop `subDirIndex` logic in `resolveMdPaths` (dead code)
48
+ - Rationale: multi-level INDEX is an untested requirement; users reference sub-INDEX from the root INDEX and the agent reads on demand (progressive disclosure)
49
+
50
+ ### 4. INSTRUCTIONS.md — stacked by level
51
+
52
+ - From global → workspaceRoot → every level of the workingDir path, load `.halo/INSTRUCTIONS.md`
53
+ - Injection order: outer → inner (global first, workingDir last)
54
+ - Each block labelled with its path relative to workspaceRoot (root itself uses `.`)
55
+ - Rationale: INSTRUCTIONS encode "how to work here"; directory depth is a natural scope, more specific wins
56
+
57
+ ### 5. Externalise system prompts
58
+
59
+ The four hard-coded constants (BOOTSTRAP / TOOL_GUIDELINES / PLATFORM_KNOWLEDGE / ORCHESTRATOR_GUIDELINES) move to:
60
+
61
+ ```
62
+ ~/.halo/global/prompts/
63
+ ├── bootstrap/ ← only injected for root agent + needsBootstrap
64
+ ├── all/ ← injected for every agent
65
+ └── root/ ← only injected for root agent
66
+ ```
67
+
68
+ - Subdirectory categorisation decides injection scope
69
+ - Inside each subdirectory, every `.md` is concatenated by filename ascending
70
+ - User extends by dropping MDs in the relevant directory (e.g. `prompts/all/my-style-guide.md`)
71
+ - Startup seed: first run writes four defaults; existing files preserved
72
+ - Live-read (every `buildAgentInstance`)
73
+ - Missing: warn + skip (don't break the server)
74
+ - `tool-guidelines.ts` remains the seed source + hard-coded fallback
75
+ - **Global only**; workspace doesn't override
76
+ - **Language**: seed content stays English (already is); UI copy stays English; section headers stay English; Chinese only in developer docs
77
+
78
+ ---
79
+
80
+ ## Target directory layout
81
+
82
+ ### Global
83
+
84
+ ```
85
+ ~/.halo/global/
86
+ ├── USER.md ← bootstrap-generated
87
+ ├── INSTRUCTIONS.md ← user-global preferences
88
+ ├── prompts/
89
+ │ ├── bootstrap/BOOTSTRAP.md
90
+ │ ├── all/TOOL_GUIDELINES.md
91
+ │ └── root/PLATFORM_KNOWLEDGE.md, ORCHESTRATOR_GUIDELINES.md
92
+ ├── agents/<id>/{agent.yaml, AGENT.md}
93
+ └── skills/<id>/SKILL.md
94
+ ```
95
+
96
+ ### Workspace
97
+
98
+ ```
99
+ <ws>/.halo/
100
+ ├── USER.md ← optional, overrides global
101
+ ├── INSTRUCTIONS.md ← project-root preferences
102
+ ├── INDEX.md ← sole project index
103
+ ├── <subdir>/.halo/INSTRUCTIONS.md ← per-subdir preferences, stacked
104
+ ├── agents/<id>/{agent.yaml, AGENT.md}
105
+ └── skills/<id>/SKILL.md
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Root vs sub-agent behaviour matrix
111
+
112
+ | Injected content | Root (`!parentId`) | Sub-agent |
113
+ |---|---|---|
114
+ | USER.md | ✓ | ✗ |
115
+ | AGENT.md | ✓ | ✓ |
116
+ | INSTRUCTIONS.md (global + stacked) | ✓ | ✓ |
117
+ | INDEX.md (project root) | ✓ | ✓ |
118
+ | `prompts/all/` | ✓ | ✓ |
119
+ | `prompts/root/` | ✓ | ✗ |
120
+ | `prompts/bootstrap/` | ✓ (only when no USER.md) | ✗ |
121
+ | `"workspace at..."` | ✓ | ✓ |
122
+ | `"Working directory: ..."` | only when workingDir != root | always |
123
+
124
+ ---
125
+
126
+ ## Execution phases
127
+
128
+ Grouped into 6 todo buckets:
129
+
130
+ ### A. is_default → priority (backend + frontend)
131
+ - session-manager.ts: drop isDefault; replace prompt branches with `!parentId`; merge tool order; drop `list_agents` filter
132
+ - agent-loader.ts: YAML gains priority; `scanAvailableAgents` returns priority
133
+ - agent-configs.ts: `parseAgentYaml` reads priority; sort by priority desc + name asc; seed template gains `priority: 99`; DELETE adds last-global guard
134
+ - frontend types.ts + api-client.ts: rename fields
135
+ - chat-panel.tsx: default-selection logic; remove "default" badge
136
+ - agent-management-main.tsx + agent-form.tsx: delete isDefault UI
137
+
138
+ ### B. working_dir feature
139
+ - `start_session` schema adds `working_dir`
140
+ - `createSession` / `buildAgentInstance` pass it through
141
+ - DB migration: `agent_sessions` adds `workingDir` column
142
+ - Resume restores from DB
143
+
144
+ ### C. md-loader simplification
145
+ - INDEX.md reads only `<ws>/.halo/INDEX.md`; drop `subDirIndex`
146
+ - INSTRUCTIONS.md becomes `workspaceInstructionsChain: Array<{rel, content}>`
147
+ - `composeMdPrompt` expands the chain as multiple sections, each header labelled with relative path (root = `.`)
148
+ - Implement `collectInstructionsChain(workspaceRoot, workingDir)`
149
+
150
+ ### D. Externalise system prompts
151
+ - Create `~/.halo/global/prompts/{bootstrap,all,root}/`
152
+ - `init.ts` startup seeds four MD files (content from `tool-guidelines.ts`)
153
+ - New `loadSystemPrompts()` reads live per subdir, filename-ascending concat
154
+ - Replace `import { ... } from './tool-guidelines'` with `loadSystemPrompts()` calls
155
+ - Missing: warn + fall back to the hard-coded value (keep `tool-guidelines.ts`)
156
+
157
+ ### E. Doc sync
158
+ - CLAUDE.md: describe the MD load flow, agent model
159
+ - `.halo/docs/backend/md-loading-flow.md` (already in target state)
160
+ - `.halo/docs/knowledge-system.md`: directory layout, injection rules
161
+ - `.halo/docs/data-storage-protocol.md`: agent YAML fields + new agent_sessions column
162
+ - `.halo/docs/session-tools-reference.md`: `start_session` schema
163
+ - `.halo/docs/test-case.md`: updated test cases
164
+
165
+ ### F. Deployment smoke test
166
+ - `pnpm --filter core/server/web build`
167
+ - Kill 9527, restart with Node 22 (PATH=$HOME/.nvm/versions/node/v22.21.1/bin:$PATH)
168
+ - Smoke: /api/health, WS connect, send one message end-to-end
169
+ - Verify: root agent receives prompts/root, sub-agent doesn't; INSTRUCTIONS stacking works; working_dir wires through; deletion guard fires
170
+
171
+ ---
172
+
173
+ ## Key constraints and risks
174
+
175
+ - **Node version**: must be v22+ (better-sqlite3 native binding bound to v22). Scripts must load nvm.
176
+ - **Compatibility**: legacy YAML's `is_default: true` stays readable but ignored; DB's `is_default` column stays untouched, just unread.
177
+ - **Backwards-compat seed**: `default` agent still auto-seeds with id `default`, but YAML uses `priority: 99`.
178
+ - **Path safety**: `working_dir` must be verified inside workspace (block `../` escapes).
179
+ - **Cache key**: with merged tool list, `cache_control` still goes on the last tool — stability unaffected.
180
+ - **Bootstrap idempotence**: once USER.md exists, `needsBootstrap` is false forever, `prompts/bootstrap/` no longer injects.
181
+ - **Self-spawn allowed**: `session_id` depth limit (`maxNestingDepth`) already guards against infinite recursion.
182
+
183
+ ---
184
+
185
+ ## Rollback plan
186
+
187
+ If something breaks in production:
188
+ - Git revert to pre-refactor commit
189
+ - `~/.halo/global/prompts/` directory is harmless to older versions (they don't read it)
190
+ - `agent_sessions.workingDir` column harmless (old code reads null → falls back to workspaceRoot)
191
+ - YAML `priority` harmless to older code (unknown field = default 0); `is_default: true` can be seeded back into the default agent's YAML
192
+
193
+ ---
194
+
195
+ ## Todo index
196
+
197
+ See the todo list. All 12 pending items run A → F; the last one is the smoke test.
@@ -0,0 +1,196 @@
1
+ # Remote Mac Worker — Design Blueprint
2
+
3
+ **Status**: not started, design initially frozen
4
+ **Filed**: 2026-04-28
5
+ **Priority**: future work, not at the front of the roadmap
6
+
7
+ ## Scope
8
+
9
+ Wire the user's Mac into Halo — **not** as a remote code workspace, but as a **capability provider**, letting server-side agents tap into native Mac capabilities (screenshot, camera, browser, WPS, iMessage, calendar, …).
10
+
11
+ The key contrast with openclaw / opencode / Claude Code:
12
+ - Those tools: agent loop on the local machine, LLM remote
13
+ - This plan: **agent loop + LLM both on the server, Mac is just a "capability execution environment"**
14
+
15
+ It's "Mac as a service", not "LLM as a service".
16
+
17
+ ## Architecture choice: Swiss-army knife + skill accumulation
18
+
19
+ Rejected alternatives (discussed and dropped):
20
+ - **Static capability plugin** (a fixed preset tool set) → capability boundary is rigid; agents have no recourse for novel capabilities
21
+ - **Computer Use pixel-level** (screenshot + click coordinates) → unfriendly to the 2018 Intel Mac (slow + expensive); universality bought with token cost
22
+
23
+ Settled on **Swiss-army knife + skills**:
24
+
25
+ ```
26
+ Low-level primitives (registered by the Worker)
27
+ - mac_shell(cmd) → arbitrary shell commands
28
+ - mac_applescript(script) → arbitrary AppleScript
29
+ - mac_jxa(script) → JavaScript for Automation (AppleScript modernised)
30
+ - mac_filesystem → file_read/write/list etc.
31
+
32
+ Middle layer — skills (preset + user-written + agent-accumulated)
33
+ - mac_screenshot
34
+ - mac_take_photo
35
+ - mac_open_wps
36
+ - mac_safari_goto
37
+ - mac_read_imessage
38
+ - …(agent first explores new scenarios, then asks user to save them as skills after verification)
39
+
40
+ Surface / UI
41
+ - Settings shows the connected worker + its registered primitives
42
+ - Each skill can be enabled/disabled
43
+ ```
44
+
45
+ Why:
46
+ - Covers ~99% of Mac apps (mature AppleScript ecosystem)
47
+ - Friendly to old Intel Mac hardware (no continuous-screenshot + vision-inference load)
48
+ - Plays naturally with Halo's existing Skill system
49
+ - High capability ceiling (Turing-complete)
50
+
51
+ ## Worker protocol outline
52
+
53
+ WebSocket-based reverse connection (Mac only needs outbound; no public IP needed):
54
+
55
+ ```
56
+ Mac Halo Server (9527)
57
+ halo-worker ──── WSS ───▶ /worker endpoint
58
+ ↕
59
+ worker-pool
60
+ ↕
61
+ agent tool dispatch
62
+ ```
63
+
64
+ Worker registration payload:
65
+
66
+ ```json
67
+ {
68
+ "type": "register",
69
+ "workerId": "peter-mac",
70
+ "primitives": ["shell", "applescript", "jxa", "filesystem"],
71
+ "os": "macos",
72
+ "osVersion": "14.x",
73
+ "arch": "x64",
74
+ "home": "/Users/peter"
75
+ }
76
+ ```
77
+
78
+ Server reads `primitives` and dynamically assembles the tool set it injects into the agent.
79
+
80
+ Protocol messages to support:
81
+
82
+ ```
83
+ Worker → Server
84
+ - register
85
+ - tool_result (id, ok, result)
86
+ - tool_stream (id, chunk) // shell stdout streaming
87
+ - pong
88
+
89
+ Server → Worker
90
+ - tool_call (id, tool, args, dry_run?)
91
+ - tool_cancel (id)
92
+ - ping
93
+ ```
94
+
95
+ **Tool results must support multiple shapes**: text / image (base64 PNG) / file (binary) / structured (JSON). No longer the "all-tool-results-are-strings" simplification.
96
+
97
+ ## Security model (mandatory)
98
+
99
+ **Dynamic model + Swiss-army knife = high risk**. Required guards:
100
+
101
+ ### 1. Frontend approval
102
+
103
+ Every `mac_shell` / `mac_applescript` execution pops a frontend confirmation:
104
+ - Show the command text
105
+ - Allow once / allow for this session / allow permanently for this command pattern
106
+
107
+ Like Claude Desktop / Cursor's tool approval UI.
108
+
109
+ ### 2. Server-side dangerous-command blocking
110
+
111
+ Regex scan for:
112
+ - `rm -rf`, `sudo`, `curl|bash` pipes, `nc`, `mkfs`, `dd`
113
+ - AppleScript `delete file`, `empty trash`, `quit application`
114
+ → Force popup, no "session allowlist"
115
+
116
+ ### 3. Worker-side path validation
117
+
118
+ `mac_filesystem`-family tools still use the `validateWorkspacePath` approach from `workspace-tools.ts`; the worker validates itself, doesn't trust server-supplied absolute paths.
119
+
120
+ ### 4. Capability switches
121
+
122
+ Settings lets the user:
123
+ - Disable `mac_shell` (keep only AppleScript)
124
+ - Block specific commands entirely (`rm` / `sudo` / `curl`)
125
+ - Disable an entire sensitive skill
126
+
127
+ ## Hardware constraints (user's 2018 Intel Mac)
128
+
129
+ - Latest macOS (exact version unknown — will probe)
130
+ - **Computer Use pixel-vision unsuitable** — old GPU, slow image processing
131
+ - AppleScript / shell / osascript are native CLI — no perf issues
132
+ - `node-pty` needs to be built x64 (not arm64)
133
+
134
+ ## Time estimate (revised)
135
+
136
+ The earlier "2-3 days" was wishful; realistic estimate:
137
+
138
+ | Phase | Time | Deliverable |
139
+ |---|---|---|
140
+ | MVP: protocol + shell + filesystem | 1 week | Agent can run commands / read files on Mac |
141
+ | + AppleScript + screenshot | 3 days | Agent controls any Mac app + screenshots |
142
+ | + Safari control, WPS control | 3 days | "Open this page and screenshot it" works end-to-end |
143
+ | + Camera, iMessage | 3-5 days | Take photos, read/send messages |
144
+ | UI: worker management + approvals | 1 week | Frontend can see worker status, approve tool calls |
145
+ | Polish + package CLI + deploy docs | 1-2 weeks | Shippable |
146
+
147
+ **Total: 4-6 full-time weeks.**
148
+
149
+ Suggested split:
150
+ - **First window (2 weekend days)**: MVP only. Get "agent executes `ls` on Mac and sees the result". Stop to evaluate whether to continue.
151
+ - **Second window (2-3 weeks)**: up to "screenshot + Safari + WPS control" — already a strong demo.
152
+
153
+ ## MVP checklist
154
+
155
+ Start and stop here; do nothing else until it lands:
156
+
157
+ - [ ] New `packages/worker` workspace, add to pnpm
158
+ - [ ] New `packages/server/src/workers/` with worker-pool + `/worker` WS endpoint
159
+ - [ ] Protocol: register / tool_call / tool_result / ping-pong
160
+ - [ ] Worker CLI: WS connect, register, ping, one `mac_shell` primitive
161
+ - [ ] Server: Project table gains `execution_target` (local / worker:<id>)
162
+ - [ ] Agent tool dispatch abstraction: `LocalExecutor` vs `RemoteExecutor`
163
+ - [ ] Frontend: Settings hard-codes one worker entry + shows worker status
164
+ - [ ] End-to-end: agent runs `ls ~` on Mac successfully
165
+
166
+ Stop once these 8 are green. **Do not expand scope.**
167
+
168
+ ## Decision log vs Anthropic Computer Use
169
+
170
+ We discussed Computer Use (Claude Sonnet 3.5+'s vision + coordinate-click capability) and decided not to go that route, because:
171
+
172
+ 1. User's machine is 2018 Intel Mac; vision inference is slow
173
+ 2. Each step's screenshot burns tokens → costly
174
+ 3. Non-deterministic (potential misclicks)
175
+ 4. Generic, but overkill for macOS's mature AppleScript ecosystem
176
+ 5. Halo runs on Bedrock Claude; it's supported but latency/cost is worse than direct API
177
+
178
+ **Not opposed to adding it later** as another primitive ("vision fallback"), but not the main path.
179
+
180
+ ## Reference projects
181
+
182
+ - **Anthropic computer-use-demo** (Docker demo, for protocol reference)
183
+ - **OpenInterpreter 01** (open-source local agent, primitive design)
184
+ - **Claude Desktop + MCP** (tool approval UX)
185
+ - **Self-Operating Computer** (coordinate-click fallback, if we ever add it)
186
+ - **Dagger** / **dstack.ai** (worker pool management)
187
+
188
+ ## Questions to answer before starting
189
+
190
+ 1. Mac's specific macOS version (gates which APIs are available)
191
+ 2. Which three skills to prioritise packaging (pick 3 from screenshot / Safari / WPS / iMessage)
192
+ 3. Approval UI granularity (session allowlist vs per-command pattern)
193
+ 4. Worker auth (where to store tokens, rotation)
194
+ 5. Multi-worker support (1 server to N workers)
195
+
196
+ Answer these first before any code.
@@ -0,0 +1,40 @@
1
+ # Roadmap
2
+
3
+ ## Model Providers
4
+ - [x] OpenAI (GPT series)
5
+ - [ ] Google Gemini
6
+ - [ ] OpenRouter (multi-model aggregator)
7
+ - [ ] Ollama (local models)
8
+
9
+ Extension interface is ready (`ModelRuntime`). Adding providers is integration work, not architecture work.
10
+
11
+ ## Channels
12
+ - [ ] Discord
13
+ - [x] Slack
14
+ - [ ] Email
15
+ - [ ] SMS
16
+
17
+ Channel adapter pattern established (Web, WeChat, Telegram, Slack, Feishu already working). New channels follow the same `CommandContext` interface.
18
+
19
+ ## CLI / TUI
20
+ - [x] CLI mode (headless, SSH-friendly)
21
+ - [x] TUI (terminal UI with interactive chat)
22
+
23
+ Enables usage without a browser. Important for SSH-into-server workflows.
24
+
25
+ ## Deployment
26
+ - [ ] Dockerfile + docker-compose
27
+ - [ ] One-click deploy templates (Fly.io / Render / Railway)
28
+
29
+ Currently manual (`node dist/index.js`). Containerization needed for distribution.
30
+
31
+ ## Shared Workspace
32
+ - [ ] Workspace templates (clone/fork a pre-configured workspace)
33
+ - [ ] Workspace marketplace or registry
34
+ - [ ] Readonly workspace sharing with token auth
35
+
36
+ Core differentiator. Share an entire configured workspace (agents + skills + context + docs), not just individual tools or skills.
37
+
38
+ ## Quality
39
+ - [ ] Test suite (unit + integration)
40
+ - [ ] CI pipeline