Intelligence Layer Architecture
lean-ctx transforms from a pure compressor into an Intelligence Layer between user, AI tool, and LLM. Based on empirical attention analysis (L-curve discovery), all output formats, filters, and encoding strategies are now calibrated to how LLMs actually process context.
Added
ctx_preloadMCP tool — Proactive context orchestration based on task description + import graph. Analyzes project files, extracts task-critical lines, key signatures, and imports, then delivers a compact L-curve-optimized context snapshot- L-Curve Context Reorder Engine — Classifies lines into 7 categories and reorders output so the most task-relevant lines occupy position 0 (where LLMs allocate 20x more attention)
Changed
- Output-Format Reordering —
ctx_readoutput now places file content first, metadata last. Task-critical information at position 0.0 - IB-Filter 2.0 — Upgraded with empirical L-curve attention weights, score-descending output, error-handling prioritization
- LLM-Native Encoding — 15+ new token optimization rules: generic simplification, lifetime elision, path shortening, brace collapsing
- System-Prompt Cleanup — Removed duplicate decoder block (~200 wasted tokens), consolidated redundant warnings, ASCII symbols replace multi-token Unicode
- CRP/TDD Response Shaping — Dynamic response budgets by complexity
Fixed
- Shell hook compression broken —
exec_buffered()bypassed compression when stdout was piped (always the case for agent hooks) - Shell hook stats lost —
std::process::exit()skipped stats flush, discarding all CLI stats silently
Full changelog: https://github.com/yvgude/lean-ctx/blob/main/CHANGELOG.md
Full Changelog: v2.13.1...v2.14.0