somora 2026.930.1

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 (404) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +364 -0
  3. package/bin/node-version.d.mts +3 -0
  4. package/bin/node-version.mjs +45 -0
  5. package/bin/somora.mjs +77 -0
  6. package/config.example.yaml +896 -0
  7. package/docs/agents.md +677 -0
  8. package/docs/api.md +3194 -0
  9. package/docs/browser.md +317 -0
  10. package/docs/builder.md +331 -0
  11. package/docs/cache-strategy.md +373 -0
  12. package/docs/compaction.md +253 -0
  13. package/docs/display.md +154 -0
  14. package/docs/dream-phases.md +891 -0
  15. package/docs/files.md +387 -0
  16. package/docs/imagegen.md +366 -0
  17. package/docs/images/somora-hero.png +0 -0
  18. package/docs/images/somora-mobile-2026-05-23.png +0 -0
  19. package/docs/images/somora-tui-2026-05-23.png +0 -0
  20. package/docs/images/somora-web-2026-05-23.png +0 -0
  21. package/docs/index.md +178 -0
  22. package/docs/lsp.md +93 -0
  23. package/docs/mcp.md +332 -0
  24. package/docs/memory.md +407 -0
  25. package/docs/mobile.md +310 -0
  26. package/docs/models.md +379 -0
  27. package/docs/projects.md +425 -0
  28. package/docs/realtime-voice.md +293 -0
  29. package/docs/resources.md +230 -0
  30. package/docs/sampling.md +128 -0
  31. package/docs/security.md +189 -0
  32. package/docs/sentinel.md +295 -0
  33. package/docs/setup.md +1217 -0
  34. package/docs/skills.md +501 -0
  35. package/docs/team.md +189 -0
  36. package/docs/thinking.md +463 -0
  37. package/docs/tmux.md +399 -0
  38. package/docs/tools.md +117 -0
  39. package/docs/videogen.md +191 -0
  40. package/docs/voice.md +288 -0
  41. package/docs/web.md +893 -0
  42. package/docs/wiki.md +583 -0
  43. package/npm-shrinkwrap.json +5670 -0
  44. package/package.json +116 -0
  45. package/src/attachments/store.ts +196 -0
  46. package/src/browser/change-stream.ts +31 -0
  47. package/src/browser/display.ts +108 -0
  48. package/src/browser/policy.ts +121 -0
  49. package/src/browser/screencast.ts +374 -0
  50. package/src/browser/service.ts +1337 -0
  51. package/src/browser/session.ts +15 -0
  52. package/src/browser/snapshot.ts +40 -0
  53. package/src/cli/auth.ts +117 -0
  54. package/src/cli/codex.ts +41 -0
  55. package/src/cli/lsp.ts +71 -0
  56. package/src/cli/resolvers/clawhub.ts +400 -0
  57. package/src/cli/setup.ts +835 -0
  58. package/src/cli/skill.ts +619 -0
  59. package/src/cli/somora.ts +548 -0
  60. package/src/cli/systemd-unit.ts +72 -0
  61. package/src/cli/team.ts +148 -0
  62. package/src/cli/tui/activity-stream.ts +121 -0
  63. package/src/cli/tui/api.ts +479 -0
  64. package/src/cli/tui/app.tsx +1169 -0
  65. package/src/cli/tui/autocomplete.tsx +55 -0
  66. package/src/cli/tui/commands.ts +913 -0
  67. package/src/cli/tui/dream-glyphs.ts +22 -0
  68. package/src/cli/tui/footer.tsx +15 -0
  69. package/src/cli/tui/format.ts +28 -0
  70. package/src/cli/tui/header.tsx +279 -0
  71. package/src/cli/tui/index.tsx +120 -0
  72. package/src/cli/tui/markdown.tsx +63 -0
  73. package/src/cli/tui/sampling.ts +162 -0
  74. package/src/cli/tui/separator.tsx +13 -0
  75. package/src/cli/tui/state.ts +42 -0
  76. package/src/cli/tui/stream.ts +330 -0
  77. package/src/cli/tui/thinking-text.ts +54 -0
  78. package/src/cli/tui/turn-views.tsx +499 -0
  79. package/src/cli/tui/types.ts +410 -0
  80. package/src/cli/tui/work-queue.ts +161 -0
  81. package/src/cli/update-args.ts +55 -0
  82. package/src/cli/wiki.ts +406 -0
  83. package/src/compaction/index.ts +28 -0
  84. package/src/compaction/midturn.ts +210 -0
  85. package/src/compaction/policy.ts +154 -0
  86. package/src/compaction/summarize.ts +691 -0
  87. package/src/compaction/template.ts +90 -0
  88. package/src/compaction/types.ts +148 -0
  89. package/src/config/loader.ts +276 -0
  90. package/src/config/reload.ts +43 -0
  91. package/src/config/types.ts +2292 -0
  92. package/src/dream/deep-actions.ts +324 -0
  93. package/src/dream/deep-dispatcher.ts +237 -0
  94. package/src/dream/deep-llm.ts +388 -0
  95. package/src/dream/deep-prompts.ts +106 -0
  96. package/src/dream/deep-runner.ts +757 -0
  97. package/src/dream/deep-skip-cache.ts +199 -0
  98. package/src/dream/deep-worker.ts +229 -0
  99. package/src/dream/json-salvage.ts +34 -0
  100. package/src/dream/judge.ts +188 -0
  101. package/src/dream/loop-state.ts +286 -0
  102. package/src/dream/lucid-actions.ts +303 -0
  103. package/src/dream/lucid-batches.ts +94 -0
  104. package/src/dream/lucid-prompt.ts +82 -0
  105. package/src/dream/lucid-runner.ts +744 -0
  106. package/src/dream/lucid-storage.ts +277 -0
  107. package/src/dream/lucid-structure.ts +102 -0
  108. package/src/dream/lucid-types.ts +137 -0
  109. package/src/dream/lucid-worker.ts +224 -0
  110. package/src/dream/rem-dedup.ts +502 -0
  111. package/src/dream/rem-extract.ts +782 -0
  112. package/src/dream/rem-reset-run.ts +67 -0
  113. package/src/dream/rem-runner.ts +696 -0
  114. package/src/dream/rem-worker.ts +527 -0
  115. package/src/dream/review-window.ts +71 -0
  116. package/src/dream/scheduler-state.ts +129 -0
  117. package/src/dream/storage.ts +497 -0
  118. package/src/dream/types.ts +133 -0
  119. package/src/dream/wiki-context.ts +133 -0
  120. package/src/engine/a2a.ts +33 -0
  121. package/src/engine/availability.ts +63 -0
  122. package/src/engine/claude-cli.ts +969 -0
  123. package/src/engine/codex-app-server-client.ts +294 -0
  124. package/src/engine/codex-bin.ts +49 -0
  125. package/src/engine/codex-cli.ts +1014 -0
  126. package/src/engine/codex-dynamic-tools.ts +239 -0
  127. package/src/engine/codex-home.ts +63 -0
  128. package/src/engine/codex-thread-config.ts +74 -0
  129. package/src/engine/context-budget.ts +257 -0
  130. package/src/engine/engine-meta-labels.ts +211 -0
  131. package/src/engine/grok-cli.ts +941 -0
  132. package/src/engine/inline-think.ts +59 -0
  133. package/src/engine/model-availability.ts +105 -0
  134. package/src/engine/openai-compatible.ts +2464 -0
  135. package/src/engine/reasoning-retry.ts +83 -0
  136. package/src/engine/registry.ts +13 -0
  137. package/src/engine/replay.ts +195 -0
  138. package/src/engine/sampling.ts +90 -0
  139. package/src/engine/thinking-params.ts +264 -0
  140. package/src/engine/types.ts +269 -0
  141. package/src/engine/user-tag.ts +24 -0
  142. package/src/imagegen/aspect.ts +128 -0
  143. package/src/imagegen/generate.ts +642 -0
  144. package/src/imagegen/references.ts +75 -0
  145. package/src/imagegen/types.ts +154 -0
  146. package/src/lsp/client.ts +183 -0
  147. package/src/lsp/fake-server.helper.mjs +42 -0
  148. package/src/lsp/format.ts +29 -0
  149. package/src/lsp/index.ts +21 -0
  150. package/src/lsp/manager.ts +238 -0
  151. package/src/lsp/registry.ts +151 -0
  152. package/src/mcp/config.ts +117 -0
  153. package/src/mcp/hub/audit.ts +55 -0
  154. package/src/mcp/hub/bridge.ts +115 -0
  155. package/src/mcp/hub/catalog.ts +69 -0
  156. package/src/mcp/hub/credentials.ts +406 -0
  157. package/src/mcp/hub/env-expand.ts +14 -0
  158. package/src/mcp/hub/manager.ts +770 -0
  159. package/src/mcp/hub/normalize.ts +213 -0
  160. package/src/mcp/server.ts +368 -0
  161. package/src/mcp/tool-schema.ts +20 -0
  162. package/src/media/capabilities.ts +392 -0
  163. package/src/media/records.ts +175 -0
  164. package/src/media/store.ts +217 -0
  165. package/src/media/types.ts +69 -0
  166. package/src/memory/chunking.ts +168 -0
  167. package/src/memory/embeddings.ts +262 -0
  168. package/src/memory/index.ts +15 -0
  169. package/src/memory/inject.ts +197 -0
  170. package/src/memory/manager.ts +996 -0
  171. package/src/memory/registry.ts +176 -0
  172. package/src/memory/rescan.ts +101 -0
  173. package/src/memory/retrieval.ts +586 -0
  174. package/src/memory/shared-index.ts +372 -0
  175. package/src/memory/slug.ts +39 -0
  176. package/src/memory/storage.ts +385 -0
  177. package/src/memory/watcher.ts +134 -0
  178. package/src/multimodal/blocks.ts +101 -0
  179. package/src/multimodal/dimensions.ts +214 -0
  180. package/src/multimodal/load.ts +86 -0
  181. package/src/multimodal/mime.ts +135 -0
  182. package/src/multimodal/pdf-render.ts +80 -0
  183. package/src/multimodal/user-content.ts +266 -0
  184. package/src/persona/files.ts +144 -0
  185. package/src/persona/loader.ts +598 -0
  186. package/src/persona/skill-gating-store.ts +59 -0
  187. package/src/persona/tool-gating-store.ts +113 -0
  188. package/src/projects/focus.ts +186 -0
  189. package/src/projects/prompt-block.ts +106 -0
  190. package/src/projects/scheme.ts +107 -0
  191. package/src/projects/store.ts +144 -0
  192. package/src/projects/types.ts +73 -0
  193. package/src/sentinel/dispatcher.ts +97 -0
  194. package/src/sentinel/schedule.ts +271 -0
  195. package/src/sentinel/scheduler.ts +840 -0
  196. package/src/sentinel/store.ts +259 -0
  197. package/src/sentinel/types.ts +221 -0
  198. package/src/server/activity-stream.ts +160 -0
  199. package/src/server/ask-calls.ts +137 -0
  200. package/src/server/ask-wait-graph.ts +171 -0
  201. package/src/server/async-tasks.ts +199 -0
  202. package/src/server/builder-busy.ts +86 -0
  203. package/src/server/builder-prompt.ts +204 -0
  204. package/src/server/builder-questions.ts +117 -0
  205. package/src/server/builder-session.ts +249 -0
  206. package/src/server/chat-aborts.ts +83 -0
  207. package/src/server/claude-config-dir.ts +71 -0
  208. package/src/server/claude-credential-sync.ts +454 -0
  209. package/src/server/env-file.ts +100 -0
  210. package/src/server/env.ts +115 -0
  211. package/src/server/heal-session.ts +151 -0
  212. package/src/server/history-page.ts +46 -0
  213. package/src/server/index.ts +7244 -0
  214. package/src/server/lockfile.ts +89 -0
  215. package/src/server/logger.ts +67 -0
  216. package/src/server/logs.ts +187 -0
  217. package/src/server/loopback-fetch.ts +130 -0
  218. package/src/server/openai-client.ts +89 -0
  219. package/src/server/prompt-assembly.ts +334 -0
  220. package/src/server/restart-reconcile.ts +139 -0
  221. package/src/server/run-turn-fallback.ts +275 -0
  222. package/src/server/run-turn-types.ts +91 -0
  223. package/src/server/run-turn.ts +1474 -0
  224. package/src/server/sanitize-assistant-text.ts +112 -0
  225. package/src/server/session-export.ts +220 -0
  226. package/src/server/session-queue.ts +376 -0
  227. package/src/server/session-workdir.ts +49 -0
  228. package/src/server/sse-h2-safe.ts +61 -0
  229. package/src/server/sse-liveness.ts +162 -0
  230. package/src/server/sse-serializer.ts +161 -0
  231. package/src/server/start-turn.ts +249 -0
  232. package/src/server/steer-inbox.ts +107 -0
  233. package/src/server/tls-keeper.ts +153 -0
  234. package/src/server/tool-format.ts +167 -0
  235. package/src/server/turn-framing.ts +52 -0
  236. package/src/server/turn-origin-kind.ts +74 -0
  237. package/src/server/turn-origin.ts +40 -0
  238. package/src/server/work-ledger.ts +975 -0
  239. package/src/server/workspace.ts +114 -0
  240. package/src/setup/config-edit.ts +201 -0
  241. package/src/setup/presets.ts +71 -0
  242. package/src/setup/prompt.ts +163 -0
  243. package/src/setup/tailscale.ts +44 -0
  244. package/src/skills/bin-checks.ts +227 -0
  245. package/src/skills/bootstrap.ts +347 -0
  246. package/src/skills/env-scope.ts +175 -0
  247. package/src/skills/gating.ts +71 -0
  248. package/src/skills/lint.ts +202 -0
  249. package/src/skills/load.ts +368 -0
  250. package/src/skills/path-helpers.ts +102 -0
  251. package/src/skills/registry.ts +178 -0
  252. package/src/ssh/exec.ts +142 -0
  253. package/src/ssh/index.ts +12 -0
  254. package/src/ssh/known-hosts.ts +109 -0
  255. package/src/ssh/pool.ts +307 -0
  256. package/src/storage/sessions.ts +602 -0
  257. package/src/team/render.ts +149 -0
  258. package/src/team/resolve.ts +122 -0
  259. package/src/team/store.ts +124 -0
  260. package/src/team/types.ts +111 -0
  261. package/src/team/write.ts +95 -0
  262. package/src/testing/isolated-home.mts +46 -0
  263. package/src/tmux/attention-watcher.ts +272 -0
  264. package/src/tmux/attention.ts +336 -0
  265. package/src/tmux/list.ts +91 -0
  266. package/src/tmux/origin-store.ts +102 -0
  267. package/src/tmux/tui-markers.ts +267 -0
  268. package/src/tools/agents/ask-cancel.ts +94 -0
  269. package/src/tools/agents/ask-result.ts +235 -0
  270. package/src/tools/agents/ask.ts +704 -0
  271. package/src/tools/agents/builder-dispatch.ts +217 -0
  272. package/src/tools/agents/images.ts +104 -0
  273. package/src/tools/agents/index.ts +42 -0
  274. package/src/tools/agents/long-task-timeouts.ts +39 -0
  275. package/src/tools/agents/session-list.ts +136 -0
  276. package/src/tools/agents/session-model.ts +106 -0
  277. package/src/tools/agents/spawn.ts +845 -0
  278. package/src/tools/agents/status.ts +589 -0
  279. package/src/tools/browser/index.ts +6 -0
  280. package/src/tools/browser/ops.ts +145 -0
  281. package/src/tools/browser/tools.ts +184 -0
  282. package/src/tools/builder/short-descriptions.ts +80 -0
  283. package/src/tools/builder/tools.ts +222 -0
  284. package/src/tools/docs/index.ts +1 -0
  285. package/src/tools/docs/tools.ts +228 -0
  286. package/src/tools/dream/index.ts +11 -0
  287. package/src/tools/dream/tools.ts +1002 -0
  288. package/src/tools/exec/allowlist.ts +233 -0
  289. package/src/tools/exec/background-detach.helper.mts +27 -0
  290. package/src/tools/exec/blacklist.ts +336 -0
  291. package/src/tools/exec/concurrency.ts +150 -0
  292. package/src/tools/exec/fit-output.ts +82 -0
  293. package/src/tools/exec/index.ts +7 -0
  294. package/src/tools/exec/internal-env.ts +89 -0
  295. package/src/tools/exec/job-store.ts +403 -0
  296. package/src/tools/exec/local.ts +649 -0
  297. package/src/tools/exec/remote.ts +399 -0
  298. package/src/tools/exec/tools.ts +934 -0
  299. package/src/tools/file/analyze.ts +378 -0
  300. package/src/tools/file/index.ts +2 -0
  301. package/src/tools/file/local.ts +707 -0
  302. package/src/tools/file/lsp-hook.ts +72 -0
  303. package/src/tools/file/persona-guard.ts +61 -0
  304. package/src/tools/file/policy.ts +292 -0
  305. package/src/tools/file/read-format.ts +129 -0
  306. package/src/tools/file/remote.ts +680 -0
  307. package/src/tools/file/replace.ts +507 -0
  308. package/src/tools/file/search-window.ts +224 -0
  309. package/src/tools/file/tools.ts +658 -0
  310. package/src/tools/file/write-scope.ts +182 -0
  311. package/src/tools/gating.ts +106 -0
  312. package/src/tools/image/budget.ts +82 -0
  313. package/src/tools/image/index.ts +7 -0
  314. package/src/tools/image/tools.ts +601 -0
  315. package/src/tools/index.ts +99 -0
  316. package/src/tools/memory/index.ts +12 -0
  317. package/src/tools/memory/tools.ts +399 -0
  318. package/src/tools/projects/index.ts +1 -0
  319. package/src/tools/projects/tools.ts +643 -0
  320. package/src/tools/registry.ts +427 -0
  321. package/src/tools/resources/index.ts +8 -0
  322. package/src/tools/resources/tools.ts +176 -0
  323. package/src/tools/resources/visibility.ts +60 -0
  324. package/src/tools/sentinel/index.ts +1 -0
  325. package/src/tools/sentinel/tools.ts +592 -0
  326. package/src/tools/skill/index.ts +4 -0
  327. package/src/tools/skill/tools.ts +285 -0
  328. package/src/tools/time/index.ts +5 -0
  329. package/src/tools/time/tools.ts +123 -0
  330. package/src/tools/tmux/index.ts +1 -0
  331. package/src/tools/tmux/local.ts +277 -0
  332. package/src/tools/tmux/remote.ts +168 -0
  333. package/src/tools/tmux/tools.ts +1064 -0
  334. package/src/tools/tool-output.ts +97 -0
  335. package/src/tools/types.ts +227 -0
  336. package/src/tools/video/index.ts +1 -0
  337. package/src/tools/video/tools.ts +425 -0
  338. package/src/tools/web/fetch.ts +337 -0
  339. package/src/tools/web/index.ts +4 -0
  340. package/src/tools/web/tools.ts +186 -0
  341. package/src/tools/wiki/index.ts +1 -0
  342. package/src/tools/wiki/tools.ts +445 -0
  343. package/src/tts/cache-gc.ts +128 -0
  344. package/src/tts/prepare-for-tts.ts +114 -0
  345. package/src/tts/service.ts +332 -0
  346. package/src/types/events.ts +695 -0
  347. package/src/types/turn-origin.ts +53 -0
  348. package/src/version.ts +21 -0
  349. package/src/videogen/dialects.ts +222 -0
  350. package/src/videogen/generate.ts +484 -0
  351. package/src/videogen/jobs.ts +178 -0
  352. package/src/videogen/runner.ts +125 -0
  353. package/src/videogen/wake.ts +119 -0
  354. package/src/voice/realtime/call.ts +948 -0
  355. package/src/voice/realtime/consult.ts +293 -0
  356. package/src/voice/realtime/fake-provider.ts +134 -0
  357. package/src/voice/realtime/manager.ts +384 -0
  358. package/src/voice/realtime/openai-provider.ts +471 -0
  359. package/src/voice/realtime/persona.ts +227 -0
  360. package/src/voice/realtime/session-match.ts +116 -0
  361. package/src/voice/realtime/types.ts +182 -0
  362. package/src/wiki/conflict.ts +113 -0
  363. package/src/wiki/explorer.ts +578 -0
  364. package/src/wiki/index-builder.ts +172 -0
  365. package/src/wiki/language.ts +134 -0
  366. package/src/wiki/log-builder.ts +150 -0
  367. package/src/wiki/map.ts +258 -0
  368. package/src/wiki/migration/analyze.ts +304 -0
  369. package/src/wiki/migration/execute.ts +689 -0
  370. package/src/wiki/migration/refine.ts +402 -0
  371. package/src/wiki/migration/store.ts +100 -0
  372. package/src/wiki/move-page.ts +57 -0
  373. package/src/wiki/structure-file.ts +192 -0
  374. package/src/wiki/taxonomy.ts +140 -0
  375. package/src/wiki/templates.ts +163 -0
  376. package/src/wiki/types.ts +133 -0
  377. package/templates/skills/README.md +24 -0
  378. package/templates/skills/_templates/api-wrapper/SKILL.md +26 -0
  379. package/templates/skills/_templates/cli-wrapper/BOOTSTRAP.md +32 -0
  380. package/templates/skills/_templates/cli-wrapper/SKILL.md +24 -0
  381. package/templates/skills/_templates/default/SKILL.md +25 -0
  382. package/templates/skills/builder-handover/SKILL.md +96 -0
  383. package/templates/skills/builder-handover/assets/ORDER.md +12 -0
  384. package/templates/skills/skill-author/SKILL.md +110 -0
  385. package/tsconfig.json +22 -0
  386. package/web/dist/assets/index-BaVv6pB2.js +631 -0
  387. package/web/dist/assets/index-BaVv6pB2.js.map +1 -0
  388. package/web/dist/assets/index-V3FV3Z25.css +32 -0
  389. package/web/dist/favicon.svg +8 -0
  390. package/web/dist/index.html +20 -0
  391. package/web/package.json +36 -0
  392. package/web/tsconfig.json +25 -0
  393. package/web-mobile/dist/apple-touch-icon.png +0 -0
  394. package/web-mobile/dist/assets/index-BqKt7IMx.css +1 -0
  395. package/web-mobile/dist/assets/index-X_vRr6cd.js +88 -0
  396. package/web-mobile/dist/assets/index-X_vRr6cd.js.map +1 -0
  397. package/web-mobile/dist/favicon.svg +8 -0
  398. package/web-mobile/dist/icon-192.png +0 -0
  399. package/web-mobile/dist/icon-512.png +0 -0
  400. package/web-mobile/dist/index.html +27 -0
  401. package/web-mobile/dist/manifest.webmanifest +32 -0
  402. package/web-mobile/dist/service-worker.js +90 -0
  403. package/web-mobile/package.json +28 -0
  404. package/web-mobile/tsconfig.json +25 -0
