Expand description
§nucleus-substrate-core — the categorical core
This crate ships three things:
Session— the agent-action object every projection projects from.Projection— a sealed, adjacently-tagged sum type whose variants are one-per-projection-functor (Identity, Capability, Flow, Economic, …).Receipt— the Ed25519-signed colimit envelope holding a session and any subset of its projections.
The categorical model is documented at
docs/architecture/substrate.md in the repo.
§Quick example
use nucleus_substrate_core::{Session, Receipt, Projection};
use ed25519_dalek::SigningKey;
let sk = SigningKey::from_bytes(&[7u8; 32]);
let session = Session {
session_id: "spiffe://test/agent-x".into(),
issuer_kid: "test-kid".into(),
issued_at_micros: 1_717_000_000_000_000,
parent_chain: vec![],
};
let projection = Projection::Identity(serde_json::json!({
"sub": "spiffe://test/agent-x",
"aud": "nucleus-substrate-test",
}));
let receipt = Receipt::sign(session, vec![projection], &sk);
// Anyone with the issuer's verifying key can verify offline.
let vk: [u8; 32] = sk.verifying_key().to_bytes();
receipt.verify(&vk).expect("self-built receipt verifies");§What’s NOT in scope here
- The concrete types each
Projectionvariant carries. Those live in the projection-lifter crates (nucleus-identity-projection,nucleus-flow-projection, etc.). This crate keeps them asserde_json::Valueto stay dependency-light. - The HTTP wire (REST routes, axum) — that’s the hub.
- The mechanism kernels (VCG, Pigouvian re-weighting) — those
live in
nucleus-econ-kernelsetc.
Modules§
- mechanism
- Mechanism-design types that live inside the Economic projection.
Structs§
- Receipt
- The colimit envelope. Holds a session + any subset of its projections, signed with the issuer’s Ed25519 key.
- Session
- The unit of authorship. Every projection projects from this.
Enums§
- Projection
- One projection of a session into a verifiable record.
- Receipt
Error
Constants§
Functions§
- canonical_
signing_ bytes - Canonical signing input for a receipt. Same function is called when building and when verifying — that’s the entire trust surface for the colimit identity.