compact causes llm to forget convo #1478

Open
opened 2026-02-16 17:31:10 -05:00 by yindo · 19 comments
Owner

Originally created by @tylerlaprade on GitHub (Aug 24, 2025).

Originally assigned to: @thdxr on GitHub.

Claude seemingly forgot the message he just sent about remaining work after "finishing" (giving up halfway through) his task. This felt like he was starting a fresh session, even though I was referencing what he just said.

Image

https://opencode.ai/s/t3wDHDQg

Originally created by @tylerlaprade on GitHub (Aug 24, 2025). Originally assigned to: @thdxr on GitHub. Claude seemingly forgot the message he just sent about remaining work after "finishing" (giving up halfway through) his task. This felt like he was starting a fresh session, even though I was referencing what he just said. <img width="537" height="830" alt="Image" src="https://github.com/user-attachments/assets/56d0af0b-06f6-455b-a804-6bbb6ebc3154" /> https://opencode.ai/s/t3wDHDQg
Author
Owner

@rekram1-node commented on GitHub (Aug 25, 2025):

ah yeah this is a due to compact

@rekram1-node commented on GitHub (Aug 25, 2025): ah yeah this is a due to compact
Author
Owner

@rekram1-node commented on GitHub (Aug 25, 2025):

we should fix

@rekram1-node commented on GitHub (Aug 25, 2025): we should fix
Author
Owner

@OpeOginni commented on GitHub (Aug 25, 2025):

Hey @rekram1-node I see you already have this issue assigned, but is it still okay if I take a look, I find it interesting.

@OpeOginni commented on GitHub (Aug 25, 2025): Hey @rekram1-node I see you already have this issue assigned, but is it still okay if I take a look, I find it interesting.
Author
Owner

@rekram1-node commented on GitHub (Aug 25, 2025):

@OpeOginni u are welcome to look at it but I think compact needs some rework and that may require discussion w/ team so just a forewarning

@rekram1-node commented on GitHub (Aug 25, 2025): @OpeOginni u are welcome to look at it but I think compact needs some rework and that may require discussion w/ team so just a forewarning
Author
Owner

@tylerlaprade commented on GitHub (Aug 25, 2025):

Oh really? I didn't see a compact around that time.

@tylerlaprade commented on GitHub (Aug 25, 2025): Oh really? I didn't see a compact around that time.
Author
Owner

@rekram1-node commented on GitHub (Aug 25, 2025):

@tylerlaprade the second to last ai message is the llm auto compacting the conversation by the looks of it

@rekram1-node commented on GitHub (Aug 25, 2025): @tylerlaprade the second to last ai message is the llm auto compacting the conversation by the looks of it
Author
Owner

@tylerlaprade commented on GitHub (Aug 25, 2025):

Ah, interesting, that actually explains quite a lot. I often see similar messages when it seems to prematurely declare victory and give a summary of its accomplishments. I guess those were actually compacts.

@tylerlaprade commented on GitHub (Aug 25, 2025): Ah, interesting, that actually explains quite a lot. I often see similar messages when it seems to prematurely declare victory and give a summary of its accomplishments. I guess those were actually compacts.
Author
Owner

@OpeOginni commented on GitHub (Aug 25, 2025):

@rekram1-node from the code it seems like auto compacting is implemented as it should (checks if model limit is reached and then runs a summarize), if you could please explain what rewrite you think needed?

Only thing I can really see is the summarize prompt is a bit little, and maybe for this exact case priority could be made to the last message made by the assistant in the summary.

@OpeOginni commented on GitHub (Aug 25, 2025): @rekram1-node from the code it seems like auto compacting is implemented as it should (checks if model limit is reached and then runs a summarize), if you could please explain what rewrite you think needed? Only thing I can really see is the summarize prompt is a bit little, and maybe for this exact case priority could be made to the last message made by the assistant in the summary.
Author
Owner

@rekram1-node commented on GitHub (Aug 25, 2025):

imo I think compact shouldn't literally replace entire convo, last n messages should stay as is and the compact should apply to the messages before it to help prevent this "memory loss"

Compact prompt could probably also use work

but these are kinda core things

Ultimately the decision isn't up to me, I am a maintainer but I don't make authoritative decisions on this project, that is the up to the team

@rekram1-node commented on GitHub (Aug 25, 2025): imo I think compact shouldn't literally replace entire convo, last n messages should stay as is and the compact should apply to the messages before it to help prevent this "memory loss" Compact prompt could probably also use work but these are kinda core things Ultimately the decision isn't up to me, I am a maintainer but I don't make authoritative decisions on this project, that is the up to the team
Author
Owner

@OpeOginni commented on GitHub (Aug 25, 2025):

Makes sense, I'll leave this one for now then, but will keep an eye out 👀

@OpeOginni commented on GitHub (Aug 25, 2025): Makes sense, I'll leave this one for now then, but will keep an eye out 👀
Author
Owner

@robertmclaws commented on GitHub (Aug 26, 2025):

Just had this one happen to me with Grok Code Free.

@robertmclaws commented on GitHub (Aug 26, 2025): Just had this one happen to me with Grok Code Free.
Author
Owner

@rekram1-node commented on GitHub (Sep 11, 2025):

This should be fixed on latest! Dax just did some compact updates

@rekram1-node commented on GitHub (Sep 11, 2025): This should be fixed on latest! Dax just did some compact updates
Author
Owner

