Edit Sanitizer is the fail-close boundary between user feedback/annotations and image-edit execution. It exists because generative image editors may reinterpret more of a source image than the user intended. Do not send a local-edit request directly to prompt-compiler until this Skill has produced a ready EditContract.
Core rule
Convert feedback into the smallest explicit mutation that can satisfy the request.
Do not treat a scribble, arrow, selection, bounding box, or phrase such as fix this as self-explanatory when more than one plausible target exists.
Workflow
- Identify the approved source checkpoint
- Resolve annotation coordinates against the source dimensions
- Map the annotation to one semantic target
- Split user feedback into atomic requested mutations
- Reject or veto unrelated global restyling when the request says
only,just,this area, or otherwise implies a bounded edit - Lock crop, canvas, perspective, identities, exact text, lighting, and unaffected composition unless the user explicitly targets one of them
- Derive protected regions from the complement of the editable target plus semantic locks
- Set a conservative mutation budget
- Require Arabic review for Arabic copy corrections
- Produce a typed EditContract
- Only when status is
ready, forward the contract toprompt-compiler
Annotation handling
Treat annotation geometry and semantic intent as separate evidence:
bbox: validate positive area and source boundspolygon: require a valid polygon around the intended areamask_ref: require an actual mask referencesemantic: require one clearly identifiable object or text regionnormalized: convert coordinates to native pixels before execution
If two plausible targets have similar confidence, return clarify rather than guessing.
Drift prevention
Every retry starts from source_checkpoint, which must be the last approved source.
Never chain a second corrective edit from a failed or visibly drifted render.
Maximum edit loop: 3 attempts. If the same defect persists or collateral changes grow, stop and return the evidence rather than continuing destructive edits.
Bounded-edit vetoes
Veto execution when:
- a local edit also asks to restyle the whole image
- there are multiple unrelated mutations that should be separate edits
- the target is outside the source or has zero area
- the annotation cannot be mapped confidently
- exact replacement copy is missing for copy correction
- the retry source is not the approved checkpoint
Preservation language
Do not promise literal pixel identity from a generative editor. Require material stability outside the edit target and validate collateral changes after execution.
Output
Return the EditContract plus a short execution verdict:
ready: may proceed to Prompt Compilerclarify: ask one target/scope question, do not executereject: invalid geometry/source/copy contract, do not executeveto: conflicting or over-broad mutation request, do not execute
Runtime helper
python3 ../../shared/scripts/sanitize_edit.py < edit-request.json
Cross-Skill Neural Connections & References
Peer & Downstream Skills
- Prompt Compiler — Downstream consumer of sanitized EditContracts
- Manipulation Director — Boundary blending physics & light wrap
- Arabic RTL Director — Text ligature verification on Arabic copy edits
- Visual QA — Target accuracy & collateral drift verification
- Designly Director — Lead orchestrator and edit state manager
Schemas & References
- Edit Contract Schema — Bounded edit schema
- Image Editing Guidance — Editing rules
- Routing Graph — Mesh topology & feedback loops