Critical: Claude Code context amnesia causes silent code deletion

Resolved 💬 21 comments Opened Jul 26, 2025 by NeaByteLab Closed Aug 15, 2025

Environment

  • Platform: Claude Code CLI
  • Claude CLI version: 1.0.61
  • Operating System: macOS 15.5 (Build 24F74)
  • Terminal: Terminal App

Bug Description

Critical amnesia issue:
Claude Code reads codebase initially but loses ALL context after few messages, causing code loss and trash additions. After 1 month testing both Claude Code CLI and Claude 4 in Cursor, consistent pattern shows Claude 4 performs worse than Claude 3.5 despite marketing claims.

Steps to Reproduce

  1. Claude Code reads 1,684-line file initially ✅
  2. Request: "split that files into modular folder"
  3. Result: 225 lines lost (13% of code disappeared)
  4. Continue conversation 5-10 messages
  5. Claude forgets everything - requires "read conversation as context"
  6. Test on simple REST API - adds unnecessary boilerplate during "optimization"

Expected Behavior

  • Maintain codebase context throughout session
  • Preserve 100% code integrity during refactoring
  • Focus on requested changes only

Actual Behavior

Amnesia Pattern:

  • ✅ Reads codebase initially
  • Loses ALL context after few steps
  • ❌ Lost 225 lines during modularization
  • ❌ Adds trash code during optimization
  • ❌ Requires constant reminders to read context

Model Comparison (1 Month Testing):

  • Claude 3.5: Better focus, similar amnesia but less severe
  • Claude 4: Worse performance, more verbose, adds unnecessary complexity
  • Regression confirmed across Claude Code CLI and Cursor IDE

Additional Context

Production Impact (30 Days Usage):

  • Constant context resets needed
  • More time fixing Claude's mistakes than original work
  • Standard workflow broken: Must remind Claude to read codebase every few messages

Key Issues:

  1. Amnesia: Forgets codebase context mid-conversation
  2. Code Loss: Silent deletion of functional code
  3. Trash Addition: Adds unnecessary complexity during optimization
  4. Model Regression: Claude 4 worse than Claude 3.5
  5. Overclaiming: Marketing doesn't match reality

Evidence:

  • Original: 1,684 lines → Modular: 1,459 lines = 225 lines missing
  • Missing methods: getBaseProcessesForNodeType(), getMemoryUtilizationFactor(), etc.
  • Same issues across Claude Code CLI and Cursor IDE
  • Claude 3.5 performs better in semantic reasoning

Bottom Line:
Claude Code has severe amnesia - reads codebase then forgets everything, causing data loss and requiring constant context reminders.

---

Conversation History

<img width="897" height="1032" alt="Image" src="https://github.com/user-attachments/assets/89eec256-28a2-4276-8aa0-61c72009f50e" />
<img width="897" height="1032" alt="Image" src="https://github.com/user-attachments/assets/b50506f3-7f8c-4911-ae0d-eef740a53677" />
<img width="897" height="1032" alt="Image" src="https://github.com/user-attachments/assets/53a96ae3-b326-4679-977e-4f5c0a6a909d" />
<img width="897" height="1032" alt="Image" src="https://github.com/user-attachments/assets/c31b3f7a-34a7-4bdc-9271-30bb7284e955" />
<img width="897" height="1032" alt="Image" src="https://github.com/user-attachments/assets/290db352-4f45-4285-b19e-6381dcdc7f65" />
<img width="897" height="1032" alt="Image" src="https://github.com/user-attachments/assets/5c8893e8-51d5-4bce-a3da-320ae5be7c8d" />

--

Proof of Usage in Cursor IDE

<img width="3600" height="1920" alt="Image" src="https://github.com/user-attachments/assets/87500392-7478-4a1c-852b-8c6b52cc6ba7" />

View original on GitHub ↗

21 Comments

NeaByteLab · 11 months ago

