agents · harness · gonk · local-llm

Everyone is making an agent harness, you should build another one (for yourself)

· 23 minute read

In February I built my own agent harness, gonk, because Claude Code's first prompt was too large for the open-weights model on my desk. Since September it has processed about 4 billion tokens, mostly on GPUs in my house, and in October it wrote most of its own code. What I built, what I use it for, the case against it, and why owning the harness matters.

The first project I shipped after Claude Opus 4.5 came out was my own agent harness.

Opus 4.5 came out on 2025-11-24. For many developers, me included, it was the point where coding agents started to work for real. Ethan Mollick had early access and posted this on launch day:

A month later, the creator of Claude Code said every line he had landed in the last thirty days came from Claude Code and Opus 4.5:

In January, Andrej Karpathy wrote that agents “have crossed some kind of threshold of coherence around December 2025 and caused a phase shift in software engineering”. Simon Willison called November 2025 an inflection point.

By February 2026 agent harnesses were already popular, and everyone was selling one. It was not clear that building my own had any value. I built one anyway, to learn how the labs think about the agent loop. I did not expect to still be adding features eight months later, or that it would do real work. Since September it has processed about 4 billion tokens.

TL;DR

3,984Mprompt tokens through gonk, Sep 1 to Oct 27
89%of those tokens ran on GPUs in my house
~$800one week of gonk at Opus 5.5 list price, with caching ($3,589 without)
108 / 133gonk commits in October that gonk wrote itself

Why I built it

Claude Code’s first prompt was large.

Before you type anything, Claude Code loads its system prompt, its tool definitions and your project context. People who measured it found 27k to 85k tokens at startup:

My own gateway log agrees. The first real call of a Claude Code session has a median of 60.5k prompt tokens. On a subscription, every new session pays that out of the usage limit.

At the time I was testing an open-weights model on a Mac Studio with an M3 Ultra. Its prefill is slow, so a 60k-token first prompt meant a long wait before the first output token. To use local models for agent work at all, I needed a harness with a very small system prompt. gonk’s first call is still about 8k tokens at the median.

Size of the first real model call in a session (median prompt tokens)
First call, median
Claude Code 60.5k
gonk office 16.3k
gonk worker 6.5k

Claude Code: 47 sessions, first call over 10k tokens (each session opens with a ~1.4k side call, left out). gonk office: 25 sessions. gonk worker: 168 sessions of one unattended worker. All calls through my gateway, read 2026-10-27.

On the M3 Ultra, the hardware I own, a model prefills at about 300-800 tokens per second. At that speed a 60k-token first prompt takes one to three minutes before the first token. An 8k-token prompt takes 10 to 27 seconds. So even with prefill as the bottleneck, gonk gets a first answer back in a reasonable time.

The size of the first prompt is half of the problem. The other half is the cache. A local server skips prefill only for the part of a prompt that matches the previous request byte for byte. In early 2026 Claude Code and OpenCode both broke that match between turns:

In my runs on local models, where prefill is the bottleneck, these cache misses were a real problem. gonk keeps its prompt prefix stable, and its cache hit rate is 87% this week. Other harnesses now sell the same property. The Register wrote that Pi’s default system prompt “is short enough to keep things snappy, especially with prompt-caching enabled”.

What I built: gonk

gonk is an agent server written in Rust. It is one binary. It talks to any OpenAI-compatible endpoint and gives the model a small set of tools: bash, file read and write, find and replace, web search and fetch, and subagents.

First version: the loop. I started on 2026-02-10. The first README said “Claude Code philosophy, 10% of the code”. It had sessions over HTTP with a message queue, one SSE event stream per session, sessions saved to disk, skills and AGENTS.md read from the working folder, and parallel tool calls.

Then: copy what I need, just as I needed it. Most of gonk’s features started the same way. A lab shipped something in its own agent. I gave the release notes to Claude Code and told it to copy the feature. That is how gonk got subagents, compaction, hooks, plugins, background jobs and a cancel that reaches subagents. The rest came from asking Claude Code to read an open spec and implement it: ACP, AG-UI (GitHub), the Agent Plugins format, and A2A-style messages between my agents.

Most of it is recent. Of gonk’s 306 commits, 224 (73%) landed in the last two months.

