Reducing Claude Hallucinations with Pre-Output Prompt Injection

A Reddit user has shared a technique for reducing hallucinations in Claude AI by approximately half through pre-output prompt injection. The method focuses on forcing the model to perform internal verification before generating responses.
Implementation Details
The approach requires two specific modifications:
1. System Prompt Addition
Add this markdown block to Claude's system prompt (output style):
Before response
IMPORTANT: MUST run before responding to user, including follow-ups. NO EXCEPTIONS.
python -m pre_output.record '{ "turn": 1/2/..., "summary": "10 words max", "uncertainties": ["unresolved observations, unverified assumptions", ...], "possible-next-steps": ["refactor, update docs", ...] }'
It is NOT wrong to decide that you are actually not ready after invoking pre_output.record ; in that case, invoke pre_output.record again with updated information.
2. Python Script Creation
Create a Python script with the following content:
print("recorded successfully.")
print("")
print("IMPORTANT RULES:")
print("- NEVER reply if you can make more progress autonomously.")
print("- NEVER reply if uncertainties remain. Do more verification.")
print(" ")How It Works
The system forces Claude to:
- Record a JSON object with turn number, brief summary (10 words maximum), uncertainties list, and possible next steps
- Re-evaluate readiness before responding
- Follow strict rules about not replying when uncertainties remain or when autonomous progress is possible
The technique appears designed for developers using Claude as a coding assistant, particularly for complex tasks where verification and step-by-step reasoning are crucial.
📖 Read the full source: r/ClaudeAI
👀 See Also

OpenClaw Agents Become Unresponsive After Week 1: Telegram Integration Issues?
User reports OpenClaw agents going silent after the first week, suspecting Telegram integration or long-term runtime issues. Restarts help temporarily.

Using AI to Generate Project Tickets Before Coding Reduces Scope Drift
A developer found that asking AI to generate detailed project tickets with tasks, sub-tasks, scope, and acceptance criteria before writing any code significantly reduced scope creep and large diffs. Each AI agent only receives its specific sub-task, not the entire plan.

Skippy's Private LLM: How I Solved OpenClaw's Ollama Sub-Agent Timeout by Calling Ollama Directly
An OC COO's AI assistant bypasses OpenClaw's broken sub-agent system by calling a second Ollama instance directly via curl. No gateway, no event loop blocking.

Enforcing Hard Guardrails for OpenClaw AI Agents: Approval Gating and Concurrency Limits
An r/openclaw user asks how to enforce hard rules like email approval and concurrency limits on a Discord-connected OpenClaw bot running Ollama with GLM. The answer: move enforcement outside the model's reasoning loop.