Syscalls for Agents: How microcontexts make agents cheaper, safer, and wiser — faster.

Use the idea of microcontexts to explain why AI agents need something like a kernel and process boundaries.

Fable Max Prompt

Your agent runs in ring 0. It reads hostile web pages into the same address space as its own instructions, then issues sends, commits, and deletions with nothing standing between intention and effect. If an operating system shipped this way — every process trusted, every operation unmediated — you wouldn’t call it unsafe; you’d call it prehistoric. Computing already lived through this moment once, and the invention that ended it has a name: the system call.

Agents need the same invention: an admission-controlled boundary between an untrusted interior and everything that matters. The unit that makes the boundary workable is the microcontext — the smallest independently addressed, typed, provenance-tagged piece of state an agent consumes or emits. Boundary, atom, and one further discipline about how atoms compose: that is the whole architecture. What follows is why each part is load-bearing, and why together they make agents cheaper, safer, and wiser — faster, which is the claim that sounds wrong and therefore needs defending.

The interior is not your department

Every serious control problem with agents traces to one fact: the forward pass is opaque. Not opaque to you — opaque to everyone, including the people who trained it. Its attention doesn’t respect your section headers; it demonstrably loses the middle of long contexts. Its failures are not noise but adversarially steerable. And once tokens are admitted, their influence on the output is entangled beyond decomposition. You cannot patch this with prompting, because a prompt is a request made to the interior, and the interior is precisely the thing you cannot specify.

Computing has one great move for unspecifiable interiors, and it has executed it repeatedly at civilizational scale: give up on the inside and make the interface rigorous. We never verified microarchitectures; we specified instruction sets and let the silicon be arbitrarily weird behind them. Kernels do not control what a process computes; they mediate every call it makes. Type systems do not govern runtime behavior; they constrain what programs are expressible at all. The discipline is identical each time: the interior may be a mystery, but the crossings are law.

The model is simply the newest untrusted component, and what it needs is not better persuasion but a syscall layer. Calling that layer “a boundary condition, not a control system” is not a confession of weakness — it is the entire thesis. The boundary is the only surface on which words like deterministic, trusted, and audited can even be defined, which makes it not the weakest place to put your architecture but the only place architecture exists.

Nothing crosses anonymously

A boundary needs a unit of account. A microcontext is that unit: a stable ID, a type, a provenance label, a scope, a token cost, and a render function. Directives, tool schemas, task frames, retrieved documents, tool outputs, scratch reasoning, summaries — all atoms, none anonymous. The rule is admission control: no ID, no provenance, no entry.

Three consequences fall out at once.

Injection defense becomes structural. The danger of prompt injection is captured by the lethal trifecta — private data, untrusted content, and the ability to act, together in one window: the confused deputy, token edition. Provenance labels do not stop an injected sentence from influencing the model; nothing at the input can. They are the prerequisite for the defense that works: gating capabilities by the taint of the context that authorized them, the design at the heart of CaMeL. You cannot refuse a tool call made on tainted authority if you never tracked taint. Labels are not the wall; they are the ledger the wall consults.

Assembly becomes a function. The window is compiled deterministically from task, store, and budget. The store is content-addressed and append-only; every summary is a new atom pointing at its sources, so nothing is silently overwritten; a subagent’s contract names exactly the atoms it may receive — least privilege, extended to memory. Same inputs, same window: without that property your evals measure noise, which is a polite way of saying they measure nothing. Think reproducible builds, for prompts.

Cost falls out of ordering. Atoms sort immutable-first — directives, schemas, task frame, then the volatile tail — yielding a stable prefix, which is what prompt caching actually monetizes. The same discipline that makes the window auditable makes most of it reusable. “Cheaper” is not a hope here; it is a sort order.

If you have built agents, you already know the anti-patterns this abolishes: the append-everything loop, the one giant system prompt, the RAG dump, the summarize-and-discard handoff that destroys lineage exactly where you will later need it. The field’s context-engineering practice has been converging on these rules piecemeal; the boundary frame is what makes them one rule.

“Send an email” is a smuggled workflow

Atomizing the input is half the job. The monolithic transcript has an output-side twin: the monolithic tool call. send_email(to, subject, body) looks like an action. It is an entire workflow — decide, compose, evaluate, commit — compressed into one irreversible crossing, which is exactly what makes it impossible to mediate. A kernel can fully judge unlink(path) against a policy. No cheap mediator can judge “send this email,” because judging it requires understanding the task as well as the agent does.

