← back
00 — opening
Last updated May 29, 2026

The Agent Harness.

Two ways to wrap a model. Claude Code, reverse-engineered. OpenClaw, wide open.

CLAUDE CODE closed · in your terminal one loop, one task MODEL shared brain OPENCLAW open · in your chats always-on daemon — same model, two bodies —
The model is the brain. A harness is the body, the senses, and the workshop. Here are two of them, taken apart side by side.
scroll
01 — the loop

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.

turn cycle
01 INPUT arrives 02 MODEL decides 03 TOOL executes 04 RESULT injected 05 NEXT step — loop until stop — END_TURN
01 / input arrives
Something wakes the agent.
Pick a harness and step through the cycle.
in essence
# 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
the contrast: Claude Code is one ephemeral loop per task in your terminal, a ReAct while-loop (the reverse-engineered 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.
02 — context & memory

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 · staged compaction (cheapest first)
used 128,000 / 200,000 tok healthy
system claude.md user model tool result summary
A full window, before any shaping. The system prompt and CLAUDE.md are pinned. Press run next shaper to apply each stage, cheapest first.
in essence
# 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
the contrast: Claude Code runs Budget Reduction, Snip, Microcompact, Context Collapse (read-time, non-destructive), then Auto-Compact (an LLM summary, last resort) to compress an ephemeral window for one long task. OpenClaw keeps durable memory on disk at ~/.openclaw/workspace, across days and channels, with prompt files like AGENTS.md and SOUL.md.
03 — tools & skills

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.

claude code · built-ins
openclaw · first-class tools
the contrast: Both use 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.
04 — subagents

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.

claude code · isolated context
main conversation
3 lines · 4.5k tokens
task
summary
subagent · explore
idle
The subagent reads, searches, reasons, and only the summary lands back in the parent. RE describes an async message queue (h2A).
the contrast: Claude Code spawns ephemeral subagents via the Task/Agent tool to protect one context; each runs in an isolated window with privilege isolation, and only its summary returns. OpenClaw runs many long-lived agents, one per channel or peer, each in its own workspace and optionally sandboxed (Docker default; SSH / OpenShell backends) with per-tool allowlists.
05 — hooks vs triggers

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.

CLAUDE CODE · LIFECYCLE HOOKS

Fire inside one session.

where
the hooks key in settings.json, hot-reloaded
events
SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, Stop, plus SubagentStart/Stop, SessionEnd, PermissionRequest, and more
can block
a PreToolUse hook returns allow / deny / ask, or exit code 2 blocks the call and feeds stderr back
trigger
the session's own lifecycle
OPENCLAW · PROACTIVE TRIGGERS

Wake from the outside.

cron
scheduled jobs (maxConcurrentRuns default 8, sessionRetention default '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
the contrast: Claude Code hooks fire inside one session's lifecycle. OpenClaw triggers wake the agent from the outside: cron, webhooks, heartbeats, and the channels themselves. It is always-on.
06 — permissions & sandboxing

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.

CLAUDE CODE · RULES + CLASSIFIER

Gate the tool call.

rules
Tool or Tool(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
OPENCLAW · WHO CAN TALK

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
the contrast: Claude Code gates each tool call against rules plus a classifier. OpenClaw gates who is allowed to talk to it, then sandboxes everyone who is not you.
07 — config & files

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.

CLAUDE CODE · IN THE REPO

Git-committed, team-shared.

memory
CLAUDE.md at ~/.claude/, ./, ./.claude/, plus CLAUDE.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.md files
OPENCLAW · WITH THE DAEMON

Lives in ~/.openclaw.

config
one ~/.openclaw/openclaw.json (JSON5: comments + trailing commas; override via OPENCLAW_CONFIG_PATH)
workspace
~/.openclaw/workspace with .agents/, extensions/, skills/
channels
under channels.<provider>.*
models
per agent via agents.defaults.models (catalog + allowlist)
the contrast: Claude Code's config rides in your repo, committed alongside the code it governs. OpenClaw's lives with the always-on daemon in ~/.openclaw on whatever host runs it.
08 — surfaces

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.

CLAUDE CODE · CLI

Your shell

runs in
your terminal, your cwd
speed
fastest, no cold start
persistence
sessions under ~/.claude/
CLAUDE CODE · IDE

Inside the editor

runs in
VS Code / JetBrains
extras
knows your selection, open files
diffs
rendered natively
CLAUDE CODE · WEB

Cloud container

runs in
ephemeral VM, torn down after
setup
install deps in SessionStart
persistence
commit & push or it's gone
OPENCLAW · THE GATEWAY

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
OPENCLAW · 20+ CHANNELS

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
the contrast: Claude Code meets you in your dev environment: CLI, IDE, or an ephemeral web container. OpenClaw meets you in the chat apps you already use, bridged through one self-hosted Gateway.
09 — openness & provenance

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.

CLAUDE CODE · CLOSED

Known by decompilation.

shape
one ~12MB minified, obfuscated cli.js (vars like X6, K8, b6)
the leak
the npm .js.map source 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
OPENCLAW · MIT, OPEN

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
the contrast: One harness had to be decompiled to be understood; the other ships its source every day. The same teardown took a leaked source map on one side and a git clone on the other.
10 — closing

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.

Claude Code facts come from official docs plus reverse-engineering of the leaked source maps. OpenClaw facts come from its open repo and docs.