ctx_read
Core ToolsRead source files. mode REQUIRED — choose by intent (see `mode` below). To UNDERSTAND code run ctx_compose FIRST; ctx_read after it identified files. anchored → edit by reference via ctx_patch (no exact-recall).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
aggressiveness | number | No | 0.0–1.0 density (entropy/task) |
fresh | boolean | No | Bypass cache |
limit | integer | No | Max lines |
mode | string | No | REQUIRED. full=verbatim(edit-ready) anchored=full+N:hh|anchors(edit via ctx_patch) raw=exact-bytes signatures=API map=structure auto=smart diff=git-delta lines:N-M=window reference=quotes task=focus |
offset | integer | No | start_line alias |
path | string | No | Absolute path |
paths | array | No | Batch read |
protect | array | No | Symbols kept verbatim |
raw | boolean | No | Verbatim (= mode=raw + fresh) |
start_line | integer | No | 1-based |
Call shape
Derived from the input schema: required parameters, plus the most common optional ones.
ctx_read(aggressiveness=N, fresh=true) Examples
Auto-mode read (default)
ctx_read path="src/auth.ts" lean-ctx selects the best compression mode automatically based on file size, recency, and task context.
Force full read
ctx_read path="src/auth.ts" mode="full" Returns complete file content. Use when editing or when you need every detail.
Read specific line range
ctx_read path="src/auth.ts" mode="lines:42-80" Surgical read of lines 42-80 only. Minimal token cost.
Tune compression with the aggressiveness dial
ctx_read path="src/auth.ts" aggressiveness=0.7 A single 0.0 (lossless) to 1.0 (max) dial controls how hard lean-ctx compresses, without choosing a named mode. It routes through the density path at the mapped target and also tunes entropy/task modes.
Protect critical symbols from compression
ctx_read path="src/auth.ts" mode="entropy" protect=["validateToken", "SECRET_KEY"] Lines containing the listed symbols or strings are force-kept verbatim, even under entropy/task compression, so safety-critical code is never dropped.
CLI Equivalent
This tool is also available via the CLI:
lean-ctx read <path> [--mode <mode>] Related Tools
3f978176ea415ac6005cf935896254aaf59632d53d30138da8dda94d89594d06 ← Back to all tools