Aggressive Context Optimizer
/install aggressive-context-optimizer
Context Optimizer
Goal: cut input tokens to the minimum that preserves task quality.
Principle: diagnose → apply the single highest-impact fix → re-measure → repeat.
Fast path — use the script
Use the bundled script to audit and apply defaults quickly:
python scripts/context_optimizer.py
python scripts/context_optimizer.py --apply
python scripts/context_optimizer.py --apply --aggressive
The script auto-detects config path, validates after writing, and rolls back on failure. Use --config \x3Cpath> for a specific file.
After running, verify with /status and /usage tokens.
Step 1 — Diagnose (manual path)
If script use is not enough or unavailable, run:
/status
/context detail
/usage tokens
Identify the dominant sink: bootstrap, tool output, memory retrieval, or long-session buildup.
Step 2 — Apply fixes in impact order
Work top-down and stop when usage is acceptable.
Fix 1: Shrink bootstrap files
Trim AGENTS.md, SOUL.md, TOOLS.md, USER.md, MEMORY.md, and heavy skill files. Remove filler and move rarely-needed detail into references read on demand.
Set smaller bootstrap/image limits and related defaults. See references/configs.md for full config examples.
Fix 2: Throttle tool output
Reduce web search/fetch payloads and prefer targeted reads (line ranges/excerpts) over full dumps.
See references/configs.md for full config examples.
Fix 3: Prune stale tool results
Enable context pruning so older, large tool payloads expire automatically while recent turns stay intact.
See references/configs.md for full config examples.
Fix 4: Tighten memory retrieval
Lower recall volume and raise relevance thresholds; keep deduplication and recency bias enabled. Narrow memorySearch.extraPaths if too broad.
See references/configs.md for full config examples.
Fix 5: Session hygiene
Use /compact mid-session, /new for topic shifts, /reset when recovery is unlikely. Enable automatic compaction for sessions that routinely run long.
See references/configs.md for full config examples.
Step 3 — Validate
After each change:
- Run
openclaw config validate. - Restart gateway if prompted.
- Re-check
/statusand/usage tokens. - Spot-check recall on a representative task.
- If quality drops, loosen the most recent change one notch.
Quick-reference: symptom → fix
| Symptom | Go to |
|---|---|
| Every turn is expensive, even simple ones | Fix 1 (bootstrap) |
| Cost spikes after searches or file reads | Fix 2 (tool output) |
| Long sessions get slow/truncated | Fix 3 (pruning) + Fix 5 (session hygiene) |
| Memory results feel noisy or irrelevant | Fix 4 (memory retrieval) |
| Screenshots are costly | Fix 1, set imageMaxDimensionPx: 512 |
| "Context too large" / truncation errors | Fix 5 (/compact or /new), then Fix 3 |
See references/aggressive-config.md for the full aggressive all-in-one config.
See references/commands.md for the full commands cheat sheet.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install aggressive-context-optimizer - 安装完成后,直接呼叫该 Skill 的名称或使用
/aggressive-context-optimizer触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Aggressive Context Optimizer 是什么?
Slash OpenClaw token costs and prevent context overflow. Use whenever the user mentions high API costs, expensive tokens, context truncation, context overflo... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 167 次。
如何安装 Aggressive Context Optimizer?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install aggressive-context-optimizer」即可一键安装,无需额外配置。
Aggressive Context Optimizer 是免费的吗?
是的,Aggressive Context Optimizer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Aggressive Context Optimizer 支持哪些平台?
Aggressive Context Optimizer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Aggressive Context Optimizer?
由 omaression(@omaression)开发并维护,当前版本 v1.0.0-alpha。