In full-page optimization mode, the system assigns [N] prefixes to each line of the source page and instructs the model to emit tag-based edit primitives that are validated and applied in reverse order to update the document without rewriting it entirely.
sequenceDiagram
autonumber
participant Engine as Optimizer Engine
participant LLM as Ideator Model
participant Editor as Page Editor
Engine->>Editor: Number lines (1..N)
Editor-->>Engine: Formatted numbered text
Engine->>LLM: Prompt with claim and numbered text
LLM-->>Engine: XML edit blocks (replace, insert)
Engine->>Editor: apply_edits(original, edits)
Note over Editor: Sorts edits descending by line number, applies changes in reverse
Editor-->>Engine: Updated page content