2025-12-17 11:29:12 +01:00
---
2026-03-19 10:27:41 -07:00
summary: "Agent runtime, workspace contract, and session bootstrap"
2025-12-17 11:29:12 +01:00
read_when:
- Changing agent runtime, workspace bootstrap, or session behavior
2026-01-31 16:04:03 -05:00
title: "Agent Runtime"
2025-12-17 11:29:12 +01:00
---
2026-01-31 21:13:13 +09:00
2026-03-19 10:27:41 -07:00
# Agent Runtime
2025-12-17 11:29:12 +01:00
2026-03-19 10:27:41 -07:00
OpenClaw runs a single embedded agent runtime.
2025-12-17 11:29:12 +01:00
## Workspace (required)
2026-01-30 03:15:10 +01:00
OpenClaw uses a single agent workspace directory (`agents.defaults.workspace` ) as the agent’ s **only ** working directory (`cwd` ) for tools and context.
2025-12-17 11:29:12 +01:00
2026-01-30 03:15:10 +01:00
Recommended: use `openclaw setup` to create `~/.openclaw/openclaw.json` if missing and initialize the workspace files.
2025-12-17 11:29:12 +01:00
2026-01-10 14:51:21 -06:00
Full workspace layout + backup guide: [Agent workspace ](/concepts/agent-workspace )
2026-01-07 00:04:03 +01:00
2026-01-09 12:44:23 +00:00
If `agents.defaults.sandbox` is enabled, non-main sessions can override this with
per-session workspaces under `agents.defaults.sandbox.workspaceRoot` (see
2026-01-10 14:51:21 -06:00
[Gateway configuration ](/gateway/configuration )).
2026-01-03 20:37:57 +01:00
2025-12-17 11:29:12 +01:00
## Bootstrap files (injected)
2026-01-30 03:15:10 +01:00
Inside `agents.defaults.workspace` , OpenClaw expects these user-editable files:
2026-01-31 21:13:13 +09:00
2025-12-17 11:29:12 +01:00
- `AGENTS.md` — operating instructions + “memory”
- `SOUL.md` — persona, boundaries, tone
- `TOOLS.md` — user-maintained tool notes (e.g. `imsg` , `sag` , conventions)
2025-12-20 16:51:53 +00:00
- `BOOTSTRAP.md` — one-time first-run ritual (deleted after completion)
- `IDENTITY.md` — agent name/vibe/emoji
- `USER.md` — user profile + preferred address
2025-12-17 11:29:12 +01:00
2026-01-30 03:15:10 +01:00
On the first turn of a new session, OpenClaw injects the contents of these files directly into the agent context.
2025-12-17 11:29:12 +01:00
2026-01-07 10:03:50 +00:00
Blank files are skipped. Large files are trimmed and truncated with a marker so prompts stay lean (read the file for full content).
2026-01-30 03:15:10 +01:00
If a file is missing, OpenClaw injects a single “missing file” marker line (and `openclaw setup` will create a safe default template).
2025-12-17 11:29:12 +01:00
2026-01-06 19:50:06 +01:00
`BOOTSTRAP.md` is only created for a **brand new workspace ** (no other bootstrap files present). If you delete it after completing the ritual, it should not be recreated on later restarts.
To disable bootstrap file creation entirely (for pre-seeded workspaces), set:
``` json5
{ agent: { skipBootstrap: true } }
```
2026-01-08 23:06:56 +01:00
## Built-in tools
2025-12-17 11:29:12 +01:00
2026-01-12 03:42:49 +00:00
Core tools (read/exec/edit/write and related system tools) are always available,
subject to tool policy. `apply_patch` is optional and gated by
`tools.exec.applyPatch` . `TOOLS.md` does **not ** control which tools exist; it’ s
2026-01-31 21:13:13 +09:00
guidance for how _ you _ want them used.
2025-12-17 11:29:12 +01:00
2025-12-20 12:22:15 +01:00
## Skills
2026-04-03 14:50:48 -04:00
OpenClaw loads skills from these locations (highest precedence first):
2026-01-31 21:13:13 +09:00
2025-12-20 12:22:15 +01:00
- Workspace: `<workspace>/skills`
2026-04-03 14:50:48 -04:00
- Project agent skills: `<workspace>/.agents/skills`
- Personal agent skills: `~/.agents/skills`
- Managed/local: `~/.openclaw/skills`
- Bundled (shipped with the install)
- Extra skill folders: `skills.load.extraDirs`
2025-12-20 12:22:15 +01:00
2026-01-10 14:51:21 -06:00
Skills can be gated by config/env (see `skills` in [Gateway configuration ](/gateway/configuration )).
2025-12-20 12:22:15 +01:00
2026-03-19 10:27:41 -07:00
## Runtime boundaries
2025-12-22 18:05:44 +01:00
2026-03-19 10:35:09 -07:00
The embedded agent runtime is built on the Pi agent core (models, tools, and
prompt pipeline). Session management, discovery, tool wiring, and channel
delivery are OpenClaw-owned layers on top of that core.
2025-12-22 18:05:44 +01:00
2025-12-17 11:29:12 +01:00
## Sessions
Session transcripts are stored as JSONL at:
2026-01-31 21:13:13 +09:00
2026-01-30 03:15:10 +01:00
- `~/.openclaw/agents/<agentId>/sessions/<SessionId>.jsonl`
2025-12-17 11:29:12 +01:00
2026-01-30 03:15:10 +01:00
The session ID is stable and chosen by OpenClaw.
2026-03-19 10:27:41 -07:00
Legacy session folders from other tools are not read.
2025-12-17 11:29:12 +01:00
2025-12-20 16:01:49 +01:00
## Steering while streaming
2026-01-03 04:26:36 +01:00
When queue mode is `steer` , inbound messages are injected into the current run.
2026-03-22 15:30:03 -07:00
Queued steering is delivered **after the current assistant turn finishes
executing its tool calls**, before the next LLM call. Steering no longer skips
remaining tool calls from the current assistant message; it injects the queued
message at the next model boundary instead.
2026-01-03 04:26:36 +01:00
When queue mode is `followup` or `collect` , inbound messages are held until the
current turn ends, then a new agent turn starts with the queued payloads. See
2026-01-10 14:51:21 -06:00
[Queue ](/concepts/queue ) for mode + debounce/cap behavior.
2026-01-03 04:26:36 +01:00
2026-01-09 22:40:58 +01:00
Block streaming sends completed assistant blocks as soon as they finish; it is
**off by default ** (`agents.defaults.blockStreamingDefault: "off"` ).
2026-01-09 12:44:23 +00:00
Tune the boundary via `agents.defaults.blockStreamingBreak` (`text_end` vs `message_end` ; defaults to text_end).
Control soft block chunking with `agents.defaults.blockStreamingChunk` (defaults to
2026-01-03 16:45:53 +01:00
800– 1200 chars; prefers paragraph breaks, then newlines; sentences last).
2026-01-09 18:19:55 +00:00
Coalesce streamed chunks with `agents.defaults.blockStreamingCoalesce` to reduce
2026-01-13 07:15:57 +00:00
single-line spam (idle-based merging before send). Non-Telegram channels require
2026-01-09 22:40:58 +01:00
explicit `*.blockStreaming: true` to enable block replies.
2026-01-03 20:37:57 +01:00
Verbose tool summaries are emitted at tool start (no debounce); Control UI
streams tool output via agent events when available.
2026-01-07 17:15:53 +01:00
More details: [Streaming + chunking ](/concepts/streaming ).
2025-12-20 16:01:49 +01:00
2026-01-17 17:16:20 +00:00
## Model refs
Model refs in config (for example `agents.defaults.model` and `agents.defaults.models` ) are parsed by splitting on the **first ** `/` .
- Use `provider/model` when configuring models.
- If the model ID itself contains `/` (OpenRouter-style), include the provider prefix (example: `openrouter/moonshotai/kimi-k2` ).
2026-04-04 14:55:44 +01:00
- If you omit the provider, OpenClaw tries an alias first, then a unique
configured-provider match for that exact model id, and only then falls back
2026-04-04 19:48:46 +01:00
to the configured default provider. If that provider no longer exposes the
configured default model, OpenClaw falls back to the first configured
provider/model instead of surfacing a stale removed-provider default.
2026-01-17 17:16:20 +00:00
2025-12-17 11:29:12 +01:00
## Configuration (minimal)
At minimum, set:
2026-01-31 21:13:13 +09:00
2026-01-09 12:44:23 +00:00
- `agents.defaults.workspace`
2026-01-13 06:16:43 +00:00
- `channels.whatsapp.allowFrom` (strongly recommended)
2025-12-17 11:29:12 +01:00
---
2026-02-07 15:40:35 -05:00
_ Next: [Group Chats](/channels/group-messages) _ 🦞