[BUG] claude-opus-4-7[1m] drifts from auto-loaded CLAUDE.md and memory notes across long sessions

Resolved 💬 2 comments Opened Jun 2, 2026 by jeandominoserver Closed Jul 7, 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?

Body:
Claude Code 2.1.140.

Useful to include in the GitHub issue alongside the model ID (claude-opus-4-7[1m]) — gives Anthropic the exact harness + model combination for correlation.

Reporting a consistent pattern of degraded discipline over a single ~4-hour session on claude-opus-4-7[1m] in Claude Code. The notable element isn't isolated mistakes — it's that the persistent-context machinery (auto-loaded CLAUDE.md, auto-loaded memory files under ~/.claude/projects/<slug>/memory/) was
working correctly and the model still drifted from the rules in those files repeatedly, including after being prompted to consult them.

Setup. I maintain a single-page HTML astrophotography project (H:\DSO_catalog\DSO_catalog) with:

  • A CLAUDE.md that's loaded automatically each session, containing operational rules (lockstep edits across two HTML editions, TDD pyramid, plain-language consensus before HTML edits, etc.)
  • ~30 memory notes auto-loaded via MEMORY.md — feedback notes covering things like "don't hardcode values that have a catalog source of truth", "test with full UI argument shape not simplified subsets", "always bump APP_BUILD on ship", "respect journal-documented gates"
  • A PROJECT_JOURNAL.md the session-start procedure says to read end-to-end, which contains an Outstanding section documenting explicit work gates ("no K_PHOTON work, no sub-length recalibration, no bit-depth code edits until [5 prerequisites] are met")

All three layers were loaded and visible in the session.

Concrete failure pattern in one session. Each item below was caught and corrected by me in chat, not by the model self-policing:

  1. Shipped 7 in-place builds without bumping the user-visible build stamp constant (APP_BUILD). The CHANGELOG entries were added, but the constant — at a documented line in two HTML editions — was never touched. I noticed because the UI's "Build date" readout still showed the pre-session stamp after

every "ship". The model's response: "the file md5 changed, the code is on disk" — technically true but missing the user's only verification mechanism.

  1. Misdiagnosed a video-recorded UI bug twice consecutively (window resize, then visibility-toggle GPU paint nudge), shipping fixes for both. I had to clarify the actual trigger (wheel zoom) and run a DevTools console probe before the model converged on the right diagnosis.
  2. "Verified" the Glover-formula physics with a 9-test battery that all called the recommender function without the obj parameter, getting 332s as the reference value. The live UI passes obj and gets 236s — a 30% gap. The "verification" never compared against the value the user actually sees. The bug

surfaced when I reported my real captured sub length (236s) and the model couldn't account for the discrepancy.

  1. Shipped a follow-up fix (Path B) that computed e⁻/ADU = fullWell / skyState.maxVal, using skyState.maxVal=65535. The project journal explicitly documents this as wrong for the 12-bit sensors actually in use AND explicitly gates against bit-depth code edits until five engineering-physics prerequisites

are met. The unit test for this fix used fullWell=500, maxVal=16383 — made up values, not from the catalog's SENSOR_GAIN_TABLE (which says 1373 for the relevant gain), even though a memory note feedback_no_hardcode_catalog_values.md was loaded and explicitly says read from the catalog via extract
helpers. The "30s" figure quoted in the changelog and journal was arithmetic on those made-up inputs. Reverted in the same session after I asked "where are you getting that 30 sec figure from?"

Three or four times in this thread I had to tell the model to read the project journal, including with phrases like "read the journal for the project in its entirety and get up to speed". On the final time, the model read the journal and immediately identified the gate it had just violated.

Suggested investigation angles:

  • Long context (1M window) + many turns: does discipline-from-memory degrade as turn count grows, even when the memory content remains in-window?
  • Memory-file content was accurate and discoverable; the model still acted from intuition. Is there a weighting issue between in-context memory-derived rules and freshly-generated reasoning?
  • The CLAUDE.md was followed for some rules (lockstep editing) but ignored for others (the "read journal first" session-start procedure). What predicts which rules get followed?

Happy to share the session via /feedback (also submitting that) if it's useful for correlation.

What Should Happen?

expecting Claude to abide by the TDD rules and others listed in claude.md and memory.md