So make the same move again: decompose until each crossing is thin.

  1. Specify the goal of the email — an atom, judgeable as a goal.
  2. Draft against the spec — an atom, attributable to the exact context that authorized it.
  3. Judge the draft against the goal — a verdict, and a far thinner task than composing.
  4. Approve, iterate, or escalate — a capability decision the boundary can enforce mechanically.
  5. Then, maybe, send — which by now means only: transmit this approved artifact to these addresses.

Notice what happened to the irreversible act: it became the most kernel-judgeable step in the chain, because everything semantically thick happened before it. And notice who chooses versus who effects. A confused process can request unlink("/") all day; whether anything is deleted is the kernel’s decision, not the process’s. That an agent picks its own calls is no disanalogy with operating systems — unmediated choice by an untrusted interior is the entire reason kernels, capabilities, and seccomp filters exist. The one genuine difference is that agent actions arrive workflow-shaped, semantically thick — and decomposition is the answer to precisely that.

Trust is a property of the arrangement

Decomposition looks like turtles all the way down — who judges the judge? — until you notice the asymmetry the whole design harvests: verification is cheaper than generation. Checking a draft against an explicit goal is thinner work than writing the draft; grading a step is easier than taking it. The pipeline above is a machine for converting that gap into trust. No single call is asked to be trustworthy. Thin calls are arranged — maker before checker, veto before commit — so that the composition has a property none of its parts do. This is the oldest trick in institutional design: maker-checker, separation of duties, four eyes on the wire transfer. Organizations learned centuries ago that wisdom does not live in any single act. It lives in the workflow.

One clause of policy is too important to learn and cheap enough to hard-code: irreversible actions never fire without confirmation. Not because the boundary is smart — because “never without a second signature” is the one policy simple enough to enforce as pure mechanism, a default-deny filter sitting at the thin final step, which is exactly where a veto costs least.

Policy moves up

Everything else deserving the word policy — what is acceptable, what good judgment looks like in this domain — does not live at the boundary at all. This is the separation of mechanism and policy, replayed for agents: the boundary enforces admission, provenance, capability, and the ledger; judgment lives in the weights, and it gets there by learning.

Here the atoms pay their second dividend. You cannot learn policy against a monolithic transcript, because there is nothing to assign credit to. Atomize the state, decompose the acts, ledger every crossing, and a trajectory becomes decomposable: this action, taken on the authority of these atoms, produced this outcome — a supervisable unit. The window ledger stops being an audit trail and becomes the training corpus. Escalations are where human labels enter, so the human sits at the residue, not in the loop. Judgment is expensive at inference and amortized across training; put it where it amortizes.

Why rigid is fast

Now the subtitle’s invoice can be itemized. Cheaper is the stable prefix and the declared budget: cache hits instead of re-reads, eviction as policy instead of accident. Safer is provenance-gated capability plus the mechanical veto: the lethal trifecta dismantled structurally instead of rhetorically. Wiser is composition plus the loop that feeds on its own exhaust: verifier-checked steps today, learned judgment tomorrow.

Faster is the one that sounds wrong, and it is the reason to build any of this. Rigidity is supposed to be molasses. But deterministic assembly is what makes evals mean anything; replayable ledgers are what make debugging cheap; decomposed, credit-assignable trajectories are what make improvement trainable. Every loop you actually iterate — evaluate, debug, learn — runs on rails the boundary laid. Rigid is what fast is made of.

It is also the answer to the objection every scaffolding architecture must survive: the Bitter Lesson. Sutton’s razor cuts machinery that competes with the model, and it will cut some of this too — the parts of context curation that exist only to compensate for weak attention will depreciate as models improve, and should. But boundaries do not compete with the interior; they define the game the interior plays. Economics, provenance, audit, and the veto are about scarcity and trust, and scale abolishes neither: an infinite context window still cannot tell you whether a sentence came from your operator or from a webpage. Interfaces outlive implementations. The ISA outlived every microarchitecture; POSIX outlived every kernel it specified. A syscall layer for agents will outlive every model that runs behind it.

The discipline, whole

Three commitments, one loop:

  • Micro-state. Context enters as addressed, typed, provenance-tagged atoms — nothing crosses anonymously.
  • Micro-acts. Actions leave decomposed, until each crossing is thin enough for a dumb boundary to judge.
  • Wise composition. Steps are arranged — maker before checker, veto before commit — so trust emerges from the workflow rather than residing in any call.

