The decisive evidenceIf the structured tool argument is already damaged, changing write cannot recover information it never received.

Find the first divergent boundary.

Intent

Keep the exact requested fixture, including invisible and escape-sensitive characters.

Tool call

Capture structured content, old_string, and new_string.

Readback

Read the narrow changed range and hash exact bytes when required.

Parser

Retain the native syntax, schema, build, or browser failure.

Route ownership from evidence.

Before toolargument damaged

Model construction or another program string consumed the character.

After toolreadback damaged

Investigate the filesystem tool or provider boundary.

After parseruntime differs

Inspect encoding, line endings, transformation, CSP, and target semantics.

Do not retry the same long literal.

One repeated failure is enough to split the artifact and preserve the first evidence. More escaping guesses increase cost without locating ownership.

Give each language one source file.

Keep HTML, OpenAPI, JavaScript, shell, Python, and CSS independent. Validate each with its native parser, checkpoint its digest, then create single-file output through a deterministic build only when distribution requires it.

Direct write

Avoid an extra run_code program string when the artifact is already text.

Small edit

Insert one uniquely delimited block and read it back immediately.

Native check

Syntax and schema validation stop the pipeline at the owning language.

Deterministic build

Generated bundles are output, never the hand-edited source of truth.

Primary evidence.

Preserve evidence before repairing text.

The complete guide includes the representation ladder, source layout, bounded procedure, literal-edit safety, failure router, edge-case fixtures, and twelve acceptance tests.

Read the complete guide