LeanCTX for Cursor

Cursor reads your repo like it costs nothing.

LeanCTX reduces Cursor token usage by 60–90% by serving compressed, AST-aware context through MCP: ctx_read returns maps and signatures instead of full files, cached re-reads cost ~13 tokens, and shell output shrinks by 88–99%. Run lean-ctx setup once and Cursor is auto-detected and configured.

The problem

Where Cursor spends your tokens.

Agent mode rereads everything

Every agent run re-feeds the same files into the window. A 4,200-token module costs 4,200 tokens. Every single time.

Long sessions degrade

As the context window fills with raw file dumps, completions get slower and less accurate. Context-rot research measures accuracy falling from 98% to 64%.

Terminal output is dead weight

Cargo builds, npm installs and test runs flood the conversation with progress bars the model never needed.

Your stack. Your agent. Better context.

The integration

How LeanCTX plugs into Cursor.

MCP server, auto-configured

lean-ctx setup writes the MCP entry into Cursor's configuration. Cursor's agent then calls ctx_read, ctx_search and ctx_shell instead of raw reads.

Rules file included

Setup installs a .cursor/rules mapping so the agent prefers the compressed tools automatically. No prompting discipline required.

Session cache underneath

Files Cursor already read return as ~13-token cache hits. The cache invalidates on modification, so the agent never sees stale code.

Setup

One command. Auto-detected.

terminal
# install LeanCTX$ curl -fsSL https://leanctx.com/install.sh | sh
# auto-detect Cursor and configure MCP + rules$ lean-ctx setup
# verify the wiring$ lean-ctx doctor
# after a day in Cursor: see the receipt$ lean-ctx gain

What changes

Three moments you'll notice.

The re-read that costs nothing

Your agent revisits a file it explored an hour ago. Instead of 4,200 tokens: a 13-token cache hit. The window stays lean all day.

The build that stays readable

cargo build output arrives as errors plus result: 847 tokens become 42. Your conversation stays about the code.

The gain report

lean-ctx gain shows exactly what today saved, from a signed local ledger rather than an estimate.

Cursor + LeanCTX, answered.

Using this at work?

Team gives your whole org one shared, audited context plane, and the ledger proves the savings to finance. Local use stays free forever, enforced by CI.

Support this project