Skip to main content

KernelSnapshot

Struct KernelSnapshot 

Source
pub struct KernelSnapshot {
Show 51 fields pub version: u32, pub total_steps: u64, pub biases: BTreeMap<String, f64>, pub constraints: BTreeMap<String, f64>, pub cas_total_steps: u64, pub cas_avg_prediction_error: f64, pub cas_adaptation_score: f64, pub cognitive_effect: RuleEffect, pub cases: Vec<Case>, pub case_capacity: usize, pub strategies: BTreeMap<String, Strategy>, pub active_modules: BTreeMap<String, String>, pub patch_history: Vec<(CognitivePatch, String)>, pub l2_enabled: bool, pub l2_in_fixed_point: bool, pub l2_dwell_steps: u64, pub l2_last_alignment_score: f64, pub l2_commit_threshold: f64, pub l2_commit_cooldown_steps: u64, pub l2_commit_cooldown_remaining: u64, pub l2_last_consequence_score: f64, pub l2_defensive_mode: bool, pub l2_negative_consequence_streak: u32, pub l2_stable_consequence_steps: u32, pub l2_reward_change_score: f64, pub l2_error_change_score: f64, pub l2_awaiting_consequence: bool, pub l2_negative_reward_streak: u32, pub l2_negative_reward_required: u32, pub l2_detector_history: Vec<MetaMetrics>, pub l2_detector_window: usize, pub l2_detector_pred_threshold: f64, pub l2_detector_self_ref_threshold: f64, pub l2_detector_cooldown_steps: usize, pub l2_detector_cooldown_remaining: usize, pub self_modify_enabled: bool, pub steps_since_last_patch: u64, pub l2_rollback_effect: Option<RuleEffect>, pub last_l2_decision: Option<L2DecisionRecord>, pub bandit_ucb: Option<BanditUcbSnapshot>, pub bandit_config: BanditConfig, pub l1_previous_effect: Option<RuleEffect>, pub l1_pending_rollback: bool, pub l2_controller: ResidentController, pub l2_pending_policy: L2Policy, pub l2_applied_policy: L2Policy, pub l2_pending_l1_rollback: bool, pub l2_last_reward: f64, pub case_sample_counter: u32, pub external_loop: Option<ExternalLoopState>, pub adaptive_state: Option<AdaptivePersistedState>,
}
Available on crate feature std only.
Expand description

Serializable snapshot of the kernel state.

Fields§

§version: u32

On-disk schema version. Missing / 0 treated as pre-0.5 and migrated up to CURRENT_SCHEMA_VERSION (currently 7) on load.

§total_steps: u64

Total number of kernel steps completed.

§biases: BTreeMap<String, f64>

Mapping of biases.

§constraints: BTreeMap<String, f64>

Mapping of constraints.

§cas_total_steps: u64

Number of CAS total.

§cas_avg_prediction_error: f64

Cas average prediction error for this value.

§cas_adaptation_score: f64

Cas adaptation score for this value.

§cognitive_effect: RuleEffect

Cognitive effect for this value.

§cases: Vec<Case>

Collection of cases.

§case_capacity: usize

Case capacity for this value.

§strategies: BTreeMap<String, Strategy>

Mapping of strategies.

§active_modules: BTreeMap<String, String>

Number of active cognitive modules.

§patch_history: Vec<(CognitivePatch, String)>

Collection of patch history.

§l2_enabled: bool

Whether the L2 meta-controller is enabled.

§l2_in_fixed_point: bool

Whether L2 in fixed point is enabled or active.

§l2_dwell_steps: u64

Number of L2 dwell.

§l2_last_alignment_score: f64

L2 last alignment score for this value.

§l2_commit_threshold: f64

L2 commit threshold for this value.

§l2_commit_cooldown_steps: u64

Number of L2 commit cooldown.

§l2_commit_cooldown_remaining: u64

L2 commit cooldown remaining for this value.

§l2_last_consequence_score: f64

L2 last consequence score for this value.

§l2_defensive_mode: bool

Whether L2 is operating in defensive mode.

§l2_negative_consequence_streak: u32

Number of consecutive negative consequences observed by L2.

§l2_stable_consequence_steps: u32

Number of L2 stable consequence.

§l2_reward_change_score: f64

L2 reward change score for this value.

§l2_error_change_score: f64

L2 error change score for this value.

§l2_awaiting_consequence: bool

Whether L2 awaiting consequence is enabled or active.

§l2_negative_reward_streak: u32

L2 negative reward streak for this value.

§l2_negative_reward_required: u32

L2 negative reward required for this value.

§l2_detector_history: Vec<MetaMetrics>

Collection of L2 detector history.

§l2_detector_window: usize

L2 detector window for this value.

§l2_detector_pred_threshold: f64

L2 detector pred threshold for this value.

§l2_detector_self_ref_threshold: f64

L2 detector self ref threshold for this value.

§l2_detector_cooldown_steps: usize

Number of L2 detector cooldown.

§l2_detector_cooldown_remaining: usize

L2 detector cooldown remaining for this value.

§self_modify_enabled: bool

