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 e1d3f81
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: services/www/src/docs/content/compaction.mdx
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,7 @@ Add `compaction` to any [OpenCode configuration file](/config):
85
85
|`auto`|`true`| Compact automatically near the context limit, and recover once when a provider rejects a request as too long. Manual compaction always works. |
86
86
|`keep.tokens`|`15000`| Approximate recent conversation kept beside the summary. Larger values preserve more detail but leave less room for new work. |
87
87
|`buffer`|`"15%"`, at least 16k | Share of the model's context window kept free. Automatic compaction starts once the conversation reaches the rest. Larger values compact earlier. |
88
+
|`window`| model limit | Optional token cap on the context window used to schedule automatic compaction. Never raises a model's own limit. |
88
89
89
90
`keep.tokens` accepts a non-negative integer.
90
91
@@ -102,6 +103,36 @@ Add `compaction` to any [OpenCode configuration file](/config):
102
103
- A token count such as `20000` also works. The same count is a large share of a small window and a small share of a large one.
103
104
- A token count at least as large as the model's window is ignored and the default applies.
104
105
106
+
### Window
107
+
108
+
Set `compaction.window` to compact earlier on large-context models while keeping the full window available when a single turn or summary needs it. You can override the window per provider, model, variant, or agent:
More specific settings win (`agents.<id>.compaction.window` > variant/model/provider `settings.compaction.window` > top-level `compaction.window`), so a model or agent can opt back into a larger window up to the model's own limit.
135
+
105
136
## Model
106
137
107
138
By default OpenCode writes the summary itself, using the session's model. Set
Copy file name to clipboardExpand all lines: services/www/src/docs/content/config.mdx
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -364,11 +364,12 @@ Control automatic context compaction and how much recent context it preserves.
364
364
"tokens":15000,
365
365
},
366
366
"buffer":"15%",
367
+
"window":80000,
367
368
},
368
369
}
369
370
```
370
371
371
-
`buffer` is the share of the model's context window kept free before automatic compaction starts.
372
+
`buffer` is the share of the effective context window kept free before automatic compaction starts. `window` optionally caps the context window used to schedule automatic compaction without raising a smaller model limit; override it per provider, model, or variant with `settings.compaction.window`, or per agent with `compaction.window`.
372
373
373
374
Local summaries remain the default. Opt into native provider compaction for both
374
375
automatic and manual requests with a provider or model policy:
0 commit comments