# lean-ctx — CLI-Redirect Mode

PREFER lean-ctx CLI commands over MCP tools for token savings (no MCP schema overhead):

| USE (via Shell/Bash) | INSTEAD OF (MCP) | Why |
|---------------------|-------------------|-----|
| `lean-ctx read <path>` | `ctx_read` | No MCP schema overhead, same caching |
| `lean-ctx read <path> -m map` | `ctx_read(mode="map")` | Compressed output via CLI |
| `lean-ctx -c "<cmd>"` | `ctx_shell` | Pattern compression via CLI |
| `lean-ctx grep <pattern> [path]` | `ctx_search` | Compact results via CLI |
| `lean-ctx ls [path]` | `ctx_tree` | Directory maps via CLI |

## Usage via Shell

Run lean-ctx commands through your Shell/Bash tool:
```
lean-ctx read src/main.rs
lean-ctx read src/main.rs -m signatures
lean-ctx -c "cargo test"
lean-ctx grep "fn main" src/
lean-ctx ls src/
```

## Read modes (same as MCP):
auto | full | map | signatures | diff | aggressive | entropy | task | reference | lines:N-M

## File editing:
Use native Edit/StrReplace — lean-ctx only handles READ operations.
Write, Delete, Glob → use normally.
