editDocument
Replace exact text in a document to create a new revision while preserving history and re-resolving wikilink edges.
Instructions
Edit a document by exact string replacement (Claude-Code Edit semantics): oldString must match the current body exactly and be unique unless replaceAll. The result is ingested as a new revision (history kept; wikilink edges re-resolved; removed links forgotten) and the vault file refreshes. Use writeDocument to replace a whole body. Result counts (edges, unresolved) are whole-document snapshots after the edit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Vault-relative path of the document to edit. | |
| scope | No | Disambiguates when the same path exists in more than one scope. Omit when the path is unambiguous. An edit never changes a document's scope; it is preserved. | |
| newString | Yes | Replacement text. Must differ from oldString. | |
| oldString | Yes | Exact text to replace. Must match the current body exactly (including whitespace) and, unless replaceAll, be unique in it. | |
| replaceAll | No | Replace every occurrence instead of requiring oldString to be unique. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Absolute path of the materialized vault file. | |
| name | Yes | entities/{uid} resource name of the document-as-entity. | |
| path | Yes | ||
| edges | No | Total resolved wikilink and frontmatter edges the whole document holds after this write (snapshot, not a delta — counts all [[links]] in the current body that resolved, regardless of how many were already in the graph). | |
| changed | Yes | False when the content matched the latest revision (no-op). | |
| warnings | No | Non-fatal advisory messages — e.g. a title-collision warning when the document's display name shadows a non-document entity. Does not affect the written content; the document body is stored byte-for-byte as supplied. Omitted when empty. | |
| reconciled | No | Count of wikilinks in OTHER vault documents that this write newly made resolvable (cross-document reconcile pass; separate from the document's own edge snapshot above). | |
| unresolved | No | Count of [[wikilinks]] left dangling in the whole document after this write (snapshot, not a delta). | |
| documentUid | Yes | ||
| pendingEdit | No | True when the vault file holds an un-ingested manual edit and was left untouched. | |
| revisionUid | No | ||
| unresolvedTargets | No | The dangling wikilink targets by name (text inside [[…]] that matched nothing) — fix a typo or create the target. Omitted when none dangle. |