Get the FREE Ultimate OpenClaw Setup Guide →

guard

npx machina-cli add skill Ruya-AI/cozempic/guard --openclaw
Files (1)
SKILL.md
1.3 KB

Start the cozempic guard daemon for continuous session protection.

Default (recommended)

cozempic guard --daemon --threshold 50 -rx standard --interval 30

This runs in the background and:

  1. Checkpoints team state every 30 seconds
  2. At 60% of threshold (30MB): applies gentle prune, no reload
  3. At threshold (50MB): applies full prescription + auto-reload with team state preserved

For agent teams

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).

Options

  • --threshold N — hard threshold in MB (default: 50)
  • --soft-threshold N — soft threshold in MB (default: 60% of hard)
  • --threshold-tokens N — hard threshold in tokens (fires whichever hits first)
  • --no-reload — prune without restarting Claude
  • --no-reactive — disable kqueue/polling file watcher
  • -rx NAME — prescription at hard threshold (default: standard)

Check if running

The daemon writes to /tmp/cozempic_guard_*.log. Check with:

ls /tmp/cozempic_guard_*.pid 2>/dev/null

Source

git clone https://github.com/Ruya-AI/cozempic/blob/main/plugin/skills/guard/SKILL.mdView on GitHub

Overview

The guard skill starts a background daemon that monitors session size and prunes data before compaction triggers. It helps protect team state, especially for agent teams, by applying a gentle prune at 60% of the threshold and a full prescription with auto-reload at the hard threshold.

How This Skill Works

The guard runs as a daemon (cozempic guard --daemon) with a configured hard threshold and interval. It checkpoints team state periodically, triggers a gentle prune at 60% of the threshold without a reload, and performs a full prune with auto-reload at the hard threshold while preserving team state, logging activity to /tmp/cozempic_guard_*.log and pid files.

When to Use It

  • When running agent teams to prevent loss of TeamCreate, SendMessage, and tasks during auto-compaction
  • Before compaction triggers to avoid unexpected state loss
  • When session sizes approach the hard threshold (default 50 MB) or the soft threshold
  • In environments requiring continuous background protection without manual intervention
  • When you need regular checkpoints of team state and automated pruning

Quick Start

  1. Step 1: Start the daemon with: cozempic guard --daemon --threshold 50 -rx standard --interval 30
  2. Step 2: Confirm it's running by checking the PID files: ls /tmp/cozempic_guard_*.pid
  3. Step 3: Monitor status and logs: tail -f /tmp/cozempic_guard_*.log

Best Practices

  • Run the guard as a background daemon to provide continuous session protection
  • Tune --threshold and --soft-threshold to match your data size and risk tolerance
  • Use --no-reload only for prune-without-restart testing or special workflows
  • Enable guard for agent teams to preserve state during pruning and reloads
  • regularly verify /tmp/cozempic_guard_*.log and /tmp/cozempic_guard_*.pid to confirm operation

Example Use Cases

  • Start the daemon with default hard threshold of 50MB for an agent team: cozempic guard --daemon --threshold 50 -rx standard --interval 30
  • Guard triggers a gentle prune at 60% of the hard threshold (30MB) without reload
  • At the hard threshold (50MB), guard performs full pruning and auto-reload while preserving team state
  • Verify guard is running by listing pid files: ls /tmp/cozempic_guard_*.pid
  • Disable automatic reload for testing using --no-reload while pruning

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers