01
Compacts earlier, and better
Sets Claude Code's autoCompactWindow to 200k tokens instead of near 1M, and tells the summary what to keep: your goal, decisions, changed files, unresolved errors and next steps.
Lighten · for Claude Code
Every reply re-reads the whole conversation, so long sessions get expensive and burn through your usage limits. Lighten keeps them light: earlier guided compaction, memory across sessions and shorter noisy output. Free, and everything runs on your machine.
$ uv tool install lighten$ lighten installv0.3.1 · Claude Code 2.1.121+ · Python 3.10+ · Linux and macOS
Lighten
Auto-compaction at 200k tokens, with guidance on what to keep
Memory note after compaction, /clear or a new session
Noisy test, install and build output shortened before Claude sees it
Errors, warnings and file views never touched
lighten audit: before vs with Lighten, from your own history
The problem
Claude has no memory between replies. To answer, it re-reads the whole conversation: every message, every file it opened, every line of test output. A reply in a 400k-token conversation costs about twice as much as one at 200k.
Claude Code's auto-compaction waits until the conversation is close to the model's limit, which can be near a million tokens. Until then, every reply carries everything. In our own sessions, more than 80% of the cost came from replies where the conversation was already over 200k tokens.
Features
Four changes that keep the conversation small without losing the thread.
01
Sets Claude Code's autoCompactWindow to 200k tokens instead of near 1M, and tells the summary what to keep: your goal, decisions, changed files, unresolved errors and next steps.
02
Keeps a small local log of requests, changed files and failing commands. After a compaction, /clear or a new session in the same project, Claude gets a short note so you don't lose your place.
03
Passing-test lists and install or build progress are removed before Claude sees them. Errors, warnings and anything unrecognised are always kept, and the full output is saved locally.
04
lighten audit reads your local Claude Code history and compares sessions before and with Lighten: tokens per message, cost per message, time per message and plan-limit snapshots.
How It Works
lighten install adds these hooks to ~/.claude/settings.json and sets autoCompactWindow to 200,000. Each hook is a local Python call of about 100 ms. If anything goes wrong, the hook exits quietly and Claude Code carries on unchanged.
Hook event
What Lighten does
Results
Live A/B test on a Claude subscription: the same long session (16 messages, 48 replies) with and without Lighten.
79%
fewer tokens in a long session (16.7M → 3.6M)
~25%
less of the 5-hour plan limit for the same work
11/11
tasks completed, the same as without Lighten
One test, so treat these as an example rather than a promise. The same facts were recalled in both runs. Short sessions that never reach 200k tokens see little change. Measure your own sessions with:
$ lighten auditInstall
You need Claude Code 2.1.121 or newer and uv (or pipx). uv fetches Python 3.10+ if needed.
Run uv tool install lighten (or pipx install lighten).
Run lighten install. It backs up ~/.claude/settings.json and adds Lighten's hooks without removing your own settings.
Run lighten status. It should report "Hook self-test: OK".
Restart Claude Code or start a new session so the hooks load.
$ uv tool install lighten # or: pipx install lighten$ lighten install$ lighten status # Hook self-test: OK$ lighten install --compact-window 300000 # 150k – 1M$ lighten install --no-compact-window$ LIGHTEN_DISABLED=1 claude # one session without Lighten$ lighten uninstall --purge$ uv tool uninstall lightenlighten install backs up your settings first, keeps your own hooks and leaves an autoCompactWindow you set yourself alone. Get uv from docs.astral.sh/uv.
Lighten has no server. Everything lives in ~/.lighten on your machine:
FAQs
Keep conversations short. Every reply re-reads the whole conversation, so cost grows with conversation length. Compact earlier, use /clear between unrelated tasks, and keep noisy command output out of the context. Lighten automates this: it starts compaction at 200k tokens with guidance on what to keep, hands Claude a short memory note after a compaction or /clear, and shortens noisy output before Claude sees it.
Context engineering is deciding what goes into a language model's context window, and what stays out, so the model has what it needs for the task without wasted tokens. For coding agents like Claude Code that means managing conversation length, compaction, memory between sessions and the size of tool output.
Claude re-reads the entire conversation on every reply, including earlier tool output. A session at 400k tokens costs roughly twice as much per reply as one at 200k. In the author's own sessions, more than 80% of cost came from replies where the conversation was over 200k tokens.
In one long-session A/B test (16 messages, 48 replies) Lighten used 79% fewer tokens and about 25% less of the 5-hour plan limit, with the same tasks completed and the same facts recalled. Short sessions that never reach 200k tokens see little change. Run lighten audit to measure your own sessions.
No. Everything runs on your machine and is stored in ~/.lighten. Nothing is uploaded. lighten audit --share writes a report you can choose to send, and it contains numbers only: no code, file paths, prompts or commands.
Lighten never blanks new tool results. It only removes known noise such as passing-test lists and progress lines, keeps errors and warnings, and saves the full output on disk so Claude can read it again. Compaction is guided to keep goals, decisions, changed files and open errors.
Lighten is free to install and use. It is not open source: you may not copy, modify, redistribute or resell it.
Run lighten uninstall to remove the hooks and restore your compaction setting, add --purge to delete ~/.lighten, then run uv tool uninstall lighten.
No. Lighten is an independent project by Shryxa and is not affiliated with or endorsed by Anthropic.
Two commands, free, and nothing leaves your machine.
$ uv tool install lighten$ lighten installLighten is an independent project and is not affiliated with or endorsed by Anthropic. "Claude" and "Claude Code" are trademarks of Anthropic.
Read the guides: How to reduce Claude Code token usage and Context engineering for Claude Code.
See all Shryxa products or explore Shryxa's AI and software engineering services.