Run agent, validate output against schema/checklist, feed corrections back. Loop until passes.
Start the "Agent Output Validator" loop. - Goal: Agent output passes all validation checks — schema conformance, constraint satisfaction, and quality checklist. - Max iterations: 6 - Between iterations run: `cat OUTPUT.json | npx ajv validate -s schema.json -d -` - Exit when: output passes schema validation AND all checklist items in QUALITY.md are satisfied. Steps: 1. Run the agent on the target task 2. Capture the output (file, API response, generated code, etc.) 3. Validate against the defined schema or contract: - Structural correctness (required fields, types, formats) - Constraint satisfaction (length limits, allowed values, referential integrity) - Quality checklist (no hallucinations, no placeholder text, no TODOs, follows conventions) 4. For each validation failure, generate a specific correction instruction 5. Feed the corrections back to the agent along with the original task 6. Re-run the agent with tightened instructions 7. Re-validate the new output Self-pacing instructions: After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when exit condition passes or max iterations reached. Give a short status update each pass.
How it works