Aggressive Context Optimizer

v1.0.0-alpha

Slash OpenClaw token costs and prevent context overflow. Use whenever the user mentions high API costs, expensive tokens, context truncation, context overflo...

0· 163·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for omaression/aggressive-context-optimizer.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Aggressive Context Optimizer" (omaression/aggressive-context-optimizer) from ClawHub.
Skill page: https://clawhub.ai/omaression/aggressive-context-optimizer
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install aggressive-context-optimizer

ClawHub CLI

Package manager switcher

npx clawhub@latest install aggressive-context-optimizer
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description match the contained files and instructions. The SKILL.md and bundled Python script both audit and apply OpenClaw configuration changes (bootstrap, memory, tool caps, pruning, compaction). No unrelated binaries, env vars, or external services are requested.
Instruction Scope
The runtime instructions direct the agent (and the user) to run the included script and OpenClaw CLI commands (/status, /usage, openclaw config validate). The script legitimately reads the openclaw.json, reports findings, and can write tuned settings. This stays within the advertised purpose, but it does perform file I/O on a global config and invokes the 'openclaw' CLI.
Install Mechanism
No install spec; the skill is instruction + source files only. Nothing is downloaded or installed automatically — lowest risk for arbitrary code fetching. The provided Python script runs locally.
Credentials
The skill declares no required environment variables, no credentials, and no config paths up front. The behavior (reading/writing the OpenClaw config) is proportional to its purpose.
Persistence & Privilege
The skill does not force persistent inclusion (always:false) nor request special platform privileges, but it writes changes to the shared openclaw.json (global agent config). That is expected for a config-tuning tool but is high-impact: changes affect all agents using that config. The script attempts rollback on validation failure but does not make an on-disk backup before writing and relies on re-writing the original in-memory object on error. Also _extract_config_path parses the CLI output for a path — if the 'openclaw config file' output were untrusted or manipulated this could point to an unexpected file path.
Assessment
This skill is coherent with its purpose but it will modify your global OpenClaw config. Recommended precautions before using --apply: - Run the script without --apply first to audit (python scripts/context_optimizer.py). - Back up your openclaw.json manually (copy the file) so you can restore it if needed. - Inspect the printed changes the script will make; the script prints SET lines before applying. - Ensure the 'openclaw' CLI on the host is the expected trusted binary (the script relies on its output to find the config path and to validate changes). - Prefer trying changes in a non-production or test agent first, or apply balanced (not aggressive) defaults initially. - If you have concerns about automatic writes, manually edit the config using the examples in references/ to control exactly what changes are made.

Like a lobster shell, security has layers — review code before you run it.

latestvk978awzqa7nhakvp4cw4sr18rd831qtp
163downloads
0stars
1versions
Updated 1mo ago
v1.0.0-alpha
MIT-0

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 <path> 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:

  1. Run openclaw config validate.
  2. Restart gateway if prompted.
  3. Re-check /status and /usage tokens.
  4. Spot-check recall on a representative task.
  5. If quality drops, loosen the most recent change one notch.

Quick-reference: symptom → fix

SymptomGo to
Every turn is expensive, even simple onesFix 1 (bootstrap)
Cost spikes after searches or file readsFix 2 (tool output)
Long sessions get slow/truncatedFix 3 (pruning) + Fix 5 (session hygiene)
Memory results feel noisy or irrelevantFix 4 (memory retrieval)
Screenshots are costlyFix 1, set imageMaxDimensionPx: 512
"Context too large" / truncation errorsFix 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.

Comments

Loading comments...