Skip to content

ousid/lean

Repository files navigation

lean

dense answers. honest savings. no filler.

Make your AI coding agent answer dense. Cut the filler, keep every byte of code exact.
Built for real work (PHP and Laravel first), and honest about what it actually saves. No hype numbers.

Measured not guessed Laravel aware Last commit License

you:  why is my eloquent query slow
lean: N+1: `posts` loaded per iteration. Eager load: `User::with('posts')`.

Same fix. A third of the words. Nothing technical lost.

Why I built it

Getting an agent to answer densely is not a new idea. Most approaches share two weaknesses, and lean is built to avoid both.

First, the reported savings are usually not honest. Compression numbers tend to be measured on long chat style prose. But a coding agent's output is mostly code, diffs, and commands, and any careful tool leaves those untouched. There is little prose left to shrink, so the real saving on actual coding work is a fraction of the advertised one.

Second, a compression prompt can cost more than it saves. It adds tokens to every turn. On a short answer or a code heavy turn there is nothing to compress, so you pay that cost for almost no benefit.

lean keeps the useful part, dense and readable answers, and is built around those two problems. It measures real savings instead of estimating them, and it stays out of the way on turns where it cannot win.

What lean does

  1. Drops the filler. No "Sure, I'd be happy to help." It starts with the answer, in fragments, one idea per line.
  2. Never touches code. Commands, paths, error strings, config, identifiers all stay byte for byte exact. It only compresses prose.
  3. Knows when to shut up. A gate means it only kicks in when there is real prose to compress (roughly 40 words or more). Short replies and code heavy turns are left alone, so it never costs you more than it saves.
  4. Speaks Laravel. It keeps framework terms exact (Eloquent, Artisan, Blade, facades), assumes you know the framework, and answers a bug as Class::method, then the cause, then the fix.
  5. Tells the truth about savings. It never prints a number it did not measure.

Install

Claude Code plugin (one-time, installs from the marketplace):

claude plugin marketplace add ousid/lean
claude plugin install lean@lean

Then type /lean in a session.

Any machine (auto-detects Claude Code, Cursor, Windsurf):

curl -fsSL https://raw.githubusercontent.com/ousid/lean/main/install.sh | bash

Manual

Claude Code:

cp -R skills/lean ~/.claude/skills/
cp commands/lean*.md ~/.claude/commands/

Cursor or Windsurf:

cp .cursor/rules/lean.mdc your-project/.cursor/rules/

Needs Node 18 or newer for the stats tool. The skill itself is just a prompt, so it runs anywhere.

Levels

Switch density whenever you want.

/lean soft   trim filler, keep full sentences
/lean        default, fragments, one idea per line
/lean hard   maximum density, telegraphic, good for reviews and status

Prove the savings yourself

This is the part I care about most. lean ships a tool that reads your real session transcript and reports the actual tokens, not a guess.

# one session: real tokens plus how much of your output is even compressible
node bin/lean-stats.mjs report ~/.claude/projects/<dir>/<session>.jsonl

# the honest A/B: run the same prompts with lean off, then on, then compare
node bin/lean-stats.mjs diff baseline.jsonl lean.jsonl

The 10-prompt Laravel suite in benchmarks/laravel-suite/ shows 545 tokens saved out of 1075 baseline, about 50.7 percent. That is an estimate from authored transcripts, not an API measured figure, and the label on the output says so. The suite is explanation heavy by design, real coding sessions with diffs and tool calls will score lower. The tool will show you exactly what and why. See benchmarks/README.md to build your own set or run a live measured version.

Compress your memory files (input savings)

Everything above shrinks output. Your CLAUDE.md and project notes are input, and they load on every single session. Compress them once and you pay a smaller context tax forever.

/lean-compress CLAUDE.md

The command rewrites the file densely, keeping every rule and fact but cutting the filler. It backs up the original to CLAUDE.md.bak first, then runs a verifier that proves no code block, path, URL, or command was altered:

node bin/lean-compress.mjs check CLAUDE.md.bak CLAUDE.md

If anything technical went missing the check fails and the rewrite is rejected. Character reduction is reported exactly, the token figure is an honest estimate.

What is different, in one line

Other skills tell you what they saved. lean measures it, and refuses to run when there is nothing to save.

Full technical writeup, including what "net negative" means and how this was built, is in DESIGN.md.

Privacy

No telemetry, no accounts, no backend. The skill is a prompt, the installer copies files, and the stats tool reads a log already on your disk. Zero network calls after install.

MIT.

About

Dense answers from your AI coding agent. Honest about token savings. Laravel/PHP aware.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors