Change a document
doc_updateChange a document or directory that exists. Every change commits or is refused; expected_commit (from action=document's trailer) refuses one that has changed since you read it, with what is there now. A change to a section another agent has claimed is refused unless override_claim=true, which they see. A document open in somebody's editor takes the change into their session. Actions — edit: replace old_string with new_string (replace_all for every occurrence), or add append at the end of the document or of a section; with span, new_string replaces that one block (or old_string inside it) however large the document; refused, with the current text, if old_string is missing or ambiguous, the frontmatter would break, or another writer committed first. replace: replace a whole document's content (location or node, content); refused when nothing is there. move: rename in place (from, name) or move (from, to: the whole new location), keeping id, history and comments. A rename needs editor on everything it moves; a move to another directory needs a manager of the whole organization, so an agent delegated over folders rather than the whole organization cannot move between them. A move that widens who can reach it is refused naming who gains, until acknowledge_access_change=true. A document another agent has claimed is refused unless override_claim=true, which they see. restore: undo the last delete at a location, with its sharing; restoring twice finds nothing the second time. restore_version: put an earlier version of a document back (location or node, commit from browse action=versions), as the console's Restore this version does: its text becomes a NEW version on top, so nothing in the history is rewritten or lost, and the document's current metadata is kept. Needs editor; expected_commit refuses it if the document changed since you read it.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "doc_update"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | move: the whole new location including the name, e.g. wiki/archive/attention.md; a folder's link moves it into that folder. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too. | |
| from | No | move: the document or directory's whole location, e.g. wiki/attention.md. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too. | |
| name | No | move: the new last segment, to rename in place, e.g. self-attention.md (no slash) | |
| node | No | edit, replace, restore_version: the document's id, as returned beside its location — survives a rename or a move, so a citation written into a stored document keeps pointing at the right thing. Give this OR location, never both. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too. | |
| seat | No | the seat token identity_write action=take_seat gave you; pass it on every call while you drive that agent, and each call that carries it keeps the seat yours for a whole lease from that call | |
| span | No | edit: a block's span id (search within, browse action=spans): new_string replaces that one block, or, with old_string, old_string inside it; the rest of the document is not read back to you | |
| action | Yes | what to do; each action takes the arguments its line names | |
| append | No | edit: text to add at the end of the document, or of `section`, instead of replacing anything | |
| commit | No | restore_version: the version's commit hash, as browse action=versions lists it (any lowercase prefix of at least 7 hex characters that names one) | |
| content | No | replace: the whole document. Set metadata with YAML frontmatter at the top of `content`: `type` (one of: meeting-notes, playbook, spec, brand-asset, web-clip, contract, misc — anything else becomes misc), `title`, `summary`, and `tags` as a list. `tags` is the write-side spelling of what the listing tools call `label`. `status` takes `active` or `inactive` and is not a label: `inactive` retires a document — search and listings stop showing it, while whoever may write it still opens it by location or node, and removing the line brings it back. Omit it unless you mean to retire something. `aliases` (a list, or one name) are other names search how=titles finds the document by; a [[link]] still needs its file name or title. Any other key you write (`sources`, …) is kept as written and comes back on read; key order may change. A block that does not parse as YAML is refused, naming the line, and nothing is written: quote a value that contains ": " (summary: "a: b"). | |
| section | No | edit: with append: the heading text of the section to add to the end of, exactly as written after the #s ("Log" for "## Log"), the same as claim's span; refused if no heading or several have that text. Omit for the end of the document | |
| location | No | edit, replace, restore_version: full path from the workspace root, e.g. "handbook/vendor/acme.md". Give this OR node. A path is what a person reads; a node is what survives somebody reorganizing. · restore: full path from the workspace root, e.g. "handbook/vendor/acme.md" (as printed by browse action=documents or search). A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too. | |
| acting_as | No | an agent identity below you, or one working in a folder you can write (pass its seat too), by its id (from identity_write action=spawn) or its @handle (brief_me lists your agents with both), to make this one call as, with that agent's narrower access; for a helper whose session signs in as its person | |
| new_string | No | edit: what to put in its place | |
| old_string | No | edit: exact text to replace — must appear in the current body (with new_string; not with append) | |
| replace_all | No | edit: replace every occurrence (default: refuse if more than one) | |
| override_claim | No | edit: write even though another agent has CLAIMED the section you are changing. Logged, and they will see it. Default: refuse and name the holder. · replace, restore_version: write even though another agent has CLAIMED this document. Logged, and they will see it. Default: refuse and name the holder. · move: move even though another agent has CLAIMED a document this moves. Logged, and they will see it. Default: refuse and name the holder. | |
| expected_commit | No | edit: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters, and a part's pin with its #part). Refuses if that document has changed since. · replace: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since, and refuses a part's pin (ending #part): this overwrites the whole document. Omit to replace whatever is there now. · restore_version: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since, and refuses a part's pin (ending #part): this overwrites the whole document. Omit to restore over whatever is there now. | |
| idempotency_key | No | Any unique string you choose for this write, e.g. a UUID. If you retry the call with the same key and the same arguments, the first answer is returned and nothing is done twice. Reusing a key for a different request is refused. Keys are kept 24 hours. | |
| acknowledge_access_change | No | move: true once you have seen who gains reach and mean it |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ||
| from | No | ||
| text | No | the answer as prose, for an action that answers in prose | |
| spans | No | the blocks this write added or edited, in document order; absent when no commit was written | |
| action | Yes | the action that answered | |
| commit | No | the head of the folder the move landed in, not the moved document's own commit, so not an expected_commit (read the document for that); null for a top-level folder's rename, which writes no commit | |
| stored | No | what the document's head stores after this call, to check against what was sent (#1492) | |
| changed | No | the documents that moved, a directory's documents included, the first 25 by path; directories themselves are not listed | |
| appended | No | append only: what this call added | |
| location | No | the whole path from the workspace root this write resolved to; present on a successful write | |
| restored | No | what the restore put back, and the new version it made of it | |
| changed_total | No | how many documents moved, whether or not changed lists them all |