AI models will hallucinate, hallucinate, and hallucinate some more. Your velocity is determined by how quickly you can recover from these inevitable failures.
1The Stack Trace Feedback Loop
When writing code manually, a stack trace is an analytical puzzle for you to solve. When generating code with an AI, the stack trace is simply feedback data for the neural network. Do not waste cognitive energy trying to reverse-engineer the AI's hallucination. Highlight the error, paste it into the chat, and demand a fix. The AI is vastly faster at reading and understanding its own error outputs than you are.
2Context Poisoning
An LLM's chat history is its memory. If you try three different approaches to fix a bug in a single chat, the AI's memory now contains the broken original code, the broken fix 1, the broken fix 2, and the broken fix 3. When you ask for fix 4, the AI is looking at a massive wall of broken logic, leading to 'Context Poisoning'. The AI will become confused and start looping. The only cure is to close the chat, open a new one, and provide the clean, current state of the file.
3Defeating Outdated Training Data
If an AI continually writes code for an older version of an API (like Stripe or Next.js), you cannot argue with it. Its foundational training weights are locked. You must provide external, factual data. By using a @Docs tag or pasting a link to the modern documentation into the prompt, you force the AI to read the real-time facts, overriding its probabilistic tendency to generate outdated syntax.
