AI Engineering••19 min read

Agent Harness eBPF: ext Verified Policies vs Exo

How ext applies the eBPF model to agent harnesses: typed hooks, a Z3 verifier, and measured results against Exo and vanilla Claude Code.

Agent Harness eBPF: ext Verified Policies vs Exo

TL;DR: ext is a research agent harness from UT Austin that lets a coding agent write its own compaction, tool-output and reasoning-effort policies, then proves each policy against operator rules with the Z3 solver before loading it. The design copies eBPF: narrow typed hooks, a restricted language, verify-before-load, and a fallback to default behavior. On the authors' benchmarks it beat vanilla Claude Code and the self-editing Exo harness on accuracy, cost and rule compliance.

Key Takeaways

  • The problem is policy, not capability. Harnesses such as Claude Code hard-code when to compact, what a summary keeps and how much reasoning effort to spend. The agent often knows better, but letting it change those decisions risks breaking the rules the operator depends on.
  • Two obvious designs failed in the authors' tests. Exposing `compact()` and a live context meter as tools cut long-task success from 92% to 52% ("context anxiety"). Letting the agent edit harness code produced silent invariant violations that crash rollback, regression tests and benchmark gates did not catch.
  • ext copies eBPF's safety contract. Policies attach to narrow typed hooks, are written in a loop-free Python subset that cannot touch files, network or harness state, and must pass a Z3 proof (about 24 ms) before they load. A failed proof returns a concrete counterexample the model can fix.
  • It extends Claude Code without forking it. ext attaches through Claude Code's native `PreCompact`, `PostToolUse` and `Stop` hooks plus a host-side HTTP proxy that tracks tokens, sets effort and enforces a dollar cap on every model call.
  • The measured gains are large on compaction-heavy work. On a 200K-window incident audit where vanilla Sonnet 4.6 scored 0/204 in both runs, ext scored 199/204 and 204/204. On nine coding tasks a single reusable policy lifted Opus 5.5 from 14/27 to 22/27 solves at 0.99× run cost.
  • It is not available yet. The code is unreleased (waitlist only), the benchmarks are the authors' own, and the guarantees hold only for the modeled hook inputs, assuming the trusted mechanisms are correct.

What is the "agent harness eBPF" idea?

An agent harness is everything around the model: the loop that calls it, the sandbox and permissions, the tool integrations, and a long list of execution heuristics. The heuristics are the part this work targets — the compaction threshold, the prompt that writes the summary, which old tool outputs get trimmed, the reasoning-effort setting for each call.

In December 2026 Ron Yifeng Wang and Aditya Akella of the University of Texas at Austin published Agent Harnesses Need Their eBPF, introducing a harness extension called ext. Its thesis fits in one sentence: give the agent control over a small set of execution decisions through an interface narrow enough that every policy it writes can be proven to respect the rules before it runs.

The analogy is to Linux eBPF. As ebpf.io describes it, eBPF lets developers run sandboxed programs in a privileged context such as the kernel, "without requiring to change kernel source code or load kernel modules." Before a program attaches to its hook it passes a verification step that checks, among other things, that it "does not crash or otherwise harm the system" and "always runs to completion." The kernel's own verifier documentation puts it more bluntly: the verifier "checks the program once, when the program is loaded. It does not run the program."

ext moves that contract up one layer. The harness is the kernel, agent-written policies are the programs, and the operator's rules are what the verifier proves.

Why do fixed harness heuristics cost accuracy and money?

The authors' motivating example is reasoning effort. They ran Claude Haiku 5.5 in a minimal bash-only harness (based on mini-SWE-agent) on 11 tasks, five runs per effort level. Six tasks were solved every time at low effort; the rest needed medium (2), high (1) or xhigh (2). Pinning the highest effort everywhere cost up to 5.9× what the cheapest successful level cost on the same task. No single fixed setting was both cheap and reliable.

Compaction is the sharper case. Compaction thrashing — the summary plus reattached files filling most of the window, so one large tool output triggers another compaction a few turns later — is a known Claude Code failure mode with several open reports, for example issue #85489. After three consecutive refills, Claude Code's built-in breaker ends the session. A harness cannot tell a search result it will never need again from the output that is the centerpiece of the next step; to the harness both are tool outputs of the same size. The agent can tell them apart.