L1 self-modify master switch (v2+). Restored so that enabling L1 then restarting does not silently fall back to the safe default-off.

§steps_since_last_patch: u64

L1 patch cooldown counter (v2+). Restored so a restart cannot reset the min-steps-between-patches cooldown.

§l2_rollback_effect: Option<RuleEffect>

L2 rollback policy snapshot (v2+). Restored so that after an L2 commit a restart retains the pre-commit policy needed for negative-feedback rollback.

§last_l2_decision: Option<L2DecisionRecord>

Last UCB-backed L2 decision, available to status and trajectory replay.

§bandit_ucb: Option<BanditUcbSnapshot>

Complete local bandit state when the kernel uses BanditUcbDecisionMaker.

§bandit_config: BanditConfig

Bandit config for this value.

§l1_previous_effect: Option<RuleEffect>

Optional L1 previous effect.

§l1_pending_rollback: bool

Whether L1 pending rollback is enabled or active.

§l2_controller: ResidentController

Resident L2 controller and one-step pending policy (v4+). Missing legacy state is dormant with zero trust, so migration cannot inject a bias.

§l2_pending_policy: L2Policy

L2 policy proposed but not yet applied.

§l2_applied_policy: L2Policy

L2 policy currently applied at the control boundary.

§l2_pending_l1_rollback: bool

Whether L2 pending L1 rollback is enabled or active.

§l2_last_reward: f64

L2 last reward for this value.

§case_sample_counter: u32

Per-instance prioritized-replay cursor (v6+), independent of other kernels.

§external_loop: Option<ExternalLoopState>

Optional external loop.

§adaptive_state: Option<AdaptivePersistedState>

Optional Adaptive Kernel Protocol v1 durable state (introduced in schema v7).

Implementations§

Source§

impl KernelSnapshot

Source

pub fn migrate(self) -> Result<Self>

Migrate older snapshots into CURRENT_SCHEMA_VERSION.

Source

pub fn redact_user_content(&mut self)

Redact known user-provided goal text before writing a snapshot. Numeric learning state and schema remain unchanged.

Source

pub fn save_to(&self, path: &Path) -> Result<()>

Saves to.

Source

pub fn load_from(path: &Path) -> Result<Self>

Loads from.

Source

pub fn to_json(&self) -> Result<String>

Converts this value to JSON.

Source

pub fn from_json(json: &str) -> Result<Self>

Creates a value from JSON.

Trait Implementations§

Source§

impl Clone for KernelSnapshot

Source§

fn clone(&self) -> Self

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 KernelSnapshot

Source§

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

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

impl Default for KernelSnapshot

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for KernelSnapshot

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 KernelSnapshot

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§

§

impl Forget for KernelSnapshot

§

impl Freeze for KernelSnapshot

§

impl Move for KernelSnapshot

§

impl RefUnwindSafe for KernelSnapshot

§

impl Send for KernelSnapshot
where NodeRef<Owned, String, f64, LeafOrInternal>: Send, BoxRaw<(String, f64)>: Send, RawVecInner: Send, NonZero<i32>: Send, Utc: Send, NodeRef<Owned, String, Strategy, LeafOrInternal>: Send, BoxRaw<(String, Strategy)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, PersistedProposalRecord, LeafOrInternal>: Send, BoxRaw<(String, PersistedProposalRecord)>: Send, NodeRef<Owned, String, PersistedRequestRecord, LeafOrInternal>: Send, BoxRaw<(String, PersistedRequestRecord)>: Send, NodeRef<Owned, String, PersistedFeedbackRecord, LeafOrInternal>: Send, BoxRaw<(String, PersistedFeedbackRecord)>: Send, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Send, BoxRaw<(String, SetValZST)>: Send, NodeRef<Owned, String, ParameterBound, LeafOrInternal>: Send, BoxRaw<(String, ParameterBound)>: Send,

§

impl Sync for KernelSnapshot
where NodeRef<Owned, String, f64, LeafOrInternal>: Sync, BoxRaw<(String, f64)>: Sync, RawVecInner: Sync, NonZero<i32>: Sync, Utc: Sync, NodeRef<Owned, String, Strategy, LeafOrInternal>: Sync, BoxRaw<(String, Strategy)>: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, PersistedProposalRecord, LeafOrInternal>: Sync, BoxRaw<(String, PersistedProposalRecord)>: Sync, NodeRef<Owned, String, PersistedRequestRecord, LeafOrInternal>: Sync, BoxRaw<(String, PersistedRequestRecord)>: Sync, NodeRef<Owned, String, PersistedFeedbackRecord, LeafOrInternal>: Sync, BoxRaw<(String, PersistedFeedbackRecord)>: Sync, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Sync, BoxRaw<(String, SetValZST)>: Sync, NodeRef<Owned, String, ParameterBound, LeafOrInternal>: Sync, BoxRaw<(String, ParameterBound)>: Sync,

§

impl Unpin for KernelSnapshot

§

impl UnsafeUnpin for KernelSnapshot

§

impl UnwindSafe for KernelSnapshot

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, !>

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