From hiivmind-openclaw-os
Context protection and checkpointing system for AI Persona OS (Never-Forget Protocol). Monitors context window usage and automatically saves progress at critical thresholds to prevent context loss. Enables 95% recovery from interruptions. Triggers: checkpoint, save context, preserve, resume, context protection, never-forget, recovery, context loss, emergency checkpoint, survival mode, flush context, session recovery, decision tracking, action items, resume point, proactive save, forced checkpoint, natural break, risky operation, context threshold, vigilant mode, active checkpoint, emergency flush, critical save, context percentage, checkpoint frequency, workspace memory, permanent facts, recovery protocol, session continuity, progress preservation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/hiivmind-openclaw-os:persona-checkpointThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill implements context protection and checkpointing for AI Persona OS to prevent context loss and enable session recovery with 95% accuracy.
This skill implements context protection and checkpointing for AI Persona OS to prevent context loss and enable session recovery with 95% accuracy.
Step 1.1: Check current context window usage percentage
Calculate or estimate the current context window utilization based on conversation length, tool calls, and complexity.
Step 1.2: Determine severity threshold
| Usage | Status | Action Required |
|---|---|---|
| < 50% | 🟢 Normal | Write decisions as they happen (lightweight) |
| 50-69% | 🟡 Vigilant | Increase checkpoint frequency (every ~5 exchanges) |
| 70-84% | 🟠 Active | STOP — write full checkpoint NOW |
| 85-94% | 🔴 Emergency | Emergency flush — essentials only (task + resume point) |
| 95%+ | ⚫ Critical | Survival mode — bare minimum to resume |
Step 1.3: Apply user visibility rules
Step 2.1: Select checkpoint type based on threshold
if context < 50%:
checkpoint_type = "lightweight" # Inline decisions only
elif 50% <= context < 70%:
checkpoint_type = "vigilant" # Every ~5 exchanges, light format
elif 70% <= context < 85%:
checkpoint_type = "full" # Complete checkpoint with reasoning
elif 85% <= context < 95%:
checkpoint_type = "emergency" # Task + resume point only
else: # 95%+
checkpoint_type = "survival" # Absolute bare minimum
Step 2.2: Check for forced triggers
Override threshold-based logic if any of these occur:
Step 3.1: Create checkpoint file path
Use Bash to create directory and determine file path:
mkdir -p ~/workspace/memory
echo "~/workspace/memory/$(date +%Y-%m-%d).md"
Step 3.2: Format checkpoint content based on type
Lightweight (< 50%):
## Checkpoint [HH:MM] — Context: XX%
**Decision:** [What was decided]
Vigilant (50-69%):
## Checkpoint [HH:MM] — Context: XX%
**Active task:** [Current work]
**Resume from:** [Next step]
Full checkpoint (70-84%):
## Checkpoint [HH:MM] — Context: XX%
**Active task:** [What we're working on]
**Key decisions:**
- [Decision 1 with reasoning]
- [Decision 2 with reasoning]
**Action items:**
- [ ] [Task 1] (owner: [user/assistant])
- [ ] [Task 2] (owner: [user/assistant])
**Current status:** [Progress summary]
**Resume from:** [Exact next step with context]
Emergency (85-94%):
## ⚠️ Emergency Checkpoint [HH:MM] — Context: XX%
**Task:** [One-line description]
**Resume:** [Exact next action]
Survival (95%+):
## 🚨 Survival Checkpoint [HH:MM] — Context: XX%
**Resume:** [Minimum viable next step]
Step 3.3: Write checkpoint to file
Use Bash to append checkpoint to today's file:
cat >> ~/workspace/memory/$(date +%Y-%m-%d).md << 'EOF'
[Formatted checkpoint content from Step 3.2]
EOF
Step 3.4: Confirm write success
Verify the checkpoint was written:
tail -n 5 ~/workspace/memory/$(date +%Y-%m-%d).md
Step 4.1: Read latest checkpoint
Use Bash to locate and read today's checkpoint file:
cat ~/workspace/memory/$(date +%Y-%m-%d).md
Step 4.2: Read permanent facts
Use Read tool to load persistent context:
cat ~/workspace/MEMORY.md
Step 4.3: Parse resume instructions
Extract the most recent "Resume from" instruction from the checkpoint file.
Step 4.4: Notify user and resume
Inform the user:
Resuming from checkpoint at [time]. Context recovery: 95%
Last checkpoint: [XX]% context window
Continuing: [Resume instruction]
Step 4.5: Continue from exact resume point
Execute the next step as specified in the resume instruction with full context from permanent facts + checkpoint.
| Trigger | Frequency | Type |
|---|---|---|
| Proactive | Every ~10 exchanges | Lightweight or Vigilant (depends on context %) |
| Threshold: 70%+ | Immediate | Full checkpoint (mandatory) |
| Threshold: 85%+ | Immediate | Emergency checkpoint (mandatory) |
| Threshold: 95%+ | Immediate | Survival checkpoint (mandatory) |
| Major decision | Before execution | Full checkpoint |
| Natural break | End of task/phase | Vigilant or Full |
| Risky operation | Before execution | Full checkpoint |
| User command | On "checkpoint" keyword | Full checkpoint (forced) |
computed.last_checkpoint_time = [HH:MM]
computed.last_checkpoint_context = [percentage]
computed.checkpoints_today = [count]
computed.recovery_mode = [true/false]
npx claudepluginhub hiivmind/hiivmind-openclaw-osSaves and resumes state for multi-phase commands like /debug, /epic, /feature, /implement, and /plan, enabling work to survive session interruptions.
Create context save points to preserve conversation state before breaks, risky changes, or compaction. Use when user says 'save my progress', 'create checkpoint', 'mark this point', or before clearing context.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.