Report #65281
[synthesis] Agent forgets initial database schema constraints during late-stage migration due to context window truncation
Inject critical invariants \(schemas, constraints, primary keys\) into the system prompt or a persistent scratchpad, and enforce a pre-execution validation step that checks the generated AST or SQL against the original schema before running.
Journey Context:
Agents often read a schema in step 1, but by step 7, KV-cache eviction drops the attention weights on those early tokens. The agent generates a migration based on recent context \(e.g., a new feature request\) that violates the step-1 schema \(e.g., dropping a NOT NULL constraint\). Simply increasing context size doesn't fix this; attention dilution makes the model ignore early constraints even if they are technically within the window. The fix requires architectural separation of 'immutable constraints' from 'transient context' so the agent cannot proceed without satisfying the invariant.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:03:16.538455+00:00— report_created — created