forked from Selig/openclaw-skill
Initial commit: OpenClaw Skill Collection
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.
This commit is contained in:
56
openclaw-knowhow-skill/docs/reference/concepts/context.md
Normal file
56
openclaw-knowhow-skill/docs/reference/concepts/context.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# Context
|
||||
|
||||
OpenClaw's "Context" represents everything the model receives for a run, constrained by the model's token limit. It encompasses the system prompt, conversation history, tool calls, and attachments.
|
||||
|
||||
## Key Components
|
||||
|
||||
The system breaks down into several parts:
|
||||
|
||||
- **System prompt** (built by OpenClaw): includes rules, tools, skills, time/runtime data, and workspace files
|
||||
- **Conversation history**: user and assistant messages within the session
|
||||
- **Tool results and attachments**: command outputs, file reads, media
|
||||
|
||||
## Context Inspection Commands
|
||||
|
||||
Users can monitor context usage via:
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/status` | Shows window fullness and session settings |
|
||||
| `/context list` | Displays injected files with approximate token counts |
|
||||
| `/context detail` | Provides granular breakdown by file and tool schemas |
|
||||
| `/usage tokens` | Appends token usage to replies |
|
||||
| `/compact` | Summarizes older messages to free space |
|
||||
|
||||
## What Counts Toward the Window
|
||||
|
||||
Everything sent to the model consumes tokens:
|
||||
|
||||
- System prompt sections
|
||||
- Conversation history
|
||||
- Tool calls and results
|
||||
- Attachments and transcripts
|
||||
- Compaction summaries
|
||||
- Provider wrappers
|
||||
|
||||
## Workspace File Injection
|
||||
|
||||
OpenClaw automatically injects these files (if present):
|
||||
|
||||
- `AGENTS.md`
|
||||
- `SOUL.md`
|
||||
- `TOOLS.md`
|
||||
- `IDENTITY.md`
|
||||
- `USER.md`
|
||||
- `HEARTBEAT.md`
|
||||
- `BOOTSTRAP.md`
|
||||
|
||||
Files exceeding `bootstrapMaxChars` (default 20,000) are truncated, with truncation status indicated in context reports.
|
||||
|
||||
## Skills and Tools
|
||||
|
||||
Skills include metadata in the system prompt but load instruction details only when the model calls `/read` on the skill file.
|
||||
|
||||
Tools incur dual costs:
|
||||
1. Text descriptions in the system prompt
|
||||
2. JSON schemas that count toward context separately
|
||||
Reference in New Issue
Block a user