# Root Cause
<!--
ref: @protocol/root-cause
tags: [debugging, root-cause, discipline, architecture, escalation]
triggers: [still broken, same bug again, keeps coming back, fix broke something else, patch on patch]
trigger_prompt: Use when debugging is looping — recurring symptoms, serial patches to one subsystem, or a suspected structural cause that instance fixes keep missing. Includes a hard stop after 3 failed fixes.
complements: [@protocol/compound-learnings, @protocol/protocol-audit]
version: 3
updated_at: 2026-10-26T20:50:43.756Z
-->
No fix before you can state the root cause: first check prior activity (recent changes, earlier findings and failed fixes) and build on it, then reconstruct how the system works, restate the real ask, diff against the nearest working example, fix at the level of the cause, and hard-stop to question the architecture after three failed fixes.
## The iron rule
**Do not write a fix before you can state the root cause.** A fix you can't tie to a stated root cause is a patch, and patches to unstated causes are how a codebase accumulates the same bug in five costumes.
## The five phases
### 0. Check prior activity before you research
Most problems are one of two kinds, and both leave a trail:
- **Recent** — something changed and the problem followed. The change log is the guide: `git log --since` / `git log -p` and `git blame` on the failing path, recent deploys, config edits, dependency bumps. Start the reconstruction from what moved.
- **Long-standing** — it has been noticed before, so there is already data: an issue or impulse, a past session, a notes entry, a lesson, a fix that was tried and reverted. Search the tracker (`/impulse` search, the repo's issues), the knowledge base (`/search?q=<symptom>`), and past sessions (`@protocol/flashback`) for the symptom, the component, and the error text.
Write down what you found in two lists — **already tried (and what happened)** and **already known** — before forming a hypothesis. **Re-doing research that exists, or re-trying a fix that already failed, is not allowed: build on the prior art.** If the trail is empty, say so and name where you looked; an unsearched "nothing known" reads exactly like a searched one.
### 1. Reconstruct how the system actually works
Ground truth, not memory or assumption: read the code paths, probe the endpoints, check what actually fires. Write the reconstruction down in a few lines — "message arrives → handler X → state lives only on the client → server loop starts cold." The act of writing it usually exposes the fault line. If external behavior is involved, check current documentation or discovery endpoints rather than guessing (APIs drift; your model of them is stale by default).
### 2. Restate the real ask
What must be true for the operator, stated as outcomes ("the agent stays coherent across a conversation; corrections are possible; nothing is lost on interrupt") — not as the absence of the current symptom. Patch-loops live in the gap between "make the error go away" and what was actually wanted.
### 3. Pattern analysis against working examples
Find the nearest thing that works — a working code path, a passing configuration, a prior version (phase 0's change log usually names it) — and diff behavior, not vibes. What is structurally different? One hypothesis at a time: state it, design the single cheapest observation that would falsify it, run that. Resist testing three hypotheses in one change; you won't know which one the evidence answered.
### 4. Fix at the level of the cause
If the root cause is structural (state in the wrong place, a missing adapter, a generator producing the wrong shape), the fix is structural — change the system, not the instance. Guard it: a failing check first that passes after, so the class of bug can't silently return.
**Leave the trail for the next one.** Record the root cause, what was tried, and what worked where phase 0 would find it — on the issue or impulse, in the commit message, and in a lesson if it generalizes. Phase 0 only works if every previous run fed it.
## Stopping condition
**After 3 failed fixes, stop fixing** — and count the failed fixes phase 0 found from earlier sessions and other agents, not only your own. Three misses means the fault is above the level you're patching at — question the architecture: is the loop itself wrong? Is the state in the wrong tier? Is the abstraction lying? Zoom out to phase 1 and reconstruct the system fresh; do not attempt fix #4 in the same frame that produced #1-3.
## Calibration move: the adversarial plan diff
When the diagnosis matters and you can afford it, run the same diagnosis prompt in a second, clean session (ideally a stronger model tier), then have one critique the other's plan: *"given this conclusion, what did that plan get dangerously wrong?"* Categorize the misses (reintroduces a fixed bug class / factually wrong about a dependency / backwards on a protocol-level behavior). This tells you where your default tier can be trusted to plan alone — and where it can't.
## Signature smells that this protocol should have been running already
- The commit log is a string of small patches to the same subsystem
- "It's still broken" after a fix that "worked"
- Each fix is explainable only in terms of the previous fix
- You've pointed at the suspected cause in a prompt and the fix still went instance-level
- The issue, impulse or notes already record this symptom, and your plan doesn't mention what they say
- Your proposed fix is one an earlier session already tried
---
*Related: `@content/youtube/aie/the-one-thing-every-ai-agent-framework-agrees-on-mislav-ivanda-daytona` · `@content/youtube/ai-jason/how-to-install-and-use-claude-code-agent-teams-reverse-engineered` · `@protocol/stuck` · `@protocol/example-impulse` · `@agentsite/project`*
---
*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*
*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*