The Day a Scheduled AI Agent Erased 31,000 Lines — append-only discipline and verify-first detection An engineering team reported that a scheduled AI agent erased 31,318 lines from a 31,323-line shared roadmap file 52 seconds after a PR merge, because the agent performed a whole-file Write without reading existing content and its checkout had not caught up. The team recovered the file from the last-good git commit and now restricts automated agents to anchored tail appends, backed by a CI or pre-receive hook that rejects any tracked file shrinking by more than a set line threshold. Automated AI agents are convenient — until a task as simple as "update a file" turns into a destructive operation. This post uses a real ROADMAP truncation incident from our operations to explain the append-only discipline that keeps scheduled agents from destroying large shared files, and the verify-first pattern that caught the damage immediately. Our growth-strategy log, GROWTH STRATEGY ROADMAP.md , had grown to a single file of 31,323 lines . Then, 52 seconds after a PR was merged to main, a scheduled "roadmap update" agent fired an automated commit. The commit looked like this: 1 insertion + , 31,318 deletions - The file was wiped down to a few header lines. The cause was simple: the agent wrote back an "updated" version with a full Write whole-file overwrite without reading the existing content first. Right after the merge its checkout hadn't caught up, so the agent treated near-empty content as the source of truth and overwrote everything. What saved us was an operating rule: treat the prompt's premises as hypotheses and always cross-check them against date / KPI / git / PR / issue state . At the start of the next session, the state check flagged "the ROADMAP is abnormally short" instantly, and it was handled as an incident. Recovery itself was a one-liner thanks to git: Restore the file from the last-good commit git show