Expand description
Pure decision functions: values in, verdicts out. Zero internal deps.
Holds no I/O handles, no clock, no global state (ARCHITECTURE.md paragraph 1).
The entry crates/kernel/Spec.lean specifies this crate, and each module
names the part under crates/kernel/spec/ that specifies it.
This file is an index, and the modules are the library. Every
module is public and a caller reaches a decision through the module
that owns it — gate::domain, discard::decide, approval::may_answer
— so the module name says which authority answered. What the root
re-exports is the vocabulary those signatures are written in: the
value types a caller names in its own fields and arguments. A
function is never re-exported here, and nothing is renamed on the
way out, because a second spelling of one name is the defect
xtask lexicon exists to catch.
Re-exports§
pub use address::Address;pub use address::GIT_METADATA;pub use address::PROTECTED_METADATA;pub use address::RESERVED_PREFIX;pub use address::ReadVerdict;pub use address::SessionName;pub use approval::AnswerVerdict;pub use approval::Answerer;pub use approval::ApprovalClass;pub use approval::ApprovalId;pub use approval::ApprovalItem;pub use approval::Autonomy;pub use approval::ClusterKey;pub use approval::Ruling;pub use backpressure::Admission;pub use backpressure::ItemMeta;pub use backpressure::QueueStats;pub use backpressure::ShedReason;pub use blockage::Blockage;pub use blockage::Notice;pub use blockage::RedNode;pub use budget::BudgetUse;pub use budget::ByteLen;pub use budget::Tokens;pub use budget::UsdMicros;pub use change::FileChange;pub use change::How;pub use change::Lines;pub use completion::Completion;pub use completion::Evidence;pub use completion::PlannedProgress;pub use completion::Progress;pub use completion::UnplannedProgress;pub use config::ClockStampGranularity;pub use config::ClockZone;pub use config::FrozenConfig;pub use config::ContainerImage;pub use config::ContainerLimits;pub use config::EnvVarName;pub use config::Interpreter;pub use config::LayeredValue;pub use config::LiveConfig;pub use config::SandboxArm;pub use config::SandboxLimits;pub use config::McpServer;pub use config::McpTransport;pub use config::SecondThreshold;pub use delegation::Delegate;pub use delegation::DelegateKind;pub use delegation::DelegationVerdict;pub use delegation::Delegator;pub use delegation::Depth;pub use discard::Restoration;pub use discard::DenyReason;pub use discard::Discard;pub use discard::DiscardForecast;pub use discard::DiscardRequest;pub use discard::DiscardVerdict;pub use error::AccountDisposition;pub use error::AxCode;pub use error::AxError;pub use error::Carrier;pub use error::ErrorDraft;pub use error::GateRefusal;pub use error::ProviderFailureKind;pub use error::Retry;pub use event::record::InputKinds;pub use event::EventDraft;pub use event::EventKind;pub use event::EventRecord;pub use event::EventRef;pub use event::Payload;pub use event::RunId;pub use event::Seq;pub use event::TimeMs;pub use event::WindowClass;pub use gate::GateOutcome;pub use gate::ConnectorCall;pub use gate::DOORS;pub use gate::DoorId;pub use gate::EgressAllowlist;pub use gate::EgressOutcome;pub use gate::EgressTarget;pub use goal::GoalEntry;pub use goal::GoalId;pub use goal::GoalResource;pub use goal::GoalVerdict;pub use idem::Duplicate;pub use idem::IDEM_DERIVE_V;pub use idem::IdemGuard;pub use idem::IdemKey;pub use keep_warm::KeepWarm;pub use ledger::GENESIS_PREV;pub use ledger::Ledger;pub use locator::B3Hash;pub use locator::GitOid;pub use locator::Locator;pub use locator::Range;pub use model::AdmissionRequirement;pub use model::LandingPolicy;pub use model::Mode;pub use model::RunPolicy;pub use model::Window;pub use model::BuildingPolicy;pub use model::Ceiling;pub use model::ChatMessage;pub use model::ChatRequest;pub use model::ChatResponse;pub use model::ContentBlock;pub use model::CacheCount;pub use model::ModelRequest;pub use model::ModelReturn;pub use model::ModelTag;pub use model::ModelUsage;pub use model::Role;pub use model::StopReason;pub use model::DialectKind;pub use model::EarlyCalls;pub use model::Effort;pub use model::ImageRef;pub use model::ImageType;pub use model::Increment;pub use model::Increments;pub use model::MessageBreakpoint;pub use model::Model;pub use model::SystemBlock;pub use model::ToolDef;pub use node_id::NODE_DEPTH_MAX;pub use node_id::NodeId;pub use plan::Held;pub use plan::PlanExit;pub use plan::PlanNode;pub use plan::PlanTree;pub use plan::StopCause;pub use pursuit::Pursuit;pub use pursuit::PursuitState;pub use pursuit::PursuitVerdict;pub use reach::Answered;pub use reach::Connected;pub use reach::Named;pub use reach::Proxying;pub use reach::Reach;pub use reach::Through;pub use registry::Artifact;pub use registry::Claim;pub use registry::RegisterVerdict;pub use registry::Registry;pub use registry::ResidentId;pub use release::Maturity;pub use release::Release;pub use release::ReleaseVerdict;pub use repair::RepairVerdict;pub use retries::Retries;pub use secret::Sealed;pub use secret::SecretRef;pub use secret::SecretSpan;pub use share::WHOLE_PPB;pub use spine::EvidenceCell;pub use spine::NewChild;pub use spine::ROADMAP_COLUMNS;pub use spine::ROADMAP_FILE;pub use spine::ROADMAP_STATUS_SPELLINGS;pub use spine::RoadmapRow;pub use spine::RoadmapShape;pub use spine::RoadmapStatus;pub use spine::ScopeChange;pub use spine::WriteMoment;pub use stall::ActionFingerprint;pub use stall::StallVerdict;pub use taint::TaintSet;pub use taint::TaintSource;pub use taint::Tainted;pub use tool::writes::Writes;pub use tool::CostTier;pub use tool::Effect;pub use tool::ExecArm;pub use tool::GateSubject;pub use tool::RenderIntent;pub use tool::ServerLabel;pub use tool::Temporal;pub use tool::TimeoutMs;pub use tool::Tool;pub use tool::ToolCall;pub use tool::ToolMeta;pub use tool::ToolName;pub use tool::ToolOutcome;pub use version::Version;pub use version::VersionVerdict;pub use write_domain::DocumentReason;pub use write_domain::DomainPrefixes;pub use write_domain::DomainVerdict;pub use write_domain::EditSample;pub use write_domain::EditWarVerdict;pub use write_domain::WriteDomain;pub use write_domain::WriteLimit;
Modules§
- account_
recovery - Which account of a provider a request goes out on, and after a failure
whether it goes out again on the same account, moves to another, or
stops.
The part
crates/kernel/spec/AccountRecovery.leanspecifies this module (crates/kernel/Spec.lean§8-86, kernel D54 and D55). - address
- Address: canonical relative path inside a city, and
the WriteDomain primitive
is_within. The partcrates/kernel/spec/Address.leanspecifies this module. - approval
- The Approval Inbox holds design questions and nothing else (9.2).
The part
crates/kernel/spec/Approval.leanspecifies this module. - backpressure
- Admission control: the city-wide shedding posture.
One function serves every queue-shaped resource — signal queues and fd
headroom alike; capacity semantics belong to the caller. Queues and
counters live in storage::queue, never here.
The part
crates/kernel/spec/Backpressure.leanspecifies this module. - blockage
- Red, and how far it reaches.
The part
crates/kernel/spec/Blockage.leanspecifies this module. - budget
- Money and quantities as integers (15.3-6), and what a piece of work
turned out to cost.
The part
crates/kernel/spec/Budget.leanspecifies this module. - change
- What moved between two checkpoints, as a fact rather than as a patch.
The part
crates/kernel/spec/Change.leanspecifies this module. - completion
- Completion and progress. Claiming done makes
nothing done:
Completion::Donecannot be built without evidence the city recorded itself (the runtime checks depth). Progress is honest in the type: only a planned run owns a ratio method — an unplanned run has nothing to ask a percentage from. The partcrates/kernel/spec/Completion.leanspecifies this module. - config
- Three-layer config resolution, specified by
crates/kernel/spec/Config.lean.FrozenConfigandLiveConfigshare no field; tests check this property. - consts_
external - External-fact constants: values that follow the
outside world. Changing one requires evidence that the world changed,
never our own preference.
The part
crates/kernel/spec/ConstsExternal.leanspecifies this module. - consts_
policy - Policy constants: our choices. Changing one
changes behavior and therefore requires EVAL evidence or an
explicit ruling. Data only — zero branches by charter.
The part
crates/kernel/spec/ConstsPolicy.leanspecifies this module. - degradation
- Degrade truthfully: which resource is the bottleneck, the readings
that show it, and what the person can do about it.
Readings are sampled by the caller; this module only decides. The one
state that stops the city taking on new work is a disk close to full,
and the refusal carries that
Degradation::DiskLowso the door can say how much to free. The partcrates/kernel/spec/Degradation.leanspecifies this module. - delegation
- Delegation: two delegate kinds, one level deep.
The guard is two-layered on purpose: statically, a
Delegatevalue has no delegate method — minting a grandchild cannot be spelled; dynamically,admitre-checks depth at every spawn so a hand-rolled path cannot sneak past the type. One level is an invariant, not a constant — a constant would imply it is tunable. The partcrates/kernel/spec/Delegation.leanspecifies this module. - discard
- Discard: deletion as an effect class, judged by effect and never by
intent. C14 in the type: a Discard without a
restoration plan cannot be constructed; the unplanned path exists only
as a request shape for exec forecasts — and the door denies it.
This module is the discard door’s sole authority;
gate::discarddelegates wholly and only shapes the refusal. The partcrates/kernel/spec/Discard.leanspecifies this module. - error
- AxError, the one error shape of the whole city, and
AxCode, the closed set of 35 error codes.
The part
crates/kernel/spec/Error.leanspecifies this module. - event
- EventRecord and the closed EventKind set: the value layer of “the Ledger is the only history”.
- gate
- The doors. This module is the library-wide sole producer of gate
refusal codes: every Deny goes through
AxError::refusalwith the three mandatory parts. Boundary feedback beats opening sermons — the refusal is the teaching. The partcrates/kernel/spec/Gate.leanspecifies this module. - goal
- Same-resource mutual exclusion. Detection is
kernel’s; arbitration is not — reading statements and judging intent
belongs to models (collab::arbiter) and humans.
The part
crates/kernel/spec/Goal.leanspecifies this module. - idem
- IdemKey: the dedup key for outward actions.
The part
crates/kernel/spec/Idem.leanspecifies this module. - keep_
warm - Keep-warm: whether, and when, a prompt cache still in use is renewed
before the provider lets it expire.
The part
crates/kernel/spec/KeepWarm.leanspecifies this module. - layout
- Where a city keeps each kind of file on disk: one derivation from
the city root and an address (
crates/kernel/spec/Layout.lean§8-56). - ledger
- The Ledger port: the only write entrance to history (seam list,
ARCHITECTURE section 3), plus the chain rule both adapters and replay
share.
The part
crates/kernel/spec/Ledger.leanspecifies this module. - locator
- Locator: the one grammar for referring to content across events and
sessions. The part
crates/kernel/spec/Locator.leanspecifies this module. Two schemes only: - model
- The model seam (seam registry ARCHITECTURE 3).
Every provider call carries a
BuildingPolicyvalue; the policy is defined here (kernel cannot name outer crates) and evaluated bycity::policy— dependency inversion, same as the ledger seam. The partcrates/kernel/spec/Model.leanspecifies this module. - node_id
- A plan node’s address: the dotted path that says where it hangs.
The part
crates/kernel/spec/NodeId.leanspecifies this module. - plan
- The plan as a tree: what the nodes are, what each one is worth, what
may be started now, and the two ways a held node is put down.
The part
crates/kernel/spec/Plan.leanspecifies this module. - policy_
limit - Policy limits as values (
crates/kernel/spec/PolicyLimit.lean§8-73): each type carries one ceiling’s legal domain and the one refusal that says no, so a caller hands over what it observed and cannot spell a second refusal. - pursuit
- A pursuit: a goal the city keeps working towards, and the one
condition under which a city that holds one stops.
The part
crates/kernel/spec/Pursuit.leanspecifies this module. - reach
- Where a call to a provider stops, stage by stage.
The part
crates/kernel/spec/Reach.leanspecifies this module. - registry
- The three registry books: Artifact, Asset,
Resident census. The load-bearing line is the Claim/Artifact split —
an unverified result is testimony, and
Artifact::verifyis the only door between the two (player–referee in the type). The registry is a value, not a store: state lives with the caller and is rebuilt from the Ledger. The partcrates/kernel/spec/Registry.leanspecifies this module. - release
- Which release a binary is, and how two releases order.
The part
crates/kernel/spec/Release.leanspecifies this module. - repair
- Repair leases: when the environment itself is
broken, repair is serialized — one live lease per scope subtree, so
two runs can never “fix” the same breakage into a bigger one. The
active table is the caller’s state; kernel only judges.
The part
crates/kernel/spec/Repair.leanspecifies this module. - retries
- How many times a failed call is made again.
The part
crates/kernel/spec/Retries.leanspecifies this module. - secret
- Secret shape judgment, the
secret:reference grammar andSealed<T>. Detection is shape-table-first, entropy-second; both are hand-written, regex-free, backtracking-free and float-free — entropy runs in fixed point so the judgment is deterministic and kani-provable. False positives are the accepted normal: the entrance replaces losslessly, only the exits refuse. The partcrates/kernel/spec/Secret.leanspecifies this module. - share
- How much of the whole plan one node is, and why nobody can mint more.
The part
crates/kernel/spec/Share.leanspecifies this module. - spine
- The spine documents’ grammar: how a row of
Roadmap.mdis written and read, and the six fields a Memo outline carries. The partcrates/kernel/spec/Spine.leanspecifies this module. - stall
- The sole stall criterion. Watchdog consumes the
verdict and decides disposal; it never re-derives the criterion —
“what counts as stalled” lives here and nowhere else.
The part
crates/kernel/spec/Stall.leanspecifies this module. - taint
- The taint ring. One axiom: external content is
always data.
Tainted::newis the city-wide sole entrance for foreign bytes; reads hand out borrows, derivation unions provenance, and no method ever returns the bare value — “washing it clean” is a compile error, not a review finding. The partcrates/kernel/spec/Taint.leanspecifies this module. - tool
- The tool seam (seam registry ARCHITECTURE 3).
ToolMetais the eight-field registration: a tool without a complete meta is invisible to the model.effectdecides which gate a call passes;temporaldecides whether its envelope carries a clock stamp. The partcrates/kernel/spec/Tool.leanspecifies this module. - version
- Optimistic concurrency: writes carry a
base_version; a stale base yields a verdict, never a silent merge. The partcrates/kernel/spec/Version.leanspecifies this module. - write_
domain - WriteDomain prefix checking and edit-war detection. C17 is enforced twice on purpose: a reserved prefix cannot be
constructed into a domain, and a reserved target is refused at
judgment even so — fail-closed has no single point of failure.
The part
crates/kernel/spec/WriteDomain.leanspecifies this module.
Structs§
- Origin
- Where a session branched off: one run of this city, and the line in it that the branch starts after.