Skip to main content

Reflexion

Struct Reflexion 

Source
pub struct Reflexion {
Show 17 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, pub edited_at: Option<String>, pub dropped_at: Option<String>, pub dropped_reason: Option<String>,
}
Expand description

One learned note, tied to the intervention that produced it.

Fields§

§id: String§domain: String

behavior for now; writing once drafting exists.

§session_id: String§trigger: String

What kind of intervention triggered it: steer, denial, followup.

§context: String

What mecha was doing, compactly — the evidence a rule can be argued from.

§intervention: String

What the user said or did.

§reflexion_text: String

The inferred lesson, phrased as a reusable directive.

§error_type: Option<String>§confidence: Option<f64>§is_processed: bool

Set once an abstraction pass has consumed it.

§leap_run_id: Option<String>§created_at: String§origin: Origin

Provenance of the session the lesson was drawn from. Reflections recorded before this field existed load as Untrusted — see Origin.

§evidence: Evidence

What 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.

§edited_at: Option<String>

When the owner rewrote the lesson in their own words.

An edited lesson is the owner’s, and that is a provenance promotion rather than a cosmetic flag. The argument is evidence_for’s, one step stronger: when a conversation held third-party content the reflector is shown only the user’s typed words and the reflection classifies clean, because third-party bytes never reached the model that wrote it. A lesson the owner typed skips the model entirely, so there is nothing left to launder. context is withheld on the way through, since that is the field the untrusted bytes were in.

§dropped_at: Option<String>

When the owner dropped it, and why.

A flag, never a deletion, on the rule retired_at and the outbox’s resolved items already follow: the record is the evidence that this was considered and refused, and a store that forgets its refusals lets the same lesson come back next pass with nothing to say it was already judged.

§dropped_reason: Option<String>

Implementations§

Source§

impl Reflexion

Source

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.

Source

pub fn provenance(&self) -> Origin

The origin this record would be classified as today.

The stored field is what the miner decided at the time, and the store is append-only — so records written before is_harness_voice existed carry clean for interventions mecha wrote itself. Two are on disk now, and one of them had already reached a pending rule proposal. Deriving the effective value here rather than migrating the file keeps the record as written (the evidence) and the judgement current, which is the same split Session::taint_timeline makes about checkpoints.

One place, so a future decision to let self-authored reflections consolidate — with their own budget, or behind a probe that can actually grade them — changes a gate rather than a scattering of checks.

Reaches a stored record only in the shape the live guard now produces. is_harness_voice is a whole-string match (== for the nudges, starts_with/contains for the three stemmed voices), which recognises a harness voice recorded alone but not one folded into a joined string a pre-fix miner produced — a nudge concatenated with a real steer, from before extract_interventions filtered per block. The two records this method exists to reclassify happen to be pure nudges, so this reaches them; a joined-string record from the same era would not reclassify here even though it should.

Trait Implementations§

Source§

impl Clone for Reflexion

Source§

fn clone(&self) -> Reflexion

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Reflexion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Reflexion

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Reflexion

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more