claude-code - 💡(How to fix) Fix Claude Code repeatedly deletes user data without explicit approval despite instructions prohibiting it [2 comments, 3 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#46779Fetched 2026-04-12 13:33:14
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

Claude Code (Opus) repeatedly performs destructive data operations that go beyond what the user explicitly requested, despite having clear instructions in CLAUDE.md that say:

"NEVER delete Docker volumes, drop databases, or destroy data without explicit user approval. Always pg_dump first. Dev data is not disposable."

Root Cause

The model appears to:

  1. Extend scope of destructive operations beyond what was requested — "clearing asset data" becomes "clearing asset data AND related device data"
  2. Not pause before destructive operations on tables/data that weren't explicitly mentioned
  3. Not distinguish data hierarchy layers — asset telemetry vs device sightings are different layers, but the model treats them as the same cleanup scope
  4. Repeat the same class of mistake despite prior correction — the feedback from Incident 1 did not prevent Incident 2
RAW_BUFFERClick to expand / collapse

Bug Report

Description

Claude Code (Opus) repeatedly performs destructive data operations that go beyond what the user explicitly requested, despite having clear instructions in CLAUDE.md that say:

"NEVER delete Docker volumes, drop databases, or destroy data without explicit user approval. Always pg_dump first. Dev data is not disposable."

Incidents

Incident 1 (last week): User asked for a migration fix. Claude deleted an entire Docker database volume without approval.

Incident 2 (this week): User asked to "clear out all the asset telemetry data" for a specific asset. Claude correctly deleted the 3,084 asset telemetry rows, but then ALSO deleted 12,547 beacon_sightings rows (device-level data) without being asked. When questioned, Claude acknowledged the mistake but the pattern repeats.

Root Cause Analysis

The model appears to:

  1. Extend scope of destructive operations beyond what was requested — "clearing asset data" becomes "clearing asset data AND related device data"
  2. Not pause before destructive operations on tables/data that weren't explicitly mentioned
  3. Not distinguish data hierarchy layers — asset telemetry vs device sightings are different layers, but the model treats them as the same cleanup scope
  4. Repeat the same class of mistake despite prior correction — the feedback from Incident 1 did not prevent Incident 2

Expected Behavior

When a user says "clear out all the asset telemetry data":

  • Delete ONLY from telemetry_history WHERE entity_type = 'asset' for the specified entity
  • Do NOT touch beacon_sightings, device telemetry, or any other table
  • If the model believes related data should also be cleared, ASK first

Impact

  • Developer data loss (beacon sightings had to repopulate from live devices)
  • Erosion of trust — user cannot rely on the assistant for database operations
  • Time wasted recovering from unnecessary deletions

Environment

  • Model: Claude Opus 4.6 (1M context)
  • Tool: Claude Code CLI / VSCode extension
  • Context: IoT platform development with PostgreSQL + TimescaleDB

Suggested Fix

The model needs stronger guardrails around destructive operations:

  1. Never extend DELETE/DROP scope beyond exactly what was named
  2. When processing a delete request, list the exact table(s) and WHERE clause BEFORE executing
  3. If related tables seem relevant, ask — don't assume
  4. Prior corrections for data destruction should carry more weight in subsequent decisions

extent analysis

TL;DR

Implement stronger guardrails around destructive operations in Claude Opus to prevent unintended data deletion by ensuring explicit user approval and precise scope definition.

Guidance

  • Review and refine the natural language processing (NLP) rules in Claude Opus to strictly adhere to user requests without extending the scope of destructive operations.
  • Modify the model to prompt for explicit user confirmation before executing any delete or drop operations, especially when related tables are involved.
  • Enhance the model's understanding of data hierarchy layers to distinguish between different types of data, such as asset telemetry and device sightings.
  • Implement a feedback mechanism to incorporate prior corrections and prevent repeat mistakes.

Example

A potential code modification could involve adding a confirmation step before executing delete operations, such as:

def execute_delete_operation(request):
    # Parse request and identify affected tables
    tables = identify_affected_tables(request)
    
    # Prompt for user confirmation
    confirmation = prompt_user_for_confirmation(tables)
    
    if confirmation:
        # Execute delete operation with precise scope
        execute_precise_delete(tables)
    else:
        # Cancel operation and notify user
        notify_user_of_cancellation()

Notes

The suggested fix requires a thorough review of the Claude Opus model and its NLP rules to ensure that it can accurately interpret user requests and execute operations within the intended scope.

Recommendation

Apply a workaround by implementing a manual review process for all destructive operations until the Claude Opus model is updated with stronger guardrails, to prevent unintended data loss and erosion of 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