logoalt Hacker News

LoganDarktoday at 9:44 AM1 replyview on HN

The first messages in the transcript are a dynamically generated system prompt that are recalculated every request and not persisted. This is just how OpenCode works. If the inputs to the calculation do not change, then it won't invalidate the cache, but whenever the inputs do, it does invalidate the cache.

From the latest commit on the dev branch,

here is the code that generates the system messages from scratch: https://github.com/anomalyco/opencode/blob/03521003fafdc6d34...

and here is the code that dynamically re-generates the system messages on every completion: https://github.com/anomalyco/opencode/blob/03521003fafdc6d34...

Regardless of how many invalidations occur in practice, this is not okay. You cannot just regenerate the start of the transcript dynamically throughout a session from things that change as frequently as current working directory. That's the worst etiquette I've ever seen in a harness.


Replies

FeepingCreaturetoday at 10:08 AM

Oh, to build the skills prompt. Right, now it makes sense. Should be noted that in normal circumstances this should change very rarely. I think it makes sense because the models aren't trained to pick up tool changes in mid-operation.

show 1 reply