somora 2026.1004.4 → 2026.1007.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +27 -23
  2. package/config.example.yaml +27 -0
  3. package/docs/api.md +57 -9
  4. package/docs/cache-strategy.md +24 -5
  5. package/docs/compaction.md +45 -0
  6. package/docs/display.md +14 -6
  7. package/docs/files.md +54 -12
  8. package/docs/imagegen.md +10 -1
  9. package/docs/memory.md +28 -0
  10. package/docs/mobile.md +29 -1
  11. package/docs/models.md +44 -4
  12. package/docs/resources.md +22 -0
  13. package/docs/setup.md +35 -3
  14. package/docs/thinking.md +37 -9
  15. package/docs/web.md +14 -5
  16. package/package.json +2 -1
  17. package/src/attachments/store.ts +19 -1
  18. package/src/browser/session.ts +2 -2
  19. package/src/cli/auth.ts +22 -0
  20. package/src/cli/claude-bin.ts +48 -0
  21. package/src/cli/config.ts +47 -0
  22. package/src/cli/setup.ts +11 -7
  23. package/src/cli/somora.ts +6 -1
  24. package/src/cli/tui/api.ts +44 -2
  25. package/src/cli/tui/app.tsx +62 -8
  26. package/src/cli/tui/commands.ts +109 -12
  27. package/src/cli/tui/header.tsx +20 -0
  28. package/src/cli/tui/stream.ts +2 -0
  29. package/src/cli/tui/types.ts +10 -1
  30. package/src/compaction/summarize.ts +4 -0
  31. package/src/compaction/template.ts +15 -0
  32. package/src/compaction/types.ts +3 -0
  33. package/src/config/loader.ts +75 -10
  34. package/src/config/types.ts +40 -7
  35. package/src/engine/a2a.ts +1 -1
  36. package/src/engine/claude-cli.ts +136 -4
  37. package/src/engine/codex-cli.ts +74 -0
  38. package/src/engine/engine-meta-labels.ts +2 -0
  39. package/src/engine/openai-compatible.ts +142 -29
  40. package/src/engine/types.ts +7 -0
  41. package/src/imagegen/generate.ts +30 -5
  42. package/src/imagegen/types.ts +6 -0
  43. package/src/media/capabilities.ts +8 -0
  44. package/src/memory/inject.ts +66 -7
  45. package/src/multimodal/blocks.ts +14 -0
  46. package/src/multimodal/load.ts +21 -2
  47. package/src/multimodal/model-image.ts +127 -0
  48. package/src/server/index.ts +118 -39
  49. package/src/server/run-turn.ts +65 -16
  50. package/src/server/session-compact.ts +138 -0
  51. package/src/server/thinking-resolve.ts +30 -0
  52. package/src/ssh/exec.ts +55 -22
  53. package/src/storage/sessions.ts +40 -15
  54. package/src/tools/exec/tools.ts +3 -0
  55. package/src/tools/file/analyze.ts +46 -7
  56. package/src/tools/file/remote.ts +31 -10
  57. package/src/tools/file/tools.ts +86 -19
  58. package/src/tools/image/tools.ts +6 -0
  59. package/src/tools/registry.ts +14 -0
  60. package/src/types/events.ts +23 -2
  61. package/web/dist/assets/{index-Cl1xtY5g.js → index-40x__Izy.js} +96 -96
  62. package/web/dist/assets/index-40x__Izy.js.map +1 -0
  63. package/web/dist/assets/index-CZFgQRsq.css +32 -0
  64. package/web/dist/index.html +2 -2
  65. package/web-mobile/dist/assets/index-CxILeHfe.js +88 -0
  66. package/web-mobile/dist/assets/{index-BpsX8_mX.js.map → index-CxILeHfe.js.map} +1 -1
  67. package/web-mobile/dist/assets/{index-DZXivrMo.css → index-Cyr13VGR.css} +1 -1
  68. package/web-mobile/dist/index.html +2 -2
  69. package/web/dist/assets/index-Cl1xtY5g.js.map +0 -1
  70. package/web/dist/assets/index-D0q6NZer.css +0 -32
  71. package/web-mobile/dist/assets/index-BpsX8_mX.js +0 -88
package/README.md CHANGED
@@ -11,11 +11,19 @@
11
11
  > turn what they learn into a shared long-term wiki while they sleep.
12
12
  > Run. Rest. Dream.
13
13
 
14
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
15
- [![Status: active dev](https://img.shields.io/badge/status-active%20dev-green.svg)](#status)
16
- [![Node ≥22](https://img.shields.io/badge/node-%E2%89%A522-brightgreen.svg)](#requirements)
14
+ <p align="center">
15
+ <a href="https://somora.ai"><img src="https://img.shields.io/badge/Website-2ea44f?style=for-the-badge&logo=googlechrome&logoColor=white" alt="Website: somora.ai" /></a>
16
+ <a href="https://docs.somora.ai"><img src="https://img.shields.io/badge/Docs-0a7ea4?style=for-the-badge&logo=readthedocs&logoColor=white" alt="Documentation: docs.somora.ai" /></a>
17
+ <a href="https://www.npmjs.com/package/somora"><img src="https://img.shields.io/npm/v/somora?style=for-the-badge&logo=npm&label=npm&color=cb3837" alt="npm: somora" /></a>
18
+ <a href="https://somora.ai/discord"><img src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord" /></a>
19
+ <a href="https://x.com/somora_ai"><img src="https://img.shields.io/badge/@somora__ai-000000?style=for-the-badge&logo=x&logoColor=white" alt="X: @somora_ai" /></a>
20
+ </p>
17
21
 
18
- **[Website](https://somora.ai) · [Documentation](https://docs.somora.ai) · [npm](https://www.npmjs.com/package/somora)**
22
+ <p align="center">
23
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /></a>
24
+ <a href="#status"><img src="https://img.shields.io/badge/status-active%20dev-green.svg" alt="Status: active development" /></a>
25
+ <a href="#requirements"><img src="https://img.shields.io/badge/node-%E2%89%A522.13-brightgreen.svg" alt="Node 22.13 or newer" /></a>
26
+ </p>
19
27
 
20
28
  ## Install
21
29
 
@@ -81,8 +89,9 @@ A small server you run on your machine that hosts your agents. You chat
81
89
  with them from the terminal, the browser, or your phone; they remember
82
90
  things across sessions; they use the same typed tools — memory, files
83
91
  (numbered reads, tolerant patches, filtered search), web, shell, tmux,
84
- attachments, sub-agents — regardless of which LLM you point them at. Everything an agent is asked to do — a question from you, a
85
- question from another agent, a sub-agent, a scheduled trigger, a voice
92
+ attachments, sub-agents — regardless of which LLM you point them at.
93
+ Everything an agent is asked to do — a question from you, a question
94
+ from another agent, a sub-agent, a scheduled trigger, a voice
86
95
  call — goes through one queue per session that you can see and take back
87
96
  from in every client.
88
97
 
@@ -101,7 +110,7 @@ one you give a repository to.
101
110
  | **Memory** | Notices facts, dreams them into notes and the wiki | Reads memory, never writes it; does not dream |
102
111
  | **Works in** | Its workspace | The pinned project's folder, and only there |
103
112
  | **Window** | Chat | Chat plus a task panel: mode, plan → Go, tasks, questions, running time |
104
- | **Made how** | `somora agent create`, or an agent creates one | The same, with `kind: builder` — fixed for life |
113
+ | **Made how** | `somora setup agent`, or a folder with an `AGENTS.md` and an `agent.yaml` | A folder whose `agent.yaml` says `kind: builder` — fixed for life |
105
114
 
106
115
  You can talk to a builder directly — describe the project, let it plan,
107
116
  press Go — or let a chat agent hand it the order in one call and be
@@ -133,18 +142,13 @@ On top of chat and memory, each optional and off until configured:
133
142
  that wake an agent on a schedule ([docs/sentinel.md](docs/sentinel.md)).
134
143
  - **External MCP servers** — one config entry, all engines see the tools,
135
144
  gateable per agent ([docs/mcp.md](docs/mcp.md)).
136
- - **Builders** — agents of a second kind that are coding harnesses: a
137
- short coding tool set, harness rules instead of a persona, long turns,
138
- a task panel with the plan, the task list and the questions they ask
139
- you. Describe a project, let the builder plan, press Go — or let
140
- another agent hand over the order in one call and be woken with the
141
- report; one builder per folder at a time, and the hand-over procedure
142
- ships as a skill ([docs/builder.md](docs/builder.md)). With a
143
- language server installed, every write comes back with the compiler's
144
- errors for the file ([docs/lsp.md](docs/lsp.md)).
145
+ - **Language servers** — with one installed, every file a builder
146
+ writes comes back with the compiler's errors for that file, so it
147
+ fixes them in the same step ([docs/lsp.md](docs/lsp.md)).
145
148
  - **Steering** — type into a running turn instead of behind it: the
146
- model reads your message at its next step and changes course, on every
147
- engine ([docs/api.md → Steering](docs/api.md#steering)).
149
+ model reads your message at its next step and changes course. Works on
150
+ the Claude, Codex and OpenAI-compatible engines; on Grok the message
151
+ waits for the next turn ([docs/api.md → Steering](docs/api.md#steering)).
148
152
 
149
153
  ## Requirements
150
154
 
@@ -154,9 +158,9 @@ Hard:
154
158
  older Node every `somora` command stops with the upgrade steps.
155
159
  - **tmux** — for the `tmux` tool (long-lived terminal sessions for agents)
156
160
  and the web tmux app.
157
- - **At least one LLM backend:** the Claude Code binary (Claude
158
- subscription, engine `claude-cli`); a ChatGPT subscription (engine
159
- `codex-cli` — Codex is bundled, `somora codex login`); the Grok Build CLI
161
+ - **At least one LLM backend:** a Claude subscription (engine
162
+ `claude-cli` — Claude Code is bundled, `somora auth login`); a ChatGPT
163
+ subscription (engine `codex-cli` — Codex is bundled, `somora codex login`); the Grok Build CLI
160
164
  (SuperGrok/Premium, engine `grok-cli`); or any OpenAI-compatible HTTP
161
165
  server (Ollama, LM Studio, vLLM, oMLX, OpenRouter, …).
162
166
 
@@ -261,7 +265,7 @@ sudo apt install tmux ripgrep build-essential # Debian/Ubuntu
261
265
  npm install -g somora
262
266
 
263
267
  # 3. Log in to at least one LLM backend (pick one or more)
264
- curl -fsSL https://claude.ai/install.sh | bash && claude auth login # Claude subscription
268
+ somora auth login # Claude subscription; Claude Code is bundled
265
269
  somora codex login # ChatGPT subscription; Codex is bundled
266
270
  # local models: run Ollama / LM Studio / oMLX and add the endpoint to
267
271
  # ~/.somora/config.yaml after step 4
@@ -353,7 +357,7 @@ Three first-party clients, all hitting the same local server:
353
357
  |---|---|---|
354
358
  | **TUI** | `somora tui` | Terminal multi-agent chat with full keyboard control, the session's queue (`/queue`), memory and tool detail toggles. |
355
359
  | **Web** | `https://<host>.<tailnet>.ts.net:18737/web/` | A browser desktop: one window per agent, drag-and-drop attachments and screenshots, tmux app and shell terminal, Wiki Explorer with link graph, Media gallery, Sessions browser, the agent's Chromium window, server log, Abilities matrix (which tools and skills each agent may use), Team and Agent windows, a queue badge per session (what runs, what waits, what is arriving — take back or stop from there), dictation and spoken replies, and a voice window for a live call. HTTPS required; LAN-trust, no auth. [docs/web.md](docs/web.md) |
356
- | **Mobile (PWA)** | `…:18737/mobile/`, then "Add to Home Screen" | The phone app: avatar row to switch agent, one chat per agent, the same queue sheet, voice input and spoken replies, photo/PDF attachments via the native picker. [docs/mobile.md](docs/mobile.md) |
360
+ | **Mobile (PWA)** | `…:18737/mobile/`, then "Add to Home Screen" | The phone app: avatar row to switch agent, a sheet in the header to switch session and model or restore an archived session, the same queue sheet, voice input and spoken replies, photo/PDF attachments via the native picker. [docs/mobile.md](docs/mobile.md) |
357
361
 
358
362
  Anything else can talk to the server the same way the clients do:
359
363
  [docs/api.md](docs/api.md) is the HTTP + SSE + WebSocket reference.
@@ -110,6 +110,11 @@ providers:
110
110
  engine: openai-compatible
111
111
  baseUrl: http://localhost:11434/v1
112
112
  apiKey: lm-studio
113
+ # After a pause this long, earlier memory blocks leave the replayed
114
+ # history (docs/memory.md — "Old blocks after a pause"). Default 60,
115
+ # about when a paid provider's cache has expired; a server of your
116
+ # own can use less.
117
+ # dropMemoryBlocksAfterIdleMinutes: 10
113
118
  models:
114
119
  - id: gemma-4-31b-it-8bit
115
120
  alias: gemma4big
@@ -119,6 +124,17 @@ providers:
119
124
  alias: gemma4small
120
125
  contextWindow: 131072
121
126
  capabilities: [text, image]
127
+ # A reasoning model: its words for the levels, and the level used
128
+ # when neither session nor agent sets one (docs/models.md —
129
+ # "When no level is set"). Without `default` nothing is sent and
130
+ # the model decides.
131
+ # - id: qwen3.8-flash-next
132
+ # alias: qwen
133
+ # contextWindow: 524288
134
+ # capabilities: [text, image, reasoning]
135
+ # reasoning:
136
+ # levels: { "off": low, high: xhigh }
137
+ # default: high
122
138
 
123
139
  # Same engine, different host — totally fine.
124
140
  # ollama:
@@ -140,6 +156,7 @@ providers:
140
156
  # engine: openai-compatible
141
157
  # baseUrl: https://openrouter.ai/api/v1
142
158
  # apiKey: <YOUR_OPENROUTER_KEY>
159
+ # dropMemoryBlocksAfterIdleMinutes: 60 # the default, shown for completeness
143
160
  # models:
144
161
  # - id: anthropic/claude-haiku-4.5
145
162
  # alias: orhaiku
@@ -154,6 +171,11 @@ providers:
154
171
  # contextWindow: 262144
155
172
  # capabilities: [text]
156
173
 
174
+ # Attachments and images sent to a model (docs/files.md).
175
+ # attachments:
176
+ # maxImageBytes: 5242880 # largest image sent, after scaling
177
+ # maxImageEdge: 2048 # longer side in pixels; larger images are scaled down first, 0 = off
178
+
157
179
  # Vision / multimodal worker (Phase Y). Optional. When set, the
158
180
  # `analyze_file` tool dispatches images and PDFs to the worker model
159
181
  # and returns its text analysis — useful when the active main model
@@ -172,6 +194,10 @@ providers:
172
194
  # when the local worker sits on a GPU box that runs one profile at a
173
195
  # time: without a chain, a profile switch takes analyze_file down for
174
196
  # every agent at once, and quietly.
197
+ #
198
+ # PDFs take the same chain: a worker with `pdf` gets the document, one
199
+ # with only `image` the first 20 pages as images. `pdfWorker` is only
200
+ # needed when PDFs should go to a model that reads the document itself.
175
201
  # vision:
176
202
  # worker: openrouter/anthropic/claude-haiku-4-5 # single model, still valid
177
203
  # pdfWorker: openrouter/anthropic/claude-sonnet-4-6 # optional override for PDFs
@@ -722,6 +748,7 @@ providers:
722
748
  # historyWeightEmpty: 0.8 # … when it has none ("you should know that, right?")
723
749
  # historyTurnChars: 800 # chars taken from each history turn
724
750
  # shortQueryBm25Weight: 0.5 # BM25 weight for 1–2-word messages (null = hybrid.bm25Weight)
751
+ # skipRepeats: true # a section the model still has in context is not injected again
725
752
  # hybrid:
726
753
  # vectorWeight: 0.7 # weight of vector similarity in fused score
727
754
  # bm25Weight: 0.3 # weight of BM25/FTS5 in fused score
package/docs/api.md CHANGED
@@ -286,11 +286,12 @@ back to its real size.
286
286
 
287
287
  ### `GET /config/status`
288
288
 
289
- Whether `config.yaml` changed on disk since the server loaded it, and
290
- whether the server can restart itself.
289
+ Whether `config.yaml` changed on disk since the server loaded it,
290
+ whether the file is valid, and whether the server can restart itself.
291
291
 
292
292
  ```json
293
- { "path": "/home/me/.somora/config.yaml",
293
+ { "invalid": null,
294
+ "path": "/home/me/.somora/config.yaml",
294
295
  "loadedAt": "2026-05-14T11:09:08.429Z",
295
296
  "changedOnDisk": false,
296
297
  "restartRequiredSections": ["server", "memory", "obsidian", "wiki", "mcp",
@@ -301,7 +302,14 @@ whether the server can restart itself.
301
302
 
302
303
  `restartRequiredSections` are the config sections that are read at
303
304
  start and only change after a restart. `restartAvailable` is `true`
304
- when the systemd user unit is active.
305
+ when somora runs as a background service (systemd user unit on Linux,
306
+ LaunchAgent on macOS).
307
+
308
+ `invalid` is `null` while the file on disk validates. Otherwise it is
309
+ `{since, message}`: the file does not validate, somora keeps running on
310
+ the last valid version, `since` is when this version of the file was
311
+ first seen and `message` lists the problems. The route checks the file
312
+ on every call.
305
313
 
306
314
  ### `POST /config/reload`
307
315
 
@@ -436,6 +444,11 @@ What a client sees, in order:
436
444
  | The turn is already finishing | It becomes an ordinary queued turn. Nothing is lost. |
437
445
  | The message carries `agent_ask_call_id` | Never steered: such a question needs a turn of its own. |
438
446
 
447
+ On `claude-cli` a message steered while the model writes its final
448
+ answer is answered in the same turn. The model finishes the answer,
449
+ then replies to the message in a new paragraph. The turn ends once
450
+ every steered message has had its answer.
451
+
439
452
  Sub-agent and voice turns can be steered like any other. The web
440
453
  client offers a steer or queue switch next to Send. Its starting
441
454
  position is the agent's `steering:` setting in `agent.yaml`, reported
@@ -996,8 +1009,43 @@ cannot be archived. `main` cannot: reset it instead.
996
1009
 
997
1010
  ### `POST /agents/:agent/sessions/:session/unarchive`
998
1011
 
999
- Brings an archived session back. Returns
1000
- `{archived: false, agent, session}`.
1012
+ Brings an archived session back as a normal session, also one that
1013
+ `/reset` archived. Returns the state after the call:
1014
+
1015
+ | Status | Body |
1016
+ |---|---|
1017
+ | `200` | `{archived: false, agent, session, slug}`. `slug` is the name the session is listed under. |
1018
+ | `409` | `{error, archived: true}`. The session is still archived. |
1019
+
1020
+ A reset archive keeps its id and is listed under the name in that id,
1021
+ for example `main-archive` or `trip-archive`. The original name stays
1022
+ with the fresh session. The history is untouched, and REM does not read
1023
+ the archived part a second time.
1024
+
1025
+ The web client's Sessions window, the mobile app's session sheet and
1026
+ the TUI's `/unarchive` all use this route.
1027
+
1028
+ ### `POST /agents/:agent/sessions/:session/compact`
1029
+
1030
+ Compacts the session now, on the engine of its model. See
1031
+ [Compact by hand](compaction.md#compact-by-hand).
1032
+
1033
+ | Body field | Required | Meaning |
1034
+ |---|---|---|
1035
+ | `instructions` | no | What the summary should keep. Used on `openai-compatible` and `claude-cli`, at most 2000 characters. |
1036
+
1037
+ | Status | Body |
1038
+ |---|---|
1039
+ | `200` | `{agent, session, status: "compacted", engine, tokensBefore?, tokensAfter?, note?}`. `note` says when the engine ignored the instructions (`codex-cli`). |
1040
+ | `200` | `{agent, session, status: "nothing_to_compact", engine, note}`. The session is too short, or the engine has no conversation for it yet. |
1041
+ | `400` | `{status: "unsupported", engine, note}`. The engine cannot compact by hand (`grok-cli`). |
1042
+ | `409` | `{error, busy: true}`. A turn or another compaction is running. |
1043
+ | `502` | `{error}`. The engine failed while compacting. |
1044
+
1045
+ A finished compaction is stored as an `engine_meta` row with engine
1046
+ `somora` and `itemType: "context_compacted"`, and sent to every client
1047
+ on the session. Its `payload` holds `text`, `manual: true`, the `engine`,
1048
+ the token counts and the `focus`.
1001
1049
 
1002
1050
  ### `POST /agents/:agent/sessions/:session/reset`
1003
1051
 
@@ -1101,9 +1149,9 @@ The thinking level in force.
1101
1149
 
1102
1150
  | Field | Meaning |
1103
1151
  |---|---|
1104
- | `effective` | The level that applies: `off`, `low`, `medium`, `high`, or `null` for the engine's default. |
1105
- | `override`, `personaDefault` | The session's and the agent's setting, or `null`. |
1106
- | `source` | `session-override`, `persona-default` or `engine-default`. |
1152
+ | `effective` | The level that applies: `off`, `low`, `medium`, `high`, or `null` when nothing is set and the model decides. |
1153
+ | `override`, `personaDefault`, `modelDefault` | The session's setting, the agent's, and the active model's `reasoning.default`, or `null`. |
1154
+ | `source` | `session-override`, `persona-default`, `model-default`, or `engine-default` (nothing set: nothing is sent; show it as "model decides", not "off"). |
1107
1155
  | `modelSupportsReasoning` | Whether the current model uses the setting at all. |
1108
1156
  | `wire` | The value actually sent when it differs from the level, for example `xhigh` for `high`. Else `null`. |
1109
1157
 
@@ -146,6 +146,14 @@ new.
146
146
  The price is a larger session file: each user message also stores its
147
147
  block, typically 500 to 2000 characters.
148
148
 
149
+ Two things keep the blocks from piling up. A section that is still in
150
+ the conversation is not injected again (`memory.autoInject.skipRepeats`).
151
+ And after a pause longer than the provider's
152
+ `dropMemoryBlocksAfterIdleMinutes`, the earlier blocks are dropped from
153
+ the rebuilt conversation, once. The cache has expired by then, so the
154
+ one changed prefix costs nothing extra; from the next turn on the cache
155
+ holds again.
156
+
149
157
  ### Why not a second system message
150
158
 
151
159
  Putting the recalled notes in a late system message looks cleaner and
@@ -159,19 +167,22 @@ message and is not sent as a second one.
159
167
 
160
168
  ### Tool calls in the history
161
169
 
162
- Earlier turns that used tools are replayed in the native shape: an
163
- assistant message with `tool_calls`, then one `role: tool` message per
164
- result.
170
+ Earlier turns that used tools are replayed in the native shape, one
171
+ assistant message per reply of the model: the text it wrote in that
172
+ reply with its `tool_calls`, then one `role: tool` message per result.
173
+ The closing message holds only the last reply.
165
174
 
166
175
  ```jsonc
167
- {"role":"assistant","content":null,"tool_calls":[{"id":"c1","type":"function",
176
+ {"role":"assistant","content":"I'll write the note:","tool_calls":[{"id":"c1","type":"function",
168
177
  "function":{"name":"file_write","arguments":"{\"path\":\"notes.md\"}"}}]}
169
178
  {"role":"tool","tool_call_id":"c1","content":"{\"ok\":true}"}
170
179
  {"role":"assistant","content":"Done, the file is written."}
171
180
  ```
172
181
 
173
- Three rules apply:
182
+ The rules:
174
183
 
184
+ - Each reply keeps its own text next to its own calls. Calls the model
185
+ made together stay in one message.
175
186
  - Each call is followed directly by its result, in order.
176
187
  - A call without a recorded result is dropped. A crashed turn leaves
177
188
  such calls, and most providers reject them.
@@ -182,6 +193,12 @@ Three rules apply:
182
193
  The native shape matters for more than the cache. A history in which the
183
194
  assistant never calls a tool teaches a weaker model not to call tools.
184
195
 
196
+ The same goes for the order of the text: all of a turn's interim text
197
+ replayed after its calls reads as "tool work is narrated", and a model
198
+ then narrates instead of calling. Turns recorded before the text was
199
+ stored per reply therefore come back with their closing reply only, and
200
+ so does a reply that narrates tool work without having called a tool.
201
+
185
202
  The rebuild is deterministic: the same session file gives the same
186
203
  request, so the cache holds.
187
204
 
@@ -231,6 +248,7 @@ providers:
231
248
  baseUrl: ...
232
249
  apiKey: ...
233
250
  memoryInjectMode: inline-user
251
+ dropMemoryBlocksAfterIdleMinutes: 60
234
252
  models: [...]
235
253
 
236
254
  agentLoop:
@@ -245,6 +263,7 @@ wiki:
245
263
  | Setting | Default | Meaning |
246
264
  |---|---|---|
247
265
  | `providers.<name>.memoryInjectMode` | `inline-user` | Only for `openai-compatible` providers. `inline-user` puts the per-turn block in front of the user message and keeps the cache. `system` appends it to the system prompt and loses the cache on every turn. |
266
+ | `providers.<name>.dropMemoryBlocksAfterIdleMinutes` | `60` | Only for `openai-compatible` providers. After this many minutes without a turn, the earlier memory blocks are dropped from the rebuilt conversation. Match it to the provider's cache lifetime. `0` keeps them. |
248
267
  | `agentLoop.toolUsageReminder` | `true` | Adds the constant tool reminder to the system prompt when the agent has tools. Switching it changes the prefix once. |
249
268
  | `wiki.search.overviewMaxChars` | `4000` | Size limit of the wiki overview. A larger value means a larger constant prefix, paid once per session. |
250
269
  | `wiki.search.overviewTopNSlugs` | `30` | Most sections listed when the overview falls back to section names and counts. |
@@ -17,6 +17,8 @@ is called compaction.
17
17
  summaries, in the order they are tried.
18
18
  - **A backup when a model is down.** If one summariser refuses, the next
19
19
  one is asked.
20
+ - **Compact by hand.** `/compact` shortens a session right away, with an
21
+ optional focus for the summary, and the conversation goes on.
20
22
 
21
23
  ## Set it up
22
24
 
@@ -48,6 +50,47 @@ kind. REM reads it independently.
48
50
  The rest of this page, up to [Which model summarises](#which-model-summarises),
49
51
  describes the `openai-compatible` path.
50
52
 
53
+ ## Compact by hand
54
+
55
+ `/compact` compacts the open session now, instead of waiting for the
56
+ automatic compaction. Use it when a long conversation should go on with
57
+ less weight, or before you change the subject within the same session.
58
+ A sentence after the command tells the summary what to keep:
59
+
60
+ ```text
61
+ /compact
62
+ /compact keep every file path and the open questions
63
+ ```
64
+
65
+ | Client | How |
66
+ |---|---|
67
+ | Web client | `/compact [what to keep]` in the chat, or **Compact now** in the `•••` session menu. |
68
+ | Mobile app | **Compact this conversation** in the session sheet. |
69
+ | TUI | `/compact [what to keep]`. |
70
+ | HTTP | `POST /agents/:agent/sessions/:session/compact`, see the [API](api.md#post-agentsagentsessionssessioncompact). |
71
+
72
+ What happens depends on the engine of the session's model:
73
+
74
+ | Engine | Who compacts | The focus sentence |
75
+ |---|---|---|
76
+ | `openai-compatible` | somora, with the same summary as the automatic compaction. The last exchanges (`safetyCushionPairs`) stay as they are. | Goes into the summary prompt. |
77
+ | `claude-cli` | Claude Code compacts its own session, as `/compact` does in Claude Code. | Passed to Claude as its instructions. |
78
+ | `codex-cli` | Codex compacts its own thread. | Not used: Codex takes no instructions for it. The reply says so. |
79
+ | `grok-cli` | Not available. | |
80
+
81
+ Good to know:
82
+
83
+ - **Not during a turn.** While a turn runs, the command is refused with
84
+ `This session is busy`. Compact once the turn has ended. A message
85
+ you send while a compaction runs waits until it is done.
86
+ - **The chat says what happened.** A row reads, for example,
87
+ `Compacted by hand: Claude compacted its session (17.2k → 1.5k
88
+ tokens).` It shows in every client, also with the tool rows hidden.
89
+ - **A short session stays as it is.** With too little conversation the
90
+ reply says so and nothing changes.
91
+ - **Nothing is lost on disk.** As with the automatic compaction, the
92
+ session file keeps every message and REM reads all of it.
93
+
51
94
  ## Before a turn
52
95
 
53
96
  ### Measuring the session
@@ -342,6 +385,8 @@ Environment variables override the file:
342
385
  | Summaries cost subscription usage | `compaction.worker_chosen` shows a CLI model | Set `compaction.workers`. |
343
386
  | Compaction fails | `compaction.worker_failed`, `compaction.all_workers_failed`, `compaction.no_model_fits`, `engine.compaction_fail` | Check that the workers are reachable and that one has a large enough window. |
344
387
  | A listed worker is never asked | `compaction.workers_unresolved` or `model.unavailable` | Fix the name, or wait until the model is tried again. |
388
+ | `/compact` answers `This session is busy` | A turn or another compaction is running | Wait until it has ended, then run it again. |
389
+ | `/compact` changes nothing | `session.compacted_by_hand` with `status: nothing_to_compact` | The session is too short, or the engine has no conversation for it yet. |
345
390
 
346
391
  ## See also
347
392
 
package/docs/display.md CHANGED
@@ -48,7 +48,8 @@ list while you type a `/`, the input, and a line of hints.
48
48
 
49
49
  | Part | Meaning |
50
50
  |---|---|
51
- | `🐨 somora · <agent>:<session> · <model>` | Where you are, and the model that answered the last turn. |
51
+ | `🐨 somora · <agent>:<session> · <model>` | Where you are, and the model that answered the last turn. Before the first turn: the model the session will use. |
52
+ | `→ <model> (next turn)` | The session's model was switched since the last turn, here, in another client or by an agent. The next turn uses it. |
52
53
  | `Σ↑ 12k+80k¢` | Input tokens the last turn spent, summed over all its requests. The green part with `¢` was read from the cache. |
53
54
  | `▣ 45k/200k` | How full the context is. Yellow above 75 %, red above 90 %, magenta when it is over the window. |
54
55
  | `↓ 1.2k (300 🧠)` | Output tokens, with reasoning tokens in brackets. A `~` marks an estimate. |
@@ -75,6 +76,7 @@ list while you type a `/`, the input, and a line of hints.
75
76
  | `🧠 thinking` | The model's reasoning, only with `/verbose thinking on`. |
76
77
  | `[image] <file>` or `[video] <file> (4.0s)` | The reply produced a picture or a video. The terminal shows the file name. |
77
78
  | `i`, `!`, `✗` | A notice from the client: info in gray, warning in yellow, error in red. |
79
+ | `✗ config.yaml does not validate …` | `config.yaml` has a mistake. somora keeps running on the last valid version, the line lists the problems. See [A broken config file](setup.md#a-broken-config-file). |
78
80
 
79
81
  ### Turns nobody typed
80
82
 
@@ -124,7 +126,7 @@ switch and `/verbose` as the zoom.
124
126
  |---|---|
125
127
  | `/show` | Lists the current state. |
126
128
  | `/show memory on\|off` | Shows or hides the `◇ memory` lines. |
127
- | `/show tools on\|off` | Shows or hides tool calls, tool results and the `◌` engine lines. |
129
+ | `/show tools on\|off` | Shows or hides tool calls, tool results and the `◌` engine lines. somora's own lines, `model switched` and `context compacted`, stay visible. |
128
130
  | `/verbose` | Lists the current state. |
129
131
  | `/verbose tools on\|off` | Adds the full input and output below each tool call and result. Engine lines expand to their full content. |
130
132
  | `/verbose memory on\|off` | Adds the full recalled text below each memory line, as the model received it. |
@@ -223,16 +225,19 @@ A path only works after the format word.
223
225
  | `/help` | Lists all commands. |
224
226
  | `/agents` | Lists the agents. `*` marks the current one. |
225
227
  | `/agent <name> [session]` | Switches to another agent, into its `main` session unless you name one. |
226
- | `/sessions` | Lists the current agent's sessions with message count and last activity. `📬` marks unread, `📁` a pinned project. |
227
- | `/session <slug-or-id>` | Switches to another session of the current agent. |
228
+ | `/sessions` | Lists the current agent's sessions with message count and last activity, in your local time. `📬` marks unread, `📁` a pinned project. |
229
+ | `/sessions archived` | Lists the archived sessions, newest first, with the time they were archived and their id. |
230
+ | `/session <slug-or-id>` | Switches to another session of the current agent. An archived one is not opened: the client names the `/unarchive` that brings it back. |
231
+ | `/unarchive <slug-or-id>` | Brings an archived session back as a normal session and switches to it. A session `/reset` archived comes back as `<name>-archive`. When several archives share the name, the client lists their ids: run it again with the id. |
228
232
  | `/new <slug>` | Creates a session and switches to it. |
229
233
  | `/main` | Returns to the `main` session. |
230
- | `/reset [YES]` | Without `YES`: explains what would happen. With `YES`: archives the current session and starts it fresh. The archive can be opened again with `/session <id>`. |
234
+ | `/compact [what to keep]` | Compacts this session now and the conversation goes on. The sentence is the focus of the summary. See [Compact by hand](compaction.md#compact-by-hand). |
235
+ | `/reset [YES]` | Without `YES`: explains what would happen. With `YES`: archives the current session and starts it fresh. `/unarchive` brings the archive back. |
231
236
  | `/models` | Lists the configured models with alias, engine, context size and capabilities. |
232
237
  | `/model [<alias>\|default]` | No argument: shows the model in effect and where it comes from. An alias or `provider/id`: sets it for this session. `default` or `-`: back to the agent's own model. |
233
238
  | `/show [memory\|tools] [on\|off]` | Line visibility, see "The two switches". |
234
239
  | `/verbose [tools\|memory\|system\|thinking] [on\|off]` | Detail level, see "The two switches". |
235
- | `/thinking [off\|low\|medium\|high\|default]` | No argument: shows the thinking depth in effect and its source. A level: sets it for this session. `default` or `-`: clears the session's own setting. |
240
+ | `/thinking [off\|low\|medium\|high\|default]` | No argument: shows the thinking depth in effect and its source: the session, the agent's default or the model's default. With nothing set it says `model decides`: nothing is sent, and reasoning models usually think. A level: sets it for this session. `default` or `-`: clears the session's own setting. |
236
241
  | `/reload` | Reads `~/.somora/config.yaml` again without a restart. Reports what changed and what needs a restart. |
237
242
  | `/restart [YES]` | With `YES`: restarts the somora service. Every open stream drops and the client reconnects. Without `YES`: asks you to confirm. |
238
243
  | `/sampling [key=value …\|default]` | No argument: shows the sampling parameters in effect. `key=value` pairs set them for this session, the value `-` removes a key. `default` or `-` clears the session's own setting. |
@@ -331,6 +336,9 @@ Routes the client uses for the features on this page:
331
336
  | `POST /spawn-cancel` | `/queue rm` on a running sub-agent. |
332
337
  | `POST /chat/abort` | Esc, and `/queue rm` on a running question. |
333
338
  | `GET /agents/:agent/sessions/:session/export?format=…` | `/export`, with `format` being `json` or `markdown`. |
339
+ | `GET /agents/:agent/sessions?include_archived=true` | `/sessions archived`, `/unarchive` with a name. |
340
+ | `POST /agents/:agent/sessions/:session/unarchive` | `/unarchive`. |
341
+ | `GET /config/status` | The `config.yaml does not validate` line. |
334
342
  | `POST /config/reload` | `/reload`. |
335
343
  | `POST /server/restart` | `/restart YES`. |
336
344
 
package/docs/files.md CHANGED
@@ -60,8 +60,9 @@ are handled by the server.
60
60
  { "name": "file_search", "input": { "pattern": "TODO", "path": "src/", "target": "<resource-name>" } }
61
61
  ```
62
62
 
63
- Three things are local only: showing images and PDFs, the persona
64
- backup, and the builder write scope.
63
+ Images and PDFs work the same on a resource: the file is downloaded
64
+ and shown like a local one. Two things are local only: the persona
65
+ backup and the builder write scope.
65
66
 
66
67
  ## How paths resolve
67
68
 
@@ -126,6 +127,15 @@ copy in `backup`. The last five backups per file are kept.
126
127
  This covers `AGENTS.md`, `SOUL.md`, `USER.md`, `VOICE.md` and
127
128
  `agent.yaml` directly under `~/.somora/agents/<name>/`.
128
129
 
130
+ ## The server config is checked after each write
131
+
132
+ When `file_write` or `file_patch` writes `~/.somora/config.yaml`, the
133
+ file is checked the way the server checks it. The write stays. If the
134
+ file does not validate, the result carries `config_invalid` with the
135
+ list of problems, and somora keeps running on the last valid version
136
+ until the file is fixed. `somora config check` runs the same check from
137
+ a shell.
138
+
129
139
  ## Builders write inside their project
130
140
 
131
141
  A builder agent pinned to a project folder may write only there and in
@@ -165,8 +175,9 @@ characters.
165
175
 
166
176
  ## Images and PDFs
167
177
 
168
- `file_read` looks at the first bytes of a local file, not at its name,
169
- and answers by kind:
178
+ `file_read` looks at the first bytes of a file, not at its name, and
179
+ answers by kind. This works the same for a file on an SSH resource.
180
+ The file is downloaded first, up to 64 MB.
170
181
 
171
182
  | File | Active model has `image` | Result |
172
183
  |---|---|---|
@@ -174,9 +185,31 @@ and answers by kind:
174
185
  | PNG, JPEG, WebP, GIF | yes | The image itself. The model sees it. |
175
186
  | PDF | yes | The first 20 pages as images, rendered at 1.5 times page size. |
176
187
  | Image or PDF | no | An error that points to `analyze_file`. |
188
+ | Video or audio | any | An error with the hint to extract a frame with `ffmpeg`. |
177
189
  | Unknown binary | any | An error with the hint to inspect the file with `exec`. |
178
190
 
179
- An image may be up to `attachments.maxImageBytes` in size. PDF pages
191
+ ### Images are scaled before they reach the model
192
+
193
+ An image whose longer side is above `attachments.maxImageEdge` (2048
194
+ pixels by default) is scaled down to it before it goes to the model.
195
+ The file itself is not changed. This holds for every image a model
196
+ gets:
197
+
198
+ - `file_read`, local and on a resource
199
+ - chat attachments, also the screenshot button in the web client
200
+ - the review image after `image_generate`
201
+ - images from external MCP tools
202
+ - attachments replayed from earlier turns
203
+
204
+ Text in screenshots stays readable. A 4K or Retina screenshot is
205
+ scaled by about half, which brings its text to the size it has on an
206
+ ordinary screen. The large providers scale big images down themselves,
207
+ so a bigger image costs more without showing more. Set
208
+ `maxImageEdge: 0` to send images as they are, or raise it when a model
209
+ of yours needs finer detail.
210
+
211
+ With scaling on, a source image may be up to 50 MB.
212
+ `attachments.maxImageBytes` then applies to the scaled image. PDF pages
180
213
  cost tokens: roughly 1300 per page on Anthropic models. A PDF with more
181
214
  than 20 pages comes with a note that only the first 20 were rendered.
182
215
 
@@ -222,8 +255,10 @@ Rules for the chain:
222
255
 
223
256
  - A worker must be on an `openai-compatible` provider. Use a proxy such
224
257
  as OpenRouter to reach a Claude or GPT model.
225
- - A worker needs the `image` capability for images and the `pdf`
226
- capability for PDFs. One that lacks it is skipped for that file.
258
+ - A worker needs the `image` capability for images. For a PDF, a worker
259
+ with `pdf` gets the document itself. A worker with only `image` gets
260
+ the pages as images, at most the first 20, and the prompt says when
261
+ more exist. A worker with neither is skipped for that file.
227
262
  - A worker that failed is skipped for `vision.healthCacheMs`. After a
228
263
  mere timeout it is skipped for the shorter `vision.timeoutCooldownMs`,
229
264
  because slow is not the same as gone.
@@ -237,6 +272,12 @@ Rules for the chain:
237
272
  A description is short, and a reasoning model with a large limit can
238
273
  think past the timeout. Raise it when you ask for long transcriptions.
239
274
 
275
+ **When `vision.pdfWorker` helps.** Without it, PDFs take the same
276
+ chain as images, so a local vision model reads them as page pictures.
277
+ Set `pdfWorker` when PDFs should go to a model that reads the document
278
+ itself. It gets the text, not only pictures of the pages, which is more
279
+ exact for long or text-heavy files and not limited to 20 pages.
280
+
240
281
  > **Note:** A worker name that is not a model in `config.yaml` stops the
241
282
  > server at start with a clear message. A missing capability or the
242
283
  > wrong engine only writes a warning to the log.
@@ -403,6 +444,7 @@ vision:
403
444
  timeoutCooldownMs: 10000
404
445
 
405
446
  attachments:
447
+ maxImageEdge: 2048 # longer side in pixels, 0 = no scaling
406
448
  maxImageBytes: 5242880 # 5 MB
407
449
  maxPdfBytes: 33554432 # 32 MB
408
450
  maxTextBytes: 1048576 # 1 MB
@@ -418,13 +460,14 @@ providers:
418
460
  |---|---|---|
419
461
  | `workspace.default` | `~/somoraworkspace` | Root for relative paths. Per agent: `workspace.path` in `agent.yaml`. |
420
462
  | `vision.worker` | unset | Vision worker, or an ordered list of them. Without it `analyze_file` is hidden. |
421
- | `vision.pdfWorker` | unset | Worker or list for PDFs only. Falls back to `vision.worker`. |
463
+ | `vision.pdfWorker` | unset | Worker or list for PDFs only. Falls back to `vision.worker`, whose image-only workers read PDFs as page images. |
422
464
  | `vision.timeoutMs` | `60000` | Time limit for one worker attempt. |
423
465
  | `vision.totalBudgetMs` | `90000` | Time limit for the whole chain. |
424
466
  | `vision.maxOutputTokens` | `1500` | Output limit for a worker answer. |
425
467
  | `vision.healthCacheMs` | `60000` | How long a failed worker is skipped. `0` turns this off. |
426
468
  | `vision.timeoutCooldownMs` | `10000` | How long a worker is skipped after a timeout. `0` turns this off. |
427
- | `attachments.maxImageBytes` | `5242880` | Largest image for uploads, `file_read` and `analyze_file`. |
469
+ | `attachments.maxImageEdge` | `2048` | Longest side in pixels of an image sent to a model. Larger images are scaled down first. `0` sends images as they are. |
470
+ | `attachments.maxImageBytes` | `5242880` | Largest image sent to a model. With scaling on it applies after scaling, and a source image may be up to 50 MB. Without scaling it is the limit for uploads, `file_read` and `analyze_file`. |
428
471
  | `attachments.maxPdfBytes` | `33554432` | Largest PDF for uploads and `analyze_file`. |
429
472
  | `attachments.maxTextBytes` | `1048576` | Largest text attachment. |
430
473
  | `attachments.maxPerTurn` | `10` | Attachments per message. |
@@ -432,8 +475,6 @@ providers:
432
475
 
433
476
  The size defaults match the strictest supported provider, so they are
434
477
  safe with every engine. Providers may also limit PDFs to 100 pages.
435
- Raise `maxImageBytes` when agents should look at large images, such as
436
- generated 2K or 4K pictures, which often have 6 to 9 MB.
437
478
 
438
479
  ## Tools
439
480
 
@@ -504,7 +545,8 @@ extension get a delete followed by a rename.
504
545
  | `analyze_file` is missing from the tool list | `vision.worker` is unset, or the active model can see images itself. |
505
546
  | `no vision worker could handle this ...` | Every worker in the chain failed. The message lists each one with its reason. |
506
547
  | `worker produced no text within ... output tokens` | The worker spent its output on thinking. Raise `vision.maxOutputTokens` or use another worker. |
507
- | `vision.worker.no_image_capability` or `vision.worker.no_pdf_capability` in the log at start | A worker lacks a capability. Add it to the model, or set `vision.pdfWorker`. |
548
+ | `vision.worker.no_image_capability` in the log at start | A worker cannot see images. Add `image` to the model if it has vision, or remove it from the chain. |
549
+ | `vision.worker.no_pdf_capability` in the log at start | A worker that may get PDFs has neither `pdf` nor `image`, so it can do nothing with a PDF. |
508
550
  | `multipart uploads are not supported` | Send the raw file bytes as the body of `POST /attachments`. |
509
551
  | A file ended up in `<workspace>/<workspace-name>/...` | The relative path started with the workspace folder's name. Drop that prefix. |
510
552
 
package/docs/imagegen.md CHANGED
@@ -179,7 +179,10 @@ render squares, and still answer with a perfectly good image. somora
179
179
  measures the returned picture itself:
180
180
 
181
181
  - **Size.** Explicit pixels were requested and others came back: the
182
- result names both.
182
+ result names both. When reference images were passed and the result
183
+ has the shape of the first one, the note says so: many edit models
184
+ take their canvas from reference image 1 and use `size` only as a
185
+ pixel budget. Pass a first reference in the shape you want.
183
186
  - **Shape.** A ratio was requested and the picture is more than 1 %
184
187
  off: the result names the ratio and the real dimensions.
185
188
 
@@ -387,6 +390,12 @@ free text shows as `any value`. Values the catalog suggests
387
390
  `recommended`: not a restriction, but a value outside that list is the
388
391
  usual reason for a provider error.
389
392
 
393
+ What the catalog says about the model in its own words (`note`) comes
394
+ through as `endpoint_note`, and
395
+ its notes on single settings (`supported_parameters.<field>.note`) as
396
+ `param_notes`. They explain behaviour somora cannot know, for example
397
+ that an edit model takes its shape from the first reference image.
398
+
390
399
  `media_list` exists because a path in a tool result does not survive
391
400
  context compaction. Its filters: `type` (`image` or `video`), `query`
392
401
  (part of the prompt), `model`, `agent`, `mine_only`, `since` and