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

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.
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.
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.
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.
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.
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, 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:
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."
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:
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.
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.
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.
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.
The authors are explicit about the trust model, and it is worth repeating because "provably safe" is easy to over-read:
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.
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.
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.
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.
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.
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.
Explore how Claude Code, Cursor, Aider, and Cline work under the hood. Agent loops, tool dispatch, and edit strategies explained.
AI EngineeringLearn how caching, tool selection, memory and retrieval shape agent context, with cost calculations, failure cases and an evaluation checklist.
AI EngineeringBuild 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