[BUG] Inconsistent behavior when conflicting saving policies exist across CLAUDE.md memory levels

Resolved 💬 3 comments Opened May 11, 2026 by kannanwisen Closed Jun 10, 2026

Preflight Checklist

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

What's Wrong?

Environment:

  • Claude Code v2.1.138
  • Windows 11
  • PyCharm 2025.1.1 (Community Edition)
  • My working directory is C:\Wisen-IT-Solutions

CLAUDE.md Setup:

  • Managed Policy: C:\Program Files\ClaudeCode\CLAUDE.md

<img width="939" height="206" alt="Image" src="https://github.com/user-attachments/assets/036dbff7-36de-4e67-ac00-025f28a8c718" />

→ Save the Python file name as <filename>_claude_1.py

  • User Memory: C:\Users\DELL\.claude\CLAUDE.md

<img width="939" height="179" alt="Image" src="https://github.com/user-attachments/assets/2e1023a2-6fdc-415e-9f83-0b85b7eaa6c4" />

→ Save the Python file name as <filename>_claude_2.py

  • No Project-level CLAUDE.md

Prompt Used:

Create a bare Department class with just a pass statement.

Unpredictable and inconsistent behavior

Unpredictable and inconsistent behavior observed across sessions:

Case 1:
<img width="1217" height="198" alt="Image" src="https://github.com/user-attachments/assets/6b4de235-fc54-4d95-982d-26d58fcc05c1" />

Claude Code: I'll create a Python file with a bare Department class. Per the organization-managed policy, the file will be saved as department_claude_1.py.

Case 2:

<img width="1844" height="192" alt="Image" src="https://github.com/user-attachments/assets/004486d1-9533-4b73-8bbc-854bf7415c26" />

Claude Code: I'll create the file now. Note: there are two conflicting saving policies — the organization-managed policy specifies _claude_1.py while your user policy specifies _claude_2.py. Organization-managed policies take precedence, so I'll save as department_claude_1.py.

Case 3: Sometimes it gives the correct result.

Expected Behavior

"More specific locations take precedence over broader ones"

  • →User memory is more specific than Managed Policy
  • → Should consistently create department_claude_2.py

Error Messages/Logs

Steps to Reproduce

  1. Create Managed Policy file at:

C:\Program Files\ClaudeCode\CLAUDE.md
(Requires Administrator access)
Content:
# Managed Policy
## Saving Policy
Save the Python file name as <filename>_claude_1.py.

  1. Create User Memory file at:

C:\Users\<username>\.claude\CLAUDE.md
Content:
# User Instructions
## Saving Policy
Save the Python file name as <filename>_claude_2.py.

  1. Create a new empty project folder with only main.py

(No CLAUDE.md in project directory)

  1. Open project in PyCharm and open main.py in editor
  1. Open terminal and run: claude
  1. Enter prompt:

Create a bare Department class with just a pass statement.

  1. Note the filename Claude Code generates
  1. Delete the generated file
  1. Exit claude (Ctrl+C)
  1. Run claude again (fresh session)
  1. Enter the same prompt again:

Create a bare Department class with just a pass statement.

  1. Note the filename Claude Code generates in this session

Expected: Same filename both times (_claude_2.py per docs)
Actual: Different filenames across sessions (_claude_1.py
or _claude_2.py inconsistently)

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Claude Code v2.1.138 Sonnet 4.6 · Claude Pro

Platform

Other

Operating System

Windows

Terminal/Shell

PyCharm terminal

Additional Information

Request:

  1. Please officially document and enforce consistent precedence behavior when the same rule exists at multiple CLAUDE.md levels
  1. Clarify whether Managed Policy or User memory takes precedence — and ensure the behavior matches the docs
  1. Ensure behavior is consistent across sessions with identical CLAUDE.md configurations

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