Functions are pure by default. To do I/O, you declare the capabilities you need. The compiler verifies you don't use anything else. Each capability is middleware with a policy. Policies are M-of-N governed. The type system IS the sandbox.
Pure. No I/O at all. Memoizable, parallelizable, replayable. The default for every function.
Controlled I/O through named capabilities only. The compiler rejects any I/O outside the declared capabilities. Each capability has a policy.
Unrestricted I/O. Reserved for the executor — runs only after M-of-N policy approval. Never given to untrusted code.
The +E(users, email) annotation
tells the compiler: every +E call in this body must trace back to users or
email. No ambient File, Network, or Process access. The function reads and processes
data freely through its capabilities — it can await reads, think, read more — but it cannot
reach outside the declared aperture.
A capability wraps an effectful operation with a policy. Every invocation goes through the policy first. Capabilities compose — add logging, rate limiting, or validation by wrapping:
Nobody — not the tool, not the developer, not a single admin — can change a policy unilaterally. Updating a policy requires M-of-N cryptographic signatures from authorized auditors.
The sandbox function reads freely through its capabilities but can only propose writes. The policy function is pure — it just checks signatures. The executor is fully effectful but runs only after M-of-N approval. If the sandbox throws, MVCC rollback — proposed actions revert. Clean.
JavaScript sandboxes (DeterministicJS)
and WASM memory isolation work at runtime — they can't tell you WHAT the code will do until it
runs. U's +E(capabilities) is a compile-time guarantee: the compiler proves the
function only uses its declared capabilities before the code ever executes. You know the attack
surface from the type signature, not from running the code in a cage.
This is how Safebots works. The modifier system replaces DeterministicJS, the WASM sandbox, the capability injection framework, the write-intent queue, and the policy enforcement layer — with three modifier annotations. The type system IS the sandbox. Read the full Safebots story.