# Scratch Trash Guard

> Guard deletion and cleanup requests with a mandatory choice between permanent deletion and moving to /scratch/gguo/trash, plus a required user-entered confirmation code before execution. Use when the user asks to delete, remove, clean up, purge, discard, or archive files/directories, or when a task would normally use rm or otherwise destroy files.

- Skill: `kwongfuk/scratch-trash-guard` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kwongfuk/scratch-trash-guard`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kwongfuk/scratch-trash-guard/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: KwongFuk (https://skillmd.com/u/kwongfuk)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/kwongfuk/scratch-trash-guard

---


# Scratch Trash Guard

Never execute a deletion or trash move immediately. Every destructive or quasi-destructive action requires an explicit mode choice and a confirmation code from the user.

## Rules

- Before doing anything, identify the candidate files and present the target set concisely.
- Always ask the user to choose one mode for the target set:
  - permanent deletion
  - move to `/scratch/gguo/trash`
- After the user chooses the mode, require the user to type a confirmation code before executing.
- Generate a short confirmation code tied to the action, for example `DEL-4821` or `TRASH-4821`.
- Do not execute until the user's reply includes the exact confirmation code.
- Do not use `rm` for user/project files unless the user chose permanent deletion and supplied the exact confirmation code.
- If the user chose trash, move files into `/scratch/gguo/trash`, not `/tmp` and not a project-local trash folder.
- Preserve relative paths under a dated subdirectory:
  - `/scratch/gguo/trash/<project-name>/<YYYYMMDD_HHMMSS>/...`
- If a file is already inside `/scratch/gguo/trash`, leave it there unless the user asks for another action.
- If the request is ambiguous, prefer moving only the clearly targeted files and report anything uncertain.
- If the target set changes after confirmation, discard the old code and require a new mode choice and a new confirmation code.

## Workflow

1. Identify candidate files.
2. Present the target set to the user in concise form.
3. Ask the user to choose either permanent deletion or move to trash.
4. Generate and show a confirmation code that must be typed back exactly.
5. Execute only after the user's reply includes the exact code.
6. If the chosen mode is trash, create the trash destination under `/scratch/gguo/trash/<project-name>/<timestamp>/` and move files with directory structure preserved.
7. If the chosen mode is permanent deletion, confirm the exact target set once more in the execution message and then delete it.
8. Report the final outcome, including the trash path for moved items or a concise list of permanently deleted items.

## Path Rules

- Derive `<project-name>` from the repository or working directory name when reasonable.
- For single loose files outside a repo, use `misc` as the project name.
- Keep filenames unchanged.

## Examples

- Deleting stale evaluation outputs from `/home/gguo/code/eye` should become a move into:
  - `/scratch/gguo/trash/eye/<timestamp>/evaluation/results/...`
- Deleting one temporary manifest should become a move into:
  - `/scratch/gguo/trash/eye/<timestamp>/tmp/...`
- Before either action, ask for the mode and require a typed code such as `TRASH-4821` or `DEL-4821`.

## Permanent Deletion Exception

Only permanently delete when the user explicitly chooses permanent deletion for the presented target set and then types the exact confirmation code. A plain "yes", "ok", or "confirm" is not enough.

