robots on payroll.

THE VAULT / RUN IT LIKE A BUSINESS / PROMPTS + MARKDOWN

The Debug Loop

Every vibe-coded project hits the moment where the agent stops fixing your bug and starts making it worse. This is my recovery system for that moment: a 7-step loop, 10 paste-ready investigation prompts, a CLAUDE.md block that changes agent behavior mid-debug, and a table that tells you when to stop and git reset. Most of what I know about debugging agents I learned the expensive way: from the bugs they wrote in my own projects.

LAST VERIFIED 2026-07-09

NOTE

Use this page as a prompt reference. Every file below is built to be handed straight to an AI. Download it, drop it into Claude, ChatGPT, Cursor, or Lovable, and say "use this as my playbook." The prompts on this page are copy-paste ready.

The failure spiral: it guesses, you paste, it guesses worse

You know the shape of it. Something breaks. You paste the error. The agent says "I see the issue!" and changes some code. It doesn't work. You paste the new error. "Ah, I see the actual issue now!" More changes. By round five your diff is 400 lines, three of the changes were guesses that didn't get reverted, and the original bug is still there, now wearing a disguise.

Here's why it happens. When you paste an error and ask for a fix, you are asking the agent to pattern-match a stack trace to the most statistically likely cause. Sometimes that's right. When it's wrong, each failed fix adds noise: new code, new behavior, a longer conversation full of confident wrong explanations that the agent keeps re-reading as if they were evidence. The context fills up with its own bad guesses. Round one had maybe a 50/50 shot. Round five is guessing inside a haunted house it built itself.

RoundWhat you sayWhat actually happens
1"here's the error, fix it"Plausible guess. Coin flip.
2"still broken, here's the new error"Guess #2 stacked on unreverted guess #1.
3"STILL broken"Agent starts changing things near the error, not causing it.
4"why is it worse now??"It's debugging its own failed fixes. Original bug buried.
5"forget it, rewrite the whole file"Congratulations, you now have new bugs with no repro for the old one.

WATCH OUT

The one rule that breaks the spiral: stop prompting for fixes, start prompting for investigation. "Fix this error" invites a guess. "Trace this value from the form to the database and show me where it changes" produces evidence. Agents are genuinely good at investigation. They read code fast, they grep everything, they don't get bored. You just have to ask for that instead of a fix.

Everything below is that one rule turned into a system: a loop to run, prompts to paste, and standing instructions so the agent behaves this way by default.

The loop: 7 steps, in order, no skipping

This is the same loop professional debuggers have used for decades. Nothing here is novel. What's new is that you're not doing the steps yourself, you're directing an agent through them, and the agent will skip steps if you let it. It especially wants to skip 1 and jump to 6.

  1. 1

    Reproduce

    Get the bug to happen on demand with one command. A bug you can't reproduce is a bug you can't verify is fixed, which means every "fixed it!" is a vibe. If it's intermittent, measure the failure rate (run it 20 times, count).

  2. 2

    Isolate

    Shrink the world. Which file, which function, which input, which line? The repro that needs your whole app is a bad repro; the one that fails with a single function call is a map to the bug.

  3. 3

    Instrument

    Look at real values, not imagined ones. Add logging at the boundary where data crosses systems (client to API, API to DB, your code to a third-party SDK). Most bugs live at boundaries. Prefix every debug line so you can remove them with one grep.

  4. 4

    Hypothesize

    Force an explicit theory: root cause in two sentences, plus why the bug presents exactly the way it does. If the theory can't explain the weird part ("why only some users?"), it's not the theory. Get three ranked hypotheses when one theory has taken over the room.

  5. 5

    Bisect

    When it used to work, don't read diffs, binary search them. git bisect finds the breaking commit in log2(n) steps: 6 runs covers 64 commits, 10 runs covers 1,000. Agents are excellent at driving this mechanically.

  6. 6

    Fix

    Minimal change, one hypothesis at a time. If the fix doesn't make the repro pass, revert it fully before trying the next idea. The spiral in section one is what happens when this rule gets skipped.

  7. 7

    Regression-proof

    Turn the repro into a permanent test, prove the test fails without the fix and passes with it, then write a 10-line postmortem note. Two minutes of writing beats re-debugging the same class of bug in August.

