My agent overwrote a wiki page

It happens on the first day more than any other: an agent that has just been connected calls wiki_updatePage on a page that already exists, and the page is replaced. Here is why nothing is lost, and what to change so it stops.

What happened

wiki_updatePage replaces the whole page. An agent that calls it without expected_version on a page that already exists gets its way — the result carries a warning saying so, but the previous text is gone from the page.

Nothing is lost: open the page, and the byline under the title says who did it and when. History lists every version; Restore the previous version puts back what was there, as a new version attributed to you. See History and conflicts.

The fix is the prompt: the snippets in Teaching your agent teach wiki_patchPage against the version the agent read, and wiki_updatePage only with expected_version. A stale write is then refused with a diff instead of landing.