open-standards/jcp/CONTRIBUTING.md
Transaction Science 7a72be5cd7 loader-gguf wave 39: Intel OpenVINO IR (.xml + .bin)
OpenVINO ships models as two sibling files:

  model.xml   topology + per-tensor (offset, size, dtype, shape)
  model.bin   raw weight blob; each Const layer's data
              lives at the offset+size declared in the XML.

This is the cleanest tensor-archive format of all the
ones the substrate has ingested so far — "raw bytes at
offset+size in a sibling file."

SCOPE — what wave 39 does

  Parse `.xml` streaming via quick-xml (already a
  workspace dep). Extract every `<layer type="Const">`'s
  `name` + `<data element_type=, shape=, offset=, size=/>`
  attributes. mmap the sibling `.bin`. Surface as:

    OvModel {
        xml_path, bin_path,
        net_name, ir_version,
        tensors:  Vec<OvTensorInfo>,
        bin_mmap,
    }

  OvTensorInfo { id, name, dtype, shape, bin_offset, bin_size }

  read_openvino_ir(path/to/model.xml) auto-resolves the
  sibling .bin (same basename + .bin extension). On load
  every Const layer's (offset, size) is bounds-checked
  against the .bin file length, so corrupt XML refusing
  to fit triggers OvError::BinOutOfBounds at parse time
  rather than at first slice.

  tensor_bytes(&t) returns Some(&[u8]) into the .bin
  mmap. The substrate primitive.

DTYPE COVERAGE

  All documented OpenVINO IR element types:
    f64 f32 f16 bf16
    i64 i32 i16 i8 i4
    u64 u32 u16 u8 u4 u1
    boolean string
    f8e4m3 f8e5m2 f8e8m0 f4e2m1
    nf4

  Case-insensitive parse. Unknown values pass through as
  Unknown(String) — same forward-compat strategy as the
  other readers.

SCOPE — what wave 39 does NOT do

  No operator graph execution. No edge / port traversal.
  No reshape / fuse pattern matching. JouleClaw has its
  own kernel suite.

NEW FILES

  crates/jouleclaw-loader-gguf/src/openvino.rs
  crates/jouleclaw-loader-gguf/examples/load_openvino.rs

  lib.rs: + pub mod openvino;
  Cargo.toml: + quick-xml workspace dep

TESTS (7 new)

  dtype_parse_round_trip                f32/F32/bf16/nf4/u1/f8e4m3/unknown
  dtype_element_sizes                   sub-byte sentinels
  synthetic_ir_round_trip               full XML→bin walk, 2 tensors
  missing_bin_sibling_returns_error     .xml without .bin
  out_of_bounds_offset_detected         .bin too small for declared size
  ir_with_no_const_layers_loads         empty model edge case
  malformed_shape_attribute_errors      "2,abc,3" rejected

  loader-gguf: 193 → 200 tests.

NEXT — Wave 40: document why TensorRT engines can't be
substrate-ingested (opaque NVIDIA binary, version-locked
to driver + arch).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-06-09 11:07:50 -04:00

36 lines
1.9 KiB
Markdown

# Contributing to JCP
JCP is one of the [Transaction Science open standards](../README.md). The wire
format and the right to fork are public; Transaction Science is the steward, not
the proprietor.
## Ground rules
- **Reference code** (`jcp-rs/`) is Apache-2.0. **Specification text** (`SPEC.md`)
is CC-BY-4.0.
- Rust toolchain is pinned by the repo `rust-toolchain.toml`. `cargo test
--workspace` MUST pass and `cargo clippy --workspace --all-targets` MUST be
warning-free.
- Any change to a wire structure (the Grant, the Frame, the `jcp/1` receipt core,
the canonical encoding) requires regenerating and committing `conformance/v1/`
(`cargo run -p jcp-conformance --bin gen-vectors -- conformance/v1`).
- Two invariants are correctness, not style, and a PR that weakens either will be
declined: **enforcement happens outside the model**, and a `data` frame can
**never** exercise a capability.
## The smallest valuable contributions
- **Transport bindings:** map Frames onto a concrete ordered, authenticated
channel (e.g. an MCP/A2A bridge that wraps existing tool/agent calls in Grants
and Frames) without moving the decision into the model.
- **Measured energy:** a `HwShunt` cost backend (RAPL/NVML) so a runtime debits
hardware-measured joules instead of a model estimate.
- **Conformance:** adversarial negatives (a chain that amplifies mid-delegation, a
receipt whose budget disagrees with the grant, a frame that replays a spent
nonce) and independent implementations certifying against `conformance/v1/`.
- **Revocation & chains:** grant revocation lists and multi-hop attenuation-chain
verification (validate the whole chain narrows monotonically to its root).
- **Capability discovery:** a signed, content-addressed catalog of a server's
resources and actions, so a grant's `resource`/`actions` bind to real content.
Issues and PRs scope by the `jcp` subdirectory tag.