{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "EditOutput",
"description": "NDJSON output for a surgical edit operation.",
"type": "object",
"properties": {
"bytes_after": {
"description": "File size in bytes after editing.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"bytes_before": {
"description": "File size in bytes before editing.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"checksum_after": {
"description": "BLAKE3 checksum after editing.",
"type": "string"
},
"checksum_before": {
"description": "BLAKE3 checksum before editing.",
"type": "string"
},
"edits": {
"description": "Number of edit operations applied.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"elapsed_ms": {
"description": "Operation duration in milliseconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"fuzzy": {
"description": "Whether fuzzy matching was used (only present in --old/--new mode).",
"type": [
"boolean",
"null"
]
},
"lines_after": {
"description": "Line count after editing.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"lines_before": {
"description": "Line count before editing.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"mode": {
"description": "Edit mode used (e.g. `after_line`, `range`, `old_new`, `exact`).",
"type": "string"
},
"mtime_preserved": {
"description": "Whether the original modification time was preserved (true) or updated to now (false).\nCritical for build systems: false ensures cargo/make/cmake detect the change.",
"type": [
"boolean",
"null"
]
},
"pair_results": {
"description": "Per-pair match results (multi-pair mode only) — the per-item ground truth.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/$defs/PairResult"
}
},
"pairs_total": {
"description": "Total number of `--old`/`--new` pairs requested (multi-pair mode only).",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0
},
"path": {
"description": "Path of the edited file.",
"type": "string"
},
"similarity": {
"description": "Similarity score of the fuzzy match, 0.0-1.0 (only present for `block_anchor` strategy).",
"type": [
"number",
"null"
],
"format": "double"
},
"strategies_tried": {
"description": "Number of strategies tried before success (only present in --old/--new mode).",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0
},
"strategy": {
"description": "Fuzzy strategy that succeeded (only present when fuzzy=true).",
"type": [
"string",
"null"
]
},
"type": {
"description": "Event type discriminator.",
"type": "string"
}
},
"required": [
"type",
"path",
"edits",
"mode",
"bytes_before",
"bytes_after",
"checksum_before",
"checksum_after",
"lines_before",
"lines_after",
"elapsed_ms"
],
"$defs": {
"PairResult": {
"description": "Outcome of matching a single `--old`/`--new` pair in multi-pair edit mode.\n\nEmitted in `pair_results` on both success and error envelopes so agents\ncan verify each pair objectively without re-running the edit (G117).\nIn the default all-or-nothing mode, pairs after the first failure are\nnever attempted and are absent from the array.",
"type": "object",
"properties": {
"index": {
"description": "1-based position of the pair in the `--old`/`--new` invocation order.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"matched": {
"description": "Whether the pair matched and was applied to the content.",
"type": "boolean"
},
"similarity": {
"description": "Similarity score of the fuzzy match, 0.0-1.0 (block-anchor and context-aware only).",
"type": [
"number",
"null"
],
"format": "double"
},
"strategy": {
"description": "Matching strategy that succeeded (e.g. `exact`, `whitespace_normalized`).",
"type": [
"string",
"null"
]
}
},
"required": [
"index",
"matched"
]
}
}
}