mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-06 07:12:54 +08:00
Source-grounded rewrite of 529 published docs pages with per-unit information-loss verification: 1,713 factual corrections cited to src/**, generated surfaces regenerated, frontmatter titles preserved for i18n, release notes pages untouched. All docs gates green. Closes #100141
2.0 KiB
2.0 KiB
summary, read_when, title
| summary | read_when | title | ||
|---|---|---|---|---|
| Apply multi-file patches with the apply_patch tool |
|
apply_patch tool |
Apply file changes using a structured patch format. This is ideal for multi-file
or multi-hunk edits where a single edit call would be brittle.
The tool accepts a single input string that wraps one or more file operations:
*** Begin Patch
*** Add File: path/to/file.txt
+line 1
+line 2
*** Update File: src/app.ts
@@ optional change context
-old line
+new line
*** Delete File: obsolete.txt
*** End Patch
Parameters
input(required): Full patch contents including*** Begin Patchand*** End Patch.
Notes
- Patch paths support relative paths (from the workspace directory) and absolute paths.
tools.exec.applyPatch.workspaceOnlydefaults totrue(workspace-contained). Set it tofalseonly if you intentionally wantapply_patchto write/delete outside the workspace directory.- Use
*** Move to:within an*** Update File:hunk to rename files. *** End of Filemarks an EOF-only insert when needed.- Enabled by default for every model. Set
tools.exec.applyPatch.enabled: falseto disable it, or restrict it to specific models withtools.exec.applyPatch.allowModels(accepts raw ids likegpt-5.4or full ids likeopenai/gpt-5.4). - Config lives under
tools.exec.applyPatch.*.
Example
{
"tool": "apply_patch",
"input": "*** Begin Patch\n*** Update File: src/index.ts\n@@\n-const foo = 1\n+const foo = 2\n*** End Patch"
}