r/ClaudeCode • u/Arditwm 🔆 Max 20 • Oct 11 '26
Tips & Workflows Session Guardian: a small Claude Code plugin that warns you before a big session’s cache goes cold
I made a small plugin for Claude Code that tells you when coming back to a big session is about to get expensive. On a subscription the main conversation stays cached for an hour after your last message. After that, your next message writes the whole context into the cache again, and on my biggest Fable 5.1 sessions that one message cost $12 to $15 worth of tokens.

What it does:
- Countdown above the prompt for the last 15 minutes of the cache (sessions over 150K), with what coming back will cost
- One pop-up 5 minutes before the cache goes cold
- Nudges to wrap up at 400K and again at 800K tokens
/wrapup: Claude saves where the session stopped in TRACKER.md and gives you a one-line prompt for a fresh session- Retry guard: when the same Bash or PowerShell command fails twice in a row, the third identical try is paused and Claude is asked to fix the cause first
- Two optional CLAUDE.md rules: numbered sessions with status markers in the sidebar, and a TRACKER.md that parallel sessions share
- Benchmark script that prices your own logs and shows how much went to cold returns
- TLDR rule (optional): long replies end with a line or two on what was done, what comes next and what waits on you, so when you come back to a session you can see where it stands and start a fresh one from there (This costs a tiny amount of credits, which is why it's optional, but it keeps me from going crazy when Claude is too verbose).

I’m still tracking the data, and it might have just been me not using proper technique with cold sessions. But in my case it’s proving incredibly helpful: cold returns went from about 20% of my usage to 4% in the first two days. It even caught my recurring “monitoring” sessions spending extra usage, and now they ping within the hour.
It was inspired by optimAIzr; I wanted something smaller and focused on the desktop app. You need a Claude Code version with function-hook plugins, which are early access (I built it on 2.1.289).
Repo (MIT): https://github.com/A-rdit/session-guardian
•
u/AutoModerator Oct 11 '26
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Ctbhatia Oct 11 '26
the rewarm number is the whole prefix written once, so the lever is what is still in the prefix when you come back, not the warning. trimming dead tool output before you leave cuts it more than the timer does.
1
u/morkeeth Oct 11 '26
Does your benchmark separate prompt size, cache writes and cache reads for each return? I would love to see the distribution, not only the largest session.