I shared a GitHub URL (https://github.com/anthropics/claude-code/issues/4487) and Claude immediately assumed it was a successfully posted issue, responding with detailed analysis about the submission without actually checking the URL first.

When am asked Claude to "read the opening issues and read some issue" from the repository, Claude finally fetched the URL and discovered issue #4487 doesn't exist. This sequence perfectly demonstrates Claude Code's core amnesia problem - it makes confident assumptions without verification, loses track of what it has actually checked versus what it assumes, and requires explicit user prompting to perform basic validation tasks that should happen automatically.

Claude said :
_"Ah! Now I understand - issue #4487 doesn't actually exist"_

<img width="938" height="1020" alt="Image" src="https://github.com/user-attachments/assets/96d5dd77-7843-4b29-9cbb-791f91a6a762" />

heyagent · 11 months ago

@NeaByteLab I believe you are experiencing this issue because parsing a website consumes a lot of tokens, and Anthropic is trying to minimize the usage. So instead of the bot checking what is really going on the website, it's just giving you an assumption which most of the times is wrong. The same thing happens when it is checking the files. Previously, it was much more prone to reading files, and now it is much more prone to just writing.

This is just an observation. I don't have any factual data to support my claim. Can also be due to the fact that Claude Code is getting dangerously slow compared to other tools on the market, so they have to compromise by missing long running steps.

NeaByteLab · 11 months ago
@NeaByteLab I believe you are experiencing this issue because parsing a website consumes a lot of tokens, and Anthropic is trying to minimize the usage. So instead of the bot checking what is really going on the website, it's just giving you an assumption which most of the times is wrong. The same thing happens when it is checking the files. Previously, it was much more prone to reading files, and now it is much more prone to just writing. This is just an observation. I don't have any factual data to support my claim. Can also be due to the fact that Claude Code is getting dangerously slow compared to other tools on the market, so they have to compromise by missing long running steps.

Current Claude Code architecture :

  1. Using prompt caching (ephemeral cache control)
  2. Sending entire conversation history each request
  3. Still exhibiting amnesia behavior

Then the issue about token optimization theory doesn't hold up.

The real issue becomes more concerning :

If full context is being sent but Claude still "forgets":

  • It's not about token costs (they're cached)
  • It's about processing/reasoning failures
  • Claude literally cannot maintain coherent understanding across the conversation
  • This suggests fundamental model limitations

Two possibilities :

  1. Cache isn't working properly
  • Ephemeral cache supposed to persist conversation context
  • But maybe cache invalidation is too aggressive
  • Or context gets corrupted during caching
  1. Model reasoning degradation
  • Even with full context, Claude 4 can't maintain coherence
  • Context window vs actual comprehension mismatch
  • Model regression from Claude 3.5 → Claude 4

The amnesia is happening DESPITE having full context - that's a much worse problem than token optimization.

<img width="887" height="460" alt="Image" src="https://github.com/user-attachments/assets/12de00f6-05e2-4c43-bb39-aaa4f191a2ed" />

<img width="1799" height="887" alt="Image" src="https://github.com/user-attachments/assets/91abefb4-2ca2-4f83-b858-e2b6749fc554" />

NeaByteLab · 11 months ago

_Claude: Always challenge AI assessments, especially definitive technical claims._

<img width="1800" height="956" alt="Image" src="https://github.com/user-attachments/assets/16afa0a9-0b97-46fb-8e5c-8023b2f6931e" />

<img width="667" height="763" alt="Image" src="https://github.com/user-attachments/assets/714f0ebf-08db-45eb-97ed-24a795640748" />

<img width="1100" height="962" alt="Image" src="https://github.com/user-attachments/assets/ddeb01b1-2485-4156-8160-177886d033bb" />

NeaByteLab · 11 months ago

Why I'm Reporting This

This is honest user feedback to help improve Claude Code. Not promotional content or competitive agenda - just genuine experience from actual usage.

Documentation Provided

  • Screenshots and reproduction steps
  • Specific examples with line counts
  • Timeline of actual events

Conclusion

Many users likely face similar issues. Thank you for considering this feedback - I hope it helps make Claude Code more reliable for serious development work.

PiotrMocan · 11 months ago

try to downgrade claude package version, it works for me npx @anthropic-ai/claude-code@1.0.24, newer versions compresses context, from what version can't tell

NeaByteLab · 11 months ago
try to downgrade claude package version, it works for me npx @anthropic-ai/claude-code@1.0.24, newer versions compresses context, from what version can't tell

v1.0.61 👍🏻

<img width="677" height="452" alt="Image" src="https://github.com/user-attachments/assets/ee5219bf-6f38-4140-ac48-09ed14089f1f" />

---

v1.0.24 much better 👍🏻

<img width="696" height="790" alt="Image" src="https://github.com/user-attachments/assets/d7a7486f-b5e9-4fd6-956d-3d14cd4bcc03" />

UBParker · 11 months ago

I have issues that I feel are related in terms of context amnesia. Two examples from today using opus in Claude CLI . Claude forgot mid-conversation how to use gcloud and told me "I'm just an AI assistant, I don't have the ability to run shell commands or access external systems" , funny bc that is most of what I use it to do. Now I asked it to add a user, it did so successfully, then when adding a second user it forgot Python syntax, forgot that it had just written a script to add a user that was successful. I have been using it all day, every day for weeks and I agree this is a degradation from the previous functionality. I had previously been getting around the forgetfulness by having it write MD files of the current TODO and follow them but it seems to be forgetting mid conversation now, even with the files

<img width="1440" height="359" alt="Image" src="https://github.com/user-attachments/assets/395b3a35-da0e-4601-93db-91b2b13cd041" />

