The Day Antigravity Replaced Our Stylesheet
An AI agent was asked to darken a heading color slightly. It replaced the entire stylesheet. The fix took ten seconds because we had committed before the run. The lesson is permanent: 'make this slightly darker' is not an instruction an agent can act on without inventing the rest.
At 19:00, we asked an agent to darken one headline. At 19:01, it had rewritten the entire stylesheet.
Here is the timestamped log: what broke, why it broke, and why recovery took ten seconds instead of two hours.
What happened
| Item | Detail |
|---|---|
| Tool | Antigravity, running inside VS Code |
| What we asked for | Darken the hero section's headline color slightly |
| What the agent did | Replaced the entire stylesheet from scratch |
| Visible result | Site layout completely broken on reload |
| Recovery | git restore on the file. Ten seconds, end-to-end |
The timeline
| Time | Event |
|---|---|
| 19:00 | Sent the request: "the hero headline color is a bit too light, please darken it" |
| 19:01 | Agent decided the existing stylesheet was "not optimal" and rewrote the whole file |
| 19:02 | Reload showed a broken layout — spacing, color overrides, custom utilities all gone |
| 19:03 | git diff --stat showed the 487-line file had been replaced |
| 19:04 | git restore src/css/style.css brought the site back |
The agent's reasoning, when we read the diff, was internally consistent. It saw an "outdated" stylesheet, decided to bring it up to a modern baseline, and produced a clean rewrite that included the requested color change. The rewrite was clean in isolation. It just solved a problem we had not asked it to solve.
Why it happened
Three failure points compounded.
The instruction was too loose. "A bit too light, please darken it" gave the agent room to interpret what counted as a fix. With a loose instruction, "fix the color" can become "fix the file." Agents do not draw the line for you.
The scope was implicit. We assumed the agent would touch the relevant selector. The agent assumed the entire stylesheet was in scope. Neither of us said which.
We gave it no off-limits line. Nothing in the prompt said "do not modify any other property." Without that line, every other property in the file was fair game.
The agent did exactly what was allowed. The instructions were the problem.
Why the recovery worked
Earlier in the day, we had run:
git add -A
git commit -m "before agent change"
That thirty-second habit is the only reason this became a Field Notes piece instead of a story about losing several hours of styling work. With the commit in place, recovery is one command, which reverts that file to the last committed version:
git restore src/css/style.css
For a version-controlled file, that is the whole recovery procedure. The same principle applies to documents in Notion, Google Docs, or any tool with version history — confirm a snapshot exists before the agent runs.
Where the recovery fails
A few patterns we have seen turn a recoverable incident into a real loss:
| Pattern | Why it breaks recovery | What to do instead |
|---|---|---|
| No commit before the agent run | git restore returns to the last commit. If there is none, there is nothing to return to |
Always commit before delegating destructive work |
| You edited the file yourself between the commit and the agent | A blanket git restore discards your edits along with the agent's |
Commit your own changes first, or work on a branch |
| Multiple files were changed, you only restored one | The unrestored files keep the agent's edits, leaving inconsistencies | Run git diff --stat first to see every changed file, then decide |
The reusable template
After this incident, every CSS request we send to an agent uses this format:
Target: [file] → [selector]
Change: [property] from [current value] → [new value]
Off-limits: any other selector or property in this file
Done when: git diff shows only the change above on the named selector
Applied to the original incident, the prompt would have read:
Target: src/css/style.css → .hero__title
Change: color from current value → #1a1a1a
Off-limits: any other selector or property
Done when: git diff shows only color changing on .hero__title
A four-line block, thirty seconds to write. Writing it takes about as long as hoping the agent guesses correctly once. Skipping it costs whatever you planned to do with the next two hours.
Four lessons
- Version control is the cheapest insurance there is. The thirty seconds it takes to commit is the entire defense against most agent disasters.
- "A bit," "slightly," and "a little" are not instructions an agent can act on without inventing the rest.
- In our experience, stylesheets are unusually risky. Agents seem to treat them as opportunities for "improvement" more than other file types. The same effect appears with config files, prompt libraries, and template files — anything that looks like it could be tidier.
- The off-limits line does most of the work. "Do not change anything else" turns a vague instruction into a bounded one.
Related reading
- The AI Task Delegation Checklist — the pre-flight you run before delegating to any agent
- Three Ways AI Agents Break Your Work — the broader pattern this incident fits into