Chio/Docs

LearnSystem Architecture

Architecture

The kernel mediates agent actions by checking mandates, metering cost, and signing a receipt before a tool runs.

The Five Components

Chio governs the execution stage of autonomous commerce, where an agent's mandate determines which action the protocol permits. Autonomous Commerce traces the broader process. This page describes the five components and their trust boundaries.

Agent (Untrusted)

An agent is an LLM-powered process that uses tools. The kernel treats agents as untrusted. An agent presents a valid capability token with each request; it has no ambient authority.

Kernel (Trusted Compute Base)

The kernel is the trusted mediator between agents and tool servers. It processes each invocation request and:

  • Validates capability tokens (signature, expiry, scope)
  • Runs the guard pipeline against the request
  • Enforces economic constraints (budgets, metering)
  • Dispatches allowed calls to the appropriate tool server
  • Signs and commits a receipt for each mediated decision

Trusted computing base

The kernel is the trusted compute base. If the kernel is compromised, the guarantees documented for mediated calls no longer apply. Keep the trusted computing base small, audited, and isolated. Rust addresses memory-safety risks but does not establish correctness by itself.

Tool Server (Sandboxed)

Tool servers perform work such as reading files, querying databases, calling APIs. They can be native Chio tool servers or existing MCP servers wrapped by the Chio proxy. Tool servers are sandboxed: they only receive calls that have already passed the kernel's validation and guard pipeline.

Capability Authority

The Capability Authority issues and revokes capability tokens: it defines the tools, arguments, duration, and budget available to an agent. The trust control plane handles issuance and revocation alongside identity, credentials, federation, and governance. A federated issuer mints a scoped token with chio trust federated-issue. The system owner or orchestrator typically operates the authority. The kernel enforces the tokens it signs and is the trusted compute base.

Receipt Log (Integrity-Verified)

The receipt log is an append-only store of signed receipts. Each receipt records a single kernel decision (allow or deny), including the full request, the guard evaluation results, timing, and a cryptographic signature. Receipts are cryptographically signed, making tampering detectable.

System groups

The five components enforce a call. The wider system groups work around the kernel. The runtime kernel is the trusted mediator. The trust group handles identity, credentials, federation, governance, capability issuance, and revocation. The economy group handles metering, budgets, and settlement. These groups use kernel-signed receipts as their records of decisions.

The workspace contains more than 100 crates in eleven groups:

GroupWhat lives there
coreShared types (capabilities, receipts, canonical JSON, signing), errors, and the adversarial suite
kernelCapability validation, the guard pipeline, receipt signing, and the runtime and platform variants
guardsNative, data-layer, WASM, and external guards, plus HushSpec policy and the guard registry
protocolProtocol and provider edges (MCP, A2A, OpenAPI, Tower, Envoy) that turn ecosystems into governed tool servers
economyMetering, budgets, pricing, markets, credit, settlement, and anchoring
trustdid:chio, credentials and passports, federation, governance, reputation, attestation, and model cards
observabilitySIEM export, lineage, log redaction, metrics, and receipt export
platformControl plane, stores, signed manifests, config, workflow, and HTTP and session primitives
productsThe chio CLI and the packaged products built on the kernel
sdkGuard-authoring SDK, FFI bindings, and receipt-evaluation helpers
toolingConformance suite, spec codegen and validation, LSP, and test support

Inside the Kernel

This page distinguishes a pure core, a shell that adapts external inputs, and operational code for I/O, storage, and transport. Lean theorem checking covers stated properties of a bounded model of selected pure-core symbols; it does not cover the full runtime.

Trusted computing base and proof boundary

The diagram separates the core, shell entry, and operational code. The inner components have a smaller trusted code base.

