/timewright:undofrom timewright
Undo Claude's changes since the last prompt (covers Bash mutations)
Ships in timewright. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Undo every filesystem change Claude made since the most recent user prompt, including changes from Bash commands that native /rewind does not track. timewright keeps a single snapshot of the working tree taken at the start of the current turn, and this command restores the working tree to that snapshot.
Using the Bash tool, run:
node "${CLAUDE_PLUGIN_ROOT}/bin/undo.js" --diff
Parse the JSON the command prints to stdout.
If ok is false: report error to the user verbatim and stop. Common cause: no snapshot exists yet (first turn in a new project — nothing to undo to).
If hasChanges is false: tell the user "nothing to undo — the working tree already matches the snapshot" and stop.
If headDrift is not null: warn the user loudly. The real git HEAD has moved since the snapshot was taken (they ran git reset, git checkout, git rebase, or similar outside Claude). Show both headDrift.snapshot and headDrift.current SHAs and explain that undoing will overwrite their current state with snapshot-era state that assumed the old HEAD. Ask whether to proceed anyway before the AskUserQuestion below.
If multiAgent is present and multiAgent.active is true: warn the user that multiple agents (show multiAgent.count and multiAgent.handles) are active in this repo. The snapshot captures the entire working tree — undoing will revert all agents' changes since the snapshot was taken, not just the calling agent's. This warning does not block — continue to the summary below.
Show the user a summary of what will change:
modified — Claude changed these, undo will restore them.added — these exist now but did not exist in the snapshot. Undo will delete them. This is the dangerous set — call it out explicitly, since it may include files the user created in parallel in their IDE.removed — the snapshot had these but they are gone from the working tree.If any list has more than 20 entries, show the first 20 and note how many more there are.
Use AskUserQuestion to confirm. Ask: "Apply this undo? This will overwrite the working tree to match the snapshot." Offer two choices: "Yes, undo" and "No, cancel".
On "Yes, undo": using the Bash tool, run:
node "${CLAUDE_PLUGIN_ROOT}/bin/undo.js" --apply
Parse the JSON result.
ok is true and errors is absent or empty, tell the user the undo was applied successfully.ok is true but errors is a non-empty list, tell the user the undo was partially applied and show the list of files that failed (often caused by Windows symlink privilege issues, filesystem permissions, or files held open by another process).ok is false, show the error field to the user.On "No, cancel": tell the user nothing was changed and stop.
What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub joys-dawn/toolwright --plugin timewright