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
- laz3rjenkins/atomic-commitstheir own version, first seen Nov 8, 2026
- buildomator/buildomatortheir own version, first seen Nov 4, 2026
- nguyenthanhtat/screen1-claudetheir own version, first seen Nov 1, 2026
- MFaizR77/turnbacktheir own version, first seen Oct 14, 2026
- manastalukdar/ai-devstudiotheir own version, first seen Oct 13, 2026
- kks0488/vibe-claudetheir own version, first seen Oct 11, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- buildomator/buildomator★ 102same name
- kks0488/vibe-claude★ 29same name
- hereinthehive/kickstart★ 4same name
- nguyenthanhtat/screen1-claude★ 2same name
- manastalukdar/ai-devstudio★ 1same name
- MFaizR77/turnback★ 1same name
- 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.
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
- Very specific: line 17
Use the id the user gave, or latest.
- Distinctive: line 19
If two sessions touched the same files, map both — a file restored to the wrong version is worse than one left alone.
- Very specific: line 51
Before recommending anything, check whether the file changed *after* the session ended (modifiedAt versus the session's end time).
- Distinctive: line 70
Never chain a restore with anything else in the same command.
- Distinctive: line 71
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 …
- Distinctive: line 73
If it is not a git repository, say so — the agent's backups are then the only safety net, and they are per-session.
“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.
Files
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> --mdFor 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:
| Group | Condition | What it means |
| New | the session created the file | There is nothing to restore — undoing it means deleting it. Say that explicitly; never present a created file as "unrecoverable" |
| Safe | git clean, committed | Nothing to do — git already holds the previous version |
| Restorable | a backup version exists | copy <backup> <target> returns the file to its pre-edit state |
| Git-recoverable | dirty in git, no backup | git checkout -- <path> — but this also drops the user's own edits to that file |
| Patch-only | a diff exists, no backup | Reverse patch: review it, then git apply -R --check before applying |
| Unrecoverable | none of the above | Say 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.
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
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.

