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.
- package/LICENSE +21 -0
- package/README.md +364 -0
- package/bin/node-version.d.mts +3 -0
- package/bin/node-version.mjs +45 -0
- package/bin/somora.mjs +77 -0
- package/config.example.yaml +896 -0
- package/docs/agents.md +677 -0
- package/docs/api.md +3194 -0
- package/docs/browser.md +317 -0
- package/docs/builder.md +331 -0
- package/docs/cache-strategy.md +373 -0
- package/docs/compaction.md +253 -0
- package/docs/display.md +154 -0
- package/docs/dream-phases.md +891 -0
- package/docs/files.md +387 -0
- package/docs/imagegen.md +366 -0
- package/docs/images/somora-hero.png +0 -0
- package/docs/images/somora-mobile-2026-05-23.png +0 -0
- package/docs/images/somora-tui-2026-05-23.png +0 -0
- package/docs/images/somora-web-2026-05-23.png +0 -0
- package/docs/index.md +178 -0
- package/docs/lsp.md +93 -0
- package/docs/mcp.md +332 -0
- package/docs/memory.md +407 -0
- package/docs/mobile.md +310 -0
- package/docs/models.md +379 -0
- package/docs/projects.md +425 -0
- package/docs/realtime-voice.md +293 -0
- package/docs/resources.md +230 -0
- package/docs/sampling.md +128 -0
- package/docs/security.md +189 -0
- package/docs/sentinel.md +295 -0
- package/docs/setup.md +1217 -0
- package/docs/skills.md +501 -0
- package/docs/team.md +189 -0
- package/docs/thinking.md +463 -0
- package/docs/tmux.md +399 -0
- package/docs/tools.md +117 -0
- package/docs/videogen.md +191 -0
- package/docs/voice.md +288 -0
- package/docs/web.md +893 -0
- package/docs/wiki.md +583 -0
- package/npm-shrinkwrap.json +5670 -0
- package/package.json +116 -0
- package/src/attachments/store.ts +196 -0
- package/src/browser/change-stream.ts +31 -0
- package/src/browser/display.ts +108 -0
- package/src/browser/policy.ts +121 -0
- package/src/browser/screencast.ts +374 -0
- package/src/browser/service.ts +1337 -0
- package/src/browser/session.ts +15 -0
- package/src/browser/snapshot.ts +40 -0
- package/src/cli/auth.ts +117 -0
- package/src/cli/codex.ts +41 -0
- package/src/cli/lsp.ts +71 -0
- package/src/cli/resolvers/clawhub.ts +400 -0
- package/src/cli/setup.ts +835 -0
- package/src/cli/skill.ts +619 -0
- package/src/cli/somora.ts +548 -0
- package/src/cli/systemd-unit.ts +72 -0
- package/src/cli/team.ts +148 -0
- package/src/cli/tui/activity-stream.ts +121 -0
- package/src/cli/tui/api.ts +479 -0
- package/src/cli/tui/app.tsx +1169 -0
- package/src/cli/tui/autocomplete.tsx +55 -0
- package/src/cli/tui/commands.ts +913 -0
- package/src/cli/tui/dream-glyphs.ts +22 -0
- package/src/cli/tui/footer.tsx +15 -0
- package/src/cli/tui/format.ts +28 -0
- package/src/cli/tui/header.tsx +279 -0
- package/src/cli/tui/index.tsx +120 -0
- package/src/cli/tui/markdown.tsx +63 -0
- package/src/cli/tui/sampling.ts +162 -0
- package/src/cli/tui/separator.tsx +13 -0
- package/src/cli/tui/state.ts +42 -0
- package/src/cli/tui/stream.ts +330 -0
- package/src/cli/tui/thinking-text.ts +54 -0
- package/src/cli/tui/turn-views.tsx +499 -0
- package/src/cli/tui/types.ts +410 -0
- package/src/cli/tui/work-queue.ts +161 -0
- package/src/cli/update-args.ts +55 -0
- package/src/cli/wiki.ts +406 -0
- package/src/compaction/index.ts +28 -0
- package/src/compaction/midturn.ts +210 -0
- package/src/compaction/policy.ts +154 -0
- package/src/compaction/summarize.ts +691 -0
- package/src/compaction/template.ts +90 -0
- package/src/compaction/types.ts +148 -0
- package/src/config/loader.ts +276 -0
- package/src/config/reload.ts +43 -0
- package/src/config/types.ts +2292 -0
- package/src/dream/deep-actions.ts +324 -0
- package/src/dream/deep-dispatcher.ts +237 -0
- package/src/dream/deep-llm.ts +388 -0
- package/src/dream/deep-prompts.ts +106 -0
- package/src/dream/deep-runner.ts +757 -0
- package/src/dream/deep-skip-cache.ts +199 -0
- package/src/dream/deep-worker.ts +229 -0
- package/src/dream/json-salvage.ts +34 -0
- package/src/dream/judge.ts +188 -0
- package/src/dream/loop-state.ts +286 -0
- package/src/dream/lucid-actions.ts +303 -0
- package/src/dream/lucid-batches.ts +94 -0
- package/src/dream/lucid-prompt.ts +82 -0
- package/src/dream/lucid-runner.ts +744 -0
- package/src/dream/lucid-storage.ts +277 -0
- package/src/dream/lucid-structure.ts +102 -0
- package/src/dream/lucid-types.ts +137 -0
- package/src/dream/lucid-worker.ts +224 -0
- package/src/dream/rem-dedup.ts +502 -0
- package/src/dream/rem-extract.ts +782 -0
- package/src/dream/rem-reset-run.ts +67 -0
- package/src/dream/rem-runner.ts +696 -0
- package/src/dream/rem-worker.ts +527 -0
- package/src/dream/review-window.ts +71 -0
- package/src/dream/scheduler-state.ts +129 -0
- package/src/dream/storage.ts +497 -0
- package/src/dream/types.ts +133 -0
- package/src/dream/wiki-context.ts +133 -0
- package/src/engine/a2a.ts +33 -0
- package/src/engine/availability.ts +63 -0
- package/src/engine/claude-cli.ts +969 -0
- package/src/engine/codex-app-server-client.ts +294 -0
- package/src/engine/codex-bin.ts +49 -0
- package/src/engine/codex-cli.ts +1014 -0
- package/src/engine/codex-dynamic-tools.ts +239 -0
- package/src/engine/codex-home.ts +63 -0
- package/src/engine/codex-thread-config.ts +74 -0
- package/src/engine/context-budget.ts +257 -0
- package/src/engine/engine-meta-labels.ts +211 -0
- package/src/engine/grok-cli.ts +941 -0
- package/src/engine/inline-think.ts +59 -0
- package/src/engine/model-availability.ts +105 -0
- package/src/engine/openai-compatible.ts +2464 -0
- package/src/engine/reasoning-retry.ts +83 -0
- package/src/engine/registry.ts +13 -0
- package/src/engine/replay.ts +195 -0
- package/src/engine/sampling.ts +90 -0
- package/src/engine/thinking-params.ts +264 -0
- package/src/engine/types.ts +269 -0
- package/src/engine/user-tag.ts +24 -0
- package/src/imagegen/aspect.ts +128 -0
- package/src/imagegen/generate.ts +642 -0
- package/src/imagegen/references.ts +75 -0
- package/src/imagegen/types.ts +154 -0
- package/src/lsp/client.ts +183 -0
- package/src/lsp/fake-server.helper.mjs +42 -0
- package/src/lsp/format.ts +29 -0
- package/src/lsp/index.ts +21 -0
- package/src/lsp/manager.ts +238 -0
- package/src/lsp/registry.ts +151 -0
- package/src/mcp/config.ts +117 -0
- package/src/mcp/hub/audit.ts +55 -0
- package/src/mcp/hub/bridge.ts +115 -0
- package/src/mcp/hub/catalog.ts +69 -0
- package/src/mcp/hub/credentials.ts +406 -0
- package/src/mcp/hub/env-expand.ts +14 -0
- package/src/mcp/hub/manager.ts +770 -0
- package/src/mcp/hub/normalize.ts +213 -0
- package/src/mcp/server.ts +368 -0
- package/src/mcp/tool-schema.ts +20 -0
- package/src/media/capabilities.ts +392 -0
- package/src/media/records.ts +175 -0
- package/src/media/store.ts +217 -0
- package/src/media/types.ts +69 -0
- package/src/memory/chunking.ts +168 -0
- package/src/memory/embeddings.ts +262 -0
- package/src/memory/index.ts +15 -0
- package/src/memory/inject.ts +197 -0
- package/src/memory/manager.ts +996 -0
- package/src/memory/registry.ts +176 -0
- package/src/memory/rescan.ts +101 -0
- package/src/memory/retrieval.ts +586 -0
- package/src/memory/shared-index.ts +372 -0
- package/src/memory/slug.ts +39 -0
- package/src/memory/storage.ts +385 -0
- package/src/memory/watcher.ts +134 -0
- package/src/multimodal/blocks.ts +101 -0
- package/src/multimodal/dimensions.ts +214 -0
- package/src/multimodal/load.ts +86 -0
- package/src/multimodal/mime.ts +135 -0
- package/src/multimodal/pdf-render.ts +80 -0
- package/src/multimodal/user-content.ts +266 -0
- package/src/persona/files.ts +144 -0
- package/src/persona/loader.ts +598 -0
- package/src/persona/skill-gating-store.ts +59 -0
- package/src/persona/tool-gating-store.ts +113 -0
- package/src/projects/focus.ts +186 -0
- package/src/projects/prompt-block.ts +106 -0
- package/src/projects/scheme.ts +107 -0
- package/src/projects/store.ts +144 -0
- package/src/projects/types.ts +73 -0
- package/src/sentinel/dispatcher.ts +97 -0
- package/src/sentinel/schedule.ts +271 -0
- package/src/sentinel/scheduler.ts +840 -0
- package/src/sentinel/store.ts +259 -0
- package/src/sentinel/types.ts +221 -0
- package/src/server/activity-stream.ts +160 -0
- package/src/server/ask-calls.ts +137 -0
- package/src/server/ask-wait-graph.ts +171 -0
- package/src/server/async-tasks.ts +199 -0
- package/src/server/builder-busy.ts +86 -0
- package/src/server/builder-prompt.ts +204 -0
- package/src/server/builder-questions.ts +117 -0
- package/src/server/builder-session.ts +249 -0
- package/src/server/chat-aborts.ts +83 -0
- package/src/server/claude-config-dir.ts +71 -0
- package/src/server/claude-credential-sync.ts +454 -0
- package/src/server/env-file.ts +100 -0
- package/src/server/env.ts +115 -0
- package/src/server/heal-session.ts +151 -0
- package/src/server/history-page.ts +46 -0
- package/src/server/index.ts +7244 -0
- package/src/server/lockfile.ts +89 -0
- package/src/server/logger.ts +67 -0
- package/src/server/logs.ts +187 -0
- package/src/server/loopback-fetch.ts +130 -0
- package/src/server/openai-client.ts +89 -0
- package/src/server/prompt-assembly.ts +334 -0
- package/src/server/restart-reconcile.ts +139 -0
- package/src/server/run-turn-fallback.ts +275 -0
- package/src/server/run-turn-types.ts +91 -0
- package/src/server/run-turn.ts +1474 -0
- package/src/server/sanitize-assistant-text.ts +112 -0
- package/src/server/session-export.ts +220 -0
- package/src/server/session-queue.ts +376 -0
- package/src/server/session-workdir.ts +49 -0
- package/src/server/sse-h2-safe.ts +61 -0
- package/src/server/sse-liveness.ts +162 -0
- package/src/server/sse-serializer.ts +161 -0
- package/src/server/start-turn.ts +249 -0
- package/src/server/steer-inbox.ts +107 -0
- package/src/server/tls-keeper.ts +153 -0
- package/src/server/tool-format.ts +167 -0
- package/src/server/turn-framing.ts +52 -0
- package/src/server/turn-origin-kind.ts +74 -0
- package/src/server/turn-origin.ts +40 -0
- package/src/server/work-ledger.ts +975 -0
- package/src/server/workspace.ts +114 -0
- package/src/setup/config-edit.ts +201 -0
- package/src/setup/presets.ts +71 -0
- package/src/setup/prompt.ts +163 -0
- package/src/setup/tailscale.ts +44 -0
- package/src/skills/bin-checks.ts +227 -0
- package/src/skills/bootstrap.ts +347 -0
- package/src/skills/env-scope.ts +175 -0
- package/src/skills/gating.ts +71 -0
- package/src/skills/lint.ts +202 -0
- package/src/skills/load.ts +368 -0
- package/src/skills/path-helpers.ts +102 -0
- package/src/skills/registry.ts +178 -0
- package/src/ssh/exec.ts +142 -0
- package/src/ssh/index.ts +12 -0
- package/src/ssh/known-hosts.ts +109 -0
- package/src/ssh/pool.ts +307 -0
- package/src/storage/sessions.ts +602 -0
- package/src/team/render.ts +149 -0
- package/src/team/resolve.ts +122 -0
- package/src/team/store.ts +124 -0
- package/src/team/types.ts +111 -0
- package/src/team/write.ts +95 -0
- package/src/testing/isolated-home.mts +46 -0
- package/src/tmux/attention-watcher.ts +272 -0
- package/src/tmux/attention.ts +336 -0
- package/src/tmux/list.ts +91 -0
- package/src/tmux/origin-store.ts +102 -0
- package/src/tmux/tui-markers.ts +267 -0
- package/src/tools/agents/ask-cancel.ts +94 -0
- package/src/tools/agents/ask-result.ts +235 -0
- package/src/tools/agents/ask.ts +704 -0
- package/src/tools/agents/builder-dispatch.ts +217 -0
- package/src/tools/agents/images.ts +104 -0
- package/src/tools/agents/index.ts +42 -0
- package/src/tools/agents/long-task-timeouts.ts +39 -0
- package/src/tools/agents/session-list.ts +136 -0
- package/src/tools/agents/session-model.ts +106 -0
- package/src/tools/agents/spawn.ts +845 -0
- package/src/tools/agents/status.ts +589 -0
- package/src/tools/browser/index.ts +6 -0
- package/src/tools/browser/ops.ts +145 -0
- package/src/tools/browser/tools.ts +184 -0
- package/src/tools/builder/short-descriptions.ts +80 -0
- package/src/tools/builder/tools.ts +222 -0
- package/src/tools/docs/index.ts +1 -0
- package/src/tools/docs/tools.ts +228 -0
- package/src/tools/dream/index.ts +11 -0
- package/src/tools/dream/tools.ts +1002 -0
- package/src/tools/exec/allowlist.ts +233 -0
- package/src/tools/exec/background-detach.helper.mts +27 -0
- package/src/tools/exec/blacklist.ts +336 -0
- package/src/tools/exec/concurrency.ts +150 -0
- package/src/tools/exec/fit-output.ts +82 -0
- package/src/tools/exec/index.ts +7 -0
- package/src/tools/exec/internal-env.ts +89 -0
- package/src/tools/exec/job-store.ts +403 -0
- package/src/tools/exec/local.ts +649 -0
- package/src/tools/exec/remote.ts +399 -0
- package/src/tools/exec/tools.ts +934 -0
- package/src/tools/file/analyze.ts +378 -0
- package/src/tools/file/index.ts +2 -0
- package/src/tools/file/local.ts +707 -0
- package/src/tools/file/lsp-hook.ts +72 -0
- package/src/tools/file/persona-guard.ts +61 -0
- package/src/tools/file/policy.ts +292 -0
- package/src/tools/file/read-format.ts +129 -0
- package/src/tools/file/remote.ts +680 -0
- package/src/tools/file/replace.ts +507 -0
- package/src/tools/file/search-window.ts +224 -0
- package/src/tools/file/tools.ts +658 -0
- package/src/tools/file/write-scope.ts +182 -0
- package/src/tools/gating.ts +106 -0
- package/src/tools/image/budget.ts +82 -0
- package/src/tools/image/index.ts +7 -0
- package/src/tools/image/tools.ts +601 -0
- package/src/tools/index.ts +99 -0
- package/src/tools/memory/index.ts +12 -0
- package/src/tools/memory/tools.ts +399 -0
- package/src/tools/projects/index.ts +1 -0
- package/src/tools/projects/tools.ts +643 -0
- package/src/tools/registry.ts +427 -0
- package/src/tools/resources/index.ts +8 -0
- package/src/tools/resources/tools.ts +176 -0
- package/src/tools/resources/visibility.ts +60 -0
- package/src/tools/sentinel/index.ts +1 -0
- package/src/tools/sentinel/tools.ts +592 -0
- package/src/tools/skill/index.ts +4 -0
- package/src/tools/skill/tools.ts +285 -0
- package/src/tools/time/index.ts +5 -0
- package/src/tools/time/tools.ts +123 -0
- package/src/tools/tmux/index.ts +1 -0
- package/src/tools/tmux/local.ts +277 -0
- package/src/tools/tmux/remote.ts +168 -0
- package/src/tools/tmux/tools.ts +1064 -0
- package/src/tools/tool-output.ts +97 -0
- package/src/tools/types.ts +227 -0
- package/src/tools/video/index.ts +1 -0
- package/src/tools/video/tools.ts +425 -0
- package/src/tools/web/fetch.ts +337 -0
- package/src/tools/web/index.ts +4 -0
- package/src/tools/web/tools.ts +186 -0
- package/src/tools/wiki/index.ts +1 -0
- package/src/tools/wiki/tools.ts +445 -0
- package/src/tts/cache-gc.ts +128 -0
- package/src/tts/prepare-for-tts.ts +114 -0
- package/src/tts/service.ts +332 -0
- package/src/types/events.ts +695 -0
- package/src/types/turn-origin.ts +53 -0
- package/src/version.ts +21 -0
- package/src/videogen/dialects.ts +222 -0
- package/src/videogen/generate.ts +484 -0
- package/src/videogen/jobs.ts +178 -0
- package/src/videogen/runner.ts +125 -0
- package/src/videogen/wake.ts +119 -0
- package/src/voice/realtime/call.ts +948 -0
- package/src/voice/realtime/consult.ts +293 -0
- package/src/voice/realtime/fake-provider.ts +134 -0
- package/src/voice/realtime/manager.ts +384 -0
- package/src/voice/realtime/openai-provider.ts +471 -0
- package/src/voice/realtime/persona.ts +227 -0
- package/src/voice/realtime/session-match.ts +116 -0
- package/src/voice/realtime/types.ts +182 -0
- package/src/wiki/conflict.ts +113 -0
- package/src/wiki/explorer.ts +578 -0
- package/src/wiki/index-builder.ts +172 -0
- package/src/wiki/language.ts +134 -0
- package/src/wiki/log-builder.ts +150 -0
- package/src/wiki/map.ts +258 -0
- package/src/wiki/migration/analyze.ts +304 -0
- package/src/wiki/migration/execute.ts +689 -0
- package/src/wiki/migration/refine.ts +402 -0
- package/src/wiki/migration/store.ts +100 -0
- package/src/wiki/move-page.ts +57 -0
- package/src/wiki/structure-file.ts +192 -0
- package/src/wiki/taxonomy.ts +140 -0
- package/src/wiki/templates.ts +163 -0
- package/src/wiki/types.ts +133 -0
- package/templates/skills/README.md +24 -0
- package/templates/skills/_templates/api-wrapper/SKILL.md +26 -0
- package/templates/skills/_templates/cli-wrapper/BOOTSTRAP.md +32 -0
- package/templates/skills/_templates/cli-wrapper/SKILL.md +24 -0
- package/templates/skills/_templates/default/SKILL.md +25 -0
- package/templates/skills/builder-handover/SKILL.md +96 -0
- package/templates/skills/builder-handover/assets/ORDER.md +12 -0
- package/templates/skills/skill-author/SKILL.md +110 -0
- package/tsconfig.json +22 -0
- package/web/dist/assets/index-BaVv6pB2.js +631 -0
- package/web/dist/assets/index-BaVv6pB2.js.map +1 -0
- package/web/dist/assets/index-V3FV3Z25.css +32 -0
- package/web/dist/favicon.svg +8 -0
- package/web/dist/index.html +20 -0
- package/web/package.json +36 -0
- package/web/tsconfig.json +25 -0
- package/web-mobile/dist/apple-touch-icon.png +0 -0
- package/web-mobile/dist/assets/index-BqKt7IMx.css +1 -0
- package/web-mobile/dist/assets/index-X_vRr6cd.js +88 -0
- package/web-mobile/dist/assets/index-X_vRr6cd.js.map +1 -0
- package/web-mobile/dist/favicon.svg +8 -0
- package/web-mobile/dist/icon-192.png +0 -0
- package/web-mobile/dist/icon-512.png +0 -0
- package/web-mobile/dist/index.html +27 -0
- package/web-mobile/dist/manifest.webmanifest +32 -0
- package/web-mobile/dist/service-worker.js +90 -0
- package/web-mobile/package.json +28 -0
- package/web-mobile/tsconfig.json +25 -0
package/docs/agents.md
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
# Agents
|
|
2
|
+
|
|
3
|
+
An **agent** is a distinct personality somora can chat as. You can have
|
|
4
|
+
many; each has its own memory and its own model preferences.
|
|
5
|
+
|
|
6
|
+
## Two kinds: chat agents and builders
|
|
7
|
+
|
|
8
|
+
Every agent has a kind, set in `agent.yaml` when it is created and never
|
|
9
|
+
changed afterwards. This page describes **chat agents**, the default
|
|
10
|
+
kind. A **builder** (`kind: builder`) shares the server, the sessions,
|
|
11
|
+
the team and the API, but is a coding harness rather than a persona:
|
|
12
|
+
|
|
13
|
+
| | Chat agent | Builder |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| **What it is for** | Talking, thinking, remembering, orchestrating: the assistant you ask, the analyst, the coordinator | Building software in a repository: plan, edit, run, test, report |
|
|
16
|
+
| **Its prompt** | Its persona (`AGENTS.md`, `SOUL.md`, `USER.md`), your team, the wiki map, memory recall | Harness rules, an environment block, the repository's own `AGENTS.md`/`CLAUDE.md`; no persona, no memory recall |
|
|
17
|
+
| **Tools** | The whole programme, gated per agent | A short coding set: files, shell, task list, questions, helpers, colleagues, search |
|
|
18
|
+
| **Turns** | A few rounds; the loop stops at 30 tool calls | Hours; hundreds of rounds, compaction mid-turn, a task list you watch |
|
|
19
|
+
| **Memory** | Notices facts, dreams them into notes and the wiki | Reads memory, never writes it; does not dream |
|
|
20
|
+
| **Works in** | Its workspace | The pinned project's folder, and only there |
|
|
21
|
+
| **Window** | Chat | Chat plus a task panel: mode, plan → Go, tasks, questions, running time |
|
|
22
|
+
| **Made how** | `somora agent create`, or an agent creates one | The same, with `kind: builder` — fixed for life |
|
|
23
|
+
|
|
24
|
+
Everything below applies to chat agents; where a builder differs, the
|
|
25
|
+
line says so, and [builder.md](builder.md) has the whole picture.
|
|
26
|
+
|
|
27
|
+
## Anatomy
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
~/.somora/agents/<name>/
|
|
31
|
+
├── AGENTS.md ← required. behavioural rules + identity (frontmatter)
|
|
32
|
+
├── SOUL.md ← optional. voice / personality
|
|
33
|
+
├── USER.md ← optional. what the agent knows about you
|
|
34
|
+
├── VOICE.md ← optional. hand-written character for spoken calls
|
|
35
|
+
├── agent.yaml ← optional. operator-config (model, tools, voice, REM)
|
|
36
|
+
├── memory/ ← per-agent memory inbox
|
|
37
|
+
│ ├── *.md ← un-consolidated notes
|
|
38
|
+
│ ├── memory.db (+ -wal, -shm) ← derived index
|
|
39
|
+
│ ├── .deep-skip-cache.json ← Deep's hash-cache for skipped files
|
|
40
|
+
│ └── .dreams/ ← REM extraction findings awaiting review
|
|
41
|
+
│ └── processed/ ← resolved findings (audit trail)
|
|
42
|
+
└── sessions/ ← chat history (jsonl + meta json per session)
|
|
43
|
+
├── main.jsonl
|
|
44
|
+
└── 20260501-143022_some-slug.jsonl
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The memory directory is the agent's **inbox** — short-term, volatile.
|
|
48
|
+
Deep periodically promotes content to the shared wiki and deletes the
|
|
49
|
+
source. See [memory.md](memory.md) and [wiki.md](wiki.md).
|
|
50
|
+
|
|
51
|
+
What the agent knows about its **colleagues** — who reports to whom,
|
|
52
|
+
who to involve for what — does not live in the persona. It is rendered
|
|
53
|
+
into the prompt from `~/.somora/team.yaml`, one file for the whole
|
|
54
|
+
install; see [team.md](team.md). Keep `AGENTS.md` to the agent's own
|
|
55
|
+
behaviour and lane.
|
|
56
|
+
|
|
57
|
+
## Creating a new agent
|
|
58
|
+
|
|
59
|
+
The minimum is an agent directory with an `AGENTS.md`. Everything else is
|
|
60
|
+
optional.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
mkdir -p ~/.somora/agents/<your-agent>
|
|
64
|
+
cat > ~/.somora/agents/<your-agent>/AGENTS.md <<'EOF'
|
|
65
|
+
---
|
|
66
|
+
name: <your-agent>
|
|
67
|
+
description: Engineering-minded research assistant
|
|
68
|
+
icon: 🌼
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
- Be precise. Quote sources when you have them.
|
|
72
|
+
- Don't speculate beyond what's in your memory or the conversation.
|
|
73
|
+
- You are who the operator configured you as — stick to the
|
|
74
|
+
description above and the SOUL.md voice.
|
|
75
|
+
EOF
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The next `/agents` call from the CLI lists the new agent — no server
|
|
79
|
+
restart needed.
|
|
80
|
+
|
|
81
|
+
### Identity goes in AGENTS.md frontmatter
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
---
|
|
85
|
+
name: <your-agent> # must match the directory name
|
|
86
|
+
description: ... # one-line — shown by `/agents`
|
|
87
|
+
icon: 🌼 # optional emoji shown in CLI prompts and listings
|
|
88
|
+
color: "#5cf2d6" # optional hex display colour for the web client's agent tint
|
|
89
|
+
role: Researcher # optional short role tag shown under the name in the web dock
|
|
90
|
+
---
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Operator config goes in agent.yaml
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
# ~/.somora/agents/<your-agent>/agent.yaml
|
|
97
|
+
model: opus # alias OR provider/modelId
|
|
98
|
+
fallback: gpt55 # used when primary fails before producing any output
|
|
99
|
+
# (visible: ⇄ chip on that turn + notice in the web UI)
|
|
100
|
+
# fallback: [deep4flash, orhaiku] # or an ordered chain — each is tried in
|
|
101
|
+
# turn when the previous one died before its first
|
|
102
|
+
# output or tool call. Put at least one entry on a
|
|
103
|
+
# different host/provider than the primary: two
|
|
104
|
+
# models on the same GPU box go down together.
|
|
105
|
+
# A model that was unreachable is remembered as such
|
|
106
|
+
# (config `fallback.retryUnavailableMinutes`, default
|
|
107
|
+
# 60): the next turns start on the working backup
|
|
108
|
+
# right away instead of knocking on the dead primary
|
|
109
|
+
# again, still with the fallback chip on the turn
|
|
110
|
+
# (its reason then reads "not tried — marked
|
|
111
|
+
# unavailable since …"). After the hour the primary
|
|
112
|
+
# is tried once more; a success drops the note.
|
|
113
|
+
#
|
|
114
|
+
# One exception to "before producing any output": some providers stream
|
|
115
|
+
# their refusal AS assistant text and only then report the error — a
|
|
116
|
+
# monthly quota notice is the common case. The engine adapter marks
|
|
117
|
+
# those, and the chain still runs, because such text is not an answer.
|
|
118
|
+
# A turn that already called a tool is never repeated on another model:
|
|
119
|
+
# the side effects have happened.
|
|
120
|
+
|
|
121
|
+
# Optional: cross-engine thinking depth (off|low|medium|high)
|
|
122
|
+
# Per-session override via /thinking <level>. Only applies to models with
|
|
123
|
+
# the `reasoning` capability — see thinking.md.
|
|
124
|
+
thinking: medium
|
|
125
|
+
|
|
126
|
+
# Optional: the kind of agent — chat (default) or builder. Fixed at
|
|
127
|
+
# creation. A builder is a coding harness: harness rules instead of
|
|
128
|
+
# SOUL/USER prose, a short coding tool set, no memory recall block, long
|
|
129
|
+
# turns, a task panel in the web. See builder.md.
|
|
130
|
+
kind: chat
|
|
131
|
+
|
|
132
|
+
# Optional: per-agent loop caps for the openai-compatible engine
|
|
133
|
+
# (override the server's agentLoop). Builders default to 500 rounds,
|
|
134
|
+
# 2000 tool calls and 8 hours per turn; chat agents inherit the server
|
|
135
|
+
# config unless set here.
|
|
136
|
+
agentLoop:
|
|
137
|
+
maxRounds: 50
|
|
138
|
+
maxToolCallsPerTurn: 200
|
|
139
|
+
maxTurnMs: 3600000
|
|
140
|
+
|
|
141
|
+
# Optional: steering default for the web client. true = a message typed
|
|
142
|
+
# while a turn is running is handed INTO that turn before its next step
|
|
143
|
+
# (the model reads it between two tool calls); false (default) = it waits
|
|
144
|
+
# in the session queue and becomes its own turn. The steer / queue
|
|
145
|
+
# toggle next to Send flips it per message either way. Works on the openai-compatible,
|
|
146
|
+
# claude-cli and codex-cli engines; other engines always queue. See the
|
|
147
|
+
# `steer` field of POST /chat/send in api.md.
|
|
148
|
+
steering: false
|
|
149
|
+
|
|
150
|
+
# Optional: sampling defaults for openai-compatible models (temperature,
|
|
151
|
+
# top_p, top_k, …). Override the model's own defaults per key; per-session
|
|
152
|
+
# via /sampling and /temp. Dormant on claude-cli / codex-cli — see sampling.md.
|
|
153
|
+
sampling:
|
|
154
|
+
temperature: 1.0
|
|
155
|
+
top_p: 0.95
|
|
156
|
+
|
|
157
|
+
# Optional: per-agent workspace override. Default cwd for the file_* tools.
|
|
158
|
+
# Falls back to config.workspace.default (~/somoraworkspace) when unset.
|
|
159
|
+
workspace:
|
|
160
|
+
path: ~/<your-agent>-workspace
|
|
161
|
+
|
|
162
|
+
# Optional: hide remote resources from this agent. By default every
|
|
163
|
+
# resource defined in config.yaml is visible. See resources.md.
|
|
164
|
+
resources:
|
|
165
|
+
deny: ['production-db']
|
|
166
|
+
|
|
167
|
+
# Optional: per-agent tool visibility — uniform for built-in and
|
|
168
|
+
# external MCP tools. Patterns: exact name, toolset:<tag>, trailing-*
|
|
169
|
+
# glob. deny beats allow; no section = agent sees everything. See mcp.md.
|
|
170
|
+
# Denying a tool removes it from the model's tool list, which is real
|
|
171
|
+
# context saved: the full built-in surface costs roughly 13k tokens per
|
|
172
|
+
# turn. Only tools whose configuration exists are offered in the first
|
|
173
|
+
# place — the web Abilities window lists exactly those, so a switch there
|
|
174
|
+
# always changes something.
|
|
175
|
+
tools:
|
|
176
|
+
deny: ['toolset:exec', 'mcp__parallel__*']
|
|
177
|
+
allow: []
|
|
178
|
+
|
|
179
|
+
# Optional: per-agent skill visibility, same shape and semantics as
|
|
180
|
+
# tools: (deny beats allow, empty allow = all). The Abilities window
|
|
181
|
+
# writes exact-name denies here; a plain list (`skills: [a, b]`) is
|
|
182
|
+
# also accepted as an allow-list. See skills.md.
|
|
183
|
+
skills:
|
|
184
|
+
deny: ['instagram-downloader']
|
|
185
|
+
|
|
186
|
+
# Optional: whether this agent looks at the images it generates.
|
|
187
|
+
# `never` (default) returns path + metadata only; `always` also feeds the
|
|
188
|
+
# image back into the agent's context so it can judge the result and
|
|
189
|
+
# re-prompt on its own — roughly 2k tokens per image. Not a lock: the
|
|
190
|
+
# agent can still set `return_image` per call.
|
|
191
|
+
imageReview: never # never | always
|
|
192
|
+
|
|
193
|
+
# Optional: this agent's voice, for realtime calls (realtime-voice.md).
|
|
194
|
+
# Only what SPEAKING needs — who the agent is comes from its persona
|
|
195
|
+
# files, so there is no second character to maintain. Without this block
|
|
196
|
+
# the agent cannot be called and does not appear in the voice picker.
|
|
197
|
+
# A hand-written character can live in VOICE.md next to AGENTS.md; it
|
|
198
|
+
# replaces the derived one, while the rules that keep a call honest stay.
|
|
199
|
+
voice:
|
|
200
|
+
enabled: true
|
|
201
|
+
voice: ash # alloy ash ballad coral echo sage shimmer verse marin cedar
|
|
202
|
+
language: de
|
|
203
|
+
style: "dry, direct, no small talk"
|
|
204
|
+
consultPolicy: always # auto | substantive | always
|
|
205
|
+
maxSpokenSentences: 4
|
|
206
|
+
|
|
207
|
+
# Optional: REM phase (per-agent session→memory extraction)
|
|
208
|
+
rem:
|
|
209
|
+
enabled: true
|
|
210
|
+
model: gemma4big # required when enabled — never inherits the chat model
|
|
211
|
+
# fallback: deep4pro # optional backup worker, used only when `model`
|
|
212
|
+
# is unreachable (connection refused, 5xx, timeout)
|
|
213
|
+
# fallback: [glm, deep41flash] # or an ordered chain, tried in turn
|
|
214
|
+
idleMinutes: 30 # auto-trigger after N min idle
|
|
215
|
+
chunkTokens: 50000 # range-split for very long sessions
|
|
216
|
+
chunkTimeoutMs: 600000 # 10 min/chunk; gemma-friendly
|
|
217
|
+
participate_in_wiki: true # default true; false = REM only, never Deep
|
|
218
|
+
# thinking: low # optional reasoning depth (off|low|medium|high) for
|
|
219
|
+
# the REM worker; applied only when that model has
|
|
220
|
+
# the `reasoning` capability
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
REM is the per-agent dream phase that watches sessions and proposes
|
|
224
|
+
memory updates with your approval. The platform-wide phases (Deep,
|
|
225
|
+
Lucid) are configured in `~/.somora/config.yaml.wiki.deep / .lucid` —
|
|
226
|
+
not per-agent. See [dream-phases.md](dream-phases.md).
|
|
227
|
+
|
|
228
|
+
`participate_in_wiki: false` opts a single agent's memory inbox out
|
|
229
|
+
of the Deep promote-to-wiki pipeline. REM still runs (the agent still
|
|
230
|
+
gets memory findings), Deep just won't see this agent's inbox. Useful
|
|
231
|
+
for sandbox/scratch agents you don't want contributing to the shared
|
|
232
|
+
wiki.
|
|
233
|
+
|
|
234
|
+
The split between `AGENTS.md` (identity + behavioural rules, agent-editable)
|
|
235
|
+
and `agent.yaml` (operator config) is intentional but not enforced as a
|
|
236
|
+
hard limit — the agent **can** edit `agent.yaml` via the `file_*` tools,
|
|
237
|
+
the path-blacklist allows it. The convention is: persona-content evolves
|
|
238
|
+
in the .md files, operator-config evolves in .yaml. Agents can self-edit
|
|
239
|
+
both.
|
|
240
|
+
|
|
241
|
+
### Seeing and editing the persona without a terminal
|
|
242
|
+
|
|
243
|
+
`/web` → right-click the agent tile → **Configure…** opens the Agent
|
|
244
|
+
window: the three persona files as editors, `agent.yaml` read-only, a
|
|
245
|
+
budget strip (persona total, team block, full prompt, tool schemas —
|
|
246
|
+
characters and estimated tokens against `promptBudgets` in config.yaml)
|
|
247
|
+
and a *Full prompt* tab with the system prompt exactly as the next turn
|
|
248
|
+
would send it. Saves are refused when the agent changed the file in the
|
|
249
|
+
meantime, and every save keeps a backup. See [web.md](web.md).
|
|
250
|
+
|
|
251
|
+
### Self-edit and cross-agent edit
|
|
252
|
+
|
|
253
|
+
Each agent gets a small self-pointer block prepended to its system prompt
|
|
254
|
+
at every turn. It tells the agent its name, where its persona files
|
|
255
|
+
live, the workspace path, the global config location, which remote
|
|
256
|
+
resources are configured, and the convention for referencing local
|
|
257
|
+
files in chat replies (markdown links carrying the bare absolute path
|
|
258
|
+
like `[label](/home/.../file.md)` — those route to a FileView window
|
|
259
|
+
in the web client; wrapped URLs do not). This means the agent can run
|
|
260
|
+
e.g.:
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
file_write({ path: "~/.somora/agents/<your-agent>/USER.md", content: "...", mode: "overwrite" })
|
|
264
|
+
file_read({ path: "~/.somora/agents/<your-agent>/agent.yaml" })
|
|
265
|
+
file_patch({ path: "~/.somora/config.yaml", old_string: "...", new_string: "..." })
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
…to update its own state without you having to dictate paths.
|
|
269
|
+
|
|
270
|
+
**Cross-agent editing is intentionally allowed.** One agent can rewrite
|
|
271
|
+
another's `AGENTS.md`, adjust their `agent.yaml`, or add notes to
|
|
272
|
+
their memory. Agents shape each other in this design, not just
|
|
273
|
+
themselves. The only files in `~/.somora/agents/<*>/` that stay
|
|
274
|
+
off-limits are the `sessions/` dirs (append-only conversation logs
|
|
275
|
+
managed by somora's storage layer). See `files.md` for the full
|
|
276
|
+
write blacklist.
|
|
277
|
+
|
|
278
|
+
To learn more about somora's own architecture, agents can call
|
|
279
|
+
`somora_docs_list` and `somora_docs_read` — those tools serve the
|
|
280
|
+
contents of this `docs/` directory.
|
|
281
|
+
|
|
282
|
+
### Persona in three files
|
|
283
|
+
|
|
284
|
+
| File | Role |
|
|
285
|
+
| ---------- | --------------------------------------------------------------------- |
|
|
286
|
+
| `AGENTS.md` | Behavioural rules. "Reply concisely." "Use tools when asked, don't preface." |
|
|
287
|
+
| `SOUL.md` | Voice / character. "I speak in short sentences. I have dry humour." |
|
|
288
|
+
| `VOICE.md` | Optional, and only for realtime calls: the spoken character, replacing the one derived from the files above. The rules that keep a call honest (ask before answering anything factual, never invent, never refuse work on your own authority) always stay. See [realtime-voice.md](realtime-voice.md). |
|
|
289
|
+
| `USER.md` | Static context about you. "User is Maria. Lives in Berlin. Two cats." |
|
|
290
|
+
|
|
291
|
+
All three are concatenated into the system prompt. Edit them in place; the
|
|
292
|
+
loader re-reads on every turn — no restart needed.
|
|
293
|
+
|
|
294
|
+
### Naming rules
|
|
295
|
+
|
|
296
|
+
Agent directory names must match `^[A-Za-z0-9_-][A-Za-z0-9_.-]*$`. No
|
|
297
|
+
spaces, no slashes. Lowercase is the convention.
|
|
298
|
+
|
|
299
|
+
## Switching agents and sessions
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
/agents — list all configured agents
|
|
303
|
+
/agent <name> — switch to <name>, drop into its main session
|
|
304
|
+
/agent <name> some-topic — switch to <name>, session named "some-topic"
|
|
305
|
+
|
|
306
|
+
/sessions — list sessions of the current agent
|
|
307
|
+
/session some-topic — switch to that session (newest match)
|
|
308
|
+
/new daily-2026-05-02 — create + switch to a new session
|
|
309
|
+
/main — back to the agent's main session
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
`main` is a magic name — every agent always has one, you can't delete it.
|
|
313
|
+
Use `/reset YES` to archive the current main and start fresh while keeping
|
|
314
|
+
the old content as an archived session you can resume any time.
|
|
315
|
+
|
|
316
|
+
## Exporting a session
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
/export — write current session as Markdown to ./<agent>-<session>.md
|
|
320
|
+
/export markdown [path] — same, optionally pick a target path
|
|
321
|
+
/export json [path] — write raw JSONL (full fidelity) to <path or default>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Markdown is the default — a readable transcript with user/assistant
|
|
325
|
+
turns, fenced tool-call blocks, and engine plan/todo items rendered as
|
|
326
|
+
GitHub task lists. JSON is the canonical source (byte-identical to the
|
|
327
|
+
on-disk JSONL); use it for backups or moving a conversation to another
|
|
328
|
+
somora host.
|
|
329
|
+
|
|
330
|
+
In the web client the same export lives in the Sessions tool: each row
|
|
331
|
+
has a file-text icon (Markdown) and a file-json icon (JSONL) that
|
|
332
|
+
trigger a browser download.
|
|
333
|
+
|
|
334
|
+
## Per-session model overrides
|
|
335
|
+
|
|
336
|
+
Each agent has a default model from `agent.yaml`. You can override per
|
|
337
|
+
session:
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
/model — show what's effectively used now
|
|
341
|
+
/model gemma — use gemma for this session only
|
|
342
|
+
/model default — drop the override, fall back to agent default
|
|
343
|
+
/models — list every configured model with its alias
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Overrides are stored in the session's meta-file and survive across server
|
|
347
|
+
restarts.
|
|
348
|
+
|
|
349
|
+
## Talking to another agent
|
|
350
|
+
|
|
351
|
+
Agents talk to each other with `agent_ask`. The message lands in the
|
|
352
|
+
target's **real** session as a user message, so the target answers with
|
|
353
|
+
its full memory, persona and history, and the exchange stays visible
|
|
354
|
+
there afterwards. The target sees a header
|
|
355
|
+
`[Message from agent <name>, session <slug>]` ahead of the message and
|
|
356
|
+
answers as it would answer you; that answer comes back to the asker as
|
|
357
|
+
the tool result. The header is the turn's frame — the server composes
|
|
358
|
+
it beside the message, in the same per-turn field that carries the
|
|
359
|
+
memory-recall block — so the stored text of the turn is the message
|
|
360
|
+
itself, and that is what the target's memory and recall are built
|
|
361
|
+
from.
|
|
362
|
+
It is request-response, not a message bus: an agent that received a
|
|
363
|
+
question answers by finishing its turn, never by calling `agent_ask`
|
|
364
|
+
back at its caller.
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
agent_ask({ agent: "<other-agent>", message: "…" })
|
|
368
|
+
agent_ask({ agent: "<other-agent>", session: "projekt-a", create_session: true, model: "<alias>", message: "…" })
|
|
369
|
+
agent_ask({ agent: "<other-agent>", message: "…", images: ["/abs/path.png"], timeout_ms: 120000 })
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
- **Where it lands.** Without `session`, a reply to the agent that
|
|
373
|
+
wrote to you (or to your spawning parent) goes back to the session
|
|
374
|
+
that message came from; anything else goes to the target's `main`.
|
|
375
|
+
An explicit `session` always wins. An unknown slug is an error that
|
|
376
|
+
lists the target's existing sessions.
|
|
377
|
+
- **Creating a project session.** `create_session: true` creates a
|
|
378
|
+
named slug on the target when it does not exist yet (not `main`, not
|
|
379
|
+
ids, not `sub-…` sessions). `model` pins an alias or `provider/id`
|
|
380
|
+
on the session this call creates; on an existing session it is
|
|
381
|
+
ignored and the result says so in `session_note`. The target is
|
|
382
|
+
told, beside its first message in that session, `[Your session
|
|
383
|
+
'<slug>' was just created by <agent> for this conversation; it runs
|
|
384
|
+
on model <model>.]` — the stored text is the question.
|
|
385
|
+
- **Pictures.** `images` takes absolute paths. somora uploads them and
|
|
386
|
+
puts them on the target's turn, so a model with vision sees them; a
|
|
387
|
+
target without vision gets the vision worker's description.
|
|
388
|
+
- **Queueing.** The call waits in the target session's queue in arrival
|
|
389
|
+
order, like a typed message. It cannot ask yourself; a self-clone
|
|
390
|
+
task is what `spawn_subagent` is for.
|
|
391
|
+
- **Waiting.** `wait: true` (the default) blocks until the reply.
|
|
392
|
+
`timeout_ms` defaults to `agentLoop.longTaskDefaultTimeoutMs`
|
|
393
|
+
(5 minutes) and is capped at `longTaskMaxTimeoutMs` (30 minutes).
|
|
394
|
+
When the target has not answered by then the call returns
|
|
395
|
+
`state: "pending"` with a `call_id` — the target keeps working, and
|
|
396
|
+
the message is never sent again.
|
|
397
|
+
- **Handing over.** `wait: false` hands the message over and returns
|
|
398
|
+
`state: "pending"` with the `call_id` at once (plus `session_created`,
|
|
399
|
+
`session_model` or `session_note` when they apply). The rule: an
|
|
400
|
+
answer needed to go on with this turn → `wait: true`; a job that may
|
|
401
|
+
take its time → `wait: false`. Either way the reply reaches the asker
|
|
402
|
+
— see the wake below.
|
|
403
|
+
- **Taking it back.** `agent_ask_cancel({ call_id })` takes a call of
|
|
404
|
+
your own back. Still waiting in the target's queue: it is removed and
|
|
405
|
+
the target never sees it (`removed`). Already running — the usual
|
|
406
|
+
case, since a free target starts a call within milliseconds: the
|
|
407
|
+
target is told to stop through its running turn (the same channel a
|
|
408
|
+
steered message uses), and whatever it still delivers wakes you no
|
|
409
|
+
more (`withdrawn`, with `steered: true` when the stop message reached
|
|
410
|
+
the turn, `false` when the engine does not read messages mid-turn or
|
|
411
|
+
the turn had just ended). The target stops on its own; the tool never
|
|
412
|
+
aborts another agent's turn — a person's Stop does that. `unknown`
|
|
413
|
+
when nothing runs or waits under the id. Another agent's call cannot
|
|
414
|
+
be taken back.
|
|
415
|
+
|
|
416
|
+
The result has one of three states:
|
|
417
|
+
|
|
418
|
+
| `state` | What it carries | Meaning |
|
|
419
|
+
|---|---|---|
|
|
420
|
+
| `done` | `response`, `ms`, `usage`, `call_id`, `target_agent`, `target_session`, `routing_reason` (`explicit`, `reply_to_origin` or `default_main`), plus `session_inferred`, `session_created`, `session_model`, `session_note` or `routing_note` when they apply | The target answered. `routing_note` appears when no session was named, there was no origin to reply to, and the caller is working in a non-main session: the message went to the target's `main`, which may not have that context. |
|
|
421
|
+
| `pending` | `call_id`, `hint` | The target is still queued or running, or the call was sent with `wait: false`. Fetch the outcome with `agent_ask_result`, or wait to be woken. |
|
|
422
|
+
| `failed` | `error`, `hint` | The target's turn ran and failed — a model or engine error, or `stopped by the user` when a person pressed Stop on it — or it never ran because a person took it out of the target's queue (`removed from the queue by the user before it started`). An asker that had stopped waiting is woken with an `[agent answer]` turn saying so. Not something to retry on your own. |
|
|
423
|
+
|
|
424
|
+
`agent_ask_result({ call_id })` picks up a pending call: `done` with
|
|
425
|
+
the reply, `failed` with the error, or `pending` with `phase` `queued`
|
|
426
|
+
or `running`. `wait_until_done: true` blocks server-side until the call
|
|
427
|
+
finishes or `timeout_ms` passes, which is cheaper than polling. After a
|
|
428
|
+
server restart, pass `agent` and `session` of the original call and the
|
|
429
|
+
answer is read from the target's session.
|
|
430
|
+
|
|
431
|
+
An asker that stopped waiting, or never waited, does not have to
|
|
432
|
+
remember to poll. When the answer lands, the asker is woken in the
|
|
433
|
+
session it asked from with an `[agent answer]` turn. Its text is the
|
|
434
|
+
record of what happened:
|
|
435
|
+
|
|
436
|
+
```text
|
|
437
|
+
[agent answer] <other-agent> has answered the question you sent to session 'main' — you had stopped waiting for it. It begins: "…"
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
The instruction that goes with it — read the whole answer with
|
|
441
|
+
`agent_ask_result({ call_id })`, then do what depended on it —
|
|
442
|
+
accompanies the turn as its frame, beside the text, so the record
|
|
443
|
+
stays one line. A question a person took out of the target's queue
|
|
444
|
+
wakes the asker the same way (`… was removed from the queue by the
|
|
445
|
+
user before <other-agent> saw it — it will not be answered (call_id
|
|
446
|
+
"…")`). The wake waits `agentLoop.wakeGraceMs`
|
|
447
|
+
(default 3 seconds); reading the result through `agent_ask_result`
|
|
448
|
+
inside that window cancels it, and an asker still on the line never
|
|
449
|
+
gets one. The same wake, with the same grace, brings back a finished
|
|
450
|
+
background sub-agent and a rendered video — one mechanism for
|
|
451
|
+
everything an agent started and walked away from.
|
|
452
|
+
|
|
453
|
+
**Follow-ups.** A target may answer with "I am working on it with
|
|
454
|
+
sub-agents and will report back". Its turn ends, and with it the call,
|
|
455
|
+
while the work goes on. The asker does not have to come back for the
|
|
456
|
+
rest. Every piece of work remembers during which turn it was started,
|
|
457
|
+
so the sub-agents the target spawned while answering, the calls it
|
|
458
|
+
made, and whatever those start in turn form a tree under the original
|
|
459
|
+
call. When the last member of that tree has finished and the wake turn
|
|
460
|
+
about it has run in the target's session, the asker hears about it
|
|
461
|
+
exactly once — a follow-up carrying what the target wrote in its wake
|
|
462
|
+
turns about this work, oldest first (the answers of all of them, not
|
|
463
|
+
only the last: a summary given in the first wake turn is not lost to a
|
|
464
|
+
"nothing new" in the second). A wake that is still waiting in the
|
|
465
|
+
queue when the target reads that result itself is withdrawn, so a
|
|
466
|
+
result fetched during another turn does not come back as a stale
|
|
467
|
+
"finished" notice. So that this text is written for the asker and not as a note to
|
|
468
|
+
self, every wake turn under such a call carries, beside the usual
|
|
469
|
+
"fetch the result" frame, where its answer goes:
|
|
470
|
+
|
|
471
|
+
```text
|
|
472
|
+
What you answer in this turn is forwarded to agent <asker> as the follow-up to the question they sent (call_id "<id>") once all the work you started for it has finished — write it as the answer to that question, with the results, not as a note to yourself.
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Four subs are four wakes in the target's session and one
|
|
476
|
+
follow-up to the asker, after the fourth. Work started inside a wake
|
|
477
|
+
turn extends the tree, and grandchildren count. The follow-up is an
|
|
478
|
+
ordinary message from the target agent — `origin.kind: "agent"` with
|
|
479
|
+
the original `call_id`, the text stored as the message — so clients
|
|
480
|
+
render it like any other. Its frame, beside the usual `[Message from
|
|
481
|
+
agent …]` header, says what it is:
|
|
482
|
+
|
|
483
|
+
```text
|
|
484
|
+
[Follow-up on the question you sent earlier (call_id "<id>"): the work it started has finished. Below is its result — treat it as the answer to that question. Continue whatever depended on it; if nothing does, tell your human in one line.]
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Nobody waits for this message, so taking it out of the queue wakes no
|
|
488
|
+
one. There is no follow-up when the tree hangs under a person's turn
|
|
489
|
+
(that session shows the wake itself) or under a turn nobody asked for
|
|
490
|
+
(a sentinel fire, a tmux wake), when the call did not finish `done`,
|
|
491
|
+
when the wake turn was stopped by a person, when the target has already
|
|
492
|
+
sent the asker a message of its own since the call finished, or when the
|
|
493
|
+
asker read the result with `agent_ask_result` during the grace. A wake
|
|
494
|
+
turn that fails for another reason still produces one, saying the work
|
|
495
|
+
finished but the turn reporting it failed, with the error. Like the
|
|
496
|
+
rest of the ledger the tree lives in memory: after a server restart
|
|
497
|
+
there is none, and no follow-up. So a target that says it will report
|
|
498
|
+
back does — through such a follow-up turn — and the asker never asks
|
|
499
|
+
again.
|
|
500
|
+
|
|
501
|
+
Blocking waits are guarded against cycles. The server tracks who waits
|
|
502
|
+
on whom and refuses a call that would close the loop — even through a
|
|
503
|
+
chain of three or more agents — with an error that says so, instead of
|
|
504
|
+
letting both sessions hang. Sub-agents waiting on their parents are
|
|
505
|
+
part of the same graph.
|
|
506
|
+
|
|
507
|
+
## Persona files change only with a backup
|
|
508
|
+
|
|
509
|
+
Agents may edit their own persona files and each other's (self-edit and
|
|
510
|
+
collaborative editing are by design), but never without a copy: every
|
|
511
|
+
`file_write` or `file_patch` on `AGENTS.md`, `SOUL.md`, `USER.md`,
|
|
512
|
+
`VOICE.md` or `agent.yaml` first writes `<file>.bak-<timestamp>` (last
|
|
513
|
+
five kept), the same way the web editor does. See
|
|
514
|
+
[files.md](files.md#persona-files-never-without-a-backup).
|
|
515
|
+
|
|
516
|
+
## What a server restart does to running turns
|
|
517
|
+
|
|
518
|
+
A restart cuts every turn that is running. At the next boot somora
|
|
519
|
+
reads each session's tail: a turn without an end gets an `error`
|
|
520
|
+
(`[somora] This turn was interrupted by a server restart…`) and a
|
|
521
|
+
`turn_end`, so the window stops showing it as running and the model's
|
|
522
|
+
history is whole again. Whoever was waiting for that turn is told: an
|
|
523
|
+
agent that asked with `agent_ask` (waiting or not) or with
|
|
524
|
+
`builder_dispatch` is woken with `[agent answer] … was cut off by a
|
|
525
|
+
server restart before an answer came` and the `call_id`, the parent of a
|
|
526
|
+
helper with a `[subagent attention]` note. Nothing is re-run on its own;
|
|
527
|
+
the asker sends again if it still needs the answer.
|
|
528
|
+
|
|
529
|
+
## Sub-agents
|
|
530
|
+
|
|
531
|
+
`spawn_subagent` delegates a sealed task. The sub runs in a **fresh**
|
|
532
|
+
session of the target persona — `sub-<parent>-<timestamp>`, or
|
|
533
|
+
`sub-self-…` for a clone of the caller — with normal memory, tools and
|
|
534
|
+
thinking, and produces a final answer. Sub sessions stay visible in the
|
|
535
|
+
target's session list with a "sub from" marker.
|
|
536
|
+
|
|
537
|
+
```
|
|
538
|
+
spawn_subagent({ task: "…" }) # clone of yourself, background
|
|
539
|
+
spawn_subagent({ persona: "<other-agent>", task: "…", wait: true })
|
|
540
|
+
spawn_subagent({ task: "…", model: "<alias>", maxRounds: 32, attention: false })
|
|
541
|
+
spawn_subagents({ tasks: [{ task: "…" }, { persona: "<other-agent>", task: "…" }] })
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
- **Every spawn is a background task.** `spawn_subagent` registers a
|
|
545
|
+
task and starts the sub in the background whichever way it is
|
|
546
|
+
called. **`wait: false`** (default) returns the `task_id` at once
|
|
547
|
+
and the caller's turn ends. **`wait: true`** waits for that same
|
|
548
|
+
task and returns the sub's final answer inline — the result, the
|
|
549
|
+
runtime verdict and the `task_id`. Because a synchronous sub is an
|
|
550
|
+
ordinary task, it appears in `subagent_list`, a person can stop it
|
|
551
|
+
with the Stop button, and `subagent_cancel` reaches it and every
|
|
552
|
+
sub it spawned while the parent is still waiting.
|
|
553
|
+
- **When the wait runs out.** The wait is sized off
|
|
554
|
+
`agentLoop.longTaskMaxTimeoutMs` (default 30 minutes, minus a few
|
|
555
|
+
seconds). A sub still working by then does not fail: the tool
|
|
556
|
+
returns `ok: false, wait: "sync", state: "pending"` with the
|
|
557
|
+
`task_id` and a hint, the sub keeps running, and the parent is woken
|
|
558
|
+
with a `[subagent attention]` turn when it finishes — or fetches the
|
|
559
|
+
result itself with `subagent_result({ task_id })`. A sub that
|
|
560
|
+
finishes inside the wait does not wake the parent; the parent has
|
|
561
|
+
the result.
|
|
562
|
+
- **`spawn_subagents`** runs up to eight tasks in parallel and returns
|
|
563
|
+
one result per task in the same order; `wait` applies to the batch.
|
|
564
|
+
- **`model`** overrides the persona's default for this sub (an alias or
|
|
565
|
+
`provider/id` exactly as configured). **`maxRounds`** raises the
|
|
566
|
+
sub's tool-call round cap above `agentLoop.maxRounds` — orchestrator
|
|
567
|
+
subs that spawn and poll their own subs need it. **`images`** works
|
|
568
|
+
as for `agent_ask`.
|
|
569
|
+
- **Checking on a sub.** `subagent_status({ task_id })` reports
|
|
570
|
+
`running`, `done`, `failed` or `cancelled` with target and
|
|
571
|
+
timestamps. `subagent_result({ task_id, wait_until_done?, timeout_ms? })`
|
|
572
|
+
returns `done` with the text, `usage`, the runtime verdict `outcome`
|
|
573
|
+
(`completed`, `partial`, `degraded`, `failed`) with `outcome_reason`,
|
|
574
|
+
`tool_calls`, `rounds`, `files_written`, `media` and
|
|
575
|
+
`follow_ups` (texts that arrived after the sub's report, oldest
|
|
576
|
+
first — see the follow-up wake below); `failed` with
|
|
577
|
+
the error; or `pending`. `subagent_list({ state?, limit? })` lists
|
|
578
|
+
the caller's own tasks, newest first, from the server's in-memory
|
|
579
|
+
registry (a restart empties it). `subagent_cancel({ task_id,
|
|
580
|
+
reason? })` cancels a sub of your own — running, or still waiting in
|
|
581
|
+
its session's queue — and every sub it spawned; files on disk and the
|
|
582
|
+
session stay.
|
|
583
|
+
- **Attention wake.** When a background sub finishes and its result has
|
|
584
|
+
not been fetched, the parent is woken in the session it spawned from
|
|
585
|
+
with a `[subagent attention]` turn. Its text is the record:
|
|
586
|
+
|
|
587
|
+
```text
|
|
588
|
+
[subagent attention] Task '<task_id>' (sub-agent '<name>', session 'sub-…') finished with state 'done'. Outcome: completed, 7 tool calls, 3 rounds. First line: "…" Files written (1): … Generated media (1): …
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
The instruction — fetch the full answer with `subagent_result({
|
|
592
|
+
task_id })`, then continue whatever depended on it — accompanies
|
|
593
|
+
the turn as its frame, beside the text. A brief a person removed
|
|
594
|
+
from the queue wakes the parent the same way (`… was removed from
|
|
595
|
+
the queue by the user before it started — there is no result.`).
|
|
596
|
+
The wake waits `agentLoop.wakeGraceMs` (default 3 seconds); a
|
|
597
|
+
`subagent_result` inside that window cancels it, and
|
|
598
|
+
`attention: false` opts a spawn out of it altogether — except when
|
|
599
|
+
the spawn happened while answering another agent or a voice call:
|
|
600
|
+
they wait for the outcome and hear it through the follow-up, which
|
|
601
|
+
needs that wake, so the flag does not count there. A sub a person
|
|
602
|
+
stops from the queue (■ under From here, `/queue rm` in the TUI)
|
|
603
|
+
wakes its parent the same way, with `was stopped by the user before
|
|
604
|
+
it finished — there is no result`; a sub the parent cancels itself,
|
|
605
|
+
and children taken down with their parent, wake no one.
|
|
606
|
+
- **Follow-up wake.** A sub that starts sub-agents of its own is told
|
|
607
|
+
in its system prompt not to hand in its report while they are still
|
|
608
|
+
working: wait for them (`wait: true`, or `subagent_result` with
|
|
609
|
+
`wait_until_done`) and fold their results in, because what it returns
|
|
610
|
+
is what its parent gets. A sub that reports early anyway does not
|
|
611
|
+
leave its parent without the rest. Whatever a sub starts is
|
|
612
|
+
remembered as started during its task — its own subs, the agents it
|
|
613
|
+
asks, and what those start in turn — and when the last of it has
|
|
614
|
+
finished and the wake about it has run in the sub's session, the
|
|
615
|
+
parent gets one more `[subagent attention]` turn:
|
|
616
|
+
|
|
617
|
+
```text
|
|
618
|
+
[subagent attention] Task '<task_id>' (sub-agent '<name>', session 'sub-…') has a follow-up: the work it started has finished. It begins: "…"
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
Its frame: fetch it with `subagent_result({ task_id })` — the
|
|
622
|
+
follow-up is in its `follow_ups` field — then continue whatever
|
|
623
|
+
depended on it; if nothing does, a short acknowledgement to the user
|
|
624
|
+
is enough. The sub's own wake turns (about its subs) carry the
|
|
625
|
+
matching note — "What you answer in this turn is forwarded to your
|
|
626
|
+
parent (<agent>, session <session>) as the follow-up to task
|
|
627
|
+
'<task_id>' …" — so the sub writes them as its report. The text is
|
|
628
|
+
the final text of that last wake turn;
|
|
629
|
+
`follow_ups` (`result.follow_ups` under `GET /spawn-result`) keeps every
|
|
630
|
+
follow-up of a task, oldest first. A parent hears once, after the
|
|
631
|
+
whole tree, not once per level, and work started inside a wake turn
|
|
632
|
+
extends the tree. The follow-up waits the same grace, and a
|
|
633
|
+
`subagent_result` inside it cancels it. There is none for a task a
|
|
634
|
+
person asked for, for one that did not finish `done`, for a wake turn
|
|
635
|
+
a person stopped, or after a server restart; a wake turn that failed
|
|
636
|
+
for another reason still sends one, saying the work finished but the
|
|
637
|
+
turn reporting it failed, with the error.
|
|
638
|
+
- **Limits.** Nesting is capped at depth 3. Each agent may run 4 subs
|
|
639
|
+
at once and the whole server 16; subs spawned by subs count against
|
|
640
|
+
the parent's 4 and may fill only 3 of them, so an orchestrator sub
|
|
641
|
+
can never lock its own agent out. A spawn that finds a cap full is
|
|
642
|
+
refused with the numbers.
|
|
643
|
+
|
|
644
|
+
A sub's turn is a turn like any other: it waits in its session's
|
|
645
|
+
queue, shows up in `/health` and in the session's queue view, and a
|
|
646
|
+
person can stop it — with Stop in the sub's own session the parent sees
|
|
647
|
+
the task as `failed` with `stopped by the user`; with ■ under "From
|
|
648
|
+
here" in the queue popover (or `/queue rm` in the TUI) as `cancelled`
|
|
649
|
+
with the same reason — or remove it from the queue before it starts,
|
|
650
|
+
which the parent sees as `cancelled` with `removed from the queue by
|
|
651
|
+
the user before it started`. Either way the parent is woken and told.
|
|
652
|
+
|
|
653
|
+
## Programmatic agent creation
|
|
654
|
+
|
|
655
|
+
If you want to script agent creation, the directory layout is the contract.
|
|
656
|
+
Drop the files into `~/.somora/agents/<name>/` and they're picked up on the
|
|
657
|
+
next `GET /agents` request.
|
|
658
|
+
|
|
659
|
+
The HTTP API:
|
|
660
|
+
|
|
661
|
+
```
|
|
662
|
+
GET /agents list agents
|
|
663
|
+
GET /agents/:agent/sessions list sessions
|
|
664
|
+
POST /agents/:agent/sessions {slug} create session
|
|
665
|
+
POST /agents/:agent/sessions/:session/reset archive + reset (spawns REM if configured)
|
|
666
|
+
GET /agents/:agent/memory/notes list memory inbox notes
|
|
667
|
+
GET /agents/:agent/memory/search?q=… hybrid recall across memory+wiki+vault (debug)
|
|
668
|
+
POST /agents/:agent/tools/:name invoke a tool directly (debug)
|
|
669
|
+
POST /dream/run-deep {wait?, force?} trigger Deep manually (platform-wide)
|
|
670
|
+
POST /dream/run-lucid {wait?} trigger Lucid manually (platform-wide)
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
See:
|
|
674
|
+
- [memory.md](memory.md) — the per-agent memory inbox + retrieval
|
|
675
|
+
- [wiki.md](wiki.md) — the shared long-term wiki layer
|
|
676
|
+
- [dream-phases.md](dream-phases.md) — REM/Deep/Lucid mechanics
|
|
677
|
+
- [tools.md](tools.md) — full tool reference
|