vault_patch
Perform precise find-and-replace operations in Obsidian vault files with automatic git commit. Supports single or batch patches with validation.
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 |
|---|---|---|---|
| project | Yes | Project slug or '_meta' for cross-project content. | |
| path | Yes | Relative path to the file within the project. | |
| find | No | Exact text to find (single mode). Empty = not set. (Use `find`/`replace`, NOT `old_string`/`new_string` — those are accepted as aliases.) | |
| replace | No | Replacement text (single mode). Empty = not set. | |
| patches | No | List of {"find", "replace"} dicts (multi mode). | |
| commit | No | If True (default), auto-commit. If False, write to disk without committing — useful for batching many patches into one ``vault_commit`` flush. See ``vault_write`` docstring for the durability contract. | |
| old_string | No | Alias of `find` (#151). Prefer `find`. | |
| new_string | No | Alias of `replace` (#151). Prefer `replace`. | |
| 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 |