## Decision

`--replace-body` is refused when the file's `content_hash` differs from the document's
`acknowledged_hash`: the hash of the version docir last **wrote**, or last **returned in
full** through `get`. The question the guard answers is "did the file change since docir
last showed it to, or wrote it for, a caller?", not "does the file differ from the
index?".

A document with no acknowledgement (new to the index through a clone, a pull or a rebuild)
is refused a whole-body replace until it has been read. Comparing it with the index
instead would be blind in exactly the case this decision exists for, because the watcher
keeps the two equal.

Only `--replace-body` consults it. Every other mode composes with the file as it is on
disk, so the asymmetry issue-be95d3e242a3 records stands unchanged.

## Why the index was the wrong reference

The index is a projection that something keeps catching up. The daemon's watcher runs
`reindex --changed` within a second of any change under `docs/`, so the index and the
file agree again long before an agent's next write, and a guard that compares the two
never fires with the daemon up (issue-5e61f46f19f8). That cannot be fixed by making the
watcher slower or by excluding bodies from it: the watcher exists so that every read
answers from a current index.

## Who advances it

- **Writes that return the document** — `add`, `update`, `archive`, `unarchive` — set it
  to what they wrote. Their response carries the whole document, so the caller has been
  shown exactly what is now on disk, hand edit included.
- **A full `get`**, single or batched, sets it to what it returned. `get` reads the
  **file**, not the index; otherwise the refetch the refusal asks for shows the version
  without the edit and acknowledges a body nobody saw.
- **Mechanical rewrites** — `tag rename`, `tag rm --force`, the edge strip of
  `delete --force`, and `check --fix` — *carry* it: it moves to the rewritten hash only if
  it stood at the hash of the version they rewrote. Their output names ids, not bodies,
  so they may keep a caller's knowledge valid across their own change but must not grant
  any.
- **Nothing else.** `reindex` (full or `--changed`, and so the watcher) and the store
  bootstrap never write it, and a rebuild keeps the stored value for every id that
  survives. A section read (`get --section`) does not: the caller has not seen the rest.
  `docir build` reads every body with `acknowledge: false`, because rendering a site is
  nobody's read. A federation peer is never written — its `DocumentService` is built with
  `acknowledge_reads=False`, on top of the read-only connection (adr-fb938175f72a).

## Consequences

- It is still not optimistic concurrency control. The acknowledgement is per document,
  not per caller, so a second agent's `get` or write licenses the first agent's replace.
  What it sees is every change made *around* docir — a hand edit, a merge, a pull —
  whatever has re-indexed it since.
- `get` now writes to the index when what it shows differs from the stored value, and
  only then, so repeated reads take no write lock.
- The value lives only in the index (migration `0014`), like the id counter, and the files
  cannot restore it: a deleted index loses every acknowledgement, and the old comparison
  is what remains. A document new to the index — a pull, a merge, a fresh clone — starts
  with none for the same reason, and with the daemon up the fallback cannot see a hand
  edit made to it before anyone read it. Reading first is what arms the guard.