Context Compaction Amnesia and Missing Post-Write Verification Gates

I am reporting two reliability issues observed in long-running Google Antigravity coding-agent sessions:

Automatic context compaction was followed by code modifications made without revalidating previously inspected source files.

Large source files were generated in single write_to_file calls, with no documented post-write review or verification before task completion.

These are harness-level reliability concerns, not merely model-quality issues.

Issue 1: Context compaction followed by source-state loss

The session logs recorded two automatic compaction events, The checkpoint stated:

Resuming from a compaction — you have lost access to the full conversation history

After the first compaction, the agent continued modifying previously inspected code without adequately revalidating the original source definitions.

During subsequent iterations, it introduced six nonexistent identifiers and replaced a previously established initialization constraint with an incorrect hardcoded limit.

Following the second compaction, the agent introduced inconsistent contract identifiers across related modules, breaking their integration.

The central concern is that the harness allowed the agent to continue editing source code without re-establishing source-grounded information after context loss.

Issue 2: Large one-shot file generation without verification

In a separate coding task, the agent created two substantial source files:

File A: 2,160 lines, 27,745 generated tokens, one write_to_file call.

File B: 995 lines, 17,879 generated tokens, one write_to_file call.

The observed session ended without reopening these files or conducting a documented comparison against previously established requirements.

Hi @Hello_there,

Welcome to the Forum,

Thank you for the feedback. To preserve source definitions across context compactions and enforce verification after large file writes, we recommend the following workaround:

  • Add a standing rule in ~/.gemini/GEMINI.md (or a workspace .agents/rules/ markdown file) requiring the agent to re-read target files with view_file after a # Resuming from a compaction checkpoint. Keep shared contract identifiers and initialization limits explicitly in that rule file to ensure they survive context truncation.
  • Run /compact with explicit preservation instructions (for example, /compact Preserve exact contract identifiers, initialization limits and inspected file paths verbatim) before starting a new module phase. Furthermore, prompt the agent to apply incremental edits using replace_file_content rather than single-call full-file rewrites.