Visual guide compares agent harnesses Pi, OpenCode, Hermes and OpenClaw

A newsletter guide at newsletter.maartengrootendorst.com, with more than 30 custom visuals, looks inside four agent harnesses: Pi, OpenCode, Hermes and OpenClaw. Its opening point is that the same LLM placed in each of them yields four quite different agents. Pi is the most minimalistic, OpenCode uses a shared server to handle different clients, Hermes loops skills back into its memory, and OpenClaw has over 30 chat channels. The author read the source code and fixed a specific snapshot of each project, because these frameworks change quickly; that choice also makes the guide easier to update in a year.
The guide first defines the terms. On its own, an LLM is a text-in, text-out machine. Adding memory and tools lets it interact with the environment. That gives two pieces: the model weights, and the agent harness, which turns the model's tokens into actions. The model itself is stateless, meaning it does not change or remember what happened before. The harness is everything around it: it creates the prompts, executes tools, stores sessions and enforces guardrails. Together they form the agent. The author argues that the harness arguably has an equal and perhaps even greater influence on the output than the choice of LLM size.
The four harnesses differ in scale. All of them are coding agents that share a core able to read, edit and execute code. Hermes and OpenClaw focus more on the personal-assistant use case, with an extra layer for chat connectors (such as Slack), personal memory and scheduled wake-ups, which makes their codebases bigger. Pi and OpenCode have decently sized codebases; OpenClaw is described as quite hefty. The author counts the core app separately from plugins and extensions, and says it is unclear whether plugins should count at all.
The walkthrough starts with TinyAgent, an educational harness the author and a co-author built for their book An Illustrated Guide to AI Agents. It turns a local Gemma 4 model into an agent in around 600 lines of Python, with small modules such as LLM(), Memory() and Tools(), and no server or chat connectors. Its core loop is ReAct (Reason and Act), a 2022 technique that the author says is still used in every framework in the guide. At each pass the model reasons about the next step, outputs a tool call that the harness executes, then observes the result, which is added to memory. This repeats until the model decides it can answer. The loop fits in fewer than twenty lines of Python.
Pi is the first production-grade harness in the comparison, with a bit more than 100K lines of code. It runs in the terminal, with no server and four default tools: read, write, edit and bash. Its stated philosophy is that it is a minimal, extensible agent harness you can make your own. Compared with TinyAgent it adds three things.
First, compaction. When the context window fills to 184k tokens, older turns are summarised by an LLM, while the most recent 20k tokens stay exactly as they were so the model keeps an accurate picture of what it was doing. Pi also saves sessions, unlike TinyAgent: each turn is written to JSONL linked by id and parent pointers, so you can revert to an earlier turn and branch, much like git.
Second, better tools. TinyAgent can only write whole files, while Pi has an edit tool that updates a specific line, which cuts how much the model must write. Pi also handles large output such as a pytest.log: the full log is stored locally and only the last 2,000 lines plus the file path go back to the model. Since failures usually appear at the end of a trace, the model still sees the error and can search the file later with Agentic RAG. The author counts both model-callable tools (edit) and harness-side behaviour (log truncation) as parts of the harness.
Third, steering. You can send a message while Pi is running. Pi runs independent tools in parallel and injects the message just before the tool output goes back to the LLM. There are two message types: a steer message that redirects the next LLM call, and a follow-up message that waits until the model is completely done. The guide shows the loop in agent-loop.ts, where getSteeringMessages() runs inside the active inner loop and getFollowUpMessages() runs only when the agent would otherwise stop. According to the author, all four production harnesses adopt compaction, surgical edits and truncation from this Pi baseline.
OpenCode is roughly Pi's size but puts an HTTP server in front of the agent, so several clients (terminal, desktop and others) share one SQLite session. Pi's loop stops if you close its terminal. OpenCode writes all traces to a database (for example opencode.db), so you can close the terminal and carry on from the web app. At every step the server reads the session history, runs one model pass and saves the result for the next step, which can run from anywhere. OpenCode also has a Code Mode: instead of one tool call per turn, the LLM writes one short script that chains several tool calls, runs them together and sees the output only when all have finished. The author calls this an example of CodeAct, a pattern where the model writes executable code, such as Python, to orchestrate its tool calls. The available text ends here, partway through the OpenCode section, so the Hermes and OpenClaw sections are not covered.
Key facts
- The guide reads the source code of four agent harnesses (Pi, OpenCode, Hermes, OpenClaw) in more than 30 custom visuals, building up from TinyAgent, an educational harness of around 600 lines whose core loop fits in fewer than twenty lines of Python.
- The author argues the harness arguably has an equal and perhaps even greater influence on output than LLM size; the model is stateless, and the harness handles prompts, tools, sessions and guardrails.
- Pi (a bit more than 100K lines, four default tools) compacts history at 184k tokens while keeping the latest 20k tokens intact, stores turns as JSONL with parent pointers for branching, and returns only the last 2,000 lines of large logs to the model.
- Pi supports steering mid-run through two message types: a steer message that redirects the next LLM call and a follow-up message that waits until the model is done.
- OpenCode puts an HTTP server in front of the agent so several clients share one SQLite session, and its Code Mode lets the LLM write one short script that chains tool calls (an example of CodeAct).
Why it matters
Teams often treat the choice of model as the main decision when building a coding or assistant agent. This guide argues that the harness around the model arguably has an equal and perhaps even greater influence on the output, and that the same LLM becomes four different agents depending on the harness. It makes that concrete by tracing mechanisms in real code: compaction, session storage, log truncation, steering, a shared server, and tool chaining. It is an explainer rather than a new product or result, but it shows how production harnesses differ in practice.
Who it affects
Engineers choosing or building an agent harness, and anyone who wants to understand what sits between an LLM and a working coding agent. The Hermes and OpenClaw angle (chat connectors, personal memory, scheduled wake-ups) matters to people building personal-assistant agents rather than pure coding tools. The TinyAgent baseline suits readers who want to learn how a harness works from scratch.
How to use it
Read it as a build-up. Start with TinyAgent's ReAct loop (reason, call a tool, observe), then see what Pi adds: compaction, an edit tool, log truncation and steering. Then see how OpenCode decouples the loop from the terminal with a server and database. The author links snapshots of each project so you can inspect the code yourself. TinyAgent's code is open-source and comes from the author's book. The article's price and access terms are not covered in the available text.
How solid is it
The guide is based on the author's reading of the source code of specific snapshots of each harness, and it cites concrete values such as the 184k-token compaction threshold and the 2,000-line log limit, plus a code reference in Pi's agent-loop.ts. The available text covers the introduction, TinyAgent, Pi and the start of OpenCode; the Hermes and OpenClaw sections are not part of it. Claims such as the harness mattering as much as model size are the author's argument, stated with 'arguably', not a measured result.
Risks and caveats
The author notes these frameworks update quickly, so details are tied to the chosen snapshots and may drift. Codebase sizes depend on the author's decision to exclude plugins and extensions, which the author is not sure is fair. The text gives no benchmarks or performance comparisons between the harnesses and no recommendation of which to pick. Because the Hermes and OpenClaw sections are not covered here, this account says little about those two beyond the headline differences.
“Pi is a minimal, extensible agent harness that you can make your own.”
— Pi's stated philosophy, as quoted in the guide