by OnlyTerp
Make your OpenClaw AI agent faster, smarter, and cheaper. Speed optimization, memory architecture, context management, model selection, and one-shot development guide.
# Add to your Claude Code skills
git clone https://github.com/OnlyTerp/openclaw-optimization-guideGuides for using ai agents skills like openclaw-optimization-guide.
Make your OpenClaw AI agent faster, smarter, cheaper, and actually safe to run in production.
April 30, 2026 sweep. Stable baseline: OpenClaw 2026.4.27. Beta tracked: 2026.4.29-beta.1. This refresh removes subscription-era Claude assumptions, replaces stale model/setup advice, and adds the late-April operator tricks people actually need now: Active Memory filters, people wiki provenance, visible-reply enforcement, active-run steering, manifest-backed model catalogs, browser coordinate clicks, Codex Computer Use setup, DeepSeek/DeepInfra/NVIDIA provider expansion, safer config handling, and the new security posture.
By Terp — Terp AI Labs
OpenClaw changed more in the last two weeks of April than most agent projects change in a quarter. If you last read this guide at 2026.4.15, these are the new rules:
No comments yet. Be the first to share your thoughts!
/models add after it briefly shipped in 2026.4.22. Stop telling agents to edit model config from chat.messages.visibleReplies can force visible channel replies through the message tool, and spawned sub-agent events carry routing metadata.Read Part 33 — Late-April 2026 Field Guide first if you want the latest tricks before the deep dives.
Most agent capability comes from the harness, not the weights.
The exact percentage is rhetoric. The operator lesson is concrete: model swaps help, but the big wins come from context budgets, memory discipline, tool permissions, flow control, provider routing, hooks, and verification loops.
flowchart LR
subgraph Model["The Model (weights)"]
M[Claude Opus 4.7<br/>or your choice]
end
subgraph Harness["The Harness (operator-controlled) — this guide"]
direction TB
Inst[Instructions<br/>SOUL/AGENTS/MEMORY/skills]
Ctx[Context engineering<br/>budgets + progressive disclosure]
Tools[Tools + approvals<br/>semantic categories]
Guard[Guardrails<br/>hooks, Task Brain, redaction]
Mem[Memory layer<br/>memory-core + LightRAG + dreaming]
Orch[Orchestration<br/>5 coordination patterns]
end
Model -.-> Harness
Harness -.-> Results[Production results]
You usually cannot change the weights. You can change everything else: context, memory, tools, approvals, verification, cost controls, and orchestration. The rest of this guide is that operator-controlled layer.
| Do this | For this outcome | |---|---| | Grade your setup → | 50-item Production Readiness Scorecard, score out of 100, shareable. | | Copy the reference config → | Working SOUL / AGENTS / MEMORY / TOOLS templates plus a conservative example config. | | See the numbers → | Reproducible benchmark methodology + harness + run template. | | Browse the ecosystem → | Curated list of skills, tools, papers, talks, adjacent projects. | | Hit a wall? → | Gotchas & FAQ, symptom-indexed. Most questions answered in one page. |
OpenClaw's file layout maps 1:1 to Karpathy's three-tier LLM Wiki pattern published April 10, 2026. If you only remember one diagram from this guide, make it this one:
flowchart TB
subgraph Raw["Raw sources — immutable, agent read-only"]
Vault["vault/*"]
Daily["memory/YYYY-MM-DD.md"]
end
subgraph Curated["Curated summaries — injected on every message"]
Soul["SOUL.md<br/>identity"]
Agents["AGENTS.md<br/>operational rules"]
Mem["MEMORY.md<br/>durable facts"]
Dreams["DREAMS.md<br/>reflection diary"]
Skills["skills/*<br/>on-demand playbooks"]
end
subgraph Artifacts["Generated artifacts — one-shot output"]
PRs["PRs / commits"]
Reports["Reports / transcripts"]
end
Raw -. memory_search .-> Agent((Agent))
Curated --> Agent
Agent --> Artifacts
Agent -. Deep-phase promote .-> Mem
Artifacts -. auto-capture .-> Daily
| File | Purpose | Size cap | Written by | Read when |
|------|---------|---------:|------------|-----------|
| SOUL.md | Identity, invariants, non-negotiables | < 1 KB | Human | Every message |
| AGENTS.md | Operational rules, decision trees, tool routing | < 2 KB | Human + agent (auditable) | Every message |
| MEMORY.md | Durable facts promoted from short-term (pointer index) | < 3 KB | Agent via memory promote | Every message |
| DREAMS.md | Human-readable reflection diary | latest N entries | Built-in Dreaming | Every message |
| skills/ | Named playbooks | per-skill small | Human + SkillClaw | On activation |
| vault/ | Raw source notes, transcripts, links | unbounded | Auto-capture + humans | On memory_search |
| memory/YYYY-MM-DD.md | Daily short-term rollup | rolling | Auto-capture | On memory_search |
Full reasoning and update rules in Part 31 — The LLM Wiki Pattern In OpenClaw.
| Metric | Before | After | Source | |--------|-------:|------:|--------| | Context file size (SOUL + AGENTS + MEMORY) | ~15 KB | ~5 KB | Part 1 | | Memory search latency | 2–5s (cloud) | <100ms (local) | Part 4, Part 10 | | Compaction crash rate | loops on 16K models | fixed in 4.15+ | Part 15 | | Coding-agent token usage | baseline | –60% | Part 19 — Repowise | | Sessions before audit trail | 0 surfaces | all surfaces | Part 24 — Task Brain |
Full numbers in benchmarks/.
Alongside the 33 parts themselves, this repo now includes the tooling that turns "I read the guide" into "I can audit and reproduce the results":
vault/ skeleton, and a