Agent skill · Code Review & Quality

session-guard

Use when working on complex multi-step tasks, when a session is getting long (40+ tool calls), when the agent starts ignoring rules it followed earlier, when conventions drift, when output quality seems to degrade, or after any context compaction event. Prevents long-session corruption AND context compaction amnesia through behavioral self-enforcement.

Seth Hobson38,331★ · +219/wk · 1 repos on radarProfile →
claude-codecodexcopilotcursorMIT
Install
npx skills add wshobson/agents --skill session-guard --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 4 KB
Bundled scripts: none
Path: plugins/skill-forge-essentials/skills/session-guard/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 38,479 · +148 this week
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Session Guard ## Overview Long sessions corrupt silently. Context compaction drops instructions unannounced. Hooks don't fix it (confirmed by multiple developers on GitHub issues #19471, #9796, #64171). This skill prevents both through behavioral self-enforcement: monitor health, anchor critical rules through compaction, split before damage occurs. No packages, no databases - pure behavioral enforcement that works in every harness. ## When to Use - Session exceeds 40 tool calls - Agent contradicts earlier decisions - Style/naming conventions start drifting - After any context compaction event - Task scope growing unbounded ## Health Signals | Signal | Threshold | Action | |--------|-----------|--------| | Tool call count | >40 | YELLOW: checkpoint + recite critical rules | | Tool call count | >60 | RED: split or compact with anchor | | Agent contradicts earlier decision | Any | VERIFY: re-read source of truth | | Style/naming drift | Any | RECITE: state the active rules aloud | | File read returns unexpected content | Any | RE-READ: don't trust cached state | | Task scope growing unbounded | Continuous | SPLIT: one task per session | ## Protocol ### Green Zone (0-40 tool calls) N

What's inside
Steps it walks through
  1. Overview
  2. When to Use
  3. Health Signals
  4. Protocol
  5. Green Zone (0-40 tool calls)
  6. Yellow Zone (40-60 tool calls)
  7. Red Zone (60+ tool calls OR drift signal)
  8. Context Anchoring (anti-compaction)
  9. What survives compaction:
  10. What gets LOST in compaction:
  11. Compaction-Safe Pattern
  12. Common Mistakes
  13. Why This Matters
More from agents
All skills →
About this skill
What does the session-guard skill do?

Use when working on complex multi-step tasks, when a session is getting long (40+ tool calls), when the agent starts ignoring rules it followed earlier, when conventions drift, when output quality seems to degrade, or after any context compaction event. Prevents long-session corruption AND context compaction amnesia through behavioral self-enforcement.

How do I install it?

Run `npx skills add wshobson/agents --skill session-guard --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From wshobson/agents, a repository with 38,479 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going