pub struct Rule {
pub text: String,
pub enabled: bool,
pub confidence: Option<f64>,
pub based_on_count: Option<u32>,
pub id: Option<String>,
pub sources: Vec<String>,
pub created_at: Option<String>,
pub retired_at: Option<String>,
pub retired_reason: Option<String>,
pub probation: bool,
}Expand description
One rule in a domain’s TOML file.
A rule outlives the pass that wrote it, so it carries its own lineage:
id is what the validation ledger keys on, sources closes the
provenance chain from a live rule back to the reflections it was argued
from (batch-level — the learner’s per-rule attributions would be its own
unverifiable testimony), and created_at is the staleness signal. Every
new field defaults, so rule files written before they existed load
unchanged — the same trick as Reflexion::origin, minus the fail-closed
semantics, because absent lineage on an already-accepted rule is history,
not a threat.
Fields§
§text: String§enabled: bool§confidence: Option<f64>§based_on_count: Option<u32>§id: Option<String>Minted when the rule first enters the store; stable across consolidations that keep the text.
sources: Vec<String>Reflexion ids of the batch that produced (or last rewrote) this rule.
created_at: Option<String>§retired_at: Option<String>Set instead of deleting: a retired rule is evidence — the learner is told it was tried and measured harmful, which a deleted line cannot say — and the invalidation is reversible where erasure is not.
retired_reason: Option<String>§probation: boolThe gate could not measure this rule at birth.
mecha learn --auto applies a batch whose probes all skipped rather
than holding it — the D1 ruling, and the only alternative that is not
either today’s stall (hold, when unmeasurable batches are the common
case) or giving up the writing and followup half of the corpus
permanently. What makes that defensible is that the rule is marked
and retires sooner: acting without certainty is the bet, and a shorter
leash is the hedge.
Distinct from “the ledger has not covered it yet”, which is a
property of rule_tallies and true of every new rule for a while. This
records that the counterfactual gate ran and could not grade it —
the gate’s probes never reach the validation ledger, so nothing else
remembers that. Released by release_probation_when_measured_clean
once the ledger has graded the rule beyond its convictions — and only
then, because an attributed regression always arrives inside an
observation, so releasing on coverage alone would strip the leash on
the very evidence it exists to act on.