Capabilities and RBAC
Agent capability model: AgentCapabilities, IpcScope, ToolPermissions, SandboxPolicy, ResourceLimits, the CapabilityChecker, and governance-gated elevation.
WeftOS enforces a capability-based access control model for kernel-managed agents. Each agent process carries an AgentCapabilities value that defines what it may spawn, send, execute and consume. Tool permissions and the sandbox policy are separate values passed to the checker alongside it.
Source: crates/clawft-kernel/src/capability.rs. Cross-node capability claims (a different mechanism) are in capability_claim.rs; see the end of this page.
AgentCapabilities
pub struct AgentCapabilities {
pub can_spawn: bool, // default true
pub can_ipc: bool, // default true
pub can_exec_tools: bool, // default true
pub can_network: bool, // default false
pub ipc_scope: IpcScope, // default IpcScope::All
pub resource_limits: ResourceLimits,
}Fields accept camelCase aliases when deserialized (canSpawn, ipcScope and so on).
IpcScope
pub enum IpcScope {
All, // default
ParentOnly,
Restricted(Vec<u64>), // listed PIDs; topics limited to public topics
Topic(Vec<String>), // listed topics only, no direct PID messaging
None,
}A topic is public when it is exactly public or starts with public. (is_public_topic).
Scope enforcement
AgentCapabilities::can_message(pid) and can_topic(topic) give these answers, and can_ipc = false denies everything:
| Scope | Message to a PID | Topic access |
|---|---|---|
All | allowed | allowed |
ParentOnly | can_message returns false and its comment says the caller must check the parent separately | allowed (not restricted) |
Restricted(pids) | only PIDs in the list | only public topics |
Topic(topics) | denied | only topics in the list |
None | denied | denied |
CapabilityChecker::check_ipc_target and check_ipc_topic call these methods, and A2ARouter calls the checker for Process and Topic targets (a2a.rs). No parent check was found in check_ipc_target, so ParentOnly behaves as "no direct PID messaging" there.
ToolPermissions
pub struct ToolPermissions {
pub allow: Vec<String>, // empty = all allowed
pub deny: Vec<String>, // overrides allow
pub service_access: Vec<String>, // empty = no restriction
}SandboxPolicy
pub struct SandboxPolicy {
pub allow_shell: bool,
pub allow_network: bool,
pub allowed_paths: Vec<String>,
pub denied_paths: Vec<String>,
}SandboxPolicy is a struct of booleans and path lists. Earlier versions of this page showed an enum with None, Strict and Permissive variants; no such enum exists. The one check the checker makes with it is for shell tools: shell_exec, exec_shell, bash, command and run_command are denied when allow_shell is false.
ResourceLimits
pub struct ResourceLimits {
pub max_memory_bytes: u64, // default 256 MiB
pub max_cpu_time_ms: u64, // default 300,000 (5 minutes)
pub max_tool_calls: u64, // default 1,000
pub max_messages: u64, // default 5,000
pub max_disk_bytes: u64, // os-patterns only; default 100 MiB, 0 = unlimited
}CapabilityChecker
CapabilityChecker::new(Arc<ProcessTable>) reads each agent's capabilities from the process table. Its methods return KernelError::CapabilityDenied or ResourceLimitExceeded:
check_tool_access(pid, tool, permissions, sandbox): the agent must havecan_exec_tools; the tool must not be indeny; ifallowis non-empty the tool must be in it; shell tools needsandbox.allow_shell.check_ipc_target(from, to)andcheck_ipc_topic(pid, topic):can_ipc, then the scope table above.check_service_access(pid, service, permissions): ifservice_accessis non-empty the service must be listed.check_resource_limit(pid, resource): compares aResourceType(Memory,CpuTime,ConcurrentTools,Messages) against the limits and fails when the value is greater than the limit.
Capability elevation
pub struct CapabilityElevationRequest {
pub pid: u64,
pub current: AgentCapabilities,
pub requested: AgentCapabilities,
pub reason: String,
}
pub enum ElevationResult {
Granted { new_capabilities: AgentCapabilities },
Denied { reason: String },
}AgentCapabilities::request_elevation_gated (feature exochain) asks the governance gate for the action capability.elevate with a fixed effect of risk 0.5 and security 0.5. If the gate denies, the result is Denied. When a chain manager is passed, both outcomes are appended as capability.elevate events (EVENT_KIND_CAPABILITY_ELEVATE). needs_elevation(platform, requested) is true for the browser platform when the request asks to spawn, to use the network, or for any scope other than Restricted.
Browser defaults
AgentCapabilities::browser_default() gives: no spawning, IPC allowed, tools allowed, no network, IpcScope::Restricted(vec![]), and limits of 64 MiB memory, 60,000 ms CPU, 200 tool calls and 500 messages (10 MiB disk under os-patterns). The browser-sandbox default of "no filesystem or network" described in older versions of this page is expressed through can_network = false and the scope, not through a separate Strict policy.
Cross-node capability claims
Separately from per-agent capabilities, peers advertise capability tokens (mesh, code, review, ipc, spawn, ecc, hnsw and others) as Ed25519-signed claims. Tokens outside an allow-list, and tampered signatures, are rejected at verification (capability_claim.rs, WEFT-147). The placement capability vocabulary (ADR-099), used to match workloads to nodes, is a third, unrelated list; it is in the repo reference docs/reference/capability-vocabulary.md.
IPC and A2A Messaging
Kernel IPC message envelopes, MessageTarget variants, MessagePayload types, A2A routing, GlobalPid for cross-node addressing, and request-response patterns.
ExoChain Subsystem
Append-only hash chain with SHAKE-256, Ed25519 and ML-DSA-65 dual signing, RVF persistence, witness chains, and integrity verification.