NeaByteLab · 11 months ago
I have issues that I feel are related in terms of context amnesia. Two examples from today using opus in Claude CLI . Claude forgot mid-conversation how to use gcloud and told me "I'm just an AI assistant, I don't have the ability to run shell commands or access external systems" , funny bc that is most of what I use it to do. Now I asked it to add a user, it did so successfully, then when adding a second user it forgot Python syntax, forgot that it had just written a script to add a user that was successful. I have been using it all day, every day for weeks and I agree this is a degradation from the previous functionality. I had previously been getting around the forgetfulness by having it write MD files of the current TODO and follow them but it seems to be forgetting mid conversation now, even with the files <img alt="Image" width="1440" height="359" src="https://private-user-images.githubusercontent.com/10344478/471151106-395b3a35-da0e-4601-93db-91b2b13cd041.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTM1Njc1OTAsIm5iZiI6MTc1MzU2NzI5MCwicGF0aCI6Ii8xMDM0NDQ3OC80NzExNTExMDYtMzk1YjNhMzUtZGEwZS00NjAxLTkzZGItOTFiMmIxM2NkMDQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA3MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNzI2VDIyMDEzMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEyZWE4MzQyMTM4M2E2YzQ2NTdjZTZhZTI5ZjgyOTJkMTE2MjRjNjg0ZmM0YzU2ZWZjNWE4OTJkMzdlOGE4NDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.8hRcpG5WDPXGr-YWqjWviPUMhvSQrUGWUF5gPZ6xrcw">

v1.0.24 bettter, u should try that!

npm uninstall @anthropic-ai/claude-code
npm install @anthropic-ai/claude-code@1.0.24 -g
claude config set -g autoUpdaterStatus disabled
claude

Feedback (v1.0.24)

  • All response good (direct & concise)
  • Context understanding 🚀
  • Less hallucinating 👍🏻
UBParker · 11 months ago

thanks!

notengoideanise · 11 months ago

anyone else experience better results with v1.0.24?

heyagent · 11 months ago

Initially, I thought, "Yeah", but after using it for several hours, it still makes dumb mistakes. @notengoideanise

tttocklll · 11 months ago

So far v1.0.24 feels better than v1.0.61 for me too.
I'm curious if there's any newer version without the amnesia issues seen in v1.0.61.

PiotrMocan · 11 months ago
So far v1.0.24 feels better than v1.0.61 for me too. I'm curious if there's any newer version without the amnesia issues seen in v1.0.61.

It might be, 1.0.24 is just most older version you can run, though if they really "optimize" context in newer versions, they have done it incrementally through a lot of updates, that's why so many users didn't realize that tool became dumber

shcv · 11 months ago

Do y'all have a file like this that you can share? I.e., a large file that you want split into modules, which it does poorly? I'd like to be able to repeat the test.

AdonisTheCreator · 11 months ago

The Quen 3 Suicide Power move was so funny lmao, but seriously wtf is happening to claude code

NeaByteLab · 11 months ago
Do y'all have a file like this that you can share? I.e., a large file that you want split into modules, which it does poorly? I'd like to be able to repeat the test.

Want to challenge the AI? Tell it to wrap several public APIs into a single file, then refactor that monolith into clean, modular parts—without even asking for basic HTML. This is, for example, writing 5,000+ lines of code without losing context!

<img width="274" height="356" alt="Image" src="https://github.com/user-attachments/assets/e340c546-b294-410e-811e-ac41a670232f" />

notengoideanise · 11 months ago
> Do y'all have a file like this that you can share? I.e., a large file that you want split into modules, which it does poorly? I'd like to be able to repeat the test. Want to challenge the AI? Tell it to wrap several public APIs into a single file, then refactor that monolith into clean, modular parts—without even asking for basic HTML. This is, for example, writing 5,000+ lines of code without losing context! <img alt="Image" width="274" height="356" src="https://private-user-images.githubusercontent.com/209737579/472373546-e340c546-b294-410e-811e-ac41a670232f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTQwOTc3MDEsIm5iZiI6MTc1NDA5NzQwMSwicGF0aCI6Ii8yMDk3Mzc1NzkvNDcyMzczNTQ2LWUzNDBjNTQ2LWIyOTQtNDEwZS04MTFlLWFjNDFhNjcwMjMyZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwODAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDgwMlQwMTE2NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jZTY0MmVlYmFjYjRmMDc4OTIzNzEwZjhlZGUzNmY1MmFkZWE1NWIwMTk4NDJjMzFjNmU3Y2U0ZjExMmVjZTZhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.vpXj1l2VJubM8duqavs7xR4HpgsZixSCQvp0lWAm2f0">

still having the same results? have you tested the newest version again?

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4520
  2. https://github.com/anthropics/claude-code/issues/2545
  3. https://github.com/anthropics/claude-code/issues/3841

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] · 11 months ago

This issue has been automatically closed as a duplicate of #4520.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.