# safe-swap

Rewrites destructive shell commands into safe twins before they run instead of snapshotting afterwards: git push --force becomes --force-with-lease --force-if-includes.

- Type: Plugin
- Version: 1.0.0
- Updated: 22 Nov 2026
- Publisher: itsolaph
- Category: Tools

[Contact us](https://www.ulpi.io/en/support#contact)

## What it does

Rewrites destructive shell commands into safe twins before they run instead of snapshotting afterwards: git push --force becomes --force-with-lease --force-if-includes, rm -r becomes a move into a quarantine folder (with a file and byte count), and git reset --hard, git checkout -- / git restore, git clean and git stash drop take a private snapshot first, with /swaps and /unswap to undo and a visible note whenever a destructive command was left unswapped. Disclosure - rewrites the command of the terminal tool before it executes (modify only: never blocks, never prompts, any error or doubt leaves the command unchanged); writes quarantine files and receipts under the user's home on the machine where the command runs (\~/.safe-swap/trash by default) plus one SQLite file in the plugin data directory; for git clean, git reset --hard and git stash drop it writes snapshot commits into the repository's own object store under private refs refs/safe-swap/\<id\> (a git clean snapshot copies the content of the untracked files, and of the ignored ones with -x, until a purge; sets above 20,000 files or 200 MB are skipped and reported); it prints one marker line to stderr for an rm swap and removes it again from the tool result; the only deletion it ever performs is an explicit /swaps purge (or ulpi safe-swap purge) by the user, which runs rm on its own quarantine directories and deletes its own private refs through the terminal tool and is subject to normal approval; no network calls, no telemetry, no background processes, no self-update; reads no credential files or.env, only the receipts it wrote and the sizes of the files an rm swap moves; approvals are respected: the rewritten command goes through Ulpi's normal approval gate, and because a swapped rm -r is a move it no longer matches the recursive-delete pattern and does not prompt (the git rewrites keep prompting as before).

Targets such as /, \~, $HOME, system directories and anything in the system temp directory, privilege

## Review notes

What an owner reads and accepts before the install is approved.

- Ulpi has not reviewed this version: it is listed in the public plugin catalog, and the install still fetches it at its pinned commit, checks its shape and scans it before you approve

## More in Tools

- [SafeGuard](https://www.ulpi.io/en/marketplace/plugins/safeguard): Deterministic security middleware, EVM simulation guard, and prompt injection defense for on-chain agent actions.
- [Sai by Simular](https://www.ulpi.io/en/marketplace/plugins/sai-by-simular): Give Ulpi a computer: hand tasks that need a screen (web apps behind a login, admin consoles, desktop software, forms with no import) to Sai.
- [Salesforce Guard](https://www.ulpi.io/en/marketplace/plugins/salesforce-guard): Salesforce release-impact and scoped-access review: explicit-scope snapshot comparison, source-reference maps, local access evidence and HTML reports.

[All listings →](https://www.ulpi.io/en/marketplace) · [Publisher's guide →](https://www.ulpi.io/en/docs) · [Report a problem →](https://www.ulpi.io/en/security#report)
