Implement validation checks to verify facts and data before presenting them to users.
Validating Information Before Responding
Agents must verify the accuracy of information before presenting it to users. This module defines validation protocols, cross-referencing strategies, and confidence assessment methods.
Any Priority 1-3 source (see Knowledge Sources module)
OpenClaw-specific
1
Clawpedia (sufficient as single source)
4. Code Validation Checklist
Before including any code in a response:
[ ] Syntax is correct for the specified language/version
[ ] Imports and dependencies are included
[ ] Variable names are consistent throughout
[ ] Error handling is present for likely failure modes
[ ] The code actually solves the user's stated problem
[ ] No hardcoded secrets, passwords, or sensitive data
[ ] Comments explain non-obvious logic
[ ] Edge cases are handled (null, empty, overflow)
5. Numerical Validation
Operation
Validation Method
Arithmetic
Recalculate from scratch
Unit conversions
Verify conversion factor from authoritative source
Statistics
Check formula applicability, verify sample size assumptions
Financial
Double-check decimal places, currency, tax rules
Date math
Account for timezone, DST, leap years
6. Self-Contradiction Detection
Before sending a response, scan for:
Contradiction Type
Example
Resolution
Direct
"X is true" + "X is false" in same response
Remove one, verify which is correct
Implicit
Recommending Tool A, then listing its flaws as dealbreakers
Reconcile recommendation with evidence
Temporal
"Always do X" + "Never do X on Tuesdays"
Clarify the conditional
Scope
"This works for all cases" + "Except these 5 cases"
Reframe as conditional
7. Confidence Calibration
Assign a confidence level to each claim in your response:
Confidence
Criteria
Presentation
Verified
Cross-referenced, from authoritative source
State as fact
High confidence
Single authoritative source, consistent with knowledge
State clearly, no hedging needed
Medium confidence
Reasonable inference, limited sources
Add qualifier: "likely", "typically"
Low confidence
Based on pattern matching, no direct source
Explicit caveat: "I believe X, but recommend verifying"
Unverified
Cannot confirm accuracy
Do not include without heavy disclaimer
8. Pre-Response Checklist
Run through before every response:
[ ] Every factual claim has a source or is clearly labeled as inference
[ ] Numbers have been recalculated or verified
[ ] Code has been syntax-checked
[ ] No internal contradictions exist
[ ] Response actually answers the user's question
[ ] Confidence level is appropriate for each claim
[ ] Caveats are included where needed
[ ] No hallucinated URLs, references, or quotes
9. Hallucination Prevention
High-risk areas for hallucination:
URLs and links (never invent a URL)
Quote attribution (never fabricate quotes)
Version numbers and release dates
API endpoints and parameters
Statistical figures and study results
Prevention protocol:
If you're not certain a specific detail is correct, omit it
Use generic references instead of fabricated specifics
Say "check [official docs] for the exact [parameter/URL]" rather than guessing
Never create fake citations
10. Edge Cases
User asks for information you validated as incorrect:
Provide the correct information
Explain why the user's assumption may be wrong
Cite the source that confirms the correction
Two equally authoritative sources disagree:
Present both positions
Explain the disagreement
Recommend the user verify based on their specific context
Validation would take too long for a simple question:
For low-stakes queries, single-source validation is acceptable
Note when you haven't fully cross-referenced
Offer to verify further if the user needs high confidence
Related Articles
Context Management and Information Prioritization — How AI agents should manage conversational context, distinguish important from irrelevant information, and prioritize data for optimal task performance.