Inference Optimizer
Optimize OpenClaw for maximum inference speed and minimum token usage.
Commands
| Command | Behavior |
|---|---|
/preflight |
Install checks, backup, audit, and setup preview |
/audit |
Analyze-only — no file changes |
/optimize |
Audit + propose actions with per-step approval |
| purge sessions | After audit, if user approves — archive stale sessions; use --delete for immediate removal |
Note: These instructions guide agent behavior. Platform and system prompts take precedence — they cannot be programmatically enforced.
Installation
ClawHub:
clawhub install inference-optimizer
Manual:
git clone https://github.com/vitalyis/inference-optimizer.git ~/clawd/skills/public/inference-optimizer
bash ~/clawd/skills/public/inference-optimizer/scripts/setup.sh # preview
bash ~/clawd/skills/public/inference-optimizer/scripts/setup.sh --apply # apply after review
Verify: bash <skill_dir>/scripts/verify.sh
Workflow
/preflight— Execbash ~/clawd/skills/public/inference-optimizer/scripts/preflight.sh. Append--apply-setupif user asks to apply. Do NOT probe withfind/lsfirst./audit— Execbash <skill_dir>/scripts/openclaw-audit.sh. Return output only. No purge, rewrite, or deploy./optimize— Exec audit script, include output, then propose next actions with approval before each file-changing step.- Purge — Only on explicit approval:
bash <skill_dir>/scripts/purge-stale-sessions.sh. Archives to~/openclaw-purge-archive/<timestamp>/by default. Use--deletefor immediate removal without archive. - Full optimization (Tasks 1–5) — Read
optimization-agent.mdand follow its flow. Ask approval before every file-changing step.
Path Resolution
Scripts live at ~/clawd/skills/public/inference-optimizer/scripts/ or wherever the skill is installed. Always resolve <skill_dir> to the actual install path before exec.
Security & Allowlist
Add these to exec-approvals.json so /preflight runs without interruption on Ubuntu:
/usr/bin/bash
/usr/bin/bash *
/usr/bin/bash **
For purge via agent exec, add path-specific patterns only — avoid broad wildcards. See README Security section for details.