claude-code - 💡(How to fix) Fix [Feature request] Local Claude Code logs allow state reset via manual deletion [1 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#51646Fetched 2026-04-22 07:56:42
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
labeled ×4renamed ×1unlabeled ×1

Error Message

Error Messages/Logs

Root Cause

  • Separate logging data from critical state data
  • Add integrity checks (e.g., hashing or validation)
  • Prevent unintended resets caused by local file manipulation
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Claude Code stores internal logs and state-related data locally on the user's machine in a way that allows users to manually delete or modify them.

This enables unintended resetting of internal state (such as sessions, usage limits, or memory), which may bypass expected safeguards.

Issues Observed

  • Users can bypass expected persistence mechanisms by deleting or modifying local files.
  • Local storage appears to influence application state beyond just logging.

Potential Impact

  • Bypassing usage limits
  • Resetting session tracking
  • Breaking memory/state consistency
  • Security and integrity concerns for local state management

Concern

Critical state appears to be stored in locations that are easily accessible and modifiable by the user, which may not be intended for enforcing application-level constraints.

This behavior could lead to inconsistencies and potential misuse if not properly handled.

What Should Happen?

Expected Behavior

  • Logs should be strictly non-critical and should not affect application state.

  • Critical state (sessions, limits, memory) should not be resettable via manual file deletion.

  • The system should detect tampering with local files and handle it safely.

  • Important state should either:

    • be stored securely, or
    • be validated against a trusted source (e.g., backend or integrity checks)

Suggested Improvements

  • Separate logging data from critical state data
  • Add integrity checks (e.g., hashing or validation)
  • Prevent unintended resets caused by local file manipulation

Error Messages/Logs

Steps to Reproduce

  1. Install and launch Claude Code (latest version).

  2. Start a normal session:

    • Interact with the system to generate state (e.g., prompts, usage tracking).
  3. Locate local storage directory:

    • Windows: %APPDATA%/ClaudeCode/
    • Linux: ~/.config/claude-code/
    • macOS: ~/Library/Application Support/ClaudeCode/
  4. Navigate to stored files:

    • Identify files such as:
      • session.json
      • usage.json
      • logs/
      • memory/state-related files
  5. Modify or delete state files:

    • Example:
      • Open JSON files and reset values (e.g., usage counters → 0)
      • OR delete session-related files entirely
  6. Restart Claude Code:

    • Close the application fully
    • Relaunch it
  7. Observe behavior:

    • Session resets OR
    • Usage limits are bypassed OR
    • Memory/state inconsistencies occur

Claude Model

Other

Is this a regression?

Yes, this worked in a previous version

2.1.116

No response

Claude Code Version

2.1.116

Platform

Other

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response

extent analysis

TL;DR

Separating logging data from critical state data and implementing integrity checks can help prevent unintended resetting of internal state in Claude Code.

Guidance

  • Review the current storage mechanism to identify where critical state data (e.g., sessions, usage limits, memory) is stored and ensure it is not accessible for manual modification by users.
  • Consider implementing a secure storage solution for critical state data, such as encryption or a secure token-based system.
  • Add integrity checks, like hashing or digital signatures, to detect tampering with local files and handle it safely to prevent bypassing of expected safeguards.
  • Validate critical state data against a trusted source, such as a backend server, to ensure consistency and prevent misuse.

Example

No specific code example can be provided without knowing the exact implementation details of Claude Code's storage mechanism. However, a general approach could involve storing critical state data in a secure, encrypted file or using a secure token-based system to validate user sessions and usage limits.

Notes

The provided information suggests that this is a regression issue, as it worked in a previous version. Therefore, reviewing the changes made between versions might help identify the root cause of the problem.

Recommendation

Apply a workaround by separating logging data from critical state data and implementing integrity checks to prevent unintended resetting of internal state until a permanent fix is available. This approach can help mitigate the security and integrity concerns associated with local state management in Claude Code.

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

claude-code - 💡(How to fix) Fix [Feature request] Local Claude Code logs allow state reset via manual deletion [1 participants]