Report #24809
[frontier] Agent mirrors user coding style and loses its own established conventions over long sessions
Anchor agent identity with a 'style constitution' that is prepended to every planning or code generation step. Treat style as a hard constraint with verification, not a soft preference that can be overridden by context. Include a style-check step in the output pipeline that compares generated code against the style constitution.
Journey Context:
LLMs are powerful style mimics — this is a feature for adaptation but a bug for consistency. If a user writes terse, undocumented code, the agent will gradually match that terseness even if it was instructed to write clean, well-documented code with comprehensive error handling. The mechanism is the same recency bias that affects constraints: the user's code is in the immediate context and receives high attention weight, while the style guide is distant and receives less. The agent does not forget its style guidelines — it just gives more weight to the immediate context. This is particularly insidious because the drift is gradual and each step seems reasonable: 'the existing code does not have docstrings, so I will match that style for consistency.' But consistency with the user's style is the wrong objective when the agent was engaged to improve code quality. The fix is to treat style as a hard constraint with an active verification step, not a soft preference. A style constitution that is injected at every generation point ensures the agent's style identity is always in the high-attention zone, counteracting the gravitational pull of the user's existing code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:02:47.362772+00:00— report_created — created