#Capabilities
A dependency declaration says what a program needs. It does not grant permission to access files, inherit environment variables, or use the network. The host supplies implementations and authority.
Compile-time execution matters here as much as runtime execution: a dependency can run staged code while your program is being built.
#Compile and Runtime Policy
The native CLI selects profiles in .rig/config.toml:
[capabilities]
compile = "sandboxed"
runtime = "unrestricted"
These are also the defaults when no config exists.
sandboxed allows declared executable Component dependencies from the resolved graph while denying ambient filesystem, environment, process-argument, network, and standard-stream authority. Clocks and randomness retain their baseline implementations, so this is not a promise of deterministic or hermetic compilation.
unrestricted enables supported host authority and inherits the ergonomic host defaults. For CLI execution, it mounts the selected project root read-write at guest .; it does not use an unrelated process working directory as that root.
Build and reduce use the compile profile. Run uses it while compiling, then the runtime profile while invoking the command. All test stages use the compile profile, including Stage 0 tests.
#A Narrower Runtime Profile
This profile permits standard output, inherited arguments, and read-only access to a project's data directory:
[capabilities]
compile = "sandboxed"
runtime = "read_data"
[capabilities.profiles.read_data]
stdio = "inherit"
[capabilities.profiles.read_data.process]
inherit_args = true
[[capabilities.profiles.read_data.filesystem.mounts]]
host = "data"
guest = "data"
writable = false
Create the host directory before running a program that needs the mount. Its path is resolved from the project directory containing .rig/. Only the explicitly mounted path becomes available to guest filesystem operations.
Custom profiles start from sandboxed authority and enable the fields they specify. Omitting network or environment configuration therefore leaves them disabled; a custom profile does not inherit unrestricted defaults.
#Available Grants
| Setting | Values or meaning |
|---|---|
stdio |
"inherit" or "disabled" |
network |
"allow" or "disabled" |
env.inherit |
Inherit the host environment |
env.values |
Explicit name/value table |
process.inherit_args |
Inherit the command's argument list |
process.args |
Explicit complete argument list |
filesystem.mounts |
Host path, guest path, and optional writable grant |
Inherited and explicit environment settings are mutually exclusive, as are inherited and explicit arguments. Built-in profile names cannot be redefined. Unknown fields, undefined selected profiles, and invalid combinations are configuration errors rather than ignored settings.
For inherited runtime arguments, rig run main.rig -- hello gives the guest main.rig followed by hello. An explicit process.args list replaces that complete list. Compile-time argument inheritance instead exposes the compiler process's actual arguments.
#Policy Ownership
The nearest config found upward from the entry directory is root invocation policy. Dependency packages cannot replace it with their own profiles; all selected dependencies execute under that root policy.
Resolving a WIT definition grants no authority: it is schema data. A direct WASI import still needs an implemented host binding with the selected permissions. Conversely, allowing a capability does not make every possible host interface implemented.
Package fetching is a separate transport operation. A guest network grant controls executed code, not whether the CLI can resolve a declared package through a registry.
Capability-denied diagnostics identify compile-time or runtime execution, the selected profile, and the denied authority. Host APIs may also return recoverable permission errors through their ordinary result types.
#Other Hosts and Execution Limits
The browser playground is hosted separately. It grants virtual arguments and environment, exit, stdout, and stderr, but not access to local files or arbitrary network interfaces. Browser embeddings can provide additional explicit host bindings through rig-web.
Execution limits complement permissions. A host may interrupt code that exhausts its limits; that is an execution failure, not a recoverable Variant result. Interruption or a trap does not guarantee resource destructors or JavaScript cleanup will run. Release resources explicitly on normal completion paths.
The language's static initialization restriction is independent of these grants: permission to call an asynchronous interface does not make that call legal inside a module-level initializer.