Kernel verified core and operational codeoperational shell · chio-kernel runtimekernel shell entry · chio-kernelpure verified core · chio-kernel-corechio_kernel_core::capability_verify — pure issuer-trust, signature, and time-window checks over one in-memory capabilitycapability_verifysig · issuer · timechio_kernel_core::scope::resolve_matching_grants — fail-closed portable scope matching over request arguments onlyresolve_matching_grantsportable scopechio_kernel_core::evaluate::evaluate — pure authorization path composing capability verification, subject binding, scope match, and sync guardsevaluateauth compositionchio_kernel_core::receipts::sign_receipt — pure receipt-signing step over an already-constructed receipt bodysign_receiptcanonical JSON · Ed25519ChioKernel::evaluate_portable_verdict — direct delegation into chio_kernel_core::evaluate with trusted-issuer and portable-guard wiringevaluate_portable_verdictshell delegatorChioKernel::build_and_sign_receipt — direct delegation into chio_kernel_core::sign_receipt once the shell has assembled the receipt bodybuild_and_sign_receiptassembles receipt bodyRuns async guards outside the pure core. Their synchronous portable decisions are passed into evaluate as data.Guard pipeline runnerasync · side-effectingRevocation-store lookups and delegation-store lineage joins — explicitly excluded from the verified-core boundary.Revocation · lineagestore lookupsReceipt persistence, checkpoint publication, and clustered trust-control — outside the verified core; affects availability, not safety.Receipt persistenceSQLite store · checkpointsBudget mutation, payment authorization, and any metering state transition — excluded from the verified-core boundary.Budget · meteringauthorize · commit · reconcileDPoP verification, nonce replay caches, hosted/session admission, tool subprocess and network effects — all operational-shell concerns.Transport · dispatchDPoP · hosted · subprocessdelegatedelegateLean 4 · 5 theorems · P1 has 1 outstanding `sorry`Lean-proven · pure functions · no I/Onot in TCB · affects availability, not safetythin API · wires trusted inputs into the pure corechio-core · chio-core-types — shared types: canonical JSON, capabilities, scopes, grants, receiptsinside out: narrower trust, stronger guaranteesdashed = shell delegates into pure core
The innermost ring contains the pure authorization and receipt-signing code proved in Lean. The surrounding code handles transport, persistence, metering, and dispatch; it affects availability but is outside the safety TCB.
  • Pure core: selected pure symbols in chio-kernel-core shown in the Lean map below (capability verification, grant resolution, evaluation, receipt signing, and scope subset) have no I/O. The theorem families below cover their stated properties over the claim-registry bounded model.
  • Kernel shell entry: an interface on ChioKernel that assembles inputs and delegates into the pure core.
  • Operational shell: everything else, transport, dispatch, persistence, budget mutation, revocation. A fault here can deny service; it cannot silently widen authority.

Formal-claim boundary

If the bounded pure-core model satisfies its theorems and the shell preserves their preconditions, the modeled operational-shell faults cannot produce a forged allow receipt or an over-broad grant. The theorem claims do not establish this result for the full runtime.

Where the kernel actually runs

The kernel ships in four deployment configurations. The trust model is the same; the process boundary and transport differ.

Four kernel deployment modes1 · Embedded library (chio-kernel-core)2 · Native sidecar (chio-kernel)3 · Hosted MCP edge (chio-cli mcp serve-http)4 · Envoy ext_authz (chio-envoy-ext-authz)agent processAgent: host binary that links chio-kernel-core directlyAgenthost binaryKernel: chio-kernel-core, linked in; validates tokens and runs guards in-processKernelchio-kernel-coreTool Server: spawned subprocess, reached over stdio or a unix socketTool Serversubprocagent processkernel processtool processAgentisolatedKernel: chio-kernel running as a local co-processKernelchio-kernelTool Serverisolatedhosted edgeAgent: remote client authenticating to the hosted edgeAgentremote clientKernel: chio-cli mcp serve-http, hosted behind an HTTPS boundaryKernelserve-httpControl plane: trust-control APIs (issue / revoke / attest) attached to the kernelControlissue · revokeTool ServertenantedAgent: any HTTP client; unaware of the kernelAgentHTTP clientEnvoy: proxy on the data path, configured with an ext_authz filterEnvoyext_authz filterKernel: chio-envoy-ext-authz, serving CheckRequest gRPC off the sideKernelauthz svcTool Server: any HTTP API; protected without modificationTool ServerHTTP APIin-proc callsubproc / unix sockframed JSONdispatchHTTPS + DPoPtrust-ctldispatchrequestCheckRequestforwardminimum footprint · agent owns trustagent–kernel isolation · local receiptsremote session lifecycle · tenantedprotect arbitrary HTTP APIs · header mutationssame five trust roles · four physical shapespick per workload · trust model identical across modes
These deployments arrange the agent, kernel, tool server, capability authority, and receipt log differently. Their trust roles are the same.
  • Embedded library: link chio-kernel-core directly into the agent. Minimum footprint, but the agent owns the signing key. Good for single-tenant local deployments.
  • Native sidecar: run the kernel as a separate process, agents speak length-prefixed canonical JSON over a Unix socket or TCP. Process-level isolation between agent and kernel.
  • Hosted MCP edge: chio mcp serve-http exposes an MCP-compatible HTTP interface with remote session lifecycle and a control-plane API. Tenanted deployments.
  • Envoy ext_authz: run the kernel as an external authorization service for any HTTP API that Envoy fronts. Protects arbitrary upstream services with header mutations and structured verdicts.

