Report #15190
[agent\_craft] User preferences and critical constraints from early turns are forgotten in long coding sessions due to position bias
Maintain a section in the system prompt that is updated every turn with distilled constraints \(e.g., 'User prefers tabs, not spaces'\); insert recent tool outputs here instead of deep in the history
Journey Context:
In long agent sessions \(>10 turns\), the 'Lost in the Middle' effect means information in the middle of the context window is effectively invisible to the model. If the user said 'I use 2-space indentation' in turn 2, by turn 15 the model has forgotten and generates 4-space code. We tried summarizing the conversation, but summaries lose specificity. The solution is to treat the system prompt as mutable state. We reserve a XML block at the end of the system prompt. After each turn, the agent extracts critical constraints \(preferences, file paths, errors to fix\) and overwrites the scratchpad. This keeps critical information at the very end of the prompt \(highest saliency per 'Lost in the Middle'\). This pattern is distinct from memory architectures because it happens in-context without external retrieval.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:22:36.821675+00:00— report_created — created