“Context” is everything OpenClaw sends to the model for a run. It is bounded by the model’s context window (token limit). Beginner mental model:Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
- System prompt (OpenClaw-built): rules, tools, skills list, time/runtime, and injected workspace files.
- Conversation history: your messages + the assistant’s messages for this session.
- Tool calls/results + attachments: command output, file reads, images/audio, etc.
Quick start (inspect context)
/status→ quick “how full is my window?” view + session settings./context list→ what’s injected + rough sizes (per file + totals)./context detail→ deeper breakdown: per-file, per-tool schema sizes, per-skill entry sizes, and system prompt size./usage tokens→ append per-reply usage footer to normal replies./compact→ summarize older history into a compact entry to free window space.
Example output
Values vary by model, provider, tool policy, and what’s in your workspace./context list
/context detail
What counts toward the context window
Everything the model receives counts, including:- System prompt (all sections).
- Conversation history.
- Tool calls + tool results.
- Attachments/transcripts (images/audio/files).
- Compaction summaries and pruning artifacts.
- Provider “wrappers” or hidden headers (not visible, still counted).
How OpenClaw builds the system prompt
The system prompt is OpenClaw-owned and rebuilt each run. It includes:- Tool list + short descriptions.
- Skills list (metadata only; see below).
- Workspace location.
- Time (UTC + converted user time if configured).
- Runtime metadata (host/OS/model/thinking).
- Injected workspace bootstrap files under Project Context.
Injected workspace files (Project Context)
By default, OpenClaw injects a fixed set of workspace files (if present):AGENTS.mdSOUL.mdTOOLS.mdIDENTITY.mdUSER.mdHEARTBEAT.mdBOOTSTRAP.md(first-run only)
agents.defaults.bootstrapMaxChars (default 12000 chars). OpenClaw also enforces a total bootstrap injection cap across files with agents.defaults.bootstrapTotalMaxChars (default 60000 chars). /context shows raw vs injected sizes and whether truncation happened.
When truncation occurs, the runtime can inject an in-prompt warning block under Project Context. Configure this with agents.defaults.bootstrapPromptTruncationWarning (off, once, always; default once).
Skills: injected vs loaded on-demand
The system prompt includes a compact skills list (name + description + location). This list has real overhead. Skill instructions are not included by default. The model is expected toread the skill’s SKILL.md only when needed.
Tools: there are two costs
Tools affect context in two ways:- Tool list text in the system prompt (what you see as “Tooling”).
- Tool schemas (JSON). These are sent to the model so it can call tools. They count toward context even though you don’t see them as plain text.
/context detail breaks down the biggest tool schemas so you can see what dominates.
Commands, directives, and “inline shortcuts”
Slash commands are handled by the Gateway. There are a few different behaviors:- Standalone commands: a message that is only
/...runs as a command. - Directives:
/think,/verbose,/trace,/reasoning,/elevated,/model,/queueare stripped before the model sees the message.- Directive-only messages persist session settings.
- Inline directives in a normal message act as per-message hints.
- Inline shortcuts (allowlisted senders only): certain
/...tokens inside a normal message can run immediately (example: “hey /status”), and are stripped before the model sees the remaining text.
Sessions, compaction, and pruning (what persists)
What persists across messages depends on the mechanism:- Normal history persists in the session transcript until compacted/pruned by policy.
- Compaction persists a summary into the transcript and keeps recent messages intact.
- Pruning drops old tool results from the in-memory prompt to free context-window space, but does not rewrite the session transcript - the full history is still inspectable on disk.
legacy context engine for assembly and
compaction. If you install a plugin that provides kind: "context-engine" and
select it with plugins.slots.contextEngine, OpenClaw delegates context
assembly, /compact, and related subagent context lifecycle hooks to that
engine instead. ownsCompaction: false does not auto-fallback to the legacy
engine; the active engine must still implement compact() correctly. See
Context Engine for the full
pluggable interface, lifecycle hooks, and configuration.
What /context actually reports
/context prefers the latest run-built system prompt report when available:
System prompt (run)= captured from the last embedded (tool-capable) run and persisted in the session store.System prompt (estimate)= computed on the fly when no run report exists (or when running via a CLI backend that doesn’t generate the report).
Related
Context engine
Custom context injection via plugins.
Compaction
Summarizing long conversations to keep them inside the model window.
System prompt
How the system prompt is built and what it injects each turn.
Agent loop
The full agent execution cycle from inbound message to final reply.