Session Guard

•
39k
•

Prevents context compaction amnesia and long-session instruction drift through disciplined behavioral self-monitoring and rule anchoring.

Session Guard provides a lightweight, framework-agnostic behavioral enforcement protocol that protects Claude Code and other agentic harnesses from silent context corruption and context compaction amnesia. By tracking health signals such as tool call counts (triggering green, yellow, and red zones), checking for convention drift, and establishing file-based context anchors, it ensures the agent consistently adheres to project rules throughout complex multi-step workflows. It automatically manages checkpointing, rule recitation, and session handoffs before degraded context can damage code quality.

Key Features

01Active rule recitation to prevent silent convention and style drift during long sessions
02Threshold-based zone monitoring (Green, Yellow, Red) based on tool call volume
03Zero-dependency behavioral enforcement compatible across all major agent harnesses
04Automated checkpoint generation and clean session handoff protocol for large-scale tasks
05Anti-compaction context anchoring using persistent rule files rather than volatile chat memory
0639,277 GitHub stars

Use Cases

01Recovering active project instructions immediately following automated context compaction events
02Structuring clean handoff documentation when splitting unbounded tasks across fresh agent sessions
03Preventing rule violations and architectural drift during deep, 40+ tool call development runs