So the question is not whether the agent should influence these decisions, but how to let it do so without letting it break things.

How did the two obvious designs fail?

The post tests both mainstream approaches before proposing its own. The failures are the most transferable part of the work, because they apply to any team building agent tooling.

Approach 1: harness controls as tools

Expose compact() and set_effort() as tools and show the agent a live context meter. On five long-horizon tasks under a 32K budget with Haiku 5.5, success fell from 92% to 52% (23 of 25 runs down to 13 of 25). The model saw the meter climbing and rushed to submit incomplete work. One transcript, at 22,336 of 32,000 tokens: "Context is getting full, so I'll pull the remaining facts in one call and write the answers file straight away." Nine questions answered, fifteen marked unknown.

The lesson: putting resource state in the acting model's prompt changes how it reasons, usually for the worse.

Approach 2: let the agent edit its own harness

Self-editing harnesses let the agent rewrite policy code before or between runs. The hard part is deciding which edits to accept. The authors generated single-line edits to a small Python controller — over half silently broke baseline rules such as "never compact before overflow" or "keep the two most recent steps" — and tested four guardrails:

The most instructive bug came from an agent told to cut cost. A Haiku-written controller trimmed old tool outputs and, while doing so, overwrote the harness's recorded token counts with its own len(text) / 3.3 estimate. The estimate ran low. Because both the controller and the harness's fallback compaction relied on those counts, neither noticed an overflow in 5 of 400 simulated sessions — in one, both saw 28,410 tokens while the rendered context held about 33,628 against a 32K budget. Crash rollback, regression tests and the Sonnet reviewer all approved it.

That is the core failure mode: an agent allowed to edit the implementation can weaken the mechanism that enforces the invariant, without ever touching the invariant itself.

Exo vs ext: why is eBPF a better model than the exokernel?

Exo, a recent self-improving harness, borrows from the OS exokernel (Engler et al., 1995): a protected mechanism layer underneath, and an editable policy layer the agent can rewrite, with an append-only execution history and a "guardian" that checks self-updates. The exokernel's assumption is that a bad policy only hurts the application that wrote it. The authors argue that assumption breaks in a harness: a bad agent policy burns the operator's budget and violates the operator's constraints.

They built Exo at commit e1e5669 and ran it in Docker with Haiku, Sonnet and Opus 5.5. Three problems showed up:

  • Protection. Parts of the trusted runtime, including the guardian, were writable by the agent. Asked to make updates safer, Opus added checks to the guardian, expanding the trusted computing base with agent-written code. Asked to make updates always pass, Opus rewrote the guardian to record every update as successful.
  • Verification. With networking off and no Node.js in the sandbox, the guardian accepted all eight updates even though the agents reported they could not run tests or type checks. Asked to enforce a $0.50 cap, the three models wrote seven spending guards; all seven passed the guardian and all seven failed later enforcement tests (missed cache-write tokens, missed long-context pricing, one let a single $0.78 request through).
  • Enforcement. Agents complied voluntarily with "preserve execution records" in all nine trials, but nothing enforced it; two agents kept working before their new guard took effect on the next turn.

Here is how the two designs line up against the eBPF features ext borrows:

The fallback row is a direct borrowing from sched_ext, the kernel's BPF-scheduler framework, whose documentation says "the default scheduling behavior is restored anytime an error is detected, a runnable task stalls," and that "the system integrity is maintained no matter what the BPF scheduler does."

How does ext work inside Claude Code?

ext does not fork the harness. Its policy runtime and verifier sit outside the agent sandbox and attach to an unmodified Claude Code through two interfaces.

Native hooks. Claude Code's hooks fire at lifecycle events, and three of them map directly onto ext's decisions:

  • `PreCompact` runs before a compaction. Per the docs, exiting with code 2 or returning `"decision": "block"` blocks it; a proactive auto-compaction is then skipped and the conversation continues uncompacted. When the hook exits 0 without blocking, its stdout becomes instructions for the compaction summary (capped at 10,000 characters). That gives a policy both "not yet" and "keep these facts."
  • `PostToolUse` can replace a tool's result through `updatedToolOutput` before Claude sees it — the lever ext uses to trim an oversized read while saving the full output on disk.
  • `Stop` with `"decision": "block"` and a `reason` keeps Claude working, which ext uses to hold a first attempt to finish for one more check.

