MA

Safe, Git-aware undo for tasks and project phases.

Install

mkdir -p .claude/skills/maestro-revert && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13119" && unzip -o skill.zip -d .claude/skills/maestro-revert && rm skill.zip

Installs to .claude/skills/maestro-revert

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Git-aware revert of track, phase, or individual task. Safely undoes implementation with plan state rollback.
108 charsno explicit “when” trigger
Advanced

Key capabilities

  • Revert implementation work at track, phase, or task granularity
  • Create new revert commits without destroying original history
  • Roll back maestro plan state after reverting
  • Perform safety pre-checks before any revert operation
  • Handle local-only resets with different options
  • Re-apply reverted changes using git revert --no-edit

How it works

The skill identifies the scope of work to revert, performs safety checks, creates new revert commits, and updates the maestro plan state.

Inputs & outputs

You give it
Track, phase, or task to revert, with optional flags
You get back
New revert commits, rolled back maestro plan state, and updated track status

When to use maestro:revert

  • Reverting a failed feature
  • Undoing a project phase
  • Restoring state after a bad implementation

About this skill

Revert -- Git-Aware Undo

Overview

Revert undoes implementation work at track, phase, or task granularity. It creates NEW revert commits -- original history is never destroyed. After reverting, maestro plan state is rolled back so tasks can be re-implemented.

Core principle: git revert is additive. It records the undo as new history. The original commits remain reachable via reflog and git log. This is the safe default.

If you are thinking about git reset --hard, stop. Read the Danger Zones section first. There are almost always safer alternatives.

When to Use

SituationScopeCommand
Task produced wrong result--task <name>Revert that task's commits
Phase approach was wrong--phase <N>Revert all commits in phase N
Track needs complete restartNo scope flagRevert entire track
Single bad commit (known SHA)Manualgit revert --no-edit <sha>

Exceptions (ask your human partner):

  • Commits contain secrets or credentials (need history rewrite, not revert)
  • Revert would create unresolvable conflicts (consider branch recreation)
  • Work was never pushed (local-only reset may be simpler)

Decision Tree: revert vs reset vs branch recreation

Start here: Have the commits been pushed to a remote that others pull from?

Commits pushed to shared remote?
  |
  +-- YES --> Use `git revert` (ALWAYS)
  |           Creates new commits that undo the old ones.
  |           Safe for shared history. No force push needed.
  |
  +-- NO (local only) --> How clean do you need it?
        |
        +-- Keep changes staged --> `git reset --soft <target>`
        |   Files stay in index. You can re-commit differently.
        |
        +-- Keep changes unstaged --> `git reset --mixed <target>` (default)
        |   Files in working tree, not staged. Review before re-committing.
        |
        +-- Destroy changes completely --> `git reset --hard <target>`
        |   [DESTRUCTIVE] Working tree matches target. Changes are GONE.
        |   Requires explicit user confirmation. See Danger Zones.
        |
        +-- History is tangled beyond repair --> Branch recreation
            Create new branch from known-good point, cherry-pick what to keep.
            See reference/git-operations.md for branch recreation protocol.

Decision summary:

StrategyPushed?Preserves history?Risk level
git revertYes or NoYes (additive)Safe
git reset --softNo onlyPartial (moves HEAD)Low
git reset --mixedNo onlyPartial (moves HEAD)Low
git reset --hardNo onlyNo (destroys changes)DESTRUCTIVE
Branch recreationEitherYes (new branch)Complex

Default: always use git revert unless you have a specific reason not to. The other strategies exist for edge cases, not convenience.

Safety Pre-Checks (MANDATORY)

Before ANY revert operation, run these checks. Do not skip them.

1. Clean worktree

git status --porcelain

If output is non-empty: STOP. Uncommitted changes will complicate the revert.

  • Stash them: git stash push -m "pre-revert backup"
  • Or commit them: git add -A && git commit -m "wip: save before revert"
  • Then proceed.

2. Verify branch

git branch --show-current

Confirm you are on the branch where the revert should happen. Reverting on the wrong branch is recoverable but messy.

3. Check remote state

git log --oneline origin/$(git branch --show-current)..HEAD 2>/dev/null

If this shows commits: you have local-only work. A git reset might be appropriate (see Decision Tree). If this shows nothing: all commits are pushed. Use git revert only.

If the remote tracking branch does not exist, treat all commits as local-only but confirm with the user.

4. Create backup tag

git tag pre-revert-$(date +%Y%m%d-%H%M%S)

This lightweight tag marks the current HEAD. If anything goes wrong, you can return here:

git reset --hard pre-revert-<timestamp>

5. Verify no in-progress operations

test -d .git/rebase-merge -o -d .git/rebase-apply && echo "REBASE IN PROGRESS"
test -f .git/MERGE_HEAD && echo "MERGE IN PROGRESS"
test -f .git/CHERRY_PICK_HEAD && echo "CHERRY-PICK IN PROGRESS"

If any operation is in progress: STOP. Complete or abort it first.

See reference/safety-checks.md for extended pre-flight validation (submodules, CI state, stash management).

Arguments

$ARGUMENTS

  • <track>: Track name or ID (optional -- if omitted, enter Guided Selection)
  • --phase <N>: Revert only phase N (optional)
  • --task <name>: Revert only a specific task (optional)
  • No scope flag: revert the entire track

Step-by-Step Workflow

Step 1: Parse Target Scope

