agentleFS
ChrisLamDevChrisLamDev/hermes-core-skills/skills/checkpoints-and-rewind/SKILL.md

checkpoints-and-rewind

Skill11 starsChanged 5 months agoMITView on GitHub

Use before making irreversible changes (deleting files, destructive git operations, large refactors). Use when you need the ability to roll back if something goes wrong. Use at the start of any task that modifies multiple files.

  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before making risky or irreversible changes, create a checkpoint.

    line 33
  2. Distinctive:

    Core principle: Every multi-file change starts with a safety net.

    line 35
  3. Distinctive:

    When you need to undo:

    line 118

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Checkpoints & Rewind

Overview

Before making risky or irreversible changes, create a checkpoint. If things go wrong, rewind to the checkpoint. This gives you the confidence to experiment without fear of breaking things.

Core principle: Every multi-file change starts with a safety net.

When to Use

  • Before large refactors — Moving code, renaming files, changing architecture
  • Before deleting anything — Files, directories, database data
  • Before destructive git operations — git reset, git rebase, git clean
  • Before trying experimental approaches — "Let's see if this works"
  • At the start of any task that modifies 3+ files
  • Before running auto-fix in code review (Step 7 of requesting-code-review)

Do NOT use for: Single-file edits, reading files, running tests, or any operation that's trivially undoable.

How to Create a Checkpoint

Method 1: Git Commit (Recommended)

# Before making changes
git add -A && git commit -m "[checkpoint] before <description>"

# Make your changes...

# If things go wrong:
git reset --hard HEAD~1

# If things go right:
# Keep the checkpoint commit, or squash it later

Method 2: Git Stash (For Experiments)

# Before making changes
git stash push -m "checkpoint: <description>"

# Make your changes... (starting from clean state)

# If things go wrong:
git stash pop  # restore the checkpoint (undoes your changes)

# If things go right:
git stash drop  # discard the checkpoint

Method 3: Manual Backup (No Git)

# Before making changes
cp -r important_file.ts important_file.ts.checkpoint

# Make your changes...

# If things go wrong:
cp important_file.ts.checkpoint important_file.ts

# Clean up after success:
rm important_file.ts.checkpoint

Naming Convention

Always include:

  • [checkpoint] prefix (easy to search in git log)
  • What you're about to do
  • Date/time if helpful

Good:

[checkpoint] before refactoring ChantingHall to adapter pattern
[checkpoint] before trying experimental rendering approach
[checkpoint] before deleting old story-data.js

Bad:

[checkpoint] save
[checkpoint] before changes
wip

Rewind Process

When you need to undo:

Step 1: Assess the Damage

# See what changed
git status
git diff --stat

# See recent commits
git log --oneline -5

Step 2: Choose Rewind Method

Scenario A: Just checkpointed, no other commits in between

git reset --hard HEAD~1

Scenario B: Checkpoint was several commits ago

# Find the checkpoint commit
git log --oneline --grep="\[checkpoint\]"

# Revert to it
git reset --hard <commit-hash>

Scenario C: Need to keep some changes, undo others

# Reset specific files
git checkout <commit-hash> -- path/to/file.ts

# Or use interactive reset
git reset -p HEAD~1

Scenario D: Already pushed to remote

# DON'T force push. Instead:
git revert <commit-hash>
# This creates a new commit that undoes the changes (safe for shared repos)

Step 3: Verify the Rewind

# Check the project still works
npm test -- --passWithNoTests 2>&1 | tail -5
# Or
npm run build 2>&1 | tail -5

Integration with Other Skills

  • think-tool — Use Think Tool before deciding whether to checkpoint
  • subagent-driven-development — Each subagent should checkpoint before starting its task
  • requesting-code-review — Auto-fix loop (Step 7) should checkpoint before attempting fixes
  • spec-driven-development — Checkpoint before Phase 4 (Implement)

Best Practices

  1. Checkpoint early, checkpoint often — Better to have too many than too few
  2. Use descriptive messages — "before refactor" not "save"
  3. Don't rely on the undo buffer — Editor undo only works within the same session
  4. Clean up old checkpoints — After a successful task, squash or drop checkpoint commits
  5. Combine with Think Tool — Think first, then checkpoint, then act

Common Mistakes

  • Not checkpointing before destructive operations — "I'll just be careful" is not a strategy
  • Checkpointing after starting changes — The checkpoint must be BEFORE, not during
  • Forgetting to clean up — Old checkpoint files and commits accumulate
  • Skipping verification — Always verify after rewind to make sure it worked

Quick Reference

ActionCommandWhen
Git checkpointgit add -A && git commit -m "[checkpoint] ..."Before changes
Stash checkpointgit stash push -m "checkpoint: ..."Before experiments
File backupcp file file.checkpointNo git / single file
Rewind (last commit)git reset --hard HEAD~1Undo all changes
Rewind (specific)git reset --hard <hash>Undo to specific point
Selective undogit checkout <hash> -- <file>Undo specific file
Safe undo (pushed)git revert <hash>Don't force push
Clean checkpoint commitgit rebase -i HEAD~NSquash during cleanup

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.