Expand description
§Brain Intent — Standardized Intent Token (SIT) schema
Provides the universal envelope (IntentToken) that classifiers emit and
routers resolve into concrete tool invocations. The schema is wire-stable:
the SCHEMA constant identifies the version of the envelope shape.
This crate is intentionally dependency-light — it defines data types and trait signatures only. Concrete classifier, router, registry and index implementations live in higher-level crates that compose this schema.
Modules§
- sanitization
- Treat MCP tool descriptions and tool outputs (and any other attacker-controllable text that flows into an LLM prompt) as untrusted input.
- verbs
- Canonical verb vocabulary for Brain’s capability kernel.
Structs§
- Backend
Id - Opaque identifier for a native action backend (
memory,web_search, …). Kept as a newtype to keepToolRouteself-describing without forcing the schema crate to know about every backend in the workspace. - Default
Intent Router - Default
IntentRouterthat scores registered tools against a token and returns the highest-ranked candidate’s route. Pure-data routing — no embeddings (the semanticCapabilityIndexlands in a separate slice); this router relies on verb match plus capability overlap. - InMemory
Tool Registry - In-memory
ToolRegistrybacked by aRwLock<HashMap>. The default registry the MCP host and native backends register into on mount; the router queries this when resolving anIntentToken. - Intent
Token - The universal envelope that flows from a classifier through a router into
an executor.
verb+objectdescribe what the caller wants;required_capabilitiesandconstraintsdescribe under what conditions the action may run;provenancerecords who asked. - Object
- Scored
Tool - Tool
Annotations - Tool
Descriptor - Tool
Usage - Reasoner-facing usage guidance for a capability. This is
what lets a planner or the chat reasoner choose the right tool instead
of guessing from a one-line description: when it applies, when it does
not, what must be true first, roughly what it costs, and the safety
tierthe action carries (awareness ≠ permission — execution is still gated by the consent/audit path; this string is purely descriptive). - Verb
Enums§
Constants§
- SCHEMA
- Wire identifier for the current SIT envelope. Bumped on any
breaking change to
IntentToken.
Traits§
- Breaker
Check - Per-tool circuit-breaker snapshot. The router calls this for every
candidate during
IntentRouter::resolve; tools whose breaker isOpenare excluded from scoring so a recently-failing tool can’t be chosen until the cooldown elapses. The concrete breaker lives inbrainos-resilience; the trait keeps the schema crate independent of the resilience layer. - Capability
Index - Semantic top-k search over the registered tools. The default scoring strategy combines verb match, capability overlap, and embedding similarity against the token’s surface form.
- Intent
Router - Resolves a token into a concrete invocation target. Implementations score
candidates from a
CapabilityIndexand return the best route. - Tool
Registry - Authoritative catalog of every tool the host can dispatch to. The MCP host and native backends register here on mount; the router queries here when resolving a token.