anomalyco / anomalyco/opencode
Plan mode rewrites prompt history and breaks prefix caching
Open
@jlongster is already working on this.
Since Aug 20, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Description
OpenCode 1.18.5 rewrites model-visible history when resuming a plan session.
Captured two consecutive OpenAI-compatible requests:
- system message: same length, different hash
- tools: byte-identical
- previous file-attached user message: 5,373 → 3,833 serialized characters
The immediate follow-up got 0 cached tokens and re-prefilled all 45,222 tokens in 143.3s.
Repro
- Run
opencode run --pure --agent plan --file foo.py "...". - Resume with
opencode run --pure --agent plan --session <id> "...". - Compare the outbound
messagespayloads.
Expected
Historical messages remain byte-identical. Only the new turn is appended.
macOS, no plugins, custom OpenAI-compatible provider.
Related: #26749, #32202.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.