Description
The system prompt is rebuilt on every request: instruction.system() re-reads the instruction files (AGENTS.md, CLAUDE.md, memory.md, …) and system.ts injects Today's date. Any change to that prefix — editing an instruction file during a session, or the date rolling over at midnight — changes the system message, so the provider's cached prefix diverges at token ~0 and the entire conversation is re-prefilled.
On a long session (1M-context model) that's ~450K tokens re-prefilled (~4 minutes) with no signal in the UI — it just looks like the model is thinking. It affects every provider, not just Anthropic, and the date case is guaranteed once per day for any session that spans midnight.
Steps to reproduce
- Start a session with a large context and make a few turns (warm the prefix cache).
- Edit an instruction file (e.g.
AGENTS.md or memory.md) mid-session.
- Send another message. The system message hash changes and the follow-up reports 0 cached tokens, re-prefilling from token 0.
OpenCode version
1.18.30
Operating System
Linux (reproduces on all platforms)
Related: #29584 (closed stale), #36483, #43722. Proposed fix: #48777 (rebased from #33246).
Description
The system prompt is rebuilt on every request:
instruction.system()re-reads the instruction files (AGENTS.md,CLAUDE.md,memory.md, …) andsystem.tsinjectsToday's date. Any change to that prefix — editing an instruction file during a session, or the date rolling over at midnight — changes the system message, so the provider's cached prefix diverges at token ~0 and the entire conversation is re-prefilled.On a long session (1M-context model) that's ~450K tokens re-prefilled (~4 minutes) with no signal in the UI — it just looks like the model is thinking. It affects every provider, not just Anthropic, and the date case is guaranteed once per day for any session that spans midnight.
Steps to reproduce
AGENTS.mdormemory.md) mid-session.OpenCode version
1.18.30
Operating System
Linux (reproduces on all platforms)
Related: #29584 (closed stale), #36483, #43722. Proposed fix: #48777 (rebased from #33246).