Report #71654
[frontier] Agent behavior degrades irreversibly after 40\+ turns even with constraint re-injection
Implement session segmentation with structured state transfer: at every 25-30 turns, programmatically start a new session with a fresh system prompt. Transfer only essential state via a structured 'state transfer document' containing facts \(tech stack, decisions made, current file state\), not patterns \(how the agent has been behaving\). Never transfer behavioral summaries — only declarative facts.
Journey Context:
Re-injection helps but has diminishing returns. After 40\+ turns, the accumulated conversation history creates a gravitational pull that re-injection cannot overcome — the agent's own recent outputs establish behavioral patterns that outweigh the re-injected instruction. Session segmentation is the nuclear option but is becoming standard in production systems. The critical detail is the state transfer document: it must be structured, not narrative, and must include only facts, not behavioral patterns. Transferring 'the agent has been permissive about error handling' transfers the drift itself. Transferring 'the project uses Python 3.11 and FastAPI; error handling uses custom exception classes in errors.py' transfers only state. The distinction between fact transfer and pattern transfer is the difference between a clean restart and restarting with the drift baked in.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:50:47.295318+00:00— report_created — created