inf3r — system specification

docs/spec.md · wiki index

inf3r — system specification

Status: settled. Section 26 lists the decisions. How to read this: sections 1–7 give the idea. Sections 8–17 give the parts. Sections 18–24 give the rules, the build, and the work. Section 25 gives the current state of the repository. How to edit this: change the text in place. Keep the section numbers. If you add a decision, give it the next D number in section 26. If you remove a rule, say why in the same paragraph. Language: ASD-STE100 Simplified Technical English. Short sentences. One word has one meaning. Section 3 gives the definitions.


1. About this document

This document is the specification of inf3r. It is the only normative text. If the code and this document disagree, the code is wrong.

The document describes:


2. What inf3r is

inf3r is an inference engine. A client gives a model name and a capability. The engine finds the plugin for that pair and runs it.

inf3r runs as many model and target pairs as the machine can hold. A target is one hardware configuration. The pairs share devices through the ledger.

Every modality is supported. The modalities are text, embeddings, speech in and out, music, images, video, and typed decisions. A modality is data. It is not a separate entry point. A model declares what it can do. The engine routes on that declaration.

inf3r is not a model runner and not an integrator of other engines. It is a host for bundles.

A bundle is one directory. It holds one model, one target, and one engine. Generic engines compromise across architectures, quantisations, and hardware. A bundle makes one pair a bounded, self-contained unit of work so an author or an agent can write a faster engine built specifically for that model on that target. One copy of the directory is a complete answer for one pair, and one replacement of the engine changes nothing outside the directory.

A bundle author picks a model and a target. The author can write a dedicated engine for that pair, or bind a premade runtime as a cheap baseline inside the same directory — directly through a library FFI shim, or through the compatibility binder for an external binary or local HTTP runtime. The author can use any reference: llama.cpp, candle, ort, a vendored research repository, or hand-written CUDA. A reference is a reference, not a host dependency, and there is no shared per-engine layer in crates/. Wrapping a reference to set a baseline and replacing it with custom kernels are the same move inside one directory.

The host gives the bundle the shared infrastructure: a small protocol, a manifest format, a residency and ledger system, a shared host KV cache, a verification gate, and a benchmark harness. The host does not give the bundle a tensor abstraction, a kernel library, a runtime, or a required language.

inf3r distributes the host tooling, the protocol, the bundle contract, and the in-repo fixtures. It does not distribute model bundles, weights, engine images, or a registry of them. An end user creates a bundle under plugins/<model>/<target>/ and owns its engine, pin, image recipe, and deployment.

The engine is host independent. deploy.toml binds the plugins to one host. The same binaries run on a different host with a different deploy.toml. A rebuild is not necessary.


3. Words used in this document

WordMeaning
coreThe process inf3r-core. The core finds plugins, routes jobs, and controls devices.
webThe process inf3r-web. The web has HTTP, auth, SSE, and the adapters.
cliThe process inf3r. The cli gives operator commands.
bundleOne directory for one model on one target. It holds the engine, the manifests, and the model directory. The unit of work.
engineThe code inside a bundle that runs inference. An engine is authored or bound. The engine can be any language.
pluginThe process that a bundle becomes when the core starts it. Also the role on the wire.
targetOne hardware configuration. A target names the backend, the devices, and the memory.
modelOne set of weights and its behaviour. A model serves one name or more names.
pairOne model on one target. One bundle implements one pair.
jobOne task from a client. A job names one model and one capability.
partOne input item of a job. A part is text, image, audio, video, tokens, or JSON.
capabilityThe name of a task type. Examples are chat, embed, and stt.
vocabularyThe parts, channels, and parameters that one capability permits.
channelThe name of one output stream of a job.
eventOne status message about a job.
blobOne file in the blob store. A blob has a content address.
blob storeThe directory that holds blobs.
manifestThe files that describe a bundle, its engine, its target, and its models.
adapterWeb code that changes one API format into a job.
ledgerThe record of reserved bytes for each device.
reserveTo record bytes in the ledger before a model load.
unloadTo stop a model and free the device memory.
admitTo accept a job into a queue.
residencyThe rule that keeps a model on a device or removes it.
publishTo move a completed artifact file into the blob store.
goldenA recorded input and output pair. CI compares the new output with the recorded output.

Abbreviations:


4. The tree

This is the repository tree. A * marks a directory that is empty today. A planned mark names a file or crate that the spec needs and the tree does not have.

