guard

Monitor Claude Code session size and prune noisy context before auto-compaction.

368|36|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/Ruya-AI/cozempic --skill guard-ruya-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/Ruya-AI/cozempic/tree/main/plugin/skills/guard
Command: npx skills add https://github.com/Ruya-AI/cozempic --skill guard-ruya-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill runs a background sentinel that monitors Claude Code session size and proactively prunes bloat so that auto-compaction does not discard critical agent team state or waste token budget.

Core Features & Use Cases

  • Continuous checkpointing: saves team state to disk at configurable intervals to enable safe reloads.
  • Threshold-driven pruning: applies soft trims at a soft threshold and full prescriptions plus optional auto-reload at a hard threshold.
  • Reactive overflow recovery: file-watcher detects rapid inbox floods and applies escalating prescriptions with a circuit breaker to prevent recovery loops.
  • Use Case: Protect long-running Agent Teams from losing TeamCreate, SendMessage, and task state during Claude Code auto-compaction.

Quick Start

Start the guard daemon in the background with a 50MB threshold and a 30 second checkpoint interval to protect agent teams.

Frequently Asked Questions about guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent Claude Code auto-compaction from discarding critical agent team state?

To prevent auto-compaction from discarding critical agent team state, you can run a background sentinel that monitors session size and proactively prunes context bloat. This preserves TeamCreate, SendMessage, and task state during long-running interactive sessions.

What is session pruning and how does threshold-based pruning work?

Session pruning removes noisy context and metadata bloat to manage token budgets. Threshold-based pruning applies soft trims when a soft limit is reached and full prescriptions plus optional auto-reload at a hard limit to protect critical state.

How do I recover from rapid context overflow in long-running agent teams?

Recover from rapid context overflow using reactive file-watcher overflow recovery. It detects inbox floods and applies escalating pruning prescriptions with a circuit breaker to prevent recovery loops while preserving team state.

Can I checkpoint session state to disk for safe reloads during interactive sessions?

Yes, you can checkpoint session state to disk at configurable intervals for safe reloads. Continuous checkpointing saves team state periodically, enabling recovery without losing critical agent team context.

Does the guard sentinel work with Claude Code interactive sessions and agent teams?

Yes, the guard sentinel works with Claude Code interactive sessions and long-running agent teams. It monitors token budgets, repeated tool outputs, and metadata bloat that accumulate in these environments to prevent auto-compaction issues.

What are the limitations of auto-pruning sessions to prevent compaction?

A limitation of auto-pruning is that aggressive pruning prescriptions can trigger recovery loops if rapid inbox floods persist. A circuit breaker mitigates this, but pruning is designed for threshold-based overflow rather than continuous high-volume context generation.