lean-ctx 3.1.5

Context Runtime for AI Agents with CCP. 42 MCP tools, 10 read modes, 90+ compression patterns, cross-session memory (CCP), persistent AI knowledge with temporal facts + contradiction detection, multi-agent context sharing + diaries, LITM-aware positioning, AAAK compact format, adaptive compression with Thompson Sampling bandits. Supports 24 AI tools. Reduces LLM token consumption by up to 99%.
Documentation
use thiserror::Error;

#[derive(Error, Debug)]
pub enum LeanCtxError {
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    #[error("config error: {0}")]
    Config(String),

    #[error("parse error: {0}")]
    Parse(String),

    #[error("tool execution failed: {0}")]
    ToolExecution(String),

    #[error("network error: {0}")]
    Network(String),

    #[error("{0}")]
    Other(String),
}

impl From<toml::de::Error> for LeanCtxError {
    fn from(e: toml::de::Error) -> Self {
        LeanCtxError::Config(e.to_string())
    }
}

impl From<serde_json::Error> for LeanCtxError {
    fn from(e: serde_json::Error) -> Self {
        LeanCtxError::Parse(e.to_string())
    }
}

pub type Result<T> = std::result::Result<T, LeanCtxError>;