Edit, append, compact, or restore a doc
doc_editEdit or restore existing documents and task pages by patching text, appending sections, compacting notes, or undoing changes; use table and task-note tools for tables and logs.
Instructions
Change or undo an existing doc or task page; tables via doc_edit_table, task logs via task_note. Prefer patch (old or section/from+to+print) over rewrite. append adds at the end, under under, or to assistant notes (task ID)/Diary.
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": {
"doc": "<doc>",
"mode": "<mode>"
},
"name": "doc_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | For `patch`: 1-based end line (defaults to EOF; with `from` only) | |
| doc | Yes | Doc ID, task-page filename, or task ID (for `append`, `digest_task_notes`, `restore`) | |
| old | No | For `patch`: unique verbatim passage to replace (not with `section`/`from`) | |
| echo | No | Return lines around the change (`patch`/`append`) | |
| from | No | For `patch`: 1-based start line (requires `print`) | |
| mode | Yes | `digest_task_notes` compacts assistant notes | |
| No | Card/read fingerprint; required for `rewrite`, `compact`, positional `patch` | ||
| under | No | For `append`: exact heading text to append under | |
| content | No | New text for every mode but `restore` ("" deletes in `patch`; <=6,000 for `digest_task_notes`) | |
| section | No | For `patch`: 0-based heading index from card (requires `print`) | |
| version | No | For `restore`: target version ID from `workspace_read(view="versions")` | |
| even_if_more | No | For `restore`: also undo newer edits, once read | |
| person_asked | No | For `compact`: the person asked, on a doc they began | |
| keep_compaction | No | Confirm keeping prior compaction on user request |