Determine what to revert:

  • Track-level: No --phase or --task flag. Revert all commits in the track.
  • Phase-level: --phase N specified. Revert commits from phase N only.
  • Task-level: --task <name> specified. Revert a single task's commit(s).

If no <track> argument, proceed to Guided Selection:

  1. Read .maestro/tracks.md and recent git history: git log --oneline --since="7 days ago" --grep="maestro"
  2. Present a menu grouped by track: ID, description, status, completed task count
  3. If user provides a custom track ID, use that

Step 2: Locate Track

Match track argument against IDs and descriptions in .maestro/tracks.md. If not found: report and stop.

Read the track's plan.md and metadata.json to understand structure.

Step 3: Resolve Commit SHAs

Goal: Build the complete list of commits to revert for the target scope.

BR-enhanced path (if metadata.json has beads_epic_id):

br list --status closed --parent {epic_id} --all --json

Parse close_reason for SHAs (format: sha:{7char}). Scope by labels for --phase/--task.

Legacy path: Read plan.md, extract [x] {sha} markers from the appropriate scope:

  • Track: All [x] {sha} markers
  • Phase N: Only markers under ## Phase N
  • Task: Only the marker for the matching task

Plan-update commits (always check):

git log --oneline --all --grep="maestro(plan): mark task" -- .maestro/tracks/{track_id}/plan.md

Track creation commit (track-level revert only):

git log --oneline --all --grep="chore(maestro:new-track): add track {track_id}"

If no SHAs found in scope: report "No completed tasks found in the specified scope. Nothing to revert." and stop.

See reference/git-operations.md for the full SHA resolution protocol with edge cases.

Step 4: Git Reconciliation

For each SHA, verify it exists:

git cat-file -t {sha}

Missing SHA (rebased/squashed/force-pushed):

# Try to find replacement by commit message
git log --all --oneline --grep="{original commit message}"

If found: offer replacement. If not: skip and warn.

Merge commit detection:

git cat-file -p {sha}  # Check for multiple "parent" lines

If merge commit found, ask user: Proceed with -m 1, skip merge commits, or cancel.

Cherry-pick duplicate detection: Compare commit messages. For identical subjects, compare patches. Remove older duplicate from revert list.

See reference/git-operations.md for full reconciliation protocol and edge cases.

Step 5: Present Execution Plan

## Revert Plan

**Scope**: {track | phase N | task name}
**Track**: {track_description} ({track_id})

**Commits to revert** (reverse chronological order):
1. `{sha7}` -- {commit message}
2. `{sha7}` -- {commit message} [plan-update]
3. `{sha7}` -- {commit message} [track creation]

**Affected files**:
{list of files changed by these commits}

**Plan updates**:
- {task_name}: `[x] {sha}` --> `[ ]`

**Safety**: Backup tag created at `pre-revert-{timestamp}`

Step 6: Confirm

Confirmation 1 -- Target: "Revert {scope} of track '{description}'? This will undo {N} commits."

  • Yes, continue
  • Cancel

Confirmation 2 -- Final: "Ready to execute? This will create revert commits (original commits are preserved in history)."

  • Execute revert
  • Revise plan (exclude specific commits)
  • Cancel

See reference/confirmation-and-plan.md for the revision loop and summary format.

Step 7: Execute Reverts

Revert in reverse chronological order (newest first):

# Standard commits
git revert --no-edit {sha_newest}
git revert --no-edit {sha_next}
# ...continue for each SHA

# Merge commits (if user approved)
git revert --no-edit -m 1 {merge_sha}

CRITICAL: Validate each git revert succeeds before continuing to the next.

On conflict:

  1. Report: "Merge conflict during revert of {sha}."
  2. Show conflicting files: git diff --name-only --diff-filter=U
  3. Ask user:
    • Help me resolve -- Show conflict markers and guide resolution
    • Abort remaining -- Stop here (already-reverted commits stay)
    • Accept theirs -- Keep current version for conflicting files: git checkout --theirs {file} && git add {file}

After resolving: git revert --continue

Steps 8-10: Update Plan State, Registry, Verify

Plan state -- Edit plan.md: change [x] {sha} back to [ ] for each reverted task.

git add .maestro/tracks/{track_id}/plan.md
git commit -m "maestro(revert): update plan state for reverted {scope}"

BR mirror (if beads_epic_id exists):

br update {issue_id} --status open --json

Registry (track-level revert only): Update .maestro/tracks.md status from [x]/[~] to [ ]. Update metadata.json status to "new".

Verify:

CI=true {test_command}

Report pass/fail. If tests fail: warn user and offer to debug.

Step 11: Summary

## Revert Complete

**Scope**: {scope}
**Track**: {track_description}
**Commits reverted**: {count} ({impl} implementation, {plan} plan-update, 

---

*Content truncated.*

When not to use it

  • When commits contain secrets or credentials
  • When revert would create unresolvable conflicts
  • When work was never pushed and a local-only reset is simpler

Limitations

  • The skill does not handle history rewrites for secrets or credentials
  • The skill requires explicit user confirmation for destructive operations like git reset --hard
  • The skill relies on atomic commits from implementation for precise reverts

How it compares

This skill provides a Git-aware, safe method for undoing work by creating new revert commits and rolling back plan state, prioritizing history preservation over destructive resets.

Compared to similar skills

maestro:revert side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
maestro:revert (this skill)05moReviewAdvanced
resolve-conflicts818moReviewIntermediate
dependency-upgrade265moReviewIntermediate
openspec-onboard106moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry