Auto-checkpoint on Command:new
Automatic session state preservation when OpenClaw resets sessions, preventing context loss during /new commands.
Auto-checkpoint on Command:new
The ClawVault hook automatically creates checkpoints before OpenClaw resets sessions, ensuring no context is lost when users run the /new command.
How It Works
When a user runs /new in OpenClaw to reset their session:
- Event Trigger: OpenClaw fires a
command:newevent - Hook Activation: ClawVault hook intercepts the event
- State Capture: Current session state is saved to vault
- Session Reset: OpenClaw proceeds with normal session reset
- Recovery Ready: State is available for future recovery
What Gets Checkpointed
The auto-checkpoint captures essential session state:
Current Work Context
- What the agent was actively working on
- Key focus areas and priorities
- Current train of thought
Session Metadata
- Session ID and timestamp
- Agent identity and model
- Session duration and message count
Recovery Markers
- Checkpoint creation time
- Last significant activity
- Session health indicators
Example Flow
Before /new Command
User: /new
OpenClaw: [About to reset session...]
↓ fires command:new event
ClawVault Hook:
Detected session reset
Creating auto-checkpoint
Saved: "Working on clawvault docs, finishing commands section"
Ready for reset
OpenClaw: [Session reset complete]After Session Reset
The agent can recover using:
clawvault wakeWhich shows:
Wake Up Summary
Last Session:
Ended: 2 minutes ago (auto-checkpoint)
Working on: clawvault docs, finishing commands section
Duration: 45 minutes
Recent Context:
- Completed repair-session.md documentation
- In progress: template.md with examples
- Next: OpenClaw integration docs
No context death detected Configuration
Auto-checkpoint runs automatically when the hook is installed — no configuration needed. The hook handler has a built-in 15-second timeout for subprocess calls.
To verify auto-checkpoint is working:
openclaw hooks list | grep clawvault
clawvault compatPerformance Characteristics
Auto-checkpoint is designed to be fast and non-intrusive:
- Typical Duration: 100-300ms
- Timeout Protection: 5 second max
- Failure Handling: Session reset continues even if checkpoint fails
- Background Processing: Non-blocking for user experience
Performance by Vault Size
| Vault Size | Checkpoint Time | Impact |
|---|---|---|
| Small (<100 files) | 50-100ms | Negligible |
| Medium (100-500 files) | 100-200ms | Barely noticeable |
| Large (500-1000 files) | 200-400ms | Very minor delay |
| Very Large (1000+ files) | 300-500ms | Small delay |
Integration with Manual Checkpoints
Auto-checkpoint complements manual checkpoint usage:
Manual Checkpoints (During Work)
# Detailed checkpoints during heavy work
clawvault checkpoint --working-on "database refactor" \
--focus "migration scripts" \
--blocked "waiting for schema review"Auto-checkpoints (Session Boundaries)
- Triggered automatically before
/new - Captures high-level session state
- Ensures nothing is completely lost
Recovery Strategy
- Recent auto-checkpoint provides session boundary context
- Manual checkpoints provide detailed work state
- Combined recovery gives complete picture
Error Handling
The hook is designed to fail gracefully:
Checkpoint Creation Failures
- Timeout: Checkpoint abandoned after 5 seconds, session reset continues
- Vault Error: Error logged, session reset continues normally
- Permission Issue: Error logged, user notified on next wake
Recovery from Failures
# Check for checkpoint issues
clawvault doctor
# Manual recovery if auto-checkpoint failed
clawvault recover --verboseCheckpoint Storage
Auto-checkpoints are stored in your vault's checkpoint system:
vault/
├── .clawvault/
│ ├── checkpoints/
│ │ ├── 2024-01-15T14:30:52.json (auto)
│ │ ├── 2024-01-15T14:45:12.json (manual)
│ │ └── 2024-01-15T15:02:33.json (auto)
│ └── last-checkpoint.json (latest)Checkpoint Metadata
Each checkpoint includes:
{
"type": "auto",
"event": "command:new",
"timestamp": "2024-01-15T15:02:33Z",
"session_id": "main/2024-01-15-143052",
"duration_ms": 150,
"context": {
"working_on": "clawvault documentation",
"focus": "OpenClaw integration guides",
"last_activity": "2024-01-15T15:02:18Z"
}
}Troubleshooting
Auto-checkpoint Not Running
Symptoms:
/newcommand doesn't create checkpoints- No recovery context after session reset
clawvault wakeshows no recent checkpoints
Diagnosis:
# Check hook status
openclaw hooks list | grep clawvault
# Run compatibility check
clawvault compatSolutions:
# Reinstall hook
clawhub install clawvault
# Check vault health
clawvault doctorMissing Context After Reset
# Check recovery state
clawvault recover --verbose
# Manual checkpoint before important work
clawvault checkpoint --working-on "important task"
# Check vault health
clawvault doctorBest Practices
- Don't rely solely on auto-checkpoint - use manual checkpoints for detailed state
- Monitor checkpoint performance - run
clawvault doctorif resets feel slow - Combine with manual checkpoints during critical work sessions
- Test recovery flow periodically with
clawvault wake
- Experimental sessions where you might reset frequently
- Long debugging sessions with multiple reset cycles
- Collaborative work where others might reset the session
- Demo/presentation prep with frequent resets to clean slate
Disable Auto-checkpoint
To disable auto-checkpoint, remove or rename the ClawVault hook:
# Remove hook entirely
rm -rf ~/.openclaw/hooks/clawvault
# Or just remove the handler
mv ~/.openclaw/hooks/clawvault/handler.js ~/.openclaw/hooks/clawvault/handler.js.disabledYou can still use manual checkpoints:
# Before running /new manually
clawvault checkpoint --working-on "current task"Comparison with Manual Workflow
| Approach | Pros | Cons |
|---|---|---|
| Auto-checkpoint | Zero effort, never forgotten, consistent | Less detailed, generic context |
| Manual only | Rich context, precise timing, full control | Easy to forget, inconsistent |
| Hybrid (recommended) | Best of both, comprehensive coverage | Slightly more storage |
The hybrid approach uses auto-checkpoint as a safety net while manual checkpoints provide detailed context for important work.