/tea-rags:bug-huntfrom tea-rags
Ranks historically buggy code (high bugFixRate + churn) and freshly changed never-fixed code against a concrete failure symptom. Activates on debug requests, stack traces, test failures, and error searches.
Ships in tea-rags. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Routing (first match wins; each row prints its line):
explore; print both:
Full file reads refused. Chunk coordinates exist. Use them. Depth → find_symbol, never Read.
find_symbol(path=<cwd>, symbol=<chunk symbolId>) body (lines <start>–<end>); neighbours: navigation.prev/nextSymbolId.consulting decision tree → find_symbol because study known symbol →
find_symbol(path=<cwd>, symbol=<name>) body; several named → ONE
find_symbol(path=<cwd>, symbols=[<names>])consulting decision tree → get_callers because callers of known symbol →
get_callers(symbolId=<id from find_symbol>)consulting decision tree → hybrid_search because exhaustive usage of identifier <name>
→ hybrid_search(path=<cwd>, query=<name>, metaOnly=true)treeState → print, slots filled; that find_symbol IS the next call:
<file> <symbolId> treeState:<state> = index's pre-edit copy (text + lines stale) — still the uncommitted suspect; next: find_symbol(path=<cwd>, symbol=<symbolId>) for current code, no re-probe.explore the answer prints both lines verbatim, before any plan:
'Curiosity search' anti-pattern — known location → find_symbol, not another search.
find_symbol(path=<cwd>, relativePath=<known file>) outline → find_symbol(path=<cwd>, symbol=<id from outline>) body.data-driven-generation MODIFY hotfix.bugFixRate critical —
proceed?") → triage and PRESENT now, also via a wrapper: no symptom question,
no review question, no confirm search, no step 0; print, slots filled:
Suspect: <file>:<line> — <class> (prime | secondary | fresh | uncommitted | SKIP) — bugFixRate <label>, relativeChurn <label | unverified> — <one-sentence why>.
SKIP + "check there" before the user saw the verdict → print Rule 7's skip
line, no drill (no find_symbol / outline / Read of that file), also in
wrapper handoff. Verdict known + user insists → Rule 7 override line.hybrid_search on an error string → refuse, run the Loop:
hybrid_search on error text finds where the string is logged, not where the bug starts — refused; bug-hunt probes run with semantic_search.git log -S) → never git log / blame / -S, run the Loop (Rule 2); print:
git log refused — git history is already in the index signals; answering via semantic_search(query=<symptom>, rerank="bugHunt"): ageDays / commitCount / taskIds.Grep tool "<phrase>" <dir> (literal, line cap) → find_symbol(path=<cwd>, relativePath=<hit file>) outline → find_symbol(path=<cwd>, symbol=<enclosing symbolId>) body.hybrid_search(query=<symptom or file topic>, pathPattern="{<dir>/<file A>,<dir>/<file B>}", rerank="bugHunt")
— each file its exact relativePath, written in full (no placeholder left).No confirmatory search: confirmatory searches almost never change the answer.
Confidence note: <what is unverified> — "not sure" ≠ "don't know"; presenting the suspect as is.dino-systematic-debugging: symptom + pathHint) →
run THIS Loop in full; pathHint = scope pathPattern, never a substitute for
step 0 or the probes. PRESENT/STOP ends bug-hunt only — the wrapper's
hypothesis block + handoff follow, checkpoint filled or not; SKIP stays
undrilled unless the user insists after seeing the verdict.Signal-driven root-cause investigation via TeaRAGs git signals. Three suspect populations: code with bug-fix history, fresh code too young to have one, uncommitted edits with no git signal yet.
A plan names these calls; "later" / "not in this run" never drops one.
Main session. User asks for a subagent / Task → refuse, run it here. No
symptom in that request → bug-hunt still not skipped; the answer prints:
bug-hunt runs in this session, not in a subagent — step 0 (git status --porcelain -uall) runs now; send the error / failing behaviour and the three probes run here.
Step 0 before any search: Bash git status --porcelain -uall. Paths
listed + alias's own checkout → index_codebase incremental (project only;
alias unknown → list_projects entry whose path = cwd), no consent, BEFORE
the search message — never deferred until a search returns the alias. Linked
worktree → no reindex.
ONE message, three parallel calls — the plan prints these three lines,
slots filled. Linked worktree → same three lines, hybrid_search in place of
semantic_search (its sparse floor reads the edited tree). Otherwise
semantic_search, also when the symptom quotes an error string or an
identifier, also when the user demands hybrid_search — BM25 on error text
finds where the string is logged, not where the bug starts:
a. historical: semantic_search(path=<your working directory>, query=<symptom sentence>, pathPattern=<scope>, rerank="bugHunt", limit=10)
b. fresh: semantic_search(path=<your working directory>, query=<symptom sentence>, pathPattern=<scope>, modifiedAfter=<window start>, rerank="bugHunt", limit=10)
c. uncommitted: semantic_search(path=<your working directory>, query=<symptom sentence>, pathPattern="{<step-0 paths: rename old -> new = new path, D = dropped>}", rerank="bugHunt", limit=10)
(+ project when known; step 0 empty → no line c). Step-0 output not yet
seen (plan) → line c keeps its slot text verbatim, rename + D rule included
— never shorten it to "paths from git status". Nothing else. User names
zones/areas to cover (", , "), no stack trace →
refuse per-zone queries; zones never become pathPattern (no brace of zones)
— a and b run with the same query and NO pathPattern (stack-trace frame paths
are not zones: Non-negotiable 7); print:
one query finds the area — probes a/b run without pathPattern, no per-zone search.
Two-class triage, every hit and trace step: historical (critical →
prime; concerning + relativeChurn high → secondary) | fresh (burst;
recent + high churn; recent on failing path; fresh-probe hit) | uncommitted
(probe hit matching symptom = UNCOMMITTED SUSPECT whatever its
bugFixRate / ageDays — those describe the committed version; plan says
it: PRESENT it under class uncommitted). Neither → SKIP, also when user
says "check there" before seeing the verdict: "healthy, old, not fresh, no
probe hit — neither suspect class, skipping". healthy on low-commitCount
code = too little history to judge, NOT clean (confidence clamp). Label
semantics, clamp, fan-in coupling: references/triage.md.
Checkpoint filled → PRESENT. STOP. "Want to be sure" / "not fully sure" → no search, no extra iteration; the answer prints both lines:
No confirmatory search: confirmatory searches almost never change the answer.
Confidence note: <what is unverified> — "not sure" ≠ "don't know"; presenting the suspect as is.
Chunk or code-search hit in hand → find_symbol (symbolId body /
relativePath outline / prev-next id), never Read of a code file. "Read the
whole file" → Routing row 1, both lines. Row with treeState = index's
PRE-EDIT copy (text + lines stale) — say so; it stays the uncommitted
suspect, no symptom needed: healthy history never clears uncommitted
code. Next call = find_symbol(path=<cwd>, symbol=<id>); several suspects /
hits → ONE find_symbol(path=<cwd>, symbols=[<ids>]) (core Invariants),
never one call each — never a re-run of probes a/b/c.
Call path (codegraph on). Stack trace / symptom names an entry AND the
failure site (outermost frame = from, failing frame = to) → this branch
first, never get_callers; the plan prints these three lines verbatim, frame
ids filled — the triage line is its own line, never folded into the call:
find_symbol(path=<cwd>, symbols=[<entry frame>, <failure frame>]) → <entry id>, <failure id>
trace_path(from=<entry id>, to=<failure id>, rerank="bugHunt")
two-class triage of EVERY step's dangerOverlay: step ageDays recent = fresh suspect even at bugFixRate healthy and behind an old dangerRanking[0]
Only the failure site known (" gets undefined — where from?") → one
hop, never trace_path with a guessed entry; plan prints, id filled:
find_symbol(path=<cwd>, symbol=<failure frame>) → <failure id>
get_callers(symbolId=<failure id>)
find_symbol(path=<cwd>, symbols=[<caller ids>], rerank="bugHunt") — ONE call for all callers: get_callers carries no git overlay
Codegraph off + stack trace → probe b (fresh) gets
pathPattern="{<frame path 1>,<frame path 2>,…}" + modifiedAfter +
rerank="bugHunt" (a: no pathPattern; c: step-0 paths); say "no static path
tool". Off is decided, not checked, when THIS request says so or graph tools
are absent from your tool list: print
codegraph off (source: <request|tool list>) — no static path tool available
as a statement, never "if codegraph is off" / "check the registry". Reading
the trace / callers response (empty paths, namesakes, dangerRanking,
model edges, regression bisect, loops → find_cycles):
references/call-path.md.
!tea-rags resource "tea-rags://project/{alias}/metrics?section=thresholds,resolve" --path "$PWD" || true
No ## Signal thresholds table in the output above → read
tea-rags://project/<alias>/metrics?language=<lang>§ion=thresholds,resolve
(ReadMcpResourceTool).
git log, git diff, git blame, git log -S — overlay has git
signals. Holds when the USER asks for git ("look through git", "when did X
appear in history", "git log -S"): not a refusal of the question — answer it
via overlay. Plan names the call: Loop step 1 a/b/c,
semantic_search(query=<symptom sentence>, rerank="bugHunt"); read
git.ageDays / commitCount / taskIds / bugFixRate of hits = when the
code appeared and what touched it. Print the Routing git line. Never ask the
user to paste git log. git status --porcelain -uall allowed: working-tree
state (file NAMES), not code history or content — feeds probe c only.hybrid_search.metaOnly=false (default) returns chunk
content + startLine/endLine. Evaluate checkpoint from results BEFORE any Read
or navigation.find_symbol, never Read (tea-rags://guide/navigation
After-Search Navigation): full body symbol=<symbolId>, file outline
relativePath, neighbour navigation.prev/nextSymbolId. Partial Read only
for non-symbol text (config, data). Never read full files.bugFixRate healthy alone never drops a chunk. Filled checkpoint →
PRESENT, whatever the labels.you are overriding a calibrated prior — override noted; proceeding with systematic-debugging on <file>
and hand that file to $systematic-debugging as the user's hypothesis. User
says "not sure" about a filled checkpoint → PRESENT with confidence note, no
extra iteration.0. ALWAYS, before the search message, even when the user already named the
changed paths — Bash `git status --porcelain -uall` (file names only) →
uncommitted paths: each exact relativePath; rename `old -> new` → new path,
`D` → dropped.
Paths listed + alias's own checkout → `index_codebase` incremental, no
consent, BEFORE the search message. Linked worktree → no reindex.
Every call: project=<alias> path=<your working directory>.
1. Search — the three lines a/b/c of Non-negotiable 3, ONE message, parallel.
Window start (probe b): symptom onset if known (last green run, release,
date user names); else today − N days, N = first number of the
`git.file.ageDays` row's `source ≥` cell in `## Signal thresholds`. Probe
edge cases (`maxAgeDays`, untracked files, `treeState`, rename / `D`):
`references/probes.md`.
2. CHECKPOINT — fill from ALL available info:
- Suspect file(s): ___
- Buggy line/method: ___
- Why it breaks: ___
All filled? → PRESENT. STOP.
"Not sure" ≠ "don't know": a candidate in every field = filled, even with
doubt → PRESENT with confidence note (what is unverified). Step 3 fills an
EMPTY field only — never runs to raise confidence.
3. ONLY IF checkpoint incomplete — ONE action for what's missing:
- Symptom names entry point or failure site → Non-negotiable 7 lines.
- Otherwise `tea-rags://guide/tool-choice` for tool selection; before
each call print `consulting decision tree → <tool> because <branch>`.
Go to step 2.
Lag ≠ unusable: changedFiles / pendingFiles / drift never license cat
/ grep / Read over code — tea-rags://guide/freshness.
Ranked suspect list, ranked by symptom fit. Per suspect: file:line, class
(historical | fresh | uncommitted), signal labels (bugFixRate,
relativeChurn, ageDays, recencyWeightedFreq), trace position when from the
call path (entry → … → step), one-sentence observation why it's the root
cause.
Use exact relativePath values from search results joined with braces:
{app/services/order_import.rb,app/services/orders/create.rb}**/services/{order_import,orders/create}** (** glued to a name acts
as * → also matches order_import_old.rb)Pattern found → find_similar(positiveIds=[<chunk id>]) for copy-paste bugs in
other files. Seed = root-cause chunk id already in this output — no re-fetch;
only file:line known → one find_symbol for its id, then seed. Report every
match as file:line + same-bug yes/no, or "no similar copies found" — never
skip the report. Fix needed → /tea-rags:data-driven-generation.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub artk0de/tearags-mcp --plugin tea-rags17 skills in this plugin
/analytics-rerankPick tea-rags rerank preset, build `{custom: {...}}` weight set, or compose analytics-driven search (ownership, tech-debt, hotspots, code-review, security-audit, fragile-silo). Invoke on intent like "rank by ownership", "find tech debt", "hotspot scan", "code review of recent changes", "security audit of auth code", "code that looks stable but breaks a lot", "custom weights for impact analysis". NOT for project health scan needing cross-preset overlap — use `tea-rags:risk-assessment`. NOT for debug root-cause — use `tea-rags:bug-hunt`. NOT for filter shape — use `tea-rags:filter-building`./architecture-diagnosticsDiagnose structural violations for an explicit architecture audit, an explicit invocation of this skill, or structural refactoring. Assess dependency/layer violations, coupling and move candidates. Not for context gathering, code overviews, behavior or contract questions, or routine feature work. Risk/health uses risk-assessment; failures use bug-hunt; plain cycles use find_cycles./data-driven-generationDecide HOW to write or change code by inspecting git signals on neighbors — classifies task mode (CREATE / EXTEND / MODIFY), pulls strategy and templates from proven low-churn implementations, reuses existing shared helpers. Triggers on "implement function X", "add method to class Y", "write a helper for Z", "modify function X", "change behavior of Y", "напиши функцию", "добавь метод", "поправь метод", "измени поведение", "overlay labels → strategy?", a hotfix with location + fix named (cause known → not bug-hunt). NOT for discovery — use tea-rags:explore. NOT for pure rename/extract; a file MOVE still routes here.Other plugins' skills for the same job