v3.6.4
Added
- Cognition Loop — Hebbian-inspired 8-step background knowledge reorganization: seed promote, structural repair, fidelity check, lateral synthesis, contradiction resolution, co-retrieval strengthening, decay, and compaction. Trigger manually via
ctx_knowledge action=cognition_loopor configure automatic runs withautonomy.cognition_loop_interval_secs. (#cognition-loop) - Knowledge Archetypes — Typed knowledge nodes with 10 archetypes (Architecture, Decision, Gotcha, Convention, Dependency, Pattern, Workflow, Preference, Observation, Fact). Archetypes influence salience-based ranking and are auto-inferred from category names. Fully backward-compatible via
#[serde(default)]. - Fidelity Scoring — Two-tier quality metric (structural + semantic) for knowledge facts. Structural fidelity is computed deterministically from source presence, confirmation count, confidence, freshness, and feedback. Fidelity scores influence recall ranking.
- Hebbian Edge Strengthening — Knowledge relation edges now carry
strength(0.0–1.0) anddecay_ratefields. Co-retrieved facts strengthen their edges via a saturating Hebbian formula. Exponential time-based decay and threshold-based pruning keep the graph lean. - Cross-Agent Knowledge Bridge — Controlled sharing of high-confidence facts between agents. Only publishable archetypes (Architecture, Convention, Decision, Dependency, Gotcha) with confidence ≥ 0.8 can be shared. Imported facts carry provenance tracking and a 10% trust penalty. New actions:
bridge_publish,bridge_pull,bridge_status. - Auto-Update Scheduler — Native
lean-ctx update --schedulewith OS-specific schedulers (macOS LaunchAgent, Linux systemd/cron, Windows Task Scheduler). Subcommands:--schedule off,--schedule status,--schedule notify,--schedule 12h. Default is OFF — requires explicit opt-in. - Setup Auto-Update Opt-In — Interactive
lean-ctx setupnow asks whether to enable automatic updates (Step 9/11). Respects user freedom: default is N, non-interactive mode never enables, and the setting is always changeable via CLI or config. --quietflag for updater —lean-ctx update --quietsuppresses output when already current. Used by the auto-update scheduler to avoid noisy cron/LaunchAgent logs.- Session Update Notification — One-shot per-session update hint via
session_update_hint(). Returns a single notification when a newer version is available, then stays silent for the rest of the session. [updates]config section — New config block withauto_update(default false),check_interval_hours(default 6), andnotify_only(default false). Overridable viaLEAN_CTX_AUTO_UPDATE,LEAN_CTX_UPDATE_INTERVAL_HOURS,LEAN_CTX_UPDATE_NOTIFY_ONLYenv vars.
Security
- Constant-time token comparison — Proxy bearer token validation uses
subtle::ConstantTimeEqto prevent timing side-channels. - Header forwarding allowlist — Proxy no longer blindly forwards all headers; only an explicit
FORWARDED_HEADERSallowlist is passed through. - Secret detection — Regex-based scanning for API keys, tokens, and credentials in file reads and tool output. Integrated into
io_boundaryas a pre-read filter. - Shell allowlist — Configurable command allowlist for sandboxed shell execution with
extract_base_commandvalidation. - Audit trail — SHA-256 chained audit log for security-relevant events (tool denials, cross-project reads, capability checks). CLI:
lean-ctx audit. - Capability-based access control —
Capabilityenum with per-tool requirements and per-role grants. Tools are denied if the agent's role lacks the required capabilities. - macOS Seatbelt sandboxing —
sandbox-execbased process isolation for shell commands on macOS. - Linux Landlock sandboxing — Landlock LSM-based filesystem restrictions for shell commands on Linux.
- OWASP Agentic Top 10 alignment — Module mapping lean-ctx security features to the OWASP Top 10 for Agentic Applications.
- Signed handoff bundles — Ed25519 signatures on agent handoff bundles for provenance verification.
- PathJail expanded — 16 path-like parameter keys now validated (including
destination,old_path,new_path,config_path,output). - Reference store — Large tool outputs (>4000 chars) stored server-side with opaque IDs to prevent context bloat.
- Proxy metrics — Atomic counters for request totals, tokens saved, and bytes compressed.
Upgrade
lean-ctx update # recommended (auto-downloads + refreshes shell hooks)
cargo install lean-ctx # or
npm update -g lean-ctx-bin # or
brew upgrade lean-ctxNote: After upgrading via cargo/npm/brew, run
lean-ctx setupto refresh shell aliases.lean-ctx updatedoes this automatically.
Full Changelog: v3.6.4...v3.6.4