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
Copy file name to clipboardExpand all lines: advanced/context-pruning.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,13 @@ Context pruning is distinct from [session compaction](../core-concepts/sessions-
17
17
18
18
## How Pruning Triggers
19
19
20
-
Pruning is **opt-in**— it only runs when `mode: "cache-ttl"`is set on the agent. The flow:
20
+
Pruning is **enabled by default**using `cache-ttl` mode. No configuration is required to activate it. Set `mode: "off"`to disable it explicitly. The flow:
21
21
22
22
```
23
23
history → limitHistoryTurns → sanitizeHistory → LLM
24
24
```
25
25
26
-
> **Note:**`pruneContextMessages` (PruneStage) is **not** part of the main pipeline above. It runs opt-in and separately — only when `mode: "cache-ttl"` is set. The diagram above reflects the standard history preparation path.
26
+
> **Note:**`pruneContextMessages` (PruneStage) is **not** part of the main pipeline above. It runs as a separate stage — by default in `cache-ttl` mode unless explicitly disabled with `mode: "off"`. The diagram above reflects the standard history preparation path.
27
27
28
28
Before each LLM call, GoClaw:
29
29
@@ -78,12 +78,12 @@ This placeholder is configurable. Hard clear can also be disabled entirely.
78
78
79
79
## Configuration
80
80
81
-
Context pruning is **opt-in**. To enable it, set `mode: "cache-ttl"` in the agent config.
81
+
Context pruning runs with `cache-ttl` mode **by default** — no config needed to activate it. To disable pruning entirely, set `mode: "off"`.
82
82
83
83
```json
84
84
{
85
85
"contextPruning": {
86
-
"mode": "cache-ttl"
86
+
"mode": "off"
87
87
}
88
88
}
89
89
```
@@ -115,7 +115,7 @@ All other fields have sensible defaults and are optional.
115
115
116
116
| Field | Default | Description |
117
117
|-------|---------|-------------|
118
-
|`mode`|*(unset — pruning disabled)*| Set to `"cache-ttl"` to enable pruning. Omit or leave empty to keep pruning off. |
118
+
|`mode`|`"cache-ttl"`*(enabled by default)*| Set to `"off"` to disable pruning. Omit or leave empty to keep the default `cache-ttl` mode. |
119
119
|`keepLastAssistants`|`3`| Number of recent assistant turns to protect from pruning. |
120
120
|`softTrimRatio`|`0.25`| Trigger soft trim when context fills this fraction of the context window. |
121
121
|`hardClearRatio`|`0.5`| Trigger hard clear when context fills this fraction after soft trim. |
@@ -130,12 +130,14 @@ All other fields have sensible defaults and are optional.
130
130
131
131
## Configuration Examples
132
132
133
-
### Enable pruning (minimum config)
133
+
### Disable pruning
134
+
135
+
Pruning is on by default. To turn it off:
134
136
135
137
```json
136
138
{
137
139
"contextPruning": {
138
-
"mode": "cache-ttl"
140
+
"mode": "off"
139
141
}
140
142
}
141
143
```
@@ -223,7 +225,7 @@ Once the consolidation pipeline has promoted a body of knowledge to L0 (via drea
223
225
224
226
**Pruning never triggers**
225
227
226
-
Confirm that `mode` is set to `"cache-ttl"`— pruning is opt-in and disabled by default. Also confirm that `contextWindow` is set on the agent — pruning needs a token count to calculate ratios.
228
+
Pruning is enabled by default. If it appears inactive, confirm that `mode` is not explicitly set to `"off"` in the agent config. Also confirm that `contextWindow` is set on the agent — pruning needs a token count to calculate ratios. Finally, verify the context ratio is actually reaching `softTrimRatio` (0.25 by default).
227
229
228
230
**Agent re-runs tools unexpectedly**
229
231
@@ -276,4 +278,4 @@ Tool output is now capped at the source before being added to context. Rather th
276
278
-[Memory System](../core-concepts/memory-system.md) — 3-tier memory architecture and consolidation pipeline
277
279
-[Configuration Reference](/config-reference) — full agent config reference
> **ID namespace protection:** If you pass a `entity_id` or `episodic_id` to `vault_read` by mistake, the tool returns a descriptive error telling you the correct tool to use — rather than a generic "document not found". Always use the `doc_id` from vault results with `vault_read`.
293
+
284
294
> **Note on linking:** Explicit document linking is now handled automatically by the enrichment pipeline. The `vault_link` agent tool has been removed. Links are created via wikilink syntax in document content (`[[target]]`) or generated semantically by EnrichWorker. You can view links via `GET /v1/agents/{agentID}/vault/documents/{docID}/links`.
285
295
286
296
---
@@ -413,4 +423,4 @@ No feature flag. Vault is active if the migration ran and VaultStore initialized
0 commit comments