NOTE

You won't need all 7 steps for every bug. A typo-class bug is reproduce, fix, regression-proof, done in 10 minutes. The full loop is for the bugs that survived your first two attempts. The moment a bug survives two fix attempts, drop into the full loop. That's the trigger.

The 10 prompts: paste-ready, in the order you'll need them

Each prompt maps to a step in the loop. Fill the [SLOTS], paste, and hold the agent to the output format. Prompts 1 to 4 are investigation, 5 and 6 are the gate, 7 to 10 are the fix and the insurance. All ten are also in the download at the bottom.

PROMPT: 1. Reproduce it deterministically
We have a bug: [ONE-SENTENCE SYMPTOM, e.g. "checkout returns 500 for some users"].

Before touching any code, build me a deterministic reproduction:

1. Write the smallest possible script or test that triggers the bug on demand (a single command I can run, e.g. a test file or a curl call). Put it in [REPRO PATH, e.g. scripts/repro-checkout-500.sh].
2. Run it and confirm it fails. Paste the exact failing output.
3. If you cannot reproduce it, do NOT guess at a fix. Instead list the top 3 pieces of information you would need to reproduce it (specific log lines, input values, environment details) and stop there.

Constraints:
- Do not modify any production code in this step.
- The repro must not depend on manual clicking or timing luck.
- If the bug is intermittent, run the repro [N, e.g. 20] times and report the failure rate as a number.

Output format: (a) the repro file, (b) the command to run it, (c) the failing output, (d) failure rate if intermittent.
PROMPT: 2. Read before you write
Do not write or edit any code in this session until I say "go".

Read the code involved in [SYMPTOM] and give me a written trace:

1. Start at [ENTRY POINT, e.g. the POST /checkout handler] and follow the execution path to where the failure appears. List each file and function in order, with one line on what it does to the relevant data.
2. Quote the exact lines (with file paths and line numbers) where the failing value is created, transformed, and consumed.
3. Note anything surprising: dead code, duplicate logic, TODOs, error handling that swallows exceptions, values that change type along the way.

Constraints:
- Quotes must be real code you read, not reconstructions from memory.
- If you hit a boundary you cannot read (external API, compiled dependency), say so explicitly instead of describing what it "probably" does.

Output format: numbered trace, then a "surprises" list. No proposed fixes yet.

Prompt 2 is the highest-leverage one in the set. Agents default to writing code because that's what they get asked for all day. A forced read-only pass regularly finds the bug before a single line changes, and the "surprises" list often surfaces the real problem even when the trace doesn't.

PROMPT: 3. Instrument the boundary
The failure in [SYMPTOM] involves data crossing from [SIDE A, e.g. the client form] to [SIDE B, e.g. the API handler / the DB layer / the third-party SDK].

Add temporary instrumentation at that boundary:

1. Log the exact value entering the boundary and the exact value leaving it, with a unique prefix [PREFIX, e.g. "DBG-LOOP:"] so we can grep for it.
2. Include types, lengths, and null/undefined states, not just the values.
3. Run the repro from earlier ([REPRO COMMAND]) and paste every DBG line.
4. State in one sentence where the value stops matching expectations.

Constraints:
- Instrumentation only. Do not "fix things while you are in there".
- Never log secrets, tokens, or full user records; redact to shape and length.
- All added lines must contain the prefix so removal later is one grep.

