agentleFS
OthmanAdiOthmanAdi/haircut/skills/restore/SKILL.md

restore

Skill1 starsChanged 2 months agoMITView on GitHub

Undo a haircut trim. Puts back the skills, commands, subagents, MCP servers, hooks, plugins and files that haircut parked into a dated bag, using the receipt it wrote at the time. Use this skill whenever the user says undo the cleanup, undo the haircut, put my config back, restore what was trimmed, I need that MCP server again, that skill is gone and I want it back, roll the trim back, what is in the bag, or which files were moved. Use it also when something stopped working right after a config cleanup and they suspect the cleanup caused it, and whenever they ask how to reverse a config cleanup they regret.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the plan and tell the user in plain words what comes back, what is skipped and why.

    line 43
  2. Distinctive:

    Never print a credential. A file coming out of a bag may hold one.

    line 78
  3. Very specific:

    If what the user actually wants is to park something again, that is the haircut skill, not this one.

    line 82

“Common” is measured: kept by at least 6 in 10 of the 8 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

haircut restore

Restore walks a bag's manifest in reverse: files move back where they came from, symlinks are relinked, and anything it cannot reverse on its own is printed for the user. It never deletes, and it never overwrites a path that exists again.

1. Find the bag

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" status

This lists every bag with its operation count and the restore command for each. Bags are named after the run that made them. If there is more than one and the user has not said which, ask before touching anything.

2. Dry run, always

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" restore --dry-run

That takes the newest bag. For a specific one:

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" restore --bag <bag id> --dry-run

Read the plan and tell the user in plain words what comes back, what is skipped and why. Skips are normal and not a failure: a path that exists again is never overwritten, and the manifest records the reason.

3. Restore

The same command without --dry-run, after the user has seen the plan and said yes.

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" restore --bag <bag id>

4. What restore will not do on its own

Three kinds of operation need a word from you:

  • edit: a config file that trim rewrote, for example a hook removed from a settings file or a server disabled in a config file. The verbatim original sits in _originals inside the bag. Restore points at it instead of clobbering the file, because the user may have edited that file since. Offer --restore-edits, which copies the original back over it, and say plainly that any change made to that file since the trim is lost when they do.
  • cli: trim used the agent's own command line to remove a server or disable a plugin. Restore prints the reverse command. Show it to the user and run it only on their go.
  • Symlinks and junctions: relinking on Windows needs Developer Mode or an elevated shell. If it fails for that reason, say so and hand the user the command rather than retrying.

Rules

  • Restore never deletes anything, including on the way back.
  • Partial is fine. --bag picks which bag; inside it, skips are reported rather than forced.
  • Never print a credential. A file coming out of a bag may hold one. Name the path, not the content.
  • Anything that loads at session start will not appear in the current session after it comes back. Tell the user to start a new session.
  • If what the user actually wants is to park something again, that is the haircut skill, not this one.

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.