open-standards/eoc/eoc-rs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science 2688e2b936
Some checks failed
wai cross-architecture byte-equality / windows-x86_64 (pull_request) Successful in 23s
wai cross-architecture byte-equality / linux-aarch64 (pull_request) Successful in 40s
joule-code conformance gate / Build + round-trip C1-C4 vectors (pull_request) Failing after 1m3s
WAI conformance / cargo-class corpora · windows (pull_request) Successful in 1m13s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 1m8s
wai cross-architecture byte-equality / macos-arm64 (reference) (pull_request) Successful in 1m57s
WAI conformance / cross-arch byte-equality · windows (pull_request) Successful in 23s
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 58s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 3s
standards workspaces build + test / jcp-rs (pull_request) Failing after 12s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 39s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m1s
wai cross-architecture byte-equality / linux-x86_64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · linux (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · macos (pull_request) Has been cancelled
WAI neural decoders end-to-end / synthetic fixtures → Rust decode → reference (±4) (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
standards workspaces build + test / smart-byte-rs (pull_request) Has been cancelled
deps: cargo update across 18 workspaces
Lockfiles only — newest versions WITHIN the semver ranges the manifests already
declare. No manifest constraint was widened by this commit.

That distinction is load-bearing here. `cargo upgrade`, which rewrites manifests
to the latest major, is precisely what killed smart-byte: rand was pinned to
"0.10" against source written for 0.8, and the crypto stack it sits on
(ed25519-dalek, curve25519-dalek, bls12_381, bulletproofs) all require
rand_core 0.6 — so 0.8 is a ceiling those crates impose, not a preference.
Moving past it means waiting for that ecosystem or migrating 41 call sites of
cryptographic code, and neither belongs in a routine update.

Largest moves: smart-byte 207 packages, openpay 189, jouleclaw 182, eoc 164.

Verified on 1.98.0 with the updated lockfiles — 12 workspaces green:

  smart-byte 616   openpay 1935   joule-code 278   jcp 258   map 220
  sandbox 186      aac 89         joulecontract 82  arl 58    sense 38
  proof 31         joulehook 24

One pre-existing failure is deliberately NOT addressed here: jouledesk's
`the_joule_budget_is_enforced_across_tags` seals two decisions where the budget
permits one. It fails identically on the original lockfile, so it is not a
dependency problem — it is a budget-enforcement defect in the Joule Desk
standard, and a ceiling that seals a receipt for work it refused deserves its
own fix and its own commit rather than burial in a dependency sweep.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-08-26 08:34:28 -04:00
..
crates unbreak four standards that had never been compiled 2026-08-26 08:34:06 -04:00
Cargo.lock deps: cargo update across 18 workspaces 2026-08-26 08:34:28 -04:00
Cargo.toml toolchain: Rust 1.98.0, and MSRV follows 2026-08-26 08:33:46 -04:00
README.md Parallel ingest: 9 issues' worth of work across openpay / smart-byte / eoc 2026-05-23 13:24:05 -04:00
rust-toolchain.toml toolchain: Rust 1.98.0, and MSRV follows 2026-08-26 08:33:46 -04:00

eoc-rs — EOC reference implementation in Rust

Apache-2.0 reference implementation of the Energy-Optimized Compute specification (CC-BY-4.0 spec lives in ../spec/).

EOC is a four-stage memoizing cascade. Every query is tried at each stage in turn and the first that can answer wins. The four stages, cheapest to most expensive, are:

  1. Cache (eoc-cache) — content-addressed LRU. Cache hits are nearly free.
  2. Key-value (eoc-kv) — exact key match plus cosine-similarity embedding match.
  3. Graph (eoc-graph) — triple-store retrieval. Reference impl is a small in-memory matcher; production deployments swap in a real graph backend driven by DCY (EOC-4).
  4. Neural (eoc-neural) — last-resort inference. Reference impl ships an EchoBackend; production deployments wire in llama.cpp / Ollama / Anthropic API / etc.

Joule cost is the unit of accounting. The eoc-meter crate reads cumulative micro-joules from whatever hardware counter is available (Linux RAPL, macOS powermetrics, NVIDIA NVML behind the cuda feature) and falls back to a StubCounter everywhere else — including WASM.

Workspace layout

Crate Purpose
eoc-core Types: Query, Response, Stage, JouleCost, Receipt.
eoc-cache Stage 1 — LRU cache + the Stage trait.
eoc-kv Stage 2 — KV + embedding-similarity lookup.
eoc-graph Stage 3 — in-memory triple store.
eoc-neural Stage 4 — neural inference trait + EchoBackend.
eoc-meter Hardware energy counters with stub fallback.
eoc-cascade Glue: walks the four stages, attributes joule cost.
eoc Reference CLI.
eoc-wasm wasm-bindgen wrapper — browser-runnable cascade.

Running

cargo test --workspace
cargo clippy --workspace --all-targets
cargo run --bin eoc -- query "what is 2+2"
cargo run --bin eoc -- meter

Example output:

$ cargo run --bin eoc -- query "what is 2+2"
stage  : kv
payload: 4
cost   : 50 µJ (estimated)
receipt: <64-char hex>

CUDA / NVML

NVIDIA NVML support is feature-gated and off by default so the workspace builds without libnvidia-ml. To enable:

cargo build -p eoc-meter --features cuda

WASM

The cascade compiles to wasm32-unknown-unknown. The meter does not — RAPL, NVML, and powermetrics are all absent in the browser, so WASM builds use StubCounter and report estimated joule cost.

rustup target add wasm32-unknown-unknown
cargo build -p eoc-wasm --target wasm32-unknown-unknown --release
wasm-bindgen target/wasm32-unknown-unknown/release/eoc_wasm.wasm \
    --out-dir ./pkg --target web

Then from JavaScript:

import init, { WasmCascade } from "./pkg/eoc_wasm.js";
await init();
const cascade = new WasmCascade();
const r = await cascade.resolve("ping");
console.log(r); // { stage: "kv", payload: "pong", microjoules: 50, ... }

License

Apache-2.0 for the Rust source in this workspace. The EOC specification text in ../spec/ is CC-BY-4.0. See ../LICENSE.