Skip to content

compact causes llm to forget convo #2234

Closed as not planned
Closed as not planned

Description

@tylerlaprade

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

Activity

  1. changed the title [-]Claude forgot the context of what he just said[/-] [+]compact causes llm to forget convo[/+] on Aug 25, 2025
  2. rekram1-node commented on Aug 25, 2025

    @rekram1-node
    Collaborator

    ah yeah this is a due to compact

  3. rekram1-node commented on Aug 25, 2025

    @rekram1-node
    Collaborator

    we should fix

  4. OpeOginni commented on Aug 25, 2025

    @OpeOginni
    Contributor

    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.

  5. rekram1-node commented on Aug 25, 2025

    @rekram1-node
    Collaborator

    @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

  6. tylerlaprade commented on Aug 25, 2025

    @tylerlaprade
    Author

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

  7. rekram1-node commented on Aug 25, 2025

    @rekram1-node
    Collaborator

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

  8. tylerlaprade commented on Aug 25, 2025

    @tylerlaprade
    Author

    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.

  9. OpeOginni commented on Aug 25, 2025

    @OpeOginni
    Contributor

    @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.

  10. rekram1-node commented on Aug 25, 2025

    @rekram1-node
    Collaborator

    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

  11. OpeOginni commented on Aug 25, 2025

    @OpeOginni
    Contributor

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

  12. robertmclaws commented on Aug 27, 2025

    @robertmclaws

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

  13. rekram1-node commented on Sep 11, 2025

    @rekram1-node
    Collaborator

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

  14. rekram1-node commented on Sep 12, 2025

    @rekram1-node
    Collaborator

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

  15. gugahoi commented on Sep 18, 2025

    @gugahoi

    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.

  16. rekram1-node commented on Sep 18, 2025

    @rekram1-node
    Collaborator

    @gugahoi are you manually compacting and it hangs?

  17. gugahoi commented on Sep 18, 2025

    @gugahoi

    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.

  18. raymelon commented on Oct 3, 2025

    @raymelon

    Curious how to set auto compacting to False.

  19. trystan2k commented on Oct 3, 2025

    @trystan2k

    Curious how to set auto compacting to False.

    You can do this:

    OPENCODE_DISABLE_AUTOCOMPACT=true opencode

  20. dhruvkej9 commented on Jan 1, 2026

    @dhruvkej9

    @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
    
  21. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions