Highlights
MCP Tool Enforcement — LLMs now reliably use lean-ctx MCP tools instead of native tools across all 19 supported IDEs/agents through a 3-layer strategy:
- PreToolUse Hooks — Soft-redirect hooks for Claude Code, Cursor, and Gemini CLI intercept native
Read,Grep,ListFilescalls and guide LLMs toctx_read/ctx_search/ctx_tree. Safety fallback ensures native tools work if MCP server is unreachable. - LITM-Optimized Rules v5 — Critical instructions placed at beginning AND end of rules blocks (exploiting LLM attention patterns).
- Project-Level Reinforcement — Auto-creates
AGENTS.mdand.cursorrulesonlean-ctx init --agent.
Token Optimization Deep Dive — Performance improvements across all phases:
- Config caching with
OnceLock, stats batching, deferred writes - 20+ new compression patterns (cargo, git, docker, npm, uv/conda/poetry)
- Trimmed tool descriptions, strengthened CRP/TDD output constraints
Added
- 6 new IDE/agent rules targets: Qwen Code, Trae, Amazon Q Developer, JetBrains, Antigravity, Pi Coding Agent
- 19 total supported IDEs/agents (up from 13)
- Auto-refresh hooks + rules on
lean-ctx updateand MCP server start - Complete uninstall cleanup for rules files (13 locations), hook scripts (7 files), and configs
Changed
- Removed double savings footer, compressed entropy/stale headers
- Stats batching with in-memory accumulator + periodic flush
- Fixed npm test heuristic (proper Jest/Vitest parsing)
- Hook installation refactored for reusability
Full changelog: https://github.com/yvgude/lean-ctx/blob/main/CHANGELOG.md
Full Changelog: v2.12.6...v2.12.7