Who it is forA Claude Code or Codex user who wants proof that a context-size change cut cost before keeping it.
The problemA cost saving can come with more tool calls, errors or waiting, and it is unclear whether the change caused them.
The outcomeA before and after table where every worse row is marked as a trade-off, plus a one-command way to undo the change.
What you need first
- Node.js 20.11 or later (22.13 or later to read opencode history)
- Existing usage logs from Claude Code, Codex or opencode on this machine
- A terminal
Steps
- Run
optimaizr apply context-compaction. - Use Claude Code or Codex normally for several days.
- Run
optimaizr resultsto compare the days after with the days before. - If the trade-offs are not worth it, run
optimaizr undo context-compaction.
Prompt for your agent
In the optimaizr repo, after context compaction has been applied for several days, run `optimaizr results` on this machine and report cost per prompt before and after. Verify that every row that got worse is marked as a trade-off before you draw a conclusion.
Caveat. The README says part of any saving may already have been under way, because the baseline is the days before the change.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for blendbunjaku/optimaizr and "Check whether compacting at 200K actually saved money"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer