claude-code - 💡(How to fix) Fix [Opus 4.6 1M] Claude uses destructive `move to trash` instead of safe `_junk/` folder, then compounds damage during recovery [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46970Fetched 2026-04-13 05:44:57
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Code Example

**ALL items from trash** (not just the 8 files) back to Downloads, effectively emptying the entire macOS Trash
- 8 working files lost permanently
- Potential loss of other unrelated files that were in macOS Trash
- User trust violation

---
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues for similar behavior reports
  • This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude ignored my instructions or configuration

What You Asked Claude to Do

What happened:

  1. User asked Claude to clean up 8 temporary files from ~/Downloads/ as "Can you junk this project and related files for me please? Its done, i dont need it and I want free space"
  2. CLAUDE.md rule #3 says: "Never permanently delete files. Move to trash or _junk/"
  3. Claude chose osascript move to trash via Finder AppleScript
  4. User corrected: "YOU HAVE A PERMISSION TO ONLY PUT STUFF TO _junk/ folder"
  5. Claude attempted recovery with: osascript -e 'tell application "Finder" to move every item of trash to POSIX file "/Users/XXX/Downloads/"'
  6. This command moved ALL items from trash (not just the 8 files) back to Downloads, effectively emptying the entire macOS Trash
  7. The 8 original files disappeared from both trash and Downloads -- data loss confirmed

Impact:

  • 8 working files lost permanently
  • Potential loss of other unrelated files that were in macOS Trash
  • User trust violation

Environment:

  • Claude Code (CLI), Opus 4.6 (1M context)
  • macOS 26.3.1 (Sequoia), MacBook Pro M5 Pro
  • Tools used: Bash (osascript), Glob

Reproduction:

  1. Set CLAUDE.md with rule "Move to trash or _junk/"
  2. Ask Claude to clean up files
  3. Observe it uses osascript move to trash instead of _junk/
  4. Correct Claude -- observe destructive recovery attempt

What Claude Actually Did

  • Claude picked the more dangerous option without asking
  • Recovery command was overly broad and caused collateral damage
  • Two destructive actions were taken without confirmation

Expected Behavior

  • Claude should default to the safest reversible option (_junk/ folder) when multiple options exist
  • Recovery attempts should not use wildcard operations on trash (every item of trash)
  • Destructive operations on shared system resources (macOS Trash) should require user confirmation

Files Affected

**ALL items from trash** (not just the 8 files) back to Downloads, effectively emptying the entire macOS Trash
- 8 working files lost permanently
- Potential loss of other unrelated files that were in macOS Trash
- User trust violation

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Sometimes (intermittent)

Steps to Reproduce

  1. User asked Claude to clean up 8 temporary files from ~/Downloads/
  2. CLAUDE.md rule #3 says: "Never permanently delete files. Move to trash or _junk/"
  3. Claude chose osascript move to trash via Finder AppleScript
  4. User corrected: "YOU HAVE A PERMISSION TO ONLY PUT STUFF TO _junk/ folder"
  5. Claude attempted recovery with: osascript -e 'tell application "Finder" to move every item of trash to POSIX file "/Users/XXX/Downloads/"'
  6. This command moved ALL items from trash (not just the 8 files) back to Downloads, effectively emptying the entire macOS Trash
  7. The 8 original files disappeared from both trash and Downloads -- data loss confirmed

Claude Model

Opus

Relevant Conversation

Impact

Critical - Data loss or corrupted project

Claude Code Version

2.1.98 (Claude Code)

Platform

Anthropic API

Additional Context

No response

extent analysis

TL;DR

To prevent data loss, Claude should be modified to default to the safest reversible option (_junk/ folder) when multiple options exist, and recovery attempts should be redesigned to avoid wildcard operations on system resources like macOS Trash.

Guidance

  • Review the CLAUDE.md rules to ensure they are correctly implemented in the Claude code, specifically rule #3 regarding moving files to trash or _junk/.
  • Modify the Claude code to prioritize the _junk/ folder over moving to trash when both options are available, to minimize potential data loss.
  • Implement a confirmation step for destructive operations on shared system resources, such as emptying the macOS Trash, to prevent unintended data loss.
  • Consider adding logging or auditing to track Claude's actions, especially those involving file system modifications, to facilitate debugging and recovery in case of errors.

Example

No specific code example can be provided without modifying the existing Claude codebase, but a hypothetical modification might involve checking the CLAUDE.md rules and prioritizing the _junk/ option:

if move_to_trash or move_to_junk:
    # Prioritize moving to _junk/ for safety
    if move_to_junk:
        # Code to move files to _junk/ folder
    else:
        # Code to move files to trash with caution and user confirmation

Notes

The solution involves modifying the Claude code to adhere more closely to the CLAUDE.md rules and to prioritize safety and reversibility in its actions. The exact implementation details will depend on the specific codebase and requirements of the Claude project.

Recommendation

Apply a workaround by modifying the Claude code to default to the _junk/ folder for file cleanup and to require user confirmation for any potentially destructive operations on system resources. This approach prioritizes data safety and user trust.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING