Get more from every LLM call your app makes.
Your coding assistant makes prompts cacheable, cuts dead weight, stops wasted output and speeds up first tokens, without changing the answers.
npx leanprompt install
From your project root. Needs Node 20.19 or newer. It shows every file it will write and asks before writing. Then reload your assistant and type /leanprompt init.
Works with Claude Code, Codex, Cursor, OpenCode and any agent that reads AGENTS.md.
One example app, before and after one fix
The audit page for dated-chat. Before, the system prompt starts with the time to the second, so no call can reuse the handbook that follows it. After, the time moves to the newest message.
app.ts line 11; static score 46.
Both pages show estimates from the code, not measurements. /leanprompt measure turns a fix into a before and after number.
Audits of public projects
The same audit, run on open-source apps. Each one is dated, names the commit it read, and links where the maintainers were told and what they said.
-
An AI agent that runs company work for a founder on Z.ai's GLM, with a prompt head built byte-stable and guarded by its own test.
≈ 2,000,000 tokens per 1,000 calls, prompt tokens the cache could have served, from a history window that slid every turn estimate
catalation/synapse-ceo ·
-
A book translator that is already very cache-aware: session mode, Anthropic cache marks, cached-token metering.
≈ 58,000 tokens per 1,000 calls, for a cut-off batch sent twice more, before the fix estimate
yihong0618/bilingual_book_maker ·
-
A chat app whose 2.0 code already takes caching seriously, with Anthropic cache marks and a stable system prompt.
≈ 8,000,000 tokens per 1,000 calls, for default-model chats, if the gateway does not cache them estimate
keinsaasforever/better-chatbot ·
What your assistant does with it
Audit
/leanprompt auditfinds every LLM call in the app and ranks where it loses tokens and time: a prompt the cache cannot reuse, dead weight, output thrown away.Fix
/leanprompt fixchecks each finding, shows a diff and applies it on your yes. A fix that changes what the model is asked or answers is not a fix.Prove
/leanprompt measurecompares the provider’s own usage numbers before and after, and/leanprompt scoreturns them into one number you can put in CI.
38 rules, each with a way to check it
- prefill-cache12 rules
Makes prompts that the provider's cache can reuse, so the app stops paying full price to prefill the same tokens on every call.
- generation-economy17 rules
Stops paying to generate, or to prefill again, what one call could have produced.
- prompt-diet6 rules
Cuts dead weight from what each call sends.
- lmwarden3 rules
What to do when the model runs on your own hardware.
Every rule says how to detect the problem in code, the smallest fix, what the fix must not break, and how to verify it. Provider facts carry a checked date and a source.
leanprompt is not a prompt-compression library, and it works on the app the assistant is building, not on the assistant’s own bill. No telemetry, no proxy, no hosted service, no account. It does not edit your code without asking.


