agentleFS
hailneedhailneed/agent-blackbox/skills/undo/SKILL.md

undo

Skill0 starsChanged 3 months agoMITView on GitHub

Work out what a coding agent changed on disk and what can still be reverted — map every file it touched to a recovery source (the agent's own backup, git, or a reverse patch), and flag the actions that cannot be undone at all. Use when the user wants to roll back what an agent did, asks whether a change can be taken back, is unsure what was modified, says "geri al", "bunu nasıl geri alırım", "undo what it did", "which files did it change", "can I revert this", or runs /agent-blackbox:undo [session]. Not for reviewing what happened — that is agent-blackbox:timeline. Not for auditing risk across sessions — that is agent-blackbox:risk.

7 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions7 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 7

    1. buildomator/buildomator★ 102same name
    2. kks0488/vibe-claude★ 29same name
    3. hereinthehive/kickstart★ 4same name
    4. nguyenthanhtat/screen1-claude★ 2same name
    5. manastalukdar/ai-devstudio★ 1same name
    6. MFaizR77/turnback★ 1same name
    7. laz3rjenkins/atomic-commits★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 4

    Distinctive

    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. Very specific:

    Use the id the user gave, or latest.

    line 17
  2. Distinctive:

    If two sessions touched the same files, map both — a file restored to the wrong version is worse than one left alone.

    line 19
  3. Very specific:

    Before recommending anything, check whether the file changed *after* the session ended (modifiedAt versus the session's end time).

    line 51
  4. Distinctive:

    Never chain a restore with anything else in the same command.

    line 70
  5. Distinctive:

    If the working directory is a git repository and it is dirty, propose git stash -u (or a WIP commit) *before* the first restore, so this …

    line 71
  6. Distinctive:

    If it is not a git repository, say so — the agent's backups are then the only safety net, and they are per-session.

    line 73

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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

Undo map (undo)

Turn "the agent broke something" into a concrete list: which files changed, where each one can be recovered from, and which actions are already past recovery.

Language rule: write every user-facing output in the language the user is speaking with you. Safety rule: this skill produces a plan. It does not restore anything until the user says to, one file or one group at a time. Never restore in bulk on your own initiative.

Step 0 — Pick the session

Use the id the user gave, or latest. When they describe it instead ("az önceki", "dsg-platform oturumu"), run --list --days 7 --md first and match on directory and time. If two sessions touched the same files, map both — a file restored to the wrong version is worse than one left alone.

Step 1 — Build the map

node "${CLAUDE_PLUGIN_ROOT}/scripts/blackbox.mjs" --undo --session <id|latest> --md

For an agent that records diffs rather than file backups (Codex), also write a draft reverse patch (expand the home directory yourself; never pass a literal ~):

node "${CLAUDE_PLUGIN_ROOT}/scripts/blackbox.mjs" --undo --session <id> \
  --patch "<home>/.agentlens/blackbox/<slug>-undo.patch"

Requires Node.js 18+. Read the output fully before saying anything.

Step 2 — Sort files by what you can actually do

Each row carries a backup version, a git state and a suggested recovery. Group them:

GroupConditionWhat it means
Newthe session created the fileThere is nothing to restore — undoing it means deleting it. Say that explicitly; never present a created file as "unrecoverable"
Safegit clean, committedNothing to do — git already holds the previous version
Restorablea backup version existscopy <backup> <target> returns the file to its pre-edit state
Git-recoverabledirty in git, no backupgit checkout -- <path> — but this also drops the user's own edits to that file
Patch-onlya diff exists, no backupReverse patch: review it, then git apply -R --check before applying
Unrecoverablenone of the aboveSay so plainly and early. Do not imply a rollback that does not exist

Before recommending anything, check whether the file changed after the session ended (modifiedAt versus the session's end time). If it did, someone edited it since — restoring would silently discard that work. Call this out.

Step 3 — Read the irreversible list

The report's second half lists destructive, data, git and publish actions that actually ran. These are not in the file map because no file map can fix them. Report them in the order that matters: deleted data first, then anything published or pushed outward, then history rewrites. For each, say what the realistic remedy is — a remote copy, a database backup, a new release — or say that there is none.

Step 4 — Propose, do not perform

Present the plan as a short numbered list, most valuable first, with the exact command for each step. Then stop and ask which of them to run. When the user picks:

  • Restore one file or one named group at a time, and show the diff you are about to overwrite when it is short enough to read.
  • Never chain a restore with anything else in the same command.
  • If the working directory is a git repository and it is dirty, propose git stash -u (or a WIP commit) before the first restore, so this operation is itself reversible.
  • If it is not a git repository, say so — the agent's backups are then the only safety net, and they are per-session.

Step 5 — Reply

Short: how many files changed, how many are recoverable and by which route, how many are not, and the irreversible actions if any. End with the one question the user has to answer to move forward. If nothing changed on disk, say that in a single line.

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.