The Agent Harness.
Two ways to wrap a model. Claude Code, reverse-engineered. OpenClaw, wide open.
One emits a turn. The other never sleeps.
Every agent needs a loop. Claude Code runs a fresh one per task and tears it down at end_turn.
OpenClaw runs a single daemon that stays up for days, waking whenever a message arrives. Step through
the same five beats and watch where they diverge.
# Claude Code: one ephemeral loop per task def run_task(prompt): messages = [user(prompt)] while True: reply = model(messages) # think messages.append(reply) if not reply.tool_calls: # text only -> done return reply # stop_reason: "end_turn" for call in reply.tool_calls: # act messages.append(run_tool(call)) # observe, then repeat
# OpenClaw: one daemon, never sleeps while True: # the Gateway event = inbox.get() # a message, cron tick, or webhook agent = route(event) # pick the per-channel agent agent.handle(event) # runs its own loop, then waits
nO async generator) that ends at end_turn. OpenClaw is a
persistent Gateway daemon multiplexing many chats into per-agent sessions, awake until you stop it.
One compresses to survive. The other remembers on disk.
Claude Code fights a fixed window. Before each model call it runs five compaction shapers, cheapest first, and only summarizes as a last resort. There is no single magic threshold. OpenClaw barely has this problem: its memory is plain Markdown and YAML on disk that outlives any one session.
# Claude Code: shrink history cheapest-first, stop once it fits SHAPERS = [budget_reduction, snip, microcompact, context_collapse, auto_compact] def fit(messages, limit): for shape in SHAPERS: if tokens(messages) <= limit: break # fits now, stop early messages = shape(messages) return messages
~/.openclaw/workspace, across days and channels,
with prompt files like AGENTS.md and SOUL.md.
Same format. Different appetite.
Both speak the same dialect: a SKILL.md file with YAML frontmatter, progressive disclosure,
and MCP for everything else. The difference is what the tools reach for. Claude Code aims at a codebase.
OpenClaw aims at your life, and pulls skills from a public marketplace.
SKILL.md + MCP. Claude Code's tools target a codebase (Read, Edit, Bash, Grep) with
skills scoped enterprise / personal / project / plugin. OpenClaw's target your life (browser, canvas, cron,
Discord, Slack) and pull from the ClawHub registry at clawhub.ai. One caveat: an audit
found roughly 26% of 31,000+ community skills carried at least one vulnerability.
One spawns to forget. The other lives in parallel.
Claude Code spins up a subagent in a fresh, isolated window, lets it do the expensive work, and keeps only the summary. It is an escape valve for context. OpenClaw runs many agents at once, one per channel or peer, each long-lived and sandboxed. Press spawn to watch Claude Code's version.
h2A).One fires from inside. The other from outside.
Claude Code's hooks live inside a single session's lifecycle: deterministic shell escapes wired to named events. OpenClaw's triggers come from the outside world and wake the agent: cron, webhooks, an inbound message.
Fire inside one session.
- where
- the
hookskey insettings.json, hot-reloaded - events
- SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, Stop, plus SubagentStart/Stop, SessionEnd, PermissionRequest, and more
- can block
- a
PreToolUsehook returns allow / deny / ask, or exit code 2 blocks the call and feeds stderr back - trigger
- the session's own lifecycle
Wake from the outside.
- cron
- scheduled jobs (
maxConcurrentRunsdefault 8,sessionRetentiondefault '24h') - webhooks
- authenticated, under
hooks, default path/hooks; plus Gmail Pub/Sub - heartbeat
- per-agent, default every '30m' (0m disables)
- channels
- are the I/O surface: a message in is a wake event, the reply goes back out
One gates every call. The other gates who can call.
Claude Code checks each tool call against rules and, in auto mode, a separate classifier model. OpenClaw starts a level up: it decides who is even allowed to talk to it, then sandboxes everyone who is not you.
Gate the tool call.
- rules
ToolorTool(specifier), e.g.Bash(npm run test *),Read(./.env)- order
- deny → ask → allow, first match wins, merged across scopes
- modes
- default, acceptEdits, plan, auto, dontAsk, bypassPermissions
- classifier
- auto mode runs a separate model that blocks escalations (curl|bash, prod deploys, force-push, push to main)
- floors
- protected paths (.git, .claude, shell rc) are never auto-approved; even bypass blocks
rm -rf /and refuses root unless sandboxed
Gate the speaker.
- DM policy
pairing | allowlist | open | disabled, default pairing- pairing
- a one-time code:
openclaw pairing approve <channel> <code> - main session
- runs tools on the host with full access, for the single owner
- everyone else
- non-main sessions are sandboxed (Docker default) with per-tool allowlists
One rides in your repo. The other lives with the daemon.
Both are file-driven, no database. Claude Code's config lives in .claude/ inside the repo,
committed and shared with the team. OpenClaw's lives in ~/.openclaw on whatever host runs
the always-on daemon.
Git-committed, team-shared.
- memory
CLAUDE.mdat~/.claude/,./,./.claude/, plusCLAUDE.local.md- settings
settings.json+settings.local.json; precedence managed > CLI > local > project > user (permission rules merge)- agents
.claude/agents/- mcp
.mcp.json/~/.claude.json- skills
SKILL.mdfiles
Lives in ~/.openclaw.
- config
- one
~/.openclaw/openclaw.json(JSON5: comments + trailing commas; override viaOPENCLAW_CONFIG_PATH) - workspace
~/.openclaw/workspacewith.agents/,extensions/,skills/- channels
- under
channels.<provider>.* - models
- per agent via
agents.defaults.models(catalog + allowlist)
~/.openclaw on whatever host runs it.
One meets you at work. The other in your chats.
Claude Code is the same harness on three substrates inside your dev environment. OpenClaw is one self-hosted Gateway that bridges into the messaging apps you already live in.
Your shell
- runs in
- your terminal, your cwd
- speed
- fastest, no cold start
- persistence
- sessions under
~/.claude/
Inside the editor
- runs in
- VS Code / JetBrains
- extras
- knows your selection, open files
- diffs
- rendered natively
Cloud container
- runs in
- ephemeral VM, torn down after
- setup
- install deps in
SessionStart - persistence
- commit & push or it's gone
Self-hosted bridge
- runs on
- a VPS or your own machine
- nodes
- a macOS menu bar, plus iOS and Android nodes
- shape
- one daemon, many channels at once
The apps you already use
- messaging
- WhatsApp, Telegram, Slack, Discord, Signal, iMessage, Matrix, Teams
- more
- Google Chat, Feishu, LINE, WeChat, QQ, IRC, Nostr, Twitch, WebChat
- idea
- the agent shows up where you already are
One had to be decompiled. The other ships its source daily.
The reason we can write any of this down differs sharply between the two. One harness we know only because it leaked. The other we know because it was open from day one.
Known by decompilation.
- shape
- one ~12MB minified, obfuscated
cli.js(vars like X6, K8, b6) - the leak
- the npm
.js.mapsource maps embedded sourcesContent with the original TypeScript, enabling deobfuscation - coverage
- covered as a "source leak" by InfoQ, The Register (Apr 2026)
- analysis
- VILA-Lab pinned v2.1.88: ~1,884 TS files, ~512K LOC, only ~1.6% AI decision logic vs ~98.4% deterministic infrastructure
Known by reading it.
- license
- MIT, public from day one
- releases
- CalVer
vYYYY.M.D, near-daily; latest stable v2026.5.27 - lineage
- Clawdbot → Moltbot → OpenClaw, by Peter Steinberger (@steipete)
- scale
- hundreds of thousands of stars (~375K); mascot Molty, a space lobster
- steward
- creator hired by OpenAI (Feb 2026); a stewardship foundation now runs it
git clone on the other.
The harness is the interesting part.
A language model on its own is a function. What turns it into an agent is the orchestration around it: the loop, the context discipline, the tools, the permissions, the surfaces. Claude Code and OpenClaw make almost opposite choices at every layer, and both work.
One is a closed, single-task loop you run in your terminal, reconstructed from a leaked source map. The other is an open, always-on daemon that lives in your chats, readable in full on GitHub. Same model. Two bodies.
- github.com/VILA-Lab/Dive-into-Claude-Code
- kirshatrov.com/posts/claude-code-internals
- blog.brightcoding.dev · inside claude code
- dev.to/kolkov · we reverse-engineered 12 versions
- github.com/ghuntley/claude-code-source-code-deobfuscation
- infoq.com · claude code source leak
- code.claude.com/docs · hooks
- code.claude.com/docs · settings
- code.claude.com/docs · skills
- code.claude.com/docs · permission modes
Claude Code facts come from official docs plus reverse-engineering of the leaked source maps. OpenClaw facts come from its open repo and docs.