SKILL.md--- name: lean-ctx description: Use LeanCTX Context Gateway tools to select task-relevant code context, apply supported controls, reuse local knowledge and inspect recorded evidence. Use when lean-ctx MCP tools (ctx_*) are available or file, search or command output needs a focused view. --- # LeanCTX — Context Gateway for AI agents Less context. More intelligence. LeanCTX provides local context selection, supported access and content controls, and evidence of observed context operations for existing agents: Select → Control → Learn → Prove. Learn means local task and knowledge continuity, not model training. Recovery depends on source or archive availability and access permissions. LeanCTX | SDK is the separate integration surface for applications. lean-ctx shapes context before it reaches you: cached reads, compressed shell output, focused search, recovery to exact source. Two rules beat every detail: 1. **Fewer round trips beat smaller outputs.** One call that answers the question is cheaper than three small ones. Never add a call just to save a few hundred tokens. 2. **Never wait by polling.** Do not loop `sleep` + status checks (see below). ## Intent → tool | You want to… | Call | |---|---| | Understand how something works (unknown location) | `ctx_compose(task)` — ranked files + source in one call; use it FIRST instead of search→read→read | | Find the exact definition of a symbol | `ctx_search(action="symbol", name=…)` | | Find code by meaning | `ctx_search(action="semantic", query=…)` | | Find a text/regex pattern | `ctx_search(pattern=…, path=…)` | | Who calls X / what calls X makes | `ctx_callgraph(action="callers"|"callees", symbol=…)` | | Read a file you will edit | `ctx_read(path, mode="anchored")` → edit with the host's native edit tool, or `ctx_call(name="ctx_patch", arguments={…})` | | Read a file only for context | `ctx_read(path, mode="signatures"|"map")`; a range: `mode="lines:N-M"` | | Re-check a file after editing | `ctx_read(path, mode="diff")` | | Run a command (build, test, git, …) | `ctx_shell(command)` — output is compressed | | List files / directory shape | `ctx_glob(pattern)` / `ctx_tree(path, depth)` | | Remember across sessions | `ctx_session(action="finding"|"decision"|"task", value=…)`; durable project facts: `ctx_call(name="ctx_knowledge", arguments={"action": "remember", …})` | Do not read or search through `ctx_shell` (`cat`, `sed -n`, `grep`, `rg`): that bypasses the read cache and symbol index. Use `ctx_read` / `ctx_search`. ## Deferred tools (ToolSearch) If the host lists lean-ctx tools by name only (Claude Code's ToolSearch), load what the task needs in **one** call, e.g. `select:mcp__lean-ctx__ctx_compose,mcp__lean-ctx__ctx_search,mcp__lean-ctx__ctx_read`. Do not fall back to `ctx_shell` for everything because it happens to be loaded. A tool named here that your tool list lacks (the default profile shows a sm