inf3r — the brief

docs/index.md · wiki index

inf3r — the brief

This page is the original brief. It is not the specification. Where the two disagree, spec.md is right. Section 5 of spec.md is the normative text for the bundle tree.

Everything is a bundle. A bundle is one directory for one model on one target: the weights, the engine that runs them, the hardware profile, and the facts it declares. It is the unit of work, the unit of replacement, and the unit an agent is given. The engine inside can be authored in Rust for speed, or bound from a runtime that already exists, in any language. The protocol exists so that the engine can be anything. The bundle exists so that the protocol has a unit.

inf3r ships the host, the protocol, the bundle contract, the SDK, the host tooling, and test fixtures. It does not ship model bundles, weights, engine images, or a registry of them. A real bundle is end-user content: an operator creates it under plugins/<model>/<target>/, owns its engine, pin, and image recipe, and deploys it. The fixtures exist to prove the protocol and the gate.

What it is. An inference engine addressed by model and target. You point it at one model and one inference target; it runs that pair, alongside as many others as the machine can hold. Every modality is supported — text, embeddings, speech in and out, music, images, video, typed decisions — as capabilities a model declares, not as separate entry points.

What it is for. Hosting any engine per (model, target) pair so that a strong agent or author pointed at one bundle directory can beat generic multi-model engines. inf3r is not an engine integrator — it provides the shared host infrastructure (protocol, routing, VRAM ledger, residency, shared KV cache, verification gate, and benchmark loop). Inside one bundle directory, binding a premade runtime (library FFI, or binary/http via inf3r-bind) is the cheap bootstrap baseline; writing or specializing custom kernels (Rust, CUDA, or any language) in that same directory is the payoff. A reference is a reference, not a host dependency: wrapping it to set a baseline and rewriting it to beat that baseline are the same move. No shared engine layer in crates/, no tensor abstraction, no kernel library, no mandated runtime, no mandated language.

Components

ownsbinary
corediscovery, catalog, ledger, admission, residency, switching, supervision, the peer protocolinf3r-core
webHTTP, auth, wire encoding, SSE, OpenAI and native surfacesinf3r-web
bundleone model on one target: the engine, the weights, the profile, the factsinf3r-<model>-<target>
clioperator commands: ps, queue, new, reload, doctorinf3r

Core and web ship in one control container and are not supported running apart. A bundle engine runs in its own sibling container (D28), never in the control. The boundary exists to keep HTTP, auth and JSON out of the engine. The web is a client of the core over the same framed protocol plugins use.

