open-standards/mesh
Repository files (latest commit first)
Filename Latest commit message Latest commit date
David Charlot ab5f508023
All checks were successful
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 2m34s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 1m21s
standards workspaces build + test / aac-rs (pull_request) Successful in 2m37s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 55s
standards workspaces build + test / map-rs (pull_request) Successful in 56s
standards workspaces build + test / mesh-rs (pull_request) Successful in 54s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 47s
standards workspaces build + test / openpay (pull_request) Successful in 3m8s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 4m43s
lockfiles / every Cargo.lock is current (pull_request) Successful in 34s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 5s
no-vanity-metrics / WAI public text names no comparison (pull_request) Successful in 4s
no-vanity-metrics / WAI public text names no company or product (pull_request) Successful in 3s
no-vanity-metrics / No new orphan source files (pull_request) Successful in 7s
spec citations resolve / Code cites no section its SPEC lacks (pull_request) Successful in 7s
standards workspaces build + test / arl-rs (pull_request) Successful in 1m15s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m58s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m34s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 1m11s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 1m12s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m26s
standards workspaces build + test / sense-rs (pull_request) Successful in 1m14s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m24s
tests in CI / every test file is run by a job or listed with its reason (pull_request) Successful in 3s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m56s
mesh: the identity rides the whole path, and the keys it adds are exactly two
The receipt-level test pins that the identity changes the sealed bytes. This
one pins the path: two meshes differing only in whether the engine reports
what ran, same recipe name on both, and the envelopes must differ. If the
identity were carried but not sealed they would match, and a verifier
comparing signatures could not tell a receipt bound to these weights from one
bound to any others.

It also asserts the added keys are *exactly* `precision` and `weights_digest`,
which catches an extra key as well as a missing one — the same assertion shape
the delivered-fidelity test uses, and the reason that test is worth copying.

Falsified three ways, each caught at a different assertion:
  - projection removed      → the wire assertion fires
  - digest projected as a constant → the hex assertion fires
  - wire keeps it, `signed_core_bytes` drops it → the signed-core assertion
    fires, which is the "carried but not sealed" case the test is named for
and the third is the one a weaker test would have missed.

No conformance vector is added, deliberately: #183 took the same decision for
`delivered_fidelity`. The published pack's value is that its bytes do not
move, and `reporting_model_identity` exists so the fields are exercisable
without touching it.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-10-14 01:33:23 -04:00
..
conformance/v1 wai.generate.spectral: extend the lexicon to 370 words (data-only, pin unchanged) 2026-06-27 05:33:47 -04:00
mesh-rs mesh: the identity rides the whole path, and the keys it adds are exactly two 2026-10-14 01:33:23 -04:00
tools/joules-per-decision mesh: withdraw the GPU per-decision figure — another process held 99.5% of the GPU 2026-10-05 07:20:58 -04:00
CONTRIBUTING.md wai.generate.spectral: extend the lexicon to 370 words (data-only, pin unchanged) 2026-06-27 05:33:47 -04:00
LICENSE wai.generate.spectral: extend the lexicon to 370 words (data-only, pin unchanged) 2026-06-27 05:33:47 -04:00
LICENSE-SPEC wai.generate.spectral: extend the lexicon to 370 words (data-only, pin unchanged) 2026-06-27 05:33:47 -04:00
README.md mesh: an in-process engine is metered by this process's own CPU and GPU energy 2026-10-08 20:21:15 -04:00
SPEC.md mesh §3.6: the receipt sealed the model by name, so the name was not a binding 2026-10-14 01:30:11 -04:00

Mesh

Energy-accounted inference serving & routing. One of the Transaction Science open standards.

Mesh treats every inference as a metered transaction. A request declares a joule ceiling and a fidelity floor; the mesh routes it to the cheapest-sufficient model on the cheapest-sufficient backend, serves it under an energy meter, and seals a receipt whose headline figure is microjoules per accepted output token — measured at the meter, not estimated from a price list.

