L3M: A Verifiable Harness and Runtime for Self-Extending and Self-Improving Agents
Carson Eisenach, Robert Joseph George, Vincent Quenneville-Belair, Kate Gwimm, Dean Foster
cs.AI
Oct 14, 2026 · v1
cs.LG
TL;DR
Implements an agent harness runtime in Lean 4, proves kernel-checked safety theorems about its code, and has agents extend it with sealed Lean programs.
Abstract
The lasting gains in AI have come from methods that absorb more computation, and language models already scale computation within a call. Useful work, though, happens across calls: over hours or days, through tools and external systems, among many agents and the humans they work for, and increasingly through code the agents write themselves. Whether that work compounds is enabled by the harness around it, and the harness faces a constraint the model does not: of the three participants in such a computation, the human, the model and code, only the human's attention does not scale, so the computation can grow only if the human is not in every loop. L3M is a runtime built on that premise, written in Lean 4 so that one language implements the harness, states its invariants, and is the language agents extend it in. One computation spans humans, agents, models and code, and all of its state lives in Git: a rich state trajectory – rather than a chat conversation – is an object the runtime can resume, rewind, fork, compare and merge. Waiting, communication, delegation and undo are primitives, not patterns the model reasons through each time. When an agent works out a procedure, it can write it once as a sealed Lean program whose type is its permission request, and the harness offers it back as a tool – machinery for the model to use. To take the human out of the loop, L3M uses reversibility to decide where that is safe: a tool's review tier follows from how far its effects can be undone, so agents act freely where the runtime can recover. Because the machinery can change, the properties that make this safe are stated as kernel-checked theorems about the code that runs. On Terminal-Bench, an untuned L3M reaches about two thirds of its (unsafe) shell-equipped pass rate using only safe (not needing human review) tools.
Problem
Long-running agentic computations need a harness that keeps the human out of every loop while keeping it safe for agents to act and to extend the harness with their own code. Conventional model-centred loops route waiting, coordination, recovery and state back through the model.
Approach
L3M is a runtime written in Lean 4 that keeps all agent state (logs, grants, mail, workspaces) as Git refs, so trajectories can be resumed, rewound, forked and merged. Tools are effect-typed and carry capability tokens, and each tool's review tier is set by how reversible its effects are. Agents add tools by writing sealed Lean programs whose types state their permission requests. Invariants such as path confinement, monotone authority across the agent tree, and no self-granting are stated and proved as kernel-checked theorems about the running code, with Lean Manifests recording what each claim rests on.
Results
On 37 Terminal-Bench tasks, an untuned L3M using only safe (tame) tools reaches 27.0% pass@3, against 41.7% with an unreviewed shell and 59.5% for Claude Code with permissions bypassed. Shell review mainly adds model calls and tokens rather than lowering success.
| Configuration | Pass@3, % | Model calls | Tokens, M | Minutes |
|---|
| Claude Code, permissions bypassed | 59.5 | 53.0 | 4.43 | 24.6 |
| L3M, shell, review off | 41.7 | 53.2 | 7.70 | 25.4 |
| L3M, tame | 27.0 | 53.3 | 7.74 | 21.6 |
| L3M, tame, no programs | 24.3 | 41.5 | 6.17 | 24.5 |
Terminal-Bench (37 tasks, pass@3)