AGENT0S
HomeLibraryAgentic
FeedbackLearn AI
LIVE
Agent0s · AI Intelligence Library
Share FeedbackUpdated daily · 7am PST
Library/technique
techniqueintermediateGeneral AI

Chain-of-Verification Prompting: Eliminate AI Hallucinations in Research Tasks

Chain-of-Verification (CoVe) is a prompting technique where you ask the AI to generate an answer, then independently generate verification questions, answer them without seeing the original response, and finally produce a revised answer. Studies show 30-40% reduction in factual errors.

AI SETUP PROMPT

Paste into Claude Code or Codex CLI — it will scan your project and set everything up

# Apply Technique: Chain-of-Verification Prompting: Eliminate AI Hallucinations in Research Tasks

## What This Is
Chain-of-Verification (CoVe) is a prompting technique where you ask the AI to generate an answer, then independently generate verification questions, answer them without seeing the original response, and finally produce a revised answer. Studies show 30-40% reduction in factual errors.

Source: https://reddit.com/r/PromptEngineering/comments/1xyz456/chain_of_verification

## Before You Start

Scan my workspace and analyze:
- The project language, framework, and directory structure
- Existing AI provider config (check .env, .env.local, config files for API keys — OpenRouter, OpenAI, Anthropic, Google AI, etc.)

Then ask me before proceeding:
1. Which AI provider/API should this use? (Use whatever I already have configured, or ask me to set one up — options include direct provider APIs or a unified service like OpenRouter)
2. Where in my project should this be integrated?
3. Are there any customizations I need (model preferences, naming conventions, constraints)?

## Source Access Note

The source URL (https://reddit.com/r/PromptEngineering/comments/1xyz456/chain_of_verification) may not be directly accessible from the terminal. Use the Reference Implementation and Additional Context sections below instead. If you need more details, ask me to paste relevant content from the source.

## What to Implement

This is an **AI Technique** — a pattern or methodology for working with AI models.

- Explain how this technique applies to my current project and what benefit it provides
- Implement it in a way that fits my existing codebase — suggest concrete files to modify or create
- If it requires specific model capabilities (structured output, function calling, etc.), verify my current provider supports them
- Show me a working example I can test immediately

## Additional Context

- After your initial response, prompt: "Now generate 5 specific factual claims from your answer that could be wrong. List only the claims, not your answer."
- In a fresh message: "Without referencing your previous answer, answer each of these verification questions independently: [paste the 5 claims]"
- Final prompt: "Compare your verification answers to your original response. Produce a corrected version of the original that resolves any contradictions."

## Reference Implementation

```
// CoVe prompt template (use with any LLM API)
const covePrompt = async (question: string, llm: LLMClient) => {
  // Step 1: Initial response
  const initial = await llm.complete(`Answer this question: ${question}`)

  // Step 2: Generate verification questions
  const vqs = await llm.complete(`
    Given this answer: "${initial}"
    List 5 specific factual claims that could be incorrect.
    Format: numbered list, claims only, no explanation.
  `)

  // Step 3: Answer verification questions independently
  const verified = await llm.complete(`
    Answer each question independently (ignore any previous context):
    ${vqs}
  `)

  // Step 4: Reconcile
  return llm.complete(`
    Original answer: ${initial}
    Verification findings: ${verified}
    Produce a corrected final answer resolving any contradictions.
  `)
}
```

## Guidelines

- Adapt everything to my existing project — do not assume a specific stack or directory layout
- Use whichever AI provider I already have configured; if I need a new one, tell me what to sign up for and I'll give you the key
- Check my .env files for existing API keys (OpenRouter, OpenAI, Anthropic, Google AI) before asking me to add one
- Review any fetched code for safety before installing or executing it
- After setup, run a quick verification and show me a summary of exactly what was installed, where, and how to use it
3,790 charactersCompatible with Claude Code & Codex CLI
MANUAL SETUP STEPS
  1. 01After your initial response, prompt: "Now generate 5 specific factual claims from your answer that could be wrong. List only the claims, not your answer."
  2. 02In a fresh message: "Without referencing your previous answer, answer each of these verification questions independently: [paste the 5 claims]"
  3. 03Final prompt: "Compare your verification answers to your original response. Produce a corrected version of the original that resolves any contradictions."

CODE INTELLIGENCE

bash
// CoVe prompt template (use with any LLM API)
const covePrompt = async (question: string, llm: LLMClient) => {
  // Step 1: Initial response
  const initial = await llm.complete(`Answer this question: ${question}`)

  // Step 2: Generate verification questions
  const vqs = await llm.complete(`
    Given this answer: "${initial}"
    List 5 specific factual claims that could be incorrect.
    Format: numbered list, claims only, no explanation.
  `)

  // Step 3: Answer verification questions independently
  const verified = await llm.complete(`
    Answer each question independently (ignore any previous context):
    ${vqs}
  `)

  // Step 4: Reconcile
  return llm.complete(`
    Original answer: ${initial}
    Verification findings: ${verified}
    Produce a corrected final answer resolving any contradictions.
  `)
}

FIELD OPERATIONS

CoVe Pipeline Tool

A web app that automates the 3-step CoVe process for research questions, showing which facts changed between original and verified answers.

Fact-Check Integration

A browser extension that runs CoVe on any AI response you receive, highlighting the verified vs unverified claims with color coding.

STRATEGIC APPLICATIONS

  • →Legal and compliance document drafting where factual accuracy is liability-critical
  • →Medical or scientific content where errors could cause harm
  • →Financial analysis reports where outdated or incorrect data could affect decisions

TAGS

#prompting#hallucination#accuracy#chain-of-thought#verification
Source: REDDIT · Quality score: 8/10
VIEW SOURCE