Appendix 13: AI Hallucination Check Prompt
You can use this prompt to query the AI to determine if it’s hallucinating.
flowchart TD
Start([🔍 Suspect Hallucination]) --> A[📋 Paste Recent Stack Traces]
A --> B[📝 Summarize Fix Attempts]
B --> C[🤖 AI Self-Diagnosis]
C --> D{Calculate Hallucination Risk}
D --> E[📊 Hallucination Risk Score]
E --> F{Score > 40%?}
F -- No --> G[✅ Proceed with Confidence]
F -- Yes --> H[🔄 Choose Recovery Action]
H --> H1[🔄 Reset a broken file]
H --> H2[📁 Request actual file(s) to re-sync]
H --> H3[🧹 Clean regenerate from scratch]
H --> H4[🔧 Remodularize logic]
H --> H5[🧭 Clarify goal or system state]
H1 --> I[✅ Recovery Complete]
H2 --> I
H3 --> I
H4 --> I
H5 --> I
style Start fill:#ffcdd2,stroke:#333
style A fill:#fff3e0,stroke:#333
style B fill:#e8f5e9,stroke:#333
style C fill:#fce4ec,stroke:#333
style D fill:#f3e5f5,stroke:#333
style E fill:#fff9c4,stroke:#333
style F fill:#e0f7fa,stroke:#333
style G fill:#c8e6c9,stroke:#333
style H fill:#ffccbc,stroke:#333
style I fill:#4caf50,stroke:#333,color:#fff
## 🔍 DIAGNOSTIC: Are You Stuck in a Hallucination Loop?
We've been debugging a project together, and I need you to critically assess whether you are currently hallucinating or out of sync with the actual project structure.
### 📊 Your Task
1. **Estimate the probability (%) that you are hallucinating.**
Hallucination includes: making up code that doesn't exist, misinterpreting errors, repeating edits without solving issues, or contradicting earlier logic.
2. **Provide a brief rationale** for your hallucination score.
3. **If the score is above 40%**, suggest one or more of the following recovery actions:
- 🔄 **Reset a broken file or component**
- 📁 **Request actual user file(s) to re-sync**
- 🧹 **Clean regenerate from scratch using project outline**
- 🔧 **Remodularize**: break current logic into smaller, independent components to reduce complexity and ambiguity
- 🧭 **Ask the user to clarify the goal or system state**
### ⚠️ Stack Traces
[Paste 3–6 recent stack traces here]
### 🛠️ Fix Attempts
[Summarize or paste AI-generated edits: filenames + key logic]
### 🧠 Required Output
There's a lot of Hallucination Risk Score: [ ]%
Explanation: [Brief reasoning]
Recommended Action(s): [Choose from options above]
Please err on the side of caution. If you're not confident in your current internal representation, treat that as a high-risk signal.