Output format: diff of instrumentation, repro output, one-sentence conclusion.
PROMPT: 4. Binary search the timeline
This worked at [KNOWN-GOOD POINT, e.g. commit abc123 / yesterday's deploy / before we added feature X]. It fails now. Find the breaking change by bisecting, not by rereading the whole diff.

1. Confirm the repro ([REPRO COMMAND]) fails on the current state.
2. Use git bisect (or manual checkout of midpoint commits if bisect is not practical) between [KNOWN-GOOD REF] and HEAD, running the repro at each step. Log each commit tested and its pass/fail.
3. When you land on the first bad commit, show me: the commit hash, its message, its full diff, and the specific hunk you believe introduced the bug, with reasoning.

Constraints:
- Do not edit code during the bisect. Checkouts only.
- If the repro cannot run on old commits (schema drift, missing env), say which commit range is untestable instead of guessing.
- Return the working tree to its original state when done.

Output format: bisect log table (commit, result), then first-bad-commit report.
PROMPT: 5. Explain it to me first
Before proposing any fix for [SYMPTOM], explain the bug to me:

1. Root cause in 2 sentences maximum, in plain language.
2. The mechanism: the exact chain from cause to visible symptom, step by step, quoting the specific lines of code involved.
3. Why it presents the way it does: why [SPECIFIC WEIRDNESS, e.g. "only some users" / "only on the second click" / "only in prod"].
4. Confidence: high / medium / low, and the one experiment that would move low or medium to high.

Constraints:
- If you cannot fill in point 3, your explanation is incomplete. Say "I cannot yet explain [WEIRDNESS]" and propose the next investigation step instead of a fix.
- No code changes in this message.

I will reply "go" if the explanation holds. Only then do you propose a fix.

NOTE

Point 3 is the lie detector. A pattern-matched guess can produce a plausible root cause, but it usually can't explain the weird specifics ("why only on the second click?"). If the explanation doesn't cover the weirdness, the explanation is wrong, and you just saved yourself a bad fix round.

PROMPT: 6. Three hypotheses ranked
For the bug [SYMPTOM], with the evidence so far ([PASTE KEY EVIDENCE: repro output, log lines, trace conclusions]), give me exactly three distinct hypotheses for the root cause.

For each hypothesis:
1. The claim, one sentence.
2. What evidence supports it and what evidence contradicts it (be honest about the contradicting part).
3. A cheap discriminating test: the fastest check that would confirm or kill this hypothesis specifically. Estimate the time in minutes.
4. Probability estimate as a percentage. The three must sum to roughly 100.

Constraints:
- The hypotheses must be genuinely different mechanisms, not three flavors of the same theory.
- Rank by probability, highest first.
- Do not fix anything. After the table, run the cheapest discriminating test for the top hypothesis and report the result.

Output format: table with columns Hypothesis / For / Against / Test / Minutes / Probability, then the test result.
PROMPT: 7. Minimal fix only
Root cause is confirmed: [ONE-SENTENCE ROOT CAUSE].

Implement the minimal fix:

1. Change only what the root cause requires. Target: fewer than [N, e.g. 15] changed lines. If the true fix needs more, stop and tell me why before writing it.
2. No refactoring, no renaming, no "while I'm here" improvements, no new dependencies, no formatting changes outside touched lines.
3. Run the repro ([REPRO COMMAND]) and paste the passing output.
4. Run the existing test suite ([TEST COMMAND]) and paste the summary line.

Constraints:
- If the repro still fails, do not stack a second change on top. Revert your change, say the hypothesis was wrong, and go back to investigation.
- One hypothesis, one change, one verification. Never two changes per run.

Output format: the diff, repro output, test suite summary, and one sentence on why this change is sufficient.
PROMPT: 8. Prove it with a test
The fix for [SYMPTOM] is in. Now lock it down:

1. Convert the repro into a permanent automated test in [TEST PATH]. The test name should describe the bug, e.g. test_checkout_rejects_expired_coupon, not test_fix or test_bug.
2. Prove the test actually guards the bug: temporarily revert the fix (stash or comment it), run the test, show me it FAILS, then restore the fix and show me it PASSES. Paste both outputs.
3. Add a one-line comment above the test linking the context: "Regression test for [SHORT BUG DESCRIPTION], fixed [DATE]."

Constraints:
- The test must fail for the original reason, not for setup errors.
- No sleeps or timing hacks; if the bug is timing-dependent, make the test control the clock or the ordering explicitly.

Output format: the test file, the fail-then-pass proof, and the final test suite summary.
PROMPT: 9. What else does this touch
We changed [FILES/FUNCTIONS CHANGED] to fix [SYMPTOM]. Before we ship, map the blast radius:

1. List every caller and consumer of the changed functions, modules, or schemas. Use actual search of the codebase (grep/references), not memory.
2. For each, state in one line whether the behavior change can affect it, and how: no effect / benign effect / needs verification.
3. For every "needs verification" item, run the relevant test or a quick manual check and report the result.
4. Check the non-code surface too: config files, environment variables, migrations, cron jobs, API consumers outside this repo, cached values that might hold the old behavior.

Constraints:
- "No callers found" must be backed by the search command you ran and its output, not asserted.

Output format: table with columns Consumer / Effect / Verified how / Result, then a yes/no shipping verdict with one sentence of reasoning.
PROMPT: 10. Write the postmortem note
Write a postmortem note for the bug we just fixed and append it to [NOTES PATH, e.g. docs/debug-log.md]. Keep it under 15 lines:

- Date: [TODAY]
- Symptom: what we saw, one line.
- Root cause: the actual mechanism, two lines max.
- Time sink: where the debugging time actually went, and what would have found it faster.
- Fix: one line plus the commit/PR reference.
- Regression test: file and test name.
- Prevention: one concrete rule, check, or CLAUDE.md line that would stop this class of bug from happening again. If it belongs in CLAUDE.md or a lint rule, propose the exact text.

Constraints:
- Plain facts, no narrative. A future agent should be able to read this in 20 seconds and avoid the same hole.

Output format: the appended note, plus the proposed prevention rule as a separate copy-ready block if there is one.

PAYOFF

The postmortem note compounds. After a couple months you have a debug-log.md the agent can read at the start of any debugging session, and it stops re-making your project's signature mistakes. It's the cheapest 15 lines you'll write all week.

The CLAUDE.md recovery block: make investigation the default

The prompts above are manual. This block makes the behavior automatic. Paste it into your project's CLAUDE.md (or AGENTS.md, or .cursorrules, whatever your agent reads as standing instructions) and the agent switches into investigation mode the moment a bug appears, without you typing anything.

The three rules doing the heavy lifting: never claim fixed without running the repro, one hypothesis at a time with mandatory reverts, and prefer reading code to writing it. The rest is guardrails around the classic agent failure modes: silencing errors instead of fixing them, weakening tests to make suites pass, and leaving failed-fix debris in the tree.

CLAUDE.md (append)
## Debugging rules

When we are debugging (a test fails, an error appears, behavior is wrong),
switch from building mode to investigation mode. These rules override your
defaults until the bug is fixed and regression-tested.

### Investigation before code

- Prefer READING code to WRITING code. Before proposing any change, trace
  the execution path and quote the specific lines involved (file + line).
- Never propose a fix until you can state the root cause in two sentences
  AND explain why the bug presents exactly the way it does (why these
  inputs, why intermittent, why only in this environment). If you cannot,
  say what information is missing and how to get it.
- If you cannot reproduce the bug with a command or test, your first task
  is building that reproduction, not fixing anything.

### One hypothesis at a time

- State your current hypothesis explicitly before each change.
- One hypothesis, one change, one verification run. Never stack a second
  change on top of an unverified first change.
- If a change does not fix the repro, REVERT it before trying the next
  hypothesis. Do not leave failed-fix debris in the working tree.
- After 3 failed hypotheses, stop proposing fixes. Summarize what has been
  ruled out and recommend either instrumentation, a git bisect, or reverting
  to the last known-good state.

### Honest verification

- Never claim something is fixed without running the reproduction and
  showing the passing output in the same message. "This should fix it"
  is banned vocabulary; run it.
- Never weaken, skip, delete, or mark-as-expected-failure a test to make
  the suite pass. If you believe a test itself is wrong, stop and say so;
  the human decides.
- Do not silence errors (empty catch blocks, broad exception handlers,
  ignoring return codes, @ts-ignore, eslint-disable) as a fix. Silencing
  a symptom is not fixing a bug.
- When the fix works, immediately convert the reproduction into a permanent
  regression test, and prove it: show the test failing with the fix
  reverted and passing with the fix applied.

### Minimal footprint

- Fixes change the fewest lines that the root cause requires. No
  refactoring, renaming, dependency bumps, or formatting churn inside a
  bugfix. Propose cleanups separately, after the fix ships.
- Temporary debug logging must carry a "DBG:" prefix and must be removed
  before the fix is final. Grep for the prefix to confirm.
- Never log secrets or full user records while instrumenting; redact to
  shape and length.

### Escalation honesty

- If evidence points outside the code you can see (third-party outage,
  data corruption, infra config), say so directly instead of changing
  application code to route around a mystery.
- If we have been debugging one bug for a long stretch with rising diff
  size and no confirmed root cause, recommend `git stash` or reset to the
  last known-good commit and a fresh start with a better reproduction.
  Recommending a reset is a valid and welcome answer.

WATCH OUT

Standing instructions are strong defaults, not guarantees. Agents still drift, especially deep into a long session when early instructions carry less weight. When you see the drift (a "this should fix it" without a run, a second change stacked on the first), don't argue, just paste the relevant prompt from the set above. The prompts are the enforcement layer.

  • [ ]Pasted the block into CLAUDE.md (or AGENTS.md / .cursorrules)
  • [ ]Deleted any rules you don't actually want enforced (half-believed rules train the agent to ignore all of them)
  • [ ]Started a fresh session so the agent reads the updated file
  • [ ]Tested it: introduced a trivial bug and confirmed the agent traces before it edits

When to git reset instead: the sunk cost table

Sometimes the right move is not a better debugging prompt. It's throwing the session away. This feels terrible and is frequently correct: with agent coding, regenerating from a clean state plus a better prompt is often cheaper than untangling a corrupted one. The 40 minutes you spent isn't an investment, it's the sunk cost, and the mess in your working tree is compounding interest on it.

My rule of thumb, as a table. Find your row by two numbers: minutes spent on this one bug, and lines changed since the last known-good commit.

Time on this bugLines changed since known-goodThe move
< 15 min< 50Keep going. Normal debugging. Run the loop.
15-45 min< 50Keep going, but switch to investigation prompts (1, 2, 5) if you haven't. Small diff means the bug is findable.
15-45 min50-300Yellow zone. git stash, re-run the repro on clean code. If it passes, your "fixes" were the bug. If it fails, restore and continue with a real repro in hand.
> 45 min< 50The diff isn't the problem, the model is. Fresh session, same tree, open with prompt 2 (read before you write). Long conversations full of failed theories poison the next guess.
> 45 min> 300Reset. git reset --hard to known-good (or git stash if you're nervous), fresh session, and re-attempt with the repro and everything you learned in the prompt.
AnyYou can no longer explain the diffReset. If neither you nor the agent can say what half the changes are for, you're not debugging anymore, you're archaeology.

NOTE

The stash trick in the yellow zone is criminally underused. git stash costs 5 seconds and answers the scariest question directly: is the original bug still there, or are you now debugging your own fixes? About half the time I run it in a messy session, the clean tree passes.

PAYOFF

A reset is not starting over. You keep the repro script, the trace, the ruled-out hypotheses, and the postmortem notes. Attempt two with that package usually lands in a fraction of the time attempt one burned. Commit working states often (every green moment) and "known-good" is never far away.

The nastiest cases, each with its opening prompt

Four bug families that eat vibe coders alive, because the naive repro loop doesn't work on them: the bug hides in an environment, a timing window, or yesterday's data. Each accordion has the shape of the bug, the trap agents fall into, and the specific opening prompt to paste.

Works locally, fails in prod

The defining feature: your repro command passes on your machine, so the standard loop stalls at step 1. The bug lives in a difference between environments, and the fastest path is enumerating the differences, not staring at the code. The usual suspects: env vars, Node/Python/runtime version, build flags (minification, NODE_ENV=production), a managed DB vs your local one, case-sensitive filesystems, timezone of the server, and secrets that exist locally but not in the deploy.

WATCH OUT

The agent trap: it can't see prod, so it theorizes about code it CAN see and starts "hardening" random functions. Refuse any code change until the diff table below is filled in.

PROMPT: Opening prompt: diff the environments
Bug: [SYMPTOM] happens in production but not locally. Repro command locally: [REPRO COMMAND], currently passing.

Do not change any application code. First, build me an environment diff:

1. List every dimension where prod and local can differ for this code path: runtime version, env vars consumed (grep the codebase for process.env / os.environ usage and list every variable this path reads), build mode and flags, database engine and version, filesystem case sensitivity, timezone, locale, installed system dependencies, request path (proxy/CDN/load balancer in front).
2. For each dimension, fill in: local value (read it from my machine/config), prod value (read it from [DEPLOY CONFIG LOCATION, e.g. vercel.json / Dockerfile / fly.toml / .github/workflows], or mark UNKNOWN with the exact command or dashboard page I should check).
3. Rank the differences by likelihood of causing [SYMPTOM], with one line of reasoning each.
4. Propose the cheapest way to make my local run more prod-like for the top candidate (e.g. NODE_ENV=production, prod build served locally, same DB engine in Docker) so we can reproduce locally.

Output format: table with columns Dimension / Local / Prod / Suspect ranking, then the local-reproduction plan. No code changes.
Race conditions and heisenbugs

Fails 1 time in 10, never under the debugger, always in front of users. The tell-tale signs: the bug involves "sometimes", it appears under load or on slow networks, it involves two things finishing in an unpredictable order (two awaits, a webhook and a redirect, a read racing a write), or adding a console.log makes it go away.

WATCH OUT

The agent trap: sprinkling sleeps and retries until the failure rate drops below your patience threshold. That's not a fix, that's moving the race to a customer with a slower connection. Never accept a fix whose mechanism is "wait longer."

PROMPT: Opening prompt: make the race deterministic
Bug: [SYMPTOM], intermittent. It fails roughly [FAILURE RATE, e.g. "2 times in 10"] and seems related to [SUSPECTED TRIGGER, e.g. "fast double-clicks" / "slow network" / "two requests at once"].

Treat this as a race condition until proven otherwise. Do not add sleeps, retries, or timeouts as a fix at any point.

1. Map every concurrent thing in this code path: async operations, awaits, promises not awaited, event handlers, timers, webhooks, background jobs, and every piece of shared state they read or write (module-level variables, caches, DB rows, localStorage).
2. For each pair that touches the same state, state the assumed order and what breaks if the order flips.
3. Build a deterministic repro by CONTROLLING the order, not by timing luck: inject delays or manual promise resolution at the suspect points in a test so the bad ordering happens every time. Show me the repro failing 5 out of 5 runs.
4. Only then, propose a fix from this menu, justified: proper awaiting/sequencing, a lock or mutex, idempotency key, disable-while-pending on the UI action, atomic DB operation (transaction, unique constraint, compare-and-swap). Explain why your pick eliminates the race rather than shrinking the window.

Output format: concurrency map, ordering analysis, deterministic repro with 5/5 failing runs, then the proposed fix with mechanism.
Stale caches: the fix that refuses to appear

You changed the code, the behavior didn't change. Or the data updated, the UI still shows the old value. Before you question your sanity, question the 6+ layers that can serve you yesterday: browser cache, service worker, CDN, framework build cache (Next.js is famous for .next weirdness), server-side data cache, Redis/memcached, DB query cache, and your own memoization. A stale cache turns a correct fix into an "unfixable" bug, which then baits you into breaking the correct fix.

NOTE

Fast sanity check before the prompt: hard-refresh in a private window, and add an obvious marker (a console.log with a timestamp, a visible string) to prove the code you're editing is the code that's running. If the marker doesn't show up, you're editing the right file and running the wrong build.

PROMPT: Opening prompt: audit the cache layers
Symptom: I changed [WHAT YOU CHANGED, code or data] but the running app still shows the old behavior at [WHERE]. Assume a stale cache until proven otherwise.

1. Prove which version is actually executing: add a marker (log line or visible string with a timestamp) to the changed code, rebuild/restart via [BUILD/RUN COMMAND], and confirm whether the marker appears. Report yes/no.
2. Enumerate every cache layer between my edit and my eyeballs in THIS stack: browser cache, service worker, CDN ([CDN/HOST, e.g. Vercel/Cloudflare, or "none"]), framework build cache, server data cache or ISR/revalidation, Redis/memcached, ORM or query cache, in-code memoization, and stale processes (old dev server, orphaned worker). Mark each as present/absent in this project by reading the actual config, not guessing.
3. Give me flush commands for each present layer, ordered cheapest first, and we clear them ONE at a time, rechecking the symptom after each, so we learn which layer it was.
4. When we find it, tell me the invalidation bug: why did this layer hold stale data, and what invalidation rule or cache key change prevents it, rather than "clear the cache" as a lifestyle.

Output format: marker result, cache layer table (layer / present? / evidence / flush command), then the layer-by-layer clearing log and the invalidation fix.
Env drift: it broke and nobody changed the code

No commits, but it's broken. Something outside your repo moved: a dependency updated (loose version ranges plus a fresh install), a third-party API changed behavior or deprecated something, an API key expired or hit a quota, a certificate lapsed, a platform runtime auto-upgraded, or an env var got edited in a dashboard where there's no git blame. Vibe-coded stacks are extra exposed because agents happily add dependencies with loose ^ ranges and you accumulate 40 of them without noticing.

WATCH OUT

The agent trap: it assumes the cause is in the code, because the code is all it can see. It will "find" a plausible-looking bug in code that has worked untouched for 3 months, and fix it. Now you have drift AND a code change.

PROMPT: Opening prompt: what moved outside the repo
Bug: [SYMPTOM] started around [WHEN IT STARTED]. git log shows no code changes in that window ([CONFIRM: paste `git log --since=... --oneline` output]). Therefore assume the cause is OUTSIDE the repo. Do not modify application code.

Investigate the external surface in this order and report findings for each:

1. Dependencies: compare the lockfile to what is actually installed ([PACKAGE MANAGER, e.g. npm/pnpm/pip]). Was anything installed, rebuilt, or updated recently? List packages whose resolved version could have changed under loose ranges, newest first.
2. Third-party APIs this path calls ([LIST SERVICES, e.g. Stripe, OpenAI, an email API]): check the exact error responses we get now (status codes, error bodies, headers). Do any indicate auth failure, quota, deprecation, or a changed response shape? Check the service's status page and changelog if reachable.
3. Credentials and quotas: list every key, token, and cert this path uses (by env var name only, never print values). For each: does the error pattern match expiry or rate limiting (401/403/429)?
4. Platform: runtime version, OS image, or build image changes on [HOST, e.g. Vercel/Railway/a VPS]; check for auto-upgrade notes in the deploy logs.
5. Data: did the shape or volume of incoming data change (a new user input pattern, a row that violates an old assumption)? Sample recent failing inputs vs older succeeding ones.

Output format: findings per category with evidence, a ranked list of suspected causes, and the single cheapest confirming check for the top suspect. Code changes only after we confirm the cause, and only if the right fix is actually in the code (e.g. pinning a version), not a workaround for someone else's outage.

Downloads: the prompts and the CLAUDE.md block as files

Both artifacts as standalone files: keep debug-prompts.md somewhere you can copy from fast (I keep mine in the repo at docs/, so the agent can also read it), and paste the recovery block into your project instructions today, before the next bug, not during it.

PAYOFF

The 60-second install: paste the recovery block into CLAUDE.md, drop debug-prompts.md into docs/, commit. Next time a bug survives two fix attempts, you run the loop instead of the spiral. That swap is worth hours the first week you use it.

Get the next drop

Every new Vault system ships to the list first. Twice a week, free.