# Agent Undo

> Git-backed undo and redo for AI agent turns, including shell and script changes, without touching your git history.

Agent Undo is a free AI agent skill on Agensi by Lindi Sylqa, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Lindi Sylqa](https://www.agensi.io/creators/lindi-sylqa)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Version: 1.0
- Last updated: 2026-11-29
- Security: scan passed (2026-11-29); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/agent-undo
- Tags: ai-agents, code-review, git, claude-code, versioning, dev-tools, undo, rewind

## About this skill

Stop worrying about an AI agent breaking your project or losing track of manual changes. This skill provides a git-backed safety net that snapshots every file before and after each agent turn, capturing edits from shell commands, formatters, and scripts that standard edit-tool checkpoints miss. It works entirely within private git refs, ensuring your branches, staging area, and commit history remain untouched.

### What it does
- **Atomic Snapshots** captures all tracked and untracked files before and after every message.
- **Safe Reverts** restores your project folder to the exact state it was in before a specific turn.
- **Side-Effect Tracking** logs changes made by `sed`, build scripts, or code generators.
- **Private Indexing** stores all data in `refs/checkpoints/` to avoid polluting your `git log`.
- **Automatic Hooks** integrates with Claude Code to manage checkpoints without manual commands.

### How it works
1. **Setup** runs `CP install-hooks` to link the checkpoint system to your agent's lifecycle.
2. **Monitor** creates a `CP begin` snapshot at the start of a request and `CP end` when work finishes.
3. **Inspect** uses `CP list` or `CP diff` to view turn history and specific file changes.
4. **Restore** executes `CP undo` to roll back the workspace or `CP redo` to bring changes back.

### Frameworks & tools
Built for Node.js 18+ and Git 2.23+. It includes native integration for Claude Code via `.claude/settings.json` and supports manual loops for Cursor, Codex, and Gemini.

### Why this beats prompting it yourself
Prompting an agent to "revert" often results in messy manual deletions or broken code states. This skill uses the underlying filesystem via Git, guaranteeing a byte-for-byte restoration that includes untracked files and bypasses the agent's potential hallucinations about its previous actions.

### Use cases
- Recovering from a regex command that accidentally corrupted multiple files.
- Comparing the output of two different prompts by toggling between checkpoints.
- Reverting automated formatting changes that violated project style guides.
- Creating a manual safety point before running risky shell migrations.

### Known limitations
Does not track files in `.gitignore` or changes outside the project root. Requires an initialized git repository to function.

## Requires

- Node.js 18+
- Git 2.23+

Run it inside a git repository; it can run git init for you. On Windows, install Git for Windows. Codex, Cursor and other agents without hooks run begin/end themselves. Ignored files like .env and node_modules are never snapshotted or restored.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Agent Undo skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does Agent Undo differ from simply asking an AI agent to "revert" its last change?

Unlike basic prompt-based reverts, this skill uses Git's filesystem-level snapshots to capture every change, including those from shell scripts and formatting tools, ensuring a byte-for-byte restoration without hallucination.

### Will these checkpoints clutter my project's git commit history or branches?

Not at all. The skill uses private git refs (refs/checkpoints/) to store snapshots, meaning your branches, staging area, and commit history stay perfectly clean.

### Which AI agents and IDEs are compatible with this skill?

It features native integration for Claude Code via automatic hooks and provides manual CLI commands for use with other agents like Cursor or Gemini.

### Does Agent Undo track changes to my .env files or other ignored assets?

No, the skill only tracks files currently monitored by Git; any files or directories listed in your .gitignore are excluded from snapshots for security and performance.

### What are the technical requirements to get this skill running in my project?

Setup is minimal: once you have Node.js 18+ and Git installed, you simply run the install-hooks command to link the checkpoint system to your agent's lifecycle.

### What is included in the purchase of this skill?

You receive the full skill package including the checkpoint CLI, native hooks for Claude Code, and documentation for integrating it into custom AI agent loops.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
