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
Currently agents.defaults.compaction applies uniformly to all agents. In multi-agent deployments, agents have fundamentally different context-retention needs. An orchestrator agent needs long memory; a specialist agent should compact aggressively after task completion.
The Problem
We run 17 agents in a 4-tier hierarchy:
Tier
Role
Context Need
Ideal Compaction
King (orchestrator)
Dispatch, audit, decision
Long — needs full dispatch/audit history
70% threshold, preserve decisions
Scene Leads (4)
Project management, review
Medium — needs project context + member interaction
65% threshold, preserve milestones
Specialists (12)
Execute specific tasks
Short — finish task, release context fast
55% threshold, aggressive compaction
But OpenClaw only supports:
{"agents": {"defaults": {"compaction": {"mode": "default",// Same for ALL agents"reserveTokens": 12000// Same for ALL agents}}}}
Result
Orchestrator compacts too aggressively → loses dispatch history → forgets what it assigned to whom
Specialist agents compact too slowly → waste context window on completed tasks → eventually hit token overflow
Proposed Solution
Per-agent compaction override
{"agents": {"defaults": {"compaction": {"mode": "default","reserveTokens": 12000}},"entries": {"main": {"compaction": {"mode": "safeguard",// More conservative for King"reserveTokens": 20000,"thresholdPercent": 70// Only compact at 70% full}},"dev-lead": {"compaction": {"thresholdPercent": 65}},"dev-frontend": {"compaction": {"mode": "default","reserveTokens": 8000,"thresholdPercent": 55// Compact early and often}}}}}
Why This Matters
Different agents have different memory needs — This is fundamental to any multi-agent system
No workaround exists — We tried building external compaction via session-guardian skill, but compaction is a core engine feature; external tools can only trigger it, not configure it
Small implementation surface — The compaction config already exists at agents.defaults; extending it to agents.entries.<name>.compaction follows the existing override pattern
Our Workaround (Published on ClawHub)
We built session-guardian with a "smart compaction" layer:
First-time install: LLM analyzes each agent's role → generates compaction-strategies.json
Summary
Currently
agents.defaults.compactionapplies uniformly to all agents. In multi-agent deployments, agents have fundamentally different context-retention needs. An orchestrator agent needs long memory; a specialist agent should compact aggressively after task completion.The Problem
We run 17 agents in a 4-tier hierarchy:
But OpenClaw only supports:
Result
Proposed Solution
Per-agent compaction override
Why This Matters
session-guardianskill, but compaction is a core engine feature; external tools can only trigger it, not configure itagents.defaults; extending it toagents.entries.<name>.compactionfollows the existing override patternOur Workaround (Published on ClawHub)
We built
session-guardianwith a "smart compaction" layer:compaction-strategies.jsonauto-compact.shhourly → applies per-agent thresholds externallyThis works but is inherently limited — external tools can't control the actual compaction algorithm, only monitor and react.
Validation
We tested all 17 agents with personalized strategies. Results:
Related