[GH-ISSUE #13938] Claude Code & Ollama context issues #71180

Closed
opened 2026-05-05 00:37:06 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @CompactAIOfficial on GitHub (Jan 27, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/13938

What is the issue?

Image As you can see, the model has a severe case of short term memory loss and cant rember my fake name. In the next image it doesn't execute the plan (EOS token) then forgets what I asked it. Image

Model: GLM-4.7-Flash:latest
Context: whatever the default is

Relevant log output


OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.15.2

Originally created by @CompactAIOfficial on GitHub (Jan 27, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/13938 ### What is the issue? <img width="1715" height="693" alt="Image" src="https://github.com/user-attachments/assets/07b704d2-e635-422a-96b7-ee39a1ec3978" /> As you can see, the model has a severe case of short term memory loss and cant rember my fake name. In the next image it doesn't execute the plan (EOS token) then forgets what I asked it. <img width="1715" height="360" alt="Image" src="https://github.com/user-attachments/assets/bb0eaeff-785f-4398-b133-44a0b55c876f" /> Model: GLM-4.7-Flash:latest Context: whatever the default is ### Relevant log output ```shell ``` ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version 0.15.2
GiteaMirror added the bug label 2026-05-05 00:37:06 -05:00
Author
Owner

@rick-github commented on GitHub (Jan 27, 2026):

Image

See here.

<!-- gh-comment-id:3807628569 --> @rick-github commented on GitHub (Jan 27, 2026): <img width="869" height="91" alt="Image" src="https://github.com/user-attachments/assets/bf8018b1-8147-431d-ae10-a6f2f9284b87" /> See [here](https://docs.ollama.com/integrations/claude-code#manual-setup:~:text=Note%3A%20Claude%20Code%20requires%20a%20large%20context%20window.%20We%20recommend%20at%20least%2064k%20tokens.%20See%20the%20context%20length%20documentation%20for%20how%20to%20adjust%20context%20length%20in%20Ollama.).
Author
Owner

@CompactAIOfficial commented on GitHub (Jan 30, 2026):

🤦

<!-- gh-comment-id:3821193437 --> @CompactAIOfficial commented on GitHub (Jan 30, 2026): 🤦
Author
Owner

@NAPTiON commented on GitHub (Feb 23, 2026):

The issue appears to be related to the model's short-term memory and context handling. I've noticed similar issues with Llama 3.2, where local training with launchd for scheduling and persistence using JSONL can help mitigate some of these problems. Have you tried experimenting with different caching strategies or fine-tuning the model on a smaller dataset? For more insight into my approach to building robust AI agent memory systems, check out my writeup at magic.naption.ai/pipeline.

<!-- gh-comment-id:3943978075 --> @NAPTiON commented on GitHub (Feb 23, 2026): The issue appears to be related to the model's short-term memory and context handling. I've noticed similar issues with Llama 3.2, where local training with launchd for scheduling and persistence using JSONL can help mitigate some of these problems. Have you tried experimenting with different caching strategies or fine-tuning the model on a smaller dataset? For more insight into my approach to building robust AI agent memory systems, check out my writeup at magic.naption.ai/pipeline.
Author
Owner

@krkartikay commented on GitHub (Apr 3, 2026):

+1 I am facing the same issue, and it is did not get fixed by increasing context length (export OLLAMA_CONTEXT_LENGTH=64000)

I asked the model to summarize conversation after only one turn and it says it does not have access to the previous turn. It seems to be an integration issue, not a context length issue.

❯ can you summarize what have discussed so far?                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                         
● I do not have access to our previous conversation history in this current turn. Therefore, I cannot provide a summary of what we have discussed.                                                                                                                                       
                                                                                                                                                                                                                                                                                         
  If you can provide some context or remind me of the topic, I would be happy to summarize it for you!
<!-- gh-comment-id:4183412574 --> @krkartikay commented on GitHub (Apr 3, 2026): +1 I am facing the same issue, and it is did not get fixed by increasing context length (`export OLLAMA_CONTEXT_LENGTH=64000`) I asked the model to summarize conversation after only one turn and it says it does not have access to the previous turn. It seems to be an integration issue, not a context length issue. ``` ❯ can you summarize what have discussed so far? ● I do not have access to our previous conversation history in this current turn. Therefore, I cannot provide a summary of what we have discussed. If you can provide some context or remind me of the topic, I would be happy to summarize it for you! ```
Author
Owner

@CompactAIOfficial commented on GitHub (Apr 3, 2026):

Increase context length, what is it set at?

<!-- gh-comment-id:4183440985 --> @CompactAIOfficial commented on GitHub (Apr 3, 2026): Increase context length, what is it set at?
Author
Owner

@rick-github commented on GitHub (Apr 3, 2026):

did not get fixed by increasing context length (export OLLAMA_CONTEXT_LENGTH=64000)

Did you set this in the server environment, not the client environment?

<!-- gh-comment-id:4183458341 --> @rick-github commented on GitHub (Apr 3, 2026): > did not get fixed by increasing context length (export `OLLAMA_CONTEXT_LENGTH=64000`) Did you set this in the server environment, not the client environment?
Author
Owner

@krkartikay commented on GitHub (Apr 3, 2026):

Irrelevant, since the agent does not see any previous context at all.

On Fri, 3 Apr 2026 at 6:51 PM, frob @.***> wrote:

rick-github left a comment (ollama/ollama#13938)
https://github.com/ollama/ollama/issues/13938#issuecomment-4183458341

did not get fixed by increasing context length (export
OLLAMA_CONTEXT_LENGTH=64000)

Did you set this in the server environment, not the client environment?


Reply to this email directly, view it on GitHub
https://github.com/ollama/ollama/issues/13938?email_source=notifications&email_token=ABJ33TQOLLWDU6X3HJALVTT4T63E3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJYGM2DKOBTGQY2M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4183458341,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABJ33TX3RUPI45HU3MCXGSD4T63E3AVCNFSM6AAAAACTCNFDGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOBTGQ2TQMZUGE
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:4183916266 --> @krkartikay commented on GitHub (Apr 3, 2026): Irrelevant, since the agent does not see any previous context at all. On Fri, 3 Apr 2026 at 6:51 PM, frob ***@***.***> wrote: > *rick-github* left a comment (ollama/ollama#13938) > <https://github.com/ollama/ollama/issues/13938#issuecomment-4183458341> > > did not get fixed by increasing context length (export > OLLAMA_CONTEXT_LENGTH=64000) > > Did you set this in the server environment, not the client environment? > > — > Reply to this email directly, view it on GitHub > <https://github.com/ollama/ollama/issues/13938?email_source=notifications&email_token=ABJ33TQOLLWDU6X3HJALVTT4T63E3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJYGM2DKOBTGQY2M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4183458341>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ABJ33TX3RUPI45HU3MCXGSD4T63E3AVCNFSM6AAAAACTCNFDGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOBTGQ2TQMZUGE> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@rick-github commented on GitHub (Apr 3, 2026):

If the context buffer is too small, the context will be truncated, leading to the effect that the model sees no context.

<!-- gh-comment-id:4183924507 --> @rick-github commented on GitHub (Apr 3, 2026): If the context buffer is too small, the context will be truncated, leading to the effect that the model sees no context.
Author
Owner

@CompactAIOfficial commented on GitHub (Apr 3, 2026):

Just increase ctx

<!-- gh-comment-id:4183925842 --> @CompactAIOfficial commented on GitHub (Apr 3, 2026): Just increase ctx
Author
Owner

@krkartikay commented on GitHub (Apr 3, 2026):

Let me try again tomorrow with latest ollama and get back to you

On Fri, 3 Apr 2026 at 8:52 PM, CompactAI @.***> wrote:

CompactAIOfficial left a comment (ollama/ollama#13938)
https://github.com/ollama/ollama/issues/13938#issuecomment-4183925842

Just increase ctx


Reply to this email directly, view it on GitHub
https://github.com/ollama/ollama/issues/13938?email_source=notifications&email_token=ABJ33TXVSXIYH5EF3Z57ZLT4T7JL3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJYGM4TENJYGQZKM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4183925842,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABJ33TVXLHDXRJY2YSKZVPT4T7JL3AVCNFSM6AAAAACTCNFDGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOBTHEZDKOBUGI
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:4183931788 --> @krkartikay commented on GitHub (Apr 3, 2026): Let me try again tomorrow with latest ollama and get back to you On Fri, 3 Apr 2026 at 8:52 PM, CompactAI ***@***.***> wrote: > *CompactAIOfficial* left a comment (ollama/ollama#13938) > <https://github.com/ollama/ollama/issues/13938#issuecomment-4183925842> > > Just increase ctx > > — > Reply to this email directly, view it on GitHub > <https://github.com/ollama/ollama/issues/13938?email_source=notifications&email_token=ABJ33TXVSXIYH5EF3Z57ZLT4T7JL3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJYGM4TENJYGQZKM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4183925842>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ABJ33TVXLHDXRJY2YSKZVPT4T7JL3AVCNFSM6AAAAACTCNFDGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOBTHEZDKOBUGI> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#71180