Message Flow

A tool invocation follows the kernel's deterministic evaluation path.

Chio message flow: agent, kernel, tool serverkernel · internal stagesAgent: any LLM-powered process requesting a tool callAgentuntrustedChio Kernel: the trusted mediatorChio Kerneltrusted compute baseTool Server: the actual tool implementationTool ServersandboxedValidate tokensig · expiry · scopeGuard pipelinestateless + sessionEconomic checkbudget · meteringSign receiptappend-onlyAgentreceives responseChio Kernelreceipt committedTool Serverwork completeToolCallRequest + capability tokendispatch · if all passtool resultToolCallResponse + receiptdeterministic path · no shortcuts · no bypasssolid = cross-lane message · numbered pill = kernel stage
A tool call moves from the agent through four kernel stages to the tool server and back. Time flows from top to bottom.

The kernel evaluation stages in detail:

Stage 1: Token Validation

The kernel extracts the capability token from the request and validates:

  • Signature: the token was issued by a recognized Capability Authority
  • Expiry: the token has not expired (time-bounded by design)
  • Scope: the requested tool and arguments fall within the token's declared scope
  • Revocation: the token has not been revoked by the CA

If any check fails, the request is immediately denied. No further processing occurs.

Stage 2: Guard Pipeline

If the token is valid, the request enters the guard pipeline. The pipeline is composed of composable guard families covering filesystem, shell, network egress, tool access, secrets, patch integrity, prompt safety, threat intel, rate limiting, and agent-surface controls (computer use, browser automation, code execution, remote desktop):