package/docs/setup.md ADDED
@@ -0,0 +1,1217 @@
1
+ # Setup
2
+
3
+ > End-to-end install for somora as a long-running service on your
4
+ > machine. The short way is the installer plus the setup assistant
5
+ > (next section); the numbered sections after it are the same steps by
6
+ > hand, with the background for each. A short dev-from-checkout section
7
+ > sits at the bottom for contributors.
8
+
9
+ ## The short way: installer + assistant
10
+
11
+ ```bash
12
+ curl -fsSL https://somora.ai/install.sh | bash
13
+ ```
14
+
15
+ Run it as the user who will own somora — not as root; the agents get
16
+ that user's rights. What it does, each step skipped when already in
17
+ place:
18
+
19
+ | Step | What happens | Needs admin rights |
20
+ |---|---|---|
21
+ | System packages | tmux, ripgrep, git, a C/C++ compiler, python3 — through apt, dnf, pacman, zypper or Homebrew | yes, asked first; without them the compiler is the only hard stop |
22
+ | Node.js | kept when ≥22.13; otherwise Node 24 system-wide (NodeSource / Homebrew) or, without admin rights, the official build into `~/.local/share/somora/node` (checksum-verified) | only for the system-wide variant |
23
+ | npm folder | when npm's global folder is not writable for you, it moves to `~/.npm-global` and is added to your `PATH` | no |
24
+ | somora | `npm install -g somora` | no |
25
+ | Service | `somora init`, enabled at boot, lingering on so it survives logout | no (lingering may ask) |
26
+ | Assistant | `somora setup` | no |
27
+
28
+ Options go after `bash -s --`, or as environment variables:
29
+
30
+ ```bash
31
+ curl -fsSL https://somora.ai/install.sh | bash -s -- --no-setup # stop before the assistant
32
+ curl -fsSL https://somora.ai/install.sh | bash -s -- --version 2026.930.1
33
+ curl -fsSL https://somora.ai/install.sh | bash -s -- --yes --no-sudo # no questions, no admin rights
34
+ ```
35
+
36
+ `--yes` (`SOMORA_YES=1`), `--no-setup`, `--no-service`, `--no-sudo`,
37
+ `--version <v>` (`SOMORA_VERSION`). `https://somora.ai/install.sh` always
38
+ serves the script of the latest release; the same file is attached to
39
+ every GitHub release as `install.sh`.
40
+
41
+ ### `somora setup` — the assistant
42
+
43
+ ```bash
44
+ somora setup # all steps
45
+ somora setup access # one step: models | agent | memory | team | access | start
46
+ ```
47
+
48
+ | Step | What it does |
49
+ |---|---|
50
+ | `models` | Claude subscription (installs Claude Code if missing, runs its login), ChatGPT subscription (the bundled Codex login, browser or device code), or your own OpenAI-compatible server (asks the address, lists its models, asks the context window). Writes the `providers:` block with the tested settings from [models.md](models.md). |
51
+ | `agent` | Creates the first agent: name, how it addresses you, answer language, model, backup model. On an existing install it lists the agents and offers to repair one whose model no longer exists. |
52
+ | `memory` | Turns on REM per agent (with its own model), the duplicate check for new notes, and the shared wiki with Deep and Lucid — in a new folder or an existing Obsidian vault ([dream-phases.md](dream-phases.md), [wiki.md](wiki.md)). |
53
+ | `team` | With two or more agents: writes the first `team.yaml` ([team.md](team.md)). |
54
+ | `access` | This machine only, local network, or **Tailscale HTTPS**: installs and connects Tailscale if needed, walks you through the one switch in the Tailscale admin page, fetches the certificate and turns on automatic renewal. |
55
+ | `start` | Starts (or, after asking, restarts) the service, waits until it answers, sends the agent a real test message and says which model replied. |
56
+
57
+ The assistant never rewrites a file wholesale: comments and your own
58
+ settings in `config.yaml` / `agent.yaml` stay, the previous version is
59
+ kept next to the file as `<name>.bak-setup-<date>-<time>`, and a result
60
+ the server could not load is not written at all.
61
+
62
+ ## 1. System prereqs
63
+
64
+ Hard requirements:
65
+
66
+ | Tool | Why | Install |
67
+ |---|---|---|
68
+ | **Node ≥22.13** | runtime + native `node:sqlite`; every `somora` command refuses to start on an older Node and prints the upgrade steps, `somora update` checks the target release before building | [nodejs.org](https://nodejs.org/) or `nvm install 22` |
69
+ | **tmux** | the `tmux` tool + the web tmux app | `sudo apt install tmux` (Debian/Ubuntu) · `brew install tmux` (macOS) · `sudo dnf install tmux` (Fedora) |
70
+ | **ripgrep** (`rg`) | needed by `file_search` | `sudo apt install ripgrep` · `brew install ripgrep` · `sudo dnf install ripgrep` |
71
+ | **git** | clone the repo | usually pre-installed; otherwise package-manage |
72
+
73
+ Optional, per feature:
74
+
75
+ | Tool | Why | Install |
76
+ |---|---|---|
77
+ | **Chromium / Chrome** | the shared `browser` tool ([browser.md](browser.md)) — auto-detected, or set `browser.executablePath` | `sudo apt install chromium` · `brew install --cask chromium` · `sudo dnf install chromium` |
78
+ | **Xvfb** | `browser.headed: true` on a host without a display (a virtual screen so Chromium runs with a window and does not announce itself as headless) | `sudo apt install xvfb` · `sudo dnf install xorg-x11-server-Xvfb` · `sudo pacman -S xorg-server-xvfb` · macOS: not needed |
79
+
80
+ C/C++ toolchain — `npm install` builds two native modules
81
+ (`better-sqlite3` for SQLite, `@huggingface/transformers`'s ONNX runtime
82
+ for local embeddings). Both ship prebuilt binaries for the common
83
+ platforms; if your build falls through to source you'll need
84
+ `build-essential` / Xcode CLT / equivalent.
85
+
86
+ ## 2. At least one LLM backend
87
+
88
+ Pick one or more. somora doesn't care which you use, but at least one
89
+ must be installed and authenticated before the first chat (§5).
90
+
91
+ **Claude (recommended)** — Anthropic's Claude Code CLI uses your Claude
92
+ subscription, no API key needed:
93
+
94
+ ```bash
95
+ curl -fsSL https://claude.ai/install.sh | bash # installs to ~/.local/bin/claude
96
+ claude auth login
97
+ ```
98
+
99
+ **ChatGPT** — the Codex engine uses your ChatGPT subscription. Codex is
100
+ bundled with somora (no separate install), so this login step comes
101
+ **after** [§4 Install somora](#4-install-somora):
102
+
103
+ ```bash
104
+ somora codex login # ChatGPT Plus/Pro/Business; an existing `codex login` is picked up too
105
+ ```
106
+
107
+ **Local models** — Ollama, LM Studio, vLLM, or oMLX. Install separately
108
+ per their docs and have a `/v1/chat/completions` endpoint reachable on
109
+ some `http://host:port`. somora talks to them via the `openai-compatible`
110
+ engine — see [§6 Configuring providers](#6-configuring-providers) for
111
+ the config block.
112
+
113
+ ## 3. Optional but recommended
114
+
115
+ | Tool | Unlocks | Install |
116
+ |---|---|---|
117
+ | **Obsidian** | the wiki layer + read-only vault recall | [obsidian.md](https://obsidian.md/) |
118
+ | **Tailscale** | HTTPS for the web client (lifts the 6-connection browser limit, unlocks mic/screenshot APIs) | [tailscale.com](https://tailscale.com/) |
119
+
120
+ Without Obsidian: somora still works (memory inbox per agent, sessions,
121
+ all tools), you just lose the long-term shared wiki layer.
122
+
123
+ Without Tailscale: the web client falls back to plain HTTP/1.1 and is
124
+ single-window-only; the TUI is unaffected.
125
+
126
+ ## 4. Install somora
127
+
128
+ ```bash
129
+ npm install -g somora
130
+ ```
131
+
132
+ The package carries the built web clients and a pinned dependency tree
133
+ (`npm-shrinkwrap.json`), so every install gets exactly the versions the
134
+ release was tested with. One native module (`node-pty`) is compiled
135
+ during the install on Linux — that is what the compiler from §1 is for.
136
+
137
+ If npm answers `EACCES`, its global folder belongs to root. Give npm a
138
+ folder of your own instead of reaching for `sudo`:
139
+
140
+ ```bash
141
+ npm config set prefix ~/.npm-global
142
+ echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.profile && source ~/.profile
143
+ ```
144
+
145
+ ## 5. Start the server + chat
146
+
147
+ ```bash
148
+ somora init # creates ~/.somora/ + writes the systemd user-service unit
149
+ somora server start # starts the unit and enables it at boot
150
+ somora tui # opens the TUI against the running server
151
+ ```
152
+
153
+ `somora init` is idempotent and one-time: it creates `~/.somora/`
154
+ (config + lockfile + logs land here) and writes the systemd unit at
155
+ `~/.config/systemd/user/somora.service` with `ExecStart` baked to your
156
+ freshly installed global binary. From then on, `somora server start`
157
+ just brings the unit up; the server runs in the background and
158
+ survives logout / reboot. To stop / restart / inspect:
159
+
160
+ ```bash
161
+ somora server stop
162
+ somora server restart
163
+ somora server status
164
+ journalctl --user -u somora -f # tail logs
165
+ ```
166
+
167
+ If you don't want systemd (e.g. on macOS, in a container, or while
168
+ debugging):
169
+
170
+ ```bash
171
+ somora server start --foreground # blocks the terminal; Ctrl-C to stop
172
+ ```
173
+
174
+ ### Updating somora
175
+
176
+ ```bash
177
+ somora update # the current release
178
+ somora update --edge # the newest build on npm, incl. pre-releases
179
+ somora update 2026.930.1 # a specific version
180
+ ```
181
+
182
+ `somora update` asks npm for the target version, checks that your
183
+ Node.js is new enough for it, installs it (`npm install -g somora@<v>`),
184
+ re-runs `somora init` so the systemd unit's `ExecStart` points at the
185
+ freshly installed binary, then restarts the service. When you are
186
+ already on that version it does nothing (`--force` reinstalls). Pass
187
+ `--no-reinit` to skip the unit rebake if you've hand-edited
188
+ `somora.service`.
189
+
190
+ Version numbers are dates: `2026.930.1` is the first build of
191
+ 30 September 2026, `2026.1005.2` the second of 5 October. Versions up
192
+ to `2026.09.29.12` (four parts) predate the npm package and were
193
+ installed from a git checkout; their `somora update` still works and
194
+ brings you onto the npm package.
195
+
196
+ #### Recovering an upgrade that didn't take effect
197
+
198
+ The systemd unit's `ExecStart` is baked in by whichever copy of somora
199
+ ran `somora init`. If you initially ran `init` from a git checkout
200
+ (common for early adopters), the unit pins to that checkout path:
201
+
202
+ ```
203
+ ExecStart=/home/<you>/somora/bin/somora.mjs server start --foreground
204
+ ```
205
+
206
+ A subsequent `npm install -g <tarball>` then has no effect on the
207
+ running service — systemd keeps launching the checkout binary, which
208
+ serves its old `web/dist`. Symptom: new features missing in the web UI
209
+ even after install + restart.
210
+
211
+ To spot it:
212
+
213
+ ```bash
214
+ systemctl --user cat somora.service | grep ExecStart
215
+ # good: ExecStart=/home/<you>/.npm-global/lib/node_modules/somora/bin/somora.mjs ...
216
+ # bad: ExecStart=/home/<you>/somora/bin/somora.mjs ... (← checkout, not global)
217
+ ```
218
+
219
+ `somora update` re-bakes the unit automatically. If the unit still
220
+ points at a checkout, run the manual fix once:
221
+
222
+ ```bash
223
+ "$(npm root -g)"/somora/bin/somora.mjs init
224
+ systemctl --user daemon-reload
225
+ systemctl --user restart somora.service
226
+ # or, for a config.yaml edit that touches models, providers, caps, tools:
227
+ # the gear menu in the web taskbar → Reload config, or /reload in the TUI
228
+ curl -ks https://<host>:18737/version
229
+ ```
230
+
231
+ Hard-reload the browser (Ctrl+Shift+R / Cmd+Shift+R) after so it
232
+ doesn't serve a cached JS bundle from before the upgrade.
233
+
234
+ On first start somora creates `~/.somora/`:
235
+
236
+ ```
237
+ ~/.somora/
238
+ ├── config.yaml ← server config (created with sane defaults)
239
+ ├── agents/
240
+ │ └── default/ ← seed agent created on first run; rename / customize
241
+ │ ├── AGENTS.md
242
+ │ ├── SOUL.md
243
+ │ ├── USER.md
244
+ │ └── agent.yaml
245
+ ├── index/
246
+ │ └── shared.db ← vault + wiki retrieval index, one per instance (derived, rebuilt if deleted)
247
+ └── logs/
248
+ └── server.YYYY-MM-DD.1.log
249
+ ```
250
+
251
+ The log rolls daily. You do not need a shell to read it: the **log**
252
+ tile in the web client shows the end of a day's file with filters for
253
+ level, agent and text ([web.md](web.md)).
254
+
255
+ ### Optional: tell the agents who is who
256
+
257
+ With more than one agent, write `~/.somora/team.yaml` (start with
258
+ `somora team init --principal "<your name>"`) so every agent gets the
259
+ org chart and "who to involve for what" in its prompt. See
260
+ [team.md](team.md).
261
+
262
+ ## 6. Configuring providers
263
+
264
+ Edit `~/.somora/config.yaml`. The shipped default has just one provider
265
+ (Anthropic via Claude Code subscription) and is enough to chat with
266
+ Claude. Add more providers as needed.
267
+
268
+ ### Anthropic via Claude Code subscription (no API key)
269
+
270
+ ```yaml
271
+ providers:
272
+ anthropic:
273
+ engine: claude-cli
274
+ models:
275
+ - id: claude-opus-5
276
+ alias: opus
277
+ contextWindow: 1000000
278
+ capabilities: [text, image, pdf, reasoning]
279
+ ```
280
+
281
+ Requires the Claude Code CLI binary at `~/.local/bin/claude` (or set
282
+ `SOMORA_CLAUDE_BIN` env to its path). Auth is handled by the binary —
283
+ `claude login` once and somora rides on the resulting session.
284
+
285
+ ### OpenAI via Codex CLI subscription (no API key)
286
+
287
+ ```yaml
288
+ providers:
289
+ openai:
290
+ engine: codex-cli
291
+ models:
292
+ - id: gpt-5.6-terra
293
+ alias: terra
294
+ contextWindow: 258400 # the Codex session window, not the 1.05M API window
295
+ capabilities: [text, image, pdf, reasoning]
296
+ ```
297
+
298
+ `contextWindow: 258400` is deliberate: Codex runs a session against a
299
+ window it delivers itself and reports on every turn
300
+ (`modelContextWindow`, 258,400 for every model it offers), and on a
301
+ CLI engine the value does not trigger somora's compaction anyway — it
302
+ only decides whether the model is picked as a compaction worker and
303
+ what the header percentage claims. See
304
+ [compaction.md](compaction.md#what-contextwindow-really-controls--per-engine)
305
+ and [models.md](models.md).
306
+
307
+ <a id="codex"></a>
308
+ Codex is **bundled** — `@openai/codex` is an exact-version dependency of
309
+ somora and runs as an app-server per turn; a global `codex` on the host
310
+ is ignored (`SOMORA_CODEX_BIN` remains as a debugging override). Auth:
311
+ `somora codex login` (ChatGPT Plus/Pro/Business). somora keeps its own
312
+ Codex home at `~/.somora/codex-home` and mirrors `auth.json` from
313
+ `~/.codex` on every turn, so a login done with a global Codex CLI works
314
+ as well. `somora codex debug models` shows the model catalog the bundled
315
+ version sees.
316
+
317
+ somora's tools reach Codex as dynamic tools. `codexCli.directTools`
318
+ (config.yaml) names the tools kept in the model's direct tool list every
319
+ turn; everything else is deferred and found via Codex tool search (or
320
+ `ALL_TOOLS` inside Code Mode on the GPT-5.6/GPT-6 models). The default
321
+ is the everyday core: memory_*, file_*, exec, tmux, web_*, time_now,
322
+ agent_ask, agent_ask_result, spawn_subagent, subagent_result, somora_docs_*.
323
+
324
+ ### xAI via Grok Build CLI subscription (no API key)
325
+
326
+ ```yaml
327
+ providers:
328
+ xai:
329
+ engine: grok-cli
330
+ models:
331
+ - id: grok-4.5
332
+ alias: grok
333
+ contextWindow: 500000
334
+ capabilities: [text, reasoning]
335
+ ```
336
+
337
+ Requires the Grok Build CLI (`grok`) on PATH — installed via
338
+ `curl -fsSL https://x.ai/cli/install.sh | bash`, which drops the binary
339
+ at `~/.local/bin/grok`. Override with `SOMORA_GROK_BIN` if it lives
340
+ elsewhere.
341
+
342
+ Auth is handled by the binary: run `grok login` once, which writes a
343
+ session to `~/.grok/auth.json`. somora's adapter connects over ACP
344
+ (Agent Client Protocol — JSON-RPC on stdio, `grok agent stdio`) and the
345
+ handshake picks up that session as the `cached_token` auth method
346
+ automatically. **A SuperGrok / Premium subscription authenticates the
347
+ CLI, not the xAI API** — so this path uses your subscription, while
348
+ pointing an `openai-compatible` provider at `https://api.x.ai/v1`
349
+ would bill a separate pay-per-token API account instead.
350
+
351
+ `grok-4.5` reports three reasoning efforts (low / medium / high,
352
+ default high), so somora's `/thinking` knob maps straight through. Give
353
+ the model the `reasoning` capability to activate it. Note there's no
354
+ "disabled" state — `/thinking off` maps to `low`.
355
+
356
+ **Tools.** somora's full MCP surface (memory, file_*, exec, wiki,
357
+ subagents, …) is handed to the ACP session via
358
+ `session/new`'s `mcpServers` parameter, scoped to the current
359
+ agent+session exactly like claude-cli and codex-cli. On top of that
360
+ Grok Build brings its own file/shell tools, scoped to the working
361
+ directory (`$HOME`).
362
+
363
+ Grok reaches MCP tools through a `search_tool` / `use_tool`
364
+ indirection rather than listing all of them up front, which keeps a
365
+ large surface cheap context-wise. The adapter unwraps that: a
366
+ `use_tool{tool_name:'somora__memory_list'}` call is recorded as
367
+ `mcp__somora__memory_list`, so session logs and tool rows match
368
+ what the other engines emit. The `search_tool` probes themselves
369
+ surface as-is.
370
+
371
+ Budget note: the tool catalogue is not free. A trivial two-tool turn
372
+ measured ~76k input tokens on a fresh session, ~108k on the follow-up,
373
+ with most of it served from cache (`tokens_in_cached`). Against
374
+ grok-4.5's 500k window that's comfortable, and on a subscription it
375
+ costs nothing extra — but it's worth knowing before pointing an
376
+ API-billed provider at the same setup.
377
+
378
+ Sessions resume across turns via `session/load` against the
379
+ `grokSessionId` stashed in session-meta.
380
+
381
+ **Attachments.** Grok Build exposes no attachment channel over ACP —
382
+ the handshake reports `promptCapabilities.image: false`. Images and
383
+ PDFs therefore never reach the engine: the capability gate in
384
+ `run-turn.ts` refuses them first, since `grok-4.5` declares neither
385
+ `image` nor `pdf`, and the user gets "does not support image inputs"
386
+ before a process is spawned. Text attachments pass the gate and are
387
+ inlined into the prompt, the same way codex-cli handles its non-image
388
+ attachments. Anything else that somehow arrives is named to the model
389
+ as undeliverable and recorded as an `engine_meta` item of type
390
+ `attachments_unsupported` — never dropped silently.
391
+
392
+ **API failures surface as errors.** xAI reports a spent balance or a
393
+ blocked subscription on the proprietary `_x.ai/*` channel — a
394
+ `retry_state{type:'failed'}` frame plus `turn_completed` with
395
+ `stop_reason: 'error'` — not through the ACP error channel. The
396
+ adapter reads both and emits a somora `error` event carrying the
397
+ message (e.g. *"API error (status 402 Payment Required): Grok Build
398
+ usage balance exhausted"*), so a configured `fallback:` model takes
399
+ over. Replayed frames from `session/load` are ignored via
400
+ `_meta.isReplay`, so a failure from an earlier turn cannot abort a
401
+ resumed one.
402
+
403
+ ### Local OpenAI-compatible LLM (Ollama, LM Studio, vLLM, oMLX, ...)
404
+
405
+ For this engine `contextWindow` is the compaction wall — set it to the
406
+ **server's** limit (`--max-model-len`, `--context-length`), not the
407
+ model card's. Recommended blocks per model family, with sampling and
408
+ reasoning vocabularies, are in [models.md](models.md).
409
+
410
+ ```yaml
411
+ providers:
412
+ local:
413
+ engine: openai-compatible
414
+ baseUrl: http://localhost:11434/v1 # adjust to your local server
415
+ apiKey: dummy # most local servers ignore this
416
+ models:
417
+ - id: llama3.3:70b
418
+ alias: llama
419
+ contextWindow: 131072
420
+ capabilities: [text]
421
+ - id: gemma-3-27b-it
422
+ alias: gemma
423
+ contextWindow: 131072
424
+ capabilities: [text, image]
425
+ ```
426
+
427
+ Multiple OpenAI-compatible providers can coexist — give each one a unique
428
+ name (`local`, `lmstudio`, `office`, …).
429
+
430
+ #### Reliability with smaller / local models
431
+
432
+ Smaller models (deepseek, kimi, and many local ones) drive the
433
+ OpenAI-compatible tool loop less reliably than the big hosted models.
434
+ Two well-documented failure modes show up: they re-issue the **same tool
435
+ call over and over** without registering the result, and they sometimes
436
+ **echo the provider's internal tool-result template** ("Use the results
437
+ below to formulate an answer…") as their reply instead of answering.
438
+ somora hardens this path so a weaker model degrades gracefully instead of
439
+ flooding you:
440
+
441
+ - **Duplicate tool calls in one round are collapsed** to a single
442
+ execution — the model still gets a result for every *distinct* call.
443
+ - **A per-turn tool-call budget** (`agentLoop.maxToolCallsPerTurn`,
444
+ default 30) stops a runaway that the round cap can't see, and forces a
445
+ clean final answer.
446
+ - **A budget notice at 75 %** of either cap: one user-role message
447
+ ("N rounds and M calls remain — wrap up") so a "read N things, then
448
+ summarise" task ends on its own instead of at the hard stop.
449
+ - **The forced final answer** is a user-role message, valid on every
450
+ backend (strict chat templates such as vLLM + Qwen reject a trailing
451
+ system message). If that call fails too, the turn returns a digest of
452
+ the last tool results instead of only an error line.
453
+ - **Output guards** detect a leaked template or a repeated-text loop in
454
+ the stream, cut it before it floods the window, and force one clean
455
+ no-tools answer.
456
+
457
+ None of this touches the `claude-cli` / `codex-cli` engines — they run
458
+ their own loop. It also stays out of the way of capable models, which
459
+ never trip these guards.
460
+
461
+ ```yaml
462
+ providers:
463
+ local:
464
+ engine: openai-compatible
465
+ models:
466
+ - id: some-strong-local-model
467
+ alias: big
468
+ contextWindow: 131072
469
+ capabilities: [text]
470
+ # Opt a trusted model back into parallel tool calls. Default is
471
+ # sequential (one call per round) because weak models fan out
472
+ # into large duplicate batches; a strong model doing independent
473
+ # reads can safely parallelise.
474
+ parallelToolCalls: true
475
+ - id: some-local-reasoning-model
476
+ alias: thinker
477
+ contextWindow: 262144
478
+ capabilities: [text, reasoning]
479
+ # Output cap sent as `max_tokens`. Unset = not sent, and vLLM then
480
+ # allows the whole remaining context — on a reasoning model, where
481
+ # thinking and answer share that budget, nothing else stops a
482
+ # runaway thinking phase. (Not the memory block's
483
+ # `memory.autoInject.maxTokens`, which caps injected input.)
484
+ maxTokens: 16384
485
+ # Which words this model accepts for somora's thinking levels and
486
+ # where they go in the request — see docs/thinking.md.
487
+ reasoning:
488
+ levels: { high: xhigh }
489
+ # Vendor-recommended sampling for this model; agent.yaml and the
490
+ # session override win per key — see docs/sampling.md.
491
+ sampling:
492
+ temperature: 1.0
493
+ top_p: 0.95
494
+
495
+ agentLoop:
496
+ maxToolCallsPerTurn: 30 # hard ceiling on tool calls per turn (openai-compatible)
497
+
498
+ thinkingContent: # the model's reasoning text in the clients — docs/thinking.md
499
+ capture: true # false drops it at the server (no SSE, no JSONL)
500
+ maxChars: 65536 # per-turn cap on what is persisted
501
+ ```
502
+
503
+ ## 7. Voice — STT + TTS (optional)
504
+
505
+ Voice is two independent toggles:
506
+
507
+ - **STT** (speech-to-text) — turns the mic button on for the web and
508
+ mobile-PWA chat. Tap, talk, tap again → transcript drops into the
509
+ draft.
510
+ - **TTS** (text-to-speech) — when you submit via mic and the per-chat
511
+ auto-play toggle is on, somora generates spoken audio for the
512
+ assistant reply and plays it. A Play-button on the bubble lets you
513
+ replay.
514
+
515
+ Both proxy through OpenAI-compatible endpoints on a provider you've
516
+ already configured. See [voice.md](voice.md) for the full picture
517
+ including the `/voice/turn` audio-in/audio-out endpoint for
518
+ integrations.
519
+
520
+ ### Speech-to-Text
521
+
522
+ When enabled, the web chat input grows a mic button next to send. Click
523
+ → record, click again → transcribe → text lands in the textarea ready to
524
+ send. Audio is forwarded to an OpenAI-compatible STT endpoint
525
+ (`POST /v1/audio/transcriptions`) and the result lands locally — never
526
+ travels via a cloud API unless you configure one.
527
+
528
+ Supported upstreams: **oMLX** (mlx-audio, Apple Silicon — full audio API
529
+ including TTS), **faster-whisper-server**, **OpenAI Whisper API**, and
530
+ anything else exposing the OpenAI audio shape. Configure once, switch
531
+ backends by editing one block.
532
+
533
+ ```yaml
534
+ stt:
535
+ enabled: true
536
+ provider: omlx # ← name of an entry in `providers`
537
+ model: mlx-community/whisper-large-v3-turbo
538
+ language: de # optional default hint (ISO 639-1)
539
+ ```
540
+
541
+ `stt.provider` must reference an existing `openai-compatible` provider
542
+ in your `providers` block — the STT call reuses its `baseUrl` and
543
+ `apiKey`. The STT model is **not** listed in `providers.<x>.models`;
544
+ keeping it separate keeps it out of chat-model pickers, agent-config
545
+ validation, and `/v1/models`.
546
+
547
+ The web mic button **auto-hides** when:
548
+ - the server reports `stt.enabled: false` (or the block is omitted)
549
+ - the browser lacks `MediaRecorder` / `navigator.mediaDevices.getUserMedia`
550
+ - the page wasn't loaded over a secure context (HTTPS — required by the
551
+ mic-permission API in most browsers; via Tailscale, that's already
552
+ satisfied)
553
+
554
+ ### Recommended model
555
+
556
+ `mlx-community/whisper-large-v3-turbo` is the practical sweet spot on
557
+ Apple Silicon: ~800M params, near-real-time on M-series chips,
558
+ multilingual incl. German, marginal quality difference vs. the full
559
+ large-v3. If oMLX flags the model as missing the HuggingFace
560
+ preprocessor/tokenizer files (MLX-converted repos sometimes ship
561
+ weights only), drop the upstream config JSONs in alongside the weights:
562
+
563
+ ```bash
564
+ cd ~/.omlx/models/whisper-large-v3-turbo
565
+ for f in preprocessor_config.json tokenizer.json special_tokens_map.json \
566
+ tokenizer_config.json generation_config.json; do
567
+ curl -L -O "https://huggingface.co/openai/whisper-large-v3-turbo/resolve/main/$f"
568
+ done
569
+ ```
570
+
571
+ ### Text-to-Speech
572
+
573
+ Mirror config for spoken replies. Same posture — proxies through an
574
+ OpenAI-compatible TTS endpoint (`POST /v1/audio/speech`) on a provider
575
+ you already have.
576
+
577
+ ```yaml
578
+ tts:
579
+ enabled: true
580
+ provider: omlx # ← references providers.omlx
581
+ model: fish-audio-s2-pro-8bit # whatever your upstream calls it
582
+ language: de
583
+ cache:
584
+ retentionDays: 7 # 0 disables GC
585
+ maxSizeMB: 500
586
+ reencode:
587
+ enabled: true # needs ffmpeg on $PATH
588
+ opusBitrateKbps: 24
589
+ clients:
590
+ web:
591
+ autoPlayVoiceReplies: false # initial toggle state for new sessions
592
+ allowUserOverride: true
593
+ mobile:
594
+ autoPlayVoiceReplies: false
595
+ allowUserOverride: true
596
+ ```
597
+
598
+ Auto-TTS for the normal chat fires **only** when all four hold:
599
+ `tts.enabled` is true, the user submitted via mic (`input_modality=voice`),
600
+ the per-session 🔊 toggle is on, and the assistant text is speakable
601
+ (no heavy code blocks / large tables). Otherwise the chat stays
602
+ text-only. The `🔊`/`🔇` toggle in the chat header is sticky per
603
+ session (`localStorage`).
604
+
605
+ Two flows are wired:
606
+
607
+ - **Normal chat auto-TTS** — voice input → spoken reply on web + mobile.
608
+ - **`POST /voice/turn`** — independent audio-in/audio-out endpoint
609
+ for panel/satellite/bridge integrations; always generates audio
610
+ regardless of toggles. See [voice.md](voice.md#voiceturn-endpoint).
611
+
612
+ System dependency: `ffmpeg` on `$PATH` if you want `tts.reencode.enabled`
613
+ (opus/m4a output). Without ffmpeg, set `reencode.enabled: false` and
614
+ clients receive plain WAV (larger, but works).
615
+
616
+ ## Tunables
617
+
618
+ These all live in `config.yaml` with conservative defaults; uncomment to
619
+ override. Full schema in [`src/config/types.ts`](../src/config/types.ts).
620
+
621
+ ```yaml
622
+ promptBudgets: # soft caps for static prompt text — warnings only, nothing is truncated
623
+ teamBlockChars: 3000 # the "# Your team" block per agent (docs/team.md)
624
+ personaFileChars: 8000 # each of AGENTS.md / SOUL.md / USER.md
625
+ personaTotalChars: 14000 # the three together — shown in the web Agent window
626
+
627
+ realtimeVoice: # talking to an agent (docs/realtime-voice.md)
628
+ enabled: false # off until a realtime provider and a key exist
629
+ provider: openai # openai | google | local
630
+ model: gpt-realtime-2.1-mini
631
+ apiKeyFile: ~/.somora/secrets/openai-realtime.key # a FILE, chmod 600 — never the key in config
632
+ # url: ws://127.0.0.1:8787/realtime # where to connect; omitted = OpenAI. Set it (and
633
+ # # provider: local) to use a service of your own that speaks
634
+ # # the same protocol — same adapter, no key needed on localhost
635
+ defaultVoice: alloy # ten exist: alloy ash ballad coral echo sage shimmer verse marin cedar
636
+ consultPolicy: always # auto | substantive | always — when the speaking model must ask the real agent
637
+ consult:
638
+ quickAnswerMs: 8000 # how long a spoken question waits on the agent (1000..120000);
639
+ # past it the voice says it handed the request over and keeps
640
+ # talking, the answer is read out when it lands
641
+ maxCallMinutes: 20 # hard stop; a standing call bills while nobody talks
642
+ allowAgentSwitch: false # move a call to another agent or session mid-conversation
643
+ turnDetection: { threshold: 0.4, prefixPaddingMs: 200, silenceDurationMs: 420 }
644
+ # Separate from `stt`/`tts`: those are dictation and spoken replies
645
+ # (docs/voice.md). A call needs a realtime-capable provider; a normal
646
+ # chat-completions endpoint cannot carry one.
647
+
648
+ compaction:
649
+ triggerRatio: 0.8 # fraction of the input budget (window minus the answer)
650
+ safetyCushionPairs: 4 # most-recent turns kept uncompacted
651
+ # modelOverride: opus # force a specific compaction worker model
652
+ # workers: [big-local, small-local] # who may summarise, in the order they are tried
653
+ # The trigger works off the token count the provider reported for the
654
+ # last request, and off somora's own ESTIMATE only until there is one
655
+ # (new session, model switch, provider without usage). When the backend
656
+ # nevertheless rejects a prompt as too long (400 "Prompt too long",
657
+ # "maximum context length", oMLX's prefill memory guard — typical after
658
+ # switching a long session from a 1M-window model to a 131k one), the
659
+ # openai-compatible engine forces a compaction down to the last
660
+ # exchange and retries the turn once; a second refusal surfaces as a
661
+ # plain-language error (switch model or /reset) instead of the raw 400.
662
+ # Compaction workers are picked from models whose engine has a one-shot
663
+ # path (claude-cli, codex-cli, openai-compatible): the smallest
664
+ # contextWindow that fits the range × 1.3 — which can be a
665
+ # subscription-backed CLI model. `workers:` replaces that pick with an
666
+ # ordered list of your own; a model that is not listed never
667
+ # summarises. Either way up to three workers are asked per compaction,
668
+ # so one refusing (busy host, rate limit, a route being reloaded)
669
+ # costs an attempt, not the compaction. Mechanics, and what
670
+ # contextWindow means on each engine, in docs/compaction.md.
671
+
672
+ agentLoop:
673
+ maxRounds: 8 # tool-call rounds per turn (openai-compatible)
674
+ toolCallTimeoutMs: 30000 # per-tool-call timeout for fast tools (memory, web, file, time)
675
+ longTaskDefaultTimeoutMs: 300000 # 5 min — slow A2A tools (agent_ask, subagent_result
676
+ # wait_until_done) when the caller passes no timeout_ms;
677
+ # also honoured inside the MCP child of the CLI engines
678
+ longTaskMaxTimeoutMs: 1800000 # 30 min — hard ceiling for those, even with an explicit
679
+ # timeout_ms; past it the tool answers state "pending", the
680
+ # work keeps running. claudeCli.mcpToolTimeoutMs and
681
+ # codexCli.toolTimeoutSec must be >= this.
682
+ execMaxConcurrentPerAgent: 8 # background exec jobs one agent may hold
683
+ execMaxConcurrentGlobal: 32 # … across all agents
684
+ wakeGraceMs: 3000 # when work an agent started and walked away from
685
+ # finishes (a late agent_ask answer, a background
686
+ # sub-agent, a rendered video), the agent is woken in
687
+ # the session it asked from — unless it fetched the
688
+ # result within this grace. 0..60000.
689
+ toolUsageReminder: true # short "call tools, don't narrate" block in the
690
+ # system prompt whenever the agent has tools.
691
+ # Tools reach the model through a separate API
692
+ # field, never through prompt text; smaller local
693
+ # models benefit from being told so explicitly.
694
+ # Constant text — one cache invalidation on
695
+ # rollout, none afterwards.
696
+
697
+ # Per-engine idle-event watchdog. If an engine produces no events
698
+ # (assistant_delta, tool_call, …) for this duration mid-turn, the
699
+ # turn is aborted so the per-session lock releases and the user
700
+ # sees a clean error instead of all agents looking dead. Dream
701
+ # workers (Deep/Lucid) bypass this — they run on their own path.
702
+ #
703
+ # While a tool call is in flight the threshold is automatically
704
+ # relaxed to the MCP tool timeout (claudeCli.mcpToolTimeoutMs /
705
+ # codexCli.toolTimeoutSec, 30 min by default), so a legitimately
706
+ # long-blocking tool (agent_ask, subagent_result wait_until_done)
707
+ # isn't cut off by the much shorter idle window — a genuinely dead
708
+ # child is still caught at the tool-timeout horizon.
709
+ # How long a model that was unreachable stays out of every cascade —
710
+ # the chat fallback chain, the REM worker chain and the compaction
711
+ # workers. The first cascade that hits the outage writes the model
712
+ # down; later turns start past it instead of paying the dead hop
713
+ # (~30 s each) again. A success clears the note early; a config
714
+ # reload or POST /models/availability/reset clears all of them.
715
+ fallback:
716
+ retryUnavailableMinutes: 60
717
+
718
+ engineWatchdog:
719
+ claudeCliIdleMs: 300000 # 5 min — subscription, fast first event
720
+ codexCliIdleMs: 300000 # 5 min — subscription, fast first event
721
+ grokCliIdleMs: 300000 # 5 min — same class as the other CLIs
722
+ openaiCompatibleIdleMs: 1200000 # 20 min — local LLMs can stream slowly;
723
+ # raise if your backend regularly silences
724
+ # for longer than 20 min mid-turn
725
+
726
+ # Per-subscriber write budget for SSE broadcasts. A healthy writeSSE
727
+ # finishes in microseconds; a wedged subscriber (mobile browser
728
+ # backgrounded, TCP receive window stuck at 0, dead-but-not-closed
729
+ # stream) can otherwise stall every following turn on that session
730
+ # until server restart. This is NOT a per-turn timeout — long-running
731
+ # tool calls and slow local LLMs are unaffected, because each
732
+ # individual event-write is still microseconds.
733
+ sse:
734
+ publishTimeoutMs: 10000 # 10 sec per single event-write; evict the
735
+ # subscriber on overrun and continue. Healthy
736
+ # writes never hit this; 2 orders of magnitude
737
+ # more than a normal write ever takes.
738
+ publishParallel: true # broadcast in parallel — one slow client
739
+ # never blocks the others. Flip to false only
740
+ # if you need strict serial delivery order.
741
+ heartbeatMs: 20000 # comment-frame heartbeat on every stream;
742
+ # clients treat > ~2 missed as a lost link.
743
+ deadAfterMs: 60000 # a subscriber whose heartbeat write has not
744
+ # completed for this long is dead: evicted
745
+ # (`sse.publish_evict_dead` in the log), socket
746
+ # destroyed. Catches vanished tabs / stuck
747
+ # TCP windows that never send FIN.
748
+ h2PingIntervalMs: 30000 # HTTP/2 PING per client session (TLS listener) …
749
+ h2PingTimeoutMs: 30000 # … no ACK within this → session destroyed
750
+ keepAliveDelayMs: 30000 # TCP keepalive on every socket
751
+
752
+ memory:
753
+ embedding:
754
+ provider: local # 'local' uses @huggingface/transformers (ONNX)
755
+ model: all-MiniLM-L6-v2 # alias or full HF repo path
756
+ chunking:
757
+ targetTokens: 400
758
+ overlapTokens: 80
759
+ autoInject:
760
+ queryTurns: 3 # current message + last-(N-1) turns as context
761
+ maxResults: 5 # top-N hits injected per turn
762
+ minScore: 0.35 # discard hits below this score (0..1)
763
+ maxTokens: 1500 # hard cap on the injected memory block
764
+ historyWeight: 0.3 # how much the previous turns steer the vector query
765
+ historyWeightShort: 0.55 # … for a message with only 1–2 content words
766
+ historyWeightEmpty: 0.8 # … for a message with none ("das solltest du wissen?")
767
+ historyTurnChars: 800 # head of each previous turn used for the blend
768
+ shortQueryBm25Weight: 0.5 # BM25 share for a 1–2-word question; null = hybrid default
769
+ hybrid:
770
+ vectorWeight: 0.7
771
+ bm25Weight: 0.3
772
+ slugMatchBoost: 1.5 # boost a page whose slug names a query word (1 = off)
773
+
774
+ # Projects (opt-in, off by default) — pointer-file manifests binding
775
+ # a chat session to a real-world thing (Obsidian notes, code dirs,
776
+ # URLs, remote-resource paths). When enabled, agents see six tools
777
+ # (entity_list, project_list, project_get, project_create,
778
+ # project_update, project_focus), the chat-header gets a project chip,
779
+ # and slash commands /projekt + /projects activate. See
780
+ # docs/projects.md for the full model.
781
+ #
782
+ # `entities` is a CURATED VOCABULARY — projects belong to one entity
783
+ # (e.g. "privat", "enovom"), and the agent must pick from this list
784
+ # at create time. Prevents STT mishearings from inventing phantom
785
+ # entities and gives you a free filter axis ("list all private
786
+ # projects"). Agents cannot extend this list via tools.
787
+ # projects:
788
+ # enabled: true
789
+ # entities:
790
+ # - slug: privat
791
+ # label: Privat
792
+ # - slug: enovom
793
+ # label: enovom GmbH
794
+ # # add as many as you need — these are YOURS to curate
795
+ ```
796
+
797
+ ### Engine-meta — codex todo_list
798
+
799
+ `codex-cli` (GPT-5.x and codex models) tracks an internal
800
+ plan/checklist while it works. Codex emits `item.completed` events with
801
+ `itemType: "todo_list"` every time the model marks a task done or adds
802
+ a new one. somora persists these to the session JSONL as `engine_meta`
803
+ records — they're available to:
804
+
805
+ - The chat UI when **show.tools** is enabled (web + TUI). Renders as
806
+ a dimmer block with a `◌ codex · plan` prefix to visually
807
+ differentiate from real tool calls. Expand to see the task list with
808
+ ✓ / → / ○ glyphs per status.
809
+ - The REM dream-worker, which scans session history to extract
810
+ memories. Codex plans appear in that history, so the agent can
811
+ retain "what was on my list yesterday" implicitly.
812
+ - The session export (`?format=markdown`), where plans render as
813
+ GitHub-style task lists.
814
+
815
+ Mobile PWA hides engine_meta entirely (mobile is intentionally a
816
+ text-only minimalist surface). The other engines emit their own
817
+ `engine_meta` rows through the same mechanism — a forced compaction,
818
+ a dropped sampling key or an adjusted reasoning effort on
819
+ `openai-compatible`, an undeliverable attachment on `grok-cli`, a
820
+ restarted session on any CLI engine.
821
+
822
+ Friendly labels live in
823
+ [`src/engine/engine-meta-labels.ts`](../src/engine/engine-meta-labels.ts)
824
+ — a tiny `engine → itemType → label` map. Unknown itemTypes fall back
825
+ to the raw string so future codex/SDK additions appear immediately,
826
+ just with a less-pretty label. No configuration needed.
827
+
828
+ ### Wiki + dream-system (optional but recommended)
829
+
830
+ The wiki layer enables long-term shared knowledge across all agents.
831
+ Requires an Obsidian vault. See [wiki.md](wiki.md) for the full
832
+ mental model.
833
+
834
+ ```yaml
835
+ obsidian:
836
+ vault: ~/Documents/Vault # required for the wiki to work
837
+
838
+ wiki:
839
+ enabled: true
840
+ vaultSubfolder: somora # → <vault>/somora/ becomes the wiki
841
+ language: de # de | en — section headings, default folders,
842
+ # index/log wording, prose language (docs/wiki.md)
843
+
844
+ deep: # Memory→Wiki consolidation
845
+ enabled: true
846
+ intervalHours: 12
847
+ model: opus # via claude-cli, subscription
848
+
849
+ lucid: # Wiki cleanup
850
+ enabled: true
851
+ intervalDays: 7
852
+ model: opus
853
+ requireApproval: true
854
+ maxCallsPerTurn: 3 # cap on wiki_* tool invocations during
855
+ # an active Lucid review-loop, per user
856
+ # turn. Forces per-page user confirmation
857
+ # for bigger plans. Raise (e.g. 5-10) if
858
+ # you regularly OK multi-page batches
859
+ # and the default 3 cuts off legitimate
860
+ # work. Resets on every user message.
861
+
862
+ search:
863
+ boostWiki: 1.4 # wiki hits rank above memory in retrieval
864
+ boostMemory: 0.85
865
+ boostVault: 0.65
866
+ overviewMaxChars: 4000 # wiki-overview block in the system prompt;
867
+ # snapshotted once per session, so this is
868
+ # paid once inside the cached prefix
869
+ overviewTopNSlugs: 30 # max sections listed when even the bare
870
+ # page list exceeds the budget
871
+ ```
872
+
873
+ Per-agent REM (session→memory extraction) is configured in each
874
+ `agent.yaml`, not here — see [agents.md](agents.md).
875
+
876
+ **Scheduler state files** — Deep and Lucid persist their cadence
877
+ to `~/.somora/dream-state/{deep,lucid}.json` so server restarts
878
+ don't reset the timer. Each file holds the last started / completed /
879
+ failed timestamps; the worker reads these at boot and schedules the
880
+ next run at `lastCompletedAt + interval`, with a 60 s startup grace
881
+ when the run is already overdue. Fresh installs get an `lastCompletedAt
882
+ = now` anchor on first boot so restart-storms before the first auto-
883
+ fire don't starve out the schedule.
884
+
885
+ You normally never touch these files. If you want to **force the
886
+ next auto-Deep/Lucid to fire sooner** without manually triggering
887
+ it, edit `lastCompletedAt` to an older timestamp (or delete the
888
+ file — the bootstrap anchor is rewritten on the next start). If
889
+ you want to **pause auto-firing** without disabling the worker,
890
+ set `lastCompletedAt` to a future timestamp.
891
+
892
+ ### Sentinel — proactive triggers (optional)
893
+
894
+ The trigger runtime that wakes agents on a schedule (see
895
+ [sentinel.md](sentinel.md)). One configuration knob:
896
+
897
+ ```yaml
898
+ sentinel:
899
+ completedRetentionDays: 7 # default; 0 disables auto-cleanup
900
+ ```
901
+
902
+ `completedRetentionDays` controls how long one-shot `at`-triggers
903
+ stay in the registry after they've fired. The scheduler sweeps at
904
+ boot and on each daily re-arm tick; older `completed` entries get
905
+ auto-deleted along with their history file. Set to 0 to disable
906
+ auto-cleanup entirely (manual `sentinel delete` only). Recurring
907
+ triggers don't auto-GC — they end up in `paused` or `error` and you
908
+ choose when to remove them.
909
+
910
+ ## HTTPS (Tailscale) — required for the web client at scale
911
+
912
+ The web client opens **one persistent SSE connection per chat window**.
913
+ Browsers cap HTTP/1.1 at 6 concurrent connections per origin, so a multi-
914
+ agent setup (plus tmux session attaches) hits that ceiling fast —
915
+ symptom: new chat tabs silently fail to send, agents seem unresponsive.
916
+
917
+ Solution: serve somora over **HTTP/2-over-TLS**. HTTP/2 multiplexes
918
+ every stream over a single TCP connection, lifting the limit entirely.
919
+ The same upgrade also unlocks secure-context-only browser APIs that the
920
+ roadmap depends on (mic / screenshare / clipboard write / push
921
+ notifications / service workers).
922
+
923
+ **somora's blessed path is Tailscale.** Tailscale issues
924
+ publicly-trusted Let's Encrypt certs for your tailnet's `*.ts.net`
925
+ hostnames, free, with a single command — Node + every browser accept
926
+ them with no warnings, no CA installs, and no manual cert pinning. If
927
+ you're not on Tailscale you'll need to wire up your own cert (mkcert
928
+ for LAN-only, or a real DNS-validated LE cert) — same config block,
929
+ different acquisition.
930
+
931
+ ### Set up TLS via Tailscale
932
+
933
+ 1. Install Tailscale on the somora host (`sudo tailscale up`).
934
+ 2. In the [Tailscale admin DNS panel](https://login.tailscale.com/admin/dns),
935
+ enable **MagicDNS** and **HTTPS Certificates** (one-time tailnet setting).
936
+ 3. Generate certs into `~/.somora/certs/`:
937
+
938
+ ```bash
939
+ mkdir -p ~/.somora/certs
940
+ cd ~/.somora/certs
941
+ tailscale cert <your-host>.<your-tailnet>.ts.net
942
+ ```
943
+
944
+ `tailscale status` shows your hostname; the FQDN is
945
+ `<host>.<tailnet>.ts.net`. The command writes
946
+ `<fqdn>.crt` (cert) and `<fqdn>.key` (private key, mode 0600).
947
+ 4. Reference them in `~/.somora/config.yaml`:
948
+
949
+ ```yaml
950
+ server:
951
+ host: 0.0.0.0 # REQUIRED for remote clients (default 127.0.0.1 = loopback only)
952
+ port: 18737
953
+ tls:
954
+ cert: ~/.somora/certs/<your-host>.<your-tailnet>.ts.net.crt
955
+ key: ~/.somora/certs/<your-host>.<your-tailnet>.ts.net.key
956
+ publicHost: <your-host>.<your-tailnet>.ts.net
957
+ ```
958
+
959
+ `host: 0.0.0.0` is what makes the server reachable from other machines
960
+ (LAN / Tailscale); the default `127.0.0.1` binds loopback-only. Keep
961
+ this in `config.yaml` (not as a `SOMORA_HOST` env in the systemd unit) —
962
+ config survives `somora update`, unit env does not (the update rebakes
963
+ the unit from a template). If you *do* need custom systemd env, put it in
964
+ a drop-in (`~/.config/systemd/user/somora.service.d/*.conf`) — drop-ins
965
+ survive the rebake; `somora init` also carries forward existing
966
+ `Environment=`/`EnvironmentFile=` lines and prints what it preserved.
967
+
968
+ `publicHost` MUST match the cert subject — strict TLS verification is
969
+ on. Internal MCP-child callers (subagent fallback in
970
+ `src/tools/agents/spawn.ts`) read this hostname from env at server
971
+ startup and use it for their own HTTPS callbacks; there is no
972
+ loopback bypass, everything goes through the one secure listener.
973
+ 5. Add `renew: tailscale` to the block (see [Cert renewal](#cert-renewal))
974
+ and restart somora. Connect with the full URL:
975
+ `https://<your-host>.<your-tailnet>.ts.net:18737/web/`. The `:port`
976
+ part is required because somora doesn't run on 443.
977
+
978
+ ### Cert renewal
979
+
980
+ Tailscale certs are valid for ~90 days. Add one line and somora takes
981
+ care of them:
982
+
983
+ ```yaml
984
+ server:
985
+ tls:
986
+ cert: ~/.somora/certs/<your-host>.<your-tailnet>.ts.net.crt
987
+ key: ~/.somora/certs/<your-host>.<your-tailnet>.ts.net.key
988
+ publicHost: <your-host>.<your-tailnet>.ts.net
989
+ renew: tailscale
990
+ ```
991
+
992
+ Twice a day the server asks Tailscale for a certificate that is good
993
+ for at least 30 more days (`tailscale cert --min-validity 720h`; it only
994
+ re-issues when the current one is closer to its end) and loads the new
995
+ pair **without a restart** — running turns are not interrupted. For
996
+ that, `tailscale cert` must work for the user somora runs as:
997
+
998
+ ```bash
999
+ sudo tailscale set --operator=$USER # once
1000
+ ```
1001
+
1002
+ `somora setup access` does both for you. Without `renew:` the server
1003
+ still watches the two files: renew them any way you like and the new
1004
+ certificate is served at the next check (log line
1005
+ `server.tls.reloaded`). A failed renewal is logged as
1006
+ `server.tls.renew_failed` with the reason; from 14 days before the end
1007
+ `server.tls.expires_soon` warns on every check.
1008
+
1009
+ ### Without Tailscale
1010
+
1011
+ Drop in any cert + key — the config doesn't care about the issuer, only
1012
+ that the file paths point at valid PEM. For local LAN dev,
1013
+ [mkcert](https://github.com/FiloSottile/mkcert) is the cleanest
1014
+ non-Tailscale option (`mkcert -install` once per device, then
1015
+ `mkcert <host>.local 192.168.x.y`). Self-signed (without an installed
1016
+ CA) will work but every browser will scream — only acceptable for
1017
+ single-developer scratch use.
1018
+
1019
+ ### Falling back to plain HTTP
1020
+
1021
+ Omit the `server.tls` block entirely. somora reverts to HTTP/1.1 plain.
1022
+ You'll keep the 6-connection limit and lose secure-context features.
1023
+ Fine for single-window dev, no good for multi-agent daily use.
1024
+
1025
+ ## Mobile PWA — `/mobile`
1026
+
1027
+ somora ships a second web client at `/mobile` aimed at phones. It's a
1028
+ PWA — installable to your home screen on iOS / Android, runs in
1029
+ standalone-app mode with no browser chrome. Minimal-scope by design:
1030
+ chat only, no tmux / no file viewer / no multi-window layout. See
1031
+ [mobile.md](mobile.md) for the full feature scope, install flow per
1032
+ platform, and configuration knobs.
1033
+
1034
+ Installing:
1035
+
1036
+ 1. On the phone, with Tailscale connected, visit
1037
+ `https://<your-host>.<your-tailnet>.ts.net:18737/mobile/` in Safari
1038
+ (iOS) or Chrome (Android).
1039
+ 2. **iOS:** share menu → "Add to Home Screen".
1040
+ 3. **Android:** Chrome's install banner, or menu → "Install app".
1041
+
1042
+ Build pipeline: `build:mobile` script alongside `build:web`, both run
1043
+ by `build:all` and triggered by the `prepack` hook on `npm pack`. The
1044
+ `somora update` flow picks this up automatically — no manual step. The
1045
+ release tarball always contains both `web/dist` and `web-mobile/dist`.
1046
+
1047
+ ## Isolated Claude config dir
1048
+
1049
+ somora-spawned claude-cli subprocesses run with their own config tree
1050
+ under `~/.somora/claude-home/`, not the user's `~/.claude/`. On first
1051
+ server start the dir is auto-created and the user's
1052
+ `~/.claude/.credentials.json` is copied into it; a continuous sync
1053
+ (see below) keeps both credential stores on the same OAuth session so
1054
+ one `claude login` covers somora and the user's own Claude Code.
1055
+
1056
+ Everything else (project history, sessions, plugin marketplace state,
1057
+ shell snapshots, MCP-needs-auth cache, …) lives separately. somora's
1058
+ agents never see the user's interactive-CLI state, and vice versa.
1059
+
1060
+ **Why it matters**
1061
+
1062
+ - **Auto-update insulation.** Anthropic's launcher silently rolls
1063
+ forward the user's claude binary. If a release migrates the state
1064
+ schema, somora's spawn — which may run a different binary version —
1065
+ would no longer read the migrated tree cleanly. The isolated dir
1066
+ keeps somora's state out of that path.
1067
+ - **Privacy + predictability.** The user's project conversations,
1068
+ installed plugins, and per-project skill caches never leak into
1069
+ agent context.
1070
+ - **Reproducible deploys.** A fresh somora install on a new machine
1071
+ starts from the same blank slate regardless of how the user's
1072
+ personal Claude Code is set up.
1073
+
1074
+ **Scope**
1075
+
1076
+ The isolation applies to the internal engine adapter that somora uses
1077
+ to talk to Claude. Tools the agent invokes for the user — `tmux create`,
1078
+ `exec`, the `process` family — strip somora-internal vars from the
1079
+ spawned shell by default (`CLAUDE_CONFIG_DIR`, `SOMORA_CLAUDE_BIN`, the
1080
+ other engine-binary overrides, `TSX_TSCONFIG_PATH`, `NODE_ENV`, and
1081
+ Claude Code's MCP-child markers), so a `claude` or `codex` you start
1082
+ inside a tmux pane sees your normal `~/.claude` login state, and a
1083
+ project's own `tsx`/`next`/dotenv see the project's config rather than
1084
+ somora's. The `inherit_agent_env: true` flag opts back into inheritance
1085
+ when you specifically want it (see `docs/tmux.md`).
1086
+
1087
+ **Overriding**
1088
+
1089
+ Set `CLAUDE_CONFIG_DIR` in `~/.somora/somora.env` (or shell env) to
1090
+ point at any directory you prefer — useful for shared multi-host
1091
+ setups, or when you want somora to read a hand-curated config tree.
1092
+ The auto-create + credential sync still runs on whichever path
1093
+ you supply.
1094
+
1095
+ **If the user hasn't run `claude login`**
1096
+
1097
+ The credentials file at `~/.claude/.credentials.json` won't exist
1098
+ yet, and the bootstrap logs a warning instead of failing. Run
1099
+ `claude login` once interactively (any session) — the running
1100
+ server's credential watcher picks it up within seconds, no restart
1101
+ needed.
1102
+
1103
+ **Shared-login credential sync**
1104
+
1105
+ Sharing one login between two config trees has a structural enemy:
1106
+ the claude CLI refreshes OAuth tokens with an atomic write (tmp file +
1107
+ rename). A symlink from the somora-side file to
1108
+ `~/.claude/.credentials.json` would not survive that — rename replaces
1109
+ the *symlink itself*, so after the first token refresh the link would
1110
+ silently materialize into a real file. From then on both trees would
1111
+ rotate the same OAuth session independently, and whichever side
1112
+ refreshes later invalidates the other; the losing side eventually
1113
+ fails with `OAuth session expired and could not be refreshed`.
1114
+
1115
+ somora therefore maintains the sharing as a *continuously reconciled
1116
+ content sync* (default `claudeCli.sharedUserCredentials: true` in
1117
+ `config.yaml`), never as a symlink:
1118
+
1119
+ - **Filesystem watcher** on both parent directories plus a 60 s
1120
+ fallback poll — a token refresh (or fresh `claude login`) on either
1121
+ side propagates to the other within seconds, while the server runs.
1122
+ - **Boot reconcile** covers drift that happened while the server was
1123
+ down.
1124
+ - **Pre-turn reconcile** in the claude-cli engine guarantees every
1125
+ turn starts on the newest OAuth chain.
1126
+ - **Auth-failure reconcile** — if a turn still fails auth, somora
1127
+ reconciles inline and tells you whether re-sending the message is
1128
+ enough or a fresh `claude login` is needed.
1129
+
1130
+ On divergence the side with the *later OAuth expiry* wins (its refresh
1131
+ happened last, so its refresh-token chain is the live one) and is
1132
+ copied over the other — atomic write, mode `0600`, previous content
1133
+ kept once at `.credentials.json.somora-prev`. A corrupt/unparseable
1134
+ file always loses to a healthy one.
1135
+
1136
+ Inspect or fix the state manually any time:
1137
+
1138
+ ```
1139
+ somora auth status # both stores: mtime, OAuth expiry, in sync / diverged
1140
+ somora auth sync # one-shot reconcile (what the watcher does continuously)
1141
+ ```
1142
+
1143
+ `GET /health` also reports the sync state under `claudeAuth`
1144
+ (existence, expiry, divergence — never token material).
1145
+
1146
+ **Running somora on a separate Claude account**
1147
+
1148
+ Set `claudeCli.sharedUserCredentials: false` in `config.yaml` — somora
1149
+ then never touches either credentials file, and you manage
1150
+ `~/.somora/claude-home/.credentials.json` yourself (e.g. via
1151
+ `CLAUDE_CONFIG_DIR=~/.somora/claude-home claude login`).
1152
+
1153
+ ## Environment overrides
1154
+
1155
+ | Var | Default | Purpose |
1156
+ | -------------------------------- | ---------------------------- | ---------------------------------------- |
1157
+ | `SOMORA_HOME` | `~/.somora` | data root for config / agents / sessions |
1158
+ | `SOMORA_PORT` | `config.yaml:server.port` | server bind port (override) |
1159
+ | `SOMORA_HOST` | `config.yaml:server.host` (`127.0.0.1`) | server bind host override. Prefer `server.host` in config.yaml — it survives `somora update`; a `SOMORA_HOST` env in the systemd unit is dropped by the update rebake. Auto-set to `tls.publicHost` for MCP-child callers when TLS is on. |
1160
+ | `SOMORA_TLS` | `0` | set to `1` by parent when serving HTTPS — MCP-child callers use it to switch to https:// |
1161
+ | `SOMORA_LOG_LEVEL` | `info` | Pino log level |
1162
+ | `SOMORA_CLAUDE_BIN` | `~/.local/bin/claude` | Claude Code binary path |
1163
+ | `CLAUDE_CONFIG_DIR` | `~/.somora/claude-home` | Isolated state dir for claude-cli subprocesses (auto-created on boot, see "Isolated Claude config dir") |
1164
+ | `SOMORA_CODEX_BIN` | unset (bundled) | Debugging override for the Codex binary; otherwise the bundled `@openai/codex` is used |
1165
+ | `SOMORA_COMPACTION_TRIGGER_RATIO`| from config | override compaction trigger |
1166
+ | `SOMORA_COMPACTION_SAFETY_PAIRS` | from config | override compaction cushion |
1167
+ | `SOMORA_COMPACTION_MODEL` | from config | override compaction worker |
1168
+ | `SOMORA_COMPACTION_WORKERS` | from config | comma-separated worker cascade |
1169
+
1170
+ The live values are queryable: `GET /env` returns the resolved set with
1171
+ `isDefault` flags, and the same data is logged at server startup as
1172
+ `somora.env`.
1173
+
1174
+ ## Develop from a checkout (contributors)
1175
+
1176
+ If you want to hack on somora itself rather than just run it:
1177
+
1178
+ ```bash
1179
+ git clone https://github.com/thenaxon/somora_agent.git somora
1180
+ cd somora
1181
+ npm install # local install instead of -g
1182
+ npm run dev:server # terminal A — starts via tsx watch
1183
+ npm run dev:cli # terminal B — TUI against the dev server
1184
+ ```
1185
+
1186
+ The dev server reads/writes the same `~/.somora/` as the production
1187
+ binary, so anything you configure (providers, agents, persona files)
1188
+ shows up in both. To isolate, point `SOMORA_HOME` at a scratch dir:
1189
+
1190
+ ```bash
1191
+ SOMORA_HOME=/tmp/somora-dev npm run dev:server
1192
+ ```
1193
+
1194
+ Other useful scripts:
1195
+
1196
+ | Command | What |
1197
+ |---|---|
1198
+ | `npm run typecheck` | server-side `tsc --noEmit` |
1199
+ | `npm test` | every `*.test.mts`, each against a throwaway `SOMORA_HOME` |
1200
+ | `npm test src/browser` | one subtree, same isolation |
1201
+ | `npm run verify:fast` | typecheck plus the suite |
1202
+ | `cd web && npm run dev` | Vite dev server for the web client (proxies API to `:18737`) |
1203
+ | `cd web && npm run build` | rebuild `web/dist/` (the bundle the production server serves at `/web/`) |
1204
+
1205
+ Run tests through `npm test`, not `tsx --test` directly. The logger opens
1206
+ its file the moment it is imported, so a test started without an
1207
+ explicit `SOMORA_HOME` would write into the running installation's log
1208
+ and make its error count meaningless. The launcher sets a temporary home
1209
+ before anything loads and removes it afterwards; `SOMORA_TEST_HOME=/some/dir`
1210
+ keeps it when you want to read the test's own log. A file started by hand
1211
+ under `node:test` falls back to a temporary log directory too, but only
1212
+ the launcher isolates sessions, memory and the Claude config as well.
1213
+
1214
+ There's no built-in auth on the HTTP API — somora binds to `127.0.0.1`
1215
+ by default and assumes you're its only user. To expose it across a
1216
+ network, use Tailscale (see HTTPS section above) or put it behind a
1217
+ reverse proxy with proper auth.