
Session Guard
Keeps long AI sessions from drifting by monitoring tool-call count and re-reading rules after compaction
- Repository
- wshobson/agents
- Stars
- 42,095
- Licence
- MIT
- Files
- 1 file
What it does
Once installed, the agent watches how long a working session has run. After about 40 tool calls it checkpoints its progress and restates the key project rules, and after about 60 it stops and suggests splitting the work into a fresh session. It also re-reads the project's rules file when it notices contradictions, style drift, or after a context compaction, instead of relying on memory. The skill is only a set of written instructions; it installs no packages and runs no code.
Great for
- Developers running long, multi-step coding sessions with an AI agent
- Teams who have noticed an agent forgetting conventions or contradicting earlier decisions
- People who want a lightweight behavioural guideline rather than tooling or infrastructure
Skip it if
- Short, simple tasks, where the thresholds will never be reached and the instructions add nothing
- Anyone expecting a guaranteed fix: the skill relies on the agent following its own instructions, and the file itself cites hooks as not reliably solving the problem
- Critical rules that exist only in chat: the skill says these are lost during compaction, so they must be saved to project files to be useful
Try asking
- “Use session-guard to check whether this long refactor session needs to be split up”
- “My agent just contradicted a naming decision from earlier, so re-read the project rules and recap them”
- “We just hit a context compaction; re-anchor on CLAUDE.md before continuing”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 1 original files, the MIT licence and an attribution note.
session-guard.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip session-guard.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip session-guard.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Keep your important conventions in a project file such as CLAUDE.md, since the skill depends on the agent being able to re-read them.
- Use the checkpoint summaries at the 40 and 60 tool-call marks to start a fresh session with a clean handoff.
- Treat the thresholds (40 and 60 calls) as rough guidance and adjust them to your own workflow.
What's inside
- SKILL.md
Redistributed unmodified from wshobson/agents under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.