goose session state lost after compacting — is there a way to persist key facts? #12097
|
I've noticed that after a long session when goose compacts the conversation, it loses track of things I told it earlier. For example I'll say "the deploy target is 10.0.0.5" at the start, and after compacting it asks me for the IP again. Is there a mechanism to mark certain information as persistent so it survives compacting? I tried putting it in The workaround I'm using is writing important state to a file and telling goose to read it back, but that's clunky. Anyone found a better pattern for this? |
Replies: 3 comments
|
this is a known pain point. compaction summarizes the conversation to save tokens, and the summarizer doesn't know which facts are critical vs disposable. your deploy IP is "context" to the model, same as any other sentence that got said 40 messages ago. the file-write workaround you're doing is actually the most reliable pattern. I do the same thing — write state to a scratchpad file and tell the agent to read it when needed. slightly less clunky version: at the start of a session, create a
|
|
Writing critical state to a pinned file and referencing it from .goosehints is working well enough for now. Not elegant but at least the IP survives compaction. Would be nice if goose had a native |
|
Disclosure: I build Grunz, another coding agent, and this exact failure (a fact stated early and gone after compaction) was the most expensive bug we had. The file approach above is right. A few things made it much more reliable for us. Why it happens: the summarizer keeps what looks important in the transcript, and a fact stated once at the start is the oldest and least-repeated text there. "The deploy target is 10.0.0.5" gets compressed to "the user described the deploy setup," which reads fine and has lost the only part that mattered. Making the file pattern less clunky:
goose also has a built-in Memory extension for storing facts across sessions, which is worth trying if you want something less manual than a file. The same rule applies, though: store the exact value, not a description of it. The longer-term fix is the native |
this is a known pain point. compaction summarizes the conversation to save tokens, and the summarizer doesn't know which facts are critical vs disposable. your deploy IP is "context" to the model, same as any other sentence that got said 40 messages ago.
the file-write workaround you're doing is actually the most reliable pattern. I do the same thing — write state to a scratchpad file and tell the agent to read it when needed.
slightly less clunky version: at the start of a session, create a
session-state.mdand tell goose "write any fact I mark as important to session-state.md, and re-read it after compaction." it's still manual but at least the agent handles the file I/O instead of you..…