lean-ctx 3.5.24

Context Runtime for AI Agents with CCP. 63 MCP tools, 10 read modes, 95+ 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
---
description: "lean-ctx hybrid: MCP for reads/search, CLI for shell commands"
alwaysApply: true
---

# lean-ctx — Context Engineering Layer
<!-- lean-ctx-rules-hybrid-v2 -->

## Mode: Hybrid (MCP reads + CLI shell)

Use MCP tools for file reads and search (cached, token-efficient):

| USE (MCP) | INSTEAD OF | Why |
|-----------|------------|-----|
| `ctx_read(path, mode)` | `Read` | Session cache, 10 modes, re-reads ~13 tok |
| `ctx_search(pattern, path)` | `Grep` | Compact, token-efficient results |

Use lean-ctx CLI for shell commands (no MCP schema overhead):

| USE (via Shell) | INSTEAD OF (MCP) |
|-----------------|-------------------|
| `lean-ctx -c "<cmd>"` | `ctx_shell` |
| `lean-ctx ls [path]` | `ctx_tree` |

File editing: use native Edit/StrReplace. Write/Delete/Glob → use normally.