interplane-mv
INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority.
Brought by drakestapleton
interplane-mv / spec / CROSSVEIL.md
| 1 | # Crossveil: the authority boundary contract |
| 2 | |
| 3 | > Nothing crosses the veil as authority merely because a model requested it. |
| 4 | |
| 5 | Crossveil is a contract, not a policy engine. A runtime adapter implements two callbacks: |
| 6 | |
| 7 | ``` |
| 8 | decide(capability_request, context) -> decision |
| 9 | execute(capability_request, decision, context) -> result // called only when decision == authorized |
| 10 | ``` |
| 11 | |
| 12 | `context` carries `trace_id`, `message_id`, `parent_id`, the model `Party`, and any runtime-local |
| 13 | session handle the adapter chose to attach. INTERPLANE passes it through untouched. |
| 14 | |
| 15 | Rules the pipeline enforces (and conformance tests): |
| 16 | |
| 17 | 1. `execute` is called only after `decide` returned `authorized` for that exact `capability_request`. |
| 18 | 2. The pipeline never fabricates, caches, upgrades or reuses a decision. Every request is decided. |
| 19 | 3. A decision with an unknown `decision` value is treated as `denied` (`unknown_decision`). |
| 20 | 4. `requires_approval` returns to the model as `requires_approval`; only a later runtime decision |
| 21 | that carries `approval.approval_id` minted by the runtime can turn it into `authorized`. Anything |
| 22 | a model puts in `arguments` or `extensions` is never read as approval. The later decision |
| 23 | arrives through a host-only continuation call (see below), never through the model's channel. |
| 24 | 5. Adapter exceptions in `decide` become `denied` with `runtime_unavailable`; in `execute` they become |
| 25 | `error` with `execution_error`. Fail closed. |
| 26 | 6. The adapter, not INTERPLANE, decides the trust class of the returned data |
| 27 | (`result.provenance.trust` and `result.provenance.content_kind`). Defaults when the adapter says |
| 28 | nothing: `tool_result` + `unknown` (fail closed; see Crossveil Trust below). |
| 29 | |
| 30 | ## Approval continuation (host-controlled) |
| 31 | |
| 32 | `requires_approval` is not the end of the road, but only the host can continue it. The pipeline |
| 33 | exposes `continue_approval` and `cancel_approval` to the host process; nothing a model produced |
| 34 | (`tool_request`, `arguments`, `extensions`, an envelope, free text) reaches them, and none of it is |
| 35 | read as a grant. The normative contract is in `CORE.md` (Approval continuation); the rules are: |
| 36 | |
| 37 | 1. **Correlation.** `trace_id` + `request_id` + the `approval_id` the runtime minted for that request |
| 38 | + the digest of the original `capability_request`. A continuation for changed arguments, another |
| 39 | capability, another request or an `approval_id` minted for something else is refused: the request |
| 40 | is DENIED and stays DENIED. The approval covers the exact effect that will run, not a class of |
| 41 | effects that sounds like it. |
| 42 | 2. **Expiry.** `approval.expires_at` as minted is checked against the host's clock. Expired is DENIED. |
| 43 | A null `expires_at` is not compared, so that approval has no time limit (CORE, continuation |
| 44 | check 5). |
| 45 | 3. **Catalog.** A runtime catalog that changed between pending and continuation is `stale_capability` |
| 46 | and DENIED. |
| 47 | 4. **Cancellation** by the host is DENIED and terminal. |
| 48 | 5. **Replay.** A second continuation of the same request, or of one that is no longer pending, is |
| 49 | refused and changes nothing. Continuation is a transition on the existing request, never a |
| 50 | re-admission, so `replayed_message` and `duplicate_request_id` stay on. A runtime's own |
| 51 | idempotency (a receipt ledger) is separate and is not used for this. |
| 52 | 6. **Restart.** Pending state is in memory. After a restart a pending request cannot be continued |
| 53 | (fail closed); the host starts a new request. |
| 54 | 7. `decide` is not called again at continuation, the pipeline still never builds an `authorized` |
| 55 | decision, and `execute` runs at most once per request. |
| 56 | |
| 57 | Evidence: cases A01 to A14 of `bench/PROTOCOL-0.3.md` (`conformance/fixtures/approval/`), identical |
| 58 | verdicts in the Rust reference runner and the retired Python one. |
| 59 | |
| 60 | ## State record |
| 61 | |
| 62 | Each request's lifecycle (see `CORE.md`) is recorded by the pipeline and exposed to the caller as |
| 63 | an `ObservedRecord`. It is a log, not a lock: the runtime remains free to keep its own ledger. |
| 64 | |
| 65 | ## Crossveil Trust |
| 66 | |
| 67 | Model-visible material carries two axes of provenance, both assigned by the runtime, never by the |
| 68 | model: |
| 69 | |
| 70 | | `content_kind` (what it is) | `trust` (how far the runtime trusts it) | |
| 71 | |---|---| |
| 72 | | runtime_instruction, user_request, model_generated, tool_result, workspace_content, memory, web_content, document, email, skill, external_provider, unknown | trusted_runtime, user_supplied, workspace_untrusted, external_untrusted, unknown | |
| 73 | |
| 74 | Trust metadata does not block anything by itself; it tells the runtime and the model adapter what |
| 75 | the material is so that a system instruction, a web page, a tool output, a memory hit and a model |
| 76 | proposal are never flattened into indistinguishable text. Rules: |
| 77 | |
| 78 | 1. Absent or unparseable trust is `unknown`, which receivers treat like `external_untrusted`. |
| 79 | Inability to determine trust is never converted into trust. |
| 80 | 2. Adapters set `result.provenance.content_kind` and `trust` on every result. Defaults when the |
| 81 | runtime says nothing (absent or null): `tool_result` + `unknown`. A `content_kind` string the |
| 82 | receiver does not recognize, or a non-string value, is `unknown`. A `trust` string it does not |
| 83 | recognize, or a non-string value, is `external_untrusted`. `trusted` is always derived from |
| 84 | `trust` (CORE.md) and an adapter-supplied `trusted` is never read, so unknown provenance never |
| 85 | becomes trusted by being serialized and read back (conformance cases 26 and 27). |
| 86 | 3. Results are rendered back to the model as data. The pipeline never parses tool-call markup inside |
| 87 | a result into a new intent (conformance cases 22 and 23 carry such markup as an injection probe). |
| 88 | 4. Odysseus's `metadata.trusted`/`source` and its `untrusted_context_message` map onto these axes. |
| 89 | Its `ResultIntegrity` maps explicitly: `workspace_untrusted` and `external_untrusted` carry over; |
| 90 | `system` (server-authored output) is `trusted_runtime` unless Odysseus's own |
| 91 | `tool_result_should_arm_gate` marks the result as carrying non-system content, then |
| 92 | `external_untrusted`. AIEN's aegis-runtime has no equivalent today and the adapter fills in |
| 93 | `unknown` honestly. |
| 94 | |
| 95 | 5. **InputRecord** (`input.schema.json`) names one piece of material placed in front of the model: |
| 96 | `input_id`, `content_kind`, `trust`, `source` (a `Party`: who handed the bytes to the context), |
| 97 | `origin` (a locator: file path, URL, memory record id, provider id or `runtime:<id>`, or a |
| 98 | digest-only form for sensitive locators), `content_digest`, `trace_id`, `parent_id` (the |
| 99 | `message_id` or `request_id` that produced it; `null` for host-registered inputs) and |
| 100 | `derived_from` (`input_id`s it was computed from; may be empty). The runtime assigns `trust`. |
| 101 | Content the model itself generated is `content_kind = model_generated` with trust |
| 102 | `external_untrusted`; the pipeline never records it on its own (rule 7). The nine source classes are workspace, web, memory, document, skill |
| 103 | (including tool descriptions), tool output, external provider, runtime-generated and user |
| 104 | request; `conformance/fixtures/input/` holds one schema-valid example of each. |
| 105 | 6. **Exposure** is the optional `provenance.exposure` on a `tool_request`: |
| 106 | `{inputs: [input_id...], floor: TrustLevel}`, where `floor` is the least trusted level among the |
| 107 | inputs visible to the model when it produced the turn. Order: `trusted_runtime` > |
| 108 | `user_supplied` > `workspace_untrusted` > `external_untrusted`; `unknown` counts as |
| 109 | `external_untrusted`. The pipeline computes it from its own ledger; an `exposure` arriving inside |
| 110 | a model-produced or admitted envelope is discarded and recomputed, never read. Since 0.3 cut P3 |
| 111 | the pipeline computes it. Per trace it keeps a ledger of inputs: every result it renders back |
| 112 | to the model is recorded automatically (`parent_id` is the `request_id`, `trust` and |
| 113 | `content_kind` are the result's normalized provenance, `unknown` when it has none), and the |
| 114 | host adds any other input before a turn through a host-only registration call that model |
| 115 | output and envelopes cannot reach. All `tool_request`s of a turn, and the `CallContext` passed |
| 116 | to `decide` and `execute`, carry the ledger as it stood when the turn began. |
| 117 | A result with no classified body is recorded `unknown` and counts as `external_untrusted`, on |
| 118 | purpose; this covers results that were not executed (denied, requires_approval, not_found, |
| 119 | rejected, an unknown decision value, a decide fault) and executed `error` and `timed_out` |
| 120 | results (CORE.md, issue #57). Exposure fails |
| 121 | closed: an empty ledger, an input of unknown or unrecognized trust, and an input whose |
| 122 | `derived_from` names an id the ledger does not hold all count as `external_untrusted`. |
| 123 | 7. **Source classes.** The trust each class receives, and who records it. `Recorded by` is the |
| 124 | pipeline when it renders a result, otherwise the host through `register_input`. A class that |
| 125 | can originate outside the workspace is `external_untrusted`; where the runtime cannot tell, it |
| 126 | labels the weaker value (never the stronger). |
| 127 | |
| 128 | | Source class | `content_kind` | `trust` | Recorded by | Mock source | |
| 129 | |---|---|---|---|---| |
| 130 | | workspace | workspace_content | workspace_untrusted | host | file input (case 31) | |
| 131 | | web | web_content | external_untrusted | pipeline | `web_fetch` (32) | |
| 132 | | memory | memory | workspace_untrusted | pipeline | `recall_memory` (33) | |
| 133 | | document | document | external_untrusted | pipeline | `read_document` (34) | |
| 134 | | skill, tool description | skill | external_untrusted | host (descriptions), pipeline (`load_skill`) | `load_skill`, description input (35) | |
| 135 | | tool output | tool_result | adapter's value, `unknown` if absent | pipeline | `list_dir` (36) | |
| 136 | | external provider | external_provider | external_untrusted | pipeline | `call_provider` (37) | |
| 137 | | runtime-generated | runtime_instruction | trusted_runtime | host | system prompt (38) | |
| 138 | | user request | user_request | user_supplied | host | operator input (39) | |
| 139 | | model-generated | model_generated | external_untrusted | host | earlier model text (40) | |
| 140 | |
| 141 | Skills and tool descriptions are `external_untrusted`, not `workspace_untrusted` (P2's example |
| 142 | said otherwise): a third-party skill or a tool server's description is authored outside the |
| 143 | workspace and is read by the model as instruction-shaped text. A host that knows a skill file |
| 144 | was written inside the workspace may register it as `workspace_untrusted`; the mock cannot tell, |
| 145 | so it labels `external_untrusted`. Memory stays `workspace_untrusted` because the runtime wrote |
| 146 | it; a memory entry distilled from external content names that content in `derived_from`. |
| 147 | The pipeline does not record the model's own prior text. When a host feeds earlier model output |
| 148 | back into the context it registers it as `model_generated` / `external_untrusted` (`parent_id` |
| 149 | null, `derived_from` naming what the model had seen if known). Recording it automatically would |
| 150 | make the floor of every multi-turn trace `external_untrusted` by construction and hide real |
| 151 | exposure changes; an unregistered model turn is a host omission, visible as a ledger that lacks |
| 152 | it (case 40). |
| 153 | |
| 154 | Stage names used by this spec and their decision detail: INVALID is `REJECTED` with decision |
| 155 | `invalid`; NOT_FOUND is `REJECTED` with decision `not_found`. A `capability_request` whose |
| 156 | `mapping.catalog_digest` differs from the runtime's live catalog digest is rejected with |
| 157 | `stale_capability` before the authority callback is invoked. |
| 158 | |
| 159 | ## Mapping to the two real runtimes |
| 160 | |
| 161 | | INTERPLANE decision | Odysseus (2992bf6) | AIEN | |
| 162 | |---|---|---| |
| 163 | | `authorized` | `ToolGateDecision(allowed=True)` and policy not blocking | aien-cli `SafetyDecision::Allow`; aegis `pre_dispatch_check` Ok | |
| 164 | | `denied` | policy `blocks()` / `NON_ADMIN_BLOCKED_TOOLS` / delegated-credential refusal | `SafetyDecision::Deny(reason)`; aegis `Err(reason)`; `DoctrineDecision::Deny` | |
| 165 | | `requires_approval` | `ToolGateDecision(allowed=False)` + sealed `PendingToolApproval` | `SafetyDecision::AskUser(prompt)`; `DoctrineDecision::RequireApproval` | |
| 166 | | `constraints` on authorized | n/a | `DoctrineDecision::AllowRestricted(list)` | |
| 167 | | `not_found` | name not in `TOOL_TAGS` / `_MCP_TOOL_MAP` | skill not in `ALLOWED_SKILLS` / registry | |
| 168 | | `invalid` | `function_call_to_tool_block` rejection | aegis "args must be a JSON object" | |
| 169 | |
| 170 | `runtime_state` carries the native detail (`odysseus.tool_gate`, `aien.safety_decision`, |
| 171 | `aien.doctrine_decision`) so nothing is lost in translation. |