feat(checkpoint): filesystem checkpointing and rollback before destructive operations#559
feat(checkpoint): filesystem checkpointing and rollback before destructive operations#559alireza78a wants to merge 3 commits intoNousResearch:mainfrom
Conversation
f17715d to
6fb5756
Compare
|
Thanks for this PR @alireza78a! We loved the concept and the quality of your CheckpointStore implementation. We've taken your core approach (shadow git repos via GIT_DIR + GIT_WORK_TREE, deterministic path hashing, exclude patterns) and built it into a proper integration. What we changed from your approach:
Your shadow git approach was the right design — we just adjusted the integration points. Thanks for the inspiration and the solid foundation! 🎉 |
Automatic filesystem snapshots before destructive file operations, with user-facing rollback. Inspired by PR #559 (by @alireza78a). Architecture: - Shadow git repos at ~/.hermes/checkpoints/{hash}/ via GIT_DIR - CheckpointManager: take/list/restore, turn-scoped dedup, pruning - Transparent — the LLM never sees it, no tool schema, no tokens - Once per turn — only first write_file/patch triggers a snapshot Integration: - Config: checkpoints.enabled + checkpoints.max_snapshots - CLI flag: hermes --checkpoints - Trigger: run_agent.py _execute_tool_calls() before write_file/patch - /rollback slash command in CLI + gateway (list, restore by number) - Pre-rollback snapshot auto-created on restore (undo the undo) Safety: - Never blocks file operations — all errors silently logged - Skips root dir, home dir, dirs >50K files - Disables gracefully when git not installed - Shadow repo completely isolated from project git Tests: 35 new tests, all passing (2798 total suite) Docs: feature page, config reference, CLI commands reference
Closes #452
What changed
Added filesystem checkpointing using a shadow git repository before any destructive operation (delete, overwrite, move).
How it works
Files changed
Tested on
macOS