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-4821orTRASH-4821. - Do not execute until the user's reply includes the exact confirmation code.
- Do not use
rmfor 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/tmpand 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
- Identify candidate files.
- Present the target set to the user in concise form.
- Ask the user to choose either permanent deletion or move to trash.
- Generate and show a confirmation code that must be typed back exactly.
- Execute only after the user's reply includes the exact code.
- If the chosen mode is trash, create the trash destination under
/scratch/gguo/trash/<project-name>/<timestamp>/and move files with directory structure preserved. - If the chosen mode is permanent deletion, confirm the exact target set once more in the execution message and then delete it.
- 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
miscas the project name. - Keep filenames unchanged.
Examples
- Deleting stale evaluation outputs from
/home/gguo/code/eyeshould 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-4821orDEL-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.