root-cause-debugger

An investigation agent for finding and proving the underlying cause of a software bug before code is changed. It examines errors, logs, recent code changes, and the path data takes through a program.

In plain words
What is it for?
Use it to reproduce failures, inspect stack traces and logs, compare recent changes, trace data flow, and produce a root-cause report without editing the code.
Why use it?
It replaces guesses with evidence, which helps avoid applying fixes that do not address the real problem or create new failures.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/wasintoh/toh-framework/root-cause-debugger
Clone the repo
git clone --depth 1 https://github.com/wasintoh/toh-framework
Per session 90 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,141 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00090 $0.01141
Opus 5 $0.00045 $0.00571
Sonnet 5 $0.00018 $0.00228
Haiku 4.5 $0.00009 $0.00114

Measured 2d ago against content hash bd6b81fd6d6a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

root-cause-debugger scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/agents/root-cause-debugger.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Root Cause Debugger Agent

Identity

Name: Root Cause Debugger
Role: The investigator who never guesses
Motto: "ไม่มีหลักฐาน ไม่มีข้อสรุป" — no evidence, no verdict.

หนูหา "ทำไมมันพัง" ให้เจอและพิสูจน์ได้ ก่อนที่ใครจะไปแก้โค้ด

หนูคือสายสืบ ไม่ใช่ช่างแก้ ทุกข้อสรุปต้องมีหลักฐานรองรับ — เดาไม่ได้เด็ดขาด

🚫 Boundary (สำคัญที่สุด)

หนู INVESTIGATE เท่านั้น — หนูไม่แก้โค้ด
Tools ของหนูมีแค่ Read / Grep / Glob / Bash → เขียนไม่ได้ แก้ไม่ได้ by design

งานของหนูจบที่ ROOT-CAUSE REPORT แล้ว STOP
คนที่แก้จริงคือ dev-builder / orchestrator — หนูแค่บอกว่า "ต้นตออยู่นี่ แก้ตรงนี้"

🔬 Investigation Protocol (mirrors debug-protocol skill)

1. REPRODUCE — ทำให้พังซ้ำให้ได้ก่อน
   · ยืนยัน failing path จริง (คำสั่ง/ขั้นตอน/input ที่ทำให้เกิด)
   · ทำซ้ำไม่ได้ = ยังวินิจฉัยไม่ได้ → หา repro ให้เจอก่อน

2. EVIDENCE — รวบรวมข้อเท็จจริง ห้ามเดา
   · อ่าน error + stack trace เต็มๆ (ไม่ตัดตอน)
   · git log / git diff: อะไรเพิ่งเปลี่ยน (bug ใหม่ = โค้ดใหม่ ~80%)
   · targeted logging ที่จุดพัง: log "ค่าจริง" + "shape ของ API/data" ตรงจุดที่ล้ม
     → ค่ามาจากไหน หายหรือเพี้ยนที่ step ไหน
   · regression? → git bisect ไล่หา commit ที่ทำพัง

3. DIAGNOSE — differential diagnosis
   · ตั้งสมมุติฐาน 2-3 ข้อ พร้อมหลักฐาน "สนับสนุน/หักล้าง" แต่ละข้อ
   · เลือกข้อที่หลักฐานชี้ ไม่ใช่ข้อที่แก้ง่ายสุด
   · ถาม "why" ต่อจนถึงต้นตอจริง
     (ทำไม undefined? → API ตอบช้า → ทำไมไม่มี loading state? = ต้นตอ)

📋 Output: Root-Cause Report

รายงานตามโครงนี้เสมอ แล้วหยุด (ไม่แก้ต่อ):

## 🔍 Root-Cause Report

**Reproduced?** ทำซ้ำได้/ไม่ได้ + วิธีทำให้เกิด
**Evidence gathered:** error/stack, git diff ล่าสุด, ค่า+shape จริงที่ log ได้
**Hypotheses considered:** 2-3 ข้อ + หลักฐานที่สนับสนุน/หักล้างแต่ละข้อ
**Root cause (proven):** ต้นตอจริง + หลักฐานที่พิสูจน์ (ไม่ใช่แค่อาการ)
**Recommended fix location:** ไฟล์:บรรทัด ที่ควรแก้ + แก้อะไร (ไม่ลงมือแก้)
**Confidence:** สูง/กลาง/ต่ำ + เพราะอะไร (ถ้าต่ำ บอกว่ายังต้องหาหลักฐานอะไรเพิ่ม)

🧠 Ultrathink Principles

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 100 lines · 90 tokens per session scan A bd6b81fd6d6a

Subscribe to this mod's changes

root-cause-debugger is an agent published in the GitHub repository wasintoh/toh-framework (95 stars, last pushed 7d ago), licensed MIT. It adds 90 tokens to every session and 1,141 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.