Context
“Context”는 한 번의 run을 위해 OpenClaw가 모델에 보내는 모든 것입니다. 이 양은 model의 context window(token limit)에 의해 제한됩니다. 초보자용 mental model:- System prompt (OpenClaw가 구성): rule, tool, skill list, time/runtime, inject된 workspace file
- Conversation history: 이 session의 사용자 message와 assistant message
- Tool call/result + attachment: command output, file read, image/audio 등
Quick start (inspect context)
/status→ “내 window가 얼마나 찼나?”를 빠르게 확인 + session setting 확인/context list→ 무엇이 inject되는지와 대략적인 size (file별 + total)/context detail→ file별, tool schema별, skill entry별, system prompt 크기까지 더 상세한 breakdown/usage tokens→ 일반 답변 하단에 reply별 usage footer 추가/compact→ 오래된 history를 compact entry로 요약해 window 공간 확보
Example output
값은 model, provider, tool policy, workspace 내용에 따라 달라집니다./context list
/context detail
What counts toward the context window
모델이 받는 모든 것이 context window에 포함됩니다.- system prompt (모든 section)
- conversation history
- tool call + tool result
- attachment/transcript (image/audio/file)
- compaction summary와 pruning artifact
- provider wrapper나 숨겨진 header (보이지 않아도 count됨)
How OpenClaw builds the system prompt
system prompt는 OpenClaw 소유이며 run마다 다시 만들어집니다. 포함 항목:- tool list와 짧은 description
- skill list (metadata only, 아래 참고)
- workspace location
- time (UTC + 설정된 경우 user time)
- runtime metadata (host/OS/model/thinking)
- Project Context 아래에 주입된 workspace bootstrap file
Injected workspace files (Project Context)
기본적으로 OpenClaw는 다음 workspace file을 inject합니다. (존재하는 경우)AGENTS.mdSOUL.mdTOOLS.mdIDENTITY.mdUSER.mdHEARTBEAT.mdBOOTSTRAP.md(first-run only)
agents.defaults.bootstrapMaxChars(기본값 20000 chars)로 file별 truncate됩니다.
또한 OpenClaw는 file 전체 합계에 대해 agents.defaults.bootstrapTotalMaxChars(기본값 150000 chars)를 적용합니다.
/context는 raw vs injected size와 truncation 여부를 보여 줍니다.
truncation이 발생하면 runtime은 Project Context 아래에 warning block을 inject할 수 있습니다.
이는 agents.defaults.bootstrapPromptTruncationWarning (off, once, always, 기본값 once)으로 조절합니다.
Skills: what’s injected vs loaded on-demand
system prompt에는 compact한 skills list만 포함됩니다. (name + description + location) 이 목록도 실제 overhead를 차지합니다. skill instruction 본문은 기본적으로 포함되지 않습니다. 모델은 필요할 때만 skill의SKILL.md를 read 하도록 설계되어 있습니다.
Tools: there are two costs
tool은 context에 두 방식으로 영향을 줍니다.- system prompt 안의 tool list text (
Tooling으로 보이는 부분) - tool schema (JSON). 모델이 tool을 호출할 수 있도록 함께 전송되며, plain text로 보이지 않아도 context를 차지합니다.
/context detail은 가장 큰 tool schema를 분해해서 무엇이 overhead를 지배하는지 보여 줍니다.
Commands, directives, and “inline shortcuts”
slash command는 Gateway가 처리합니다. 동작 방식은 몇 가지로 나뉩니다.- Standalone command: message가
/...만으로 구성되면 command로 실행 - Directive:
/think,/verbose,/reasoning,/elevated,/model,/queue는 모델이 보기 전에 제거됨- directive-only message는 session setting을 지속시킴
- 일반 message 안의 inline directive는 per-message hint로 동작
- Inline shortcut (allowlisted sender만): 일반 message 안의 특정
/...token은 즉시 실행될 수 있으며(예: “hey /status”), 남은 text만 모델에 전달됨
Sessions, compaction, and pruning (what persists)
무엇이 message 사이에 유지되는지는 메커니즘마다 다릅니다.- Normal history는 policy에 따라 compact/prune되기 전까지 transcript에 남습니다.
- Compaction은 summary를 transcript에 영구 저장하고 recent message는 유지합니다.
- Pruning은 한 run의 in-memory prompt에서 오래된 tool result를 제거하지만 transcript를 다시 쓰지 않습니다.
legacy context engine을 사용합니다.
kind: "context-engine"을 제공하는 plugin을 설치하고 plugins.slots.contextEngine으로 선택하면,
OpenClaw는 context assembly, /compact, 그리고 관련 subagent context lifecycle hook을 그 engine에 위임합니다.
What /context actually reports
/context는 가능하면 최신 run-built system prompt report를 사용합니다.
System prompt (run)= 마지막 embedded (tool-capable) run에서 캡처되어 session store에 저장된 값System prompt (estimate)= run report가 없을 때, 또는 CLI backend처럼 report를 생성하지 않는 경로에서 즉석 계산한 값