feat: stop prompting on deletion of agent-generated files - #12
Closed
bertini36 wants to merge 1 commit into
Closed
Conversation
The blanket `Bash(rm *)` ask rule prompted on every deletion, including the scratch scripts and test fixtures the agent had just created itself. Permission rules cannot see file provenance, and `ask` outranks `allow`, so an allowlist alone could never silence it. Narrow the ask rule to recursive deletes, allowlist the scratchpad and temp directories outright, and let the auto mode classifier judge the rest: a new allow rule green-lights agent-generated files, while a new soft_deny keeps untracked user files and tracked files prompting. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hsypi4fmvtYK8PZUJgVRFo
bertini36
marked this pull request as ready for review
August 5, 2026 11:24
There was a problem hiding this comment.
Pull request overview
Updates Claude Code permission rules to reduce friction when deleting assistant-generated artifacts, while keeping prompts/denies for higher-risk operations.
Changes:
- Narrowed the blanket
Bash(rm *)ask rule to recursive deletes only (rm -r,rm -rf,rm -fr). - Added explicit allow rules for deletions under
/tmpand/private/tmp. - Added auto-mode guidance to allow deleting assistant-created files, while soft-denying deletion of non-session-created and tracked files.
Suppressed comments (1)
.claude/settings.json:34
- The temp-dir allowlist doesn’t cover
rm -f /private/tmp/**. Without this,rm -fin/private/tmpwon’t be outright allowed and will fall through to auto-mode classification.
"Bash(rm /private/tmp/**)",
"Bash(rm -r /private/tmp/**)",
"Bash(rm -rf /private/tmp/**)"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+29
to
+31
| "Bash(rm /tmp/**)", | ||
| "Bash(rm -r /tmp/**)", | ||
| "Bash(rm -rf /tmp/**)", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The blanket
Bash(rm *)ask rule prompted on every deletion, including the scratch scripts, temp fixtures, and test artifacts the agent had created moments earlier. Confirming a file you just watched the agent write is friction with no safety value.The fix has to work around two constraints. Permission rules cannot see file provenance, so no pattern can express "a file the agent generated". And
askoutranksallowin rule precedence, so adding an allowlist whileBash(rm *)stays inaskchanges nothing.Highlights:
askrule narrows from allrmto recursive deletes only (rm -r,rm -rf,rm -fr), which stay worth a prompt regardless of who created the target./tmp,/private/tmp) are allowlisted outright, so the common case never reaches the classifier.defaultModeis alreadyauto. A newautoMode.allowrule green-lights agent-generated files; a newsoft_denyrule keeps user-authored and tracked files prompting, so the loosening does not spill past its intent.The catastrophic
denyrules (rm -rf /,rm -rf ~,sudo rm *) are untouched.Type of Change
Test Procedure
jqparses the file and returns the three modified arrays with the expected contents. The change is declarative configuration with no runtime code path to exercise beyond that.What could break:
rmon a project file no longer hard-prompts, it goes to the classifier instead. If the classifier proves too permissive in practice, thesoft_denywording is the knob to tighten.Post-deploy steps
/hooksor restart the session to pick up the change. Nothing else is required; the repo is symlinked into~/.claude, so no copy step.