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
- Mattermost/model picker: add Telegram-style interactive provider/model browsing for `/oc_model` and `/oc_models`, fix picker callback updates, and emit a normal confirmation reply when a model is selected. (#38767) thanks @mukhtharcm.
56
56
- Docker/multi-stage build: restructure Dockerfile as a multi-stage build to produce a minimal runtime image without build tools, source code, or Bun; add `OPENCLAW_VARIANT=slim` build arg for a bookworm-slim variant. (#38479) Thanks @sallyom.
57
57
- Google/Gemini 3.1 Flash-Lite: add first-class `google/gemini-3.1-flash-lite-preview` support across model-id normalization, default aliases, media-understanding image lookups, Google Gemini CLI forward-compat fallback, and docs.
58
+
- Agents/compaction model override: allow `agents.defaults.compaction.model` to route compaction summarization through a different model than the main session, and document the override across config help/reference surfaces. (#38753) thanks @starbuck100.
Copy file name to clipboardExpand all lines: docs/concepts/compaction.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,36 @@ Compaction **persists** in the session’s JSONL history.
24
24
Use the `agents.defaults.compaction` setting in your `openclaw.json` to configure compaction behavior (mode, target tokens, etc.).
25
25
Compaction summarization preserves opaque identifiers by default (`identifierPolicy: "strict"`). You can override this with `identifierPolicy: "off"` or provide custom text with `identifierPolicy: "custom"` and `identifierInstructions`.
26
26
27
+
You can optionally specify a different model for compaction summarization via `agents.defaults.compaction.model`. This is useful when your primary model is a local or small model and you want compaction summaries produced by a more capable model. The override accepts any `provider/model-id` string:
28
+
29
+
```json
30
+
{
31
+
"agents": {
32
+
"defaults": {
33
+
"compaction": {
34
+
"model": "openrouter/anthropic/claude-sonnet-4-5"
35
+
}
36
+
}
37
+
}
38
+
}
39
+
```
40
+
41
+
This also works with local models, for example a second Ollama model dedicated to summarization or a fine-tuned compaction specialist:
42
+
43
+
```json
44
+
{
45
+
"agents": {
46
+
"defaults": {
47
+
"compaction": {
48
+
"model": "ollama/llama3.1:8b"
49
+
}
50
+
}
51
+
}
52
+
}
53
+
```
54
+
55
+
When unset, compaction uses the agent's primary model.
56
+
27
57
## Auto-compaction (default on)
28
58
29
59
When a session nears or exceeds the model’s context window, OpenClaw triggers auto-compaction and may retry the original request using the compacted context.
model:"openrouter/anthropic/claude-sonnet-4-5", // optional compaction-only model override
1008
1009
memoryFlush: {
1009
1010
enabled:true,
1010
1011
softThresholdTokens:6000,
@@ -1021,6 +1022,7 @@ Periodic heartbeat runs.
1021
1022
-`identifierPolicy`: `strict` (default), `off`, or `custom`. `strict` prepends built-in opaque identifier retention guidance during compaction summarization.
1022
1023
-`identifierInstructions`: optional custom identifier-preservation text used when `identifierPolicy=custom`.
1023
1024
-`postCompactionSections`: optional AGENTS.md H2/H3 section names to re-inject after compaction. Defaults to `["Session Startup", "Red Lines"]`; set `[]` to disable reinjection. When unset or explicitly set to that default pair, older `Every Session`/`Safety` headings are also accepted as a legacy fallback.
1025
+
-`model`: optional `provider/model-id` override for compaction summarization only. 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.
1024
1026
-`memoryFlush`: silent agentic turn before auto-compaction to store durable memories. Skipped when workspace is read-only.
'AGENTS.md H2/H3 section names re-injected after compaction so the agent reruns critical startup guidance. Leave unset to use "Session Startup"/"Red Lines" with legacy fallback to "Every Session"/"Safety"; set to [] to disable reinjection entirely.',
1016
+
"agents.defaults.compaction.model":
1017
+
"Optional provider/model override used only for compaction summarization. Set this when you want compaction to run on a different model than the session default, and leave it unset to keep using the primary agent model.",
1016
1018
"agents.defaults.compaction.memoryFlush":
1017
1019
"Pre-compaction memory flush settings that run an agentic memory write before heavy compaction. Keep enabled for long sessions so salient context is persisted before aggressive trimming.",
0 commit comments