-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Per-agent compaction and contextPruning overrides in agents.list #52732
Copy link
Copy link
Open
kklouzal/openclaw
#1Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Problem
Currently
compactionandcontextPruningsettings can only be configured globally inagents.defaults. When usingagents.listwith per-agent overrides (e.g.,model,workspace), these two settings are rejected as unrecognized keys:Use Case
In a multi-agent setup with different models (e.g., Opus for complex reasoning agents + Sonnet for task execution agents), each model benefits from different context management:
maxHistoryShare: 0.8) and more recent tokens (keepRecentTokens: 80000), with longer cache TTLs (2h)maxHistoryShare: 0.5,keepRecentTokens: 30000, cache TTL30m) to avoid context pollution and driftWith the current global-only config, we have to compromise on settings that are suboptimal for both tiers.
Proposed Solution
Allow
compactionandcontextPruningas optional per-agent overrides inagents.list[*], merging withagents.defaults(same pattern already used formodel,workspace,heartbeat, etc.):{ "agents": { "defaults": { "compaction": { "maxHistoryShare": 0.5, "keepRecentTokens": 30000 }, "contextPruning": { "mode": "cache-ttl", "ttl": "30m" } }, "list": [ { "id": "main", "compaction": { "maxHistoryShare": 0.8, "keepRecentTokens": 80000 }, "contextPruning": { "ttl": "2h" } }, { "id": "worker-agent", "model": "anthropic/claude-sonnet-4-6" } ] } }Environment