# Appendix 13: AI Hallucination Check Prompt # Book: Freestyle Cognition # Chapter URL: https://programmer.ie/books/freestyle-cognition/29-chapter/ # Prose fingerprint (sha256, normalized): 65bf4475bd0073de13365a6af095426c54a711824de42a19e8f815cc059da84c # Snapshot generated at build time by Hugo. This is the complete rendered prose # of the chapter; it is not a transcript of the source file. 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.