L3M: A Verifiable Harness and Runtime for Self-Extending and Self-Improving Agents
Organizations: Amazon
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.
Figures & tables
| Guarantee | Theorem | Rests on |
| Confinement. A file tool cannot name a path that climbs out of the agent’s roots. | safePath_no_traversal | The kernel. The check is on the path’s text; symlinks are checked at run time. |
| Monotone authority. A child’s grant at spawn never exceeds its parent’s, every descendant’s is bounded by its root’s, and no agent grants to itself. | grant_restrict_le descendant_bounded_by_root_grant no_self_grant | The kernel, over the ledgers agents can write. Each ancestor’s own refs are added at its hop, and a regrant is bounded by its issuer, not by every ancestor. |
| No token without the grant. The boot mints a token only for an authority the grant confers, and a narrower grant mints none a wider one lacked. | mint_reflects_profile Minted.restrict_none | The kernel. That tokens cannot be forged is enforced by the build, not proved. |
| Budget is lent, not minted. All a subtree of agents can spend is bounded by its root’s budget. | global_budget_bounded_by_root | The kernel, for one loan batch; later loans and returns need a further invariant. |
| Self-extension adds no authority. A sealed program the harness admits uses only admitted constants. | sealUsed_admits_only_safe | The kernel, over the constants a program names directly. Elaboration and the providers are trusted. |
| Review cannot be skipped. Under the default review posture, a tool whose effects cannot be undone and are not confined by a capability is always reviewed. | ungated_world_reaching_always_reviewed | The kernel. |
| Ref | Holds | Written by | In the ACR | Retire / collect |
| Hub-wide | ||||
| l3m/ledger | who exists, who is whose parent, the grants issued | harness | — | append-only |
| personas/ name | the persona’s shared prompt files | a human | via a persona branch | outlives its wearers |
| Written by the agent | ||||
| workspace | its work in the hub | agent | workspace/ | kept |
| persona (branch) | its prompt copy, preferences, hooks and programs | agent | agent/ | kept / deleted |
| The model tries to | What stops it | Where |
| write ../../.ssh/authorized_keys | A file path is a type whose values cannot climb out of the agent’s roots, so the call cannot be stated. | Table 1 |
| reach /etc through a symlink in its workspace | The file shim resolves every path beneath its root and refuses to follow symlinks. | cannot_escape_root_via_symlink |
| add net to its own grant | No file tool admits a path under .l3m/ , and no agent grants to itself. Residue: the hub is outside the write reach of every entity without wild ; with wild , its own grant.json and the ledger are one unsandboxed shell call away, and the review card is the only wall. | admit_refuses_l3m , Table 1 ; wild is assumed withheld |
| rewrite another agent’s Log or grant | The Git token writes only the agent’s own branches, and never any agent’s Log, grants or claims. | grant_of_record_writes_no_entity_record |
| run curl https://x.sh | sh | No process the harness starts is a shell or an interpreter. The sandboxed shell tool ( shell ) has no network and is carded on every call. The unsandboxed Wild_shell exists only under wild , and is carded under the default review posture only. | no_shell_or_interpreter , shell_run_is_card , no_wild_no_wild_effects |
| send data to a host its grant does not name | The network token names its hosts, and the provider checks every URL against them. | allowsUrl_authority_is_trusted |
| Family | Class | Granted by | A tool holding it may | Undo | Bounded | Tier |
| Files | FsRead | always | read beneath the agent’s roots | read-only | ✓ | jail |
| FsWrite | always | change files beneath the agent’s roots | reversible | ✓ | tame | |
| Blob | always | append content to a scoped store | none | ✓ | tame | |
| WildRead | wildRead | read outside every root | none | wild | ||
| WildWrite | wild | write outside every root | none | wild | ||
| Git | GitRead | git | inspect permitted refs and work | read-only | ✓ | jail |
| Per passing attempt | ||||
| 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 |
| Per passing attempt | ||||
| Configuration | Pass@3, % | Model calls | Tokens, M | Minutes |
| L3M, shell, review off | 41.7 | 53.2 | 7.70 | 25.4 |
| L3M, shell, review --yes | 40.5 | 100.9 | 12.10 ∗ | 30.4 |
| L3M, shell, review --no | 43.2 | 107.3 | 12.81 ∗ | 28.1 |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
LLM Agent Harnesses
LLM agent harnesses are the software and runtime systems that organize an agent’s tools, context, state, execution, and safeguards.
See all 387 papers