# OpenClaw Broken? I Fix It with Claude Code URL: https://www.laserlloyd.com/projects/openclaw-broken-i-fix-it-with-claude-code/ Published: 2026-07-11 Updated: 2026-09-16 Description: How I pair OpenClaw local agents with Claude Code: agents do the routine work, Claude Code fixes real breakage and leaves runbooks so it stays fixed. Reuse: free for personal use — full policy at https://www.laserlloyd.com/llms.txt My local OpenClaw (/projects/local-ai-agent-stack-openclaw/) agents run this website, my chat app, and a pile of small automations. They handle that routine work around the clock on a flat monthly plan, right up until the thing they're running on breaks. Then I don't ask a drowning system to save itself: I open Claude Code (https://code.claude.com/docs/en/overview) on the same box and let a stronger model fix it. tl;dr Simple, repeatable work: local OpenClaw agents. Flat-rate tokens, always on. Truly complex or broken: Claude Code, run directly on the box that runs OpenClaw. The important part: Claude Code doesn't just fix it — it sets things up so OpenClaw can do it (or survive it) next time. ## The two-tier idea Local models are good enough for a lot: drafting posts, watching services, injecting chat messages, running scheduled jobs. But they have a ceiling — smaller context, weaker debugging instincts, and a habit of confidently restarting things that need actual diagnosis. The rule of thumb: if the fix is a known runbook, OpenClaw runs it. If the fix requires *figuring out*, that's Claude Code. The OpenClaw Model Manager (/projects/openclaw-model-manager/) GUI is one of the runbooks that came out of exactly this loop — a config editor that validates model ids before saving, so one whole class of bad config never reaches the gateway. ## A real example: the crash-looping gateway One morning the OpenClaw (https://docs.openclaw.ai) gateway was crash-looping with nothing but: ``` agents.list.5: Invalid input ``` No agent named in the error. Restarts didn't help — the config was being re-broken as fast as it was repaired. A local model would have restarted it in a loop forever. Claude Code, run on the box itself, traced it: OpenClaw's identity-reconcile step was re-reading a *stale workspace file* left over from an earlier cleanup and re-injecting an invalid agent definition into the live config on every start. The durable fix was three parts: 1. Correct the stale source file (the thing actually causing it), 2. Restore the clean gateway config, 3. Verify by running the full launch-and-restart cycle until every unit stayed up. That's the pattern: the visible error was in the config, but the *cause* was a file nobody had looked at in weeks. Diagnosis, not restarts. ## "Fix it so OpenClaw can do it next time" The second half of every Claude Code session is the part most people skip: after the fix, I have it fold the knowledge back into the local system, so the same class of problem never needs the expensive model again. In practice that means: - **Runbooks the local agents can follow.** Step-by-step instructions written for a smaller model — checkable steps, exact commands, hard rules. The weekly site-refresh job I used to run worked from exactly this kind of file. - **Guardrails instead of vigilance.** After one incident, Claude Code added a fail-closed pre-publish check to this site's build (secret scan + content rules), so no agent — local or cloud — can push something embarrassing. - **Watchdogs for the known failure modes.** Timeouts tuned for slow local models, self-deleting follow-up timers for dispatched work, health checks that post to my chat app instead of failing silently. Next time the same thing wobbles, OpenClaw handles it on flat-rate tokens, and Claude Code only gets called for the genuinely new stuff. ## Why run Claude Code *on* the OpenClaw box? Run on the same machine, it reads the real logs, the real config, the real service states — and verifies the fix end-to-end instead of guessing from my description. A description filtered through me is exactly how you get plausible-but-wrong fixes. ## Gotchas - **Don't let the local agents fix themselves mid-incident.** An agent whose own gateway is broken makes things worse. Fix from outside (Claude Code), then hand back control. - **Insist on the durable fix.** "Restart it" is a symptom patch. Ask explicitly for root cause, and make the assistant prove the fix survives a restart cycle. - **Have it write the runbook while the context is hot.** The best documentation of an incident is written by the thing that just fixed it, minutes after fixing it. - **Keep secrets out of the loop.** Runbooks and briefs the agents read should be secrets-free; keys live in the environment, not in prose. Related: the OpenClaw agent stack (/projects/local-ai-agent-stack-openclaw/) this repair strategy protects, wiring DeepSeek into Claude Code and the stack (/projects/deepseek-everywhere-claude-code-openclaw/), OpenClaw Model Manager (/projects/openclaw-model-manager/), and setting up an LLM assistant (/projects/set-up-your-llm-assistant/) if Claude Code is new to you.