operations tier

operations-control-plane

Control plane for harnessed work: execution runs, evidence, state transitions, story harness, language policy, and shard provenance over corpus_sourcecode

Control plane for harnessed work: execution runs, evidence, state transitions, story harness, language policy, and shard provenance over corpus_sourcecode

Tieroperations
Roleunclassified (baselined)
Pathcrates/operations/control-plane
Edition2021
Targetsoperations_control_plane, admission_guard_live, artifact_identity_live, benefit_rows_live, canonical_identity_live, composition_shape_live, concept_kind_axes_live, concept_owner_live, dependency_rule_live, first_rule_live, gate_registry_live, gate_rows_live, inventory_seed_live, kind_term_admission_live, metaclass_ratified_live, model_identity_live, payload_read_live, payload_reasoning_live, payload_store_live, registry_export_live, requirement_live, requirement_rank_live, rule_kind_live, six_kind_identity_live, story_sections_live, symbol_index_live, term_reading_census_live, term_reading_rows_live, term_skos_live, term_version_change_live, term_version_live, transition_merge_live, withdrawn_concepts_live, work_product_live, worker_usage_live
Public items351 across 25 modules
Tests362

What it is for

Control plane for harnessed work (sprint 4.21).

Coordinates WHAT is done, in what order, and whether it counts as done: execution runs, evidence, state transitions, the story harness, language policy, shard provenance, and session accounting -- all over corpus_sourcecode.

Placement (operator ruling, 2026-08-17): this is the operations layer, which docs/architecture/layers.toml labels "runtime/SRE/control plane" and where operations-workflow already lives. It was built inside tools-org-knowledge during sprint 4.20, which is the knowledge index -- the wrong crate for source-code and application work.

A harness (imp, tools-work-runner, an interactive wrapper) binds to this library. It does not own the record: the record outlives any harness, and more than one harness contends for the same steps.

Owed merge, recorded rather than hidden: operations-workflow already ships Transition, StateMachineDefinition, StateTransitionRecord, WorkflowStore, and workflow_transition_history with compare-and-swap on state_version. execution's transition tables duplicate that concept and lack the CAS guarantee. Sprint 4.21 AC2 merges them; this crate keeps the tables until those rows are migrated, never before.

Capabilities

crate root

Control plane for harnessed work (sprint 4.21).

Item
pub const CONTROL_PLANE_MIGRATIONS: & (& str, & str)

benefit (other)

Whether a benefit has been realised (0091). Pure: the arithmetic and the

Item
fn share(baseline : f64, target : f64, latest : f64) -> Option <f64>
fn validate_measure(unit : & str, baseline : f64, target : f64) -> Result <(), String>

Realisation

Whether a benefit has been realised (0091). Pure: the arithmetic and the

Item
pub enum Realisation
Realisation :: fn as_str(self) -> & 'static str
fn realisation(baseline : f64, target : f64, latest : Option <f64>) -> Realisation

boxes (other)

Budget boxes (sprint 4.41): the decidable core. Balances are DERIVED

Item
fn median_p90_cents(costs : & i64) -> Option <(i64, i64)>

BoxFacts

Budget boxes (sprint 4.41): the decidable core. Balances are DERIVED

Item
pub struct BoxFacts
BoxFacts :: fn balance_cents(self) -> i64
fn may_spend(box_name : & str, facts : BoxFacts) -> Result <(), String>

Cost

Cost, from tokens and a dated rate schedule.

Item
pub struct Cost

CostPerAccepted

Cost, from tokens and a dated rate schedule.

Item
pub struct CostPerAccepted
CostPerAccepted :: fn ratio(& self) -> Option <f64>
CostPerAccepted :: fn cheaper_at_floor(a : Self, b : Self, coverage_floor : f64) -> Option <bool>

Rate

Cost, from tokens and a dated rate schedule.

Item
pub struct Rate

Rates

Cost, from tokens and a dated rate schedule.

Item
pub struct Rates
Rates :: fn parse(tsv : & str) ->(Self, usize)
Rates :: fn get(& self, schedule_id : & str, model : & str) -> Option <(Rate, & str)>
Rates :: fn cost(& self, schedule_id : & str, model : & str, use_ : TokenUse) -> Option <Cost>

TokenUse

Cost, from tokens and a dated rate schedule.

Item
pub struct TokenUse

Claim

Which corpus answers an ask, read from rows rather than compiled in.

Item
pub struct Claim
Claim :: fn bounded(& self) -> bool
Claim :: fn holds(& self, key_kind : & str, key : & str) -> bool
async fn claims_on(pool : & PgPool, noun : & str) -> Result <Vec <Claim>, sqlx::Error>

Corpus

Which corpus answers an ask, read from rows rather than compiled in.

Item
pub struct Corpus
async fn active(pool : & PgPool) -> Result <Vec <Corpus>, sqlx::Error>

Route

Which corpus answers an ask, read from rows rather than compiled in.

Item
pub enum Route
Route :: fn records(& self, fan_out : bool) -> Result <Vec <String>, Undecided>
fn route(claims : & Claim, nouns : & String, key : Option <(& str, & str)>) -> Route

Undecided

Which corpus answers an ask, read from rows rather than compiled in.

Item
pub struct Undecided
Undecided :: fn question(& self) -> String
Undecided :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

dispatch (other)

Dispatch decidables (sprint 4.40): which items an approval may ready,

Item
pub const MAX_ARGV_ITEMS: usize
pub const MAX_ARG_BYTES: usize
pub const MAX_PATH_BYTES: usize
fn ladder_decision(facts : LadderFacts) ->(Rung, String)

DispatchOutcome

Dispatch decidables (sprint 4.40): which items an approval may ready,

Item
pub enum DispatchOutcome
fn classify_runner_output(exit_code : i32, stdout : & str, stderr : & str) -> DispatchOutcome

DonePredicate

Dispatch decidables (sprint 4.40): which items an approval may ready,

Item
pub enum DonePredicate
fn validate_predicate(p : & DonePredicate) -> Result <(), String>
fn suggest_predicate(goal : & str) -> Option <DonePredicate>

ItemState

Dispatch decidables (sprint 4.40): which items an approval may ready,

Item
pub struct ItemState
fn readyable(items : & ItemState) -> Vec <Uuid>

LadderFacts

Dispatch decidables (sprint 4.40): which items an approval may ready,

Item
pub struct LadderFacts

Rung

Dispatch decidables (sprint 4.40): which items an approval may ready,

Item
pub enum Rung

envelope (other)