Drop a leg and the loop breaks. Micro-state without micro-acts is a beautifully audited monolith. Micro-acts without composition are small steps arranged foolishly. Composition without atoms is a workflow diagram with nothing addressable flowing through it. Together they close: atoms make behavior legible, the boundary makes it accountable, the learning layer makes it good — fed by the accountability layer’s own exhaust.

None of the parts are new, and that is the point. Paging state out of the window is MemGPT; provenance-gated capability is CaMeL; deterministic assembly is reproducible builds; the trust posture is zero trust; the composition pattern is a bank’s back office. The contribution is the arrangement — fitting, for an architecture whose central claim is that arrangement is where the property lives.

If you keep one sentence, keep the invariant: nothing enters or leaves an agent except in pieces small enough to check. Syscalls were never how programs got smart. They were how untrusted programs became safe to run — and then, because the interface held still while everything behind it improved, how they got fast. Same job. Same move. “That should be a syscall” is now a sentence you can say in a design review. Start saying it.


Appendix I: Why This Isn’t Microservices

State the objection at full strength, because it has teeth. The last architecture to promise small units, strict boundaries, and independent evolution was microservices, and the industry spent a decade paying its bill: distributed monoliths, nanoservice sprawl, on-call rotations for a for-loop, and a premium so steep that the movement’s own chroniclers ended up advising everyone to start with a monolith — while the counter-revolution wrote love letters to the majestic monolith. If “micro-” plus “boundaries” is the pitch, hasn’t this movie run before, and didn’t it end badly?

The resemblance is real. The lineage is not. Five disanalogies, each load-bearing:

1. What gets decomposed. Microservices sliced the trusted implementation: computation itself, scattered across a network. Microcontexts never touch the implementation — the model stays a monolith, and the Bitter Lesson says it should. What gets decomposed is the traffic across the trust boundary: the interface to an interior that remains whole. Microservices cut the organ apart; this structures the membrane. The architecture is, if anything, monolith-preserving — it exists precisely so the interior can stay huge, opaque, and improving while everything around it holds still.

2. Why decompose — and when to stop. Microservices decomposed for organizational independence: separate teams, separate deploys, Conway’s law promoted from observation to blueprint. That gave granularity a direction (“smaller”) but no criterion, and a direction without a stopping rule produced nanoservices, entity services, and the unwinnable “how micro is micro?” wars. Here granularity is a threshold, not a direction: decompose until the boundary can judge the crossing, then stop. Checkability is a terminal condition. “Micro” is not an aesthetic of smallness; it is the satisfaction of a predicate.

3. What kind of boundary. A microservice boundary is a network boundary, and networks bill you in fallacies: latency, partial failure, retries, sagas where transactions used to be, CAP where certainty used to be. Every function call became an RPC with a failure mode, and the boundary was pure rent. A microcontext boundary is an admission boundary inside one runtime: nothing partitions, nothing needs compensating transactions, and the crossing pays — the stable prefix is the cache key, the ledger entry is the training datum. Microservice boundaries were overhead you tolerated for independence. These boundaries are where the money comes back.

4. What crosses. In microservices, control crosses: services call services, and system behavior emerges from a call graph nobody drew — which is how you get a distributed monolith, coupling that exists but was never declared. Here, data crosses — atoms — and control never leaves the composition: the workflow is explicit, assembled deterministically, drawn before it runs. That is CaMeL’s deepest inheritance — untrusted data may flow, but it can never become control flow. Emergent coupling was the microservices disease; in this architecture, coupling is declared in the lineage graph or it does not exist.

5. Whose trust. Microservices drew hundreds of boundaries between components that fully trusted each other — cuts where no trust gradient existed, cost with no security purchase (the service mesh arrived a decade later, as an apology). This architecture draws its boundary exactly where the trust gradient is steepest: around the one untrusted component. Decompose along trust gradients, not team gradients. Conway’s law says your architecture mirrors your org chart. This one mirrors your threat model.

One thing microservices got right survives here intact: “smart endpoints, dumb pipes” — the rebellion against the enterprise service bus, the smart middle that became a god-object and a bottleneck. The mediation layer here is emphatically dumb: mechanism only — admission, provenance, capability, veto. But dumb-and-sovereign, like a kernel, not dumb-and-passive, like a pipe. Intelligence lives at the ends — generation in the interior, judgment in the learning layer — never in the middle, because the middle must stay simple enough to be law.

