lean-ctx 3.5.23

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 reads + lean-ctx CLI for shell/search/tree"
alwaysApply: true
---

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

## Mode: Hybrid

Use MCP for reads (cache benefits), and lean-ctx CLI for everything else (avoids MCP schema overhead where possible).

### MCP tools (reads)

| USE (MCP) | Why |
|-----------|-----|
| `ctx_read(path, mode)` | In-process cache, re-reads ~13 tokens |

### CLI commands (via Shell/Bash)

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

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