From 209fac0452891dc21530dc87a063a44bad37cf6b Mon Sep 17 00:00:00 2001 From: hugocasa Date: Wed, 12 Aug 2026 19:21:54 +0200 Subject: [PATCH] docs(agents): state why a routine cleanup prompts, and where scratch goes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The guard hook already auto-allows a plain rm whose operands are under /tmp or inside a git checkout in $HOME, so deleting a temp dir or a stale .sqlx entry costs nothing. What prompts is the command shape: the hook's tokenizer defers on &&, ;, redirects, quotes and $VAR, so a chained cleanup falls through to the Bash(rm:*) ask rule. That was recorded only inside a paragraph about screenshot file paths in frontend/CLAUDE.md, where nobody looking for it would find it. Stated in Core Principles instead, alongside the rule that scratch belongs outside the tree — for the reason that actually applies, which is not committing junk rather than avoiding prompts. Co-Authored-By: Claude Opus 5 (1M context) --- AGENTS.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8f25df2ed6..67416006f0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -143,9 +143,11 @@ $NAV --root backend callees "X" # what does X call? - **MUST `outline` before `Read`** on unfamiliar files — then `body` or `Read` with offset/limit for specifics - **Scratch stays outside the checkout.** Temp scripts, data dumps, cache backups and - screenshots go in the session scratch directory or `/tmp`, never in the repo — a temp file - in the tree has to be deleted again, and `rm` asks every time. When deletions are genuinely - needed, do them together as one `rm` at the end rather than one call each. + screenshots go in the session scratch directory or `/tmp`, so nothing temporary can end up + committed. Write `rm`/`mv`/`cp` as one plain unchained command: a PreToolUse hook + auto-allows those when every operand is under `/tmp` or inside this checkout, but it defers + on `&&`, `;`, redirects, quotes and `$VAR` — that deferral, not the delete itself, is what + turns a routine cleanup into a permission prompt. - Search for existing code to reuse before writing new code - Follow established patterns in the codebase - Keep changes focused — don't refactor beyond what's asked