Four production harnesses run the same ReAct loop; every meaningful difference is in where state lives, how context is shed, and who may write to memory.
What it is
A Visual Guide to Agent Harnesses by Maarten Grootendorst (co-author with Jay Alammar of An Illustrated Guide to AI Agents), published 2026-11-30 and shared on LinkedIn. It is a source-code teardown with more than 30 custom diagrams, built up from the book's 600-line educational TinyAgent to four production harnesses.
The guide pins its snapshots, which is the right practice for a fast-moving comparison: TinyAgent v0.1.1, pi v1.2.0, OpenCode v2.0.29, Hermes commit 0e427d7, OpenClaw v2026.10.3. Every claim below is as of those versions.
Thesis. Model weights are stateless; the harness is everything that builds the prompt, runs tools, stores sessions and enforces guardrails. All five run the same Reason-Act-Observe loop (TinyAgent's fits in under 20 lines of Python), so the same model in each yields four different agents. The differences sit in three places: where session state lives, how context is shed when the window fills, and how memory is written across sessions. The guide also draws a layer line: all four share a coding core (read, edit, execute), while Hermes and OpenClaw add a personal-assistant layer (chat connectors, personal memory, scheduled wake-ups), which is most of why they are larger.
Architecture side by side
One row per harness, smallest first. Figures are the guide's, read from source at the pinned snapshot.
| Harness | Shape | Session state | Context shedding | Cross-session memory | Distinctive mechanism |
|---|---|---|---|---|---|
| TinyAgent | ~600 lines of Python, educational, local Gemma 4 | In-memory list; lost when the process exits | None | None | The bare loop: reason, tool call, observe into memory |
| Pi | ~100K lines, terminal only, no server, four tools (read, write, edit, bash) | Append-only JSONL tree with id/parent pointers; any turn can be forked like a git branch | Compaction by LLM summary of older turns, last ~20K tokens kept verbatim; tool output truncated to the last 2,000 lines plus the file path | AGENTS.md-style files | Steering: a mid-run message is injected after parallel tools finish and before the next model call; follow-ups wait for the loop to stop |
| OpenCode | About Pi's size, HTTP server in front of the loop | SQLite (opencode.db); each step reads history, runs one model pass, writes back, so any client can continue it | Read-type work (read, grep, glob) delegated to a subagent that returns a ~200-token summary | Database sessions | Code Mode (CodeAct): one script chains several tool calls; Plan mode is a permission change, not a separate planner |
| Hermes | Larger; 21 default tools, 50+ bundled skills, chat gateway, pluggable sandboxes | Sessions plus memory files | Compacts earliest of the four | MEMORY.md (environment, tooling, lessons) split from USER.md (the person's preferences) | A review agent runs after any session with more than 10 tool calls and writes or updates a skill; parallel subagents return per-file summaries |
| OpenClaw | Largest; 30+ chat channels, 7 core tools by default | Main session (direct messages) kept apart from group sessions as a privacy boundary | Memory flush to disk before compaction, plus daily logs | Hybrid BM25 + embedding retrieval with 30-day recency decay and MMR rerank; nightly "dreaming" (light, deep, REM) consolidates logs into MEMORY.md | Heartbeat: a 30-minute wake-up governed by HEARTBEAT.md; the agent stays silent unless something crosses its threshold |
The guide's comparison of the always-loaded prompt is the useful cost view: Hermes and OpenClaw spend about the same tokens before the first user word, Hermes on 21 tool schemas and OpenClaw on workspace files (SOUL.md, MEMORY.md, rules).
Tradeoffs
Process-bound vs server-bound sessions. Pi's loop dies with the terminal but its JSONL tree makes branching and rewind cheap and inspectable. OpenCode's database lets several clients share one session and survive a closed terminal, at the cost of a server and a store that is harder to read by hand.
Compaction vs delegation. Compaction pays an LLM call and loses detail in the summarised span. Subagent delegation keeps exploration noise (the guide's example: ~40K tokens of search) out of the parent entirely, but the parent now acts on a summary it cannot audit.
Truncate the tail, keep the file. Pi returns only the last 2,000 lines of a long output plus its path, betting that failures sit at the end; the model can grep the file when the bet is wrong. Cheap, and right for test runs, wrong for logs whose cause is at the top.
Plan mode as a permission, not an architecture. OpenCode swaps no planner in; it narrows what the edit tool may touch. The guide reads this as evidence that capable models need less scaffolding, which is the stronger claim; the narrower one is that a deny rule is enforced and an instruction is not.
Write-back memory. Hermes' skill review and OpenClaw's dreaming turn transcripts into durable files that load in later sessions. This is the only route by which these harnesses improve without code changes, and also the only route by which one bad session persists.
Ambient autonomy. OpenClaw's heartbeat makes the agent act with nobody present. The value is proactive triage; the cost is a 48-a-day loop reading untrusted inbound content.
Failure modes and corrections
Two claims need qualifying against vendor documentation covered in earlier entries; the rest are not re-verified here and stand as the author's reading of source.
Pi's "184K" is not a constant. Pi's docs (see R438) define auto-compaction as
contextTokens > contextWindow - reserveTokens, withreserveTokens16,384 andkeepRecentTokens20,000 by default. 184K is that rule on a 200K-window model; on a 1M model it fires far later unless overridden. The 20K kept-verbatim figure matches.OpenCode's plan fence has documented doors. The guide says plan mode blocks edits to everything except
plan.md, so the model "cannot do anything else anyway". OpenCode's own docs (see R389) say the plan agent may write plan files when asked and that shell commands remain permission-controlled, and the shipped base policy opens with allow-all. A model that cannot edit can still run a shell command that edits.Summaries erase provenance. A LinkedIn commenter on the post raised the sharpest open question: OpenCode's read subagents hand summaries to a parent that holds edit and bash, Pi's tail-only truncation lets whoever controls process output control what the model sees, and nothing in the guide shows any of the four tagging text by origin after summarisation.
Learned memory is a persistence channel for injection. Hermes' review agent and OpenClaw's dreaming write into files loaded by later sessions, so one injected line can survive as a "learned" skill or fact. The heartbeat compounds this: untrusted email read every 30 minutes with no human present.
Summaries drop conditionals. A second commenter's test is worth running on any delegating harness: give the subagent a bug that only appears on retry and check whether "only on retry" survives into the parent's summary, and whether the parent then tests the retry path.
Snapshot decay. Pinning versions is correct, but OpenClaw's calendar-versioned release and Hermes' bare commit hash will be stale within weeks; treat the table as architecture, not current defaults.
Review checklist
When choosing a harness, or reviewing one you built:
Where does session state live, and can a run be resumed from a different client or forked from an earlier turn?
What is the compaction trigger as a formula, not a number, and what survives it verbatim?
When tool output is truncated, which end is kept, and is the full output still reachable by path?
Which work is delegated to subagents, and does anything mark summarised text by origin before the parent acts on it with write or shell tools?
Is "plan mode" a deny rule on every write path, including shell, or only on the edit tool?
What may write to memory that loads in later sessions, who reviews it, and can a learned skill or fact be traced to the session that produced it?
Does anything run without a human present (heartbeat, cron), and what untrusted input does it read when it does?
How many tokens are spent before the first user word, and on what: tool schemas or workspace files?
Which version did your comparison read, and when will you re-read it?
Related and sources
R054 Harness engineering: a source-code study of eleven coding agents: the academic version of the same exercise, at wider scope.
R006 6 must-know terms for AI agent harnesses: the vocabulary this guide illustrates.
R438 Pairwise precedence in Pi's context files: Pi's compaction rule and what its docs leave unsaid.
R393 Why a coding agent's session is a folder, not a name: Pi's session tree from the user side.
R389 Planning as a permission rule: OpenCode's plan agent and its two documented doors.
R432 Training a model for its harness: the Pi adapter: the harness-specific gain measured from the model side.
R147 Anthropic's components of agent memory and R123 Proactive agents: dreaming and check-in loops comparable to OpenClaw's.
R398 A day-one harness snapshot, re-read three months later: why pinned snapshots age.
Sources: A Visual Guide to Agent Harnesses (Maarten Grootendorst, Exploring Language Models, 2026-11-30); LinkedIn post and its public comments.