interplane-mv
INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority.
Brought by drakestapleton
interplane-mv / spec / CROSSAXIS.md
| 1 | # CrossAxis: capability coordinates and selection |
| 2 | |
| 3 | CrossAxis answers "which runtime capability is this canonical tool?" and "which capabilities |
| 4 | should this model see for this request?". It never answers "may the model run it?". |
| 5 | |
| 6 | ## Mapping (v0.1, minimal) |
| 7 | |
| 8 | A `MappingTable { runtime, table_version, rules[] }` with rules of two kinds: |
| 9 | |
| 10 | - `alias`: canonical `{namespace, name}` -> runtime capability name (+ optional argument renames). |
| 11 | - `passthrough`: bare native name -> itself, only for names present in the runtime catalog. |
| 12 | |
| 13 | Lookup is exact and deterministic. No fuzzy matching, no "dangerous guess": an unmapped name is |
| 14 | `unknown_capability` and never reaches the runtime. Tables are data (JSON), versioned, inspectable |
| 15 | and tested; the two real adapters each ship one. |
| 16 | |
| 17 | Argument renames are explicit per rule (`{"from": "path", "to": "file_path"}`). Type coercion |
| 18 | against the capability's parameter schema (strings from the qwen35 dialect into integers/booleans |
| 19 | the schema declares) happens here, using the catalog's `parameters`, and is recorded as |
| 20 | `mapping.coerced = [keys]`. |
| 21 | |
| 22 | ## CrossAxis Select (v0.1) |
| 23 | |
| 24 | Input: a runtime `catalog`, a list of requested domains, a `max_capabilities`, an `always_include` |
| 25 | list. Output: a `selection` receipt and the selected `CapabilityDescriptor[]` for Lenshift to render. |
| 26 | |
| 27 | Selector `domain_match` version 1: capabilities named in `always_include` are selected first (rule id |
| 28 | `always_include`, in catalog order, never truncated); then capabilities with any domain in the |
| 29 | requested set are selected sorted by name (rule id `domain:<matched domain>`); capabilities with no |
| 30 | domains are excluded with `no_domains`, the rest with `domain_mismatch`; when the total exceeds |
| 31 | `max_capabilities`, domain-selected entries are dropped from the end (sorted by name) with reason |
| 32 | `max_capabilities`. Deterministic by construction. |
| 33 | |
| 34 | Domain resolution (what the user asked -> requested domains) is **not** in v0.1 Core; the reference |
| 35 | runner takes domains as input. Selecting domains with a classifier or the model itself is a runtime |
| 36 | or bench concern; the receipt records whatever was requested. |
| 37 | |
| 38 | The `measure` block is the before/after receipt; see Measure below. |
| 39 | |
| 40 | Why this is the first killer feature: both real runtimes dump every tool schema into context |
| 41 | (Odysseus ~60 function schemas; AIEN CLI a prose list), and small local models get buried. Select |
| 42 | is a receipt-producing, deterministic subset. It grants nothing: an excluded capability is simply |
| 43 | not rendered, and an included one still crosses Crossveil. |
| 44 | |
| 45 | ## Measure (v0.2) |
| 46 | |
| 47 | `selection.measure` is additive; the 0.1 fields (`full_count`, `selected_count`, |
| 48 | `full_rendered_bytes`, `selected_rendered_bytes`) keep their meaning. `full_tokens`, |
| 49 | `selected_tokens` and `tokenizer` are deprecated and are no longer written; readers must still |
| 50 | accept them. |
| 51 | |
| 52 | ``` |
| 53 | measure: { |
| 54 | rendered_bytes: {full, selected}, // always present |
| 55 | tokens?: { |
| 56 | unit, // bytes | tokens_model_reported | tokens_endpoint_tokenizer | tokens_estimated |
| 57 | source, // free text: "usage.prompt_tokens max_tokens=1 differential", |
| 58 | // "llama.cpp /tokenize", "estimator v1 ceil(utf8_bytes/4)" |
| 59 | base_context, // prompt size of system + user, no tools |
| 60 | tool_schema: {full, selected}, |
| 61 | first_turn_prompt: {full, selected}, // system + user + tools |
| 62 | all_rounds_prompt?: {full, selected}, // bench total over the whole task |
| 63 | completion?: {full, selected} // bench total |
| 64 | } |
| 65 | } |
| 66 | ``` |
| 67 | |
| 68 | **Bytes are wire bytes.** `rendered_bytes` is the UTF-8 length of the canonical JSON (RFC 8785) of |
| 69 | the `tools` array produced by the renderer, which must be the renderer whose output is sent |
| 70 | unchanged (`openai_tools_renderer` for OpenAI-style endpoints: `{"type":"function","function": |
| 71 | {name, description, parameters}}`). A sender that serializes with another JSON writer must say so |
| 72 | in `source`; byte counts then are not comparable. |
| 73 | |
| 74 | **Unit discipline.** Every number inside one `tokens` block is in the block's single `unit`. A |
| 75 | block never mixes units; a bench that has two kinds of counts writes two runs, not one block. |
| 76 | `bytes` is the unit of `BytesOnly` (canonical-JSON bytes of messages plus tools); it exists so a |
| 77 | no-tokenizer run still has the same shape. `tokens_estimated` is always an estimate and is labelled |
| 78 | so by its unit; it must not be compared with measured units. |
| 79 | |
| 80 | **Differential rule.** `first_turn_prompt = count(system+user+tools)`, `base_context = |
| 81 | count(system+user)`, `tool_schema = first_turn_prompt - base_context` (clamped at 0), for |
| 82 | `full` and `selected` alike. Under `tokens_model_reported` the two counts are |
| 83 | `usage.prompt_tokens` of two requests with `max_tokens=1` to the same endpoint with the same |
| 84 | model, system and user messages; the second adds the rendered tools and nothing else. Under |
| 85 | `tokens_endpoint_tokenizer` they are the tokenizer's counts of the same two request bodies. |
| 86 | |
| 87 | **TokenCounter.** Core is stdlib-only and offline. It defines the interface and two offline |
| 88 | counters; live counters (model-reported, endpoint tokenizer) are implemented by the bench runner |
| 89 | against this interface and Core only assembles the receipt. |
| 90 | |
| 91 | - Rust: `trait TokenCounter { unit(), source(), count_prompt(&Value, Option<&Value>) -> u64 }`. |
| 92 | - `BytesOnly`: `len(jcs(messages)) + len(jcs(tools))` in UTF-8 bytes (tools term absent for `None`). |
| 93 | - `EstimatedTokens` (estimator v1): for a JSON value `v`, `est(v) = ceil(len(utf8(jcs(v))) / 4)`; |
| 94 | `count_prompt = est(messages) + est(tools)` (second term absent for `None`). |
| 95 | `source = "estimator v1 ceil(utf8_bytes/4)"`. |
| 96 | - `all_rounds_prompt` and `completion` are totals the bench measured in the block's unit; Core |
| 97 | validates shape and non-negativity only. |
| 98 | |
| 99 | ## Bounded expansion (v0.2) |
| 100 | |
| 101 | Expansion is an evidence-based, bounded widening of a selection on top of `domain_match` v1. It |
| 102 | is not a semantic router: Core never guesses what the model "meant". It only reacts to evidence. |
| 103 | **Expansion never touches authority.** It changes which descriptors Lenshift renders and nothing |
| 104 | else: every call, expanded-in or not, still crosses Crossveil, where the runtime decides. A |
| 105 | capability added by expansion that the runtime denies is `denied` exactly as before (conformance |
| 106 | case 24). |
| 107 | |
| 108 | `expand(selection, catalog, evidence, max_expansions?, max_added_per_expansion?) -> selection'` |
| 109 | is pure and deterministic: the same catalog, selection and evidence give byte-identical |
| 110 | `selection'`. The input is not modified. If `selection.catalog_digest` is not the catalog's digest |
| 111 | the call fails (nothing is recorded). |
| 112 | |
| 113 | Evidence (a JSON object; `evidence_digest` is its JCS digest): |
| 114 | |
| 115 | 1. `{"kind":"requested_excluded","name":N,"include_domain_siblings"?:bool}`. The model called a |
| 116 | capability that exists in the full catalog but was excluded from the current selection |
| 117 | (observable as `unknown_capability` at the selected view). Candidates: `N`, then, only when |
| 118 | `include_domain_siblings` is true, every other capability sharing a domain with `N`, sorted by |
| 119 | name. |
| 120 | 2. `{"kind":"discovery_hit","query"?:Q,"names":[..]}`. `names` is the output of `discover`. |
| 121 | Candidates: `names` in the given order, duplicates dropped. |
| 122 | |
| 123 | `discover(catalog, selection, query, limit=8) -> [name]` is pure: ASCII case-insensitive |
| 124 | substring match of `query` against the name or description of EXCLUDED capabilities (excluded |
| 125 | with reason `runtime_disabled` are never offered), sorted by name, at most `limit`; an empty query |
| 126 | gives `[]`. A runtime or bench may expose `discover` to the model as an always-included read-only |
| 127 | tool; Core defines no such tool in any catalog. |
| 128 | |
| 129 | Bounds: `max_expansions` (default 2) and `max_added_per_expansion` (default 8), always within the |
| 130 | selector's `max_capabilities`. The effective bounds are recorded in `selector.expansion` |
| 131 | `{max_expansions, max_added_per_expansion}`; once recorded they win over later arguments, so the |
| 132 | receipt alone determines the result. |
| 133 | |
| 134 | Each candidate is checked in this order and the first failing check is its refusal reason: |
| 135 | `not_in_catalog`, `already_selected`, `runtime_disabled`, `max_expansions` (rounds that added |
| 136 | something already equal `max_expansions`), `max_added_per_expansion`, `max_capabilities` |
| 137 | (selected plus added so far already equal `max_capabilities`). Pinned (`always_include`) entries |
| 138 | may already exceed `max_capabilities`; expansion then adds nothing. |
| 139 | |
| 140 | Every call appends `{round, reason, evidence_digest, added[], refused[{name, reason}]}` to |
| 141 | `selection.expansions[]`, including a call that adds nothing: `round` is the 1-based position in |
| 142 | that list (refused rounds are numbered but do not count toward `max_expansions`). `reason` is the |
| 143 | evidence kind. Added entries are appended to `selected` (rule id `expansion:<round>`, in candidate |
| 144 | order) and removed from `excluded`; the stale `measure` is dropped (the caller measures again). |
| 145 | `selection_digest` is the JCS digest of the selection with `selection_digest` and `measure` |
| 146 | removed; `expand` sets `parent_digest` to that digest of its input and `selection_digest` on its |
| 147 | output. `select` never writes a digest. |
| 148 | |
| 149 | Receipt normalization (every implementation): optional fields are omitted when empty (`always_include`, |
| 150 | `selected[].domains`, `selector.max_capabilities` when null). |
| 151 | |
| 152 | Reference API (Rust, `interplane_crossaxis`): `measure(selection, catalog, selected, render)`, |
| 153 | `measure_tokens(selection, catalog, selected, render, counted)` (`counted`: a `TokenCounter`, the |
| 154 | messages and `BenchTotals`), `BytesOnly`, `EstimatedTokens`, `openai_tools_renderer`, |
| 155 | `discover(catalog, selection, query, limit)`, |
| 156 | `expand(selection, catalog, evidence, max_expansions, max_added_per_expansion)` (`None` takes the |
| 157 | defaults), `selection_digest(selection)`. |
| 158 | |
| 159 | ## Additive hardware domain (L558) |
| 160 | |
| 161 | The initial `hardware` namespace uses the same `MappingTable`, `Catalog` and |
| 162 | `CapabilityRequest` types. Its seeded-Omega runnable mapper, typed framing, |
| 163 | profile bounds and qualification limits are specified in |
| 164 | [`omega/hardware/README.md`](../omega/hardware/README.md). |
| 165 | Host discovery is distinct from model intent and conveys no permission; |
| 166 | Crossveil and privileged runtime authorization remain required. Physical targets |
| 167 | are NOT_TESTED; this domain does not claim a general hardware abstraction layer. |