Module 8: DebuggingLesson 3 of 4

The Mindset Shift

The Mindset Shift

Stop blaming the AI. Start fixing your system.

The Wrong Mindset

"The AI is stupid. It keeps making mistakes."

This mindset leads to:

  • Prompt hacking (adding more and more instructions)
  • Frustration
  • Giving up

The Right Mindset

"My system isn't set up for this task. What's missing?"

This mindset leads to:

  • Root cause analysis
  • Systematic improvement
  • Reliable agents

The Framework

When something goes wrong, ask:

1. Was the instruction clear?

Test: Could a smart human colleague follow this instruction?

If no: Rewrite the instruction

Bad: "Fix the bug" Good: "Fix the TypeError in line 42 of auth.js by checking if user is null before accessing .email"

2. Did the agent have needed context?

Test: Was all required information available?

If no: Add context to memory or instruction

Bad: "Update the config" (which config? to what?) Good: "Update config.yaml to set debug: true"

3. Did the agent have needed tools?

Test: Is there a tool that can accomplish this?

If no: Add the tool or rethink the approach

Bad: "Send an email" (no email tool) Good: "Draft an email" (can do) + send manually

4. Was the task appropriate for an agent?

Test: Should this be automated at all?

If no: Do it yourself or simplify

Bad: "Make the app perfect" Good: "Add input validation to the login form"

Real Debug Example

Problem: Agent keeps forgetting project details

Wrong approach:

"REMEMBER THE PROJECT IS CALLED PHOENIX. DON'T FORGET!"

Right approach:

  1. Why is it forgetting? (Check if memory is being saved)
  2. Is the info in MEMORY.md? (Add it if not)
  3. Is MEMORY.md being loaded? (Check AGENTS.md)
  4. Is compaction losing info? (Add pre-compaction saves)

Root cause: Memory wasn't being saved to daily logs

Fix: Update AGENTS.md with explicit save rules

The Debugging Loop

1. Observe the failure 2. Ask: What's missing from my system? 3. Identify: Context? Tools? Instructions? Architecture? 4. Fix the system (not just the prompt) 5. Test again 6. Repeat until reliable

Key Principle

Make the system more capable, not the prompts more clever.

Clever prompts are fragile. Capable systems are robust.