Skip to main content

Crate boundgraph_core

Crate boundgraph_core 

Source
Expand description

Core primitives for the BoundGraph runtime.

BoundGraph governs the span between a reasoning engine proposing an action and a state change committing. This crate defines the immutable values that span is made of, and nothing else: no execution, no policy, no I/O.

§The primitives

SymbolTypeRole
ωWorkOrderA typed declaration of intended effect. A proposal.
ΓContextThe exact admitted token window, plus what was refused.
κCondensateA size-capped, structure-preserving summary of a result.
εEvidenceA signed verdict from a model-free checker.
λLedgerEntryOne tamper-evident record in the audit chain.

§Two invariants everything else rests on

Immutability. Every primitive is constructed complete and never mutated. There are no setters. A “change” is a new value with a new Digest.

Content addressing. Identity is the blake3 digest of the canonical CBOR encoding (Canonical). Equal digests mean equal values, which is what lets the ledger be verified by a third party and lets the content addressed store deduplicate.

§How the Foundation Laws show up here

The laws are enforced by the compiler and the runtime, not by this crate. What this crate does is make them representable — and make violating them awkward:

  • Law I (Authority). GrantSet::EMPTY is the default and there is no value meaning “unrestricted”, so a step that declares nothing gets nothing. GrantDelta records requested against granted, so attenuation is auditable rather than inferred.
  • Law II (Context). Context records what was refused as well as what was admitted, and construction fails if admissions exceed the ceiling. Condensate caps a result while keeping the original addressable.
  • Law III (Evidence). Verdict has no implicit pass, and Evidence::covers means a verdict cannot be reattached to data it never saw.

Re-exports§

pub use budget::Budget;
pub use budget::Excess;
pub use budget::MICROS_PER_USD;
pub use budget::Unit;
pub use budget::micros_of_usd;
pub use canonical::Canonical;
pub use canonical::CanonicalError;
pub use canonical::from_canonical_cbor;
pub use canonical::to_canonical_cbor;
pub use condensate::Condensate;
pub use condensate::CondensatePayload;
pub use condensate::SchemaId;
pub use condensate::SlicerId;
pub use context::AdmittedItem;
pub use context::Context;
pub use context::ContextSource;
pub use context::EvictionReason;
pub use context::EvictionRecord;
pub use context::TokenBudget;
pub use cost::AsOf;
pub use cost::AsOfParseError;
pub use cost::CostModel;
pub use cost::Pricing;
pub use cost::PricingError;
pub use cost::TokenUsage;
pub use digest::DIGEST_LEN;
pub use digest::Digest;
pub use digest::DigestParseError;
pub use error::BoundGraphError;
pub use error::Result;
pub use evidence::CheckerId;
pub use evidence::Evidence;
pub use evidence::EvidenceKind;
pub use evidence::Signature;
pub use evidence::SigningKeyId;
pub use evidence::Verdict;
pub use grant::GrantAtom;
pub use grant::GrantAtomParseError;
pub use grant::GrantSet;
pub use grant::KNOWN_DOMAINS;
pub use id::RunId;
pub use id::StepId;
pub use isolation::Confinement;
pub use isolation::Enforcement;
pub use isolation::Isolation;
pub use isolation::Tier;
pub use isolation::Worker;
pub use ledger::CostRecord;
pub use ledger::GENESIS_PREV;
pub use ledger::GrantDelta;
pub use ledger::JournalRef;
pub use ledger::LedgerEntry;
pub use work_order::Intent;
pub use work_order::ProposalOrigin;
pub use work_order::ToolCall;
pub use work_order::WorkOrder;

Modules§

budget
Declared spending limits, as data.
canonical
Canonical CBOR encoding.
condensate
The Condensate (κ) — a size-capped summary that never loses the original.
context
The Context (Γ) — the exact admitted token window, and what was refused.
cost
What a reasoner charges — the input to every cost claim the system makes.
digest
Content-addressed digests.
error
The error taxonomy.
evidence
The Evidence (ε) — a signed verdict, not a claim.
grant
Permission atoms and sets, as data.
id
Identifiers.
isolation
Which isolation tier a tool runs in, what it enforced, and the record of what actually confined a step.
ledger
The Ledger Entry (λ) — one tamper-evident record.
work_order
The Work Order (ω) — a proposal, never a command.