lean-ctx 3.1.5

Context Runtime for AI Agents with CCP. 42 MCP tools, 10 read modes, 90+ 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
# lean-ctx — Token Optimization for Pi

lean-ctx is installed as a Pi Package with first-class MCP support. All bash, read, grep, find, and ls calls are automatically routed through lean-ctx for 60-90% token savings. Additionally, 25+ MCP tools are available for advanced operations.

## How it works

- **bash** commands are compressed via lean-ctx's 90+ shell patterns
- **read** uses smart mode selection (full/map/signatures) based on file type and size
- **grep** results are grouped and compressed
- **find** and **ls** output is compressed and .gitignore-aware

## MCP tools available

In addition to the built-in tool overrides, lean-ctx provides these MCP tools:

- **ctx_session** — Session state management
- **ctx_knowledge** — Project knowledge graph (cross-session memory)
- **ctx_semantic_search** — Find code by meaning
- **ctx_overview** — Codebase overview
- **ctx_compress** — Manual compression control
- **ctx_metrics** — Token savings dashboard
- **ctx_agent** — Multi-agent coordination
- **ctx_graph** — Dependency analysis
- **ctx_discover** — Code discovery
- **ctx_context** — Context management
- **ctx_preload** — Predictive preloading
- **ctx_delta** — Changed-lines-only reads
- **ctx_edit** — Read-modify-write in one call

## No manual prefixing needed

The Pi extension handles routing automatically. Just use tools normally:

```bash
git status          # automatically compressed
cargo test          # automatically compressed
kubectl get pods    # automatically compressed
```

## Checking status

Use `/lean-ctx` in Pi to verify which binary is active and see MCP bridge status.

## Dashboard

Run `lean-ctx dashboard` in a separate terminal to see real-time token savings.