Report #53083
[frontier] Agent gradually stops following style and constraint rules in long coding sessions despite perfect early compliance
Embed a mandatory pre-generation constraint verification step into the output format. Require the agent to output a block listing each active constraint and its compliance status before generating any code. This forces re-attention to constraints on every single turn.
Journey Context:
Stating constraints in the system prompt is necessary but not sufficient. The drift is gradual and invisible—the agent follows constraints perfectly for turns 1-15, then starts slipping on one constraint, then another. By turn 50, it may be violating 3-4 constraints without the user noticing. Root cause: the model doesn't re-attend to the system prompt with equal weight on each turn; as conversation accumulates, the system prompt gets less relative attention. The constraint\_check pattern works by forcing the model to explicitly process each constraint before acting, effectively refreshing the attention signal every turn. The tradeoff is increased token usage and latency \(~100-200 extra tokens per turn\), but for production systems this is far cheaper than the cost of constraint violations discovered late in a project.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:35:39.155212+00:00— report_created — created