lean-ctx 3.9.19

Context Runtime for AI Agents with CCP. 79 MCP tools, 10 read modes, 95+ compression patterns, cross-session memory (CCP), persistent AI knowledge with temporal facts + contradiction detection, multi-agent context sharing, LITM-aware positioning, AAAK compact format, adaptive compression with Thompson Sampling bandits. Supports 24+ AI tools. Reduces LLM token consumption by up to 99%.
//! Central feature gate for science-driven context intelligence.
//!
//! Reads `cognitive_mode` from config once per call and returns whether
//! a feature category is enabled. Two tiers:
//! - **Basic** (IB intent, semantic chunking): enabled in `Basic` and `Full` modes
//! - **Full** (FSRS, Wasserstein, graph, verbosity, prefetch, stigmergy): only in `Full` mode

use crate::core::config::{CognitiveMode, Config};

/// Returns true if basic science features (intent classification, semantic chunking) are active.
pub(crate) fn basic_science_enabled() -> bool {
    !matches!(Config::load().cognitive_mode, CognitiveMode::Off)
}

/// Returns true if full science features (FSRS, OT allocation, graph expansion, etc.) are active.
pub(crate) fn full_science_enabled() -> bool {
    matches!(Config::load().cognitive_mode, CognitiveMode::Full)
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn basic_science_enabled_when_not_off() {
        // Default config is Full — both tiers must be on.
        assert!(basic_science_enabled());
        assert!(full_science_enabled());
    }
}