Smell #2: Prompt Drift

Severity: Medium

Prompt Drift: The phenomenon where successive chat iterations gradually deviate from the original design intent. Each "fix" adds complexity that obscures the original requirements until the code is a patchwork of guesses.

Symptoms

How to recognize this smell in your codebase:

  • [ ] You started wanting "Feature X" but ended with "Buggy Feature Y."
  • [ ] You cannot reconstruct the logic of a module from the chat history.
  • [ ] Each AI "fix" introduces a new, unrelated bug.
  • [ ] The chat session is longer than 15-20 turns.

Self-Assessment

If you checked 2+ items, your project is suffering from Prompt Drift.

Example

The Drift Pattern

  1. Turn 1: "Add task filtering." (AI works)
  2. Turn 5: "Why doesn't the search work with filters?" (AI adds search, logic gets complex)
  3. Turn 10: "The sorting broke when I search." (AI patches sort, filters break again)
  4. Turn 15: "Can we just start over?"

The Result: You have 300 lines of "Spaghetti Logic" where search, sort, and filter are tightly coupled and none of them work perfectly.

Debt Impact

This smell contributes to:

| Debt Category | Impact | |---------------|--------| | 🏗️ ARCH | Resulting code is "Patches on Patches" with no clean structure. | | 🧠 KNOW | Reasoning for each change is lost in a messy, deleted chat session. |

How to Fix

  1. The Reset: STOP iterating. Save the best version of the code you have.
  2. Learnings Extraction: Identify what didn't work in the previous chat.
  3. Start Fresh: Start a new chat session with a consolidated "Clean Prompt" that includes all requirements (Chapter 13).

How to Prevent

  • The 3-5 Turn Rule: If a feature isn't working by turn 5, your prompt was likely ambiguous. Reset.
  • Incremental Prompts: Prompt for one atomic task at a time.
  • Maintain a "Single Source of Truth": Use a persistent instructions file or memory file so the AI doesn't rely solely on the chat history.

Related Smells

Book Reference

Prompt Drift is explored in detail in Part I:

  • Chapter 2: Chat Until It Works — how drift compounds debt exponentially.
  • Chapter 13: Clean Prompts Revisited — the antidote to drift.

Stop chasing AI hallucinations