$npx -y skills add Ruya-AI/cozempic --skill guardProtect Claude Code sessions from context overflow by running a background daemon that monitors session size and auto-prunes before compaction hits. Use when the user says "guard", "protect session", "context getting long", "prevent compaction", "session management", or is runnin
| 1 | Start the cozempic guard daemon for continuous session protection. |
| 2 | |
| 3 | ## Default (recommended) |
| 4 | |
| 5 | ```bash |
| 6 | cozempic guard --daemon --threshold 50 -rx standard --interval 30 |
| 7 | ``` |
| 8 | |
| 9 | This runs in the background and: |
| 10 | 1. Checkpoints team state every 30 seconds |
| 11 | 2. At 60% of threshold (30MB): applies gentle prune, no reload |
| 12 | 3. At threshold (50MB): applies full prescription + auto-reload with team state preserved |
| 13 | |
| 14 | ## For agent teams |
| 15 | |
| 16 | Guard mode is **essential** for sessions running agent teams. Without it, auto-compaction triggers and the lead agent loses team state (TeamCreate, SendMessage, tasks are discarded). |
| 17 | |
| 18 | ## Options |
| 19 | |
| 20 | - `--threshold N` — hard threshold in MB (default: 50) |
| 21 | - `--soft-threshold N` — soft threshold in MB (default: 60% of hard) |
| 22 | - `--threshold-tokens N` — hard threshold in tokens (fires whichever hits first) |
| 23 | - `--no-reload` — prune without restarting Claude |
| 24 | - `--no-reactive` — disable kqueue/polling file watcher |
| 25 | - `-rx NAME` — prescription at hard threshold (default: standard) |
| 26 | |
| 27 | ## Check status and stop |
| 28 | |
| 29 | The daemon writes to `/tmp/cozempic_guard_*.log`. Check with: |
| 30 | ```bash |
| 31 | ls /tmp/cozempic_guard_*.pid 2>/dev/null # is it running? |
| 32 | tail -20 /tmp/cozempic_guard_*.log 2>/dev/null # recent activity |
| 33 | kill "$(cat /tmp/cozempic_guard_*.pid)" # stop it |
| 34 | ``` |