You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2160b97
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/concepts/compaction.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,8 +110,11 @@ When `agents.defaults.compaction.maxActiveTranscriptBytes` is set, OpenClaw
110
110
triggers normal local compaction before a run if transcript history reaches
111
111
that size. This is useful for long-running sessions where provider-side context
112
112
management may keep model context healthy while persisted transcript history
113
-
keeps growing. It does not split raw bytes; it asks the normal compaction
114
-
pipeline to create a semantic summary.
113
+
keeps growing. Set a positive byte count or size string such as `"20mb"` to opt
114
+
in; `0` or an unset value disables the guard. It does not split raw bytes; it
115
+
asks the normal compaction pipeline to create a semantic summary. For Codex
116
+
app-server sessions, the same threshold caps native rollout transcripts and
117
+
oversized native threads restart fresh.
115
118
116
119
<Warning>
117
120
The byte guard applies to the active SQLite transcript history. Legacy JSONL
@@ -120,7 +123,7 @@ checkpoint artifacts are not the active compaction target.
120
123
121
124
### Successor transcripts
122
125
123
-
When `agents.defaults.compaction.truncateAfterCompaction` is enabled, a context engine may return an explicit compacted successor session identity. OpenClaw adopts that successor and records checkpoint metadata against it. The built-in SQLite compactor keeps the current session identity and does not create a second runtime transcript.
126
+
A context engine may return an explicit compacted successor session identity. OpenClaw adopts that successor and records checkpoint metadata against it. The built-in SQLite compactor keeps the current session identity and does not create a second runtime transcript.
124
127
125
128
OpenClaw no longer writes separate `.checkpoint.*.jsonl` copies for new
126
129
compactions. Existing legacy checkpoint files can still be used while referenced
model:"openrouter/anthropic/claude-sonnet-4-6", // optional compaction-only model override
613
-
truncateAfterCompaction:true, // adopt a context-engine successor when one is returned
614
-
maxActiveTranscriptBytes:"20mb", // optional preflight local compaction trigger
613
+
maxActiveTranscriptBytes:"20mb", // opt in to preflight local compaction
615
614
notifyUser:true, // notices when compaction starts/completes and on memory-flush degradation (default: false)
616
615
memoryFlush: {
617
616
enabled:true,
@@ -638,8 +637,7 @@ Delegated consults with a requesting agent keep that requester as their owner. W
638
637
-`postIndexSync`: post-compaction session-memory reindex mode. Default: `"async"`. Use `"await"` for strongest freshness, `"async"` for lower compaction latency, or `"off"` only when session-memory sync is handled elsewhere.
639
638
-`postCompactionSections`: optional AGENTS.md H2/H3 section names to re-inject after compaction. Leave unset or use `[]` to disable.
640
639
-`model`: optional `provider/model-id` or bare alias from `agents.defaults.models` for compaction summarization only. Bare aliases resolve before dispatch; configured literal model IDs retain precedence on collisions. Use this when the main session should keep one model but compaction summaries should run on another; when unset, compaction uses the session's primary model.
641
-
-`truncateAfterCompaction`: allows a context engine to advance the session to an explicit compacted successor identity. The built-in SQLite compactor keeps the current identity. Default: `false`.
642
-
-`maxActiveTranscriptBytes`: optional byte threshold (`number` or strings like `"20mb"`) that triggers normal local compaction before a run when transcript history grows past the threshold. Requires `truncateAfterCompaction`; durable size reduction also requires a context engine that returns a successor identity. Disabled when unset or `0`.
640
+
-`maxActiveTranscriptBytes`: byte threshold (`number` or strings like `"20mb"`) that opts in to normal local compaction before a run when transcript history reaches the threshold. For Codex app-server sessions, the same threshold caps native rollout transcripts and oversized native threads restart fresh. Disabled when unset or `0`. When a context engine returns an explicit compacted successor identity, OpenClaw adopts it; the built-in SQLite compactor keeps the current identity.
643
641
-`notifyUser`: when `true`, sends brief context-maintenance notices to the user: when compaction starts and completes (for example, "Compacting context..." and "Compaction complete"), and when a pre-compaction memory flush is exhausted so the reply continues in a degraded state (for example, "Memory maintenance temporarily failed; continuing your reply."). Disabled by default to keep these notices silent.
644
642
-`memoryFlush`: silent agentic turn before auto-compaction to store durable memories. Set `model` to an exact provider/model such as `ollama/qwen3:8b` when this housekeeping turn should stay on a local model; the override does not inherit the active session fallback chain. `forceFlushTranscriptBytes` forces the flush when transcript size reaches the threshold even if token counters are stale. Skipped when workspace is read-only.
Copy file name to clipboardExpand all lines: docs/reference/session-management-compaction.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -217,7 +217,7 @@ Two triggers in the embedded OpenClaw agent:
217
217
218
218
Two additional guards run outside these two triggers:
219
219
220
-
-**Preflight local compaction**: set `agents.defaults.compaction.maxActiveTranscriptBytes` (bytes or a string like `"20mb"`) to trigger local compaction before opening the next run once the active transcript reaches that size. Normal semantic compaction still runs. Durable size reduction requires `truncateAfterCompaction` plus a context engine that returns an explicit successor identity.
220
+
-**Preflight local compaction**: set `agents.defaults.compaction.maxActiveTranscriptBytes`to a positive byte threshold (bytes or a string like `"20mb"`) to trigger local compaction before opening the next run once the active transcript reaches that size. Normal semantic compaction still runs. For Codex app-server sessions, the same threshold caps native rollout transcripts and oversized native threads restart fresh. Unset or `0` disables the guard.
221
221
-**Mid-turn precheck**: set `agents.defaults.compaction.midTurnPrecheck.enabled: true` (default `false`) to add a tool-loop guard. After a tool result is appended and before the next model call, OpenClaw estimates prompt pressure using the same preflight budget logic used at turn start. If context no longer fits, the guard does not compact inline - it raises a structured mid-turn precheck signal, stops the current prompt submission, and lets the outer run loop use the existing recovery path (truncate oversized tool results when that is enough, or trigger the configured compaction mode and retry). Works with both `default` and `safeguard` compaction modes, including provider-backed safeguard compaction. Independent of `maxActiveTranscriptBytes`: the byte-size guard runs before a turn opens, mid-turn precheck runs later, after new tool results are appended.
222
222
223
223
## Compaction settings
@@ -241,7 +241,7 @@ Set `enabled: false` to disable threshold-driven auto-compaction inside the embe
241
241
242
242
Manual `/compact` uses `agents.defaults.compaction.keepRecentTokens` (default: `20000`) and keeps that recent-tail cut point.
243
243
244
-
When `truncateAfterCompaction` is enabled, OpenClaw adopts an explicit successor identity returned by a context engine. The built-in SQLite compactor keeps the current session identity. Branch/restore checkpoint actions use a returned successor when present; legacy pre-compaction checkpoint files remain readable while referenced.
244
+
OpenClaw adopts an explicit successor identity returned by a context engine. The built-in SQLite compactor keeps the current session identity. Branch/restore checkpoint actions use a returned successor when present; legacy pre-compaction checkpoint files remain readable while referenced.
0 commit comments