# Context Checkpoint Skill ## Overview The checkpoint skill preserves session context across token resets and orchestrates sub-agent calls with minimal token usage. ## Commands ### Create Checkpoint ```bash /opt/agent-governance/bin/checkpoint now [--notes "description"] ``` Captures current state: phase, tasks, dependencies, variables, recent outputs. ### Load Checkpoint ```bash /opt/agent-governance/bin/checkpoint load [checkpoint_id] ``` Loads latest or specific checkpoint. Use `--json` for machine-readable output. ### Compare Checkpoints ```bash /opt/agent-governance/bin/checkpoint diff [--from ID] [--to ID] ``` Shows changes between checkpoints (phase, tasks, variables, dependencies). ### List Checkpoints ```bash /opt/agent-governance/bin/checkpoint list [--limit N] ``` Lists available checkpoints with timestamps and token counts. ### Context Summary ```bash /opt/agent-governance/bin/checkpoint summary --level minimal|compact|standard|full ``` Generates token-aware summaries: - `minimal` (~500 tokens): Phase + active task + agent - `compact` (~1000 tokens): + pending tasks + key variables - `standard` (~2000 tokens): + all tasks + dependencies - `full` (~4000 tokens): Complete context for complex operations ### Auto-Orchestrate Mode ```bash /opt/agent-governance/bin/checkpoint auto-orchestrate --model minimax|gemini|gemini-pro \ --instruction "command1" --instruction "command2" [--dry-run] [--confirm] ``` Delegates commands to OpenRouter models with automatic checkpointing. ### Instruction Queue ```bash /opt/agent-governance/bin/checkpoint queue list|add|clear|pop [--instruction "..."] [--priority N] ``` Manages pending instructions for automated execution. ### Prune Old Checkpoints ```bash /opt/agent-governance/bin/checkpoint prune [--keep N] ``` Removes old checkpoints, keeping the most recent N (default: 50). ## When to Use 1. **Before complex operations**: Create checkpoint to preserve state 2. **After session reset**: Load checkpoint to restore context 3. **Sub-agent calls**: Use `summary --level compact` to minimize tokens 4. **Debugging**: Use `diff` to see what changed between checkpoints 5. **Automated mode**: Use `auto-orchestrate` for humanless execution ## Examples ```bash # Save current state before risky operation checkpoint now --notes "Before database migration" # Restore after context reset checkpoint load # Get minimal context for sub-agent checkpoint summary --level minimal # Run automated commands with Minimax checkpoint auto-orchestrate --model minimax \ --instruction "run tests" \ --instruction "deploy if tests pass" # Queue instructions for later checkpoint queue add --instruction "backup database" --priority 10 checkpoint queue list ``` ## Integration Checkpoints are stored in: - `/opt/agent-governance/checkpoint/storage/` (JSON files) - DragonflyDB `checkpoint:latest` key (fast access) Audit logs go to: - SQLite: `orchestration_log` table - DragonflyDB: `orchestration:log` list