inf3r/
├── Cargo.toml                workspace. members = crates/*/*; a bundle is its own
│                             workspace (D19).
├── ops/build.sh              build the engine and every bundle into one target.
├── Cargo.lock                exact dependency pins.
├── rust-toolchain.toml       Rust 1.99.1, profile minimal, rustfmt and clippy.
├── deploy.toml               the bindings for each host. Not the code.
├── .gitignore                /target, dist, build, venv, and f0rge runtime output.
├── .stignore                 sync exclusions. Same set as .gitignore.
│
├── crates/                   all engine code. No model names. No model code.
│   ├── edge/                 the boundary with the outside world.
│   │   ├── api/              wire JSON and SSE. Native types plus the adapters.
│   │   ├── bind/             the declarative binder for a bound engine.
│   │   ├── cli/              operator commands. binary `inf3r`.
│   │   ├── proto/            the six nouns, framing, codec, descriptors, credit.
│   │   ├── sdk/              the plugin traits and serve().
│   │   └── server/           HTTP, auth, and the request path. binary `inf3r-web`.
│   │
│   ├── state/                what the machine is and what it has room for.
│   │   ├── catalog/          model file to checkpoint and capability list.
│   │   ├── host/             probe of devices, memory, architecture, and driver.
│   │   ├── ledger/           byte reservations for each device.
│   │   ├── blobs/            content store and LRU.
│   │   └── bundle/           the bundle anatomy, the manifest, and the digest.
│   │
│   ├── run/                  what is running and why.
│   │   ├── core/             discovery, routing, admission, residency. (planned)
│   │   ├── sched/            queues, deadlines, eviction, switching.
│   │   └── supervisor/       start, drain, swap, restart, stop.
│   │
│   ├── format/               four data vocabularies. No inference types.
│   │   ├── text/             token, tokenizer, template, stop set, sampling.
│   │   ├── audio/            pcm, rate, channels, transcript, mel, vad, wav.
│   │   ├── image/            frame, pixel format, colour, tile, png.
│   │   └── video/            timebase, clip, container.
│   │
│   └── files/                two weight readers and one hash. Leaves.
│       ├── gguf/             GGUF: metadata, tensor index, bounded window.
│       ├── safetensors/      safetensors reader.
│       └── sha256/           the one streaming SHA-256.
│
├── plugins/                  operator bundles and in-repo fixtures. Section 5.
├── goldens/                  * engine goldens and the capability-shape goldens.
├── docker/                   * image build. Core and web in one image.
│
├── spec/
│   ├── schema.md             the f0rge file format. Copied from the template.
│   ├── protocol.cddl         the machine grammar of the peer protocol.
│   └── fixtures/             the f0rge frontmatter goldens.
│
└── .f0rge/                   the forge. All work and all docs.
    ├── ci/
    │   ├── ci.env            runner: local
    │   ├── README.md          the step table
    │   └── steps/            00_tools.sh, 01_fmt.sh, ... 11_compose.sh
    ├── wiki/
    │   ├── docs/             this file, the index, the protocol, ops, and proposals.
    │   ├── research/         * notes.
    │   └── experiments/      * measurements.
    ├── issues/               * one directory for each issue.
    ├── prs/                  * one directory for each pr.
    ├── tasks/                * one file for each task.
    ├── merges/               * one record for each CI-gated merge.
    ├── releases/             * one file for each release. build/ and out/.
    ├── labels.md             []
    └── milestones.md         []

Two rules about the tree:

  1. The core does not contain HTTP code, auth code, or model vocabulary.
  2. The web does not contain scheduling code, residency code, or device code.

5. The bundle tree

A bundle is a directory. One bundle is one model on one target. The path is the bundle id. The core does not make the name. The layout below is the bundle contract. It is not a convention. CI refuses a directory that does not have it. Requirement R31.

plugins/<model>/<target>/
├── bundle.toml               the bundle manifest. Id, model, target, engine kind,
│                             files, and digest.
├── BUNDLE.md                 the card. Four header lines and the command that
│                             runs the bundle.
├── target.toml               the hardware profile that the bundle was built for.
├── models/
│   ├── <served-name>.toml    one file for each name that the bundle serves.
│   └── <alias>.toml          an alias is a second name for one model.
├── model/                    the weights. Mounted by the operator. Ignored by git.
├── engine/                   the runtime, when the bundle binds one. A README when
│                             the bundle authors its engine.
├── goldens/
│   ├── chat.basic.json       one recorded request and the output it owes.
│   └── <case>.json           one file for each recorded case.
├── src/                      the entry point. The authored engine, an FFI
│                             shim, or one line that calls the binder.
├── Cargo.toml                the package. It is its own workspace (D19).
├── Cargo.lock                the bundle's own dependency pin.
├── Dockerfile                optional. The bundle's own container image recipe.
└── README.md                 optional. The longer page for this bundle.

Five parts make a directory a bundle: bundle.toml, BUNDLE.md, target.toml, model/, and engine/. A directory without them is not a bundle. The shape check and inf3r bundle verify both refuse it. Requirement R31.

The repository carries the contract, the host tooling, and the fixtures. A real model bundle is end-user content: the operator chooses the model, target, engine, pin, and image recipe. The fixture names in this section are labelled as fixtures and do not describe a release catalogue.

The manifest is one key on one line. The tree has one parser and no TOML dependency.

# bundle.toml — an authored bundle.
id      = "mock/x64-cpu"
model   = "mock"
target  = "cpu"
summary = "the conformance bundle"
engine  = "authored"
binary  = "inf3r-mock-x64-cpu"
files   = "target.toml,models/mock.toml,BUNDLE.md"
sha256  = "..."

# bundle.toml — an illustrative bound bundle. The names are the operator's.
id      = "example/gpu"
model   = "example"
target  = "gpu"
summary = "a bound engine on two cards"
engine  = "http"
entry   = "engine/runtime"
args    = ["--host", "127.0.0.1", "--port", "{port}", "--model", "{model}"]
# worker = "jsonl"    # only for engine = "binary": one resident process
binary  = "inf3r-example-gpu"
files   = "target.toml,models/example.toml,BUNDLE.md"
sha256  = "..."

engine is authored, binary, http, or library. authored has no entry: the entry point is the engine. The other kinds name entry, and the binder starts it or connects to it. worker = "jsonl" is optional and only valid with engine = "binary": the entry stays resident, reads one JSON request per line, and writes event lines until done or error. Without it a binary entry is one job per process. args is optional and uses {model} for the first granted weight, {weights} for every granted weight in grant order, {weightN} for one of them, and {port}. args is a space-separated string or an inline array of quoted strings. A quoted word keeps its spaces. In the string form, a backslash escapes a quote. binary is the package binary at the bundle root. files is the comma-separated list that the digest covers, below the bundle root.

A path in binary, entry, or files is relative and normal. It has no absolute path. A .. removes one normal component; it is refused when it would leave the bundle root. A leading ./ is removed. A path under model/ is refused, including a symlink that resolves into model/. The digest never covers model/ and never covers bundle.toml itself.

The digest is SHA-256 over the binary and each file in sorted path order. A piece contributes its relative path, its byte length, and its bytes, each with a length prefix as 8 little-endian bytes. The hash reads a file in bounded chunks, so a large binary is never held in memory.

The path below plugins/ is the bundle id. The model and target names are the operator's; the core never derives them. Two hosts may use different target names for the same model.

5.1 Three archetypes

  1. Authored. src/ is the engine. The bundle owns its kernels, its KV, its batching, and its layout. This is the fast path for one pair. Rust is the default because the tree gives the GGUF reader, the vocabulary, the template, the sampler, and the stop set. The bundle can use another language. The gate starts the package and does not care what is inside it.
  2. Direct library. engine/ holds a local shared runtime and src/ is the bundle's own FFI shim implementing Plugin (and CacheCodec when it persists state). There is no sidecar, no loopback port, and no HTTP hop. This is the primary path for hosting libllama, libstable-diffusion, libaudio, or libonnxruntime. Section 15.1, method 4.
  3. Compatibility. engine/ holds an external binary or HTTP service and src/main.rs calls the engine-neutral binder. The binder maps the capability to the runtime and declares the facts the runtime can keep. It is the cheap adapter for a third-party service, not the primary host path. Section 15.1, method 2.

The engine inside a bundle can be any language. The entry point is a package because cargo and the gate need one process to start. The language of the engine is not the language of the entry point. Decision D15.

5.2 Rules for bundles

  1. No bundle depends on another bundle. Two targets of one model do not depend on each other.
  2. The bundle id is the pair. It does not change when the engine changes. A new engine is a new src/ or engine/ in the same directory. The deploy file and the client do not change. Decision D14.
  3. A bundle ships goldens. CI runs them. Requirement R9.
  4. A bundle is not privileged. A bound runtime and a hand-written engine are the same citizen.
  5. The weights are content. model/ is never tracked, never in an image, and never in the digest. Requirement R32. Decision D16.
  6. No modality directory. A bundle serves capabilities. The capability names already say which. The bundle id is its path below plugins/.
  7. crates/ does not name a model, a bundle, or an engine. Requirement R13.
  8. The bundle is the unit of replacement. To try a faster engine, replace the contents of one directory and run the gate. Nothing else changes.

6. The shape of a request

The engine has six nouns. These nouns are the complete shared shape. A new capability adds vocabulary. A new capability does not add a noun.

Job      = { id, model, capability, input: [Part], output: OutputSpec,
             params, stream, deadline_ms, priority, request_id }

Part     = { kind: text|image|audio|video|tokens|json,
             mime, role, ref: inline(bytes) | blob(sha256) }

Channel  = text | tokens | pcm | image | clip | embedding | decision | progress

Event    = { seq, job, request_id, at,
             body: started|delta|usage|progress|done|error }

Outcome  = completed | failed | cancelled | expired

Refusal  = { code, message, retryable, retry_after_s }

Five rules for the shape:

  1. A medium is data. A task is a capability. An image is a part. An image is not an endpoint. Vision is not a capability. An image part goes into chat.
  2. params is opaque to the core. The plugin reads params. The manifest names the parameter schema.
  3. The same Event object goes through all three hops. The hops are plugin to core, core to web, and web to client. See requirement R7 and R18.
  4. The socket carries control data only. A blob reference becomes a file descriptor at the peer hop. The core makes that substitution; a plugin never sees a blob.
  5. The core resolves names and bytes. The plugin defines the model behaviour.

The Part shape is almost the same as the OpenAI content part. Thus each adapter is small.


7. Capabilities

This is the capability table. It is also the table that GET /capabilities returns. The table is static: it does not depend on which models are loaded.

CapabilityRouteInput partsOutput channelsStream
chatPOST /chattext, image, audio, jsontext, tokens, decision, progressyes
embedPOST /embedtextembeddingno
rerankPOST /reranktext, jsonembeddingno
ttsPOST /ttstextpcm, progressyes
sttPOST /sttaudio, texttext, tokens, progressyes
musicPOST /musictext, audiopcm, progressyes
image-genPOST /image/generatetext, imageimage, progressyes
image-editPOST /image/editimage, textimage, progressyes
t2v-genPOST /video/text-to-videotext, imageclip, progressyes
i2v-genPOST /video/image-to-videoimage, textclip, progressyes
decidePOST /decidetext, json, imagedecisionno
extractPOST /extracttext, jsondecisionno

The capability key is the stable task name. The route is the canonical HTTP spelling of that task. They are related but not identical strings: the image and video tasks group below /image and /video. The route is not a second name and not a second code path. Section 10 gives the route list. Section 20.1 gives the freeze contract.

Notes:

  1. One model can declare more than one capability. Each capability has its own limits.
  2. progress is the only channel that all capabilities can use. A long video job needs this channel.
  3. rerank is separate from embed. The shape is different. A query and a document array go in. Scores go out.
  4. A capability that is not in the manifest cannot be reached by any route. Requirement R24.

8. The core

The core is the process inf3r-core. It owns these functions:

FunctionBehaviour
discoveryScan the bundle directories. Start each plugin with --describe. Read the catalogue. Check the schema. Check the uniqueness of all served names.
routingMap a model name and a capability to one plugin. Check that the plugin declares the capability.
admissionUse one queue for each device. The queues have priorities and deadlines. The queues are bounded. A full queue gives a refusal with a reason.
ledgerRecord the reserved bytes for each device. One reservation covers all devices of a target. The reservation is all or nothing.
residencyKeep a model on a device, or remove it. The modes are pin, warm, and idle_unload. The eviction is LRU. The eviction waits for the model to be idle.
switchingDrain, unload, reserve, start, load, ready. The sequence runs under a device lock.
supervisionStart, handshake, health check, restart with a delay, circuit breaker, stop, and removal.
protocolOne framing with two roles. A plugin serves. A front or the cli calls.
observabilityOne request id across all hops. The core logs every decision.

The core uses one path for all capabilities:

model name -> catalog entry -> capability declared -> host binding
-> device selection -> ledger reserve -> model load
-> submit -> accepted or refuse -> events -> publish -> done

The core must not hang. Every request is admitted, queued with a deadline, or refused with a reason. Requirement R3.


9. The web

The web is the process inf3r-web. The core and the web ship in one control container. An engine is a sibling container when the bind names runtime = "container". They are not supported running apart. The boundary exists to keep HTTP, auth, and JSON out of the engine.

The web uses the same framed protocol as a plugin. The web is a client of the core.

9.1 Listeners

  1. A Unix domain socket is the local listener. It is optional. The web checks the peer uid against the effective uid of its own process.
  2. A TCP listener is the remote listener. It is optional. Remote use goes through TCP on the tailnet.
  3. At least one of the two listeners is configured. Both can run at once.
  4. One bearer token. The token comes from the deploy file. The comparison is constant time.
  5. No accounts. No tenancy. No sessions.
  6. Every route except /healthz needs auth. A Unix peer authenticates by uid; a TCP peer authenticates by token. Requirement R19.

9.2 Limits

The web has these limits:

A client above the concurrent limit gets 503 and a closed connection. A read that times out gets 408; a body that is too large gets 413. The cap covers the whole connection, including a streamed reply, so a slow reader cannot make the accept loop grow without bound. Both listeners share the cap.

A request that says Expect: 100-continue gets HTTP/1.1 100 Continue before its body when the head is acceptable. A client such as curl waits for that line before it sends a body over 1 KiB.

The web parses multipart only for the OpenAI compatibility routes. There is no CORS, no compression, and no cache.


10. The HTTP API

The API has no version number. A version number exists so that one server can serve two shapes at once. inf3r does not need that. The engine, the web, the cli, and the clients move together. A published name is permanent. Section 20.1 gives the rules.

The API is RPC, not REST. Each capability route is a POST that makes a job. A resource route gets, lists, or removes a resource.

The engine has seventeen resource routes:

GET    /jobs               List jobs. This route is for the operator.
GET    /jobs/{id}          Get the status of one job.
POST   /jobs               Submit one job as JSON. The reply is 202 and a status.
DELETE /jobs/{id}          Cancel one job. This operation is idempotent.
POST   /blobs              Upload bytes. The reply gives the blob id and size.
GET    /blobs/{id}         Download one artifact.
GET    /models             List the routing catalogue.
GET    /capabilities       Give the static table in section 7 as JSON.
GET    /stats              Give peer, engine, device, blob, and cache counters.
POST   /reload             Reload one bundle or every bundle.
POST   /reload/{bundle}    Reload the bundle that the path names.
GET    /cache              List cache metadata. Never cache bytes.
POST   /cache/pin          Pin one entry by its 64-hex address.
POST   /cache/unpin        Unpin one entry.
DELETE /cache              Evict all, one model, or one entry.
POST   /cache/gc           Compact the cache WAL.
GET    /healthz            Give the liveness status. Needs no auth.

The engine has twelve capability routes. Each one is the same handler as POST /jobs, with capability filled from the path:

POST   /chat               POST   /music
POST   /embed              POST   /image/generate
POST   /rerank             POST   /image/edit
POST   /tts                POST   /video/text-to-video
POST   /stt                POST   /video/image-to-video
POST   /decide             POST   /extract

A capability route is a spelling of POST /jobs. It is not a second implementation. The request body can omit capability. The path maps to the stable capability key in section 7; the old flat image and video spellings are not routes.

A target with a query string is not a route, and neither is a trailing slash. The route table has no query and no near miss.

Every route except /healthz needs auth when a token is configured. A Unix socket peer proves its uid; a TCP peer sends the bearer token.

The OpenAI compatibility routes are under /openai/v1/. The v1 in that prefix is the OpenAI version, not an inf3r version. Section 10.3 gives the routes.

Every request has an x-request-id. The web echoes it on the response. The core and the plugin log it.

10.1 Discovery and status

GET /models lists every catalogue entry that the host has discovered, warm or cold. It is the routing catalogue, not a weight inventory:

{"models": [
  {"serve": "<served-name>", "plugin": "<model>/<target>",
   "capabilities": [
     {"name": "chat", "vocab": "chat.v1", "degraded": false, "cancel": "token"}
   ]}
]}

It does not report loaded or installed state, weight files, limits, or parameter schemas. An alias is another serve row, not a separate field. Loaded state is inferred from stats.engines, never from models.

GET /stats reports the runtime:

{
  "peers":   [{"plugin": "<id>", "model": "<served>", "in_flight": 0}],
  "engines": [{"plugin": "<id>", "served": ["<served>"], "slots": 1,
               "in_flight": 0, "queued": 0, "declared_bytes": 0,
               "load_ms": 0, "measured_bytes": 0, "tokens_out": 0,
               "first_token_ms": 0, "tokens_per_s": 0}],
  "devices": [{"device": "cuda:0", "bytes": 0, "used": 0}],
  "blobs":   {"bytes": 0, "limit": 0},
  "cache":   {"enabled": false}
}

peers has one row for each catalogue name, including a cold name; its in_flight is the queue count. engines has one row for each resident plugin. load_ms, measured_bytes, tokens_out, first_token_ms, and tokens_per_s are present only after the engine has measured them. devices reports each ledger device, its total bytes, and its used bytes. blobs reports the store's bytes and limit. cache is the cache stats object, or {"enabled": false} when the cache is off. Its top-level keys are enabled, hits, misses, hit_rate_bp, saved_prefill_ms_total, evictions, evictions_by_reason, demotions, promotions, corrupt_entries, active_writes, active_reads, pinned_bytes, pin_bound, save_count, save_ms, save_ms_p50, save_ms_p95, restore_count, restore_ms, restore_ms_p50, restore_ms_p95, tiers, and models. ops.md section 7 describes the tier and model rows.

GET /capabilities returns the static table of section 7:

{"capabilities": [
  {"name": "chat", "route": "/chat", "parts": ["text"],
   "channels": ["text"], "stream": true}
]}

The table does not depend on the catalogue or on which engines are resident.

10.2 Submit a job

POST /jobs
{
  "model": "example",
  "capability": "image-edit",
  "input": [
    {"kind":"image","mime":"image/png","blob":"<sha256>","role":"source"},
    {"kind":"image","mime":"image/png","blob":"<sha256>","role":"mask"},
    {"kind":"text","text":"replace the sky with a storm"}
  ],
  "params": {"steps": 28, "guidance": 4.5, "seed": 7},
  "output": {"image": {"mime":"image/png"}},
  "stream": true,
  "priority": "interactive",
  "deadline_ms": 120000
}

Rules for submission:

  1. The core does not examine params. The plugin examines params. The web puts output inside params under its own name, because the wire has one opaque parameter map and no sibling output field.
  2. An inline part keeps the whole request inside the body limit. A larger part is an upload to /blobs and a reference. Requirement R22.
  3. There is no URL part. The client fetches a remote file, then uploads it.
  4. model is a served name from a model manifest. The core does not make a default name.
  5. stream=false gives one object. It holds request_id, status, output (the concatenated text), events (each non-text event with channel, mime, and base64 b64), artifacts, and usage when the plugin reported it. stream=true gives an SSE event stream.
  6. priority is interactive or background.
  7. deadline_ms starts at admission. A job that is older than the deadline is refused with timeout.

10.3 Adapters

An adapter changes one API format into a job. An adapter uses the same server shape.

RouteJob that it makes
/openai/v1/chat/completionschat. messages becomes text and image parts. tools and response_format become json parts.
/openai/v1/embeddingsembed. input becomes one part or more parts.
/openai/v1/audio/speechtts. The text becomes one part. The reply is audio bytes.
/openai/v1/audio/transcriptionsstt. Multipart becomes one audio part and one text part.
/openai/v1/images/generationsimage-gen. size, n, and quality go into params.
/openai/v1/images/editsimage-edit. Multipart becomes two image parts and one text part.
GET /openai/v1/modelsNothing. It lists the served names as OpenAI model objects.

The six adapters and the model list are the only routes with a version. That version belongs to the OpenAI contract. It is not an inf3r version.

Rules for adapters:

  1. An adapter can refuse a request only if the capability also refuses it.
  2. An adapter can make N jobs from one request. For example, n=4 makes four jobs.
  3. An adapter cannot add a core feature. Requirement R23.
  4. One function in inf3r-api makes the SSE output from the event object. The adapter adds [DONE].
  5. The OpenAI vocabulary is only in crates/edge/api. The core knows no messages, no choices, and no base64. The web supplies identifiers, time, descriptors, and bytes.
  6. A standard field that the capability names becomes a part or a parameter. The chat adapter maps messages to text and image parts. The developer role becomes system. tools, or the older functions, becomes one json part with role tools and payload {"tools": [...]}. response_format becomes one json part with role response_format. The sampling fields become params. A field outside the capability is ignored. An unknown top-level field is not a refusal.
  7. A text progress event becomes reasoning_content. When stream_options.include_usage is true, a non-empty terminal usage becomes one usage chunk with no choices, before [DONE].
  8. The error type follows the status: 401 is authentication_error, 403 is permission_error, 429 is rate_limit_error, 5xx is server_error, and every other status is invalid_request_error.
  9. The transcription adapter reads the multipart fields file, model, prompt, language, response_format, and timestamp_granularities[]. response_format is json, text, or verbose_json.
  10. The image edit adapter reads the multipart fields image, mask, prompt, and model. A file field stays a descriptor.
  11. The embeddings adapter reads input, dimensions, and encoding_format. The format is float or base64. The plugin's CBOR array of vectors becomes the OpenAI data array.
  12. The speech adapter uses the MIME of the first pcm event as the response Content-Type. An image reply is always b64_json, because the engine has no public URL.

11. The event stream

All hops send this object. The plugin sends it to the core. The core sends it to the web. The web sends it to the client.

{"seq":1,"job":"019...","request_id":"r-7","at":"2026-01-01T00:00:00.1Z",
 "body":{"t":"started","model":"example","plugin":"example/gpu","est_ms":9000}}

{"seq":4,"job":"019...","body":
 {"t":"delta","channel":"progress","pct":0.21,"stage":"denoise"}}

{"seq":9,"job":"019...","body":
 {"t":"delta","channel":"text","text":"Hel"}}

{"seq":10,"job":"019...","body":
 {"t":"delta","channel":"pcm","pcm":{"rate":24000,"fmt":"f32le"},"b64":"..."}}

{"seq":20,"job":"019...","body":
 {"t":"usage","text_in":12,"text_out":84,"images":1}}

{"seq":21,"job":"019...","body":
 {"t":"done","outcome":"completed",
  "artifacts":[{"channel":"image","mime":"image/png","blob":"<sha256>","bytes":1843200}],
  "meta":{"finish_reason":"stop"}}}

Rules for events:

  1. seq increases by one for each event of a job.
  2. Each channel keeps its own order.
  3. A job has one terminal event only. The terminal event is done with an outcome, or error.
  4. A cancel gives done with outcome: cancelled. The client then has one terminal path.
  5. The plugin sends usage in the terminal frame. The core collects usage for /stats. The web emits one usage event before done when the counts are not empty.
  6. The SSE format is exact: data: <json>\n\n for each event, and data: [DONE]\n\n once at the end. A ping comment, : ping\n\n, keeps the connection alive before the first event and during a long wait. Requirement R18.
  7. If a failure occurs after the headers, the web sends one final error event. It does not close the connection without a terminal event.
  8. A client disconnect sends a cancel frame to the core. The plugin stops within one step. Requirement R15.

12. Refusals

A refusal comes before admission. A refusal always has a code from this table.

CodeHTTPCondition
unknown_model404The name is not in the catalog.
unknown_capability400The model does not declare the capability.
capability_missing400The model declares the capability. The host does not serve it.
invalid_part400The kind is not permitted. The mime or the role is incorrect.
payload_too_large413An inline part is more than 1 MiB.
queue_full429The queue is full. The reply has Retry-After.
no_room503The ledger cannot reserve the bytes. The reply has Retry-After.
load_failed503The plugin failed to start or to load.
plugin_crashed502The plugin stopped during the job.
mismatch500The manifest does not agree with the hardware probe.
protocol500The plugin did not obey the protocol.
timeout504The job exceeded the deadline.
ambiguous_model500Two plugins serve one name. The core reports this error at startup.

Rules for refusals:

  1. A refusal never hangs. The request always gets a status.
  2. The reply has this shape: {"error":{"code":"...","message":"...","retryable":false,"request_id":"..."}}.
  3. A refusal after the headers becomes a terminal error event. It does not change the HTTP status.

13. Blobs

  1. A blob has a SHA-256 content address.
  2. The blob store belongs to the core. A plugin never sees a blob, a blob id, or a path. A plugin sees a file descriptor. Section 10 of the protocol gives the rules.
  3. The client uploads bytes to /blobs. The core computes the address.
  4. The store removes the LRU blob when it needs room. A blob that a live job references is never removed.
  5. The size of the store comes from the free space of its filesystem. The operator can set an upper bound. There is no default size.
  6. A plugin writes an artifact and sends the descriptor with done. The core takes ownership, checks the length, and stores the bytes.
  7. An upload above the inline limit is spooled to an unlinked file and streamed into the store. The web does not hold the whole body in memory. A body above the store bound is refused.

The socket carries descriptors and small inline values. A 4K frame, a 60 s clip, or a 15 GB weight file is never a message. A plugin in C, Python, Go, or Zig needs sendmsg and a way to read a descriptor; a bounded read and mmap are both allowed. Requirement R22.


14. The peer protocol

The normative text is .f0rge/wiki/docs/protocol.md. The machine grammar is spec/protocol.cddl. This section gives only the contour of the contract.

  1. One 8-byte header: u32 length, u16 stream, u8 type, u8 flags. The length is at most 0xFFFFFF.
  2. Sixteen frame types. Session frames use stream 0.
  3. Three job states: open → (accept | reject) → done.
  4. Credit is an absolute watermark for each stream. A terminal frame is never credit-limited.
  5. Media is one file descriptor or inline bytes. On the plugin hop, the kernel's peer credentials authenticate the accepted socket.
  6. The core decodes the envelope. It never decodes a payload.
  7. The catalogue is the only description of a peer that the core reads.
  8. A peer reads control frames on a thread that never blocks on the worker.
  9. Two versions are compatible when their ranges overlap. Requirement R12.
  10. A plugin crash affects only the jobs of that plugin. Live streams get error with plugin_crashed. The ledger releases all bytes. Requirement R16.
  11. After a failure, the supervisor waits for as long as the failure took. It classifies version, frame, stream, size, and dependency as permanent and marks the peer unloadable. Every other failure is transient. A successful job clears the state.
  12. The protocol has no tunable numbers. The only ceiling is the length field: 16 MiB. A larger object is a descriptor.

15. The bundle

A bundle provides:

  1. One model, one target, one entry point, and one process.
  2. --describe: the id, the target, the protocol version, the capabilities, the needs, the weights, and the limits.
  3. Its own internals. The engine inside can be any language. The entry point is the package that the gate starts.
  4. Goldens. CI runs them. A bench is expected. The core does not track or compare a bench.

15.1 Four ways to be an engine

  1. Authored with the SDK. The crate is inf3r-plugin-sdk. A plugin implements Plugin: catalogue, load, and run(capability, request, emitter).

    impl Plugin for MyModel {
        fn catalogue(&self) -> Catalogue { /* what this bundle serves */ }
        fn load(&self, grant: &Grant) -> Result<Ready, Failure> { /* the weights */ }
        fn run(
            &self,
            capability: &str,
            req: Request<'_>,
            out: &mut dyn Emitter,
        ) -> Result<Report, Failure> { /* the capability */ }
    }
    
    fn main() -> std::io::Result<()> { inf3r_plugin_sdk::launch(Arc::new(MyModel::new())) }
    

    The SDK is synchronous. One job uses one thread. The SDK uses no async runtime. The plugin controls its own concurrency. The plugin controls its CUDA streams and its batching. An async runtime would add policy. The core is thus not the correct place for concurrency policy.

    The SDK checks the model, the capability, and every part kind against the catalogue before it sends accept. The Plugin::admit hook then checks the parameters and the roles. A refusal from either check is a reject in OPEN, so the caller never sees an accept for a job that the plugin did not start.

  2. Bound with the binder. The crate is inf3r-bind. The entry point is one line, and the engine is a runtime that already exists in engine/:

    fn main() -> std::process::ExitCode { inf3r_bind::main() }
    

    The catalogue shapes are per bridge: binary chat is text, HTTP chat carries text, image, audio, and JSON with the progress channel, HTTP STT emits text, and the HTTP image routes advertise only the parts those routes use. The binary generic bridge keeps its richer shapes. A model file's parts override wins.

    bundle.toml gives the engine kind and the entry:

    • engine = "binary": the binder starts engine/entry and uses its standard input and standard output as the request and the reply. Chat is a prompt of text lines. Another capability is one JSON request line; each reply line is text or a JSON object with channel, mime, and base64 b64, and event: true makes it an event instead of an artifact. Both streams run at once, so a prompt above a pipe buffer cannot deadlock. With worker = "jsonl" the entry loads once, prints {"ready":true}, and reads one request object per line. A request carries id, model, capability, params, and parts. A reply carries the same id, then either a channel with b64 and optional event, or a terminal {"done":true,"usage":{...},"meta":{...}}. {"error":{"code","message"}} is a job failure. A job has one fixed deadline; cancellation and that deadline are polled while the binder waits, so a silent or chatty engine cannot extend the job. A request or reply line above 32 MiB is refused, and the request is written on a separate thread so a full pipe cannot block the job. A missing or mismatched id, a malformed line, a duplicate terminal, or a crash stops the worker; the next job starts a new one. The one-shot binary path has the same job deadline, line cap, and blocked-pipe handling.
    • engine = "http": the binder starts engine/entry or connects to the URL. It waits for /health to answer below 500 before it reports ready, because a runtime can listen before the weights are in place. It maps chat, embed, rerank, stt, tts, image-gen, and image-edit to the seven OpenAI routes below /v1. music, t2v-gen, i2v-gen, decide, and extract use the neutral POST /<capability> bridge: the same request object as a binary engine, and one object, array, NDJSON, or SSE reply with channel, done, and error. NDJSON and SSE events are emitted as they arrive; a short socket poll checks cancellation and the job deadline, and a request or reply above 32 MiB is refused with size. A chat request carries every capability parameter, the model stop strings, the image and audio parts as data, and stream_options.include_usage. It declares cancel: request and stops: native because the runtime keeps those. An https entry is refused: a bound runtime is a local process.
    • engine = "library": the bundle links a local shared library in engine/ directly from its own src/ via FFI (method 4), implementing inf3r_plugin_sdk::Plugin without a sidecar server or HTTP hop. The generic binder inf3r-bind refuses engine = "library"; this is not a gap, because the foreign ABI belongs inside the bundle's own shim and inf3r new --bind library writes that shim.

    inf3r-bind is a thin, engine-neutral compatibility adapter for external binary and http runtimes — not the primary host path for first-class engines. It never injects vendor-specific engine flags or routes into a child runtime. It passes every granted weight descriptor to the engine, not only the first. A declaration with a path uses that path. A descriptor-only grant uses /proc/self/fd/<n> and the descriptor is inherited across the process start (and every worker restart); {weights} and {weightN} name the rest. The engine's stderr is copied to the binder's stderr, and inf3r-web passes INF3R_BUNDLE_DIR so a binary that is not beside its checkout still finds bundle.toml. The binder reads every models/*.toml; an alias_of file adds a second served name and inherits the source capabilities. It maps content and reasoning deltas to channels, and states in the catalogue what the runtime cannot do. A model file with no capability section keeps the historical implicit chat; once it declares any capability, only those names enter the catalogue.

  3. Raw protocol. The engine uses any language. The process obeys sections 14.1 to 14.4. It has --describe. Goldens prove the bundle. Requirement R21.

  4. Direct library binding (engine = "library"). The bundle's own src/ links a local runtime library (libllama, libstable-diffusion, libaudio, libonnxruntime, or a research repository) directly via FFI or a -sys crate and implements Plugin (and CacheCodec when caching KV state). There is no sidecar server, no loopback port, and no HTTP hop. The unsafe stays inside that bundle's own workspace with a stated reason (D19). Copying the bundle to another pair and specializing or replacing the bound runtime with custom kernels changes nothing outside the directory.

inf3r new <model> <target> <capability> makes a bundle. The bundle has the five parts of section 5, a target file, a model file, an empty golden set, and a correct --describe. Requirement R17. The flag --bind binary|http selects method 2 and writes the one-line binder entry point. The flag --bind library selects method 4 and writes a compiling FFI shim plus a placeholder C engine that the bundle replaces. The flag --engine selects method 1.

15.2 Goldens

A golden file has this shape:

{
  "name": "chat.basic",
  "protocol": 1,
  "request": { "capability": "chat", "input": [...], "params": {...} },
  "expect": {
    "events": [ {"t": "started"}, {"t": "delta", "channel": "text", "text": "Hi"} ],
    "done": { "outcome": "completed" }
  },
  "compare": ["channel", "text"]
}

Rules for goldens:

  1. A golden compares only the fields in compare. A different value in another field is not a failure.
  2. CI runs all goldens of all plugins that the deploy file binds. Requirement R9.
  3. A golden that records time or a seed must set the seed.
  4. The engine goldens live in goldens/. They cover SSE output, refusal codes, and protocol frames. Requirement R18.

16. The manifest

The manifest has three levels. bundle.toml names the engine, the files, and the digest. The target file gives the hardware. The model files give the served names and the capabilities.

16.1 target.toml

[target]
name       = "gpu"
backend    = "cuda"
arch       = ["x86_64"]
compute    = "sm00"
devices    = 2
vram_mb    = [1024, 1024]
driver_min = "550"
cuda_min   = "13.5"
requires   = ["cublas", "cudnn>=9"]
sharing    = "exclusive"

[limits]
max_inflight   = 8
max_part_bytes = 268435456
load_ms        = 9000
start_ms       = 30000
accounting     = "declared"

The target file is the hardware half of the pair. It is a profile, not a label. The core probes the host and checks every field before it starts the bundle. The refusal names the field, the required value, and the measured value. Requirement R6 and D17.

backend is cuda, rocm, vulkan, metal, or cpu. A selected device whose id names another backend is refused. compute is the compute capability of each selected device, as sm00 or gfx0000. vram_mb is the required device memory, in the order of the bind's devices list. A host with mixed cards checks only the devices that the bind selected. devices is the least number that the bundle needs; the bind must select at least that many. cuda_min is the lowest CUDA runtime that the engine was built against and applies only to a cuda target. requires names the libraries that the engine links.

Every key in [limits] is optional. The parser keeps the value on Profile::limits; a limit is a budget of the bundle, not a measurement of the machine. max_inflight is a u16, max_part_bytes a u64, and load_ms a u32. accounting is the bundle's own word for how it counts memory. A bundle that sets accounting = "split" declares that only part of its resident weight set is on the selected devices: vram_bytes gives one byte count per device in vram_mb order, and ram_bytes gives the bytes expected in host RAM. The host checks the device portion against the device ledger and the RAM portion against the process tree, so a hybrid CPU+GPU target is not charged its whole weight file to the card. A file that names either byte count without accounting = "split" is refused. A bound bundle also reads max_inflight as its welcome limit and start_ms as the longest wait for its HTTP engine to answer /health; without start_ms it waits for the web's 120 s load deadline.

sharing is exclusive or timeslice. The deploy file can override it.

16.2 models/<served>.toml

[model]
serve  = "example"
family = "example"

[weights]
files = ["weights/example-Q8_0.gguf"]
quant = "Q8_0"
bytes = 15600000000

[capabilities.chat]
vocab              = "chat.v1"
context            = 32768
kv_bytes_per_token = 524288
template           = "chatml"
stops              = ["<|im_end|>"]
params             = "chat.v1"

[capabilities.embed]
vocab = "embed.v1"
dims  = 4096

Rules for the model file:

  1. serve is the name from the user. The core does not make this name. Two plugins with one serve name make the error ambiguous_model.
  2. vocab is the vocabulary version. It is independent of the wire protocol version.
  3. The plugin uses template and stops. The core does not use them. The crate format/text gives the template engine to the plugin. Decision D6.
  4. bytes is the ledger unit. context × kv_bytes_per_token is the KV cache of one load. Both are capability limits, and the core reserves the larger cache that any capability of the model declares. Decision D5.
  5. An alias is a second model file with the same weights and [model] alias_of = "<served-name>". The alias does not declare capabilities. It uses the capabilities of its source.

16.3 The catalogue

The catalogue is the only description of a peer that the core reads. The JSON shape is in the CDDL. Section 12 of the protocol gives the rules.

{
  "v": 1,
  "max_inflight": 8,
  "target": {"id": "gpu", "backend": "cuda", "arch": ["sm00"],
             "devices": 2, "vram_mb": [1024, 1024]},
  "models": [
    {"serve": "example", "alias_of": null,
     "capabilities": {"chat": {"vocab": "chat.v1", "parts": ["text", "image"],
                               "channels": ["text", "tokens", "progress"]}}}
  ]
}
  1. target.toml and models/*.toml are the bundle's own files. The process uses them to build the catalogue. The core never opens them. bundle.toml is read by the cli and by the binder; the core reads the deploy file and the catalogue.
  2. --describe prints the catalogue to stdout and stops. It does no loading, so it has no deadline. Requirement R1.
  3. Discovery runs --describe, checks the schema, and checks name uniqueness at startup. A duplicate serve name is ambiguous_model.
  4. A peer that does not answer --describe never reaches READY. The supervisor then handles it like any other failed start.

17. Deploy

deploy.toml contains the bindings for one host. It is not code. The same binaries run on a different host with a different deploy file.

[[node]]
host        = "example"
bin_dir     = "target/release"
bundle_dirs = ["plugins"]
blob_dir    = "/var/lib/inf3r/blobs"
blob_bound  = "200GB"         # optional; default is the free space of blob_dir
# unix, tcp, or both. The local socket serves the CLI; TCP serves the tailnet.
web         = { unix = "/run/inf3r/web.sock", tcp = "100.64.0.5:8080" }
auth_file   = "/etc/inf3r/token"

[[node.bind]]
bundle       = "example/gpu"
models       = ["example"]
devices      = ["cuda:0", "cuda:1"]
vram         = [1024, 1024]
pin          = true
max_inflight = 8

[[node.bind]]
bundle       = "example-video/gpu"
models       = ["example-video"]
devices      = ["cuda:1"]
warm         = false
idle_unload  = "5m"
priority     = "background"
max_inflight = 1

A container-native file for one host is the same node with two extra roots and a sibling bind:

[[node]]
host            = "inf3r"
bin_dir         = "/opt/inf3r/bin"
bundle_dirs     = ["/opt/inf3r/plugins", "/opt/inf3r/plugins-extra"]
blob_dir        = "/var/lib/inf3r/blobs"
socket_dir      = "/run/inf3r"
socket_host_dir = "/run/user/1000/inf3r"
probe_image     = "inf3r:compose"
web             = { tcp = "0.0.0.0:8080" }
auth_file       = "/var/lib/inf3r/token"

[[node.bind]]
bundle   = "mock/x64-cpu"
runtime  = "container"
image    = "inf3r/mock/x64-cpu:sha-0123456789ab"
command  = ["/opt/inf3r/bin/inf3r-mock-x64-cpu"]
models   = ["mock"]
devices  = ["cpu:0"]
warm     = true

Rules for the deploy file:

  1. One [[node]] is one host. A deploy file names one host; a second node is refused. A host with two configurations gets two files, not two nodes.
  2. A bind names a bundle id and the models that the host serves from it. The bundle id is the path below plugins/. It has no modality segment. The bind names a bundle, not an engine: a new engine in the same directory uses the same bind.
  3. devices selects the devices. vram is the fallback capacity for a device whose driver does not report its total; a probed GPU total is authority. The core reserves the model's bytes, not this capacity. The unit is MB.
  4. pin means the model stays on the device. The core does not unload it.
  5. warm means the core loads the model at startup. warm = false means load on demand.
  6. idle_unload is a duration. After that time with no job, the core unloads the model.
  7. priority is interactive or background. It sets the default priority for the jobs of this binding.
  8. A build uses each bind entry. Requirement R10. The CI build proves that each binding can start. A bind's optional max_inflight is an upper bound for this host, not a raise: the core takes the smaller of it and the bundle's own welcome. A JSON-lines worker welcomes one, so a deploy value of eight still runs one job at a time; a cold bind admits one job until the live welcome is known.
  9. The binary of a process bind is bin_dir/inf3r-<id>, with each / of the id replaced by -. mock/x64-cpu runs bin_dir/inf3r-mock-x64-cpu. The rule is one line and a bundle never has to name its own binary. A container bind runs the plugin from its image; command overrides the image entrypoint.
  10. weights is optional. It overrides the weight file that the model file names. A relative path is below the bundle's model/ directory. The deploy file is the only authority on which file a host mounts.
  11. web names unix, tcp, or both. At least one listener is required. Both listeners serve the same routes and the same core.
  12. socket_dir is the private socket root in the control. It is absolute and defaults to /run/inf3r. A control container that mounts a host runtime directory at a different path also names socket_host_dir, the path that the Docker daemon resolves; the engine receives only its own instance below the host path, mounted at the control path. Both values must name the same directory and are absolute. The operator must make both names the same backing directory; a host path cannot be checked from inside the control's namespace. socket_host_dir requires socket_dir. A host-side gate uses socket_host_dir for its own listener; a gate inside a control passes --socket-dir and uses a private child root. The gate runs conflicts() before it starts a container.
  13. probe_image is the image that runs inf3r-probe outside the control's namespaces. Every container bind requires it, not only a CUDA bind: the probe is also the only correct view of a sibling's host PID and process memory. It is non-empty and pinned like every image: a bare name and :latest are refused, as is a malformed digest.
  14. runtime is process or container; the default is process. A process bind names no image, command, or mounts. A container bind requires an image and may override command; the image carries the plugin and the bundle manifests.
  15. A container image is pinned by a non-latest tag or a sha256: digest. A bare name is resolved by Docker as :latest, so it is refused with :latest and with an empty reference. The control never pulls an image at request time. A content tag sha-<12> must agree with the image's org.inf3r.source.sha256 label. When INF3R_IMAGES_LOCK names the build record, the control also checks the image id and source label against the row; without a lock, only a content tag or digest is accepted, or the local alias when the same image still carries its content tag. The image contains no weight file and no model/ directory.
  16. network is none for a container bind. The default is already none. An engine is a sibling with no network, no Docker socket, and no writable host mount except the one private socket instance that the supervisor creates. Every engine carries inf3r.managed=1 and inf3r.control=<runtime root>; a control's startup sweep removes only its own scope, so two controls can share one Docker daemon.
  17. mounts is an array of source:target[:ro] strings. Both paths are absolute and lexically normalized; a .. component is refused. The mode is ro unless it is rw, and rw is refused. The source must exist, contain no symlink, and resolve below an asset_dirs entry. A source may not name the Docker socket or a directory that contains one, be the control token or its parent, be under /etc, /var/run, /run, or /root, or be the control home or a parent. The target may not be /, /etc, /var/run, /run, /root, or a Docker socket. A mount may not overlap blob_dir, a cache tier, or either socket root. The control's cache directory is never mounted into an engine.
  18. A container bind still names models, devices, weights, and the residency fields exactly as a process bind does. The weight files cross as read-only descriptors; the deploy file does not need to mount them. Multi-file weights and assets use the same descriptor grant.
  19. The cache is a control resource (D22/D23). An engine has no cache directory, quota, or tier; its cache traffic crosses the private socket as descriptors. The cache authority is owned by the control.
  20. asset_dirs is an array of absolute host directories that a container engine may mount from. Each entry must exist, be a directory, contain no symlink, and not expose a protected path. The default is empty: with no entry, a container bind has no host asset mount. Use descriptors for weights, media, and cache objects (rule 18).
  21. A control image carries the mock manifests below /opt/inf3r/plugins. Other bundles are delivered as a manifest-only tree mounted read-only at /opt/inf3r/plugins-extra and named as the second bundle_dirs entry; the tree holds bundle.toml, target.toml, models/*.toml, and documentation, never an engine tree, plugin binary, library, or weight. ops/control-manifests.sh stages it, and compose mounts it from INF3R_MANIFEST_DIR.
  22. A container bind may set pids_limit, memory, shm, log_max_size, and log_max_files. The defaults are 256 pids, 16 GiB host memory, 512 MiB /dev/shm, 10 MiB per rotated log file, and 3 files. The host memory limit does not govern GPU memory; the device ledger does. A process bind names none of these limits.

18. The crates

This table gives the owner of each crate and the allowed dependencies. The dependency rules point one way. A crate that is not in the list may not be imported.

CrateDirectoryOwnsMay depend on
inf3r-apiedge/apiWire JSON, SSE, and the adapters.json, proto
inf3r-jsonedge/jsonThe JSON value, the parser, and the writer.none
inf3r-cliedge/cliThe operator commands. Talks to the web over HTTP.deploy, json, bundle, verify, host
inf3r-protoedge/protoThe six nouns, framing, CBOR, descriptors, and credit.none
inf3r-plugin-sdkedge/sdkThe Plugin trait, serve(), and the cache codec handle.json, proto
inf3r-serveredge/serverHTTP, auth, the request path, and the SSE writer.api, proto, core, catalog, blobs
inf3r-catalogstate/catalogA model file to a checkpoint and a capability list.files, format
inf3r-hoststate/hostThe hardware probe for CUDA, ROCm, Vulkan, Metal, and CPU memory.none
inf3r-ledgerstate/ledgerByte reservations for each device.none
inf3r-blobsstate/blobsThe content store, the LRU, and the publish.sha256
inf3r-cachestate/cacheThe host KV ledger, tiers, WAL, CRC32C, and eviction.sha256, rustix
inf3r-bundlestate/bundleThe bundle anatomy, the manifest, and the digest.sha256
inf3r-bindedge/bindThe binder for a bound engine.sdk, proto
inf3r-corerun/coreDiscovery, routing, admission, residency, and the cache host.proto, sched, supervisor, state, cache
inf3r-schedrun/schedThe queues, the deadlines, the eviction, and the switch.host, ledger, catalog
inf3r-supervisorrun/supervisorStart, drain, swap, restart, stop.sdk, ledger
inf3r-textformat/textToken, tokenizer, template, stop set, and sampling.none
inf3r-audioformat/audioPCM, rate, channels, transcript, mel, VAD, resample, and wav.none
inf3r-imageformat/imageFrame, pixel format, colour, tile, and png.none
inf3r-videoformat/videoTimebase, clip, and container.none
inf3r-gguffiles/ggufThe GGUF metadata, tensor index, and bounded tensor window.none
inf3r-safetensorsfiles/safetensorsThe safetensors reader.none
inf3r-sha256files/sha256The one streaming SHA-256.none

Rules for the crates:

  1. No crate contains a model name.
  2. format/* and files/* are leaves. They have no dependencies.
  3. No crate contains unsafe. Every crate denies unsafe_code, and there is no exception inside this workspace. Section 20.3 gives the one rule that an FFI dependency must meet. A bundle is not a crate here (D19).
  4. The core links no plugin, no model runtime, and no HTTP server. cargo check -p inf3r-core must not pull CUDA or TLS. Requirement R11.

A bundle is a package but not a member of this workspace. Its Cargo.toml declares [workspace], its own literal package fields, its own lints, and path dependencies into crates/. Cargo writes a Cargo.lock beside that manifest. Adding, removing, or replacing a bundle changes no root member, no root lock, and no engine build. CI still builds and tests every bundle by manifest. D19.


19. Requirements

Core behaviour

API shape

The peer protocol

Bundles


20. Rules of the system

  1. No model name in crates/. No bundle name and no engine name either.
  2. No bundle depends on another bundle. Sibling targets of one model do not depend on each other.
  3. Dependencies point one way. Section 18 gives the table.
  4. unsafe only with a stated reason. Section 19, R11, and decision D8.
  5. The scheduler never batches. The engine never admits.
  6. The core never interprets model internals, sampling settings, or names.
  7. No bundle is privileged. A hand-written CUDA engine and a wrapped upstream are the same citizen.
  8. The core contains no HTTP, no auth, and no JSON.
  9. The web contains no scheduling, no residency, and no device knowledge.

20.1 The freeze contract

The API has no version number. A version number exists so that one server can serve two shapes at once. inf3r does not need that. The engine, the web, the cli, and the clients move together. Thus inf3r gets the effect of a version from these rules instead. CI enforces them.

  1. A published capability name never changes meaning. chat means one thing forever.
  2. A new input is optional. The default value of a new input reproduces the old behaviour. A new required field is not permitted.
  3. A default value never changes.
  4. A reader ignores an unknown part kind, an unknown channel, an unknown parameter, and an unknown event field. It does not fail.
  5. params stays opaque to the core. Growth then costs no schema change.
  6. A break gets a new name. The new name describes the shape, not an ordinal. The name v2 is not permitted. A new task gets a new capability name and a new route.
  7. A retired name keeps answering. Or it answers with a refusal that names its replacement. A silent removal is not permitted. A capability key is a name; its canonical route is transport spelling. The two are related but not the same string. The route table in section 7 is the complete list.
  8. The six nouns in section 6 are additive only. A new field in a noun is optional. A noun never changes meaning.

The plugin socket keeps its version. The reason is different. A plugin is a separate binary. A user can pin it. The core and the plugin are not released together. Thus protocol {min, max} with interval overlap is correct there. The rule is: version where the artifacts decouple. Do not version where the releases are joint.

20.2 No magic numbers

A value in the code is a bug unless it is one of these:

  1. Measured. The engine observes it. The user cannot set it.
  2. Declared. The plugin author states it as a fact about the model and the target: load time, bytes, context, concurrency.
  3. Intent. The operator states it as a word: pinned, warm, interactive, always, never.
  4. A named resource. A bound that protects a physical limit, and the comment names the limit. Examples are a 24-bit length field, one allocation, and one socket read.

Config holds intent only. It never hides an engine decision.

The test: could the engine observe this instead? If yes, it is a bug. If it is the operator's preference, it is a word. If it is the author's fact, it is in the catalogue.

20.3 No unsafe

Every crate under crates/ denies unsafe_code. There is no exception, and no crate in the engine workspace opts out.

A bundle is its own workspace (D19). It starts from the same deny rule, but a kernel or FFI bundle may set unsafe_code = "allow" in its own [lints.rust] when the unsafe is the engine that the bundle exists to carry. The bundle says why in a comment. The boundary is the bundle manifest: inf3r bundle verify checks the anatomy and the digest, and inf3r verify checks the wire. Nothing in crates/ becomes unsafe to support it.

A dependency that must cross into FFI is allowed in the engine workspace when all four of these hold. It is pinned exactly. It exposes a safe API. It is needed for something the standard library cannot do. Its version is written in the root Cargo.toml with a comment that says why.

The dependencies that meet this bar are few. Descriptor passing is the first: rustix gives sendmsg and recvmsg with owned descriptor buffers, so a received descriptor is closed by a drop. There is no place in this tree where a raw descriptor number is constructed or forgotten.

Memory mapping does not meet the bar. A safe file-mapping API cannot promise that another process will not truncate the file, so the safe crates keep the mapping call unsafe. The engine therefore reads weights and media through a bounded offset window: inf3r-gguf::Window, TensorWindow, and PartReader. A bundle that wants a mapping pins its own crate and owns the unsafe inside its own workspace.


21. Build, test, and release

21.1 Build

./ops/build.sh release

The script builds the engine workspace and then every bundle with its own manifest, into one target directory. The root command alone does not build a bundle: a bundle is not a workspace member (D19). The toolchain is Rust 1.99.1. The edition is 2024. The resolver is 3. Cargo.toml uses exact pins only. An update is deliberate. It is never drift.

21.2 CI

The CI steps are scripts in .f0rge/ci/steps/. The filename order is the run order. Exit 0 is a pass. The first non-zero exit fails the run. The runner is local because the container gate needs the host Docker socket; ci.env names the target directory and the uv path. The host executes the engine-neutral crates and the in-repo fixtures (mock, toy, echo). An external engine bundle is never executed on the host; its container image is the gate.

00_tools.sh    make uv available; CI installs it into the target cache when
               the host lacks it
01_fmt.sh      cargo fmt --check in the workspace and in every bundle
02_clippy.sh   cargo clippy --all-targets -- -D warnings in both
03_check.sh    cargo check/test in the workspace; fixtures test on the host,
               external bundles compile only
04_shape.sh    the shape rules that a review forgets, and capability-shape goldens
05_goldens.sh  the engine goldens, the bundle goldens, the fault injector, and the gate
06_build.sh    build the engine and every bundle, then every bind in the deploy file
07_release.sh  copy the release binaries
08_image.sh    build the control image, build and check the mock bundle's own
               self-contained image, record the digests, and run the gate
               against the final image; a host without docker fails
09_bundles.sh  every plugins/<model>/<target> has the five parts and a golden,
               ignores model/, tracks no weights, and matches its digest;
               fixtures run a host golden, external engines stay container-only
10_install.sh  stage both binaries and the unit from a checkout and a release
11_compose.sh  start the compose control and its sibling mock engine, check the
               healthcheck, token/state restart, and container gate

21.3 Image

The control image's Rust, Debian, and uv bases are digest-pinned in docker/Containerfile, repeated in docker/control.lock, and carried as org.inf3r.control.base.* labels that 08_image.sh records in target/control.lock and checks.

ops/images.sh build <bundle-id> builds one self-contained bundle image from that bundle's own Dockerfile. The recipe lives inside the bundle directory; the host chooses no engine, language, base, binary, or pin. The generic builder stages only that bundle plus the shared SDK workspace (Cargo.toml, Cargo.lock, crates/), excludes model/, builds inside Docker, and tags inf3r/<bundle-id>:sha-<12> from the staged-context digest. Two bundles that use the same upstream engine each build and ship their own copy.

The build context contains source and build files, not weights: the staging scan refuses the bundle's model/ path, symlinks, unambiguous weight names, ambiguous weight names above 1 MiB, and weight-like magic before Docker sees the context. It does not impose an engine-file extension allowlist; a bundle may contain C, C++, Rust, Python, headers, CMake files, patches, or lockfiles. The whole final image is scanned again for a bundle model/ directory, unambiguous weight names, and ambiguous weight names above 1 MiB.

The final tag, image id, and source digest are recorded in ${CARGO_TARGET_DIR:-target}/images.lock. ops/images.sh check <bundle-id> recomputes the source digest, compares it with the lock and the image's org.inf3r.source.sha256 label, checks the bundle id and binary labels and the image id, and scans the whole image root for a model/ directory or a weight-like file. A failed Docker run, shell, or find is an error, not a clean scan. ops/images.sh tag <bundle-id> prints the final reference for a deploy caller.

08_image.sh runs the pipeline for mock/x64-cpu and then starts that final image through the container gate. The control verifies a container image before it starts the sibling: it refuses a bare or :latest reference, and it compares the image id and org.inf3r.source.sha256 label with INF3R_IMAGES_LOCK when that variable names a lock. Compose mounts target/images.lock at /opt/inf3r/images.lock; the CLI finds the lock in ${CARGO_TARGET_DIR:-target}/images.lock unless the variable overrides it. Adding a bundle with an arbitrary engine requires edits only inside plugins/<model>/<target>/; the host tooling never maps a bundle to a shared engine base. An image is built from local pinned inputs; the control never pulls one at request time.

21.4 Release

  1. f0rge release create <version> --notes <file|-> writes the note and runs the build scripts.
  2. The release build copies target/release/inf3r-web, target/release/inf3r, the unit, and install.sh into releases/build/<version>/.
  3. The install command is ./install.sh <version>, or cargo install --locked when the repository has no install script. The checkout root has a wrapper that runs ops/install.sh; the release copy is the same script beside the binaries. It installs both binaries and the unit. DESTDIR stages them without creating the service account.
  4. The engine has no install step of its own. A plugin is installed by its own package. The core finds it below bundle_dirs.

A release has two parts. The release directory holds inf3r-web, inf3r, inf3r-web.service, and install.sh. The source distribution holds the host tooling, the fixtures, and the docs. Together they are the host product: its binaries, service and install files, fixtures, and documentation. Neither part holds a real-model bundle, a weight, an engine library, a built bundle image, or a registry of bundles. An operator builds and deploys those separately.

21.5 Logging

  1. The core writes one line for each decision. The line has the request id, the job id, the reason, and the decision.
  2. A log line is JSON. It goes to stdout.
  3. The log does not contain a token, a prompt, or an image.

22. Operations

The cli is the process inf3r. It is a client of the web. It does not import the core.

CommandBehaviour
inf3r psList the bundles, the processes, the devices, the models, and the residency state.
inf3r queueList the queues, the depth, the priorities, and the oldest deadline.
inf3r new <model> <target> <capability>Make a bundle. Requirement R17.
inf3r bundle verify <dir>Check the five parts and the digest. Exit 1 on a problem.
inf3r bundle seal <dir>Compute the digest and write it into bundle.toml.
inf3r verify [--program <path>] [--budget <time>] [--load-budget <time>] [--job-budget <time>] [--suite <file>]Run the binding gate against one bundle.
inf3r verify --container <id> --deploy <file> [--image <ref>] [--socket-dir <dir>] [--socket-host-dir <dir>]Start the container bind, or the named image, as a sibling Docker container and run the same gate over its private socket. The host dir is the daemon-side mount path.
inf3r reload [bundle]Run discovery again. Reload one bundle or all bundles.
inf3r doctorCheck the host, the deploy file, the bundle manifests, the token, and the blob store.

Rules for the cli:

  1. A command prints a table for a human. The option --json prints one object.
  2. A command exits 0 on success. It exits 1 on a condition that the user must correct. It exits 2 on a usage error.
  3. doctor does not change state. It only reports.
  4. --socket names the local Unix socket. --tcp host:port names the remote listener. A TCP command carries --token or --token-file; a Unix command does not.
  5. ps reads GET /stats and prints the bundles, their processes, the devices, the models, and the residency rows.
  6. reload sends POST /reload. An empty object reloads every bundle; a bundle string reloads one bundle. A sibling bundle keeps its process.

23. Add a bundle

The steps for a new pair:

  1. Pick a model and a target.
  2. Run inf3r new <model> <target> <capability>. The command writes the five parts of section 5, the target file, the model file, and the goldens. To copy a bundle that already passes is also correct.
  3. Put the engine in place. An authored engine goes in src/. A bound engine goes in engine/, and src/main.rs is the one-line binder entry point. Build the bundle in its own workspace, or run ./ops/build.sh release.
  4. Put the weights in model/. The directory stays out of git. Add the file name to the model file, or name an absolute path in deploy.toml.
  5. Edit target.toml to the hardware that the engine was built for. Edit bundle.toml and BUNDLE.md to match.
  6. Run inf3r verify --weights <file>; for a container bind, run inf3r verify --container <id> --deploy deploy.toml. Run the bench.
  7. Bind the bundle id in deploy.toml. Set the devices, the memory, the sharing, and the residency.
  8. The core discovers the bundle. Then it routes to it, queues for it, and switches it in and out.

The steps change no file in crates/. The steps do not rebuild the core. Requirement R13.

The workflow for an agent is the same steps from 3 to 6. The agent replaces the engine inside one directory, runs the gate and the bench, and stops when the numbers are better. The bundle id, the deploy file, and the client stay the same. Decision D14.

The test of this rule is the closure rule:

A new modality adds vocabulary. A new modality does not add a shape.

The steps for a new capability:

  1. Add one capability page under .f0rge/wiki/docs/capabilities/. The page gives the parts, the parameters, and the channels.
  2. Add one or two rows to section 7.
  3. If necessary, add one adapter route.
  4. If necessary, add a manifest key.

The steps do not change the types in inf3r-api, the code in inf3r-sched, the code in inf3r-server, or the frame set. A new frame type is a protocol change. A protocol change needs a version increase.


24. Non-goals

  1. Training, fine-tuning, quantising, and weight download.
  2. A graphical interface.
  3. Cross-host distributed inference in version 1.
  4. LoRA hot-swap.
  5. Windows.
  6. A shared tensor API or a shared kernel API. They are deliberately absent.
  7. Core and web as separately deployable services.
  8. Accounts, quotas, and CORS.
  9. Benchmark history and comparison across plugins.
  10. A URL part in the API. The client must upload the bytes.
  11. Server-side fetch of remote media.

25. v1.0 state

This section gives the state of the host and tooling. It is not a bundle catalogue.

ItemState
WorkspaceThe engine workspace is crates/*/*. edge, state, run, files, and format are written. Every crate has tests. Every bundle is a separate workspace (D19).
Core binaryNot separate. crates/run/core is a library; inf3r-web holds it. Decision D11.
Web binarytarget/release/inf3r-web. It reads deploy.toml, checks every target profile, starts every bind, and serves HTTP and SSE.
Plugin SDKThe Plugin trait, serve(), the emitter, the catalogue, and --describe. The cache codec and transport are in the same crate.
KV cachecrates/state/cache: per-st_dev authority, ordered RAM/disk tiers, economic demotion and second-hit promotion, disk/RAM pressure hooks, CRC32C WAL and snapshot, TTL, pins, supersession, and metrics. Wire 2 carries cache frames as descriptors. The compatibility binder uses the optional /inf3r/cache bridge; a runtime that does not advertise it runs uncached. A direct library bundle can implement the same codec in its own src/.
BundlesThe contract is plugins/<model>/<target>/ with five parts, its own workspace, and its own image recipe. The repository carries test fixtures: mock/x64-cpu (twelve capabilities, no weights, no device, authored), toy/x64-cpu (a real decoder over a generated GGUF, authored), and echo/x64-cpu (a Python runtime behind one line of Rust, bound). A real model bundle is operator content, not a release artifact.
Bundle crateinf3r-bundle: the manifest, the five parts, the anatomy check, the digest, and seal. The digest never reads model/.
Binderinf3r-bind: reads bundle.toml, every model file, and its aliases; serves all twelve capability names through the neutral binary bridge and the seven OpenAI-shaped plus five neutral HTTP bridges; starts a one-shot or resident (worker = "jsonl") binary or an HTTP runtime; and declares the lifecycle words that the runtime can keep.
Goldenscrates/test/goldens: record, replay, and diff the first difference. plugins/*/*/goldens/ holds plugin goldens.
Gateinf3r verify starts a binding, checks the handshake, the catalogue, --describe, one job per suite step, extension immunity, cancel, credit replenishment, a descriptor input part, a descriptor output artifact, crash, and restart. A cache-capable binding also gets cache_fingerprint, cache_roundtrip, cache_cold_erase, cache_corrupt_fallback, and cache_abort_on_crash against a real temporary store. goldens/conformance.json is the default step list; --suite reads a bundle's own. The whole run, the load, and one job have separate deadlines. With --container, the same checks run over a sibling container's private socket; cache_cold_erase runs in container mode because the trace file lives in the one private socket directory; cache_abort_on_crash is the only skip because its fault mode is a host-process fixture.
CITwelve local steps: tools, format, clippy, check and test, shape and capability-shape goldens, engine and bundle goldens, build, release, image and the mock container gate, bundles, install, and the compose control plus sibling engine proof. The host runs engine-neutral crates and in-repo fixtures; an external engine runs only in its container.
Docs.f0rge/wiki/docs/{index,spec,protocol,core,binding,bundle,ops,plan}.md and twelve capability pages.
Protocol grammarspec/protocol.cddl; crates/edge/proto implements it.
BacklogThe forge holds the issues. The roadmap in section 26 D-numbers is settled.
Residencypin, warm, idle_unload, LRU on no_room, and a switch with an edge per step. Unload is process death (D13).
Not presentA weight file in git, in an image, or in a digest. An engine library belongs to its own bundle image, never to the repository or the host; weights and runtime builds are operator mounts.

cargo test --workspace is the engine acceptance test. Each bundle also runs its own tests in its own workspace. inf3r-web starts the mock and answers a streamed chat in crates/edge/server/tests/engine.rs. 09_bundles.sh refuses a directory under plugins/ that is not a bundle.


26. Decisions

All decisions are settled. A later change is a new decision with a new number.

D1 — encoding. CBOR, grammar in spec/protocol.cddl, JSON mirror for conformance only.

D2 — bulk data. A file descriptor at the peer hop, a blob reference at the API hop. The core substitutes. No URL.

D3 — submit route. POST /jobs is generic. POST <canonical route> is the same handler with the capability key filled from the path. Section 7 is the one route table.

D4 — SDK concurrency. Synchronous. One worker per job, one reader thread per peer, no async runtime.

D5 — ledger unit. A load reserves the declared weight bytes plus context × kv_bytes_per_token, both declared in the catalogue. A target that declares a split resident set charges only its vram_bytes to the selected devices and checks its ram_bytes against the child's host RSS. A job reserves nothing extra. Unload releases exactly the reserved bytes.

D6 — template and tokenizer. Both in the plugin. format/text gives the engine five turn layouts, a marker detector for a GGUF chat template, a GPT-2 byte BPE that uses the byte-to-Unicode spelling, and a SentencePiece BPE that reads add_space_prefix. format/vocab reads both from the model metadata.