The envelope every prompt the estate sends (sprint 4.47 A13,

Item
pub const ACCOUNT_OPEN: & str
pub const ACCOUNT_CLOSE: & str
pub const RESULT_FENCE: & str

Admitted

The envelope every prompt the estate sends (sprint 4.47 A13,

Item
pub struct Admitted

Envelope

The envelope every prompt the estate sends (sprint 4.47 A13,

Item
pub struct Envelope
Envelope :: fn demand(& self) -> String
Envelope :: fn admit(& self, reply : & str) -> Result <Admitted, EnvelopeRefusal>

EnvelopeRefusal

The envelope every prompt the estate sends (sprint 4.47 A13,

Item
pub enum EnvelopeRefusal
EnvelopeRefusal :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

JsonType

The envelope every prompt the estate sends (sprint 4.47 A13,

Item
pub enum JsonType
JsonType :: fn as_str(self) -> & 'static str

ResultShape

The envelope every prompt the estate sends (sprint 4.47 A13,

Item
pub struct ResultShape
ResultShape :: fn object(fields : & (& str, JsonType)) -> Self

verb:cap

Execution spine (sprint 4.20): the rows that make an execution, its

Item
fn cap_value(value : & Value, cap : usize) ->(Value, bool)

verb:constants

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub const OBSERVED_VALUE_CAP_BYTES: usize
pub const POLICY_CAP_BYTES: usize
pub const MAX_SHARD_SOURCES: usize
pub const STATUS_NEW: & str
pub const EVIDENCE_KINDS_V1: & & str
pub const LEGAL_TRANSITIONS: & (& str, & str, & str, bool)
pub const QUERY_PACK_SQL: & str

verb:evidence

Execution spine (sprint 4.20): the rows that make an execution, its

Item
fn evidence_hash(kind : & str, subject : & str, observed_value : & Value) -> String

verb:finish

Execution spine (sprint 4.20): the rows that make an execution, its

Item
async fn finish_run(pool : & sqlx::PgPool, run_id : Uuid, result : RunResult, detail : Option <& str>,) -> Result <(), ExecutionError>
async fn finish_run_with_account(pool : & sqlx::PgPool, run_id : Uuid, result : RunResult, detail : Option <& str>, confidence : Option <f64>, reasoning_hash : Option <& str>,) -> Result <(), ExecutionError>

verb:record

Execution spine (sprint 4.20): the rows that make an execution, its

Item
async fn record_shard_provenance(pool : & sqlx::PgPool, shard : & ShardProvenance,) -> Result <(), ExecutionError>
async fn record_transition(pool : & sqlx::PgPool, req : & TransitionRequest,) -> Result <i64, ExecutionError>
async fn record_transition_in(tx : & mut sqlx::Transaction <'_, sqlx::Postgres>, req : & TransitionRequest,) -> Result <i64, ExecutionError>

verb:start

Execution spine (sprint 4.20): the rows that make an execution, its

Item
async fn start_run(pool : & sqlx::PgPool, start : & RunStart,) -> Result <(Uuid, i32), ExecutionError>
async fn start_work_item_run(pool : & sqlx::PgPool, work_item_id : Uuid, executor_kind : ExecutorKind,) -> Result <(Uuid, i32), ExecutionError>

verb:step

Execution spine (sprint 4.20): the rows that make an execution, its

Item
async fn step_scope(pool : & sqlx::PgPool, task_id : Uuid,) -> Result <Vec <ScopeEntry>, ExecutionError>

verb:subject

Execution spine (sprint 4.20): the rows that make an execution, its

Item
fn subject_states(subject_kind : & str) -> Vec <& 'static str>

verb:update

Execution spine (sprint 4.20): the rows that make an execution, its

Item
fn update_edges(subject_kind : & str) -> Vec <(& 'static str, & 'static str)>

verb:validate

Execution spine (sprint 4.20): the rows that make an execution, its

Item
fn validate_run_start(executor_kind : ExecutorKind, shard_hash : Option <& str>, mediated_semantics_hash : Option <& str>, lexicon_version : Option <& str>, disclosure : Option <& Disclosure>,) -> Result <(), String>
fn validate_evidence_kind(kind : & str) -> Result <(), String>
fn validate_shard_sources(count : usize) -> Result <(), String>

verb:verify

Execution spine (sprint 4.20): the rows that make an execution, its

Item
async fn verify_pinned_state(pool : & sqlx::PgPool, shard_hash : & str,) -> Result <Vec <SourceState>, ExecutionError>

Cause

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub enum Cause
Cause :: fn as_str(self) -> & 'static str
fn parse_cause(s : & str) -> Result <Cause, String>
fn validate_transition(subject_kind : & str, from : & str, to : & str, cause : Cause, evidence_present : bool, run_present : bool,) -> Result <(), String>

Disclosure

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct Disclosure

ExecutionError

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub enum ExecutionError
async fn pin_paths(pool : & sqlx::PgPool, shard_hash : & str, paths : & String, repo_commit : & str,) -> Result <Vec <String>, ExecutionError>
async fn record_evidence(pool : & sqlx::PgPool, run_id : Uuid, kind : & str, subject : & str, observed_value : & Value, provenance : & str,) -> Result <Uuid, ExecutionError>
async fn step_done_predicate(pool : & sqlx::PgPool, task_id : Uuid,) -> Result <Option <Value>, ExecutionError>

ExecutorKind

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub enum ExecutorKind
ExecutorKind :: fn as_str(self) -> & 'static str
fn parse_executor_kind(s : & str) -> Result <ExecutorKind, String>

LegalEdge

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct LegalEdge
fn legal_edge(subject_kind : & str, from : & str, to : & str) -> Option <LegalEdge>

NamedQuery

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct NamedQuery
fn parse_query_pack(pack : & str) -> Vec <NamedQuery>

RunResult

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub enum RunResult
RunResult :: fn as_str(self) -> & 'static str
fn parse_run_result(s : & str) -> Result <RunResult, String>

RunStart

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct RunStart

ScopeEntry

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct ScopeEntry
fn scope_dirs(root : & std::path::Path, entries : & ScopeEntry) -> Vec <std::path::PathBuf>

ShardProvenance

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct ShardProvenance
ShardProvenance :: fn is_reproducible(& self) -> bool

SourceState

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct SourceState

TaskEntity

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct TaskEntity

TransitionRequest

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct TransitionRequest

WorkItemEntity

Execution spine (sprint 4.20): the rows that make an execution, its

Item
pub struct WorkItemEntity

gate (other)

Running a gate: the mechanism work item 5 gave Gate 3.

Item
pub const CHECK_TIMEOUT: Duration
pub const MAX_CHECK_OUTPUT_BYTES: usize
pub const ALLOWED_BINARIES: & str; 1
fn argv(program : & str) -> Result <(String, Vec <String>), String>

CheckOutcome

Running a gate: the mechanism work item 5 gave Gate 3.

Item
pub struct CheckOutcome

GateReport

Running a gate: the mechanism work item 5 gave Gate 3.

Item
pub struct GateReport
async fn run_gate(pool : & PgPool, gate : & str, work_item_id : Uuid, repo_root : & str,) -> Result <GateReport, ExecutionError>

identifier (other)

Spelled-out identifiers (sprint 4.47 amendment 10; operator, 2026-09-05:

Item
pub const LEGACY_PREFIXES: (& str, & str); 2
fn spell(label : & str, sprint : & str) -> Option <String>
fn legacy_count(text : & str, sprint : & str) -> usize
fn sprint_of_filename(path : & str) -> Option <String>
fn ratchet(baseline : & Baseline, measured : & (String, usize)) -> Vec <RatchetViolation>

Baseline

Spelled-out identifiers (sprint 4.47 amendment 10; operator, 2026-09-05:

Item
pub struct Baseline
Baseline :: fn parse(text : & str) -> Result <Self, String>
Baseline :: fn render(& self) -> String
Baseline :: fn record(& mut self, path : & str, count : usize) -> Result <(), String>

RatchetViolation

Spelled-out identifiers (sprint 4.47 amendment 10; operator, 2026-09-05:

Item
pub struct RatchetViolation

Site

Spelled-out identifiers (sprint 4.47 amendment 10; operator, 2026-09-05:

Item
pub struct Site
fn relabel(text : & str, sprint : & str) ->(String, Vec <Site>)

inventory (other)

Sprint 4.21 AC9: the inventory check costs no tokens and produces

Item
pub const MAX_QUERIES: usize
pub const MAX_QUERY_BYTES: usize
fn inventory_queries(goal : & str, noise : & std::collections::BTreeSet <String>) -> Vec <String>

InventoryReport

Sprint 4.21 AC9: the inventory check costs no tokens and produces

Item
pub struct InventoryReport
async fn run_inventory_check(pool : & PgPool, work_item_id : Uuid,) -> Result <InventoryReport, ExecutionError>

KindRow

The kind rows derived from ratified terms (sprint 4.47; ADR 0045 §3:

Item
pub struct KindRow
fn kind_row_for(term : & str) -> Option <KindRow>

lexicon (other)

Language policy as execution state (sprint 4.20 continuation).

Item
pub const REGISTRY_FILES: & & str
pub const RATIFIED_ROLE_VOCABULARY: & str
fn lexicon_version(sources : & (& str, & str)) -> String
fn conflicts(lexicon_tsv : & str, roles_tsv : & str, tier_tsv : & str, glossary_tsv : & str, ratified_role_vocabulary : & str,) -> Vec <String>
fn status_of(registry : & GovernedTerm, term : & str) -> TermStatus
fn classify_coinage(registry : & GovernedTerm, term : & str, concept : & str, evidence : Value, lexicon_version : & str, _policy : CoinagePolicy,) -> CoinageVerdict
fn validate_ratification_authority(authority : & str) -> Result <(), String>

CoinagePolicy

Language policy as execution state (sprint 4.20 continuation).

Item
pub enum CoinagePolicy
CoinagePolicy :: fn as_str(self) -> & 'static str
CoinagePolicy :: fn parse(s : & str) -> Result <Self, String>

CoinageVerdict

Language policy as execution state (sprint 4.20 continuation).

Item
pub enum CoinageVerdict

GovernedTerm

Language policy as execution state (sprint 4.20 continuation).

Item
pub struct GovernedTerm
fn build_registry(lexicon_tsv : & str, roles_tsv : & str, tier_tsv : & str, glossary_tsv : & str, ratified_role_vocabulary : & str,) -> Vec <GovernedTerm>

LexicalViolation

Language policy as execution state (sprint 4.20 continuation).

Item
pub struct LexicalViolation
fn validate_output(path : & str, lines : & String, lexicon_tsv : & str) -> Vec <LexicalViolation>

NeedsTermRatification

Language policy as execution state (sprint 4.20 continuation).

Item
pub struct NeedsTermRatification

TermStatus

Language policy as execution state (sprint 4.20 continuation).

Item
pub enum TermStatus
TermStatus :: fn as_str(self) -> & 'static str
TermStatus :: fn admissible_in_new_output(self) -> bool

lexicon_export (other)

Sprint 4.47 U1c task a2: the rows render the files.

Item
fn normalize_label(label : & str) -> String
fn non_ascii_labels(terms : & TermRow, labels : & LabelRow) -> Vec <String>
fn resolvable_label_conflicts(terms : & TermRow, labels : & LabelRow) -> Vec <LabelConflict>
fn render_lexicon(header : & str, terms : & TermRow) -> Result <String, Vec <UnrenderableField>>
fn render_roles(header : & str, terms : & TermRow) -> Result <String, Vec <UnrenderableField>>
fn render_tiers(header : & str, terms : & TermRow) -> Result <String, Vec <UnrenderableField>>
fn render_glossary(header : & str, terms : & TermRow, labels : & LabelRow, broader : & BroaderRow,) -> Result <String, Vec <UnrenderableField>>
fn render_canonical(header : & str, terms : & TermRow, labels : & LabelRow, broader : & BroaderRow,) -> Result <String, Vec <UnrenderableField>>
fn parse_canonical(tsv : & str,) -> Result <(Vec <TermRow>, Vec <LabelRow>, Vec <BroaderRow>), Vec <SeedRefusal>>
fn canonical_round_trips(bytes : & str, terms : & TermRow, labels : & LabelRow, broader : & BroaderRow,) -> Result <(), String>
fn parse_term_seed(tsv : & str) -> Result <Vec <SeedRow>, Vec <SeedRefusal>>

BroaderRow

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct BroaderRow

LabelConflict

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct LabelConflict

LabelKind

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub enum LabelKind
LabelKind :: fn as_str(self) -> & 'static str

LabelRow

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct LabelRow

LineDiff

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct LineDiff
fn diff_rendering(path : & str, on_disk : & str, rendered : & str) -> Vec <LineDiff>

SeedRefusal

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct SeedRefusal

SeedRow

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct SeedRow

TermRow

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct TermRow
fn unenforced_retirements(terms : & TermRow) -> Vec <(String, Option <String>)>

UnrenderableField

Sprint 4.47 U1c task a2: the rows render the files.

Item
pub struct UnrenderableField

metering (other)

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub const TOKEN_CLASSES: & str; 4
pub const USAGE_SOURCES: & str; 4
fn cost_of(counts : & Counts, prices : & PriceRow, model : & str, at : & str,) -> Result <DerivedCost, String>
fn derivation_key(execution_run_id : uuid::Uuid, usage_event_ids : & uuid::Uuid, price_ids : & uuid::Uuid,) -> String
fn canonical_utc(ts : & str) -> Option <String>
fn attribute_facts <'a>(facts : & 'a UsageFact, runs : & RunWindow,) ->(Vec <(uuid::Uuid, & 'a UsageFact)>, Vec <& 'a UsageFact>)
fn cents_of(amount : & Money) -> Result <i64, String>
fn unposted(all : & uuid::Uuid, posted : & std::collections::HashSet <uuid::Uuid>,) -> Vec <uuid::Uuid>
async fn record_usage_events(pool : & sqlx::PgPool, attributed : & (uuid::Uuid, & UsageFact),) -> Result <CaptureOutcome, sqlx::Error>
fn derive_remainder(facts : & PostFactRow, remainder : & uuid::Uuid, prices : & PriceRow,) -> Result <(Money, Vec <uuid::Uuid>), String>
async fn count_unreconciled(pool : & sqlx::PgPool) -> Result <usize, sqlx::Error>

CaptureOutcome

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct CaptureOutcome

Counts

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct Counts
fn sum_usage(events : & Counts) -> Counts
fn worker_usage_counts(json : & str) -> Option <(Counts, Option <String>)>
async fn record_worker_usage(pool : & sqlx::PgPool, run_id : uuid::Uuid, counts : & Counts, model : Option <& str>,) -> Result <bool, sqlx::Error>

DerivedCost

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct DerivedCost

PostFactRow

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub type PostFactRow: (uuid::Uuid, Option <String>, Option <String>, i64, i64, i64, i64,)

PostReport

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct PostReport
async fn post_costs(pool : & sqlx::PgPool, tenant_id : uuid::Uuid,) -> Result <PostReport, sqlx::Error>

PriceRow

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct PriceRow
fn price_in_effect <'a>(prices : & 'a PriceRow, model : & str, class : & str, at : & str,) -> Option <& 'a PriceRow>
async fn load_prices(pool : & sqlx::PgPool) -> Result <Vec <PriceRow>, sqlx::Error>

PriceSeed

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct PriceSeed
fn parse_rates_tsv(tsv : & str) -> Result <Vec <PriceSeed>, String>
async fn ingest_prices(pool : & sqlx::PgPool, seeds : & PriceSeed,) -> Result <(usize, usize, Vec <String>), sqlx::Error>

RunWindow

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct RunWindow
async fn run_windows_for_session(pool : & sqlx::PgPool, harness_run_id : & str,) -> Result <Vec <RunWindow>, sqlx::Error>

UsageFact

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct UsageFact
fn usage_fact(line : & str) -> Option <UsageFact>
fn dedupe_facts(facts : Vec <UsageFact>) -> Vec <UsageFact>

UsageSurvey

The meter (sprint 4.37): counts are facts, prices are ratified data,

Item
pub struct UsageSurvey
fn survey_usage <'a>(lines : impl Iterator <Item = & 'a str>) -> UsageSurvey

payload (other)

Payload store (sprint 4.43b): keep the exact shard and mediated-form bytes a

Item
pub const MAX_PAYLOAD_BYTES: usize
fn content_matches_hash(content : & str, hash : & str) -> bool
fn fits(len : usize, max : usize) -> bool
fn storable(content : & str, hash : & str) -> bool
async fn load_shard_payload(pool : & PgPool, shard_hash : & str,) -> Result <Option <LoadedPayload>, PayloadError>
async fn load_mediated_payload(pool : & PgPool, mediated_hash : & str,) -> Result <Option <LoadedPayload>, PayloadError>
async fn load_reasoning_payload(pool : & PgPool, reasoning_hash : & str,) -> Result <Option <LoadedPayload>, PayloadError>

LoadedPayload

Payload store (sprint 4.43b): keep the exact shard and mediated-form bytes a

Item
pub struct LoadedPayload

PayloadError

Payload store (sprint 4.43b): keep the exact shard and mediated-form bytes a

Item
pub enum PayloadError
fn verify_loaded(content : & str, byte_count : i64, hash : & str) -> Result <(), PayloadError>
async fn store_shard_payload(pool : & PgPool, shard_hash : & str, content : & str,) -> Result <bool, PayloadError>
async fn store_reasoning_payload(pool : & PgPool, reasoning_hash : & str, content : & str,) -> Result <bool, PayloadError>
async fn store_mediated_payload(pool : & PgPool, mediated_hash : & str, content : & str,) -> Result <bool, PayloadError>

probe (other)

The definition of done, and what happens when it is not met.

Item
fn eval_path_exists(root : & Path, path : & str, kind : PathKind) -> ProbeResult
fn decide(outcome : Outcome, attempts : Attempts) -> NextAction
fn is_cargo_test(argv : & String) -> bool
fn ran_no_tests(stdout : & str) -> bool

Attempts

The definition of done, and what happens when it is not met.

Item
pub struct Attempts

NextAction

The definition of done, and what happens when it is not met.

Item
pub enum NextAction

Outcome

The definition of done, and what happens when it is not met.

Item
pub enum Outcome

PathKind

The definition of done, and what happens when it is not met.

Item
pub enum PathKind

Probe

The definition of done, and what happens when it is not met.

Item
pub enum Probe
fn parse_probe(raw : & serde_json::Value) -> Result <Probe, String>

ProbeResult

The definition of done, and what happens when it is not met.

Item
pub struct ProbeResult

reading (other)

How a model read a governed word (story 4.74). Pure: the closed set of

Item
fn offered(input : & SensePreferenceInput <'_>) -> Candidates
fn parse_sense_selection(text : & str, offered : & Candidates) -> Result <Candidate, String>
fn preference_of(selected : Candidate) -> SensePreference
fn rank_conflict(rows : & ReadingRow) -> Vec <TermRank>

AdjudicationInput

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub struct AdjudicationInput<'a>
fn adjudication_prompt(input : & AdjudicationInput <'_>) -> String

Candidate

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub enum Candidate

Candidates

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub struct Candidates
fn candidates_for(term : & str) -> Candidates

Reading

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub enum Reading
Reading :: fn as_str(self) -> & 'static str
Reading :: fn parse(text : & str) -> Result <Self, String>
fn classify_reading(verdict : SenseVerdict) -> Reading
fn parse_adjudication(text : & str, expected : usize) -> Result <Vec <Option <Reading>>, String>

ReadingRow

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub struct ReadingRow

SensePreference

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub enum SensePreference

SensePreferenceInput

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub struct SensePreferenceInput<'a>
fn sense_preference_prompt(input : & SensePreferenceInput <'_>) -> String

SenseVerdict

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub enum SenseVerdict

TermRank

How a model read a governed word (story 4.74). Pure: the closed set of

Item
pub struct TermRank

requirement (other)

The requirements chain, decidable half (sprint 4.47 U19, A11, A12):

Item
fn plan_guard(requirements : & Requirement, findings : & Finding) -> Vec <PlanRefusal>

Disposition

The requirements chain, decidable half (sprint 4.47 U19, A11, A12):

Item
pub enum Disposition

Finding

The requirements chain, decidable half (sprint 4.47 U19, A11, A12):

Item
pub struct Finding

NeedKind

The requirements chain, decidable half (sprint 4.47 U19, A11, A12):

Item
pub enum NeedKind

PlanRefusal

The requirements chain, decidable half (sprint 4.47 U19, A11, A12):

Item
pub enum PlanRefusal

Requirement

The requirements chain, decidable half (sprint 4.47 U19, A11, A12):

Item
pub struct Requirement

session_usage (other)

Session accounting (sprint 4.20 continuation): token usage per harness

Item
fn extract_usage(line : & str) -> Option <(BTreeMap <String, i64>, Option <String>)>
fn run_id_from_source_ref(source_ref : & str) -> String

SessionUsage

Session accounting (sprint 4.20 continuation): token usage per harness

Item
pub struct SessionUsage
fn fold_session(run_id : & str, lines : impl Iterator <Item = String>) -> SessionUsage
async fn record_usage(pool : & sqlx::PgPool, usage : & SessionUsage) -> Result <usize, sqlx::Error>

story (other)

The story harness above the execution spine (sprint 4.20 continuation):

Item
pub const TEMPLATE_REGISTRY_PATH: & str
pub const SUPPLIERS: & str; 3
fn accept_worker_result(result : & WorkerResult, registry : & TemplateSection, kind : & str,) -> Result <(), Vec <ResultRefusal>>
fn headings_of(markdown : & str) -> Vec <String>
fn render_story(projection : & StoryProjection, registry : & TemplateSection, kind : & str,) -> String

Audience

The story harness above the execution spine (sprint 4.20 continuation):

Item
pub enum Audience
Audience :: fn as_str(self) -> & 'static str
Audience :: fn parse(s : & str) -> Result <Self, String>

OracleResult

The story harness above the execution spine (sprint 4.20 continuation):

Item
pub enum OracleResult
OracleResult :: fn as_str(self) -> & 'static str
fn evaluate_criterion(oracle_kind : & str, required_evidence_kind : Option <& str>, evidence : & (String, Value),) -> OracleResult

ResultRefusal

The story harness above the execution spine (sprint 4.20 continuation):

Item
pub enum ResultRefusal

StoryProjection

The story harness above the execution spine (sprint 4.20 continuation):

Item
pub struct StoryProjection

TemplateSection

The story harness above the execution spine (sprint 4.20 continuation):

Item
pub struct TemplateSection
fn render_template_registry(rows : & TemplateSection) -> String
fn parse_template_registry(tsv : & str) -> Result <Vec <TemplateSection>, String>
fn validate_rendered(markdown : & str, registry : & TemplateSection, kind : & str,) -> Result <(), String>

WorkerResult

The story harness above the execution spine (sprint 4.20 continuation):

Item
pub struct WorkerResult

story_compile (other)

The ingest direction of the story doctrine (sprint 4.39): a hand-written

Item
pub const DOC_CAP_BYTES: usize
pub const MAX_CRITERIA: usize
pub const MAX_TASKS: usize
pub const COMPILER_VERSION: & str
fn diff_story(existing_intent : & str, existing : & ExistingCriterion, compiled : & CompiledStory,) -> StoryAmendment
fn compile_story(markdown : & str, filename : Option <& str>,) -> Result <CompiledStory, CompileRefusal>

CompileRefusal

The ingest direction of the story doctrine (sprint 4.39): a hand-written

Item
pub enum CompileRefusal
CompileRefusal :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

CompiledCriterion

The ingest direction of the story doctrine (sprint 4.39): a hand-written

Item
pub struct CompiledCriterion

CompiledStory

The ingest direction of the story doctrine (sprint 4.39): a hand-written

Item
pub struct CompiledStory

ExistingCriterion

The ingest direction of the story doctrine (sprint 4.39): a hand-written

Item
pub struct ExistingCriterion

ParsedUserStory

The ingest direction of the story doctrine (sprint 4.39): a hand-written

Item
pub struct ParsedUserStory
fn parse_user_story(section : & str) -> Option <ParsedUserStory>

StoryAmendment

The ingest direction of the story doctrine (sprint 4.39): a hand-written

Item
pub struct StoryAmendment
StoryAmendment :: fn is_empty(& self) -> bool
StoryAmendment :: fn is_refused(& self) -> bool

story_html (other)

The human's projection of a story: themed HTML from the same canonical

Item
pub const HTML_GENERATOR_VERSION: & str
pub const STORY_CSS: & str
fn escape(s : & str) -> String
fn anchor(section : & str) -> String
fn render_story_html(projection : & StoryProjection, registry : & TemplateSection, kind : & str, md_href : Option <& str>,) -> String

story_sections (other)

The sprint document's sections that had a declared table and no writer

Item
fn check_security_plan(s : & SecurityPlan) -> Option <SectionRefusal>
fn check_consensus_position(p : & ConsensusPosition) -> Option <SectionRefusal>
fn check_planned_test(t : & PlannedTest) -> Option <SectionRefusal>
async fn record_security_plan(pool : & sqlx::PgPool, s : & SecurityPlan, provenance : & str,) -> Result <Uuid, SectionError>
async fn record_consensus_position(pool : & sqlx::PgPool, p : & ConsensusPosition, provenance : & str,) -> Result <Uuid, SectionError>
async fn record_planned_test(pool : & sqlx::PgPool, t : & PlannedTest, provenance : & str,) -> Result <Uuid, SectionError>
fn check_new_need(n : & NewNeed) -> Option <SectionRefusal>
fn check_new_requirement(r : & NewRequirement) -> Option <SectionRefusal>
fn check_new_finding(f : & NewFinding) -> Option <SectionRefusal>
async fn record_need(pool : & sqlx::PgPool, n : & NewNeed, provenance : & str,) -> Result <Uuid, SectionError>
async fn record_requirement(pool : & sqlx::PgPool, r : & NewRequirement,) -> Result <Uuid, SectionError>
async fn record_finding(pool : & sqlx::PgPool, f : & NewFinding) -> Result <Uuid, SectionError>

ConsensusPosition

The sprint document's sections that had a declared table and no writer

Item
pub struct ConsensusPosition

NeedPath

The sprint document's sections that had a declared table and no writer

Item
pub enum NeedPath
NeedPath :: fn as_str(self) -> & 'static str

NewFinding

The sprint document's sections that had a declared table and no writer

Item
pub struct NewFinding

NewNeed

The sprint document's sections that had a declared table and no writer

Item
pub struct NewNeed

NewRequirement

The sprint document's sections that had a declared table and no writer

Item
pub struct NewRequirement

PlannedTest

The sprint document's sections that had a declared table and no writer

Item
pub struct PlannedTest

Priority

The sprint document's sections that had a declared table and no writer

Item
pub enum Priority
Priority :: fn as_str(self) -> & 'static str

SectionError

The sprint document's sections that had a declared table and no writer

Item
pub enum SectionError
SectionError :: fn from(r : SectionRefusal) -> Self

SectionRefusal

The sprint document's sections that had a declared table and no writer

Item
pub struct SectionRefusal

SecurityInvariant

The sprint document's sections that had a declared table and no writer

Item
pub enum SecurityInvariant
SecurityInvariant :: fn as_str(self) -> & 'static str
SecurityInvariant :: fn all() -> Self; 4
fn unanswered_invariants(answered : & SecurityInvariant) -> Vec <SecurityInvariant>

SecurityPlan

The sprint document's sections that had a declared table and no writer

Item
pub struct SecurityPlan

symbol_index (other)

Sprint 4.21 AC3: the symbol inventory is state, not a file.

Item
fn normalized_name(name : & str) -> String

SymbolRow

Sprint 4.21 AC3: the symbol inventory is state, not a file.

Item
pub struct SymbolRow
async fn replace_symbols(pool : & PgPool, rows : & SymbolRow) -> Result <u64, sqlx::Error>

work_product (other)

Sprint 4.47 U1a — the work-product ontology, decidable half.

Item
fn sprint_state_machine() -> operations_workflow::Result <StateMachineDefinition>
fn sprint_number_valid(number : & str) -> bool
fn slug_valid(slug : & str) -> bool
fn kind_name_valid(kind : & str) -> bool

KindRefusal

Sprint 4.47 U1a — the work-product ontology, decidable half.

Item
pub enum KindRefusal
fn admit_kind(kind : & str, term_status : TermStatus) -> Result <(), KindRefusal>

SprintKey

Sprint 4.47 U1a — the work-product ontology, decidable half.

Item
pub struct SprintKey
SprintKey :: fn key(& self) -> String

SprintRef

Sprint 4.47 U1a — the work-product ontology, decidable half.

Item
pub enum SprintRef
fn parse_sprint_ref(s : & str) -> Result <SprintRef, String>

SprintState

Sprint 4.47 U1a — the work-product ontology, decidable half.

Item
pub enum SprintState
SprintState :: fn as_str(self) -> & 'static str
SprintState :: fn parse(s : & str) -> Result <Self, String>
SprintState :: fn next(self) -> Option <Self>
SprintState :: fn can_transition(self, to : Self) -> bool

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

operations_control_plane

flowchart TD
  n_operations_control_plane["operations_control_plane"]
  n_operations_control_plane --> n_benefit["benefit"]
  n_operations_control_plane --> n_boxes["boxes"]
  n_operations_control_plane --> n_cost["cost"]
  n_operations_control_plane --> n_datasource["datasource"]
  n_operations_control_plane --> n_dispatch["dispatch"]
  n_operations_control_plane --> n_envelope["envelope"]
  n_operations_control_plane --> n_execution["execution"]
  n_operations_control_plane --> n_gate["gate"]
  n_operations_control_plane --> n_identifier["identifier"]
  n_operations_control_plane --> n_inventory["inventory"]
  n_operations_control_plane --> n_kinds["kinds"]
  n_operations_control_plane --> n_lexicon["lexicon"]
  n_operations_control_plane --> n_lexicon_export["lexicon_export"]
  n_operations_control_plane --> n_metering["metering"]
  n_operations_control_plane --> n_payload["payload"]
  n_operations_control_plane --> n_probe["probe"]
  n_operations_control_plane --> n_reading["reading"]
  n_operations_control_plane --> n_requirement["requirement"]
  n_operations_control_plane --> n_session_usage["session_usage"]
  n_operations_control_plane --> n_story["story"]
  n_operations_control_plane --> n_story_compile["story_compile"]
  n_operations_control_plane --> n_story_html["story_html"]
  n_operations_control_plane --> n_story_sections["story_sections"]
  n_operations_control_plane --> n_symbol_index["symbol_index"]
  n_operations_control_plane --> n_work_product["work_product"]

Public surface

`crate root`

ItemWhat it is
pub const CONTROL_PLANE_MIGRATIONS: & (& str, & str)The schema this crate owns, applied into corpus_sourcecode by whoever runs migrations for that database

`benefit`

ItemWhat it is
pub enum RealisationHow far a benefit has come from its baseline toward its target, as at the latest measurement
Realisation :: fn as_str(self) -> & 'static strThe word the benefit_realisation view uses for this state.
fn share(baseline : f64, target : f64, latest : f64) -> Option <f64>The signed share of the way from baseline to target, direction-agnostic: a cost falling 100 → 60 realises at 60 exactly as revenue rising 60 → 100 does
fn realisation(baseline : f64, target : f64, latest : Option <f64>) -> RealisationThe benefit's state as at its latest measurement, or Unmeasured when there is none.
fn validate_measure(unit : & str, baseline : f64, target : f64) -> Result <(), String>The measure a benefit must carry to be written at all: a unit, and two numbers that differ

`boxes`

ItemWhat it is
pub struct BoxFactsA box as the decision sees it: the asserted limit and the derived sum of posted costs, both in cents.
BoxFacts :: fn balance_cents(self) -> i64Limit minus posted — negative when overspent (late postings can do that; the NEXT dispatch refuses, per the round's injection probe).
fn may_spend(box_name : & str, facts : BoxFacts) -> Result <(), String>AC2's decision: may this story's item proceed to a PAID rung? A refusal names the box and its balance — the runner prints it verbatim and the console banners it
fn median_p90_cents(costs : & i64) -> Option <(i64, i64)>AC5: median and p90 (nearest-rank) over posted per-run costs, cents

`cost`

ItemWhat it is
pub struct RateRates for one model under one schedule, per MILLION tokens.
pub struct TokenUseWhat a run consumed
pub struct CostA computed cost, inseparable from the schedule that produced it.
pub struct RatesParsed rate registry: (schedule_id, model) -> (Rate, currency).
Rates :: fn parse(tsv : & str) ->(Self, usize)Parse the committed TSV
Rates :: fn get(& self, schedule_id : & str, model : & str) -> Option <(Rate, & str)>
Rates :: fn cost(& self, schedule_id : & str, model : & str, use_ : TokenUse) -> Option <Cost>Cost this usage under a named schedule
pub struct CostPerAcceptedCost per accepted result — the metric that matters, and the one that is gamed if reported alone
CostPerAccepted :: fn ratio(& self) -> Option <f64>None when nothing was accepted: dividing by zero accepted results would report infinite cost for a run that simply produced nothing, which is a different failure and needs a different response.
CostPerAccepted :: fn cheaper_at_floor(a : Self, b : Self, coverage_floor : f64) -> Option <bool>The comparison, refused unless both arms clear the coverage floor

`datasource`

ItemWhat it is
pub struct CorpusOne record that can answer an ask.
pub struct ClaimOne corpus's claim on one governed noun.
Claim :: fn bounded(& self) -> boolDoes this claim state a range at all?
Claim :: fn holds(& self, key_kind : & str, key : & str) -> boolCould this claim hold key? An unbounded claim always could: stating no range is silence, not a claim of absence, and excluding it would turn one into the other
pub enum RouteHow an ask reached the record that answered it.
Route :: fn records(& self, fan_out : bool) -> Result <Vec <String>, Undecided>The corpora this route may actually be answered from
pub struct UndecidedSeveral records could answer and this capability answers from one
Undecided :: fn question(& self) -> StringThe question to put to the operator, built from the rows
Undecided :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
async fn active(pool : & PgPool) -> Result <Vec <Corpus>, sqlx::Error>Every corpus that can be asked today, in name order
async fn claims_on(pool : & PgPool, noun : & str) -> Result <Vec <Claim>, sqlx::Error>Every claim on one noun, in try order
fn route(claims : & Claim, nouns : & String, key : Option <(& str, & str)>) -> RouteRoute by governed noun, optionally narrowed by a key

`dispatch`

ItemWhat it is
pub const MAX_ARGV_ITEMS: usizeCaps on the predicate form (Gate 1.5.6 §1).
pub const MAX_ARG_BYTES: usize
pub const MAX_PATH_BYTES: usize
pub enum DonePredicateThe typed done-predicate forms the runner evaluates
fn validate_predicate(p : & DonePredicate) -> Result <(), String>Validate an operator-supplied predicate (AC2): typed kinds only, caps enforced, paths repo-relative with no parent escapes
pub struct ItemStateOne work item as the readying decision sees it.
fn readyable(items : & ItemState) -> Vec <Uuid>AC1: the set an approval may ready — draft items whose dependency (when one exists) is already verified
fn suggest_predicate(goal : & str) -> Option <DonePredicate>Suggest a done predicate from the task's own words (operator ask, 2026-09-02: "does the program not do that for me?")
pub enum RungThe routing ladder's rungs (sprint 4.41 AC3), cheapest lawful first.
pub struct LadderFactsThe inputs the ladder decision needs — all queried/probed by the rim.
fn ladder_decision(facts : LadderFacts) ->(Rung, String)AC3: pick the rung and say why — the sentence lands in routing_decision verbatim.
pub enum DispatchOutcomeWhat one runner invocation amounted to (AC3): classified from the runner's own words, refusals verbatim — never re-guessed.
fn classify_runner_output(exit_code : i32, stdout : & str, stderr : & str) -> DispatchOutcomeClassify the runner's captured output + exit status.

`envelope`

ItemWhat it is
pub const ACCOUNT_OPEN: & strThe fence the model must open its account with, and close.
pub const ACCOUNT_CLOSE: & str
pub const RESULT_FENCE: & strThe fence the typed result travels in.
pub enum JsonTypeA JSON type a field must have, for the flat-object constructor.
JsonType :: fn as_str(self) -> & 'static str
pub struct ResultShapeThe declared shape of a prompt kind's result: a JSON Schema document
ResultShape :: fn object(fields : & (& str, JsonType)) -> SelfThe common case: an object with exactly these required fields, no others (additionalProperties: false), each of one JSON type.
pub struct EnvelopeWhat every prompt carries: its kind and the shape it demands back.
pub enum EnvelopeRefusalWhy a reply was refused
EnvelopeRefusal :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub struct AdmittedA reply that passed the envelope: the account verbatim, the typed result, and how many bytes of prose fell outside the two.
Envelope :: fn demand(& self) -> StringThe demand appended to every prompt, rendered from the schema so the model is told exactly what comes back and nothing is typed per prompt.
Envelope :: fn admit(& self, reply : & str) -> Result <Admitted, EnvelopeRefusal>Admit a reply or refuse it, by the rules in the module doc

`execution`

ItemWhat it is
pub const OBSERVED_VALUE_CAP_BYTES: usizeCap on evidence.observed_value bytes (Gate 1.5.6 §1)
pub const POLICY_CAP_BYTES: usizeCap on routing_decision / selection_policy jsonb bytes.
pub const MAX_SHARD_SOURCES: usizeCap on shard_source rows per shard.
pub const STATUS_NEW: & strThe pseudo-status a subject transitions FROM at creation, so from_status can stay NOT NULL and the composite foreign key applies to the first transition as well as every later one.
pub const EVIDENCE_KINDS_V1: & & strEvidence kinds, v1
pub enum ExecutorKindWho or what performed an execution.
ExecutorKind :: fn as_str(self) -> & 'static strThe stored executor_kind text.
pub enum RunResultTerminal state of one execution attempt.
RunResult :: fn as_str(self) -> & 'static strThe stored result text.
pub enum Cause
Cause :: fn as_str(self) -> & 'static strThe stored cause text.
fn parse_executor_kind(s : & str) -> Result <ExecutorKind, String>Parse an executor_kind from the CLI
fn parse_run_result(s : & str) -> Result <RunResult, String>Parse a terminal result from the CLI
fn parse_cause(s : & str) -> Result <Cause, String>Parse a transition cause from the CLI
pub const LEGAL_TRANSITIONS: & (& str, & str, & str, bool)The legal state graph, as data: (subject_kind, from, to, requires_evidence)
pub struct LegalEdgeOne legal edge, resolved.
fn legal_edge(subject_kind : & str, from : & str, to : & str) -> Option <LegalEdge>Look up an edge in LEGAL_TRANSITIONS.
fn subject_states(subject_kind : & str) -> Vec <& 'static str>The states a subject kind can occupy, in the machine's own declaration order (first appearance of each to state in LEGAL_TRANSITIONS)
fn validate_run_start(executor_kind : ExecutorKind, shard_hash : Option <& str>, mediated_semantics_hash : Option <& str>, lexicon_version : Option <& str>, disclosure : Option <& Disclosure>,) -> Result <(), String>The model-run provenance rule: a model execution names the exact shard and the exact mediated semantics it ran on, or it does not start
fn validate_transition(subject_kind : & str, from : & str, to : & str, cause : Cause, evidence_present : bool, run_present : bool,) -> Result <(), String>Transition legality plus the per-edge evidence requirement
fn validate_evidence_kind(kind : & str) -> Result <(), String>The v1 evidence vocabulary gate
fn cap_value(value : & Value, cap : usize) ->(Value, bool)Truncate an oversize jsonb payload, returning the value to store and whether it was truncated
fn evidence_hash(kind : & str, subject : & str, observed_value : & Value) -> StringContent hash for an evidence row: SHA-256 over kind\nsubject\n<canonical value>, lowercase hex
fn validate_shard_sources(count : usize) -> Result <(), String>The shard-source cap (Gate 1.5.6 §1)
pub struct ShardProvenanceA shard's provenance: enough to recompile it, never its bytes.
ShardProvenance :: fn is_reproducible(& self) -> boolA shard is reproducible only if every source is pinned to a corpus_doc_version row.
pub const QUERY_PACK_SQL: & strThe checked-in query pack
pub struct NamedQueryOne named query from the pack.
fn parse_query_pack(pack : & str) -> Vec <NamedQuery>Split the query pack into named blocks: a -- name: <slug> line opens a block, the first line ending in ; closes it
pub enum ExecutionErrorFailures of the spine's write path.
async fn record_shard_provenance(pool : & sqlx::PgPool, shard : & ShardProvenance,) -> Result <(), ExecutionError>Record a shard's provenance and its pinned sources in one transaction
async fn pin_paths(pool : & sqlx::PgPool, shard_hash : & str, paths : & String, repo_commit : & str,) -> Result <Vec <String>, ExecutionError>Pin a shard's inputs to the corpus's own record of their state
pub struct SourceStateOne pinned source, checked against what the corpus holds NOW.
async fn verify_pinned_state(pool : & sqlx::PgPool, shard_hash : & str,) -> Result <Vec <SourceState>, ExecutionError>The state half of a replay: does every pinned source still hold the bytes the shard was compiled from? # Errors ExecutionError::Db on a connection-level failure.
pub struct RunStartWhat a caller needs to open an execution.
pub struct DisclosureThe disclosure record for one model call (ADR 0035, "Disclosure policy")
async fn start_run(pool : & sqlx::PgPool, start : & RunStart,) -> Result <(Uuid, i32), ExecutionError>Open an execution against a step
async fn start_work_item_run(pool : & sqlx::PgPool, work_item_id : Uuid, executor_kind : ExecutorKind,) -> Result <(Uuid, i32), ExecutionError>Start a run whose subject is a WORK ITEM rather than a task (0062)
async fn finish_run(pool : & sqlx::PgPool, run_id : Uuid, result : RunResult, detail : Option <& str>,) -> Result <(), ExecutionError>Close an execution
async fn finish_run_with_account(pool : & sqlx::PgPool, run_id : Uuid, result : RunResult, detail : Option <& str>, confidence : Option <f64>, reasoning_hash : Option <& str>,) -> Result <(), ExecutionError>Close an execution WITH the model's own account (sprint 4.43d, US11): confidence fills 0018's reserved at-close column; reasoning_hash points at the stored crate::payload reasoning text
async fn record_evidence(pool : & sqlx::PgPool, run_id : Uuid, kind : & str, subject : & str, observed_value : & Value, provenance : & str,) -> Result <Uuid, ExecutionError>Record one typed observation against an execution
pub struct ScopeEntryOne artifact a work item is scoped to, as work_item_scope records it.
fn scope_dirs(root : & std::path::Path, entries : & ScopeEntry) -> Vec <std::path::PathBuf>The directories a harness may be granted for a scope, resolved against a repo root
async fn step_scope(pool : & sqlx::PgPool, task_id : Uuid,) -> Result <Vec <ScopeEntry>, ExecutionError>The artifacts this step's work item is scoped to
async fn step_done_predicate(pool : & sqlx::PgPool, task_id : Uuid,) -> Result <Option <Value>, ExecutionError>This step's definition of done, as stored on its work item
pub struct TransitionRequestOne status change, applied.
async fn record_transition(pool : & sqlx::PgPool, req : & TransitionRequest,) -> Result <i64, ExecutionError>Apply a status change AND record it, in one transaction
async fn record_transition_in(tx : & mut sqlx::Transaction <'_, sqlx::Postgres>, req : & TransitionRequest,) -> Result <i64, ExecutionError>The transition inside a CALLER-OWNED transaction (sprint 4.40 AC1: an approval readies its story's items in the approval's own transaction — all of it commits or none)
pub struct WorkItemEntitywork_item as a operations_workflow::store::StatefulEntity -- sprint 4.21 AC2's binding of the harness subjects to the shipped CAS.
pub struct TaskEntityThe task — the ordered unit inside a work item (ISO/IEC/IEEE 12207) — as a stateful entity
fn update_edges(subject_kind : & str) -> Vec <(& 'static str, & 'static str)>The (from, to) pairs 0029's generated trigger enforces for one subject kind -- LEGAL_TRANSITIONS minus the creation edges (creation is an INSERT; the trigger fires on UPDATE).

`gate`

ItemWhat it is
pub const CHECK_TIMEOUT: DurationWall-clock ceiling for one check
pub const MAX_CHECK_OUTPUT_BYTES: usizePer-stream capture cap
pub const ALLOWED_BINARIES: & str; 1Binaries a registered check may invoke
pub struct CheckOutcomeWhat one check decided, and why.
pub struct GateReportWhat one gate run decided about one work item.
fn argv(program : & str) -> Result <(String, Vec <String>), String>Split a registered program string into an allowlisted binary and its arguments
async fn run_gate(pool : & PgPool, gate : & str, work_item_id : Uuid, repo_root : & str,) -> Result <GateReport, ExecutionError>Run every required check of gate against work_item_id, recording each decision as a check_result with the evidence that produced it

`identifier`

ItemWhat it is
pub const LEGACY_PREFIXES: (& str, & str); 2The legacy letter prefixes this module knows, and the kind each spells.
pub struct SiteOne rewritten site: where, what it said, what it says now.
fn spell(label : & str, sprint : & str) -> Option <String>The spelled identifier for one legacy label: AC12 with sprint 4.47 is acceptance-criterion 4.47.12; U1c is work-item 4.47.1c
fn relabel(text : & str, sprint : & str) ->(String, Vec <Site>)Rewrite every legacy label in text to its spelled form for sprint, returning the new text and the sites, in document order
fn legacy_count(text : & str, sprint : & str) -> usizeHow many legacy sites a relabel would touch: the number a commit hook ratchets downward and refuses to see rise.
fn sprint_of_filename(path : & str) -> Option <String>The sprint number a story file carries in its name (a story file named sprint-4.47-<slug>.md4.47), or None for any other file
pub struct BaselineThe ratchet's baseline: one measured count per document, shrink-only
Baseline :: fn parse(text : & str) -> Result <Self, String># Errors A line that is not path<TAB>count, by line number.
Baseline :: fn render(& self) -> String
Baseline :: fn record(& mut self, path : & str, count : usize) -> Result <(), String>Record a measurement
pub struct RatchetViolationOne document the ratchet refuses: its count is above its baseline line (or above zero with no line).
fn ratchet(baseline : & Baseline, measured : & (String, usize)) -> Vec <RatchetViolation>The ratchet over measured documents: every one whose count exceeds what the baseline allows, in path order

`inventory`

ItemWhat it is
pub const MAX_QUERIES: usizeHard cap on queries per inventory run (Gate 1.5.6 §1): the whole-goal query plus the goal's distinct meaningful words, first-appearance order.
pub const MAX_QUERY_BYTES: usizeByte cap one query may occupy -- capability_search refuses above 256, so the derivation never produces what the function would reject.
fn inventory_queries(goal : & str, noise : & std::collections::BTreeSet <String>) -> Vec <String>Derive the queries an inventory run searches, deterministically: the trimmed goal itself (when it fits the byte cap), then each distinct lowercase word longer than two characters that is not a noise word, in first-appearance order, capped at MAX_QUERIES.
pub struct InventoryReportWhat one inventory run found.
async fn run_inventory_check(pool : & PgPool, work_item_id : Uuid,) -> Result <InventoryReport, ExecutionError>Execute the work item's inventory_check root as a tool run: search, record evidence whose subject is the queries, and move the step pending -> in_progress -> verified with the evidence riding the verified edge

`kinds`

ItemWhat it is
pub struct KindRowOne kind row as derived from a ratified term.
fn kind_row_for(term : & str) -> Option <KindRow>Derive a kind row from a ratified term's label

`lexicon`

ItemWhat it is
pub enum TermStatusWhere a term stands in a given vocabulary state
TermStatus :: fn as_str(self) -> & 'static str
TermStatus :: fn admissible_in_new_output(self) -> boolWhether this status may appear, unmarked, in newly governed output.
pub struct GovernedTermOne row of the governed vocabulary.
pub enum CoinagePolicyWhat a model execution may do about a term it cannot express.
CoinagePolicy :: fn as_str(self) -> & 'static str
CoinagePolicy :: fn parse(s : & str) -> Result <Self, String># Errors A string naming the accepted set.
pub const REGISTRY_FILES: & & strThe registry files, in the order that defines the version hash
pub const RATIFIED_ROLE_VOCABULARY: & strThe vocabulary version whose role rows are RATIFIED
fn lexicon_version(sources : & (& str, & str)) -> StringContent hash of a vocabulary state: SHA-256 over name\n<bytes> for each source in the given order
fn build_registry(lexicon_tsv : & str, roles_tsv : & str, tier_tsv : & str, glossary_tsv : & str, ratified_role_vocabulary : & str,) -> Vec <GovernedTerm>Build the governed vocabulary from the repo's ratified files
fn conflicts(lexicon_tsv : & str, roles_tsv : & str, tier_tsv : & str, glossary_tsv : & str, ratified_role_vocabulary : & str,) -> Vec <String>Terms a registry classifies as ratified while ALSO retiring or prohibiting them
fn status_of(registry : & GovernedTerm, term : & str) -> TermStatusLook a term up in a built registry
pub struct LexicalViolationOne lexical violation in governed output.
fn validate_output(path : & str, lines : & String, lexicon_tsv : & str) -> Vec <LexicalViolation>Validate model output BEFORE it is accepted as governed state
pub struct NeedsTermRatificationThe typed stop a governed execution produces instead of coining a term
pub enum CoinageVerdictWhat an execution may do with a term it wants to use.
fn classify_coinage(registry : & GovernedTerm, term : & str, concept : & str, evidence : Value, lexicon_version : & str, _policy : CoinagePolicy,) -> CoinageVerdictDecide what a governed execution may do about term
fn validate_ratification_authority(authority : & str) -> Result <(), String>Only an operator ruling ratifies a term

`lexicon_export`

ItemWhat it is
pub struct TermRowA concept, as the authoring plane holds it.
pub enum LabelKindSKOS altLabel / hiddenLabel.
LabelKind :: fn as_str(self) -> & 'static str
pub struct LabelRowOne label of one concept.
pub struct BroaderRowOne stored broader edge
pub struct UnrenderableFieldA field whose text cannot go into a tab-separated file without changing what the file means
pub struct LineDiffOne line where a rendering and the file on disk disagree.
pub struct LabelConflictTwo labels that would resolve to two concepts from one bare string.
fn normalize_label(label : & str) -> StringThe normal form a bare term is resolved in: trimmed and lowercased
fn non_ascii_labels(terms : & TermRow, labels : & LabelRow) -> Vec <String>Labels the vocabulary will not accept, because their equality under a hook's bare-string match is not decidable without a normalization form this crate does not carry.
fn resolvable_label_conflicts(terms : & TermRow, labels : & LabelRow) -> Vec <LabelConflict>Every pair of labels that normalize to one string across the whole vocabulary -- prefLabels and term labels together, since a hook holds neither concept kind nor table when it resolves a word.
fn render_lexicon(header : & str, terms : & TermRow) -> Result <String, Vec <UnrenderableField>>lexicon-policy.tsv: the retirement list the commit hooks read
fn render_roles(header : & str, terms : & TermRow) -> Result <String, Vec <UnrenderableField>>architectural-role-vocabulary.tsv: vocabulary_version<TAB>role
fn render_tiers(header : & str, terms : & TermRow) -> Result <String, Vec <UnrenderableField>>tier-vocabulary.tsv: term<TAB>definition<TAB>examples
fn render_glossary(header : & str, terms : & TermRow, labels : & LabelRow, broader : & BroaderRow,) -> Result <String, Vec <UnrenderableField>>glossary.tsv: the ratified vocabulary, carrying every field the version must pin
fn render_canonical(header : & str, terms : & TermRow, labels : & LabelRow, broader : & BroaderRow,) -> Result <String, Vec <UnrenderableField>>term-canonical.tsv: the CURRENT semantic state, entire, deterministic from rows (operator ruling 2026-09-10, step 5)
fn parse_canonical(tsv : & str,) -> Result <(Vec <TermRow>, Vec <LabelRow>, Vec <BroaderRow>), Vec <SeedRefusal>>Read term-canonical.tsv back into the rows it was rendered from — the other half of the bootstrap claim (operator ruling 2026-09-10, step 6)
fn canonical_round_trips(bytes : & str, terms : & TermRow, labels : & LabelRow, broader : & BroaderRow,) -> Result <(), String>Prove a canonical rendering reads BACK to the rows it came from
fn unenforced_retirements(terms : & TermRow) -> Vec <(String, Option <String>)>Terms ruled unwritable that no registry file publishes, so no hook refuses them: (term, what to write instead)
pub struct SeedRowOne row of a term seed file: the vocabulary as an operator authored it, before any of it is in the database.
pub struct SeedRefusalWhy a seed row is not importable.
fn parse_term_seed(tsv : & str) -> Result <Vec <SeedRow>, Vec <SeedRefusal>>Parse a term seed file: term kind definition scope_note standard alt hidden broader, - for an empty cell, # for a comment
fn diff_rendering(path : & str, on_disk : & str, rendered : & str) -> Vec <LineDiff>Where the file on disk and the rendering differ, line by line

`metering`

ItemWhat it is
pub const TOKEN_CLASSES: & str; 4The token classes a price can be ratified for — mirrored by 0030's model_price.token_class CHECK (drift-tested).
pub const USAGE_SOURCES: & str; 4Who may report a usage fact — mirrored by 0030's usage_event.source CHECK (drift-tested)
pub struct CountsA run's observed token counts: the sum over its immutable usage events, one field per ratifiable token class.
fn sum_usage(events : & Counts) -> CountsSum usage facts per class
pub struct PriceRowOne ratified price row for one model
fn price_in_effect <'a>(prices : & 'a PriceRow, model : & str, class : & str, at : & str,) -> Option <& 'a PriceRow>The price in effect for model + class at at: the latest row whose effective_from is not later than at, ties broken by id so the pick never depends on input order
pub struct DerivedCostA derived cost: the money amount and the exact price rows it used — the posting binds to these ids, so a historical entry is never silently repriced from today's table.
fn cost_of(counts : & Counts, prices : & PriceRow, model : & str, at : & str,) -> Result <DerivedCost, String>Derive cost as counts × model's prices in effect at at
fn derivation_key(execution_run_id : uuid::Uuid, usage_event_ids : & uuid::Uuid, price_ids : & uuid::Uuid,) -> StringThe derivation's identity: a hash over the RUN id plus the sorted usage-event ids and price-row ids
fn canonical_utc(ts : & str) -> Option <String>Normalize a timestamp to one comparable UTC key: YYYY-MM-DD HH:MM:SS.ffffff (fraction padded to six digits)
pub struct UsageFactOne transcript line's usage, keyed for exactly-once capture.
fn usage_fact(line : & str) -> Option <UsageFact>Read one transcript line into a keyed usage fact, or None for a line carrying no usage or no usable key
fn worker_usage_counts(json : & str) -> Option <(Counts, Option <String>)>Sprint 4.41 AC4 — the worker cost seam: read the frontier CLI's own machine-readable usage (claude --output-format json carries a top-level usage object) into Counts plus the model it names
async fn record_worker_usage(pool : & sqlx::PgPool, run_id : uuid::Uuid, counts : & Counts, model : Option <& str>,) -> Result <bool, sqlx::Error>Bind one worker's self-reported usage to its run (sprint 4.41 AC4)
fn dedupe_facts(facts : Vec <UsageFact>) -> Vec <UsageFact>Collapse repeated keys to the LAST occurrence, keeping first-seen order: streaming writes a message's final usage last (25,957 live divergent cases), so the final line is the fact.
pub struct RunWindow
fn attribute_facts <'a>(facts : & 'a UsageFact, runs : & RunWindow,) ->(Vec <(uuid::Uuid, & 'a UsageFact)>, Vec <& 'a UsageFact>)Attribute facts to the run whose start, finish window contains them (boundaries inclusive)
fn cents_of(amount : & Money) -> Result <i64, String>The exact derivation, rounded to the ledger's grain (cents, bankers' half-even)
fn unposted(all : & uuid::Uuid, posted : & std::collections::HashSet <uuid::Uuid>,) -> Vec <uuid::Uuid>The facts no prior posting names — the next posting's remainder (exactly-once per FACT across a run's accruing postings).
pub struct PriceSeedOne ingest-ready price row: the ratified TSV line, split per token class, per-token, canonical-UTC
fn parse_rates_tsv(tsv : & str) -> Result <Vec <PriceSeed>, String>Parse docs/reference/model-rates.tsv (schedule_id, effective_from date, vendor, model, four per-MILLION rates, currency, provenance) into per-token PriceSeeds
pub struct UsageSurveyWhat the R6 survey measures over one line stream: whether one message's usage object repeats across lines (the double-count shape that would make per-line summing over-bill).
fn survey_usage <'a>(lines : impl Iterator <Item = & 'a str>) -> UsageSurveyCount usage-bearing lines per message.id (the decidable core of the R6 double-count question), and whether any message's repeated usage diverges across its lines.
async fn ingest_prices(pool : & sqlx::PgPool, seeds : & PriceSeed,) -> Result <(usize, usize, Vec <String>), sqlx::Error>Append-only price ingest: a seed whose (model, token_class, effective_from) already exists WITH THE SAME price is a no-op; the same key with a DIFFERENT price is a refused edit-in-place (the TSV header's own rule) — counted and returned, never a clean no-op (Gate 4)
async fn load_prices(pool : & sqlx::PgPool) -> Result <Vec <PriceRow>, sqlx::Error>Every ratified price row, effective_from rendered in the canonical UTC form price_in_effect relies on
async fn run_windows_for_session(pool : & sqlx::PgPool, harness_run_id : & str,) -> Result <Vec <RunWindow>, sqlx::Error>The run windows for one harness session, timestamps pre-canonicalized by the query (AT TIME ZONE 'UTC' — the render the pure fns state)
pub struct CaptureOutcomeWhat one capture pass did with its attributed facts.
async fn record_usage_events(pool : & sqlx::PgPool, attributed : & (uuid::Uuid, & UsageFact),) -> Result <CaptureOutcome, sqlx::Error>Insert attributed facts as transcript-sourced usage events, the line uuid as the idempotency key, the observed model and instant kept on the fact (0031)
pub type PostFactRow: (uuid::Uuid, Option <String>, Option <String>, i64, i64, i64, i64,)One fact row as the poster reads it: id, observed model, canonical observed instant, the four counts.
fn derive_remainder(facts : & PostFactRow, remainder : & uuid::Uuid, prices : & PriceRow,) -> Result <(Money, Vec <uuid::Uuid>), String>PURE: derive the remainder's summed amount and the deduped price rows it used
pub struct PostReportWhat one posting pass did.
async fn post_costs(pool : & sqlx::PgPool, tenant_id : uuid::Uuid,) -> Result <PostReport, sqlx::Error>Post every CLOSED run's underived cost into the tenant's own books: one balanced journal entry per derivation (debit model-usage expense, credit provider payable), cents at the ledger's grain, the exact amount and the fact/price bindings on cost_posting
async fn count_unreconciled(pool : & sqlx::PgPool) -> Result <usize, sqlx::Error>Postings whose journal entry is missing or no longer posted — the soft pointer's reconciliation (Gate 4 N4)

`payload`

ItemWhat it is
pub const MAX_PAYLOAD_BYTES: usizeThe largest payload we store, per row (Gate 1.5.6 input cap)
fn content_matches_hash(content : & str, hash : & str) -> boolDoes content hash (SHA-256, hex) to hash? The same digest the sharder and the DB CHECK use (foundation-audit-log, never a hand-rolled one — Gate 0.5).
fn fits(len : usize, max : usize) -> boollen bytes within max (the boundary is inclusive).
fn storable(content : & str, hash : & str) -> boolA payload is storable when it hashes to its key AND fits the cap.
pub enum PayloadErrorWhy a payload could not be stored — or served.
pub struct LoadedPayloadA stored payload, verified on the way out: the reveal/replay routes serve nothing this function has not re-hashed against its key (AC8).
fn verify_loaded(content : & str, byte_count : i64, hash : & str) -> Result <(), PayloadError>Re-verify a loaded row against its key: the content must hash to hash and the recorded byte_count must equal the content's length
async fn load_shard_payload(pool : & PgPool, shard_hash : & str,) -> Result <Option <LoadedPayload>, PayloadError>Load the stored shard payload for shard_hash, verified (re-hash == key, byte count == length)
async fn load_mediated_payload(pool : & PgPool, mediated_hash : & str,) -> Result <Option <LoadedPayload>, PayloadError>Load the stored mediated form for mediated_hash, same verification.
async fn store_shard_payload(pool : & PgPool, shard_hash : & str, content : & str,) -> Result <bool, PayloadError>Store the shard payload keyed by its hash
async fn store_reasoning_payload(pool : & PgPool, reasoning_hash : & str, content : & str,) -> Result <bool, PayloadError>Store the model's reasoning text keyed by its sha256 (sprint 4.43d, AC14)
async fn load_reasoning_payload(pool : & PgPool, reasoning_hash : & str,) -> Result <Option <LoadedPayload>, PayloadError>Load the stored reasoning for reasoning_hash, verified like the others.
async fn store_mediated_payload(pool : & PgPool, mediated_hash : & str, content : & str,) -> Result <bool, PayloadError>Store the mediated form keyed by its semantic-mediation hash

`probe`

ItemWhat it is
pub enum Probev1 done-predicate enum (Gate 1.5 sprint-4.5 Q2, Codex-sharpened names)
pub enum PathKind
fn parse_probe(raw : & serde_json::Value) -> Result <Probe, String>Parse and validate a stored predicate
pub struct ProbeResultA probe verdict plus the evidence a red verdict carries into the single corrective re-issue (the "diff attached" of harness notes §5).
fn eval_path_exists(root : & Path, path : & str, kind : PathKind) -> ProbeResultEvaluate PathExists — pure given a filesystem root.
pub enum NextActionWhere the loop goes after an attempt (Gate 1.5 Q4: ONE corrective retry with evidence attached; infra failures get ONE separate infra retry and never consume the corrective one).
pub struct AttemptsAttempt bookkeeping fed to decide
pub enum Outcome
fn decide(outcome : Outcome, attempts : Attempts) -> NextActionThe retry state machine
fn is_cargo_test(argv : & String) -> boolWhether this argv is a cargo test invocation, and so subject to the vacuous-pass rule below.
fn ran_no_tests(stdout : & str) -> boolWhether a cargo test run executed NO tests at all

`reading`

ItemWhat it is
pub enum ReadingThe closed set (term_reading.reading CHECK, 0082)
Reading :: fn as_str(self) -> & 'static str
Reading :: fn parse(text : & str) -> Result <Self, String>Exact, lowercase, closed
pub enum SenseVerdictWhat the lexicon's sense split says about one occurrence
fn classify_reading(verdict : SenseVerdict) -> ReadingThe rule from a sense verdict to a reading
pub struct SensePreferenceInput<'a>One term's probe: the bare word and up to three definitions
pub struct CandidatesWhich letter carries which candidate definition in a rendered prompt.
fn candidates_for(term : & str) -> CandidatesThe letter assignment for a term: a fixed function of the word, so the same input always renders the same bytes (a stable shard hash) and ours is not always in the same position (or the model learns the position).
fn sense_preference_prompt(input : & SensePreferenceInput <'_>) -> StringThe prompt as bytes
fn offered(input : & SensePreferenceInput <'_>) -> CandidatesThe letters actually offered for a term, given which definitions exist.
pub enum CandidateWhich candidate the model selected.
fn parse_sense_selection(text : & str, offered : & Candidates) -> Result <Candidate, String>A model's answer against the offered letters
pub enum SensePreferenceWhich sense the model prefers with no context to go on: ours, another, or it declined
fn preference_of(selected : Candidate) -> SensePreference
pub struct ReadingRowOne reading row as the ranking sees it.
pub struct TermRankOne term × model, with its shares
fn rank_conflict(rows : & ReadingRow) -> Vec <TermRank>Rank term × model by conflicting share, highest first; ties broken by fewer governed, then by name, so the order is total and stable.
pub struct AdjudicationInput<'a>One term's adjudication: the governed definition and the real-use occurrences the rules could not decide, each numbered so the answer can name it
fn adjudication_prompt(input : & AdjudicationInput <'_>) -> StringThe adjudication prompt as bytes: deterministic for equal inputs (it is the mediated payload, hashed), the closed answer set stated, UNKNOWN always offered, one tab-separated line demanded per occurrence.
fn parse_adjudication(text : & str, expected : usize) -> Result <Vec <Option <Reading>>, String>A model's adjudication against the occurrences it was shown: one line per occurrence, in order, `<n><TAB><governed\

`requirement`

ItemWhat it is
pub enum NeedKindWhat a stakeholder said, classified (29148 need; MoSCoW want).
pub struct RequirementThe requirement's slots (AC61): a requirement with an empty required slot holds the story in ASK and is never filled by guessing.
pub enum DispositionHow a requirement is met from what exists (A10; ISO 19011 finding).
pub struct Finding
pub enum PlanRefusalWhy PLAN refuses to let a story leave (AC61–AC63)
fn plan_guard(requirements : & Requirement, findings : & Finding) -> Vec <PlanRefusal>The PLAN guard: every refusal over the story's requirements and findings, in row order, so the console can show them all at once rather than one per attempt

`session_usage`

ItemWhat it is
pub struct SessionUsageWhat one session cost, summed from its own usage records.
fn extract_usage(line : & str) -> Option <(BTreeMap <String, i64>, Option <String>)>Pull the numeric usage from one transcript line, plus any model name sitting beside it
fn fold_session(run_id : & str, lines : impl Iterator <Item = String>) -> SessionUsageFold a session's lines into one accounting row
fn run_id_from_source_ref(source_ref : & str) -> StringThe session id a transcript's source_ref refers to: the file stem, which is the session uuid the harness also reports to its hooks
async fn record_usage(pool : & sqlx::PgPool, usage : & SessionUsage) -> Result <usize, sqlx::Error>Write one session's accounting into run_measurement -- the shipped telemetry substrate, keyed by run_id, which execution_run.harness_run_id already joins to

`story`

ItemWhat it is
pub enum AudienceWho a section is written for
Audience :: fn as_str(self) -> & 'static str
Audience :: fn parse(s : & str) -> Result <Self, String># Errors A string naming the accepted set.
pub struct TemplateSectionOne ratified section of a story document.
pub const TEMPLATE_REGISTRY_PATH: & strWhere the rendering of the template rows lives, relative to the repo root
pub const SUPPLIERS: & str; 3The supplier vocabulary of a section, closed (A11).
fn render_template_registry(rows : & TemplateSection) -> StringRender the template rows as the registry file: header, then one row per section in (kind, ordinal) order whatever order the rows arrive in, so the bytes are canonical and a --check diff means the rows moved.
fn parse_template_registry(tsv : & str) -> Result <Vec <TemplateSection>, String>Parse the registry file back into rows
pub struct WorkerResultWhat a worker is allowed to return: typed values, addressed to sections that already exist
pub enum ResultRefusalWhy a worker result was refused.
fn accept_worker_result(result : & WorkerResult, registry : & TemplateSection, kind : & str,) -> Result <(), Vec <ResultRefusal>>Accept or refuse a worker result against the ratified section registry
fn headings_of(markdown : & str) -> Vec <String>The level-2 headings of a rendered document, in order.
fn validate_rendered(markdown : & str, registry : & TemplateSection, kind : & str,) -> Result <(), String>Verify a rendered document still carries the ratified sections, in the ratified order
pub struct StoryProjectionEverything the generator needs
fn render_story(projection : & StoryProjection, registry : & TemplateSection, kind : & str,) -> StringRender the story document from canonical state
pub enum OracleResultThe verdict an acceptance criterion closes with.
OracleResult :: fn as_str(self) -> & 'static str
fn evaluate_criterion(oracle_kind : & str, required_evidence_kind : Option <& str>, evidence : & (String, Value),) -> OracleResultEvaluate one acceptance criterion against the evidence recorded for it

`story_compile`

ItemWhat it is
pub const DOC_CAP_BYTES: usizeInput cap (AC2): a Gate 1 doc is prose, not a payload.
pub const MAX_CRITERIA: usizeRow caps (Gate 1.5.6.1): more than this is not a sprint plan.
pub const MAX_TASKS: usize
pub const COMPILER_VERSION: & strThe compiler's version, recorded as evidence on the compile run (AC7)
pub struct CompiledCriterionOne acceptance criterion as compiled: its code (from an ACn bullet prefix when the doc numbers them, positional AC1.. when it does not) and the statement text verbatim (wrapped lines joined by one space).
pub struct CompiledStoryThe deterministic result of compiling one Gate 1 doc (AC1).
pub enum CompileRefusalTyped refusals (AC2) — each names the defect and, where a line exists, its 1-based location.
CompileRefusal :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub struct ExistingCriterionA criterion as the database holds it, for the amendment diff (sprint 4.47 AC28): its code, its statement, and whether it has closed on evidence.
pub struct StoryAmendmentWhat amending a story would do to its rows (sprint 4.47 AC28/AC29)
StoryAmendment :: fn is_empty(& self) -> boolNothing to do — the document and the rows already agree.
StoryAmendment :: fn is_refused(& self) -> boolA refusal outranks the diff: the caller writes nothing.
fn diff_story(existing_intent : & str, existing : & ExistingCriterion, compiled : & CompiledStory,) -> StoryAmendmentDiff a compiled document against the rows a story already holds
fn compile_story(markdown : & str, filename : Option <& str>,) -> Result <CompiledStory, CompileRefusal>Compile a hand-written Gate 1 doc to its canonical rows (AC1)
pub struct ParsedUserStoryThe three parts of a user story, kept apart because they answer different questions: who wants it, what they want, and the benefit that makes it worth doing.
fn parse_user_story(section : & str) -> Option <ParsedUserStory>Parse a ## User Story section into its three parts

`story_html`

ItemWhat it is
pub const HTML_GENERATOR_VERSION: & strThe renderer's version, stamped into the document like the Markdown one
pub const STORY_CSS: & strThe stylesheet, emitted with the document so a single file opens correctly with no asset server
fn escape(s : & str) -> StringEscape the five characters that would otherwise close a tag or an attribute
fn anchor(section : & str) -> StringA section's anchor: its name reduced to what a URL fragment may carry.
fn render_story_html(projection : & StoryProjection, registry : & TemplateSection, kind : & str, md_href : Option <& str>,) -> StringRender one story as a standalone themed document

`story_sections`

ItemWhat it is
pub enum SecurityInvariantThe four Gate 1.5.6 invariants
SecurityInvariant :: fn as_str(self) -> & 'static strThe stored spelling, matching 0057's CHECK.
SecurityInvariant :: fn all() -> Self; 4Every invariant, so a caller can iterate the gate rather than restate it.
pub struct SecurityPlanOne Gate 1.5.6 answer for one story
pub struct ConsensusPositionOne seat's answer in one Gate 1.5 round
pub struct PlannedTestOne planned test, written before the implementation it judges.
pub struct SectionRefusalWhy a section row was refused, in the caller's words rather than a constraint name.
fn check_security_plan(s : & SecurityPlan) -> Option <SectionRefusal>Gate 1.5.6: an invariant that applies must say how; one that does not must say why not
fn unanswered_invariants(answered : & SecurityInvariant) -> Vec <SecurityInvariant>The gate is answered when all four invariants have a row
fn check_consensus_position(p : & ConsensusPosition) -> Option <SectionRefusal>Gate 1.5: a round is a seat, a position, and (from round 2) a verdict on the previous one
fn check_planned_test(t : & PlannedTest) -> Option <SectionRefusal>Gate 2: a test that cannot say what it proves is not a plan.
pub enum SectionErrorA write refused before it reached the database, or the database's own failure
SectionError :: fn from(r : SectionRefusal) -> Self
async fn record_security_plan(pool : & sqlx::PgPool, s : & SecurityPlan, provenance : & str,) -> Result <Uuid, SectionError>Record one Gate 1.5.6 answer
async fn record_consensus_position(pool : & sqlx::PgPool, p : & ConsensusPosition, provenance : & str,) -> Result <Uuid, SectionError>Record one seat's position in one round
async fn record_planned_test(pool : & sqlx::PgPool, t : & PlannedTest, provenance : & str,) -> Result <Uuid, SectionError>Record one planned test
pub enum NeedPathWhere a need was stated
NeedPath :: fn as_str(self) -> & 'static strThe stored spelling, matching 0047's CHECK.
pub enum PriorityMoSCoW, as 0047 CHECKs it.
Priority :: fn as_str(self) -> & 'static str
pub struct NewNeedA stakeholder's words, before they are a row
pub struct NewRequirementA requirement before it is a row
pub struct NewFindingA finding before it is a row: how one requirement is met from what exists.
fn check_new_need(n : & NewNeed) -> Option <SectionRefusal>Mirrors 0047's need CHECKs.
fn check_new_requirement(r : & NewRequirement) -> Option <SectionRefusal>Mirrors 0047's requirement CHECKs
fn check_new_finding(f : & NewFinding) -> Option <SectionRefusal>Mirrors 0047's finding_reuse_cites_a_crate and finding_absence_carries_searches: a reuse that names no crate is a claim, and an absence with no searches was asserted rather than checked (AC2b).
async fn record_need(pool : & sqlx::PgPool, n : & NewNeed, provenance : & str,) -> Result <Uuid, SectionError>Record a stakeholder need
async fn record_requirement(pool : & sqlx::PgPool, r : & NewRequirement,) -> Result <Uuid, SectionError>Record a requirement against its need
async fn record_finding(pool : & sqlx::PgPool, f : & NewFinding) -> Result <Uuid, SectionError>Record a finding against its requirement

`symbol_index`

ItemWhat it is
pub struct SymbolRowOne pub item, the TSV row's shape (name kind crate layer path visibility) plus the derived normalized_name.
fn normalized_name(name : & str) -> StringFold a symbol name so spelling variants collide on purpose: StateTransitionRecord, state_transition_record and state-transition-record all normalize to statetransitionrecord (AC3's stated reason for the column existing).
async fn replace_symbols(pool : & PgPool, rows : & SymbolRow) -> Result <u64, sqlx::Error>Replace the whole symbol index in one transaction: advisory lock, delete, insert every row, commit -- or abort with nothing changed on the first error (Gate 1.5.6 §4)

`work_product`

ItemWhat it is
pub enum SprintStateThe sprint lifecycle (sprint 4.47 state table)
SprintState :: fn as_str(self) -> & 'static str
SprintState :: fn parse(s : & str) -> Result <Self, String>Parse the stored form
SprintState :: fn next(self) -> Option <Self>The forward step of the state table.
SprintState :: fn can_transition(self, to : Self) -> boolEvery legal edge: the forward step, CONSENSUS staying put for another round (ITERATE), REVIEW → BUILD (REVISE) and REVIEW → PLAN (REJECT)
fn sprint_state_machine() -> operations_workflow::Result <StateMachineDefinition>The sprint lifecycle as the registered crate's definition (Gate 0.5: operations-workflow owns state machines; this crate does not grow a second one)
pub struct SprintKeyA sprint's identity: the number every citer uses, and the slug that keeps two sprints with the same number distinct (Gate 1.5 round 2, point A)
pub enum SprintRefWhat a citation string denotes.
SprintKey :: fn key(& self) -> String
fn sprint_number_valid(number : & str) -> bool1, 4, 4.45, 3.138 — digits separated by single dots; no leading or trailing dot, no empty segment, no other character.
fn slug_valid(slug : & str) -> boolLowercase kebab: a-z0-9+(-a-z0-9+)*, at most 120 bytes
fn parse_sprint_ref(s : & str) -> Result <SprintRef, String>Parse a citation: number/slug is a key, number alone is an alias.
fn kind_name_valid(kind : & str) -> boolA work-product kind name: the same kebab grammar as a slug, at most 40 bytes — it is a table's concept name and a lexicon term at once.
pub enum KindRefusalWhy a kind was refused
fn admit_kind(kind : & str, term_status : TermStatus) -> Result <(), KindRefusal>The admission rule (ADR 0045 §3): a kind exists only for a RATIFIED term

No pub use re-exports: every item above is declared in this crate.

Boundary

Reaches into foundation, identity.

Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)operations
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/operations/control-plane
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_operations["operations"] --> n_foundation["foundation"]
  n_operations["operations"] --> n_identity["identity"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-audit-log`foundationnoalways
`foundation-bounded-io`foundationnoalways
`foundation-lexicon`foundationnoalways
`foundation-money`foundationnoalways
`identity-tenant`identitynoalways
`operations-workflow`operationsnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
jsonschema^0.53noalways
rust_decimal^1serdenoalways
serde^1derive, derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
thiserror^2noalways
uuid^1v4, v7, serde, js, v4, serdenoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tempfile^3noalways
tokio^1full, macros, rt-multi-threadnoalways

Build. None.

Depended on by. 5 workspace crates.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_tools_artifact_scaffold["tools-artifact-scaffold"] -->|uses| SELF
  n_tools_corpus["tools-corpus"] -->|uses| SELF
  n_tools_fleet_reconnect["tools-fleet-reconnect"] -->|uses| SELF
  n_tools_imp["tools-imp"] -->|uses| SELF
  n_tools_work_runner["tools-work-runner"] -->|uses| SELF
  SELF["operations-control-plane"]
  SELF -->|runtime| n_foundation_audit_log["foundation-audit-log"]
  SELF -->|runtime| n_foundation_bounded_io["foundation-bounded-io"]
  SELF -->|runtime| n_foundation_lexicon["foundation-lexicon"]
  SELF -->|runtime| n_foundation_money["foundation-money"]
  SELF -->|runtime| n_identity_tenant["identity-tenant"]
  SELF -->|runtime| n_operations_workflow["operations-workflow"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
liboperations_control_plane`src/lib.rs`
testadmission_guard_live`tests/admission_guard_live.rs`
testartifact_identity_live`tests/artifact_identity_live.rs`
testbenefit_rows_live`tests/benefit_rows_live.rs`
testcanonical_identity_live`tests/canonical_identity_live.rs`
testcomposition_shape_live`tests/composition_shape_live.rs`
testconcept_kind_axes_live`tests/concept_kind_axes_live.rs`
testconcept_owner_live`tests/concept_owner_live.rs`
testdependency_rule_live`tests/dependency_rule_live.rs`
testfirst_rule_live`tests/first_rule_live.rs`
testgate_registry_live`tests/gate_registry_live.rs`
testgate_rows_live`tests/gate_rows_live.rs`
testinventory_seed_live`tests/inventory_seed_live.rs`
testkind_term_admission_live`tests/kind_term_admission_live.rs`
testmetaclass_ratified_live`tests/metaclass_ratified_live.rs`
testmodel_identity_live`tests/model_identity_live.rs`
testpayload_read_live`tests/payload_read_live.rs`
testpayload_reasoning_live`tests/payload_reasoning_live.rs`
testpayload_store_live`tests/payload_store_live.rs`
testregistry_export_live`tests/registry_export_live.rs`
testrequirement_live`tests/requirement_live.rs`
testrequirement_rank_live`tests/requirement_rank_live.rs`
testrule_kind_live`tests/rule_kind_live.rs`
testsix_kind_identity_live`tests/six_kind_identity_live.rs`
teststory_sections_live`tests/story_sections_live.rs`
testsymbol_index_live`tests/symbol_index_live.rs`
testterm_reading_census_live`tests/term_reading_census_live.rs`
testterm_reading_rows_live`tests/term_reading_rows_live.rs`
testterm_skos_live`tests/term_skos_live.rs`
testterm_version_change_live`tests/term_version_change_live.rs`
testterm_version_live`tests/term_version_live.rs`
testtransition_merge_live`tests/transition_merge_live.rs`
testwithdrawn_concepts_live`tests/withdrawn_concepts_live.rs`
testwork_product_live`tests/work_product_live.rs`
testworker_usage_live`tests/worker_usage_live.rs`

Error model

Error typeNamed by
ExecutionErrorfinish_run, finish_run_with_account, pin_paths, record_evidence, record_shard_provenance, record_transition, … (14 total)
PayloadErrorload_mediated_payload, load_reasoning_payload, load_shard_payload, store_mediated_payload, store_reasoning_payload, store_shard_payload, … (7 total)
SectionErrorrecord_consensus_position, record_finding, record_need, record_planned_test, record_requirement, record_security_plan

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesyes

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

VariableRead in
CARGOsrc/gate.rs
CARGO_MANIFEST_DIRsrc/lib.rs
KNOWLEDGE_TEST_DBsrc/execution.rs

5 workspace crates depend on this one: tools-artifact-scaffold, tools-corpus, tools-fleet-reconnect, tools-imp, tools-work-runner.

Verification

KindCount
Unit tests243
Integration tests119
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root101
benefit403
boxes302
cost500
datasource7013
dispatch1304
envelope801
execution47038
gate707
identifier909
inventory501
kinds201
lexicon15011
lexicon_export22018
metering33020
payload13012
probe11022
reading18013
requirement604
session_usage504
story15012
story_compile1306
story_html506
story_sections2408
symbol_index303
work_product1000

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc325351
Public modules with a //! block2525
pie showData
    title Public items with rustdoc
    "Documented" : 325
    "No rustdoc detected" : 26

Metrics

MetricValue
Rust source files26
Source lines15971
Code lines12120
Public API items351
Public modules25
Tests362
Examples0
Cargo features0
Direct runtime dependencies13
Workspace reverse dependencies5
pie showData
    title Public API by kind
    "constant" : 33
    "enum" : 38
    "function" : 153
    "method" : 47
    "struct" : 79
    "type alias" : 1
pie showData
    title Rust source composition
    "Code" : 12120
    "Blank or comment" : 3851

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All operations · Manual