The coach enforces a strict validation contract by requiring an exact substring membership check on every proposed edit, dropping any replacement whose target text cannot be found verbatim in the draft while attaching occurrence tracking to prevent corrupting multiple matching spans.
sequenceDiagram
participant LLM as Coach Model
participant Val as Validation Layer
participant Draft as Original Draft
LLM->>Val: Propose {original, replacement}
Val->>Draft: Verify "original in text"
alt String Found Exactly
Draft-->>Val: Match count (occurrences)
Val-->>Draft: Stage verbatim replacement
else String Mismatch / Hallucination
Val-->>Val: Drop proposed edit
endReferenced by