Session Guard is a coding agent plugin (only Claude Code for now) that injects the current session usage limit percentage on the standard subscriptions.
For me, the experience was something like that:
- I started a new project, passed 2 hours planning it
- And then around 80% of the coding was done AFK
- I scheduled a workflow for implementing it using Claude Code
- I went to sleep
- When I woke up, the session was over, and all my monthly extra usage was burnt on a whatever project, that definitely isn't worth the dollars I expend
So I tried to orient my agent on stopping it before the session gets to a certain percentage, but actually it doesn't have knowledge about the session. And if I try to implement it as a skill, the agent will sometimes call the skill, but probably never actually consult it during a real task.
Session Guard works by consulting the session via the Anthropic API on every tool call, prompt, or agent spawn, and injecting it into the context. It may not change the behavior of your agent, but if you give instructions for it to stop when getting into a certain number, it will know it when starting a task.
- Node.js >= 18
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/heitorsDev/session-guard/main/install.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/heitorsDev/session-guard/main/install.ps1 | iexFrom a local clone:
bash install.shNo npm registry publish, no npx — the curl-pipe path fetches the repo itself into a temp dir, runs the installer (which copies what it needs into ~/.claude/session-guard/ and wires the Claude Code hooks into ~/.claude/settings.json), then discards the temp dir.
bash install.sh --uninstallor, on Windows (from a local clone, since piped iex can't take arguments):
pwsh install.ps1 --uninstallThis removes the Session Guard hooks from settings.json and deletes ~/.claude/session-guard/.