The serving shelf reports dollars per token and tokens per second. Mesh reports the number that is physical, comparable across hardware, and impossible to inflate: the joule.

The shape

ServeRequest ──▶ authorise (JCP grant) ──▶ route (cheapest-sufficient)
                                              │
                                              ▼
                          meter ◀── serve (engine) ──▶ tokens
                                              │
                                              ▼
                         sealed JCR-1 receipt: µJ / accepted token

Four roles — caller, router, engine, steward — and four phases per serve: authorise, route, meter, seal. See SPEC.md §2.

The reference workspace

mesh-rs/ is a pure-Rust reference implementation:

Crate What it is
mesh-schema wire types — ServeRequest, Fidelity, two-part Energy, RouteDecision, ServeOutcome
mesh-router energy-weighted cheapest-sufficient routing with a full candidate audit
mesh-engine the ServingEngine interface + a deterministic, weights-free ReferenceEngine
mesh-engine-gguf a real backend (behind gguf): wraps the family's pure-Rust GGUF/Metal inference substrate so the mesh routes and meters actual model tokens
mesh-meter the meter window; an always-available estimator + an optional bridge to the family hardware meter (RAPL / NVML / Apple) behind hw-meter, and ProcessMeter: this process's own CPU and GPU energy for an engine that runs in process, measured when a span covers the whole request
mesh-receipt the mesh/1 receipt, JCR-1 sealing (det-CBOR + COSE_Sign1), and a hash-chained log
mesh-core the orchestration that ties authorise → route → meter → seal together
mesh-conformance the deterministic reference scenario, its checks, and the gen-vectors bin

Mesh rides on JCP (a serve request is authorised by a JCP grant; receipts seal in JCR-1), dispatches to runtimes such as JouleClaw, and routes across compute described by EOC and isolated by Sandbox. It introduces no new cryptography (see SPEC.md §9).

Run it

cd mesh-rs

# all crates green
cargo test --workspace
cargo clippy --workspace --all-targets

# end-to-end: mint a JCP grant, serve, print the sealed receipt
cargo run -p mesh-core --example demo

# on Linux/RAPL or a CUDA/NVML box, meter real silicon (HwShunt provenance, where
# the counter is live; a counter that is not live falls back to the estimator)
cargo run -p mesh-core --example demo --features hw-meter-rapl

# regenerate the published conformance vectors
cargo run -p mesh-conformance --bin gen-vectors -- ../conformance/v1

# serve a REAL model end-to-end through Mesh (Falcon-H1 0.5B), seal the receipt
cargo run --release -p mesh-engine-gguf --features gguf --bin serve_falcon -- \
    /path/to/falcon-h1-0.5b-instruct 12 "The capital of France is"

The serve_falcon run demonstrates the whole standard on real model tokens: a JCP grant authorises each request (an underfunded grant is refused before any decode runs), the cheapest-sufficient backend is chosen, the decode is metered, and a mesh/1 receipt is sealed and hash-chained across the session — e.g. prompt "The capital of France is" → " Paris. It is known for its historical landmarks", prompt "Photosynthesis is the process by which" → " plants convert sunlight into chemical energy in the form of", with both seals verifying and the chain's prev-links intact.

The demo prints the route (every backend weighed, with the reason each was kept or rejected), the honest energy provenance, and the wedge metric — then verifies the sealed envelope under the steward key.

Status

v0.1.0-draft.1. Reference workspace builds and tests green (mesh-schema, mesh-router, mesh-engine, mesh-meter, mesh-receipt, mesh-core, mesh-conformance); cargo clippy --all-targets warning-free; published vectors in conformance/v1/. The reference engine is deterministic and weights-free; production backends implement the same ServingEngine interface — mesh-engine-gguf (behind gguf) is a real one over the family's pure-Rust GGUF/Metal substrate, kept out of the default build so it needs no weights.