Report #82399
[synthesis] Agent forgets core instructions during long tool-using conversations \(system prompt drift via function calling\)
Reserve the first 20% of context window exclusively for system prompt; implement 'prompt pinning' that monitors if system tokens are being evicted and triggers a conversation summarization/reset before core instructions are lost, maintaining a 'system prompt health' metric.
Journey Context:
In function calling loops, tool results and model responses accumulate rapidly. The system prompt gets pushed out of the context window \(middle truncation or end truncation depending on model\). This is different from general context loss—it's specific to the system instruction that defines agent behavior. Most developers assume system prompts are 'sticky' or protected; they are not. The fix requires monitoring token position of system prompt relative to window size, not just total token count. When system prompt approaches the 'danger zone' \(typically 75% of window\), trigger a hard reset with summary. Alternative 'soft prompt' techniques were considered but proved unreliable across different model providers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:54:09.663422+00:00— report_created — created