r/opencodeCLI • u/ganang1722 • 9h ago
Why does OpenCode sometimes forget things from the same session?
I've been using OpenCode to work on some testnet tasks. I asked the agent to create a separate wallet specifically for testnet activities.
At first, everything worked fine. It created the wallet, claimed faucet tokens, and even made some transactions.
But at some point, while I was still in the same session, the agent seemed to forget that it had already created the wallet.
I had to ask it to scan the files on my VPS just to find the wallet again.
I'm a bit confused about why this happens. If I'm still using the same session, shouldn't it remember what it did earlier?
Could this be related to context limits, context compaction, or something else?
Has anyone experienced something similar? How do you usually handle this when working on longer tasks?
1
u/AdventurousItem4635 8h ago
Yeah that's compaction. When the session gets close to the model's context limit OpenCode summarizes the older part of the conversation and keeps going from the summary, and details like which wallet it made or where it saved the keyfile often don't make it into that summary. Old tool outputs can get cleared too, so the command output that had the address is gone.
On anything long I have it write that kind of state to a file in the project, AGENTS.md or just a notes file with the wallet path and address, and tell it to check there first. Then it doesn't matter what got summarized.