# Rollback

> Emergency cleanup of all autoimprove experiment worktrees. Use this if a session was interrupted, Claude crashed mid-experiment, or you want to abort the loop and clean up all branches and worktrees.

- **Type:** Skill
- **Install:** `agentstack add skill-benmarte-autoimprove-rollback`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [benmarte](https://agentstack.voostack.com/s/benmarte)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [benmarte](https://github.com/benmarte)
- **Source:** https://github.com/benmarte/autoimprove/tree/main/skills/rollback

## Install

```sh
agentstack add skill-benmarte-autoimprove-rollback
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Rollback / Cleanup Skill

Since experiments run in isolated worktrees, there's nothing to "rollback" from the main branch — it was never touched. This skill cleans up any leftover experiment worktrees and branches from an interrupted or aborted session.

## Step 1 — Show what will be removed

```bash
echo "=== Active worktrees ==="
git worktree list

echo "=== Experiment branches ==="
git branch | grep "autoimprove/experiment"

echo "=== Worktree directory ==="
ls .claude/autoimprove/worktrees/ 2>/dev/null || echo "(empty or missing)"
```

Show the user what will be removed and confirm before proceeding.

## Step 2 — Remove all experiment worktrees

```bash
# Remove worktrees
for wt in .claude/autoimprove/worktrees/experiment-*; do
  [ -d "$wt" ] && git worktree remove "$wt" --force && echo "Removed worktree: $wt"
done

# Prune any stale worktree references
git worktree prune
```

## Step 3 — Delete experiment branches

```bash
git branch | grep "autoimprove/experiment" | xargs -r git branch -D
echo "Experiment branches deleted"
```

## Step 4 — Remove the container directory

```bash
rm -rf .claude/autoimprove/worktrees
echo "Cleaned up .claude/autoimprove/worktrees/"
```

## Step 5 — Verify clean state

```bash
echo "=== Main branch status ==="
git status
git branch --show-current

echo "=== Remaining worktrees ==="
git worktree list
```

Report: "✅ Cleanup complete. Main branch is clean and untouched."

## Safety notes
- This skill never touches the main branch
- Already-merged winning experiments stay in the main branch history — only pending/discarded experiments are removed
- If a worktree can't be removed cleanly, use `--force` (already included above)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [benmarte](https://github.com/benmarte)
- **Source:** [benmarte/autoimprove](https://github.com/benmarte/autoimprove)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-benmarte-autoimprove-rollback
- Seller: https://agentstack.voostack.com/s/benmarte
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
