Harness Engineering 101: The LLM is the brain, the harness is the body
TL;DR Highlight
An agent is a loop managing a JSON array; 16 chapters build one from scratch
Who Should Read
A backend developer who finds agent frameworks magical and wants to understand their internals from first principles
Core Mechanics
- Every turn resends the whole conversation
- LLM APIs are stateless.
- Each turn you send the full conversation as a JSON array and get text back.
- The harness manages that array
- A harness builds, maintains, and protects the array.
- The author sees what the field calls agents as patches on this one loop.
- Each patch exists because something broke
- Each chapter has the same shape: the failure, the minimal patch, what it costs.
- Examples include full context windows, one array not holding all the work, and drift mid-task.
- A ~300-line toy agent grows over chapters
- 16 chapters extend a plain Python agent step by step.
- Runnable code sits in src/harness/, one file per stage.
- Frameworks are wrappers around Chapter 1
- Chapter 10 frames every framework as a wrapper around the JSON array.
- RAG is treated as a harness pattern (Chapter 15).
- Appendices cover practical topics
- They cover model routing and cost engineering, worktree isolation, plan mode, and retries, rate limits, and streaming.
Community Reactions
- Building their own harness solved their problems
- A commenter ignored how other agents work and designed around their own pain points.
- They accepted more inference than standard agents and got an autonomous agent they can leave for hours.
- Harness optimization beat raw model strength
- A commenter said Jev was far worse than deepseek raw, but after harness optimization it was much better at a fraction of the cost.
- Counterpoint: the harness can be the brain too
- A commenter listed routing, planners, custom memory, classical ML, and RL as harness-side intelligence.
- They argued some tasks may not need an LLM at all.
- Advice to build it yourself, plus AI-slop criticism
- One suggested starting with Thorsten Ball's how-to-build-an-agent post and writing the core by hand.
- Several commenters criticized the book as AI-written.
How to Apply
- Print your agent's message array today
- Log the messages your agent or framework sends each turn.
- Check how the system prompt, tool results, and history stack up in order.
- Map one failure to a chapter
- Take a recent agent failure (context overflow, drift) and match it to the table of contents.
- Read that chapter's minimal patch first.
- Run the toy harness and change the loop
- Run the staged files in src/harness/.
- Add one tool and see how the loop changes.
Try It
# Paste into Claude or ChatGPT as is (simplified version of the idea)
Assume my agent sends the messages array below to the LLM API every turn.
{{messages JSON or log}}
Analyze it as an array the harness must build, maintain, and protect.
1) Which parts take the most context?
2) Are there ordering issues that break caching?
3) Which patches (summarization, subagents, guardrails) are needed for failures?
Next: ask for the most urgent patch in under 20 lines of Python.Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques