Skip to content

About

Claude Code plugin: injects account plan-usage (5h/weekly) awareness into agent context via hooks

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🛡️ Session Guard

Session Guard screenshot

Session Guard is a coding agent plugin (only Claude Code for now) that injects the current session usage limit percentage on the standard subscriptions.

Why

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.

How it works

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.

Requirements

  • Node.js >= 18

Installing

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/heitorsDev/session-guard/main/install.sh | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/heitorsDev/session-guard/main/install.ps1 | iex

From a local clone:

bash install.sh

No 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.

Uninstalling

bash install.sh --uninstall

or, on Windows (from a local clone, since piped iex can't take arguments):

pwsh install.ps1 --uninstall

This removes the Session Guard hooks from settings.json and deletes ~/.claude/session-guard/.

About

Claude Code plugin: injects account plan-usage (5h/weekly) awareness into agent context via hooks

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages