Files
openclaw-skill/openclaw-knowhow-skill/output/openclaw-docs_data/pages/Context_Window_Compaction_2afa724abe.json
Selig 4c966a3ad2 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.
2026-03-13 10:58:30 +08:00

49 lines
2.8 KiB
JSON
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"title": "Context Window & Compaction",
"content": "Every model has a **context window** (max tokens it can see). Long-running chats accumulate messages and tool results; once the window is tight, OpenClaw **compacts** older history to stay within limits.\n\n## What compaction is\n\nCompaction **summarizes older conversation** into a compact summary entry and keeps recent messages intact. The summary is stored in the session history, so future requests use:\n\n* The compaction summary\n* Recent messages after the compaction point\n\nCompaction **persists** in the sessions JSONL history.\n\nSee [Compaction config & modes](/concepts/compaction) for the `agents.defaults.compaction` settings.\n\n## Auto-compaction (default on)\n\nWhen a session nears or exceeds the models context window, OpenClaw triggers auto-compaction and may retry the original request using the compacted context.\n\n* `🧹 Auto-compaction complete` in verbose mode\n* `/status` showing `🧹 Compactions: <count>`\n\nBefore compaction, OpenClaw can run a **silent memory flush** turn to store\ndurable notes to disk. See [Memory](/concepts/memory) for details and config.\n\nUse `/compact` (optionally with instructions) to force a compaction pass:\n\n## Context window source\n\nContext window is model-specific. OpenClaw uses the model definition from the configured provider catalog to determine limits.\n\n## Compaction vs pruning\n\n* **Compaction**: summarises and **persists** in JSONL.\n* **Session pruning**: trims old **tool results** only, **in-memory**, per request.\n\nSee [/concepts/session-pruning](/concepts/session-pruning) for pruning details.\n\n* Use `/compact` when sessions feel stale or context is bloated.\n* Large tool outputs are already truncated; pruning can further reduce tool-result buildup.\n* If you need a fresh slate, `/new` or `/reset` starts a new session id.",
"code_samples": [
{
"code": "/compact Focus on decisions and open questions",
"language": "unknown"
}
],
"headings": [
{
"level": "h2",
"text": "What compaction is",
"id": "what-compaction-is"
},
{
"level": "h2",
"text": "Configuration",
"id": "configuration"
},
{
"level": "h2",
"text": "Auto-compaction (default on)",
"id": "auto-compaction-(default-on)"
},
{
"level": "h2",
"text": "Manual compaction",
"id": "manual-compaction"
},
{
"level": "h2",
"text": "Context window source",
"id": "context-window-source"
},
{
"level": "h2",
"text": "Compaction vs pruning",
"id": "compaction-vs-pruning"
},
{
"level": "h2",
"text": "Tips",
"id": "tips"
}
],
"url": "llms-txt#context-window-&-compaction",
"links": []
}