Skip to main content

clm_rust_core/layer5/
mod.rs

1//! CLM Layer 5: Continuous Learning Stratum & Meta-Circular Reflection ($L_5$).
2//! Canonical Path: kernel/clm_rust_core/src/layer5/mod.rs
3//!
4//! Provides:
5//! - Autonomous 7-step refinement cycle coordination:
6//!   Observe -> Reflect -> Hypothesize -> Synthesize -> Test -> Audit -> Integrate.
7//! - Epistemic Fitness Scoring (ΔE = S_candidate - S_baseline).
8//! - Karpathy Write-Scope Quarantine Gate (INV-14).
9//! - Stratified Universe Level verification ($U_0$–$U_5$).
10
11pub mod learning;
12#[cfg(feature = "native")]
13pub mod petri_learning;
14pub mod telemetry_hook;
15pub mod type_lattice;
16
17pub use learning::{
18    advance_boundary, close_gamma_loop, compute_delta_e, evaluate_epistemic_fitness, seal_epoch,
19    ContinuousLearningEngine, EpochState, EpistemicFitnessReport, LearningHypothesis,
20};
21#[cfg(feature = "native")]
22pub use petri_learning::{
23    EpistemicPlaceMCard, Layer5EpistemicLearningNet, LearningCycleResult, LearningTransitionPCard,
24};
25pub use telemetry_hook::LoopGammaTelemetryHook;
26pub use type_lattice::{
27    get_universe_coordinates, is_stratified, validate_universe_level, LatticeCoordinate,
28    UniverseLevel,
29};
30
31/// 7-Step Autonomous Refinement Cycle phase representation.
32#[derive(Debug, Clone, Copy, PartialEq, Eq)]
33pub enum RefinementPhase {
34    Observe,
35    Reflect,
36    Hypothesize,
37    Synthesize,
38    Test,
39    Audit,
40    Integrate,
41    Quarantine,
42}
43
44impl RefinementPhase {
45    pub fn as_str(&self) -> &'static str {
46        match self {
47            Self::Observe => "observe",
48            Self::Reflect => "reflect",
49            Self::Hypothesize => "hypothesize",
50            Self::Synthesize => "synthesize",
51            Self::Test => "test",
52            Self::Audit => "audit",
53            Self::Integrate => "integrate",
54            Self::Quarantine => "quarantine",
55        }
56    }
57}