@@ -283,36 +283,42 @@ script with one operation per nonblank command header:
283283
284284``` text
285285N: COMMAND replace command N
286+ N: accept apply hpatch's displayed safe correction for command N
286287-N delete command N
287288+N: COMMAND insert before command N
288289N+: COMMAND insert after command N
289290```
290291
291292A replacement or insertion whose command is ` type <<TAG ` consumes its heredoc body and
292293closing delimiter as part of that one correction operation. All indices refer to the
293- original rejected script before any correction operation is applied. Replacements and
294- deletions may name an index at most once and conflict with each other for the same index.
295- Multiple insertions at one anchor are allowed and retain payload order; their position is
296- relative to the original anchor even when that anchor is deleted. Every nonblank line
297- outside a correction heredoc must be a correction operation.
298-
299- The router validates all operations and referenced indices before rebuilding the script.
300- It then reparses and reevaluates the complete transformed script against the unchanged
301- workspace. A correction failure changes nothing. A successful transformation becomes the
302- base for a later correction, retains the correction-chain correlation ID, increments the
303- attempt, and charges metrics for only the compact payload the agent emitted.
294+ original rejected script before any correction operation is applied. Replacements,
295+ acceptances, and deletions may name an index at most once and conflict with each other for
296+ the same index. An acceptance is valid only when the immediately repairable rejected
297+ script retained an exact correction for that command; it never approves the rejected
298+ mutation itself. Multiple insertions at one anchor are allowed and retain payload order;
299+ their position is relative to the original anchor even when that anchor is deleted. Every
300+ nonblank line outside a correction heredoc must be a correction operation.
301+
302+ The router validates all operations, retained acceptances, and referenced indices before
303+ rebuilding the script. It then reparses and reevaluates the complete transformed script
304+ against the unchanged workspace. A correction failure changes nothing. A successful
305+ transformation becomes the base for a later correction, retains the correction-chain
306+ correlation ID, increments the attempt, and charges metrics for only the compact payload
307+ the agent emitted.
304308
305309Acceptance:
306310
3073111 . ` N: COMMAND ` remains compatible with existing replacement corrections.
308- 2 . ` -N ` , ` +N: COMMAND ` , and ` N+: COMMAND ` can remove obsolete commands and insert new
312+ 2 . ` N: accept ` substitutes exactly the safe correction displayed for command N; an absent
313+ or stale suggestion rejects without evaluating or mutating the workspace.
314+ 3 . ` -N ` , ` +N: COMMAND ` , and ` N+: COMMAND ` can remove obsolete commands and insert new
309315 commands without resending the complete script.
310- 3 . Multiple same-anchor insertions preserve payload order, including when the anchor is
311- deleted, while duplicate replacement/deletion or an absent index rejects the complete
312- correction.
313- 4 . A correction heredoc is one operation; an invalid or unterminated correction heredoc
316+ 4 . Multiple same-anchor insertions preserve payload order, including when the anchor is
317+ deleted, while duplicate replacement/acceptance/ deletion or an absent index rejects
318+ the complete correction.
319+ 5 . A correction heredoc is one operation; an invalid or unterminated correction heredoc
314320 produces one bounded diagnostic and does not reinterpret its body as operations.
315- 5 . Every corrected script is revalidated atomically against the unchanged workspace and
321+ 6 . Every corrected script is revalidated atomically against the unchanged workspace and
316322 retains the established correlation and emitted-payload metrics behavior.
317323
318324## REQ-FILE-001 — File commands
@@ -513,10 +519,13 @@ Acceptance:
513519
514520Input is read completely and the entire script is evaluated before an external filesystem
515521commit or stdout. Script ` commit ` barriers only advance the in-memory generation and
516- never create an externally visible partial result. An unchanged normal-mode change set
517- performs no filesystem operation but still reports
518- its final active editor state. An unchanged translate result emits no patch and fails
519- because it cannot represent an update; it emits no final-state report.
522+ never create an externally visible partial result. Before finalization, every changed file
523+ whose final path ends in ` .go ` is parsed and formatted with Go's standard-library
524+ ` go/format ` ; a parse failure rejects the complete transaction, while non-Go files receive
525+ no language validation. An unchanged normal-mode change set performs no filesystem
526+ operation but still reports its final active editor state. An unchanged translate result
527+ emits no patch and fails because it cannot represent an update; it emits no final-state
528+ report.
520529
521530Translate output contains file actions in deterministic first-touch order:
522531
@@ -559,14 +568,15 @@ moves. A new empty file reports position `1:1` and one empty preview line number
559568After the header, the report writes up to three total logical lines nearest the cursor or
560569first selection start: normally the preceding, containing, and following lines; at a
561570boundary, the first or last three available lines without duplication. Each row is
562- ` LINE TEXT ` . ` TEXT ` contains at most the first 64 Unicode code points of rendered line content, without
563- a line terminator or added ellipsis. Control characters are escaped so each preview stays
564- on one output line. Each successful ` tsel ` line repair appends a
565- ` repaired command N tsel line REQUESTED to RESOLVED in PATH ` note plus up to three marked
566- post-edit preview lines around the repaired location. The complete report is rendered
567- before commit or patch output, but it is emitted only after that mode-specific effect
568- succeeds. A report-write failure after the effect is best-effort and cannot retroactively
569- change the successful effect or claim rollback.
571+ ` LINE|TEXT ` , matching ` nl -ba -w1 -s'|' ` output. ` TEXT ` contains at most the first 64
572+ Unicode code points of rendered line content, without a line terminator or added ellipsis.
573+ Tabs are preserved and other control characters are escaped so each preview stays on one
574+ output line. Each successful ` tsel ` line repair appends a
575+ ` repaired command N tsel line REQUESTED to RESOLVED in PATH ` note plus up to three
576+ post-edit ` LINE|TEXT ` preview lines around the repaired location. The complete report is
577+ rendered before commit or patch output, but it is emitted only after that mode-specific
578+ effect succeeds. A report-write failure after the effect is best-effort and cannot
579+ retroactively change the successful effect or claim rollback.
570580
571581Normal mode stages new contents in same-directory temporary files before starting the
572582commit. Parse, validation, read, and evaluation failures leave the initial tree
@@ -599,39 +609,42 @@ than selecting a nearby line.
599609A command failure that addressed an existing baseline additionally writes repair context
600610on the lines following its diagnostic. Selectors resolve against a baseline the caller
601611cannot see, so a diagnostic alone forces a blind retry that costs a whole script; repair
602- context supplies the measurements that failure implies. A rejected column range reports the
603- addressed line's rune-column count, restates that one tab is one column, and lists the
612+ context supplies the measurements that failure implies. A rejected column range reports
613+ the addressed line's rune-column count, restates that one tab is one column, and lists the
604614rune-column span of each whitespace-separated token on that line. Token spans are used
605615rather than sampled columns because a sampled character usually recurs on the line and
606- cannot be located unambiguously. An out-of-range line or line range reports the file's
607- line count. An edit conflict reports which current-generation baseline lines earlier commands
608- already claim and, when a later selector can safely be rerun after materialization,
609- identifies the selector command before which ` commit ` belongs. Every repair block
610- includes a window of baseline lines around the addressed line, marks that line, and
611- escapes control characters so each rendered line stays on one output line. A failure with
612- no active baseline, including a missing file, emits its diagnostic alone. Repair context is
613- supplementary: it never changes exit status, stdout, mutation, or metrics classification.
616+ cannot be located unambiguously. An out-of-range line or line range reports the file's
617+ line count. An edit conflict reports which current-generation baseline lines earlier
618+ commands already claim and, when a later selector can safely be rerun after
619+ materialization, identifies the selector command before which ` commit ` belongs. Every
620+ repair block includes a ` LINE|TEXT ` window of baseline lines around the addressed line and
621+ escapes non-tab control characters so each rendered line stays on one output line. A
622+ failure with no active baseline, including a missing file, emits its diagnostic alone.
623+ Repair context is supplementary: it never changes exit status, stdout, mutation, or
624+ metrics classification.
614625
615626Acceptance:
616627
6176281 . Normal success has empty stdout and one rendered final-state report on stderr after
618629 commit; translate success has patch-only stdout and one pending-state report on stderr
619630 after the patch is completely written.
620- 2 . Rendered cursor affinity, selection ranges, moved paths, empty files, three-line
621- boundary windows, Unicode columns, 64-code-point truncation, and control escaping
631+ 2 . Rendered cursor affinity, selection ranges, moved paths, empty files, ` LINE|TEXT `
632+ preview windows, Unicode columns, 64-code-point truncation, and control escaping
622633 produce the specified report without implying cross-invocation persistence.
623- 3 . Malformed input, malformed or out-of-bounds line selection, unrelated literal or
634+ 3 . Changed Go files are formatted with the standard library before output, and invalid Go
635+ rejects the transaction without mutation; non-Go files receive no language validation.
636+ 4 . Malformed input, malformed or out-of-bounds line selection, unrelated literal or
624637 whitespace collision, unknown or future command, invalid UTF-8, missing or non-regular
625638 file, logical path collision, staging failure, translation failure, and cancellation
626639 produce no mutation, patch output, or final-state report.
627- 4 . Injected external filesystem commit and rollback failures are reported without false
640+ 5 . Injected external filesystem commit and rollback failures are reported without false
628641 atomicity claims and without a successful final-state report; script ` commit ` barriers
629642 remain externally invisible.
630- 5 . Failure to write a fully rendered report after a successful external effect does not
643+ 6 . Failure to write a fully rendered report after a successful external effect does not
631644 reverse that effect or record a complete report-input token estimate.
632- 6 . A rejected column range, out-of-range line, missing literal occurrence, and edit
633- conflict each emit repair context sufficient to correct the command without rereading
634- the file; a failure with no active baseline emits its diagnostic alone.
645+ 7 . A rejected column range, out-of-range line, missing literal occurrence, and edit
646+ conflict each emit repair context sufficient to correct the command without rereading
647+ the file; a failure with no active baseline emits its diagnostic alone.
635648
636649## REQ-GUIDE-001 — Agent guidance
637650
0 commit comments