@rekram1-node commented on GitHub (Sep 12, 2025):

nvm looks like more compact changes to come I'll come back once compact gets to a better state

@rekram1-node commented on GitHub (Sep 12, 2025): nvm looks like more compact changes to come I'll come back once compact gets to a better state
Author
Owner

@gugahoi commented on GitHub (Sep 17, 2025):

I don't know if my issue is related but using GitHub Copilot Sonnet 4 and compacting make the agent just stop. It hangs on "Generating ..." and I need to tell it to "Continue" otherwise it just sits there.

@gugahoi commented on GitHub (Sep 17, 2025): I don't know if my issue is related but using GitHub Copilot Sonnet 4 and compacting make the agent just stop. It hangs on "Generating ..." and I need to tell it to "Continue" otherwise it just sits there.
Author
Owner

@rekram1-node commented on GitHub (Sep 17, 2025):

@gugahoi are you manually compacting and it hangs?

@rekram1-node commented on GitHub (Sep 17, 2025): @gugahoi are you manually compacting and it hangs?
Author
Owner

@gugahoi commented on GitHub (Sep 18, 2025):

No, it's auto compacting and it hangs. It also loses a lot of the context and kinda forgets what it was doing. For more clarity, I am trying GitHub/spec-kit and I think a lot of the context window is taken up by the instructions and prompts for each command.

@gugahoi commented on GitHub (Sep 18, 2025): No, it's auto compacting and it hangs. It also loses a lot of the context and kinda forgets what it was doing. For more clarity, I am trying GitHub/spec-kit and I think a lot of the context window is taken up by the instructions and prompts for each command.
Author
Owner

@raymelon commented on GitHub (Oct 3, 2025):

Curious how to set auto compacting to False.

@raymelon commented on GitHub (Oct 3, 2025): Curious how to set auto compacting to False.
Author
Owner

@trystan2k commented on GitHub (Oct 3, 2025):

Curious how to set auto compacting to False.

You can do this:

OPENCODE_DISABLE_AUTOCOMPACT=true opencode

@trystan2k commented on GitHub (Oct 3, 2025): > Curious how to set auto compacting to False. You can do this: `OPENCODE_DISABLE_AUTOCOMPACT=true opencode`
Author
Owner

@dhruvkej9 commented on GitHub (Jan 1, 2026):

@rekram1-node @thdxr I am seeing a new bug from few days maybe related to this issue only and recent updates

The auto compact happens without context limit being near limit and then the LLM forgots the everything also compact does not works successfully. (The compact just happened after the SYSTEM REMINDER and then something weird happened, I don't know why JSON export also didn't have the compact command or message)

Part of session JSON Where it occurred:

### Session 2 (Current)
1. **Analyzed frontend VAD architecture** - confirmed no conflict exists between frontend and backend VAD (mutually exclusive)
2. **Fixed Next.js `websocket.js`** - added missing `latency_update` message handler
3. **Fixed Next.js `vad.js`** - added missing `destroy()` and `getMetrics()` methods

### Remaining Tasks
- Update `.env.example` with optimal settings (audio quality issue you mentioned)
- Test with real audio

Want me to continue with the remaining tasks or would you like to test what we have so far?

---

## User

[SYSTEM REMINDER - TODO CONTINUATION]

Incomplete tasks remain in your todo list. Continue working on the next pending task.

- Proceed without asking for permission
- Mark each task complete when finished
- Do not stop until all tasks are done

[Status: 4/6 completed, 2 remaining]

---

## User

---

## Assistant

---

## User

---

## Assistant

Looking at my context, I don't have any prior conversation history with you in this session, and there are no active todos or tasks in progress.

To understand what work has been done on this project, I can:

1. Check recent git commits
2. Review any existing session history

Let me check the git log to see recent activity:

```
Tool: bash
@dhruvkej9 commented on GitHub (Jan 1, 2026): @rekram1-node @thdxr I am seeing a new bug from few days maybe related to this issue only and recent updates The auto compact happens without context limit being near limit and then the LLM forgots the everything also compact does not works successfully. (The compact just happened after the SYSTEM REMINDER and then something weird happened, I don't know why JSON export also didn't have the compact command or message) **Part of session JSON Where it occurred:** <pre> ### Session 2 (Current) 1. **Analyzed frontend VAD architecture** - confirmed no conflict exists between frontend and backend VAD (mutually exclusive) 2. **Fixed Next.js `websocket.js`** - added missing `latency_update` message handler 3. **Fixed Next.js `vad.js`** - added missing `destroy()` and `getMetrics()` methods ### Remaining Tasks - Update `.env.example` with optimal settings (audio quality issue you mentioned) - Test with real audio Want me to continue with the remaining tasks or would you like to test what we have so far? --- ## User [SYSTEM REMINDER - TODO CONTINUATION] Incomplete tasks remain in your todo list. Continue working on the next pending task. - Proceed without asking for permission - Mark each task complete when finished - Do not stop until all tasks are done [Status: 4/6 completed, 2 remaining] --- ## User --- ## Assistant --- ## User --- ## Assistant Looking at my context, I don't have any prior conversation history with you in this session, and there are no active todos or tasks in progress. To understand what work has been done on this project, I can: 1. Check recent git commits 2. Review any existing session history Let me check the git log to see recent activity: ``` Tool: bash </pre>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1478