Agent Trash Guard
Install and verify Agent Trash Guard.
Block recognized permanent deletes from coding agents. Move a file to local trash, inspect its entry, and restore it by ID.
$ agent-trash --version
$ agent-trash listPrerequisites and installation
Use Python 3 and bash. Choose one released host adapter below. Do not install both the portable Claude plugin and the legacy Claude-only adapter: that can report each blocked command twice.
$ claude plugin marketplace add hermes-labs-ai/agent-trash-guard && claude plugin install agent-trash-guard@hermes-labs
$ codex plugin marketplace add hermes-labs-ai/agent-trash-guard && codex plugin add agent-trash-guard@hermes-labs
Run it through Codex's Bash tool after the explicit /hooks trust review.
$ gemini extensions install https://github.com/hermes-labs-ai/agent-trash-guard --ref main
Restart Gemini CLI, then use its run_shell_command tool.
For a checkout you want to inspect first, clone https://github.com/hermes-labs-ai/agent-trash-guard, run ./tests/run.sh, and use the host's local-plugin workflow documented in the repository README.
First safe check
This walkthrough is for the released Claude Code plugin, which exposes agent-trash on Claude's Bash-tool PATH. It does not promise a globally installed command in an unrelated terminal. For Codex or Gemini CLI, use the exact quoted path printed when the guard blocks a delete, or run python3 <plugin-or-extension-root>/bin/agent-trash.
$ scratch_dir=$(mktemp -d); printf 'recover me\\n' > "$scratch_dir/recover-me.txt"; printf '%s\\n' "$scratch_dir/recover-me.txt"
Copy the printed absolute path as FILE_PATH. Run each remaining step as a separate Claude Bash-tool call.
$ rm "FILE_PATH"
The hook blocks rm; the file remains at FILE_PATH.
$ agent-trash put "FILE_PATH" $ agent-trash list
list shows a timestamped entry and the original path. Copy its identifier as ENTRY_ID.
$ agent-trash restore <ENTRY_ID> $ cat "FILE_PATH"
Replace both placeholders with the copied values. The final command prints recover me.
agent-trash --version is useful for diagnosing an install, and agent-trash list is read-only. In Codex, trust the hook through /hooks before using delete interception.
Recover, retain, and update
Use agent-trash put path to create a timestamped entry, agent-trash list to inspect entries, and agent-trash restore ENTRY to restore one. Restore refuses to overwrite a newer file unless --force is explicitly supplied.
Set AGENT_TRASH_DIR to relocate the local trash. agent-trash empty --older-than 7 --yes is a permanent delete. agent-trash gc reports by default; it only collects with --collect and keeps protected, unknown, reachable, and too-young work. Update through your host's plugin or extension command, then repeat the checks above.
Troubleshooting and limits
If the CLI is missing, repeat the host readback in the repository README and restart the host where its documentation requires it. If a delete was not blocked, check that the host adapter is installed and trusted, then compare the command against the documented supported patterns.
The guard fails open on unparseable hook events and excludes overwrites, truncations, cloud/API deletion, and unsupported command forms. Read the supported-command boundary, v0.1.3 release, and MIT license.