D7 — rerank. Separate from embed.

D8 — target crates. Removed. Kernels live in plugins. crates/ holds no device code.

D9 — home of the six nouns. A new leaf crate crates/edge/proto (inf3r-proto) owns the nouns, the framing, the codec, the descriptor helpers, and credit. edge/sdk is the traits and serve(). The core depends on proto and not on sdk.

D10 — capability names. The short names in section 7. A published name is permanent.

D11 — one process for core and web. The core is a library and inf3r-web holds it. A second process would add a hop that carries the same frames, and the web already speaks them. A separate core needs a reason that this host does not have: a GPU host serves one node. Section 24 rule 7 keeps the split as a non-goal, so this decision matches the non-goal instead of contradicting it.

D12 — the unit is the pair. One (model, target) per process. A per-pair binary can carry a template, a stop set, and a sampler default that would be wrong for another model. The ledger holds one reservation per process and a crash isolates to one model. An engine that serves many models is bound as several processes, not one.

D13 — unload is process death. The core stops the child, releases the reservation, and lets the kernel free the memory. No unload frame enters the protocol. A runtime cannot fail to free memory that it does not keep. The cost is reload time, and that cost is why pin, warm, and idle_unload exist.

D14 — the unit is the bundle. One model on one target is one directory: the weights it needs, the engine that runs them, the hardware profile it was built for, and the facts it declares. Adding, replacing, or deleting a pair is a directory operation. The id is the pair, so a new engine in the same directory keeps the bind and the client unchanged. Nothing in crates/ names a model, a bundle, or an engine.

