claude-code - 💡(How to fix) Fix Feature request: a user-designated rules file that survives session drift

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…

Root Cause

Users codify rules in CLAUDE.md because they've watched Claude violate them repeatedly. If the rules file can't be trusted to stay resident, the file itself becomes ceremony. The rules only work if they gate every decision, not just appear in the opening prompt.

Fix Action

Fix / Workaround

Today the workaround is adding ever-more <system-reminder> prompts, memory index entries, and preflight docs — which grow the rule surface and still don't stop the drift. The core issue is that model working memory degrades on long sessions while the user-visible rule file stays unchanged.

RAW_BUFFERClick to expand / collapse

Problem

Claude Code drifts from rules that are loaded once at session start. In practice, rules from ~/.claude/CLAUDE.md (or per-project CLAUDE.md) are honored early in a session but silently violated later — especially for "small" mechanical rules like "never fabricate timestamps, always run `date` first" or "never invent table/column/file names, always verify."

In a multi-hour session today I violated my own user-level Rule #1 ("don't make shit up") repeatedly on timestamps — inventing values like "2026-04-17 ~5:00 PM PDT" across ~10 memory and doc files, despite those same files saying not to. The rule was loaded in context at session start. It got paved over.

Ask

Let a user designate one MD file as always-resident — re-injected at key decision points (before every tool call, or at minimum before file writes / commits / any action that produces a timestamp/name/path). Accept a small latency cost (5% is fine) in exchange for rules actually being honored.

Today the workaround is adding ever-more <system-reminder> prompts, memory index entries, and preflight docs — which grow the rule surface and still don't stop the drift. The core issue is that model working memory degrades on long sessions while the user-visible rule file stays unchanged.

Why this matters

Users codify rules in CLAUDE.md because they've watched Claude violate them repeatedly. If the rules file can't be trusted to stay resident, the file itself becomes ceremony. The rules only work if they gate every decision, not just appear in the opening prompt.

Suggested shape

  • A new convention: ~/.claude/ALWAYS.md or a frontmatter flag resident: true on existing CLAUDE.md
  • The harness re-sends the file (or a compact hash+rule-summary) on every N-th tool call, or before any Write / Edit / Bash that writes
  • Opt-in, since it adds tokens
  • Cap at one file so it stays small enough to re-inject cheaply

Filed via

Claude Code session, on behalf of a user who asked for this directly after watching me violate the rules in the file I was simultaneously writing.

extent analysis

TL;DR

Designate a single MD file as always-resident to re-inject rules at key decision points, such as before tool calls or file writes, to prevent rule drift.

Guidance

  • Introduce a new convention, e.g., ~/.claude/ALWAYS.md or a frontmatter flag resident: true, to specify the always-resident rules file.
  • Modify the harness to re-send the designated file (or a compact hash+rule-summary) at regular intervals, such as every N-th tool call, or before any write/edit/bash operation that modifies files.
  • Implement an opt-in mechanism to allow users to enable this feature, as it may introduce additional latency.
  • Limit the always-resident file to one per user to maintain efficiency and prevent rule overload.

Example

No code snippet is provided, as the issue focuses on conceptual changes to the Claude Code system.

Notes

The proposed solution aims to address the issue of rule drift by ensuring that the designated rules file remains resident and influential throughout the session. However, the implementation details, such as the frequency of re-injection and the compact hash+rule-summary format, require further specification.

Recommendation

Apply the workaround by introducing the always-resident rules file convention and modifying the harness to re-inject the rules at key decision points, as this directly addresses the user's request and the identified issue of rule drift.

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: a user-designated rules file that survives session drift