Now: v1.1. v1.0.0 shipped on 2026-10-17. It added plugins, hooks that run as separate processes and can block a tool call, AG-UI event names, sessions that survive a hard kill, and a script tool that runs model-written TypeScript in a sandbox. src/ now has about 35,000 lines of Rust in 75 files (47,542 with blank lines and comments), with 642 tests. “10% of the code” held. The leaked Claude Code source was about 512,000 lines of TypeScript. Even with blank lines and comments, gonk is under 10% of that.

What it picked up

Each new protocol made the agent useful somewhere new, beyond coding:

What it dropped

Prompt tokens through gonk per week, by who drives it
Unattended workersBenchmarksOffice agents (me in the loop)
0M300M600M900MSep 7 · Benchmarks: 59M59Sep 7Sep 14 · Benchmarks: 581MSep 14 · Office agents (me in the loop): 143M724Sep 14Sep 21 · Unattended workers: 120MSep 21 · Benchmarks: 215M335Sep 21Sep 28 · Unattended workers: 155MSep 28 · Benchmarks: 84MSep 28 · Office agents (me in the loop): 155M394Sep 28Oct 5 · Unattended workers: 512MOct 5 · Benchmarks: 17MOct 5 · Office agents (me in the loop): 169M698Oct 5Oct 12 · Unattended workers: 587MOct 12 · Benchmarks: 101MOct 12 · Office agents (me in the loop): 124M812Oct 12Oct 19 · Unattended workers: 349MOct 19 · Benchmarks: 59MOct 19 · Office agents (me in the loop): 254M662Oct 19Oct 26* · Unattended workers: 262MOct 26* · Office agents (me in the loop): 45M307Oct 26*

Millions of prompt tokens. Weeks start on Monday. * = two days only. Per-agent accounts started on Sep 1; earlier gonk traffic is not split and is left out.

Show the numbers
Unattended workersBenchmarksOffice agents (me in the loop)Total
Sep 7059059
Sep 140581143724
Sep 211202150335
Sep 2815584155394
Oct 551217169698
Oct 12587101124812
Oct 1934959254662
Oct 26*262045307

What I use it for

Unattended work, and a worker for Claude Code

gonk has two jobs:

Claude Code is now the supervisor, and it does that job very well. It plans, reviews and checks. gonk does the bulk of the work. In the last 7 days gonk made 2.6 times as many model requests as Claude Code, and wrote 2.3 times as many output tokens:

Last 7 days: gonk vs Claude Code, through the same gateway
Model requests
gonk 19,240
Claude Code 7,363
Output tokens
gonk 11.2M
Claude Code 4.9M

2026-10-20 to 2026-10-27. Claude Code here is every Claude Code session that runs through my gateway (Opus 5.5). Each metric has its own scale.

It might seem silly. After building all of this, the most active user of gonk is not me but Claude Code. So why not just use Claude Code?

This split matters for cost, because Opus is expensive on output. I am on the $100 Claude plan. If Claude Code also did gonk’s work, I would use my weekly limit about three times over and need the $200 plan. As it is, my weekly usage stays at 30-50% of the limit. I read that from my own token dashboard.

At Opus 5.5 API list prices, one week of gonk traffic would cost about $800. That figure counts cache reads at the cached price. With the premium for cache writes it is about $910. With no caching at all it is about $3,600.

I still use gonk every day. It mostly runs short workflows, small tasks and a lot of deep research. My use of it looks more like the ChatGPT or Claude chat apps than an agent, because I built a separate set of interfaces for that purpose. Speaking of UI.

An interface that keeps changing

gonk is an API with an SSE event stream, so the front end is a separate choice. It has had four so far: Claude Code as the supervisor, ACP in my editor through my Emacs agent dashboard, a web app on my phone, and AG-UI plugins. The editor and the phone are mostly for quick chats, short check-ins and research. None of them needed a change to the agent loop.

Privacy

89% of the tokens ran on GPUs in my house. Those prompts never left my network.

Okay, what are some real use cases for these systems?

Jailbreaking my PS5

On 2026-09-29 a developer called ntfargo published Relapse, a jailbreak for PS5 and PS5 Pro consoles on firmware 7.00 to 13.60. You open an exploit page in the console’s browser, and it starts a loader that listens on the network.