D15 — the entry point is a package; the engine is free. Every bundle has one cargo package at its root, because cargo needs one entry point to build and the gate needs one process to start. The engine behind that entry point is any language, any binary, any library, or an authored implementation. A bound bundle's entry point is one line of Rust; its engine is not Rust. A bundle with no Rust at all is still possible over the raw protocol, and the gate judges it the same way.

D16 — the weights are content. model/ is part of the bundle but never part of the repository, the image, or the package digest. An operator mounts it. A bundle without its weights is a complete bundle; it is not loadable until the file is present. The deploy file is the only authority on which weight file a host mounts.

D17 — the target profile is authority. target.toml states the hardware that the bundle was built for: arch, backend, compute capability, driver floor, and the memory of each selected device. The host checks every field before spawn, against the bind's devices rather than every card in the machine. A mismatch refuses the bundle with the field, the required value, and the measured value. There is no silent downgrade and no warning-only mode.

D18 — a capability is not a Rust trait. The capability page and the catalogue are the contract. inf3r-plugin-sdk exposes one untyped Plugin::run(capability, request, emitter), so a bundle in any language reads the same parts. The typed per-modality crates were removed because no process used them, and each would duplicate a wire shape that the page already owns. A typed helper may live inside one bundle; it is not a shared crate.

