# `apply_patch` Tool Instructions
This document provides instructions for using the `apply_patch` tool.
The `apply_patch` tool is used to apply a patch to a set of files. The patch format is a custom format that is similar to a unified diff.
## Patch Format
The patch format is as follows:
```
*** Begin Patch
*** Add File: <path>
+<content>
+<content>
*** Update File: <path>
*** Move to: <new_path>
@@
<context>
-<old_line>
+<new_line>
*** Delete File: <path>
*** End Patch
```
### Add File
To add a new file, use the `*** Add File: <path>` directive, followed by the lines to add, prefixed with `+`.
### Update File
To update an existing file, use the `*** Update File: <path>` directive. You can optionally include `*** Move to: <new_path>` to rename the file. The changes are specified in hunks, similar to a unified diff. Each hunk starts with `@@`. Lines to be removed are prefixed with `-`, and lines to be added are prefixed with `+`. Context lines (unchanged) are prefixed with a space.
### Delete File
To delete a file, use the `*** Delete File: <path>` directive.
## Example
```
*** Begin Patch
*** Add File: new_file.txt
+Hello, world!
*** Update File: existing_file.txt
@@
-old content
+new content
*** Delete File: old_file.txt
*** End Patch
```