update_doc
Edit documents by replacing the body with version-checked writes that reject concurrent changes, or append text safely without reading first. Use append for reports, decisions, and logs.
Instructions
Edit a document. Replacing the body REQUIRES base_version — the version you got from get_doc — and the write is refused with a 409 if anyone changed the document since, so you can never silently overwrite someone else's edit. To add to the end, pass append instead: it needs no base_version, cannot conflict, and does not make you read the document first. Prefer append for reports, decisions and logs. The doc argument accepts an old path or a bare slug too; the reply then carries moved_to (the current path). Note the two different 409s: a stale base_version, and an ambiguous bare slug (repeat with the full path or UUID).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | Document UUID, or a slug path like 'architecture/adr/adr-004' (a path also needs project_id). A path survives the document being moved: the old path still resolves, and so does a bare slug ('adr-004') when exactly one live document in the project has it. When the reference was not the live path, the reply carries moved_to — the document's current path; use that from now on. A bare slug shared by several documents is a 409 ('Ambiguous document slug') listing the full paths: pick one and repeat the call with the full path or the UUID. The UUID never changes. | |
| body | No | Replacement markdown for the WHOLE document. Requires base_version. | |
| title | No | New title. | |
| append | No | Text to add to the END of the document. No base_version needed. Cannot be combined with body. | |
| position | No | New sort position among siblings. | |
| parent_id | No | New parent document UUID. | |
| project_id | No | Project UUID. Required only when doc is a slug path. | |
| base_version | No | The version you read from get_doc. Required for any write other than append. |