pub struct Reflexion {Show 14 fields
pub id: String,
pub domain: String,
pub session_id: String,
pub trigger: String,
pub context: String,
pub intervention: String,
pub reflexion_text: String,
pub error_type: Option<String>,
pub confidence: Option<f64>,
pub is_processed: bool,
pub leap_run_id: Option<String>,
pub created_at: String,
pub origin: Origin,
pub evidence: Evidence,
}Expand description
One learned note, tied to the intervention that produced it.
Fields§
§id: String§domain: Stringbehavior for now; writing once drafting exists.
session_id: String§trigger: StringWhat kind of intervention triggered it: steer, denial, followup.
context: StringWhat mecha was doing, compactly — the evidence a rule can be argued from.
intervention: StringWhat the user said or did.
reflexion_text: StringThe inferred lesson, phrased as a reusable directive.
error_type: Option<String>§confidence: Option<f64>§is_processed: boolSet once an abstraction pass has consumed it.
leap_run_id: Option<String>§created_at: String§origin: OriginProvenance of the session the lesson was drawn from. Reflections
recorded before this field existed load as Untrusted — see
Origin.
evidence: EvidenceWhat the reflector saw: the full excerpts, or only user-authored
evidence. Records from before the field load as Full — every
reflection was, and their origin already says what to make of it.
Implementations§
Source§impl Reflexion
impl Reflexion
Sourcepub fn learnable(&self) -> bool
pub fn learnable(&self) -> bool
Whether a learning pass may consume this reflection. Structural, not a score: there is deliberately no knob that loosens it, because a switch that lets untrusted content into every future prompt is the silently-degrading-sandbox shape.
One domain is exempt, and the exemption is keyed on the consumer
rather than on a setting. The gate above exists because a learned
rule rides in every future run’s cached prefix, in front of an agent
with tools, a network and the ability to send. That premise is false
for TRIAGE_DOMAIN: its rules ride only in the mail classifier’s own
frame — a tool-less, history-less pass that emits a fixed schema and
can neither send nor reach the network — because triage is not in
RUN_DOMAINS. A triage reflection necessarily saw mail, so demanding
Clean there would not make it safe, it would make the domain
impossible: a correction with no context cannot generalise.
The exemption disables itself if its premise stops holding. Adding
triage to RUN_DOMAINS would put those rules in front of a
tool-having agent, and the check below goes false the moment that
happens rather than needing anyone to remember. LEARNING-AUTONOMY-DESIGN.md
§4 is the argument; an_untrusted_triage_reflection_stops_being_learnable_if_it_reaches_a_run
is the test.
The residual, stated because nothing enforces it. The check keys on
RUN_DOMAINS membership, which is a proxy for the consumer rather
than the consumer itself. It catches the likely breakage — someone
routes triage into ordinary runs — and it does not catch a second
one: a future caller that has tools calling
LearningStore::rules_prompt_block_for with triage directly.
Nothing stops that today, and this function would keep answering
true while its premise had quietly stopped holding.
Expressing that in the type system would need “this domain has exactly
one load site”, which Rust cannot say cheaply and a registry would cost
more than it protects. So it is written here instead, where the next
person meets it: if you are adding a consumer of triage rules that
has tools, a network, or a way to send, this exemption is no longer
sound and has to be argued again rather than inherited.