工作原理

LeanCTX 控制着什么 您的 AI 看到的内容。

LeanCTX 是 AI 代理的 context engineering layer:一个小的 Rust 二进制文件,对每一次读取、命令和搜索运行相同的循环。它 决定 你的代理阅读什么,记住 它们跨会话学到了什么,保护 它们触及了什么,证明 它们保存在签名账本中的内容,以及 重放 它们看到的内容。它解析来自 26 种语言的结构化读取数据并去除噪声,确保送达模型的内容是有目的、压缩和可证明的。你只需安装一次。其他一切都是自动化的。

The context pipeline.

Every request flows through four stages. Your tools stay the same — LeanCTX intercepts silently between your AI tool and the LLM.

Intercept

Your agent calls ctx_read, ctx_shell, or ctx_search. LeanCTX intercepts the call before it reaches the filesystem.

Analyze

Tree-sitter parses the AST. Shell patterns match the command. The content-addressed cache checks for re-reads.

Deliver

Only the signal reaches the model. Signatures, errors, relevant matches — structured, deduplicated, compressed.

One Rust binary. Zero config. Your agent gets better context without knowing LeanCTX exists.

What your agent actually sees.

When your agent reads a file, LeanCTX returns only the structural signature — function signatures, type definitions, and key logic. The full file never enters context.

Explore read modes

Shell output, compressed.

A raw git diff produces hundreds of lines. LeanCTX pattern-matches 95+ commands and returns only the meaningful delta — file names, hunks, and error lines.

See all patterns

Security built into every call.

Before any file read or shell command executes, LeanCTX validates the path against PathJail, checks the shell allowlist, and redacts detected secrets. lean-ctx doctor shows the full posture.

Security docs

How it works, answered.

The practical details behind the compression layer.

See itin action.

Install LeanCTX and watch your agent's context usage drop.

curl -fsSL https://leanctx.com/install.sh | sh
Support this project