6 custom skills (assign-task, dispatch-webhook, daily-briefing, task-capture, qmd-brain, tts-voice) with technical documentation. Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
78 lines
8.1 KiB
JSON
Executable File
78 lines
8.1 KiB
JSON
Executable File
{
|
||
"title": "Context",
|
||
"content": "“Context” is **everything OpenClaw sends to the model for a run**. It is bounded by the model’s **context window** (token limit).\n\nBeginner mental model:\n\n* **System prompt** (OpenClaw-built): rules, tools, skills list, time/runtime, and injected workspace files.\n* **Conversation history**: your messages + the assistant’s messages for this session.\n* **Tool calls/results + attachments**: command output, file reads, images/audio, etc.\n\nContext is *not the same thing* as “memory”: memory can be stored on disk and reloaded later; context is what’s inside the model’s current window.\n\n## Quick start (inspect context)\n\n* `/status` → quick “how full is my window?” view + session settings.\n* `/context list` → what’s injected + rough sizes (per file + totals).\n* `/context detail` → deeper breakdown: per-file, per-tool schema sizes, per-skill entry sizes, and system prompt size.\n* `/usage tokens` → append per-reply usage footer to normal replies.\n* `/compact` → summarize older history into a compact entry to free window space.\n\nSee also: [Slash commands](/tools/slash-commands), [Token use & costs](/token-use), [Compaction](/concepts/compaction).\n\nValues vary by model, provider, tool policy, and what’s in your workspace.\n\n### `/context detail`\n\n## What counts toward the context window\n\nEverything the model receives counts, including:\n\n* System prompt (all sections).\n* Conversation history.\n* Tool calls + tool results.\n* Attachments/transcripts (images/audio/files).\n* Compaction summaries and pruning artifacts.\n* Provider “wrappers” or hidden headers (not visible, still counted).\n\n## How OpenClaw builds the system prompt\n\nThe system prompt is **OpenClaw-owned** and rebuilt each run. It includes:\n\n* Tool list + short descriptions.\n* Skills list (metadata only; see below).\n* Workspace location.\n* Time (UTC + converted user time if configured).\n* Runtime metadata (host/OS/model/thinking).\n* Injected workspace bootstrap files under **Project Context**.\n\nFull breakdown: [System Prompt](/concepts/system-prompt).\n\n## Injected workspace files (Project Context)\n\nBy default, OpenClaw injects a fixed set of workspace files (if present):\n\n* `AGENTS.md`\n* `SOUL.md`\n* `TOOLS.md`\n* `IDENTITY.md`\n* `USER.md`\n* `HEARTBEAT.md`\n* `BOOTSTRAP.md` (first-run only)\n\nLarge files are truncated per-file using `agents.defaults.bootstrapMaxChars` (default `20000` chars). `/context` shows **raw vs injected** sizes and whether truncation happened.\n\n## Skills: what’s injected vs loaded on-demand\n\nThe system prompt includes a compact **skills list** (name + description + location). This list has real overhead.\n\nSkill instructions are *not* included by default. The model is expected to `read` the skill’s `SKILL.md` **only when needed**.\n\n## Tools: there are two costs\n\nTools affect context in two ways:\n\n1. **Tool list text** in the system prompt (what you see as “Tooling”).\n2. **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.\n\n`/context detail` breaks down the biggest tool schemas so you can see what dominates.\n\n## Commands, directives, and “inline shortcuts”\n\nSlash commands are handled by the Gateway. There are a few different behaviors:\n\n* **Standalone commands**: a message that is only `/...` runs as a command.\n* **Directives**: `/think`, `/verbose`, `/reasoning`, `/elevated`, `/model`, `/queue` are stripped before the model sees the message.\n * Directive-only messages persist session settings.\n * Inline directives in a normal message act as per-message hints.\n* **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.\n\nDetails: [Slash commands](/tools/slash-commands).\n\n## Sessions, compaction, and pruning (what persists)\n\nWhat persists across messages depends on the mechanism:\n\n* **Normal history** persists in the session transcript until compacted/pruned by policy.\n* **Compaction** persists a summary into the transcript and keeps recent messages intact.\n* **Pruning** removes old tool results from the *in-memory* prompt for a run, but does not rewrite the transcript.\n\nDocs: [Session](/concepts/session), [Compaction](/concepts/compaction), [Session pruning](/concepts/session-pruning).\n\n## What `/context` actually reports\n\n`/context` prefers the latest **run-built** system prompt report when available:\n\n* `System prompt (run)` = captured from the last embedded (tool-capable) run and persisted in the session store.\n* `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).\n\nEither way, it reports sizes and top contributors; it does **not** dump the full system prompt or tool schemas.",
|
||
"code_samples": [
|
||
{
|
||
"code": "🧠 Context breakdown\nWorkspace: <workspaceDir>\nBootstrap max/file: 20,000 chars\nSandbox: mode=non-main sandboxed=false\nSystem prompt (run): 38,412 chars (~9,603 tok) (Project Context 23,901 chars (~5,976 tok))\n\nInjected workspace files:\n- AGENTS.md: OK | raw 1,742 chars (~436 tok) | injected 1,742 chars (~436 tok)\n- SOUL.md: OK | raw 912 chars (~228 tok) | injected 912 chars (~228 tok)\n- TOOLS.md: TRUNCATED | raw 54,210 chars (~13,553 tok) | injected 20,962 chars (~5,241 tok)\n- IDENTITY.md: OK | raw 211 chars (~53 tok) | injected 211 chars (~53 tok)\n- USER.md: OK | raw 388 chars (~97 tok) | injected 388 chars (~97 tok)\n- HEARTBEAT.md: MISSING | raw 0 | injected 0\n- BOOTSTRAP.md: OK | raw 0 chars (~0 tok) | injected 0 chars (~0 tok)\n\nSkills list (system prompt text): 2,184 chars (~546 tok) (12 skills)\nTools: read, edit, write, exec, process, browser, message, sessions_send, …\nTool list (system prompt text): 1,032 chars (~258 tok)\nTool schemas (JSON): 31,988 chars (~7,997 tok) (counts toward context; not shown as text)\nTools: (same as above)\n\nSession tokens (cached): 14,250 total / ctx=32,000",
|
||
"language": "unknown"
|
||
},
|
||
{
|
||
"code": "🧠 Context breakdown (detailed)\n…\nTop skills (prompt entry size):\n- frontend-design: 412 chars (~103 tok)\n- oracle: 401 chars (~101 tok)\n… (+10 more skills)\n\nTop tools (schema size):\n- browser: 9,812 chars (~2,453 tok)\n- exec: 6,240 chars (~1,560 tok)\n… (+N more tools)",
|
||
"language": "unknown"
|
||
}
|
||
],
|
||
"headings": [
|
||
{
|
||
"level": "h2",
|
||
"text": "Quick start (inspect context)",
|
||
"id": "quick-start-(inspect-context)"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "Example output",
|
||
"id": "example-output"
|
||
},
|
||
{
|
||
"level": "h3",
|
||
"text": "`/context list`",
|
||
"id": "`/context-list`"
|
||
},
|
||
{
|
||
"level": "h3",
|
||
"text": "`/context detail`",
|
||
"id": "`/context-detail`"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "What counts toward the context window",
|
||
"id": "what-counts-toward-the-context-window"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "How OpenClaw builds the system prompt",
|
||
"id": "how-openclaw-builds-the-system-prompt"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "Injected workspace files (Project Context)",
|
||
"id": "injected-workspace-files-(project-context)"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "Skills: what’s injected vs loaded on-demand",
|
||
"id": "skills:-what’s-injected-vs-loaded-on-demand"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "Tools: there are two costs",
|
||
"id": "tools:-there-are-two-costs"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "Commands, directives, and “inline shortcuts”",
|
||
"id": "commands,-directives,-and-“inline-shortcuts”"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "Sessions, compaction, and pruning (what persists)",
|
||
"id": "sessions,-compaction,-and-pruning-(what-persists)"
|
||
},
|
||
{
|
||
"level": "h2",
|
||
"text": "What `/context` actually reports",
|
||
"id": "what-`/context`-actually-reports"
|
||
}
|
||
],
|
||
"url": "llms-txt#context",
|
||
"links": []
|
||
} |