I asked Claude Code to help, and it refused. So I gave the job to gonk, running GLM-5.3 Flash on my own GPU. It took about an hour. The strange part was the sound. The PS5 kept playing its notification chime while an agent installed custom firmware and apps on it and copied files over FTP, from a machine in the same house that was running the model.

My harness, my model, my network, my console. It was a surreal hour.

Decompiling a Game Boy Advance game

Since 2026-10-03 my agents have worked on a matching decompilation of Mario Kart: Super Circuit for the GBA. A matching decompilation is C source that compiles back to the exact bytes of the original ROM. The agents take one function at a time, and a byte comparison against the ROM is the only check. As of 2026-10-29 they have matched 595 of the game’s 1,482 functions (40%). Those are mostly the small functions: together they hold 16,626 of 160,772 instructions (10%). None of the 44 functions over 500 instructions has matched yet, and the last new match was on 2026-10-13. Most of the matches came from GLM-5.3 Flash on my own GPU.

One runtime under every app

The labs already run one engine under many products.

The pattern is one agent engine, with different tools, hooks, security checks, deployments and front ends on top. I would not be surprised if Anthropic moves the engine out of Claude Code completely and runs all its products on it.

gonk is a small version of the same idea. My coding agent, research agent, unattended workers, tutor, game decompiler, and the agents in my editor and on my phone are the same binary with different configuration.

The case against building your own

Look, I will be honest. This is overengineering. The case against it:

That said

These problems are getting smaller, and for me they are mostly gone:

What I learned

Lines of code per agent harness, October 2026
Non-blank, non-comment lines (thousands)
gonk 35k
claw-code 106k
claurst 147k
Pi 193k
Claude Code ~512k
Hermes Agent 1,432k
Codex 1,437k

Counted on 2026-10-27 from the public repositories with one script: non-blank, non-comment lines, vendored and build folders skipped, test folders left out. Claude Code (yellow) is the leaked v2.1.88 source as reported by Layer5; I did not count it myself. Hermes Agent includes 455k lines of bundled desktop and web apps; Pi's repository holds several packages.

Commits to gonk per month, by who wrote them
gonk (workers on open models)Claude CodeMe, or no trace
050100150Feb · gonk (workers on open models): 2Feb · Me, or no trace: 3638FebMar · Claude Code: 1Mar · Me, or no trace: 78MarApr · Me, or no trace: 11AprMay · Claude Code: 1818MayJunJulAug · Claude Code: 1515AugSep · gonk (workers on open models): 1Sep · Claude Code: 17Sep · Me, or no trace: 220SepOct · gonk (workers on open models): 108Oct · Claude Code: 23Oct · Me, or no trace: 2133Oct

233 commits on the develop branch, merge commits left out. Claude Code = the Claude Code agent account, or my account with a Claude co-author line. Early commits under my name have no such line, so some of the yellow is probably Claude Code too.

Show the numbers
gonk (workers on open models)Claude CodeMe, or no traceTotal
Feb203638
Mar0178
Apr0011
May018018
Jun0000
Jul0000
Aug015015
Sep117220
Oct108232133

The direction is clear to me. In the next few months, Claude Code drafts the feature specs. After that, the harness decides, proposes and implements its own features, and I review. At some point in 2027 I expect to stop reviewing. Adversarial agents will run QA and act as users, so they find most bugs before I see them. Maybe I get a release note. Maybe the system shows me a blog post and a release video about the new features.

What it could do better

What comes next for gonk

The bigger picture

I think rolling your own agent is the tip of the iceberg. Agents change the cost and benefit of homebrew software in general. Building and maintaining your own tools used to be the expensive choice. With agents doing most of the work, it is often the cheap one, if you can get your own inference and tokens. Depending on a provider has its own costs: their prices, their limits, their refusals and their breaking changes. A SaaS provider has far more resources than you to solve the problem. But you now have a superhuman coder that does not get tired. Funnily enough, it is the exact same superhuman coder that the rich SaaS provider has access to. At that point, servicing shared software and its complex release pipelines begins to look like a Rube Goldberg machine. Why not skip all that, and let the same coder ship right on your box? On 2026-10-07 GitHub had an incident that slowed pull requests, Actions, webhooks and issues. Imagine waiting for that. I run Forgejo. If Forgejo is down, I ask my agent to bring it back up. If everything goes down, including my vibe-coded harness infrastructure, I ask Claude to bring it all back up.

