Expand description
Commitment-enforcement layer - the A_t^valid gate.
This is the layer that lets the reference implementation claim all three roles. It implements the full execution chain behind operation selection:
- every action attempt is carried as an attributed event (actor, action, content, time, scope, provenance);
- the engine selects the active commitments K_t from the history H_t (expiry-aware, so expired commitments leave K_t and are not enforced);
- before an action may run, the violates() check is consulted unconditionally by the gate;
- a violation can only proceed along the documented justifiedOverride() path (authorized overrider + a recorded justification);
- a non-permitted action is blocked, never merely warned;
- every check, decision and override is appended to the audit chain (SHA-256 hash-chained so tampering is detectable);
- positive and negative tests cover every required scenario.
The runnable set is restricted to
A_t^valid = { a in A_t | attribution_valid(a) AND
(not violates(a, K_t) OR
justifiedOverride(a, K_t, H_t)) }A standalone checker that nothing calls would be an incomplete
implementation; that is why
crate::planning::Planner::execute_step routes every candidate action
through this gate before it can be advanced. The audit chain, the expiry
model and the persistence files mirror the binary, zero-JSON core.
Structs§
- Action
Event - A single attributed action attempt.
- Audit
Chunk - A single link in the audit chain. hash = sha256(prev_hash || record).
- Commitment
- A commitment (an element of the history H_t). When active it forms part of the active set K_t.
- Enforcement
Engine - The enforcement engine. Owns the commitment history H_t (and thus the active subset K_t), the override policy, and the in-memory audit chain.
- Engine
State - Reference-implementation state kept between calls (commitments + policy).
- Violation
- One concrete violation of an active commitment.
Enums§
- Decision
- Per-action decision returned by the gate.
- Enforcement
Error - Error surfaced by the gate when it actually blocks execution.
- Outcome
- Outcome persisted into the audit chain.
Constants§
- DEFAULT_
AUTHORIZED_ OVERRIDER - Default built-in overrider authority for new engines.
- MIN_
JUSTIFICATION_ LEN - Minimum length a documented justification must have to be accepted.
Functions§
- load_
audit - Read the audit chain from a binary file.
- load_
engine - Load the engine’s commitment state. A missing file yields a fresh engine.
- load_
engine_ strict - Fail-closed loader for a guard. Returns an
Errif the state or the audit cannot be loaded cleanly or the chain is invalid. A caller that turns this error into “do not run the guarded operation” gives a genuinely fail-closed boundary: corruption means denial, never a silent default. - save_
audit - Rewrite the audit chain to a binary file (magic EAU1).
- save_
engine - Persist the engine’s commitments + policy to a bincode file.