lean-ctx 3.8.14

Context Runtime for AI Agents with CCP. 71 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%.
Documentation
//! `lean-ctx skillify` — distill recurring session patterns into .cursor/rules (#290).

use crate::tools::ctx_skillify;

pub(crate) fn cmd_skillify(args: &[String]) {
    let project_root = super::common::detect_project_root(args);
    let action = args
        .iter()
        .find(|a| !a.starts_with("--"))
        .map_or("mine", String::as_str);

    if matches!(action, "help" | "--help" | "-h") {
        print_help();
        return;
    }

    // The promote action takes the next positional after the action as the slug.
    let slug = args
        .iter()
        .filter(|a| !a.starts_with("--"))
        .nth(1)
        .map(String::as_str);

    let out = ctx_skillify::handle(&project_root, action, slug);
    println!("{out}");
}

fn print_help() {
    eprintln!(
        "lean-ctx skillify — codify recurring session patterns into .cursor/rules\n\
         \n\
         USAGE:\n    \
             lean-ctx skillify <action> [args]\n\
         \n\
         ACTIONS:\n    \
             mine               Distill diary + knowledge into rules (default)\n    \
             list               Show generated skillify rules\n    \
             status             Show config + candidate/rule counts\n    \
             promote <slug>     Copy a project rule to ~/.cursor/rules\n    \
             help               Show this help"
    );
}