D19 — a bundle is a standalone workspace. The root workspace holds crates/ and nothing else. Every bundle declares [workspace] in its own Cargo.toml, keeps its own Cargo.lock, and reaches the engine crates by path. A new bundle adds no root member, no root lock entry, and no root build step. CI still builds and tests every bundle by manifest, because a bundle that does not build is not a bundle. The unsafe boundary follows the same line: engine crates deny unsafe_code without exception, and a kernel or FFI bundle may opt out in its own manifest with a stated reason. The bundle boundary is the manifest, the digest, and the gate, not a shared lint table.

D20 — a weight is read through a window, not mapped. The engine reads a weight or media descriptor at an offset through a bounded window. It does not map the descriptor. A safe file-mapping API cannot promise that another process will not truncate the file, so the safe crates keep the mapping call unsafe and no engine crate can call it. inf3r-gguf::Window parses the index once and reads only the tensor, TensorWindow bounds a safetensors tensor, and PartReader bounds one input part. A bundle that wants a mapping pins its own crate and owns the unsafe in its own workspace (D19). The wire stays the same.

D21 — one deploy file is one host. A deploy.toml describes one host and has exactly one [[node]]. A second node is refused. Two hosts have two files; the operator starts one server per file. web may name unix, tcp, or both, and both listeners share one core, one stop, and one connection cap.

