Expand description
kian-core — concept model, session state machine, six-invariant
assertions.
DESIGN §7 assigns this crate: “Concept model, session state machine,
six-invariant assertions” with key interfaces SessionId, EventKind,
Projection. It is the narrow waist of the system (AGENTS.md constraint
10): no provider, channel, daemon or super-agent specific code may live
here.
The event stream is the sole truth (constraint 1): all session state is a projection of events and projections are disposable and rebuildable.
Modules:
model— concept model (DESIGN §2.1)events— event classification and envelope, schema v0 (DESIGN §3.1, §3.3)state— session state machine and pure projection (DESIGN §2.2)context— model-context projectionderive_model_context(DESIGN §3.2, constraints 2/3)control— reserved control-envelope convention (ADR-014, durable interrupt intent)budget— the session token budget projection (ADR-055)memory— thememory/notefold: fail-closed payload parsing, the latest-per-subject projection and range verification (MEMORY-MODEL §3)invariants— the six semantic invariants + NoHalfTerminated as assertion predicatesseams— seam trait definitions (DESIGN §6.2); impl crates re-export
Modules§
- budget
- The session token budget projection (ADR-055).
- confirmation
- The pending-confirmation projection (CONFIRMATION-MODEL §4, ADR-033).
- context
- Model-context projection (DESIGN §3.2 “Model-context projection (the implementation core of A2/A3)”).
- control
- The reserved control-envelope convention (ADR-014).
- events
- Event classification and envelope (DESIGN §3.1 “Event classification (borrowing dsh’s durable/live split)” and §3.3 “Schema versioning”).
- fs
- Worker filesystem command contract (KiandProto v2, ADR-023).
- invariants
- The six semantic invariants (DESIGN §2.3) plus NoHalfTerminated, as
checkable predicates over event streams/projections, and the resident
assertion-macro family for
debug_assert!s and test assertions. - memory
- The memory-note fold (MEMORY-MODEL §3 “Notes”, round-8 plan §2.2).
- model
- Concept model (DESIGN §2.1 “Concept model and Rust type skeletons”).
- repair
- Open tool-call recovery (CONFIRMATION-MODEL §15.6, DESIGN §2.3).
- seams
- Seam trait definitions (DESIGN §6.2 “Seam three roles”).
- secrets
- exec secret hygiene — redaction of exec output and the child environment policy (live finding, severity HIGH).
- state
- Session state machine (DESIGN §2.2 “Session state machine (projection-derived)”).
- worker
- Worker-domain value rules shared by both halves of KiandProto v3: capability names and the declaration sanitizer (ADR-029).
Macros§
- assert_
session_ invariants - Runs the full resident assertion family over one event stream: projection legality, NoHalfTerminated and every single-stream invariant predicate. Panics with the violated invariant’s name — for tests and for hard assertions in debug tooling.
- debug_
assert_ session_ invariants assert_session_invariants!gated to debug builds — the residentdebug_assert!form intended for drain/store code paths.