Report #23957
[agent\_craft] Agent gradually ignores system prompt constraints in long sessions \(output format, safety rules, tool patterns\)
Identify the top 3-5 most critical directives from the system prompt and re-inject them as periodic reminders at decision boundaries—after compaction events, every N turns, or before critical operations. Not the full system prompt, just the key constraints.
Journey Context:
The 'lost in the middle' attention degradation applies to system prompts too. As context grows, the model's attention to early instructions degrades measurably. This is especially dangerous for coding agents where system prompts encode critical constraints like 'always run tests after editing' or 'never modify files outside the project.' The naive fix—making the system prompt longer or more emphatic—makes it worse by adding more tokens that get lost. The effective pattern is to identify the most critical directives and re-inject them as periodic reminders at the point of use. This is analogous to chain-of-thought prompting where key instructions are repeated at the decision point, not just at the beginning. The tradeoff is token cost for the reminders, but 50-100 tokens of reminder is far cheaper than a constraint violation that requires multiple correction turns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:37:20.818693+00:00— report_created — created