# Undo

> Restore TokenWise config backups. Lists all .tokenwise-backup-* files found, lets the user pick one to restore in place. Use when the user wants to roll back TokenWise's changes to CLAUDE.md or settings.json, or runs /tokenwise:undo.

- **Type:** Skill
- **Install:** `agentstack add skill-codeshux-tokenwise-undo`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [CodeShuX](https://agentstack.voostack.com/s/codeshux)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [CodeShuX](https://github.com/CodeShuX)
- **Source:** https://github.com/CodeShuX/tokenwise/tree/main/skills/undo

## Install

```sh
agentstack add skill-codeshux-tokenwise-undo
```

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

## About

# /tokenwise:undo — Restore from backup

Find TokenWise backups and restore one.

## Steps

1. **Find backups** with Bash:
   ```bash
   find ~/.claude -maxdepth 3 -name "*.tokenwise-backup-*" 2>/dev/null
   find . -maxdepth 3 -name "*.tokenwise-backup-*" 2>/dev/null
   ```

2. **If none found:**
   ```
   No TokenWise backups found.

   Backups are created automatically by /tokenwise:install before any file modification.
   If you've never run /tokenwise:install, there's nothing to undo.

   If you removed the backups manually, you'll need to restore from version control or recreate config by hand.
   ```

3. **If found, print a numbered list:**
   ```
   TokenWise backups found:

     1. ~/.claude/CLAUDE.md.tokenwise-backup-20260511-143218
        (target: ~/.claude/CLAUDE.md, created )
     2. ~/.claude/settings.json.tokenwise-backup-20260511-143219
        (target: ~/.claude/settings.json, created )

   Restore which? (1-N, or 'all', or 'cancel'):
   ```

4. **Parse user response:**
   - Single number → restore that one
   - `all` → restore all backups
   - `cancel` (or empty) → exit with `No changes made.`

5. **For each backup to restore:**
   - Derive target path: strip the `.tokenwise-backup-` suffix
   - Confirm: `Restore  from ? This will overwrite . [Y/n]`
   - If Y:
     - Read current target file (if exists), back it up to `.tokenwise-pre-undo-` (so undo is reversible)
     - Copy backup over target: `cp  `
     - Verify by reading target — confirm content matches backup
   - If n: skip

6. **Optionally delete the consumed backup:**
   `Delete the backup file  now that it has been restored? [Y/n]`

7. **Print summary:**
   ```
   Undo complete.

   Restored:
     

   Pre-undo backups (in case you want to redo):
     
   ```

8. **Remind user:** "Restart Claude Code so the original CLAUDE.md / settings.json take effect."

## Edge cases

- **Multiple backups for the same target file:** the user should pick which one. Print them sorted by timestamp descending (newest first).
- **Backup file is empty:** warn before restoring (`Backup is empty. Restoring will leave  empty. Continue?`).
- **Target file no longer exists:** that's fine — restore creates it.

## Tools

Read, Write, Bash.

## Source & license

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

- **Author:** [CodeShuX](https://github.com/CodeShuX)
- **Source:** [CodeShuX/tokenwise](https://github.com/CodeShuX/tokenwise)
- **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-codeshux-tokenwise-undo
- Seller: https://agentstack.voostack.com/s/codeshux
- 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%.
