Session Guard
Seth HobsonCommunityCreated by Adit JainDistributed by Seth Hobson
- Skill
- Meta (authoring, orchestration, planning, memory)
- Agent tooling
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Session Guard provides a structured behavioral framework to combat silent context degradation and memory loss in AI agents. As sessions grow or undergo context compaction, agents often lose track of initial instructions and project conventions. This skill implements a systematic monitoring protocol—categorized by tool-call thresholds and health signals—to force the agent to re-anchor its state, verify project rules, and perform controlled handoffs before performance degrades.
What it does
- Establishes a tiered monitoring protocol based on tool call volume
- Provides a checklist for re-anchoring context after compaction events
- Defines specific health signals to detect rule drift and memory loss
- Outlines a procedure for splitting tasks to maintain session integrity
- Promotes file-based rule storage to ensure persistence across compaction
- Forces explicit recitation of critical rules to override narrative momentum
When to use it
- When a session exceeds 40 tool calls
- After a context compaction event occurs
- When the agent begins to contradict earlier decisions
- When project style or naming conventions start to drift
- When the task scope becomes too large for a single session
Advantages
- Requires no external infrastructure, packages, or databases
- Works consistently across different agent harnesses
- Prevents silent corruption by enforcing proactive verification
- Reduces the risk of amnesia caused by automated context compaction
Usage examples
- “I have been working on this refactor for a while. Please initiate the Yellow Zone protocol.”
- The agent will summarize current progress, recite the 3-5 most critical project rules, and assess whether to continue or split the task.
- “We just hit a context compaction event. Run the Context Anchoring protocol.”
- The agent will immediately re-read the project rules file, recite critical rules, and verify its next planned action against those rules.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wshobson/session-guard/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip session-guard.zip -d .agents/skills
Documentation by Adit Jain
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)
Normal operation. No intervention needed.
Yellow Zone (40-60 tool calls)
CHECKPOINT - summarize progress in one paragraph
RECITE - state the 3-5 most critical active rules aloud: "Active rules: [naming convention], [file structure], [error handling pattern], [testing requirement]"
ASSESS - almost done? Push through. Not done? Prepare split.
REDUCE - no exploratory reads. Only targeted operations.
Red Zone (60+ tool calls OR drift signal)
STOP - do not make more tool calls
VERIFY - re-read project rules (don't trust memory)
CHECKPOINT - write state to handoff document
SPLIT - create handoff, suggest fresh session
Context Anchoring (anti-compaction)
When compaction has occurred (sudden loss of earlier context, or after /compact):
RE-READ the project's rules file immediately
RECITE the 3-5 critical rules aloud in your response
VERIFY your planned next action matches those rules before executing
If uncertain about ANY prior decision, RE-READ the source file - don't guess
What survives compaction:
Most recent user messages (high priority)
Currently-invoked skill body (capped at 5K tokens, oldest dropped first)
Git status and project structure
File contents read AFTER compaction
What gets LOST in compaction:
Decisions made early in conversation
Architectural rules stated only verbally (not in files)
Context from tool outputs (file reads, command outputs)
Compaction-Safe Pattern
Keep critical instructions in FILES (CLAUDE.md, CONTEXT.md), NOT in conversation. If a rule matters, it must live in a file the agent can re-read - not in something agreed on earlier.
Common Mistakes
Trusting that you remember the rules after 50+ tool calls (you don't - re-read)
Re-reading EVERYTHING to be safe (wastes tool calls - be targeted)
Feeling fine therefore assuming context is fine (compaction is SILENT)
Splitting AFTER noticing problems (split BEFORE - prevention, not recovery)
Why This Matters
Context compaction is the #1 unsolved platform problem in 2026. Hooks don't fix it (confirmed: the agent ignores post-compaction injections because the compaction summary creates narrative momentum). This skill is the lightweight behavioral countermeasure: no infrastructure, no packages - disciplined self-monitoring that works in every harness.
Files
- ATTRIBUTION.mdAdded by AutoGineer981 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md3.9 KiB
ATTRIBUTION.md
Attribution
This folder is an unmodified copy of the Agent Skill "session-guard", distributed by AutoGineer (https://autogineer.com/agent-skills).
Commit: 4bde3168b43c0655c4d00ea2726e631719908a6d
Created by: Adit Jain (https://github.com/wshobson/agents/tree/4bde3168b43c0655c4d00ea2726e631719908a6d/plugins/skill-forge-essentials/skills/session-guard)
Publisher: Seth Hobson (https://github.com/wshobson)
Licence: MIT License (https://github.com/wshobson/agents/blob/4bde3168b43c0655c4d00ea2726e631719908a6d/LICENSE)
Licence evidence: repository licence LICENSE
Retrieved: 2026-11-07
The skill's own files are unmodified copies. AutoGineer is not affiliated with or endorsed by the author or the publisher.
Files added by AutoGineer
ATTRIBUTION.md: this file, written by AutoGineer
LICENSE: copied from LICENSE
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Adit Jain
- Publisher
- Seth Hobson (Community)
- Distributed by
- Seth Hobson
- Source
- wshobson/agents · plugins/skill-forge-essentials/skills/session-guard · commit 4bde316
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Adit Jain or Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download session-guard.zip