And one risk is honestly shared: over-decomposition costs real tokens and real latency here, just as it cost real operations there. Five model calls where one would do is this architecture’s nanoservice. The defense is the stopping rule the last movement never had — and the ancestry the title claimed from the start. When the network is the boundary, you get microservices: thousands of volatile, semantically thick endpoints mirroring an org chart. When trust is the boundary, you get syscalls: a few hundred thin, stable calls that outlived every implementation behind them. Same prefix. Different family. This isn’t microservices for agents — it’s the other lineage, the one that held.


Appendix II: The Independence Budget

This appendix was almost two — one on checker independence, one on the pathologies of training on the loop’s own exhaust — and the fact that they could be mistaken for two is a flaw in the essay above. They are the same problem observed at two timescales. The composition converts verification into trust at exactly one exchange rate: the independence of maker and checker. Everything in “Trust is a property of the arrangement” and everything in “Policy moves up” draws on that single account. The essay presented the generator–verifier gap as a standing asymmetry. It is a reservoir, and the architecture spends it two ways.

The static spend: born correlated. Maker-checker means nothing if both are the same eyes. A model judging its own draft is not four eyes; it is proofreading your own essay — you read what you meant to write. This is not hypothetical caution: LLM judges measurably recognize and favor their own generations. Correlated error is precisely what separation of duties exists to prevent, and a model is maximally correlated with itself. Step 3 of the email pipeline earns its keep only if the judge’s blind spots are not the drafter’s blind spots.

The dynamic spend: becoming correlated. Now close the loop the essay celebrated: train the generator on judge-approved trajectories, and the judge is no longer a measure — it is a target, and Goodhart’s law is waiting. Optimization is a blind-spot-finding algorithm. The generator does not learn to draft well; it learns to draft approvably, and the two diverge exactly where the judge cannot see. Reward hacking is not a separate pathology from checker correlation — it is checker correlation being manufactured by gradient descent. Add model collapse — distributions narrowing as outputs become inputs — and the loop that was supposed to compound wisdom compounds agreement instead. One appendix is being born correlated; the other is becoming correlated. One theorem: the yield of the arrangement is bounded by an independence the arrangement itself consumes.

The door the essay left open. The failure should have been caught by the essay’s own instruments. Every token entering the window carries a provenance label; every crossing is ledgered — and then the ledger becomes the training corpus, and training is a crossing too. Exhaust re-enters the interior as gradient, and gradients carry no taint. The architecture guarded one door — the context window — and left the second, the training set, unmediated. This is a security hole, not just an epistemic one: an injection that survives into the corpus becomes a weight, and the lethal trifecta grows a fourth leg — write access to the model itself.

Budget management, then, as mechanism:

Diversify the eyes. Where stakes warrant, the judge runs on different weights; everywhere, it runs on different context — goal and draft, never the generator’s reasoning. A scratchpad full of rationalization is a steering vector, and least privilege applies to judges too.

Hold judges out. Never train against the judge that grades deployment. Keep a frozen judge as a canary and watch the spread: deployed-judge approval climbing while the frozen judge’s does not is Goodhart, quantified. Train/test discipline, extended from data to judgment.

Ground the loop from outside. Escalations are the loop’s only exogenous signal — the one channel optimization cannot reach around. Which makes rubber-stamping a structural failure, not a staffing problem: sample non-escalated trajectories for human audit too, so the channel stays calibrated. The residue is the grounding wire.

Mediate the second door. Exhaust passes the same admission control before it becomes gradient: provenance-gated, taint-scrutinized, ledgered as a crossing — because it is one. The corpus is a window that closes slower.

The honest close: independence can be budgeted, monitored, and refreshed. It cannot be made permanent. Every improvement in the generator narrows the gap the verifier lives in, and every training cycle spends what auditing accrues. The architecture never eliminates “trust the model”; it converts it into “trust the measured independence of two processes, plus a human signal the loop cannot optimize away” — smaller, priced, and monitored, which is the most any trust architecture has ever delivered. The essay’s invariant survives with one amendment it should have carried from the start: nothing enters or leaves an agent except in pieces small enough to check — and the weights are an entrance.

Leave a comment

Blog at WordPress.com.

Up ↑