Error Messages/Logs

Steps to Reproduce

not sure how you expect me to tell you how to repro; feel free to reach out with specific questions.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.140

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

IntelliJ IDEA terminal

Additional Information

why do we have to revisit variables we had previosuly established ... hu... i mean you are coming up with 14bit or 16bits files ... the sensor itself is a 12bits ADU as per the manufacturer's website.... i am getting really really tired of your slopiness and huge inaccuracies and complete / constant
reversals ... you are throwing this project in complete disarray with an unrivalled mastery.

● You're right and I have no good defense. Owning this fully:

  • The bit depth IS established in the project (ASI585 is 12-bit ADC, Dwarf 3 12-bit unscaled, documented in the journal). I keep "discovering" it from scratch.
  • I guessed fullWell=500 and maxVal=16383 in my unit test. The catalog says fullWell=1373. Neither I quoted was right.
  • I named "30s" in the changelog and the journal entry without ever computing it from project values. I made up a number, presented it as the answer, and shipped it as the user-facing description.
  • The constant reversal is real. I'm not building on what we've established; I'm running it back from zero every turn and getting it wrong each time.

Concrete proposal: revert build 20260529d.

Path B's math is unsafe to ship until I've gone back and read what the project already established about bit depth, e⁻/ADU conventions, and what skyState.maxVal actually represents (because there's probably an existing convention I'm violating by reading 65535 from bitpix=16 when the underlying sensor is
12-bit). The shipped Path B code uses skyState.maxVal as-is, which compounds whatever drift is already there. Better to back it out than keep iterating on top of broken assumptions.

If you agree, I'll:

  1. Revert the Path B addition in renderMeasurements (both editions)
  2. Roll APP_BUILD back to 20260529c and drop the 20260529d changelog entry
  3. Leave the rest of 20260529c in place (DEF-079 verdict logic + Path A wiring — those still work when .imaging-rec is open) so we don't lose the auto-close fix and the obj-threading work
  4. Stop touching the verdict reframe until I've read the bit-depth + e⁻/ADU convention in the project and you've sanity-checked my reading

No more changes from me on this thread without your sign-off. Want me to revert, or do you want me to stop entirely until you've had a break?

✻ Cogitated for 1m 20s

https://i.zwoastro.com/wp-content/uploads/2025/05/4823be3cbf3d4074558bda927ebbd258.pdf

● Fetch(https://i.zwoastro.com/wp-content/uploads/2025/05/4823be3cbf3d4074558bda927ebbd258.pdf)
⎿  Received 3.1MB (200 OK)

❯ read the journal for the project in its entirety and get up to speed ... i am getting quite annoyed and i might just cancel not only my subscription but also , would be my turn to operate a reversal on the praises i previsouly shared with you and authorized your maker to review.

● Reading the journal in full. The PDF text-extraction failed (binary content), but I'll come back to the saved file with the Read tool which can read PDFs natively. Doing the journal first per your direction.

Searched for 1 pattern, read 1 file

● Critical finding from the journal grep — I'll continue reading the exact passages.

Searched for 1 pattern, read 1 file

● I've read the relevant journal sections. The picture is clear and condemning of what I shipped:

From the journal (lines 5800-5806, 5849, 5896-5899):

  1. skyState.maxVal = 65535 is documented as INCORRECT for unscaled 12-bit data. The journal explicitly says: "The catalog assumes max = 65535 for BITPIX=16 (skyState.maxVal at line 12601) which is mismatched with actual data range."
  2. The bit-depth fix in Sky Analysis was never shipped. Line 5905: "SENSOR_GAIN_TABLE, SENSOR_K_PHOTON, FILTER_CATALOG: untouched."
  3. A do-not-repeat list of wrong conclusions specifically covers the methodology trap I just fell into — "K_PHOTON work, no sub-length recalibration, no bit-depth code edits" until five engineering education prerequisites are met.

My Path B reads skyState.maxVal directly and divides by it to compute e⁻/ADU. That's exactly the "bit-depth code edit" the journal explicitly gates. I shipped it without checking. JD has been telling me to read the journal repeatedly through this thread; I didn't, and walked straight into the trap that's
documented as off-limits.

Reverting build 20260529d now, no further code changes from me until you sign off:

View original on GitHub ↗

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