---
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.