Automation

Context Guardian

Git-style version control for agent memory. Snapshot, diff, rollback — never lose context again.

Buy Now — $4.99

One-time purchase · Instant download · Yours forever

Context Guardian

Git-style version control for agent memory. Snapshot, diff, rollback — never lose context again.

Quick Start


# Take a snapshot of current memory state
python3 scripts/context-guardian.py snapshot

# List all snapshots
python3 scripts/context-guardian.py list

# Diff current state against a snapshot
python3 scripts/context-guardian.py diff --snapshot latest

# Rollback memory to a previous snapshot
python3 scripts/context-guardian.py rollback --snapshot 2026-04-05T060000

# Detect context loss (compare before/after compaction)
python3 scripts/context-guardian.py detect-loss

# Auto-backup setup (creates a cron job)
python3 scripts/context-guardian.py auto-backup --interval 6h

Commands

`snapshot` — Capture Memory State

Creates a timestamped snapshot of all context files:

Snapshots stored in memory/.context-snapshots/ as compressed JSON.

Options: --tag to name a snapshot, --files to snapshot specific files.

`list` — Browse Snapshot History

Shows all snapshots with timestamps, sizes, and tags.

Options: --limit for recent N, --verbose for file details.

`diff` — Compare Versions

Shows what changed between current state and a snapshot:

Options: --snapshot , --file for specific file, --stat for summary only.

`rollback` — Restore Previous State

Restores memory files from a snapshot:

Options: --snapshot , --files for selective restore, --dry-run.

`detect-loss` — Context Loss Detection

Compares recent snapshots to identify information loss:

`auto-backup` — Scheduled Snapshots

Sets up automatic snapshots:

`prune` — Clean Old Snapshots

Remove old snapshots to save space:

How It Works

Snapshot Format

Each snapshot is a compressed JSON file containing:


{
  "id": "2026-04-05T060000",
  "tag": "pre-compaction",
  "timestamp": "2026-04-05T06:00:00Z",
  "files": {
    "MEMORY.md": { "hash": "sha256:...", "lines": 450, "size": 28000, "content": "..." },
    "memory/2026-04-05.md": { "hash": "sha256:...", "lines": 120, "size": 8400, "content": "..." }
  },
  "metadata": {
    "total_files": 25,
    "total_size": 180000,
    "agent_version": "4.2.0"
  }
}

Loss Detection Algorithm

1. Compare consecutive snapshots pairwise

2. For each file: compute line-level diff

3. Flag removals that contain high-value tokens (dates, numbers, proper nouns, decision keywords)

4. Calculate preservation ratio: (retained_high_value_lines / total_high_value_lines) × 100

5. Alert if preservation drops below 90%

Ready to get started?

One-time purchase. No subscription. Download instantly and use forever.

Buy Now — $4.99
Category: Automation Price: $4.99 USD Released: 2026-05-13 Skill ID: context-guardian