Context & memory·terminal · desktop·MIT
ContextSaver
Spots repeated waste in a session, prices it in context and time, fixes it in one click.

ContextSaver watches a Claude Code session for work that burns tokens and minutes without moving the task forward, and shows it as cards in a pane beside the transcript: what keeps happening, what it has cost so far, and the leaner way to do it. One click sends the fix to Claude, inside the turn that is already running and to every subagent spawned after it.
What it does
- Process findings. When you accept a plan, when a Workflow launches, when a prompt of yours complains about pace (“this is taking forever”, “why so slow”) and at most every 30 minutes, a judge reviews how the work is organised. It looks for review rounds stacked on a review that already covers them, the heaviest model on mechanical stages, an agent spawned for a job one command would do, or the full check suite after every merge. Each run reports at most three divergences, each with its measured cost and the lean alternative.
- Habit findings. A second judge runs on a cadence and looks for repetition at the tool level: the same file read again, the whole test suite after a single-file edit, a log read in full when a grep would do. One occurrence is never a finding.
- Cards with receipts. Each card says how often the behaviour happened, its share of the context, the wall time and the turns involved, then the alternative. Press
ito see the calls behind it. - Fix, Fix… or Ignore. Fix sends the suggested instruction, Fix… opens a field to reword it first, and Ignore drops the card for the rest of the session. Once an instruction has held for two turns, the pane credits the time and context it saved; if the behaviour comes back, its card returns.
- Rules that outlive the session. Each decision is offered as a CLAUDE.md line, a skill, an agent brief or a permission rule.
Writesaves it,Tryapplies it to this session only,Skipdrops it. - A header with the context in use, the tokens left before compaction, a trend over the last ten turns, and where the time and the context went (tests, reads, agents and so on), plus what the judges have spent.
- A band above the prompt that stays quiet until there is something to report, and names a running workflow’s stage and agents.
- Commands.
/savershows or hides the pane and/saver checkruns a check now./saver fix <n>sends card n’s fix, and/saver fix <n> <text>sends your own wording instead./saver ignore <n>drops a card,/saver debugprints the session state with what the audit has cost, and/saver resetclears the session’s ledger and decisions while keeping what it learned.
Install
Needs Claude Code 2.1.287 or later. There is nothing to configure: no API key, no dependencies, no thresholds.
claude plugin marketplace add AlmogBaku/ContextSaver
claude plugin install contextsaver@contextsaver
Then work as usual. The pane opens by itself the first time a card appears, once per session and only in a terminal at least 144 columns wide; /saver toggles it at any width. In a wide terminal it docks beside the transcript, in a narrow one it sits above the prompt. ctrl+x tab moves the keyboard into the pane, Tab cycles the buttons, Enter presses and Esc hands the keys back. Installed mid-session, it rebuilds its ledger from the transcript and checks it right away.
How it works
What it reads. The tool.call hook turns every call, in the main loop and in subagents, into a row of a session ledger: the tool, a key taken from its arguments (the shell command, the file path, the search pattern), its duration, how many characters it added to the context, the files it changed, and flags such as errors, timeouts or denials. The first 80 characters of each result are kept as a quote for the card and are not sent to the judges. turn.complete adds each turn’s token counts, its duration and the first 100 characters of the answer. prompt.submit keeps the first 200 characters of each prompt you type, for the process judge and the pace check. For a running Workflow it reads the run’s journal.jsonl and the phase names its script declares, reading the script as text without running it. At session start, session.messages hands it the transcript so far, so a late install, a /reload-plugins or a resume still starts with a ledger.
The judges cost tokens. Both judges are model.fork calls: a detached completion on top of your session’s own transcript, on the session’s model, with a digest of the ledger appended. A session on Opus pays Opus for its audit. The habit judge waits for at least eight ledger rows, then runs after about 30,000 new tokens and three turns, or, inside a long turn, after 40 more calls and five minutes. The process judge fires on the four triggers above. When a judge’s spend passes 3% of the session’s tokens, it spaces its runs further apart, and /saver debug shows exactly what the audit has spent. Replies are checked before they become cards: a finding that cites calls, agents or turns the digest did not print is dropped, and a process finding’s claimed cost is capped at what its cited evidence measured.
What Fix sends. Nothing is typed into your prompt box. A habit Fix wraps the card’s alternative as an instruction from you, prefixed Instruction from the user (via ContextSaver):, and adds it as extra context: to the main loop’s next tool result, so the turn already running sees it, and to every prompt after that, so it survives compaction. The agent.spawn hook appends the same standing instructions to the prompt of every new subagent (Claude Code’s own forks are left alone), and a workflow agent the rewrite missed gets them on its first tool result. The card’s “sent ×N” counts those deliveries. A process Fix sends a one-time re-plan with the lean alternative, to the main loop only. No tool call is ever blocked, and no output is trimmed.
What it stores and writes. Learned patterns (each behaviour with its command signature, the reason, the alternative and your last decision) are kept per project directory in the plugin’s store, so the next session’s judge knows what you fixed or ignored. The ledger, the prompt excerpts and the result quotes live only in the session’s memory. fs.write runs only when you press Write: it appends a line under a ## ContextSaver heading in the project’s CLAUDE.md, creates .claude/skills/<name>/SKILL.md or .claude/agents/<name>.md, or adds an entry to permissions.allow in .claude/settings.json. That last kind lets Claude run a command without asking, so read it before you write it. ContextSaver makes no network requests of its own; the forked model calls go wherever your session’s requests go.
Limitations
- Short sessions stay quiet: under about 15 tool calls or five turns, only behaviour seen three or more times is reported.
- Durations are wall time, so they include the time a permission prompt spent waiting for you.
- The author supports the terminal and the desktop app. On mobile surfaces the plugin keeps its ledger and draws nothing.
- The author has verified the main flow live but warns of rough edges, and the events and methods it relies on can change between Claude Code versions.
Similar Claude Mods
agent-usage-guard
Holds a burst of agents, a huge prompt or a retry loop before it eats your plan window.
context-inspector
What fills the context window, what is waste and what compaction kept, with advice.
cache-keeper
Prompt-cache timer, keep-warm pings, cold-send guard, a board of chats and a handoff.
context-bar
Your context window as one stacked bar above the prompt, a color per category.
Popular Claude Mods
The whole directory →storybloq
A board of the tickets and issues kept in .story/, in a pane beside the transcript.
worktree-map
Every git worktree of the repo with its path, HEAD, branch and lock state, in a pane.
compact-handoff
Like /compact, but the conversation becomes your validated /handoff and work carries on.
effortless
Picks the effort for every prompt and shows how long the prompt cache stays warm.



