Motivation
When performing refactors, renames, or multi-file changes, the agent must make multiple sequential writeFile/fileEdit calls. A patch tool allows atomic-ish multi-file operations in a single tool call.
Two of three reference projects have this as a core tool.
What the tool should do
Apply a structured patch that can add, update, delete, and move files in a single call.
Reference implementations
opencode (TypeScript)
- Custom patch format with Begin Patch / End Patch markers
- Supports: Add File, Update File, Delete File, Move File
- LSP diagnostics for all modified files
- Formatter integration
openclaw (TypeScript)
- OpenAI-style patch envelopes (Begin Patch / End Patch)
- Workspace-only restriction by default
- Sandbox bridge support
hermes-agent (Python)
- V4A patch format support (compatible with Codex, Cline)
- V4A supports: Update File, Add File, Delete File, Move File
- Fuzzy matching within update hunks
Requirements
- Add new file - Create a file with specified content
- Update existing file - Apply text replacements (like FileEditTool but within a patch)
- Delete file - Remove a file
- Move/rename file - Move from one path to another
- Workspace confinement - All paths must be within workspace root
- Diff preview - Return unified diff for each modified file
Suggested location
client/runtime/src/main/java/dev/omatheusmesmo/qlawkus/tool/shell/ApplyPatchTool.java
Config properties
qlawkus.file.patch.enabled (boolean, default true)
Motivation
When performing refactors, renames, or multi-file changes, the agent must make multiple sequential writeFile/fileEdit calls. A patch tool allows atomic-ish multi-file operations in a single tool call.
Two of three reference projects have this as a core tool.
What the tool should do
Apply a structured patch that can add, update, delete, and move files in a single call.
Reference implementations
opencode (TypeScript)
openclaw (TypeScript)
hermes-agent (Python)
Requirements
Suggested location
client/runtime/src/main/java/dev/omatheusmesmo/qlawkus/tool/shell/ApplyPatchTool.javaConfig properties
qlawkus.file.patch.enabled(boolean, default true)