GuardEnforcesExample
forbidden-pathBlocks access to specific file patternsDeny **/.env, **/*.pem
path-allowlistRestricts file access to declared rootsOnly allow ./workspace/**
shell-commandValidates or blocks shell command executionBlock rm -rf, allow ls
egress-allowlistControls outbound network accessOnly allow api.example.com:443
mcp-toolLimits which tools can be invokedAllow read_file, deny write_file
secret-leakScans arguments and results for secretsBlock API keys, tokens in args
patch-integrityValidates patch and diff safetyBlock dangerous file modifications
velocityRate-limits invocations per time windowMax 100 calls per 60 seconds
agent-velocitySession-aware rate limiting across agent activityThrottle a runaway agent loop
internal-networkSSRF defense against internal ranges and metadata endpointsBlock 169.254.169.254, RFC 1918 ranges
data-flowTracks data provenance and exfiltration paths across a sessionBlock reading a secret then writing it outbound

Guards are composable and independent. Each guard receives the full request context and returns an allow or deny verdict. The pipeline uses a conjunctive model: all guards must allow for the request to proceed.

Bounded Lean theorem coverage

Lean 4 checks five theorem families over the project claim-registry bounded model: P1 Capability Monotonicity (bounded Lean mechanization for attenuation over the verified-core model), P2 Revocation Completeness (bounded Lean proofs that revoked tokens and revoked presented ancestors cannot pass), P3 Fail-Closed Guarantee (bounded Lean proofs that the pure evaluator is total and fail-closed), P4 Symbolic receipt and checkpoint properties (symbolic Lean proofs plus runtime receipt-signing checks in Rust), and P5 Bounded delegation-chain structure (bounded structural delegation-chain theorems for the presented-chain model). P1 is discharged over the claim-registry bounded model; these theorems do not cover the full runtime.

The map below shows which Rust symbols each theorem constrains. The boundary is deliberately narrow: revocation lookups, budget mutation, DPoP verification, and tool dispatch stay in the operational shell until a later formal phase pulls them in.

rendering…
Five Lean theorem families and their Rust symbols. Code outside this map remains in the operational shell and is not formally proved here.

Merkle-committed receipt log

Receipts are Merkle-committed in batched checkpoints. Inclusion proofs allow any single receipt to be verified without replaying the full log, so auditors can spot-check without materializing the entire history.

Stage 3: Economic Check

After the guard pipeline, the kernel evaluates economic constraints. Each tool call has an associated cost, and the capability token carries a budget. The kernel verifies:

  • The token's remaining budget can cover the estimated cost
  • A durable pre-execution hold is placed before the tool runs, so an over-budget call is denied before anything executes
  • The cost is metered and reconciled against that hold

A tool that prices itself above the token's allowance is denied before it runs. A tool that misreports its cost receives a signed reconciliation receipt when it next settles. Finance and security use the same signed receipt format.

Stage 4: Receipt Signing

Regardless of outcome, the kernel produces a signed receipt. The receipt includes the original request, the decision (allow/deny), which guards passed or failed, timing information, and economic data. The receipt is signed with the kernel's private key and appended to the receipt log. The receipt outlives the kernel that signed it: a verifier years later needs only the public key and the canonical bytes.

receipt-example.json
{
  "id": "rcpt_a1b2c3d4e5f6",
  "timestamp": 1744537862,
  "capability_id": "cap_7f3a...e91d",
  "tool_server": "srv-files",
  "tool_name": "read_file",
  "action": {
    "parameters": {"path": "./workspace/README.md"},
    "parameter_hash": "sha256:a1b2c3d4..."
  },
  "decision": {"verdict": "allow"},
  "content_hash": "sha256:d7e8f9a0...",
  "policy_hash": "sha256:b5c6d7e8...",
  "evidence": [
    {"guard_name": "forbidden-path", "verdict": true},
    {"guard_name": "path-allowlist", "verdict": true},
    {"guard_name": "shell-command", "verdict": true},
    {"guard_name": "egress-allowlist", "verdict": true},
    {"guard_name": "mcp-tool", "verdict": true},
    {"guard_name": "secret-leak", "verdict": true},
    {"guard_name": "patch-integrity", "verdict": true},
    {"guard_name": "velocity", "verdict": true}
  ],
  "metadata": {
    "financial": {
      "grant_index": 0,
      "cost_charged": 1,
      "currency": "USD",
      "budget_remaining": 199,
      "budget_total": 200,
      "delegation_depth": 0,
      "root_budget_holder": "agent-research-bot",
      "settlement_status": "pending"
    }
  },
  "kernel_key": "9c7b3f1a2e8d4c6b...",
  "signature": "e5f6a7b8c9d0e1f2..."
}

After signing, the kernel persists the receipt, groups receipts into a Merkle checkpoint, can anchor it externally, and exports it to verifiers and SIEMs.

rendering…
A receipt's lifecycle: sign → persist → checkpoint → anchor → export. Each stage writes data used by later stages.

Fail-Closed Semantics

The kernel denies a call when an evaluation stage cannot establish an allow verdict.

Default deny

If anything goes wrong, invalid token, guard error, budget exhausted, network timeout, or internal exception, the request is denied. There is no fail-open path. Silence is denial.

The known failure modes converge on a signed deny receipt. The diagram traces ten modes from their evaluation stage to that result. The modeled paths do not bypass signing or produce an unsigned allow.

Chio fail-closed decision pathskernel stages (fail-closed conjunction)Incoming tool call request from the agentTool callagent → kernelCapability token validation: presence, signature, expiry, revocation, scopeToken validationsig · expiry · scopeGuard pipeline: any guard can short-circuit; guard panics are treated as deniesGuardsstateless → sessionEconomic check: remaining budget, per-call metering, rate accountingEconomicbudget · meteringDispatch stage: hand off to tool server, await result, observe kernel livenessDispatchtool server · resultSigned allow receipt: reached only when every stage passedSigned allow receiptdispatched · committedSigned deny receipt: the result for a failed kernel stageSigned deny receiptfail-closed · committedrequestpasspasspassall stages passno tokeninvalid signatureexpiredrevokedwrong scopeguard denyguard panicbudget exhaustedtool server timeoutkernel panicfunnel railevery deny → sinkno fail-open path · silence is denialsolid = happy path · dashed = deny branch
Kernel failures produce a signed deny receipt. If the kernel cannot complete the request, it does not dispatch the tool call.

A misconfigured kernel, crashed guard, network partition, or unavailable tool server produces a signed denial. The receipt log records the event for replay. Within this model, disruption causes a denial of service rather than a privilege escalation.


Zero Ambient Authority

A Capability Authority grants authority through signed, time-bounded, attenuable tokens. The full model is described in the Trust Model; in the wire format, that token looks like this:

zero-authority-example.yaml
# An agent with this capability can ONLY:
#   - Call read_file on server srv-files
#   - For the next 30 minutes
#   - Up to 50 invocations
#   - With a max cost of $0.10 per invocation

capability:
  id: cap_7f3a...e91d
  issuer: ca-prod-01
  subject: agent-research-bot
  issued_at: 1744536000
  expires_at: 1744537800
  scope:
    grants:
      - server_id: srv-files
        tool_name: read_file
        operations: [invoke]
        max_invocations: 50
        max_cost_per_invocation:
          units: 10
          currency: USD
  delegation_chain: []
  signature: "e5f6a7b8c9d0e1f2..."

Guard Pipeline Evaluation

The guard pipeline uses a conjunctive model: enabled guards must allow a request for it to proceed. Evaluation runs in a fixed order (cheapest first) and short-circuits on the first deny. For the per-guard reference, the authoring model, and custom-guard composition, see Guards.


Component Boundaries

The trust model depends on strict boundaries between components:

BoundaryMechanismGuarantee
Agent → KernelCapability tokensAgent cannot act without explicit authorization
Kernel → Tool ServerProcess isolation + sandboxingTool servers only receive pre-validated requests
Kernel → Receipt LogAppend-only + cryptographic signaturesReceipts cannot be modified after commit
CA → KernelSigned tokens + revocation listOnly the CA can grant or revoke authority
Agent → Tool ServerNo direct pathAll communication flows through the kernel

What an adversary would have to do

The table names the mechanisms. The diagram shows the effect of compromising each boundary and the guarantees affected.

Trust boundaries annotated with required adversary compromiseAgent: the untrusted LLM-driven process holding a capability tokenAgentuntrusted callerKernel: validates the token's signature, expiry, and scope before any dispatchKerneltoken validatorCrossing this boundary requires forging an Ed25519 signature from a trusted issuersig forgerywhat must failKernel: dispatches validated calls into an isolated tool server processKerneldispatcherTool Server: runs in its own OS process with fewer allowed system callsTool Serversandboxed workerCrossing this boundary requires breaking sandbox isolation or subverting the kernel's dispatch codesandbox escapewhat must failKernel: signs every decision with its Ed25519 key and appends to the logKernelreceipt signerReceipt Log: a tamper-evident chain; each entry references the previous hashReceipt Logappend-onlyCrossing this boundary requires exfiltrating the kernel's signing keykey theftwhat must failCapability Authority: mints tokens and publishes revocation lists consumed by the kernelCapability Authorityissuer · CAKernel: trusts the CA's public key and periodically syncs the revocation listKerneltoken verifierCrossing this boundary requires stealing the CA signing key or preventing the kernel from seeing the revocation listsync bypasswhat must failAgent: no protocol, port, or channel reaches the tool server directlyAgentuntrusted callerTool Server: reachable only through the kernel dispatch interfaceTool ServerunreachableCrossing this boundary requires subverting the model itself — a path the kernel does not exposekernel bypasswhat must failcapability tokenprocess isolation · sandboxappend-only · Ed25519 chainsigned tokens · revocation listnone — no direct pathattacker must forge Ed25519 issuer signatureattacker must escape sandbox or subvert dispatchattacker must compromise kernel signing keyattacker must steal CA key or bypass revocation syncattacker must bypass kernel entirelyfive boundaries · five classes of required compromisecompromise one boundary · guarantees degrade; compromise none · guarantees hold
Each boundary shows its protection mechanism, the required attacker capability, and the resulting failure class. The dashed fifth boundary has no direct agent-to-tool-server channel; bypassing it requires subverting the kernel model.

Key Hierarchy

Signed records depend on the keys that sign them. Production deployments separate five logical roles, each with a record type and rotation domain.

Key hierarchy and rotation domainslocal dev · one Ed25519 keypairVerifier Trust Bundle — the verification input; lists the issuer keys trusted for each record typeVerifier Trust Bundletrust root inputCapability Authority — signs capability tokens and delegated grants; represents authorization, not executionCapability Authorityissues capabilitiesKernel Signer — signs ChioReceipts and session compliance certificates; represents the execution environment that observed and enforced the sessionKernel Signersigns enforcement evidenceCheckpoint Publisher — signs checkpoint manifests and batch-root announcements; represents append-only publicationCheckpoint Publisherbatches · Merkle rootsHosted Control-Plane Identity — authenticates trust-control, ingestion, and operator APIs; it is not the signing trust rootHosted Control-Planeauthenticates APIsSigned trust bundle consumed by verifiers — aggregates trusted issuer keys + validity intervals + retirement metadataverifier trust bundleCapability tokens — signed, scoped grants presented by agents to the kernelcapability tokensChioReceipts and session compliance certificates — per-decision and per-session signed evidenceChioReceipt + session certsCheckpoint manifests and batch-root announcements — signed append-only publication recordscheckpoint manifestsAuthentication tokens for trust-control APIs, ingestion, and operator endpoints — transport authentication, not record signingtrust-control API authsignssignssignsauthenticatesconsumed by verifierincludedincludedincludedrotation: bundle-v2rotation: cap-v3rotation: kernel-v7rotation: ckpt-v4rotation: ctrl-v1dev collapses these three onto one keypair · production keeps them separatekey roles · logically distinct signersrecord types · signed or authenticated by each rolerotate per domain · retain retired keys for historical verificationhosted customer-controlled signing profile: kernel signer key stays under customer custodysolid = signs / authenticates · dashed = included in trust bundle
This diagram shows the five signing-key roles and the records they sign. Each role has its own rotation domain, so rotating the kernel signer does not invalidate historical capability tokens or checkpoint manifests. Local development may use one Ed25519 keypair; production uses separate keys.

Local development can collapse the three signer roles onto a single Ed25519 keypair, and the examples throughout these docs do. Production and hosted profiles separate them so a compromised kernel signer cannot mint capabilities, a compromised capability authority cannot forge receipts, and a compromised checkpoint publisher cannot do either. Rotation is per-domain: rotating the kernel signer does not invalidate outstanding capabilities, and rotating the capability authority does not invalidate past receipts.

Hosted customer-controlled signing

In hosted deployments, the runtime infrastructure may live with the provider, but the signing keys stay under customer custody, via HSM, KMS, or a dual-control signing sidecar. The full trust-model document, including rotation semantics, federated trust bundles, and verifier onboarding, lives in the CHIO protocol repository.

Next Steps

  • Autonomous Commerce: the autonomous-commerce process the kernel governs
  • Capabilities: deep dive into token structure, delegation, and revocation
  • Guards: detailed reference for every guard in the pipeline
  • Receipts: cryptographic receipt format and verification
  • Economics: budgets, metering, settlement, and underwriting