From 8671f79a003da51e2015d18912e04468586faf9d Mon Sep 17 00:00:00 2001 From: Dylan Hurd Date: Fri, 31 Oct 2025 14:12:39 -0700 Subject: [PATCH] fix: Longer apply_patch instructions --- codex-rs/core/src/tools/handlers/apply_patch.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/codex-rs/core/src/tools/handlers/apply_patch.rs b/codex-rs/core/src/tools/handlers/apply_patch.rs index 1e82b9cf10..a1ca31b364 100644 --- a/codex-rs/core/src/tools/handlers/apply_patch.rs +++ b/codex-rs/core/src/tools/handlers/apply_patch.rs @@ -165,7 +165,13 @@ pub enum ApplyPatchToolType { pub(crate) fn create_apply_patch_freeform_tool() -> ToolSpec { ToolSpec::Freeform(FreeformTool { name: "apply_patch".to_string(), - description: "Use the `apply_patch` tool to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.".to_string(), + description: "Send a patch to filesystem.apply_patch to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON. +The patch must start with `*** Begin Patch` and end with `*** End Patch`. The second line is the beginning of a hunk: +- `*** Add File: PATH` creates a new file and is followed by lines that begin with `+`. +- `*** Delete File: PATH` removes a file. +- `*** Update File: PATH` edits a file. You may add `*** Move to: PATH` to rename it. + - Update lines should either start with @@ (start of range), ` ` (context line), `+` (add line), or `-` (delete line). +A patch can contain multiple hunks. Paths should be absolute.".to_string(), format: FreeformToolFormat { r#type: "grammar".to_string(), syntax: "lark".to_string(),