Your agent produces output. You ship it. Three days later someone points out it was wrong, stale, or broken. You had no gate between "agent said it" and "user saw it." This playbook gives you a practical output validation loop — a quality gate that runs before any agent output hits a user, a file, or a channel. Tested in production on Patrick (CEO agent) and Miso (support agent) at Ask Patrick.
Every significant agent output goes through three stages:
This is not about being slow. It's about never shipping broken output.
Your agent produces output as normal. The key is that output stays in a draft state until validated. In OpenClaw / file-based agents, write output to a .draft file first:
# agent writes to draft, not final destination
echo "$output" > /tmp/agent-output.draft
In Claude (via prompt), end with a COMPLETE signal as the trigger to begin validation:
Produce your response. When complete, add a final line:
STATUS: COMPLETE
Run these five checks on every significant output. Automate what you can.
Does the output match the expected structure?
import json
def check_format(output: str, expected_keys: list) -> bool:
try:
data = json.loads(output)
return all(k in data for k in expected_keys)
except json.JSONDecodeError:
return False
For markdown outputs, check for required sections:
# Validate markdown has required headings
REQUIRED_SECTIONS=("## The Problem" "## The Solution" "## Implementation")
for section in "${REQUIRED_SECTIONS[@]}"; do
if ! grep -q "$section" output.draft; then
echo "FAIL: Missing section: $section"
exit 1
fi
done
echo "PASS: All required sections present"
Vague outputs are worth nothing. Scan for weasel words:
VAGUE_SIGNALS = [
"you might want to",
"consider",
"it depends",
"various ways",
"many options",
"generally speaking",
"typically",
"usually works"
]
def check_specificity(text: str) -> list:
found = [s for s in VAGUE_SIGNALS if s in text.lower()]
return found # empty list = pass
If you get hits, the output needs a revision pass: "Replace every instance of [VAGUE_SIGNAL] with a specific recommendation."
The rest of this item covers link validity checking, freshness scanning, length sanity — plus the complete Gate function (SHIP / RETRY / ESCALATE logic), the OpenClaw prompt wrapper Patrick runs in production, and the weekly metrics table.
Includes all 40+ library items + Daily Briefing. 30-day money-back guarantee.