Skip to main content

Module capabilities

Module capabilities 

Source
Expand description

The declarative capability-registration substrate.

Every native capability the kernel exposes is declared as data next to the backend logic that implements it: each backend module owns a pub fn capabilities(&BrainConfig) -> Vec<ToolDescriptor> that returns the descriptors it is wired for this run (applying its own config gate). The native_capabilities registrar here is the single collection point — it concatenates every backend’s declaration into the one manifest that feeds both the internal reasoner (the SOUL capability digest) and external clients (tools/list). The composition root registers the result through the same intent::ToolRegistry::register path the MCP host uses on mount, so native backends, mounted MCP servers, and (future) skill packs are all peers.

Authoring lives with the logic, not in the binary. Before this, the native catalog was a hand-built Vec inside the cli crate; adding a capability meant editing the binary. Now adding a capability touches only the backend that owns it. Capabilities whose logic is not in this crate (the terminal bridge, sandboxed exec, path-scoped filesystem read) are declared by the composition root that wires them, using the same native builder.

Awareness, not permission. A descriptor only makes a capability describable; execution still flows through the consent/audit/breaker path. The usage.tier mirrors the verb’s conservative intent::verbs tier hint so a reader sees the gate it will hit.

Functions§

backend
A ToolSource::NativeBackend for the named backend. Convenience for declarations so each module names its own backend id once.
destructive
Destructive, non-idempotent annotations.
native
Build a native ToolDescriptor for (ns, action), pulling the description and tier from the canonical verbs vocabulary and layering the supplied usage guidance on top. The tier is filled from the verb hint when the caller leaves it unset. Shared by every backend declaration and by the composition root for the capabilities it owns directly.
native_capabilities
The registrar: collect every native capability this crate’s backends declare for the given config into one manifest. Each backend applies its own gate, so disabled backends contribute nothing. Pure (no I/O) so it can be unit-tested and so the composition root can both register it and snapshot it (baseline).
read_only
Read-only, idempotent annotations.
usage
Assemble reasoner-facing ToolUsage guidance. tier is left unset and filled from the verb hint by native.