--- name: agy-create-verified description: "Operational guide for iterative image generation with visual and deterministic programmatic verification and edits." --- # Verified image workflow Use `agy_create_verified` only when a generated image must be checked and possibly corrected across iterations. Use `agy_generate` for one-shot or purely aesthetic work. ## Prepare the request Separate requirements into: - **Semantic:** subject, pose, style, mood, scene. - **Layout:** aspect ratio, placement, count, alignment, spacing. - **Measurable:** dimensions, dominant colors, geometry, contrast, text regions. Write acceptance criteria as explicit pass/fail statements. OpenCV can verify measurable criteria; Gemini judges semantic criteria. Do not claim a subjective requirement is objectively verified. ## Deterministic edits Use `editInstructions` for a repeatable transformation such as resize, crop, color correction, thresholding, masking, watermark placement, or geometric cleanup. Use `editScript` only for an explicit trusted script. The edit script contract is: - read input from `sys.argv[1]`; - write only the output image to `sys.argv[2]`; - use only `cv2`, `numpy`, `PIL`, `json`, `sys`, and `math`; - do not use network, subprocesses, dynamic imports, or arbitrary filesystem access. The programmatic edit runs before visual/OpenCV verification, so its output—not the raw generated image—is the candidate for the next iteration. ## Budget and interpretation - Use `maxIterations=2` for simple corrections, 3 normally, and 4–5 only when justified. - Keep `useOpenCV=true` when at least one criterion is measurable; otherwise it adds cost without reliable evidence. - A `PASS` is valid only for the final candidate and available checks. - A `FAIL` result is the latest candidate, not a compliant image. Report unmet criteria explicitly. - Inspect the per-iteration report for edit errors, unchanged progress, regressions, and failed OpenCV output before presenting the result as verified.