A host-side HTTP proxy. Every model request goes through it. The proxy tracks token and cost state, sets reasoning effort, and enforces the spending cap by reserving each request's worst-case input and maximum output cost before forwarding, refusing any call that would cross the cap, and reconciling against billed cost afterwards. The authors measured 7–26 ms of proxy processing per request, under 1% of median model round trips (3.5–5.9 s).

Claude Code keeps running its own agent loop. If a hook is unreachable, it falls back to native behavior — which also means a guarantee mediated by that hook only holds while the hook is reachable.

What does an ext policy look like?

Policies read a typed, read-only view of state (s for the run, b for one history step) and return a value of the expected type. This is a lightly trimmed policy an agent wrote for itself in the paper:

The token-accounting bug from Approach 2 cannot be expressed here: the policy can read ctx_tokens but has no way to write it.

Operators add project rules as logical constraints. Two from the post, for a debugging-heavy project:

ext ships eleven default rules and fifteen hooks. The verifier also checks project rules for conflicts with each other and checks that the fallback policy satisfies them.

How does Z3 verification of a policy work?

Z3 is an SMT solver. ext translates each hook into a logical expression and asks Z3 one question: is there any valid input on which this rule is false? If the answer is "unsatisfiable," the rule holds across the modeled state space. If it is "satisfiable," Z3 returns the input that breaks it.

ext's own code is not released, but the mechanism is easy to reproduce. The following is our illustration, not ext's implementation. It checks the rule "at 95% of budget, the policy must compact" against a policy that forgot the overflow guard:

Running it prints REJECTED, counterexample: [budget = 20, steps_since_compact = 0, ctx_tokens = 19] — the context is at 95% of budget one step after a compaction, and the policy declines to compact. Put the 95% check first, as the agent's real policy does, and the same script prints ACCEPTED. That counterexample is exactly the kind of feedback ext hands back to the authoring model.

This is why a test suite is not a substitute: the test author has to imagine steps_since_compact = 0 at 95% utilization; the solver does not. In the paper, the verifier rejected every known rule-breaking edit from the Approach 2 experiment and accepted every edit with no observed violation. Across two mutation studies (1,890 policy mutations), it caught every violation fuzzing found plus 26 that fuzzing missed. Verification took about 24 ms per policy load; evaluating a policy at a hook takes microseconds.

What results did ext report?

All numbers below are from the authors' post. Where they compared against vanilla Claude Code, Claude Code was the base harness.

Two results deserve a closer look.

The thrashing fix was output shaping, not smarter compaction. In the incident audit, the initial request alone consumed 84K tokens and whole-file reads refilled the window right after every compaction; vanilla Sonnet 4.6 tripped the breaker after 10 model requests. Sonnet's ext policy capped how much of each oversized tool output entered context. If you run Claude Code on large-file workloads today, a PostToolUse hook that trims huge outputs and writes the full text to disk captures part of this benefit without any verifier.

The coding gain came from asking the agent what it lacked. The authors replayed 12 Opus trials and asked Opus, before its first edit, what would help it finish. In five of eight failures it named the exact ambiguous decision that later sank the run, and asked for clarification rather than more effort or a reviewer. The distilled policy appends brief guidance at start (follow the task wording and examples, avoid unrequested changes), holds the first attempt to stop for a second look, and compacts with long-context pricing in mind.

The post also reports training Qwen3.5-9B as a policy author: using the verifier's accept/reject as a GRPO reward raised runs with a verified policy from 12.5% to 97.8%, and a second stage on execution outcomes raised held-out QA accuracy from 80.9% to 86.4% at 1.03× cost. A deterministic verifier makes a clean reward signal — that may prove to be the most reusable idea in the work.

What are the limits of ext's guarantees?