crates/format/* holds the data vocabulary for a medium — PCM, tokens, frames, clips — and has no plugin trait. A capability is wire vocabulary, one page under .f0rge/wiki/docs/capabilities/, and one entry in the catalogue. It is not a Rust trait, because the engine behind a bundle may be any language.

Core

discoveryscan bundle directories, read --describe
routingmodel name + target → plugin; capabilities checked
admissionper-device priority queues, deadlines, bounded, refusal with a reason
residencypin / warm / idle_unload, LRU eviction that waits for idle
switchingdrain → unload → reserve → spawn → load → ready, under a device lock
reservationbyte ledger per device, atomic across devices, all-or-nothing
lifecyclespawn, handshake, health, restart with backoff, circuit breaker, reap
protocolone framing, two roles: plugins serve, fronts and the CLI call
observabilityone request id across the boundary; every decision logged

Web

Listen. A Unix socket and a TCP listener. Either can run alone, and both can run at once. Unix socket HTTP serves local use with a peer-uid check; TCP on the tailnet uses a bearer token. One token, from config, compared in constant time. No accounts, no tenancy, no sessions.

Endpoints. The canonical capability routes are the twelve paths in section 7 of spec.md; POST <canonical route> is one of those paths.

endpointcapability requiredbodyresponse
POST <canonical route>that capabilitynative jobSSE or one object
POST /openai/v1/chat/completionschatOpenAI chatSSE chunks, [DONE]
POST /openai/v1/embeddingsembedOpenAI embeddingsJSON
POST /openai/v1/audio/speechttsOpenAI speechchunked audio
POST /openai/v1/audio/transcriptionssttmultipart file and fieldsJSON, text, or verbose JSON
POST /openai/v1/images/generationsimage-genOpenAI imagesJSON, base64
POST /openai/v1/images/editsimage-editmultipart image, mask, and promptJSON, base64
GET /openai/v1/models——served names as OpenAI models
GET /models——catalogue rows: served name, plugin, capability names/vocab/degraded/cancel
GET /capabilities——the twelve static rows: name, route, parts, channels, stream
GET /jobs——job rows and the running count
GET /stats——peers, engines, devices, blobs, cache
GET /healthz——liveness, no auth

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.

Lifecycle of a request. Parse → auth → validate → resolve model name to plugin → check capability → submit to core → translate frames to the endpoint's wire shape → close. Every request carries x-request-id, echoed on the response and logged by the core and the plugin.

Refusals. The core's reasons map to HTTP, never to a hang:

reasonstatus
unknown_model404
capability_missing400
queue_full429 + Retry-After
no_room503 + Retry-After
load_failed503
plugin_crashed502
mismatch500, config error
timeout504

Streaming. SSE framing is exact: data: <json>\n\n per chunk, data: [DONE]\n\n once at the end, : ping keepalives during prefill, an error chunk if the failure happens after headers. Non-SSE endpoints use chunked binary. A client disconnect is propagated to the core as a cancel frame, and the plugin stops within one step.

Limits. Body size, a read timeout, a total deadline for the request head, a write timeout, and a cap on concurrent connections. Above the cap is 503. Multipart is parsed only for transcriptions. No CORS, no compression, no caching.

A bundle provides

Names and configs

filequestion
plugins/<model>/<target>/bundle.tomlwhat is this bundle, what engine does it bind, and what is the digest?
plugins/<model>/<target>/target.tomlwhat hardware was this bundle built for?
plugins/<model>/<target>/models/*.tomlwhat can this bundle serve? name, weights, quant, sampling, template, stop sets, aliases
deploy.tomlhow does this host run it? web listener and token, bundle bindings, devices, budget, sharing, residency
Cargo.tomlhow is the entry point built?

Names are the user's. The bundle id is the directory path the user chooses, and uniqueness is that path; the core never derives a name. The five parts are the bundle contract, not a convention: CI refuses a directory that does not have them. Quantisation is part of the name only if the user puts it there. Sampling is opaque to the core and to the web. The weights live in model/, are mounted by the operator, and never enter git or an image.

Device sharing is config, not policy: per host, per device, exclusive or time-sliced.

Adding a bundle

1. pick a model and a target
2. inf3r new <model> <target> <capability>   or copy a bundle that passes
3. engine in src/ (authored) or engine/ (bound) + one line of binder
4. weights in model/                        mounted, never committed
5. target.toml, models/*.toml, bundle.toml, BUNDLE.md
6. inf3r verify --weights <file>            then bench
7. bind the bundle id in deploy.toml        devices, budget, sharing, residency
8. core discovers it, routes to it, queues for it, swaps it in and out

No change to crates/. No core rebuild. To make the pair faster, replace the engine inside one directory, run the gate and the bench, and stop when the numbers are better. The bundle id and the client stay the same.

Rules

  1. No model names 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: edge → run → state. format/* and files/* are leaves; plugins may depend on all of them.
  4. unsafe only in target/* and kernel crates, each with a stated reason.
  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, no wire types.
  9. The web contains no scheduling, no residency, no device knowledge.

Requirements

Non-goals

Training, fine-tuning, quantising, downloading weights. A UI. Cross-host distributed inference in v1. LoRA hot-swap. Windows. A shared tensor or kernel API — deliberately absent. Core and web as separately deployable services. Accounts, quotas, CORS. Benchmark history and cross-plugin comparison.

Status

The engine runs: twelve capability routes through a real binary, a conformance plugin, a Python plugin with no SDK, a fault injector, a binding gate, and a release script. The current state is section 25 of spec.md; what is left is plan.md.

This page is the original brief. It is not the specification.

DocumentPurpose
bundle.mdThe bundle pattern: why the pair is the unit, the anatomy, the archetypes, the rules.
spec.mdThe system specification. The tree, the API, the rules, the freeze contract.
protocol.mdThe peer protocol, wire 2. Normative.
plan.mdThe build order, the milestones, and the definition of done.
core.mdThe core as state tables: peer, residency, ledger, job, schedule, pump.
ops.mdThe install layouts, the first run, the signals, and the container.
binding.mdHow to bind an engine, write one, and pass the gate.
capabilities/One page per capability: parts, parameters, channels, usage.
spec/schema.mdThe f0rge file format. It is not an inf3r document.
spec/protocol.cddlThe machine grammar of the peer protocol.

This file and spec.md disagree. Use spec.md. Requirements R1 to R40 and the decisions D1 to D28 are in spec.md.