D22 — KV cache is a core resource. Core owns the cache ledger, tiers, TTL, pins, and eviction in crates/state/cache. A bundle owns only its codec and slot table. A per-bundle quota or proxy recreates the old broker with no global truth. R35.

D23 — cache crosses the wire only as descriptors. Wire 2 reserves 0x20..=0x27 for cache frames. A lookup returns a read descriptor; a reserve returns a writable temp descriptor; a commit returns only metadata. No path, hash, or prompt text crosses the socket. Wire 1 peers negotiate down and never see a cache frame. R36.

D24 — prefix chains, lineage, and cold erase. A key is an opaque 32-byte prefix boundary, sent longest-first. A committed tip may supersede its parent; two lineages promote a shared parent to an anchor. checkpoint_exact models never roll back. A miss erases the slot unconditionally. R37.

D25 — flush is bounded and before death. Unload sends cache_flush with the operator's budget, then kills the child whether or not the flush finished. Write-behind normally makes the flush empty. The cache never delays D13 beyond its budget. R38.

D26 — one disk authority. Core refuses two tiers on one st_dev and holds an abstract socket plus a tier flock. Strata and any foreign disk cache must route through this ledger or be disabled. Pinned bytes count against both the tier bound and the global pin bound. R39.

D27 — the engine cache bridge is optional and is never faked. A bound engine may advertise GET /inf3r/cache and implement one-slot save, restore, erase, and an optional prefix checkpoint. The binder uses the bridge when advertised and runs uncached otherwise; it never injects a vendor flag or calls a vendor route. A prefix checkpoint is used only when the engine advertises it; an engine without the operation never receives a request that pretends it exists. The bridge is engine-local HTTP, not Wire 2, and it never chooses a key, tier, TTL, pin, or eviction policy.