There is a security side too. Security people now call this month “Black October”. AI-assisted bug hunting found serious flaws in widely used software, one after another, and attacks followed. On 2026-10-21, someone compromised the release pipeline of LiteLLM, a popular LLM gateway, and published version 1.107.0 with a credential stealer inside. It was on PyPI for about two hours. It was the project’s second supply-chain compromise this year. An LLM gateway holds every API key you have. I run my own, so that release never reached my machines. Owning your stack does not make you safe, but it lets you choose what you run.

If I were starting today

  1. Get an LLM API key.
  2. Point Claude Code at Pi.
  3. Ask Claude Code to build a custom harness on top of Pi, with the UI, features and skills you need, based on how you actually use Claude Code.
  4. Iterate. Keep evolving the agentic tool, and see where it takes you.

Coming next in this series

Things I tried that worked, and plan to write about:

Sources
  1. Introducing Claude Opus 4.5, Anthropic, 2025-11-24
  2. mini-swe-agent
  3. Pi coding agent, Earendil (formerly badlogic/pi-mono)
  4. Pi 1.0, Earendil
  5. Ethan Mollick on X, 2025-11-24; Boris Cherny on X, 2025-12-27; Andrej Karpathy on X, 2026-01-26
  6. The November 2025 inflection point, Simon Willison, 2026-01-04
  7. Building agents with the Claude Agent SDK, Anthropic, 2025-09-29
  8. Get started with Claude Cowork, Claude Help Center
  9. You Said No MCP!, Earendil, 2026-09-29
  10. s1ngularity: supply chain attack leaks secrets, Wiz, 2025-08-27; Nx postmortem, 2025-09-05
  11. The first malicious MCP server on npm, Semgrep, 2025-10-02
  12. Hundreds of malicious skills found in OpenClaw’s ClawHub, eSecurity Planet, 2026-02-03
  13. GhostClaw unmasked, JFrog, 2026-03-08
  14. Trojanized Claude Code leak on GitHub, The Register, 2026-04-02
  15. Concerning behaviour in a popular open-weight AI model, Cohere, 2026-10-26
  16. Release and issue counts: GitHub API for earendil-works/pi, openclaw/openclaw and NousResearch/hermes-agent, read on 2026-10-27
  17. Claude Code startup context: ClaudeCodeCamp, XDA, How-To Geek
  18. Anthropic’s Cowork, TechCrunch, 2026-01-12; ChatGPT: what’s new (Codex app merged into ChatGPT desktop, 2026-07-09)
  19. Sony PS5 Relapse jailbreak exploit, GBHackers, 2026-10-02
  20. PHP2Shell and Black October, 404 Media, 2026-10-22; Black October, Axios, 2026-10-22
  21. Contained: Oct 21, 2026 LiteLLM release v1.107.0 compromised, LiteLLM; Inside the LiteLLM 1.107.0 compromise, Microsoft, 2026-10-23
  22. The Claude Code source leak: 512,000 lines, Layer5
  23. Line counts: claw-code 8aab1d4, claurst, Pi 177e2ad, Hermes Agent 69f73ec5, Codex 6fe77fc, gonk 31c7c74; counted 2026-10-27
  24. Prompt cache misses on local models: Claude Code with local models triggers full prompt reprocessing, 2026-02-16; opencode #19081, 2026-03-25; How to roll your own local AI coding agents, The Register, 2026-05-02
  25. Is GitHub down for you?, Android Authority, 2026-10-07
  26. Decompilation numbers: my decomp dashboard (matched functions and instructions), read on 2026-10-29
  27. Agent Client Protocol (ACP)
  28. AG-UI protocol (GitHub); A2A protocol
  29. Firecracker microVMs
  30. Cloudflare CEO Matthew Prince and the Nous CEO on who owns the internet in the age of AI, USV, 2026-10-22 (skills at 39:37-40:59)
  31. Hermes Agent skills system, Nous Research docs; Teknium on X: /learn, Curator
  32. Artificial Analysis model pages (3:1 and 7:2:1 blended price ratios)
  33. Token numbers: my own LLM gateway request log, 2026-09-01 to 2026-10-27, read on 2026-10-27
  34. Code and issue numbers: the gonk repository and its issue tracker, read on 2026-10-27