VIP-58: Capabilities: a permission kernel in the standard library
Status: accepted by Will, 2026-11-23 (standard library + task plan metadata; no grammar changes) and implemented. Will: "58 I accept. I accept every other language proposal but ones that don't require a change to the language and are purely library functions that don't require compiler changes at all should be marked as such". The runtime exports Experimental.Capability (policy evaluator, grant stores, and platform service guards), W.plan / Experimental.Durable.plan exposes each reached task's declared tier and capabilities, task/workflow capabilities ceilings are enforced monotonically across layers, and EK5801 warns when a task requiring HttpClient or ChildProcessSpawner omits tier.
Will's words
Yea good call on capabilities and permission kernal likely being something that should be built into the library itself but not clear. I think I agree with all of these and we should write VIP for all of the.
Summary
One sentence. Permissions are a standard-library module, Experimental.Capability, that puts a check in front of every platform service a program can reach, and the language adds no syntax for it.
One paragraph. This proposal chooses a library surface over language syntax, for the four reasons below. The module ports the capability and kernel packages of the reference engine (an existing Effect durable-execution framework these built-ins are modelled on). A capability names one operation, such as fs:write on /workspace/out.txt. A policy is an ordered list of patterns that allow or deny. Experimental.Capability.guard(policy) is a layer that replaces FileSystem, HttpClient and ChildProcessSpawner with checked versions, so code that never mentions permission is still checked. A grant decides whether an operation may happen. A ceiling, set with attenuate, bounds what any grant can reach, and it only narrows.
your code Experimental.Capability.guard(policy) the host
───────── ───────────────────────────────────── ────────
fs.readFileString ─► fs:read /workspace/README.md allow ─► NodeServices.layer
fs.writeFileString ► fs:write /workspace/out.txt ask ─✕ fails: PermissionRequired
http.post ─► net:post https://api.x.dev/… deny ─✕ fails: PermissionDeniedDecision
// proposed
export effect function copyReadme() {
provide Experimental.Capability.guard({ allow: ["fs:read:/workspace/**"] }) {
const fs = try FileSystem.FileSystem
const readme = try fs.readFileString("/workspace/README.md")
try fs.writeFileString("/workspace/out.txt", readme)
}
}The read succeeds. The write fails: no rule allows fs:write.
Why a library
- Injected services are the door. Vibe code reaches the platform through
FileSystem,HttpClientandChildProcessSpawner(VIP-33). A layer that decorates those tags in place guards every caller, including a library that never heard of the kernel. A second, protected tag would guard only the callers who chose it. - A decision needs run-time facts. The kernel authorizes a path after resolving it, runs the operation "through a pinned directory descriptor", and rechecks "every redirect hop" (
flows/kernel/README.md). No type system sees a symlink or a redirect. - Will leans library, in the words above.
- The one static part has a home. What a durable step may touch is declared on the step:
static readonly tier,capabilitiesandeffectson ataskorworkflow(durable-tasks-workflows). Those are members, not new grammar.
The compiler contributes without syntax: the plan it derives lists each task's tier and its declared capabilities. A reviewer reads what a workflow may touch before it runs. The plan does not infer authority from a requirement type: FileSystem in R says a step can ask, not that it may.
Module
Experimental.Capability, in scope with no import, as VIP-33 rules. Its code is vibelang-runtime/experimental/Capability. It ports the reference engine's capability package (vocabulary and evaluation, no state) and its kernel package (enforcement).
| Call | Meaning | Reference engine |
|---|---|---|
Capability.guard({ allow, deny?, workspace?, attended? }) | A layer that decorates the platform services in place | HostServices.layer over GrantStore.layer({ attended, rules }) and Workspace.layer(root) |
Capability.attenuate(patterns)(effect) | Narrow what one Effect may ask for. Nothing widens it again | CapabilitySet.attenuate |
Capability.evaluate(policy, capability) | "allow", "deny" or "ask", a pure function | Permission.evaluate |
Capability.tierOf(capability, { workspace }) | "sealed", "compensable" or "irreversible" | Capability.tierOf |
Capability.required(error) | Read a PermissionRequired back out of a PlatformError | Permission.fromPlatformError |
Capability.journaled | A grant store that writes a remembered answer to the run's journal before it takes effect | JournalGrantStore.layer |
Rules
- Text form. A capability is
action:resource, such asnet:get:https://api.github.com/repos/**. - Globs.
*matches any run of characters,/included.?matches one. There is no escape, so a resource that holds*or?cannot be granted exactly. Never build a pattern from an agent's text. - Actions are a closed list, from
flows/capability/src/Action.ts:fs:read,fs:write,net:get,net:post,net:private,model:call,memory:read,memory:write,proc:spawn, and ninejj:*actions. - Order. The last rule that matches wins, except that a configured deny is a veto. A request no rule matches is
ask, neverallow. ask. Withattended: false,askfails withPermissionRequired. Withattended: true, the operation parks on a request a person answers.guarddefaults tofalse, because a parked request nobody answers hangs a program. The reference engine'sGrantStoredefaults totrue.- Ceilings.
attenuateintersects the current ceiling with one more group of patterns. A fiber that never passed through it has no ceiling. A grant cannot reach past a ceiling, and a ceiling grants nothing. A task'scapabilitiesmember is a ceiling: omitted, it inherits the caller's;[]denies every guarded operation. - Failures. Effect fixes the error type of
fs.writeFileStringtoPlatformError. The kernel fails with aPlatformErrorwhose cause holds the structuredPermissionRequiredorPermissionDenied. - Tiers (
Capability.tierOf). They govern retry, caching and rollback; they do not grant or forbid.
| Tier | Operations |
|---|---|
sealed | fs:read, net:get, model:call, memory:read |
compensable | An fs:write inside the workspace |
irreversible | net:post, proc:spawn, memory:write, an fs:write outside the workspace |
Only an irreversible step needs an idempotency key to retry. Containment is lexical, so the kernel resolves a real path before it classifies a write.
- Decorated services.
FileSystem,ChildProcessSpawnerandHttpClientare checked.Pathpasses through. The reference engine also guards itsJjservice.
What it does not guard
- A
.tsfile or amodulebody (VIP-40) reaches the platform directly. The kernel never sees it. VIP-33's ban on platform globals in.vibecode keeps authors on the door; it is discipline, not a security proof, and VIP-54 may relax it. Untrusted code needs a process or realm with a fixed service table. - A spawned process does what the operating system lets it. Granting
proc:spawnfornpm *grants every npm subcommand and anything appended to the line. Confinement is std-sandbox's job. - A capability is not a secret. std-secrets keeps values out of a step.
- A human answer in a workflow is not a grant. It answers the workflow's question (durable-waits).
Host needs
Pure evaluation runs everywhere. The runtime guard checks resolved file paths and HTTP redirect targets through the platform services it decorates. It operates on the resolved path, so confinement against concurrent filesystem changes still requires directory handles pinned by the host. Private-network enforcement also requires host-side address checks because the guard evaluates request URLs before DNS resolution.
Maintainers' decisions
This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.
- The read succeeds. Design · Review.
- The write fails: no rule allows
fs:write. Design · Review. - Injected services are the door. Vibe code reaches the platform through
FileSystem,HttpClientandChildProcessSpawner(VIP-33). Design · Review. - A layer that decorates those tags in place guards every caller, including a library that never heard of the kernel. Design · Review.
- A second, protected tag would guard only the callers who chose it. Design · Review.
- A decision needs run-time facts. The kernel authorizes a path after resolving it, runs the operation "through a pinned directory descriptor", and rechecks "every redirect hop" (
flows/kernel/README.md). Design · Review. - No type system sees a symlink or a redirect. Design · Review.
- Will leans library, in the words above. Design · Review.
- The one static part has a home. What a durable step may touch is declared on the step:
static readonly tier,capabilitiesandeffectson ataskorworkflow(durable-tasks-workflows). Design · Review. - Those are members, not new grammar. Design · Review.
- The compiler contributes without syntax: the plan it derives lists each task's tier and its declared capabilities. Design · Review.
- A reviewer reads what a workflow may touch before it runs. Design · Review.
- The plan does not infer authority from a requirement type:
FileSysteminRsays a step can ask, not that it may. Design · Review. Experimental.Capability, in scope with no import, as VIP-33 rules. Design · Review.- Its code is
vibelang-runtime/experimental/Capability. Design · Review. - It ports the reference engine's capability package (vocabulary and evaluation, no state) and its kernel package (enforcement). Design · Review.
- Call
Capability.guard({ allow, deny?, workspace?, attended? }): Meaning: A layer that decorates the platform services in place; Reference engine:HostServices.layeroverGrantStore.layer({ attended, rules })andWorkspace.layer(root). Design · Review. - Call
Capability.attenuate(patterns)(effect): Meaning: Narrow what one Effect may ask for. Nothing widens it again; Reference engine:CapabilitySet.attenuate. Design · Review. - Nothing widens it again |
CapabilitySet.attenuate| Design · Review. - Call
Capability.evaluate(policy, capability): Meaning:"allow","deny"or"ask", a pure function; Reference engine:Permission.evaluate. Design · Review. - Call
Capability.tierOf(capability, { workspace }): Meaning:"sealed","compensable"or"irreversible"; Reference engine:Capability.tierOf. Design · Review. - Call
Capability.required(error): Meaning: Read aPermissionRequiredback out of aPlatformError; Reference engine:Permission.fromPlatformError. Design · Review. - Call
Capability.journaled: Meaning: A grant store that writes a remembered answer to the run's journal before it takes effect; Reference engine:JournalGrantStore.layer. Design · Review. - Text form. A capability is
action:resource, such asnet:get:https://api.github.com/repos/**. Design · Review. - Globs.
*matches any run of characters,/included. Design · Review. ?matches one. Design · Review.- There is no escape, so a resource that holds
*or?cannot be granted exactly. Design · Review. - Never build a pattern from an agent's text. Design · Review.
- Actions are a closed list, from
flows/capability/src/Action.ts:fs:read,fs:write,net:get,net:post,net:private,model:call,memory:read,memory:write,proc:spawn, and ninejj:*actions. Design · Review. - Order. The last rule that matches wins, except that a configured deny is a veto. Design · Review.
- A request no rule matches is
ask, neverallow. Design · Review. ask. Withattended: false,askfails withPermissionRequired. Design · Review.- With
attended: true, the operation parks on a request a person answers. Design · Review. guarddefaults tofalse, because a parked request nobody answers hangs a program. Design · Review.- The reference engine's
GrantStoredefaults totrue. Design · Review. - Ceilings.
attenuateintersects the current ceiling with one more group of patterns. Design · Review. - A fiber that never passed through it has no ceiling. Design · Review.
- A grant cannot reach past a ceiling, and a ceiling grants nothing. Design · Review.
- A task's
capabilitiesmember is a ceiling: omitted, it inherits the caller's;[]denies every guarded operation. Design · Review. - Failures. Effect fixes the error type of
fs.writeFileStringtoPlatformError. Design · Review. - The kernel fails with a
PlatformErrorwhose cause holds the structuredPermissionRequiredorPermissionDenied. Design · Review. - Tiers (
Capability.tierOf). Design · Review. - They govern retry, caching and rollback; they do not grant or forbid. Design · Review.
- Tier
sealed: Operations:fs:read,net:get,model:call,memory:read. Design · Review. - Tier
compensable: Operations: Anfs:writeinside the workspace. Design · Review. - Tier
irreversible: Operations:net:post,proc:spawn,memory:write, anfs:writeoutside the workspace. Design · Review. - Only an irreversible step needs an idempotency key to retry. Design · Review.
- Containment is lexical, so the kernel resolves a real path before it classifies a write. Design · Review.
- Decorated services.
FileSystem,ChildProcessSpawnerandHttpClientare checked. Design · Review. Pathpasses through. Design · Review.- The reference engine also guards its
Jjservice. Design · Review. - A
.tsfile or amodulebody (VIP-40) reaches the platform directly. Design · Review. - The kernel never sees it. Design · Review.
- VIP-33's ban on platform globals in
.vibecode keeps authors on the door; it is discipline, not a security proof, and VIP-54 may relax it. Design · Review. - Untrusted code needs a process or realm with a fixed service table. Design · Review.
- A spawned process does what the operating system lets it. Design · Review.
- Granting
proc:spawnfornpm *grants every npm subcommand and anything appended to the line. Design · Review. - Confinement is std-sandbox's job. Design · Review.
- A capability is not a secret. std-secrets keeps values out of a step. Design · Review.
- A human answer in a workflow is not a grant. It answers the workflow's question (durable-waits). Design · Review.
- Pure evaluation runs everywhere. Design · Review.
- Enforcement needs the platform services it decorates, and directory handles for file confinement, which Node and Bun have. Design · Review.
- A host that cannot confine a path refuses the operation; it does not fall back to a lexical check. Design · Review.
Adopted review answers
- Keep
Experimental.Xnames under VIP-33. Promotion to a bare module name requires a later decision. Review question 1.
Compared
The same program for the reference engine 1.x. It type-checks against the reference engine's kernel package at 1.0.0-rc.16.
import { Capability, GrantStore, HostServices, Permission, Workspace } from "@smthrs/kernel"
import { Effect, FileSystem, Layer } from "effect"
const allow = (action: Capability.PatternAction, resource: string) =>
new Permission.Rule({ effect: "allow", pattern: new Capability.CapabilityPattern({ action, resource }) })
export const guarded = HostServices.layer.pipe(
Layer.provide(Layer.orDie(GrantStore.layer({ attended: false, rules: [allow("fs:read", "/workspace/**")] }))),
Layer.provide(Workspace.layer("/workspace"))
)
export const program = Effect.gen(function*() {
const fs = yield* FileSystem.FileSystem
const readme = yield* fs.readFileString("/workspace/README.md")
yield* fs.writeFileString("/workspace/out.txt", readme)
})| Program | Tokens (o200k_base) | Lines |
|---|---|---|
| Vibe, proposed | 70 | 7 |
| Reference engine 1.x | 178 | 16 |
Checked. The Vibe example uses only existing syntax. It compiles under vibelang 0.0.13 against a declaration of the proposed Experimental.Capability.guard. The reference-engine program type-checks as shown.
Principles
- TypeScript-first. No syntax. A policy is an array of strings.
- Effect-second. The kernel is layers over Effect's own service tags. "Decorating in place is the point."
- Optimized for agentic programs. An agent runs tools a person did not write. A policy bounds them, and
attenuatebounds a sub-agent further. - Highly forkable. A fork changes the action list or the grant store in one package, with no compiler change.
- Factory-first. The factory's agents run under a published policy.
What this changes
Experimental.Capabilityis new. No grammar changes.- The plan format gains two fields per task: tier and declared capabilities.
static readonly tier,capabilitiesandeffectsare typed by this module.
Alternatives
- Effect tiers in the type system, such as
string!E!R!Tier. A fourth channel on every Effect type costs tokens on every signature, and a tier depends on the resource, which is a run-time value. - A
grantblock,grant "fs:read:/workspace/**" { … }. It isprovide Experimental.Capability.guard(…) { … }with a new keyword. - Capabilities as object references, passed as arguments, as in an object-capability language. Vibe already passes authority that way: a service in the requirement type. The kernel refines it by resource.
- Treat an unmatched request as denied. A host can do that with one rule. The default keeps
ask, the state an attended run needs. - Leave it to the operating system or a sandbox. A sandbox bounds a whole process. A policy bounds one step and can ask a person.
Follow-up questions
- A sealed project mode. The kernel cannot see
.tscode. Should avibe.config.jsonflag refuse.tsandmodulecode that reaches a platform API outside an allowlist? That is compiler work, and the one place this VIP could become a language VIP. Recommendation: decide with VIP-54, which owns platform code. - Warn on a missing tier. A task whose body needs
HttpClientorChildProcessSpawnerand that declares notierdefaults tosealed, which claims its result is reproducible. Recommendation: a compiler warning. - Exact grants. The glob grammar cannot express a resource that holds
*or?. Should the port add an exact matcher beside the globs? Recommendation: yes, before agents write grants. - The reference engine's
Jjservice. It is guarded in the reference engine because compensable steps snapshot the workspace with jj. Whether Vibe exposesJjat all is std-durable's question.
Depends on
- VIP-33, accepted: platform access through injected services.
- Nothing in this set.
Capability.journaledtakes the journal as a requirement; std-durable provides it.