Compiled from official docs, source-code audit, community guides, and hands-on experience. Last updated June 2026, verified against OpenClaw 2026.5.27.
Numbers and config keys below were checked against the current OpenClaw source and docs. Model IDs change often — run
/modelsin chat oropenclaw models statusto see what your providers actually expose; the model names here are examples as of mid-2026.
The single most impactful optimization. Every token in bootstrap files loads into every conversation turn. A 40-message session resends ALL bootstrap content 40 times — context accumulation accounts for 40-50% of typical token usage.
These are enforced by the OpenClaw runtime. Files exceeding these limits are silently truncated.
| Setting | Default | Config Key | What It Does |
|---|---|---|---|
| Per-file limit | 12,000 chars | agents.defaults.bootstrapMaxChars |
Max characters for any single bootstrap file before truncation |
| Total limit | 60,000 chars | agents.defaults.bootstrapTotalMaxChars |
Max characters across all bootstrap files combined |
| Near-limit warning | 0.85 (85%) |
agents.defaults.bootstrapNearLimitRatio |
Flags a file once it reaches 85% of the per-file limit (~10,200 chars) |
Source: src/agents/pi-embedded-helpers/bootstrap.ts — DEFAULT_BOOTSTRAP_MAX_CHARS = 12_000, DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS = 60_000; src/agents/bootstrap-budget.ts — DEFAULT_BOOTSTRAP_NEAR_LIMIT_RATIO = 0.85.
The per-file limit is per file, not the total. A common misconception is that
bootstrapMaxCharscaps your whole workspace — it doesn't. Each file is checked againstbootstrapMaxChars; the sum of all injected files is checked againstbootstrapTotalMaxChars. Both must be respected.
Defaults changed across versions. Earlier releases (≤ 2026.3.x) defaulted to 20,000 / 150,000. Current releases default to 12,000 / 60,000. If you copied an older config, your explicit values still win — but don't assume the old defaults if you rely on them implicitly. Check with
openclaw config get agents.defaults.bootstrapMaxChars.
Truncation behavior: When a file exceeds bootstrapMaxChars, OpenClaw keeps 70% from the head, 20% from the tail, and inserts a truncation marker between them. The middle ~10% is dropped from the agent's context — so instructions buried in the middle of an oversized file silently disappear.
| File | Injected | Rationale |
|---|---|---|
| AGENTS.md | Every turn (full + minimal prompt modes) | Operating instructions — the most expensive file |
| SOUL.md | Every turn (full mode) | Persona and behavior |
| TOOLS.md | Every turn (full + minimal prompt modes) | Tool usage guidance |
| IDENTITY.md | Every turn (full mode) | Name, vibe, emoji |
| USER.md | Every turn (full mode) | User context |
| HEARTBEAT.md | Every turn (full mode) | Periodic task checklist |
| MEMORY.md | Every turn (full mode, main session only) | Long-term curated memory |
| BOOTSTRAP.md | First run only | Deleted after onboarding |
| SKILL.md | On-demand only | NOT part of bootstrap budget |
Sub-agent sessions only inject AGENTS.md + TOOLS.md (minimal prompt mode).
These are NOT enforced by OpenClaw — they are soft targets from community optimization guides to minimize token cost per turn. The rationale: every ~1KB of bootstrap content costs ~250 tokens per message.
| File | Soft Target | Rationale |
|---|---|---|
| AGENTS.md | < 2KB | Injected in ALL sessions including sub-agents. Most frequently loaded file. Procedural rules only — move details to SKILL.md. (OnlyTerp guide) |
| SOUL.md | < 1-3KB | Defines persona, not encyclopedic knowledge. OnlyTerp recommends < 1KB (aggressive); 3KB is a practical ceiling for rich personas. |
| USER.md | < 1KB | Static user info rarely changes. A few lines about name, preferences, timezone is enough. |
| MEMORY.md | < 3KB (~100 lines) | Grows over time and triggers context compaction if too large. VelvetShark Masterclass: "under 100 lines — this isn't a journal, it's a cheat sheet." Use vector search for older memories instead. |
| IDENTITY.md | < 0.5KB | Just name + emoji + vibe. |
| HEARTBEAT.md | < 1KB | Official docs: "keep it short to avoid token burn." A checklist, not detailed instructions. |
| TOOLS.md | < 1KB | "Just reminders, not documentation" (OnlyTerp). Move details to SKILL.md files. |
| Total | < 8-10KB | OnlyTerp suggests < 8KB; 10KB is a comfortable practical ceiling. Well under the 60K hard limit, but optimized for cost. |
Why not just use the full 12K/60K? Math: 10KB of bootstrap ≈ ~2,500 tokens/turn. Over a 40-message session, that's 100K tokens just for bootstrap. Keeping files lean directly reduces cost and latency.
- Measure total size regularly:
wc -c ~/.openclaw/workspace/*.md - Monitor injected vs raw sizes:
/contextin chat shows what's actually loaded and whether truncation happened - No duplication across files — SOUL.md defines behavior, MEMORY.md stores facts. Don't repeat product details in both.
- Every line must earn its place — if removing a line doesn't change bot behavior, remove it.
- SKILL.md is NOT part of bootstrap — loaded only when the skill is invoked. Put detailed instructions there, not in SOUL.md.
- Structure with bullet points — fewer tokens than narrative paragraphs for equivalent information.
# Lower per-file limit (e.g. to force discipline)
openclaw config set agents.defaults.bootstrapMaxChars 10000
# Lower total limit
openclaw config set agents.defaults.bootstrapTotalMaxChars 40000You can also skip re-injecting bootstrap files on safe continuation turns to save tokens:
openclaw config set agents.defaults.contextInjection continuation-skipcontinuation-skip skips workspace bootstrap re-injection on safe continuation turns (after a completed assistant response); heartbeat and post-compaction retries still rebuild full context.
AGENTS.md is injected into every single conversation — including sub-agent sessions (minimal prompt mode). It's the highest-leverage file to keep lean.
- Session startup checklist (which files to read)
- Memory write rules (daily logs, long-term memory)
- Safety rules (don't send external without confirmation)
- Platform formatting rules (no tables in Telegram)
- Heartbeat reference (point to HEARTBEAT.md)
- Group chat behavior → SKILL.md for a group-chat skill, or SOUL.md if always needed
- Camera/TTS/SSH/device notes → TOOLS.md
- Email/calendar/weather checks → HEARTBEAT.md
- Emoji reaction guidelines → remove unless critical
- Generic examples and long explanations → SKILL.md files
- Detailed tool usage → TOOLS.md or SKILL.md
# AGENTS.md
## Every Session
1. Read SOUL.md, USER.md, MEMORY.md
2. Read memory/YYYY-MM-DD.md (today + yesterday)
## Memory
- Daily: memory/YYYY-MM-DD.md
- Long-term: MEMORY.md
- Write to files — mental notes don't survive restarts
## Safety
- Don't send external without confirmation
- trash > rm
## [Your specific operational rules here]OpenClaw memory is a hybrid system: plain Markdown files are the interface the agent reads and writes; an internal SQLite index (FTS5 + vector) powers search. The model only "remembers" what gets saved to disk — there is no hidden state.
| Layer | File | Owner | Bootstrap? | Purpose |
|---|---|---|---|---|
| Long-term | MEMORY.md |
Human (curated) | Yes (main sessions) | Durable facts, decisions, preferences. Budget-constrained. |
| Daily logs | memory/YYYY-MM-DD.md |
Agent (auto-flush) | No (today + yesterday auto-loaded) | Append-only running notes |
| State tracking | memory/*.json |
Agent | No | Structured state (heartbeat counters, pipelines). Full rewrites — not merge-safe. |
| Dream Diary | DREAMS.md (optional) |
Agent | No | Consolidation summaries when dreaming is enabled |
MEMORY.md is human-curated by design. Don't have the agent write to it directly — that's what daily notes and (optionally) dreaming promotion are for.
The agent calls memory_search (hybrid BM25 + vector) and memory_get (read a file or line range). Search needs an embedding provider, auto-detected from whichever API key is present — no manual wiring:
OPENAI_API_KEYGEMINI_API_KEY(free tier sufficient)VOYAGE_API_KEYMISTRAL_API_KEY
For systemd deployments: put the key in the EnvironmentFile referenced by your service unit (e.g. gateway.env), not just a shell profile. The CLI and the gateway process have separate environments.
Verify: openclaw memory status (shows index status, provider, and dreaming state). Rebuild the index with openclaw memory index --force.
- Before context pruning, OpenClaw runs a silent agent turn that prompts the model to save important context to memory files.
- This prevents loss when the conversation summary kicks in.
- Controlled by
compaction.mode—safeguardis the default in current releases. Keep it on.
Disabled by default. When enabled, a background sweep scores recent recalls and promotes only qualified items into MEMORY.md, writing phase summaries to DREAMS.md for review. Useful for long-running agents; leave it off until you understand the promotion gates (openclaw memory rem-harness previews promotions without writing).
- Push only human-owned files: SOUL.md, AGENTS.md, IDENTITY.md, TOOLS.md, USER.md, MEMORY.md, HEARTBEAT.md, skills/
- Never push
memory/orDREAMS.md— agent-owned territory. Use--exclude='./memory' --exclude='DREAMS.md'. - No file locking on workspace files — syncing while the agent is writing can corrupt files. Sync when idle.
- After push: send
/newin chat to force a bootstrap reload.
Configure automatic session reset to prevent unbounded context growth:
openclaw config set session.reset.mode daily
openclaw config set session.reset.atHour 4 # 4 AM gateway local timeYou can also expire idle sessions with session.reset.idleMinutes. When daily + idle are both configured, whichever triggers first wins.
Bootstrap files are read only at session start. After changing SOUL.md, MEMORY.md, AGENTS.md, etc.:
- Send
/newin chat, OR - Restart the gateway (
systemctl restart openclaw.service) - CLI
openclaw message sendsends FROM the bot — it doesn't trigger/newprocessing
/new— start fresh session (reloads all bootstrap files)/reset— clear current session/context— show what's loaded in the system prompt (raw vs injected sizes, truncation flags)/compact— summarize older context to free tokens/model <name>//models— switch model (per-session) / list available models
- Use HEARTBEAT.md as a checklist — the bot reads it on each heartbeat
- If HEARTBEAT.md is effectively empty (only blank lines + headers), OpenClaw skips the heartbeat to save API calls
- Track state in a JSON file (
memory/heartbeat-state.json) for message counting, rate limiting, topic rotation - Set
activeHoursto avoid night-time messages and wasted API calls
- Heartbeat runs in the main session — it shares context with DM conversations
- Increase the interval (e.g.
60m) on a quiet agent — each heartbeat is a full agent turn that burns tokens
"heartbeat": {
"every": "30m",
"activeHours": {
"start": "10:00",
"end": "22:00",
"timezone": "Asia/Almaty"
},
"target": "telegram",
"directPolicy": "allow"
}The current
heartbeatshape usesevery(a duration string like"30m"),activeHours,target, anddirectPolicy. The olderintervalMinutesfield was replaced — if you copied an old config, runopenclaw doctor --fixto migrate it.
When syncing files from macOS to a Linux server via rsync, files get the local UID (e.g. 501:staff) instead of the server user. The bot process (running as openclaw) can then fail to write to these files silently.
Fix after every rsync:
chown -R openclaw:openclaw /home/openclaw/.openclaw/workspace/Or use rsync with --chown:
rsync -av --chown=openclaw:openclaw ./workspace/ openclaw-host:/home/openclaw/.openclaw/workspace/- Directories:
700 - Config / credential files:
600(especiallyopenclaw.jsonandgateway.envwith tokens) - Workspace bootstrap files:
644 - Credentials directory:
700
| Check | Expected | How to verify |
|---|---|---|
| Gateway bind | loopback (127.0.0.1) |
openclaw config get gateway.bind |
| Public IP | None (VPN/Tailscale for remote access) | VM has no external IP |
| DM policy | pairing |
openclaw config get channels.telegram.dmPolicy |
| Group policy | allowlist + requireMention |
openclaw config get channels.telegram.groupPolicy |
| mDNS | off |
openclaw config get discovery.mdns.mode |
| Security audit | 0 critical | openclaw security audit --deep |
| Node.js | ≥ 22.12 (latest 22.x recommended) | node --version |
| Third-party skills | Reviewed source only | Never install unverified marketplace skills |
| MCP servers | Trusted endpoints only | Review each mcp.servers.* entry; secrets via ${ENV}, never inline |
openclaw security audit --deep
openclaw doctorOn a loopback-only gateway, gateway.auth.mode: token adds defense-in-depth (a pre-shared challenge-response token). mode: none is acceptable only when the gateway is bound to loopback and the host is single-tenant — on small VMs the token handshake can occasionally time out during slow startup, so some operators use none there. Never expose the gateway port with auth.mode: none.
[Unit]
Description=OpenClaw Gateway
After=network.target
[Service]
Type=simple
User=openclaw
Group=openclaw
WorkingDirectory=/home/openclaw
EnvironmentFile=/home/openclaw/.openclaw/gateway.env
ExecStart=/home/openclaw/.npm-global/bin/openclaw gateway run
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetKeep API keys here, not in openclaw.json or a shell profile:
OPENAI_API_KEY=sk-...
PATH=/home/openclaw/.npm-global/bin:/usr/local/bin:/usr/bin:/bin
HOME=/home/openclawWithout memory limits, the gateway on a 4 GB VM tends to accumulate 1.5–2 GB RSS over 2–3 days and eats into swap — typical Node.js heap fragmentation plus cached state (sessions, MCP tool definitions, vector index, plugins). Use a drop-in override so it survives reinstalling OpenClaw:
sudo mkdir -p /etc/systemd/system/openclaw.service.d/
sudo tee /etc/systemd/system/openclaw.service.d/memory-limits.conf > /dev/null << 'EOF'
[Service]
MemoryAccounting=yes
MemoryHigh=1500M
MemoryMax=2500M
OOMScoreAdjust=200
EOF
sudo systemctl daemon-reload
# then restart the gateway (see "Operations" below)- MemoryHigh=1500M — soft limit: the kernel throttles allocations and V8 GC gets more aggressive. Does not release already-accumulated swap — only a full restart does that.
- MemoryMax=2500M — hard limit. An OOM kill is recovered by
Restart=alwaysin ~10s. A periodic cold restart beats an unkillable swap storm. - OOMScoreAdjust=200 — under system-wide pressure the kernel prefers to kill the gateway over critical processes (sshd, journald).
- Confirm:
systemctl show openclaw.service | grep -E "^(Memory|OOMScore)".
systemctl daemon-reload # after editing the service/override file
systemctl restart openclaw.service # apply config changes
systemctl status openclaw.service # check health
journalctl -u openclaw -f # live logs (alternative to openclaw logs)Planned-restart hygiene. If you run an external health-check/watchdog timer that restarts the gateway on a failed
/healthprobe, stop that timer before a planned restart, then restart, then wait for/healthto return200before re-enabling it — otherwise the watchdog can kill a gateway that is still loading (plugin/MCP init can take 1-3 minutes, longer right after a major version bump):curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:18789/health # expect 200
# Check current version
openclaw --version
# Check latest available
npm info openclaw version
# Update (prefer npm over `openclaw update`, which can loop on small VMs)
npm install -g openclaw@latest
# Restart and wait for health
systemctl restart openclaw.service
sleep 30 && curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:18789/health # expect 200
# Verify
openclaw --version
openclaw doctorAfter updating, always:
- Run
openclaw doctor --fixto handle schema migrations (cron storage, streaming config, heartbeat shape). - Run
openclaw security auditto check for new findings. - Confirm
/healthreturns200— major version bumps can take a few minutes to fully start.
OpenClaw is a first-class MCP client — register external Model Context Protocol servers under mcp.servers in openclaw.json and the agent calls their tools directly as <serverName>__<toolName>. No CLI bridge is required.
| Transport | When to use | Required fields |
|---|---|---|
stdio |
Local child process (Python/Node CLIs, uvx ...) |
command, args, optional env, cwd |
sse (default if transport omitted) |
Remote MCP over Server-Sent Events | url, optional headers |
streamable-http |
Remote MCP requiring HTTP streaming | url + "transport": "streamable-http", optional headers |
headers values support ${ENV_VAR} interpolation. Only http: / https: URLs are accepted. URL credentials and header secrets are redacted from logs.
{
mcp: {
sessionIdleTtlMs: 600000, // stdio servers reaped after 10 min idle
servers: {
"exa-search": {
url: "https://mcp.exa.ai/mcp?tools=web_search_advanced_exa&exaApiKey=${EXA_API_KEY}",
transport: "streamable-http"
},
grafana: {
command: "uvx",
args: ["mcp-grafana"],
env: {
GRAFANA_URL: "https://example.grafana.net",
GRAFANA_SERVICE_ACCOUNT_TOKEN: "${GRAFANA_SA_TOKEN}"
}
}
}
}
}- Form:
<serverName>__<toolName>(double-underscore separator) - Server prefix ≤ 30 chars; full tool name ≤ 64 chars
- Non-
A-Za-z0-9_-chars are replaced with-; collisions get numeric suffixes
OpenClaw rejects interpreter-startup env keys before launching a stdio server — NODE_OPTIONS, PYTHONSTARTUP, PYTHONPATH, PERL5OPT, RUBYOPT, SHELLOPTS, PS4, and similar — to block code-injection via environment. Ordinary credential / *_API_KEY vars pass through. If a stdio MCP genuinely needs a blocked key, set it on the gateway host process (e.g. in gateway.env) instead.
Treat every MCP server as trusted code. Its tools run with the agent's privileges and can read whatever you pass them. Only register endpoints and binaries you trust, keep secrets in
${ENV}references (never inline in config), and review a server's published tool list before wiring it up.
openclaw mcp list # list configured servers
openclaw mcp show <name> [--json] # show one server
openclaw mcp set <name> '<json-object>' # add or replace one server
openclaw mcp unset <name> # removemcp set only edits config — it does not validate reachability. Restart the gateway and make a tool call to confirm. Tools are lazy-loaded — the connection happens on the first call.
skills/
my-skill/
SKILL.md # YAML frontmatter + instructions
(optional files)
SKILL.md is loaded only when the skill is invoked, not on every message. It's safe to put detailed instructions here. Keep the detailed "how-to" in SKILL.md and only the behavioral core in SOUL.md.
<workspace>/skills/— highest (per-agent)~/.openclaw/skills/— managed (all agents)- Bundled — lowest (defaults)
- Never install unverified third-party skills. In Feb 2026, 341 malicious marketplace skills were found stealing credentials (Atomic Stealer malware). Review the source of any skill before installing.
- Skills can read environment variables and execute code — treat them as trusted code.
- Prefer skills from known publishers; pin to a reviewed revision rather than tracking a moving branch.
| Command | Purpose |
|---|---|
openclaw status |
Full overview |
openclaw status --deep |
Deep channel probes |
openclaw doctor |
Config validation (--fix to auto-repair) |
openclaw logs --follow |
Live gateway logs |
openclaw memory search "query" |
Test memory search |
openclaw memory status |
Index status, embedding provider, dreaming state |
openclaw cron list |
Scheduled jobs |
- Gateway responds:
curl -s http://127.0.0.1:18789/health - Telegram connected:
openclaw channels status - Memory search works:
openclaw memory status
| Pitfall | Symptom | Fix |
|---|---|---|
| Bootstrap file too large | Bot ignores instructions buried mid-file | /context to check; trim files or raise bootstrapMaxChars |
| Confusing per-file vs total limit | Total looks fine but one file truncates | Per file ≤ bootstrapMaxChars (12K), total ≤ bootstrapTotalMaxChars (60K) |
| Missing file ownership | Bot can't update memory/state | chown -R openclaw:openclaw workspace/ after rsync |
| No embedding provider | Memory search unavailable | Set an OpenAI/Gemini/Voyage/Mistral key in gateway.env |
Changed bootstrap, no /new |
Bot uses old persona | Send /new or restart gateway |
| Env vars in shell only | Gateway doesn't see API keys | Put them in EnvironmentFile, not .bashrc |
| SOUL.md duplicates MEMORY.md | Wasted context tokens | Keep facts in MEMORY.md only |
| Telegram message spam | Bot sends bursts of partial messages | channels.telegram.streaming.mode: "off"; openclaw doctor --fix to migrate legacy streaming config |
| Isolated cron can't deliver | Scheduled job runs but no Telegram message | Use --session main (or a named session key), not --session isolated |
| Cron job killed mid-run | Long skill job stops at ~10 min | Set --timeout-seconds explicitly (default is 600s) |
| MEMORY.md grows unbounded | Frequent compaction, slow responses | Curate to < 100 lines; use vector search for older memories |
# Check current models and auth status
openclaw models status
# List available models
openclaw models
# Set default model (writes agents.defaults.model.primary)
openclaw models set <provider>/<model-id>Example model IDs (mid-2026 — verify against your providers):
- Anthropic:
anthropic/claude-opus-4-8,anthropic/claude-sonnet-4-6 - OpenAI:
openai/gpt-5.5,openai-codex/gpt-5.5(subscription OAuth) - Google:
google/gemini-3-pro(if the native provider errors, use an OpenAI-compatible endpoint)
You can configure fallbacks so the agent degrades gracefully:
agents: {
defaults: {
model: {
primary: "openai-codex/gpt-5.5",
fallbacks: ["anthropic/claude-sonnet-4-6"]
}
}
}Subscription-based providers (OpenAI Codex, Claude subscription) use an OAuth device flow that needs an interactive terminal to paste the callback URL back. On a headless server, run the login over an SSH session with a TTY (or inside tmux/screen):
openclaw models auth login --provider openai-codex
# open the printed URL in your browser, authorize,
# then paste the http://localhost:1455/auth/callback?... URL back into the terminalAlways back up the config first — auth login rewrites part of the model config:
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak-pre-auth-$(date +%Y%m%d-%H%M)Two known upstream quirks of
auth login(reproduce on 2026.4.x–2026.5.x):
- It can overwrite
agents.defaults.modelswith a partial provider tree, dropping entries for other providers. The JSON key isagents.defaults.models, NOTmodels.configuredModels— writing the wrong path crash-loops the gateway. After login, diff against the auto-savedopenclaw.json.bakand re-add anything missing.- It may leave an orphan profile instead of replacing the existing one (see below). Verify after every re-auth.
Re-auth historically created a new profile keyed by the OAuth email and left the old :default profile in place with a stale JWT. The dead duplicate later shows up in openclaw models status as expired expires in 0m and is easy to mistake for the active profile dying — prompting another re-auth and yet another orphan.
A 30-second check after every re-auth:
# Decode the JWT in each profile's `access` field and compare account IDs
AUTH=~/.openclaw/agents/main/agent/auth-profiles.json
jq -r '.profiles | to_entries[] | .key + "|" + .value.access' "$AUTH" |
while IFS="|" read -r k tok; do
payload=$(echo "$tok" | cut -d. -f2 | base64 -d 2>/dev/null)
acct=$(echo "$payload" | jq -r '."https://api.openai.com/auth".chatgpt_account_id // "?"')
email=$(echo "$payload" | jq -r '."https://api.openai.com/profile".email // "?"')
echo "$k account=$acct email=$email"
done- Same account ID across two profiles → orphan. Keep the fresh one, delete the stale key.
- Different account IDs → legitimate multi-account setup. Leave both.
Remove a confirmed orphan (back up first):
cp "$AUTH" "$AUTH.bak-$(date +%Y%m%d)"
python3 -c '
import json, sys
p = sys.argv[1]
d = json.load(open(p))
d["profiles"].pop(sys.argv[2], None) # the orphan key
json.dump(d, open(p, "w"), indent=2)
' "$AUTH" "openai-codex:default"
# then restart the gateway and confirm /health = 200Status note: On OpenClaw 2026.5.7+ this was mitigated upstream (re-auth overwrites the same-email profile correctly). Keep the check anyway — it's cheap, and the bug has regressed across upgrades before.
OpenClaw agents can spawn sub-agents via the sessions_spawn tool — isolated background sessions for parallel or long-running tasks.
- A sub-agent receives minimal prompt mode: only AGENTS.md + TOOLS.md (no SOUL.md, MEMORY.md, USER.md)
- Results are returned to the parent via an announce mechanism
- Default
maxSpawnDepth = 1(no sub-sub-agents) - You can override the model per sub-agent (delegate cheap tasks to cheaper models)
- Parallel research: spawn sub-agents to query different sources simultaneously, then aggregate
- Multi-step workflows: a morning briefing spawns 3 sub-agents in parallel instead of sequential tool calls
- Context isolation: heavy analysis runs in a sub-agent; only the summary returns to the main session
- Cost optimization: delegate formatting/parsing to cheaper models
- No MEMORY.md — pass critical context in the
tasktext - No SOUL.md — the sub-agent won't respond "in character"
- Best-effort delivery — results may be lost on gateway failure
- VM RAM constrains concurrency
agents: {
defaults: {
tools: {
subagents: {
runTimeoutSeconds: 120,
maxSpawnDepth: 1
}
}
}
}Docs: https://docs.openclaw.ai/tools/subagents
- OpenClaw Official Docs
- Context — bootstrap injection, truncation,
/context - System Prompt — prompt construction, injected files, prompt modes
- Agent Workspace — workspace file map
- Memory — hybrid Markdown + SQLite, dreaming
- Configuration: Agents —
bootstrapMaxChars,bootstrapTotalMaxChars,contextInjection - Sessions · Compaction
- Heartbeat
- Cron Jobs
- Skills · Subagents
- Security
- AGENTS.md Template
src/agents/pi-embedded-helpers/bootstrap.ts—DEFAULT_BOOTSTRAP_MAX_CHARS = 12_000,DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS = 60_000, 70/20 truncationsrc/agents/bootstrap-budget.ts—DEFAULT_BOOTSTRAP_NEAR_LIMIT_RATIO = 0.85
- VelvetShark: OpenClaw Memory Masterclass — MEMORY.md < 100 lines, daily logs + promotion
- OnlyTerp/openclaw-optimization-guide — aggressive targets (SOUL < 1KB, AGENTS < 2KB, total < 8KB)
- LaoZhang: OpenClaw Cost Optimization — context accumulation = 40-50% of token usage
- LumaDock: Reduce OpenClaw API Costs — model tiering, session management