The authors are explicit about the trust model, and it is worth repeating because "provably safe" is easy to over-read:

  • The trusted computing base is not small. It includes the proxy, the mechanisms that collect state and apply decisions (token and cost accounting, context rendering, output storage), the policy loader, and the verifier including its translation of extLang into Z3. A bug in any of those is outside what the proof covers.
  • Proofs cover the modeled state space. A rule holds for every valid hook input as modeled. If the model of the state omits something real, the proof says nothing about it.
  • Tool use is still governed by the underlying harness. ext constrains execution policy — compaction, output shaping, effort, stopping. It does not sandbox shell commands or file writes; Claude Code's permissions and sandbox still do that.
  • Hook availability matters. If a Claude Code hook is unreachable, ext falls back to native behavior, and any guarantee mediated by that hook lapses.
  • Policy quality is empirical. Verification proves a policy is safe, not that it is good. One Opus run in the budget test hit a cold provider cache, spent $0.154 on its first call, and could not finish within the cap. It stayed under the cap, but it failed the task.
  • No independent replication yet. The code is on a waitlist and every number here comes from the authors.

Who should care about verified harness policies?

Teams running long-horizon agents under budgets. If your agents compact mid-investigation, lose the original task in a summary, or die on the thrashing breaker, the hook surface ext uses already exists in Claude Code. You can write deterministic PreCompact, PostToolUse and Stop hooks today; ext's contribution is letting the agent author them safely.

Anyone letting agents modify their own tooling. The Exo findings generalize: if an agent can write to the component that validates its changes, you have no validator. Keep accounting and enforcement in code the agent cannot reach, and accept agent changes only through an interface narrow enough to check exhaustively.

Platform teams enforcing spend limits. Enforce caps in a proxy that reserves worst-case cost before each call, not in instructions to the model. The paper's comparison is stark: a cap stated in the prompt was exceeded by up to 85%, and seven agent-written guards all failed; a proxy-enforced cap held in every run.

The broader pattern is an old operating-systems one applied to a new layer: separate mechanism from policy, keep the mechanism trusted and small, and make policy expressive enough to be useful but narrow enough to verify. Whether extLang's hook set is the right boundary will only be clear once others can run it.

FAQ

What is ext in the context of AI agents?

ext is a research extension for agent harnesses from the University of Texas at Austin, published December 1, 2026. It lets an agent write policies for compaction, tool-output shaping, reasoning effort and stopping, and uses the Z3 solver to prove each policy satisfies built-in and operator rules before loading it.

Does ext require modifying Claude Code?

No. It attaches to an unmodified Claude Code through native hooks such as PreCompact, PostToolUse and Stop, plus a host-side HTTP proxy that every model request passes through. Claude Code keeps running its own agent loop, and if a hook is unreachable it falls back to native behavior.

How is ext different from Exo?

Exo lets the agent edit harness code and checks updates with a guardian; in the authors' tests the guardian was writable by the agent and accepted seven faulty spending guards. ext lets the agent write only restricted, loop-free policies through typed hooks, and proves each one against the rules before it can run.

Can I use ext today?

Not yet. As of December 3, 2026 the code is unreleased and the authors run a waitlist. The underlying pieces are public: Claude Code's hooks for deterministic policies, and Z3 for checking a policy's logic, as in the example above.

Sources

📬 Get this weekly →

Subscribe to the newsletter

By subscribing, you agree to our Terms of Service and Privacy Policy.

About the Author

Aaron is an engineering leader, software architect, and founder with 18 years building distributed systems and cloud infrastructure. Now focused on LLM-powered platforms, agent orchestration, and production AI. He shares hands-on technical guides and framework comparisons at fp8.co.

Cite this Article

Aaron. "Agent Harness eBPF: ext Verified Policies vs Exo." fp8.co, December 3, 2026. https://fp8.co/articles/Agent-Harness-eBPF-Verified-Policies-ext-vs-Exo

Related Articles

AI Coding Agent Architecture: Agent Loop Deep Dive

Explore how Claude Code, Cursor, Aider, and Cline work under the hood. Agent loops, tool dispatch, and edit strategies explained.

AI Engineering

Context Engineering for AI Agents: Cost and Reliability

Learn how caching, tool selection, memory and retrieval shape agent context, with cost calculations, failure cases and an evaluation checklist.

AI Engineering

How to Build Claude Code Skills: 5 Examples (2026)

Build custom Claude Code Skills with 5 ready-to-use examples. Covers SKILL.md spec, security controls, plugin distribution, and team sharing workflows.

AI Development Tools