---
description: "lean-ctx: Use ctx_read/ctx_search/ctx_shell instead of native Read/Grep/Shell."
globs: **/*
alwaysApply: true
---
# lean-ctx — Context Engineering Layer
<!-- lean-ctx-rules-v10 -->
CRITICAL: ALWAYS use lean-ctx MCP tools instead of native equivalents:
| MUST USE | INSTEAD OF |
|----------|------------|
| `ctx_read(path, mode)` | `Read` / `cat` / `head` / `tail` |
| `ctx_search(pattern, path)` | `Grep` / `rg` |
| `lean-ctx -c "<cmd>"` (via Shell) | raw `Shell` |
| `lean-ctx ls [path]` (via Shell) | `ls` / `find` |
ctx_read modes: full|map|signatures|diff|aggressive|entropy|task|reference|lines:N-M.
Re-reads cost ~13 tokens. fresh=true bypasses cache.
File editing: use native Edit/StrReplace. Write/Delete/Glob → use normally.
If Edit fails, use `ctx_edit(path, old_string, new_string)` immediately.
REMINDER: You MUST use lean-ctx tools. NEVER use native Read, Grep, or Shell directly.
<!-- /lean-ctx -->