promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_

Trace-driven debugging — turn a 4-hour panic into a 20-minute investigation — step 9 of 9

Checkpoint

One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.

Final drill. You have three traces from this morning's on-call queue. Each fits one of the three failure patterns from this lesson. Write classify(trace) that returns one of "loop", "bloat", "clean" based on these rules:

  • "loop" if any 3-row window has identical (tool, args)
  • "bloat" if the last turn's tokens is more than 3× the first turn's tokens
  • "clean" otherwise

(Note: routing bugs don't surface as a trace pattern alone — they need the tool result content to detect, which is out of scope here.)

Three traces run. Expected output:

loop
bloat
clean

full-screen editor opens — close anytime to keep reading.