docs: document cacheRetention parameter (#6270)

* docs: document cacheRetention parameter (#6240)

* docs: standardize cacheRetention value quoting style

* style: format anthropic.md table

* Docs: align cacheRetention inline example

---------

Co-authored-by: Sebastian <sebslight@gmail.com>
This commit is contained in:
Kimitaka Watanabe
2026-02-01 23:16:37 +09:00
committed by GitHub
parent b897389b87
commit 7a8a39a141
3 changed files with 27 additions and 7 deletions
+2 -2
View File
@@ -15,13 +15,13 @@ Session pruning trims **old tool results** from the in-memory context right befo
- When `mode: "cache-ttl"` is enabled and the last Anthropic call for the session is older than `ttl`.
- Only affects the messages sent to the model for that request.
- Only active for Anthropic API calls (and OpenRouter Anthropic models).
- For best results, match `ttl` to your model `cacheControlTtl`.
- For best results, match `ttl` to your model `cacheRetention`.
- After a prune, the TTL window resets so subsequent requests keep cache until `ttl` expires again.
## Smart defaults (Anthropic)
- **OAuth or setup-token** profiles: enable `cache-ttl` pruning and set heartbeat to `1h`.
- **API key** profiles: enable `cache-ttl` pruning, set heartbeat to `30m`, and default `cacheControlTtl` to `1h` on Anthropic models.
- **API key** profiles: enable `cache-ttl` pruning, set heartbeat to `30m`, and default `cacheRetention: "short"` on Anthropic models.
- If you set any of these values explicitly, OpenClaw does **not** override them.
## What this improves (cost + cache behavior)