D28 — Docker is the engine runtime; the control container is trusted and the engines are not. Docker, and only Docker, runs engines. Rootless Docker is the target runtime; Podman is out of scope. The control container runs inf3r-web and holds the host's rootless Docker socket. It is the trusted orchestrator: it starts, measures, and stops engine containers. A separate host-side launcher is rejected because it adds another privileged process without removing the control plane's authority over jobs, state, and scheduling. The Docker socket is never mounted into an engine container.

An engine container is a sibling, not a child: one bundle instance per container, --network none, --read-only, a writable --tmpfs /tmp, --cap-drop ALL, --security-opt no-new-privileges, and only the CDI devices that the bind names. It never receives the Docker socket, the host cache directory, the control process's file descriptors, or another bundle's socket directory. The image contains the plugin and its engine libraries, never a weight file (D16/R32).

The control container and every engine run as container root (0:0) under rootless Docker. Rootless Docker maps that root to the unprivileged host uid that runs the rootless daemon, so SO_PEERCRED reports the same uid on both sides and the existing peer-uid check keeps its meaning. Container root is not host root: the capabilities are dropped, the root filesystem is read-only, and no host path is writable except the one private socket directory. The rootless Docker user namespace maps container root to the unprivileged host uid that runs the daemon. A non-root container uid maps to a subordinate host uid instead: measured on one rootless host, container root 0:0 wrote as host 1000:1000, container 1000:1000 as host 100999:100999, and container 65534:65534 as host 165533:165533. The subordinate numbers are host-specific. A non-root container would need a socket mode wide enough for its subordinate uid, while the control's peer-uid check expects the daemon uid, so the first container tranche keeps 0:0 for both sides.

A private socket directory is created per engine instance as /run/inf3r/<instance>, mode 0700, owned by the control uid. Only that directory is mounted into its engine, at the same path. The socket file is created inside it with a 128-bit random name and mode 0666; the directory's mode and the fact that siblings do not receive the mount are the access boundary. The random path is the launch token: it is passed to the plugin as --socket <path> and exists nowhere else. Filesystem sockets replace abstract sockets because an abstract name does not cross a network namespace. The control closes the listener and removes the instance directory before it asks the container to stop, so a restart cannot find the old socket; the container stop/remove then runs even if the Docker CLI already exited.

Weights cross the container boundary as read-only descriptors over Wire 2, not as host paths. The control opens each deploy-named weight file, and a directory model is passed as one directory descriptor; the grant's path field is empty in container mode, so the engine names the object through /proc/self/fd/<n>. This keeps D2/R22 and D16/R32: the bytes do not cross the socket and no weight path enters the engine. Media and KV-cache descriptors use the same mechanism. Process mode keeps the existing path-bearing grants.

The control has no GPU and a separate PID namespace. It learns a container's host pid from Docker, and a generic probe helper container (built by the image pipeline, with host PID visibility and nvidia.com/gpu=all) supplies GPU totals, per-host-pid VRAM, and process-tree resident bytes. The probe asks for all cards, not the subset that one bind names: CDI renumbers a subset, so a probe that received only cuda:1 would see it as cuda:0; all preserves the host indices that the deploy file and the ledger use. The engine still receives only the device that its own bind names. Host::probe, the D17 profile check, verify_devices, and the VRAM settle use that probe in container mode and the local probe in process mode. The probe is an implementation of the existing Host/Memory seams, not a second ledger.

Images live in the local rootless Docker store and are built from pinned source tags or commit SHAs. Every bundle owns its complete image recipe inside its own directory; the final image is tagged inf3r/<bundle-id>:sha-<12> and is referenced by its sha256: digest in the deploy record; latest is never a runtime reference. There is no shared engine base and no central engine registry. The control never pulls an image at request time. ops/images.sh records the final digest and source digest in target/images.lock; the image labels carry the bundle id, binary, and source digest. The control and the CLI gate refuse a missing, mismatched, or unpinned image before a container starts; the deploy parser only validates the reference spelling.