vault_patch
Surgically find and replace text in vault files, with optional automatic git commit for single or multiple replacements.
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. | |
| 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |