OpenClaw Agent Optimization
Use this skill to tune an OpenClaw workspace for cost-aware routing, parallel-first delegation, and lean context.
Quick Start (copy/paste)
Full audit (safe, no changes):
Audit my OpenClaw setup for cost, reliability, and context bloat. Output a prioritized plan with rollback notes. Do NOT apply changes.
Context bloat / transcript noise:
My OpenClaw context is bloating (slow replies / high cost / lots of transcript noise). Identify the top offenders (tools, crons, bootstrap files) and propose the smallest reversible fixes first. Do NOT apply changes.
Model routing / delegation posture:
Propose a model routing plan for (a) coding/engineering, (b) short notifications/reminders, (c) reasoning-heavy research/writing. Include an exact config patch + rollback plan, but do NOT apply changes.
What you will get (output shape)
- Executive summary (what matters + why)
- Top offenders / drivers
- Cost drivers
- Context drivers
- Reliability risks
- Options A/B/C (tradeoffs made explicit)
- Recommended plan (smallest change first)
- Exact change proposals (patch snippets) + rollback
Safety Contract (must follow)
- Treat this skill as advisory by default, not autonomous control-plane mutation.
- Never mutate persistent settings (e.g.,
config.apply, config.patch, update.run) without explicit user approval.
- Never create/update/remove cron jobs without explicit user approval.
- If an optimization reduces monitoring coverage, present options (A/B/C) and require the user to choose.
- Before any approved persistent change, show: (1) exact change, (2) expected impact, (3) rollback plan.
OpenClaw 2.9+ notes (skills + context)
- Skills are snapshotted per session; if you install/update skills, start a new session (or wait for watcher refresh).
- Prefer short SKILL.md + references/ for long runbooks. Keep injected prompt text lean.
- For risky / heavy skills, consider
disable-model-invocation: true so they only run when explicitly invoked.
- Gating matters: use
metadata.openclaw.requires (bins/env/config) so skills don’t appear but fail at runtime.
- Sandboxed runs don’t inherit host env; if a skill needs secrets in sandbox, set them via sandbox env config (not skill env).
High-ROI optimization levers (typical wins)
1) Output discipline for automation
Make maintenance loops truly silent on success:
- Cron/heartbeat jobs should output exactly
NO_REPLY unless something is wrong.
2) Separate “do the work” from “notify the human”
If you want alerts but want the interactive session lean:
- Send a short out-of-band alert (Telegram/Slack/etc.), then output
NO_REPLY.
3) Prefer isolated agentTurn for autonomous background work
If a job should execute without requiring attention, prefer:
sessionTarget="isolated" + payload.kind="agentTurn"
4) Hardening & guardrails
- Use scripts-first for complex cron jobs (avoid fragile multi-line
bash -lc quoting).
- Add circuit breakers / global locks for heavy jobs.
5) Ops hygiene checklist
- Snapshot backups: freshness threshold + retention + failure markers.
- Heartbeat coverage: check model auth, disk/snapshot freshness, and ClawHub CLI auth (
npx clawhub whoami) if you rely on publishing/installs.
Workflow (concise)
- Audit rules + memory: ensure rules are modular/short; memory keeps only restart-critical facts.
- Model routing: confirm tiered routing (light / mid / deep) matches live config.
- Context discipline: apply progressive disclosure; move large static data to references/scripts.
- If transcripts are bloating, run
context-clean-up (audit-only) to get a ranked offender list + plan.
- Delegation protocol: parallelize independent tasks; use isolated sub-agents for long/noisy work.
- Heartbeat optimization (control-plane only): propose options A/B/C (coverage vs cost).
- Execution gate: if user approves changes, apply the smallest viable change first, then verify and report.
References
references/optimization-playbook.md
references/model-selection.md
references/context-management.md
references/agent-orchestration.md
references/cron-optimization.md
references/heartbeat-optimization.md
references/memory-patterns.md
references/continuous-learning.md
references/safeguards.md
1---2name: openclaw-agent-optimize3description: Use when: you want to optimize an OpenClaw setup (cost/quality tradeoffs, model routing, context discipline, delegation, reliability) and you’re okay with a structured audit → options → recommended plan. Don’t use when: you want immediate config mutations without review, or the question is unrelated to OpenClaw operations. Output: a prioritized plan + exact change proposals (with rollback) if approved.4---56# OpenClaw Agent Optimization78Use this skill to tune an OpenClaw workspace for **cost-aware routing**, **parallel-first delegation**, and **lean context**.910## Quick Start (copy/paste)11121) **Full audit (safe, no changes):**13> Audit my OpenClaw setup for cost, reliability, and context bloat. Output a prioritized plan with rollback notes. Do NOT apply changes.14152) **Context bloat / transcript noise:**16> My OpenClaw context is bloating (slow replies / high cost / lots of transcript noise). Identify the top offenders (tools, crons, bootstrap files) and propose the smallest reversible fixes first. Do NOT apply changes.17183) **Model routing / delegation posture:**19> Propose a model routing plan for (a) coding/engineering, (b) short notifications/reminders, (c) reasoning-heavy research/writing. Include an exact config patch + rollback plan, but do NOT apply changes.2021## What you will get (output shape)22- **Executive summary** (what matters + why)23- **Top offenders / drivers**24 - Cost drivers25 - Context drivers26 - Reliability risks27- **Options A/B/C** (tradeoffs made explicit)28- **Recommended plan** (smallest change first)29- **Exact change proposals** (patch snippets) + **rollback**3031## Safety Contract (must follow)32- Treat this skill as **advisory by default**, not autonomous control-plane mutation.33- **Never** mutate persistent settings (e.g., `config.apply`, `config.patch`, `update.run`) without explicit user approval.34- **Never** create/update/remove cron jobs without explicit user approval.35- If an optimization reduces monitoring coverage, present options (A/B/C) and require the user to choose.36- Before any approved persistent change, show: (1) exact change, (2) expected impact, (3) rollback plan.3738## OpenClaw 2.9+ notes (skills + context)39- Skills are snapshotted per session; if you install/update skills, start a **new session** (or wait for watcher refresh).40- Prefer **short SKILL.md + references/** for long runbooks. Keep injected prompt text lean.41- For risky / heavy skills, consider `disable-model-invocation: true` so they only run when explicitly invoked.42- Gating matters: use `metadata.openclaw.requires` (bins/env/config) so skills don’t appear but fail at runtime.43- Sandboxed runs don’t inherit host env; if a skill needs secrets in sandbox, set them via sandbox env config (not skill env).4445## High-ROI optimization levers (typical wins)4647### 1) Output discipline for automation48Make maintenance loops **truly silent on success**:49- Cron/heartbeat jobs should output exactly `NO_REPLY` unless something is wrong.5051### 2) Separate “do the work” from “notify the human”52If you want alerts but want the interactive session lean:53- Send a short out-of-band alert (Telegram/Slack/etc.), then output `NO_REPLY`.5455### 3) Prefer isolated agentTurn for autonomous background work56If a job should execute *without* requiring attention, prefer:57- `sessionTarget="isolated"` + `payload.kind="agentTurn"`5859### 4) Hardening & guardrails60- Use scripts-first for complex cron jobs (avoid fragile multi-line `bash -lc` quoting).61- Add circuit breakers / global locks for heavy jobs.6263### 5) Ops hygiene checklist64- Snapshot backups: freshness threshold + retention + failure markers.65- Heartbeat coverage: check model auth, disk/snapshot freshness, and **ClawHub CLI auth** (`npx clawhub whoami`) if you rely on publishing/installs.6667## Workflow (concise)681. **Audit rules + memory**: ensure rules are modular/short; memory keeps only restart-critical facts.692. **Model routing**: confirm tiered routing (light / mid / deep) matches live config.703. **Context discipline**: apply progressive disclosure; move large static data to references/scripts.71 - If transcripts are bloating, run `context-clean-up` (audit-only) to get a ranked offender list + plan.724. **Delegation protocol**: parallelize independent tasks; use isolated sub-agents for long/noisy work.735. **Heartbeat optimization (control-plane only)**: propose options A/B/C (coverage vs cost).746. **Execution gate**: if user approves changes, apply the smallest viable change first, then verify and report.7576## References77- `references/optimization-playbook.md`78- `references/model-selection.md`79- `references/context-management.md`80- `references/agent-orchestration.md`81- `references/cron-optimization.md`82- `references/heartbeat-optimization.md`83- `references/memory-patterns.md`84- `references/continuous-learning.md`85- `references/safeguards.md`