Skip to main content
Chain-of-Verification (Dhuliawala et al., 2023) is the canonical technique for reducing hallucination in LLM output. The flow: produce answer → generate verification questions about its claims → answer each question independently (without seeing the original answer) → reconcile discrepancies. ChatCLI implements via VerifierAgent (pure reasoning, zero tools) + VerifyHook (PostHook in the pipeline). When a discrepancy is detected, the verified_with_discrepancy flag is recorded in result.Metadata, activating Reflexion downstream.
CoVe is opt-in. With CHATCLI_QUALITY_VERIFY_ENABLED=false (default), zero overhead. When enabled, it adds +1 LLM call per use point with high effort (default effort="high").

VerifierAgent protocol

The model receives TASK + DRAFT and emits five blocks:

Critical rule: INDEPENDENT answers

The protocol instructs the model to answer each Q<n> without referring to the DRAFT. This is the heart of CoVe — if independent answers contradict the draft, there’s a suspect claim.
Models that just parrot the draft in the answers defeat the pattern. The system prompt emphasizes this explicitly; use models capable of “self-distance” (Claude Sonnet, GPT-4+).

VerifyHook flow

1

Worker finishes

Any agent produces result.Output.
2

VerifyHook.PostRun

3

Dispatch VerifierAgent

4

ParseVerifierOutput

Extracts the 5 blocks. Tolerant to order, bullets with - or *.
5

HasDiscrepancy check

Status=="verified-with-corrections" OR Discrepancies!="none".
6

On discrepancy + RewriteOnDiscrepancy

7

Reflexion consumes the flag

In the same pipeline run, ReflexionHook.PostRun sees the metadata and, if OnHallucination=true, triggers lesson generation.

Exclude list (anti-recursion + non-textual agents)


/verify — session toggle


Environment variables

Verifier override


Example: catching API hallucination

Go’s http.Client has a DefaultTimeout field you can set globally. Just do http.DefaultClient.DefaultTimeout = 30 * time.Second in the program’s init.
Error: DefaultTimeout doesn’t exist. It’s Timeout (and there’s no “DefaultTimeout” in stdlib).
Flag recorded as result.Metadata["verified_with_discrepancy"]=true. If Reflexion is on (default), a lesson is generated in background:

Interaction with Refine

When Refine + Verify are both enabled, order matters:
Refine improves stylistic quality first; Verify checks factual accuracy over the already-refined output. Reverse order (verify → refine) would work, but a refine rewrite could introduce unverified claims.
If you only enable one of them, prefer Verify for factual workflows (technical docs, API-heavy code) and Refine for stylistic workflows (summaries, reports).

Direct invocation

Or with direct tool-call to verifier in orchestrating critical steps:

Cost and latency

CoVe with weak models generates shallow questions or “verifications” that just paraphrase the draft. Use Sonnet, Opus, or GPT-4+ as CHATCLI_AGENT_VERIFIER_MODEL.

See also

#3 Reflexion

Consumes the verified_with_discrepancy signal to generate lessons about hallucination.

#5 Self-Refine

Stylistic complement: Refine polishes, CoVe verifies factually.

Original paper (Dhuliawala et al.)

Chain-of-Verification Reduces Hallucination in Large Language Models

Configuration

Env vars and slashes in one place.