# Keep a newer edit in a shared Word agreement

Two sessions read the same fee in a synthetic service agreement. A reviewer commits a change. A second session attempts to write a proposal using its earlier revision. SuperDoc reports `REVISION_MISMATCH` and the reviewer’s fee remains in the shared agreement.

## Run the example

Requires Node.js 22 or newer. Run in an empty local directory.

```sh
npm install --save-exact @superdoc/sdk@2.33.0 @hocuspocus/server@2.15.3
curl -fsSLO https://www.superdoc.dev/examples/legal-tech-room-revision.mjs
curl -fsSLO https://www.superdoc.dev/testkit_docs/template-service-agreement.docx
node legal-tech-room-revision.mjs
```

The script starts a local Hocuspocus server, opens one room from the public sample, and checks the rejected proposal and current value. The expected result is `REVISION_MISMATCH` with a retained fee of `$1,350,000.00`. The example uses document operations and two SDK sessions. It needs no model, provider API key, or production room.

Production deployments need the write admission extension and must route guarded writers for a room to the same server process. Read the current room state before retrying a write when the outcome is uncertain. Your application owns authentication, authorization, storage, and the decision to rebuild or present a proposal.

- [Read the room-scoped revision guide](https://docs.superdoc.dev/editor/collaboration/reject-stale-writes/)
- [Download the runnable source](https://www.superdoc.dev/examples/legal-tech-room-revision.mjs)
- [Download the synthetic service agreement](https://www.superdoc.dev/testkit_docs/template-service-agreement.docx)
- [Review redlines in a Word agreement](https://www.superdoc.dev/solutions/legal-tech)
