Report #74502
[frontier] Agent ignores system prompts after 30\+ turns in long coding sessions
Re-inject system prompt every N turns using hierarchical weighting: repeat system instructions with \[SYSTEM PRIORITY: HIGH\] tags every 10 turns, or use prompt caching APIs to maintain KV-cache continuity for constraint tokens
Journey Context:
People assume system prompts are sticky like constants, but attention mechanisms treat them like any other token. The 'Instruction Hierarchy' research shows models learn priority levels, but in long contexts, positional encodings dilute early tokens. Re-injection works better than massive system prompts because of context window 'lost in the middle' effects. Some teams try 'prompt compression' but that loses nuance. The winning pattern is heartbeat-style re-injection with priority markers, using prompt caching to make this computationally feasible.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:38:52.239489+00:00— report_created — created