agentleFS
D-SheyD-Shey/autoharness/.agents/skills/rollback-guard/SKILL.md

rollback-guard

Skill10 starsChanged todayMITView on GitHub

Automated git and filesystem rollback guard with atomic state recovery. Use when executing risky modifications, self-refinement iterations, or autonomous driver loops to automatically snapshot clean baselines and restore them on test or verification failure.

  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use before initiating risky automated code changes, multi-agent autonomous iterations, or self-refinement loops to snapshot clean workspace …

    line 9
  2. Distinctive:

    Verify git status / clean tree state.

    line 13
  3. Very specific:

    Create lightweight filesystem or stash snapshot in .autoharness/snapshots/<id>/.

    line 15
  4. Distinctive:

    Run test suite (e.g. pytest).

    line 19
  5. Distinctive:

    Run AST Anti-Shim sentinel to ensure no empty stubs or mocks were introduced.

    line 20
  6. Distinctive:

    Check blast radius and syntax validity.

    line 21
  7. Very specific:

    If tests or AST checks fail, immediately invoke rollback().

    line 23
  8. Distinctive:

    If verification passes, finalize snapshot as verified baseline.

    line 27
  9. Distinctive:

    Test clean snapshot capture: verify snapshot file is created with valid tree hash.

    line 30
  10. Distinctive:

    Test rollback recovery: introduce broken code or stub in workspace, trigger rollback, verify file is restored to pre-flight snapshot.

    line 31

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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

Rollback Guard

When to use

Use before initiating risky automated code changes, multi-agent autonomous iterations, or self-refinement loops to snapshot clean workspace state and restore it immediately if post-flight tests, AST checks, or syntax validations fail.

Steps

  1. Pre-flight Snapshot:
    • Verify git status / clean tree state.
    • Record HEAD commit hash and working tree state SHA256 (evidence.tree_state).
    • Create lightweight filesystem or stash snapshot in .autoharness/snapshots/<id>/.
  2. Execute Changes:
    • Perform code modifications, agent tasks, or refactoring.
  3. Post-flight Verification:
    • Run test suite (e.g. pytest).
    • Run AST Anti-Shim sentinel to ensure no empty stubs or mocks were introduced.
    • Check blast radius and syntax validity.
  4. Automated Rollback on Failure:
    • If tests or AST checks fail, immediately invoke rollback().
    • Restore modified tracked files (git restore .) and remove untracked artifacts (git clean -fd or snapshot overlay).
    • Log the regression failure and revert status to .autoharness/sentinel.json.
  5. Success Confirmation:
    • If verification passes, finalize snapshot as verified baseline.

How to verify

  1. Test clean snapshot capture: verify snapshot file is created with valid tree hash.
  2. Test rollback recovery: introduce broken code or stub in workspace, trigger rollback, verify file is restored to pre-flight snapshot.

Facts found here

  • Combining git restore with untracked artifact cleaning provides deterministic zero-leakage rollback across Windows and Unix platforms.
  • Pre-flight test baselines prevent attributing pre-existing broken tests to current task changes.

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.