Beautifully produced and genuinely deep. The reader experience makes it easy to keep going for hours.

Harness Engineering
Build the layer that turns a model into an agent.
A from-scratch, illustrated build of a real coding-agent harness — the loop, tools, context engine, durability, and orchestration.
Read on your Kindle or e-reader
Download the EPUB and read offline — perfect for the train. Works on Kindle, Kobo, Apple Books & more.
00Start Here6 capsules
The thesis. Why a model alone is not an agent, the precise difference between prompt, context, and harness engineering, and the five layers you will build across the workshop into your own coding harness.
01What is a harness?free8 min02Why 'just call the API' failsfree12 min03Prompt vs. context vs. harness engineering🔒11 min04The anatomy: five layers of a harnessMAP🔒13 min05What you will build: a pi-style harness🔒10 min06How to use this site🔒11 min01The Agent Loop6 capsules
Day 1. The beating heart of every harness: a loop that calls the model, runs the tools it asks for, and repeats until the work is done. We build a bare harness from first principles.
07The agent loop from first principlesLOOP🔒11 min08Messages, turns & roles🔒12 min09Stop conditions: when does the loop end?🔒12 min10Streaming responses into a terminal🔒12 min11The model client & provider abstraction🔒12 min12Build: your first bare harnessBUILD🔒7 min02Tools & the Execution Environment6 capsules
Day 2. A harness that can only talk is a chatbot. We give it hands: file and shell tools with strict schemas, permission gates before dangerous actions, and a sandbox to contain the blast radius.
13Tool schemas as contractsTOOLS🔒13 min14The core tools: read, write, edit, bash, search🔒12 min15Streaming tool calls to the UI🔒11 min16Permission gates & approval modes🔒12 min17Sandboxing & the blast-radius problem🔒12 min18Code-mode vs. tool-mode🔒11 min03Context Engineering6 capsules
Day 3. The context window is the scarcest resource in the system. We build the machinery that decides what the model sees every turn, compacts long sessions, and remembers across them.
19The context window as a resourceCONTEXT🔒11 min20Context budgets: what goes in, what gets evicted🔒12 min21Compaction & summarization🔒12 min22Memory systems & the CLAUDE.md pattern🔒12 min23System prompts as infrastructure, not prose🔒13 min24Build: the context engineBUILD🔒13 min04Durability, Recovery & Orchestration6 capsules
Day 4. Real agents crash, get interrupted, and hit jobs too big for one context. We make the harness recoverable and self-healing, and teach it to dispatch sub-agents under supervision.
25Durable execution & checkpointingDURABLE🔒13 min26Replay & resumable sessions🔒13 min27Self-healing loops: retries & failure classification🔒13 min28Sub-agents & handoffs🔒11 min29Supervision & plan mode🔒11 min30Human-in-the-loop: plans, approvals, escalationBUILD🔒13 min05Production Harnesses & Capstone5 capsules
Day 5. We dissect three real harnesses to see how they implement, at scale, everything you just built by hand, then you assemble your own and demo it.
31pi internals: the minimal-surface philosophypi🔒12 min32Hermes internals: a research lab's harnessHERMES🔒13 min33Claude Code internals: skills, hooks, MCP, sub-agentsCC🔒13 min34Evaluating a harness: how you know yours works🔒12 min35The capstone: your own harnessSHIP🔒12 min06Pi from Scratch12 capsules
How Pi actually works, built up from an empty file the way you would build any coding agent, one layer at a time — but every layer is Pi's real code (earendil-works/pi, MIT). We start with the loop and add exactly one thing per chapter, each because the last chapter left something missing: the toolbox, tool safety, the system prompt, the execution environment, context and cache, subagents, surfaces, and the extension system. Every claim is read straight from the source.
36Pi from scratch: the planSTART🔒10 min37The loop: from a chat call to an agentBUILD🔒10 min38The toolbox: giving Pi handsBUILD🔒11 min39Tool safety: permission gates, protected paths, trustBUILD🔒11 min40The system prompt: how Pi tells the model who it isBUILD🔒10 min41The execution environment: local, SSH, sandboxedBUILD🔒11 min42How Pi manages context (not 'the last three messages')DEEP🔒10 min43How Pi does cache control: the rolling breakpointDEEP🔒11 min44Does Pi serve the agent everything? (No, it truncates)DEEP🔒10 min45How Pi does subagents: three mechanisms, three scalesDEEP🔒13 min46Surfaces: one headless core, four front-endsBUILD🔒11 min47Extensibility: everything is an extensionBUILD🔒11 minRatings & reviews
722 readersRare mix of depth and readability. The worked examples are the clearest I have seen on this subject.
I read the free preview on a whim and ended up finishing the whole thing in two sittings. Superb pacing.