Install
openclaw skills install mkhaytman-token-optimizerAutomatically analyze and reduce OpenClaw token waste through context compression, tool-call deduplication insights, model selection guidance, and session hygiene checks. Use when sessions are nearing context limits, costs are climbing, or you want proactive token optimization before expensive tasks.
openclaw skills install mkhaytman-token-optimizerUse this skill to optimize OpenClaw token usage with a local CLI that performs analysis, compression snapshots, health checks, cleanup planning, and preflight token budgeting.
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --analyze --period 7d
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --enable
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --analyze --period 7d
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --compress --threshold 0.7 --session agent:main:main
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --health-check --active-minutes 120
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --cleanup
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --cleanup --apply
Use preflight planning before expensive task batches:
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize \
--preflight /path/to/actions.json \
--session-limit 180000
actions.json should be a JSON array of planned operations, for example:
[
{"type": "web_search", "query": "..."},
{"type": "web_fetch", "url": "..."},
{"type": "summarize", "target": "youtube"}
]
$OPENCLAW_WORKSPACE/token-usage/compressed/--format json --output /path/file.json--enable): $OPENCLAW_WORKSPACE/token-usage/token-optimizer.config.jsonDefault behavior is configured in:
config/defaults.jsonOverride with:
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --config /path/custom.json --analyze
scripts/token_optimize.py: main CLIsrc/optimizer.py: core optimization enginesrc/models.py: model selection logicsrc/compression.py: context compression helperssrc/cleanup.py: session hygiene evaluationreferences/operating-notes.md: implementation details and safe-operating guidancepython3 $OPENCLAW_SKILLS_DIR/.system/skill-creator/scripts/quick_validate.py \
$OPENCLAW_SKILLS_DIR/token-optimizer