From 58d7723c7972de468a537eb57f07cad7f5019902 Mon Sep 17 00:00:00 2001 From: Aaron Z Date: Thu, 14 May 2026 10:03:33 +0800 Subject: [PATCH 1/2] fix(coding-agent/edit): add format reminder to hashline prompt to prevent anchor+content on same line Models frequently write '+ ANCHOR| CONTENT' instead of '+ ANCHOR' followed by '~CONTENT' on the next line. Add a compact FORMAT block between and with a WRONG/RIGHT example that directly addresses this failure mode. --- packages/coding-agent/src/prompts/tools/hashline.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/coding-agent/src/prompts/tools/hashline.md b/packages/coding-agent/src/prompts/tools/hashline.md index d8380db46..9ca59b604 100644 --- a/packages/coding-agent/src/prompts/tools/hashline.md +++ b/packages/coding-agent/src/prompts/tools/hashline.md @@ -14,6 +14,18 @@ Purely textual format. The tool has NO awareness of language, indentation, brack = A..B replace the range with payload `{{hsep}}TEXT` lines, or with one blank line if no payload follows. + +Each op line is ONE of: + + ANCHOR ← nothing after the anchor! Content goes on ~ lines below. + < ANCHOR ← same rule. + - A..B ← no content needed (deletion). + = A..B ← followed by ~TEXT payload lines. + +WRONG: + 129pg| some code here +RIGHT: + 129pg + ~ some code here + + - Every line of inserted/replacement content MUST be emitted as a payload line starting with `{{hsep}}`. - `{{hsep}}` is syntax, not content. The inserted text begins after the first `{{hsep}}`; use a bare `{{hsep}}` to insert a blank line. From d62480dc6524116d7aed26150baefe03d4ea48d5 Mon Sep 17 00:00:00 2001 From: can1357 Date: Thu, 14 May 2026 05:00:10 +0200 Subject: [PATCH 2/2] fix(edit): slim format-reminder and use configured separator - Drop duplicated op listing from the reminder; already defines the four shapes one block above. - Replace hardcoded `~` with the {{hsep}} helper so the reminder tracks PI_HL_SEP / HL_EDIT_SEP overrides, matching the rest of hashline.md and addressing Codex review on #1063. - Shrink the WRONG/RIGHT example (smaller anchor, no padding runs) since the reminder's only job is contrasting on-line vs next-line payload placement. --- packages/coding-agent/src/prompts/tools/hashline.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/coding-agent/src/prompts/tools/hashline.md b/packages/coding-agent/src/prompts/tools/hashline.md index 9ca59b604..8b32ac857 100644 --- a/packages/coding-agent/src/prompts/tools/hashline.md +++ b/packages/coding-agent/src/prompts/tools/hashline.md @@ -8,6 +8,7 @@ Purely textual format. The tool has NO awareness of language, indentation, brack @@ PATH header: subsequent ops apply to PATH +Each op line is ONE of: + ANCHOR insert lines AFTER the anchored line (or EOF); payload follows as `{{hsep}}TEXT` lines < ANCHOR insert lines BEFORE the anchored line (or BOF); payload follows as `{{hsep}}TEXT` lines - A..B delete the line range (inclusive). @@ -15,15 +16,11 @@ Purely textual format. The tool has NO awareness of language, indentation, brack -Each op line is ONE of: - + ANCHOR ← nothing after the anchor! Content goes on ~ lines below. - < ANCHOR ← same rule. - - A..B ← no content needed (deletion). - = A..B ← followed by ~TEXT payload lines. +Op lines carry no content — payload goes on the next line. -WRONG: + 129pg| some code here -RIGHT: + 129pg - ~ some code here +WRONG: + 5pg| some code +RIGHT: + 5pg + {{hsep}} some code