Smart I/O

Your AI wastes 90% of its token budget reading files it doesn't need.

LeanCTX reads, compresses, and caches every file access through a 4-layer compression engine with quality gate. Choose from 10 intelligent read modes (from full cached reads to entropy-filtered signatures), leverage 95+ shell compression patterns for tools like git, npm, and docker, and use deterministic search with stable results. Every read is graph-aware: the Property Graph scores related files so the agent always knows what to read next. Re-reads cost as little as 13 tokens thanks to intelligent caching.

The Problem

4,200 Tokens for a Single File Read

Your AI agent reads a 4,200-token file when it only needs a 180-token function signature. It parses 1,800 tokens of raw shell output that could be compressed to 42. Every file access wastes tokens and slows down your workflow.

Watch how ctx_read in map mode extracts only the dependency graph and key signatures from a TypeScript file, reducing 4,200 tokens to just 180.

ctx_read
ctx_read ({ path: "src/lib/auth.ts", mode: "map" })
- exports: authenticate(), validateToken(), refreshSession()
- deps: jsonwebtoken, bcrypt, redis
- cached - 180 tokens (was 4,200)
Smart I/O

6 tools

01

10 Read Modes

From full cached reads to entropy-filtered signatures - choose the right compression for every context.

02

Shell Compression

95+ patterns for git, npm, cargo, docker and more. 60-90% smaller output, zero configuration.

03

Deterministic Search

Regex and semantic search with stable ordering, bounded results, and safety boundaries.

04

Edit Safety

Atomic writes with preimage guards, TOCTOU protection, and diff evidence.

05

Graph-Aware Reads

Every file read includes scored related files from the Property Graph - the agent always knows what to read next.

06

Incremental Graph Updates

Git-diff-based graph updates patch only changed nodes and edges instead of rebuilding the full graph.

Protocol

Token Dense Dialect (TDD)

A compression protocol that maximizes information density per token - calibrated per model family.

TDD Protocol
protocol TDD
version v1
pillar Smart I/O
status active
10 Read Modes
95+ Shell Patterns
99% Max Token Savings
tools

13 MCP tools

LeanCTX reads, compresses, and caches every file access through a 4-layer compression engine with quality gate. Choose from 10 intelligent read modes (from full cached reads to entropy-filtered signatures), leverage 95+ shell compression patterns for tools like git, npm, and docker, and use deterministic search with stable results. Every read is graph-aware: the Property Graph scores related files so the agent always knows what to read next. Re-reads cost as little as 13 tokens thanks to intelligent caching.

ctx_read

Read file (cached, compressed). Cached re-reads can be ~13 tok when unchanged. Auto-selects optimal mode. Modes: full|map|signatures|diff|aggressive|entropy|task|reference|lines:N-M. fresh=true forces a disk re-read.

ctx_shell

Run shell command (compressed output, 95+ patterns). Use raw=true to skip compression. cwd sets working directory (persists across calls via cd tracking). Output redaction is on by default for non-admin roles (admin can disable).

ctx_search

Regex code search (.gitignore aware, compact results). Deterministic ordering. Secret-like files (e.g. .env, *.pem) are skipped unless role allows. ignore_gitignore requires explicit policy.

ctx_semantic_search

Semantic code search (BM25 + optional embeddings/hybrid). action=reindex to rebuild.

ctx_tree

Directory listing with file counts.

ctx_edit

Edit a file via search-and-replace. Works without native Read/Edit tools. Use this when the IDE's Edit tool requires Read but Read is unavailable.

ctx_multi_read

Batch read files in one call. Same modes as ctx_read.

ctx_smart_read

Auto-select optimal read mode for a file.

ctx_delta

Incremental diff — sends only changed lines since last read.

ctx_expand

Retrieve archived tool output (zero-loss). Large outputs are auto-archived; use this to retrieve full details. Actions: retrieve (default), list.

ctx_outline

List all symbols in a file (functions, structs, classes, methods) with signatures. Much fewer tokens than reading the full file.

ctx_symbol

Read a specific symbol (function, struct, class) by name. Returns only the symbol code block instead of the entire file. 90-97% fewer tokens than full file read.

ctx_fill

Budget-aware context fill — auto-selects compression per file within token limit.

Verification

Every output carries proof

LeanCTX generates proof artifacts for every session: which files were read, what was compressed, which checks passed, and how tokens were spent. This makes AI work auditable, replayable, and trustworthy.

Explore Smart I/O Tools

LeanCTX reads, compresses, and caches every file access through a 4-layer compression engine with quality gate. Choose from 10 intelligent read modes (from full cached reads to entropy-filtered signatures), leverage 95+ shell compression patterns for tools like git, npm, and docker, and use deterministic search with stable results. Every read is graph-aware: the Property Graph scores related files so the agent always knows what to read next. Re-reads cost as little as 13 tokens thanks to intelligent caching.