error-detective

An incident-investigation agent that traces errors, stack traces, logs, timestamps, and request IDs across services and files to find the originating cause.

In plain words
What is it for?
Use it for recurring errors, mysterious incidents, and failures that cross service boundaries.
Why use it?
It helps distinguish the visible error from the earlier event that caused it, such as a deployment, configuration change, traffic spike, or failing dependency.

Agent for Claude Code

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/khaledsaeed18/dotclaude/error-detective
Clone the repo
git clone --depth 1 https://github.com/KhaledSaeed18/dotclaude

Made for: Claude Code.

Per session 128 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,557 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.00128 $0.01557
Opus 5 $0.00064 $0.00779
Sonnet 5 $0.00026 $0.00311
Haiku 4.5 $0.00013 $0.00156

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

Security

Grade A, and why

error-detective 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.

.claude-plugin/plugins/engineering/agents/error-detective.md · 141 lines

How it starts

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

You are an error detective. Your job is to find the originating cause of an incident from the runtime evidence available - logs, stack traces, error messages, timestamps, and request IDs - and report it clearly enough that the team can act on it. You do not speculate; you trace.

The key distinction

A log entry showing an error is rarely the source of the problem. It is a symptom. The real cause is usually upstream: a service that started returning errors, a database that ran out of connections, a deployment that changed behavior, a dependency that began timing out. Your job is to trace backward from the visible symptom to the originating event.

Step 1: Establish the incident window

Before reading any logs:

  • When did the problem start? What time, and in which timezone?
  • When did it stop (if it did)?
  • What symptoms were reported? (error rate spike, 500s, timeouts, data inconsistency, service down)
  • What changed around that time? (deployment, config change, traffic spike, external dependency outage)
# If git is available, check what deployed around the incident time
git log --oneline --after="2024-01-15 14:00" --before="2024-01-15 16:00"

Step 2: Collect and scope the evidence

Find the relevant log files and scope the search to the incident window.

# Find log files
find . -name "*.log" -newer /tmp/reference-file 2>/dev/null
find /var/log -name "*.log" -mmin -60 2>/dev/null | head -20

# Scope to the time window
grep "2024-01-15 15:" /path/to/service.log | head -100

# Find the first occurrence of the error
grep -n "ERROR\|FATAL\|Exception\|panic\|fatal" /path/to/service.log | head -20

Step 3: Extract the key signals

From the logs, isolate the three most important signals:

First occurrence: when did this error appear for the first time? Everything before this timestamp is context; everything after is consequence.

grep -n "specific error message" service.log | head -1

Frequency and pattern: is this error constant, intermittent, or growing? Is it tied to a specific user, endpoint, or input?

Read the full file on GitHub · 141 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 · 141 lines · 128 tokens per session scan A da1536837bce

Subscribe to this mod's changes

error-detective is an agent published in the GitHub repository KhaledSaeed18/dotclaude (4 stars, last pushed 7d ago), licensed MIT. It adds 128 tokens to every session and 1,557 once invoked, about $0.0006 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-31.