vault_patch
Apply exact find-and-replace edits to Obsidian vault files, supporting one or multiple sequential patches. Validates each match and auto-commits changes to git after successful application.
Instructions
Surgical find-and-replace in a vault file with auto git commit.
Supports single or multi-replacement. For a single replacement, provide
find and replace. For multiple replacements, provide patches
— a list of {"find": "...", "replace": "..."} dicts applied in
sequence. Do not mix both modes.
Each find value must appear exactly once in the file (after prior
patches in the list have been applied). If any patch fails validation,
no changes are written.
Uses 3-pass cascading match: exact → body-only → whitespace-normalized.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | No | Exact text to find (single mode). Empty = not set. (Use `find`/`replace`, NOT `old_string`/`new_string` — those are accepted as aliases.) | |
| path | Yes | Relative path to the file within the project. | |
| commit | No | If True, commit synchronously before returning. Defaults to False, which queues the path for the reconciler. See ``vault_write`` docstring for the durability contract. | |
| patches | No | List of {"find", "replace"} dicts (multi mode). | |
| project | Yes | Project slug or '_meta' for cross-project content. | |
| replace | No | Replacement text (single mode). Empty = not set. | |
| new_string | No | Alias of `replace` (#151). Prefer `replace`. | |
| old_string | No | Alias of `find` (#151). Prefer `find`. | |
| idempotency_key | No | Optional at-most-once token. If set, a retry with the same key is a no-op after the first apply (ADR-013). Empty (default) disables idempotency. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |