KilimcininKorOglu/claude-code-mods/tree/main/plugins/bughunt
bughunt
使用 /bughunt: 运行证明驱动的错误搜寻轮次,每轮都通过 mod 自身运行的失败命令来证明 one 错误,修复它并证明修复,并且循环在被阻止或未经验证的轮次中停止。 /bughunt 协作按顺序运行只读扫描仪、规划器和评论器。
关于这个 mod
寻找bug
错误搜寻提示告诉模型在修复错误之前先证明错误,并且模型通常首先编写修复程序,然后编写通过的测试。该模组按轮进行狩猎,并保证每一轮都有其证据。模型编写一个证明命令,mod 自行运行它,并且生产代码保持不变,直到证明以 FAIL 行退出非 zero。仅当相同的命令随后使用 PASS 行退出 0 时,该轮才算为已修复,并且一旦 mod 恢复修复一会儿再次失败。该循环读取每一轮的结果,并在阻塞或未经验证的轮次处停止,而不是开始下一个 one。
/bughunt collab <paths> 是第二种只读模式:扫描仪、计划员和评论家子代理依次审查路径,报告包含调查结果、计划和评论家的结论。
它的作用
回合
1。 /bughunt [--rounds N] [target] 开始对目标或整个项目进行 1 至 25 轮的搜索。 --rounds 可以站在这些论点中的任何位置。狩猎在会话的任何时刻开始。
2。 mod 发送每一轮作为提示:轮次编号、范围、轮次的证明目录 (.temp_files/bughunt/<round>/)、早期轮次的指纹和协议。模型首先开启bughunt:hunt技能,该技能持有完整规则;当回合运行时,模组会将回合的方块附加到技能文本中。
3。当一轮运行时:
- 编辑、写入和笔记本编辑停止,直到技能全面开放。
- 校样目录外的编辑停止,直到 mod 记录了
FAIL。 - 对于目标,其外部的编辑也会在
FAIL之后停止。测试文件(tests/、__tests__/、*.test.*、*.spec.*、*_test.*、test_*.py)通过,因此回归测试可以进入套件。 - 每个子代理生成都会停止:在 one 对话中运行一轮。
4。该模型使用
phase: "before"和证明命令的argv调用mcp__bughunt__proof。 mod运行命令(最多5分钟)并仅在退出非zero时记录FAIL并打印以FAIL开头的行。不打印此类行的设置或导入错误将被拒绝。修复后,具有相同argv的phase: "after"再次运行该命令,并需要退出 0 和以PASS开头的行。该模型读取退出代码、输出的最后 20 行以及原因。5。在记录PASS之前,mod 会检查证明是否达到了修复。记录FAIL时,它会拍摄工作树的快照(git stash create,不添加存储条目,或在干净的树上添加HEAD)。在接受的PASS运行后,它会列出自该快照 (git diff --diff-filter=M) 以来修改的文件,忽略证明目录和测试文件,并将它们恢复到工作树中的快照 (git restore --source,索引保持原样)。它再次运行证明,然后将修复放回去。仅当恢复的运行使用FAIL行退出非 zero 时,PASS才计数。否则,调用将被拒绝,模型可以修复证明并再次调用。该模型读取每种情况的原因: - 证明通过并恢复了修复,因此它没有达到固定代码;
- 自
FAIL以来没有修改任何生产文件; - 该目录不是 git 存储库;
- git 命令失败。
当修复被恢复时,mod 会在 $.store 中保留记录。当崩溃使检查缩短时,如果恢复的文件仍然未更改,同一目录中的下一个会话会将修复恢复。如果此后它们发生了更改,它不会覆盖它们并告诉您 git restore 命令来恢复修复。
6。当回合结束时,mod 会读取答案的结果行:以结果标签开头的第一行,因此它之前的句子不会隐藏它:
- 仅当mod在本轮中记录了
FAIL然后是 /bughunt [--rounds N] [target] start a hunt of N rounds (1 by default, 25 at most) /bughunt collab <paths> a read-only scanner, planner and critic review /bughunt stop end the running hunt /bughunt status on or off, and the running round /bughunt on | off on by default; off starts nothing and holds no edit Q时,fixed-and-verified才会继续;否则狩猎就会停止。 no-proven-bug继续。blocked、fixed-verification-incomplete、无结果线、中断或 API 错误停止搜索。- 最后一轮结束后,狩猎结束。
每个答案的 fingerprint: 行都会进入下一轮的提示,因此相同的根本原因不会被计算两次。
7。你自己写的提示结束了狩猎; /bughunt 命令没有。
合作
1。 /bughunt collab <paths> 或模型的 mcp__bughunt__collab 工具依次启动 three 子代理。它们是mod自己的代理类型(bughunt:scanner,bughunt:planner,bughunt:critic),隐藏在模型的代理列表中,并且每个只能读取:Read,Grep,Glob。
2。扫描仪立即使用 mcp__bughunt__found 报告每个发现(文件、行、严重性、描述、可选修复)。模组检查字段并保留结果。只有正在运行的扫描仪可以调用该工具。
3。规划人员收到调查结果和扫描仪的报告,并编写修复计划。批评者收到调查结果和计划,并以 verdict: approve、revise 或 reject 开始回答。4。每个步骤都有时间限制(扫描者 10, 计划者 ❯ ./register.ts hooks: session.start, command.run{command=bughunt}, agent.offer{agent=/"^bughunt:(scanner|planner|critic)$"/}, tool.describe{tool=/"^mcp__bughunt__(proof|found|collab)$"/}, tool.call{tool=/"^mcp__bughunt__proof$"/}, tool.call{tool=/"^mcp__bughunt__found$"/}, tool.call{tool=/"^mcp__bughunt__collab$"/}, prompt.submit, skill.prompt{skill=bughunt:hunt}, tool.call{tool=Skill}, tool.call{tool=Edit}, tool.call{tool=Write}, tool.call{tool=NotebookEdit}, agent.spawn, turn.complete
❯ ./register.ts calls: $.agent.register (via declare), $.agent.spawn (via portsOf), $.clock.after (via portsOf, send), $.command.register (via declare), $.command.run (via send), $.process.run (via git, recoverFix, runProof), $.prompt.submit (via send), $.sidebar.clear (via show), $.sidebar.set (via show, toPerson), $.store.delete (via putBack, recoverFix), $.store.get (via readSettings, recoverFix), $.store.set (via revertCheck, setEnabled), $.tool.register (via declare), $.ui.log (via launchCollab, send, toPerson)
Q 批评者 6 分钟)。耗尽的步骤在报告中被命名为 timed-out,扫描仪在该步骤之前发送的结果将保留在报告中。
5。当评论家没有给出判决线时,判决是 no-verdict,而不是 approve。
6。扫描仪启动后,命令和工具返回;该报告稍后以 one 消息形式到达,模型将其读取为只读审核。步骤的交回消息被 mod 接收并丢弃,因此它不会开始自己的回合。
7。当一轮运行时,协作不会开始。
你所看到的
侧边栏显示了一个站立的bughunt部分:回合、技能是否开放、证明状态以及每个完成回合的结果和指纹。停止的编辑、校样结果和狩猎结束将转到侧边栏流。没有侧边栏,它们每个都是 one 转录行,例如 bughunt: edit stopped (proof): src/a.ts。
命令
/bughunt [--rounds N] [target] start a hunt of N rounds (1 by default, 25 at most)
/bughunt collab <paths> a read-only scanner, planner and critic review
/bughunt stop end the running hunt
/bughunt status on or off, and the running round
/bughunt on | off on by default; off starts nothing and holds no edit
安装
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install bughunt@kilimcininkoroglu-mods
函数钩子是抢先体验的。 Claude Code 2.1.288 以及后来默认加载它们,所以没有什么可以打开的。
安装后
1。重新启动Claude Code。
2。在存储库中运行 /bughunt,您可以从命令行运行其测试。证明命令会根据您的权限运行,因此请阅读模型的建议。
它可以达到什么
在 Claude Code 2.1.284 上使用 claude plugin validate 进行验证:
❯ ./register.ts hooks: session.start, command.run{command=bughunt}, agent.offer{agent=/"^bughunt:(scanner|planner|critic)$"/}, tool.describe{tool=/"^mcp__bughunt__(proof|found|collab)$"/}, tool.call{tool=/"^mcp__bughunt__proof$"/}, tool.call{tool=/"^mcp__bughunt__found$"/}, tool.call{tool=/"^mcp__bughunt__collab$"/}, prompt.submit, skill.prompt{skill=bughunt:hunt}, tool.call{tool=Skill}, tool.call{tool=Edit}, tool.call{tool=Write}, tool.call{tool=NotebookEdit}, agent.spawn, turn.complete
❯ ./register.ts calls: $.agent.register (via declare), $.agent.spawn (via portsOf), $.clock.after (via portsOf, send), $.command.register (via declare), $.command.run (via send), $.process.run (via git, recoverFix, runProof), $.prompt.submit (via send), $.sidebar.clear (via show), $.sidebar.set (via show, toPerson), $.store.delete (via putBack, recoverFix), $.store.get (via readSettings, recoverFix), $.store.set (via revertCheck, setEnabled), $.tool.register (via declare), $.ui.log (via launchCollab, send, toPerson)
到达 L2,它运行模型名称的证明命令。
1. Reads: the path of each Edit, Write and NotebookEdit call; your prompts, only to see whether you wrote one; each round's final answer; the collab subagents' answers
2. Runs: the proof command the model passes to mcp__bughunt__proof, as argv without a shell, in the working directory or the cwd it names, for 5 minutes at most, a second time with the fix reverted; git stash create, rev-parse, diff and restore --worktree in the working directory for that check; three read-only subagents for a collab
3. Sends: each round's prompt and each collab report to the model as a message, a deny text for a stopped edit or spawn, the round's block after the skill's text, sidebar sections and lines or transcript lines to you; nothing leaves the machine
4. Persists: in $.store, the on/off setting, and while a revert check runs the snapshot that holds the fix and the reverted files; the hunt itself lives in memory and ends with the session
5. Hostile input: the proof command is the model's and runs with your permissions, as a Bash call would, but without a shell; a finding's fields are checked before they are kept
限制
- 门读取“编辑”、“写入”和“笔记本编辑”。不保留通过 Bash(
sed -i、重定向、脚本)更改的文件。 - 恢复检查显示证明取决于修复变更的文件。它无法判断证据是否断言了正确的行为。
- 恢复检查仅恢复修复变更的跟踪文件。仅添加文件的修复没有任何可恢复的内容,因此其 claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install bughunt@kilimcininkoroglu-mods
Q 被拒绝。在 git 存储库之外,不会记录
PASS。 - 当检查运行时(最多 one 更多证明运行),固定文件保存旧代码。在该窗口中读取它们的另一个进程发现了该错误。
- 模组衡量的是技能的传递,而不是模型读取的技能。
- 超时的协作步骤会在后台继续运行,直到结束; mod 不再等待它。- 测试引擎无法启动子代理,因此在
pipeline.ts中使用假引擎调用测试协作等待(交回、提前应答、时间限制、失败结束),并实时检查整个运行。 2.1.284直播:two轮狩猎记录失败然后通过,将指纹带入2轮并在那里结束;合作者保留了扫描仪的发现,阅读了评论家的判决,其 three 手背没有开始转动。恢复运行失败后,git 存储库中的一轮记录了PASS,之后修复又恢复原状,并且git stash list保持为空。 - 回合的大门没有旁路。
/bughunt stop结束狩猎,/bughunt off关闭模组。
发展
make install # eslint, typescript-eslint, typescript
make lint # complexity limit 10, the build fails above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test
安装
请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。
claude plugin marketplace add KilimcininKorOglu/claude-code-mods claude plugin install bughunt
原文 / README
bughunt
A bug hunt prompt tells the model to prove a bug before it fixes it, and the model often writes the fix first and a test that passes after. This mod runs the hunt in rounds and holds each round to its proof. The model writes a proof command, the mod runs it itself, and production code stays unchanged until the proof exits non-zero with a FAIL line. The round counts as fixed only when the same command then exits 0 with a PASS line, and fails again once the mod reverts the fix for a moment. The loop reads each round's outcome and stops at a blocked or unverified round instead of starting the next one.
/bughunt collab <paths> is a second, read-only mode: a scanner, a planner and a critic subagent review the paths in turn, and the report carries the findings, the plan and the critic's verdict.
What it does
Rounds
-
/bughunt [--rounds N] [target]starts a hunt of 1 to 25 rounds over the target, or over the whole project.--roundsmay stand anywhere among the arguments. The hunt starts at any point of the session. -
The mod sends each round as a prompt: the round number, the scope, the round's proof directory (
.temp_files/bughunt/<round>/), the fingerprints of the earlier rounds and the protocol. The model first opens thebughunt:huntskill, which holds the full rules; while a round runs, the mod appends the round's block to the skill's text. -
While a round runs:
- Edit, Write and NotebookEdit stop until the skill is open in the round.
- An edit outside the proof directory stops until the mod recorded a
FAIL. - With a target, an edit outside it stops after the
FAILtoo. A test file (tests/,__tests__/,*.test.*,*.spec.*,*_test.*,test_*.py) passes, so the regression test can go into the suite. - Every subagent spawn stops: a round runs in one conversation.
-
The model calls
mcp__bughunt__proofwithphase: "before"and the proof command'sargv. The mod runs the command (5 minutes at most) and recordsFAILonly when it exits non-zero and prints a line that starts withFAIL. A setup or import error that prints no such line is rejected. After the fix,phase: "after"with the sameargvruns the command again and needs exit 0 and a line that starts withPASS. The model reads the exit code, the last 20 lines of output and the reason. -
Before it records the
PASS, the mod checks that the proof reaches the fix. When theFAILwas recorded, it took a snapshot of the working tree (git stash create, which adds no stash entry, orHEADon a clean tree). After an acceptedPASSrun it lists the files modified since that snapshot (git diff --diff-filter=M), leaves out the proof directory and test files, and restores them to the snapshot in the working tree (git restore --source, the index stays as it was). It runs the proof again and then puts the fix back. ThePASScounts only when that reverted run exits non-zero with aFAILline. Otherwise the call is rejected and the model can fix the proof and call again. The model reads the reason in each case:- the proof passes with the fix reverted, so it does not reach the fixed code;
- no production file was modified since the
FAIL; - the directory is not a git repository;
- a git command failed.
While the fix is reverted, the mod keeps a record in
$.store. When a crash cuts the check short, the next session in the same directory puts the fix back, if the reverted files are still unchanged. If they changed since, it does not overwrite them and tells you thegit restorecommand that brings the fix back. -
When the round's turn ends, the mod reads the answer's outcome line: the first line that begins with an outcome label, so a sentence before it does not hide it:
fixed-and-verifiedgoes on only when the mod recordedFAILthenPASSin the round; otherwise the hunt stops.no-proven-buggoes on.blocked,fixed-verification-incomplete, no outcome line, an interrupt or an API error stop the hunt.- After the last round the hunt ends.
The
fingerprint:line of each answer goes into the next rounds' prompts, so the same root cause is not counted twice. -
A prompt you write yourself ends the hunt;
/bughuntcommands do not.
Collab
/bughunt collab <paths>, or the model'smcp__bughunt__collabtool, starts three subagents in turn. They are the mod's own agent types (bughunt:scanner,bughunt:planner,bughunt:critic), hidden from the model's agent list, and each can only read:Read,Grep,Glob.- The scanner reports each finding at once with
mcp__bughunt__found(file, line, severity, description, optional fix). The mod checks the fields and keeps the finding. Only the running scanner may call the tool. - The planner receives the findings and the scanner's report, and writes a fix plan. The critic receives the findings and the plan, and begins its answer with
verdict: approve,reviseorreject. - Each step has a time limit (scanner 10, planner 8, critic 6 minutes). A step that runs out is named in the report as
timed-out, and the findings the scanner sent before that stay in the report. - When the critic gives no verdict line, the verdict is
no-verdict, neverapprove. - The command and the tool return once the scanner started; the report arrives later as one message, and the model reads it as a read-only review. A step's hand-back message is taken by the mod and dropped, so it does not start a turn of its own.
- A collab does not start while a round runs.
What you see
The sidebar shows a standing bughunt section: the round, whether the skill is open, the proof state and each finished round's outcome and fingerprint. Stopped edits, proof results and the hunt's end go to the sidebar stream. Without the sidebar, each of them is one transcript line such as bughunt: edit stopped (proof): src/a.ts.
Command
/bughunt [--rounds N] [target] start a hunt of N rounds (1 by default, 25 at most)
/bughunt collab <paths> a read-only scanner, planner and critic review
/bughunt stop end the running hunt
/bughunt status on or off, and the running round
/bughunt on | off on by default; off starts nothing and holds no edit
Install
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install bughunt@kilimcininkoroglu-mods
Function hooks are early access. Claude Code 2.1.288 and later load them by default, so there is nothing to switch on.
After installing
- Restart Claude Code.
- Run
/bughuntin a repository whose tests you can run from the command line. The proof command runs with your permissions, so read what the model proposes.
What it can reach
Validated with claude plugin validate on Claude Code 2.1.284:
❯ ./register.ts hooks: session.start, command.run{command=bughunt}, agent.offer{agent=/"^bughunt:(scanner|planner|critic)$"/}, tool.describe{tool=/"^mcp__bughunt__(proof|found|collab)$"/}, tool.call{tool=/"^mcp__bughunt__proof$"/}, tool.call{tool=/"^mcp__bughunt__found$"/}, tool.call{tool=/"^mcp__bughunt__collab$"/}, prompt.submit, skill.prompt{skill=bughunt:hunt}, tool.call{tool=Skill}, tool.call{tool=Edit}, tool.call{tool=Write}, tool.call{tool=NotebookEdit}, agent.spawn, turn.complete
❯ ./register.ts calls: $.agent.register (via declare), $.agent.spawn (via portsOf), $.clock.after (via portsOf, send), $.command.register (via declare), $.command.run (via send), $.process.run (via git, recoverFix, runProof), $.prompt.submit (via send), $.sidebar.clear (via show), $.sidebar.set (via show, toPerson), $.store.delete (via putBack, recoverFix), $.store.get (via readSettings, recoverFix), $.store.set (via revertCheck, setEnabled), $.tool.register (via declare), $.ui.log (via launchCollab, send, toPerson)
Reach L2, it runs the proof command the model names.
1. Reads: the path of each Edit, Write and NotebookEdit call; your prompts, only to see whether you wrote one; each round's final answer; the collab subagents' answers
2. Runs: the proof command the model passes to mcp__bughunt__proof, as argv without a shell, in the working directory or the cwd it names, for 5 minutes at most, a second time with the fix reverted; git stash create, rev-parse, diff and restore --worktree in the working directory for that check; three read-only subagents for a collab
3. Sends: each round's prompt and each collab report to the model as a message, a deny text for a stopped edit or spawn, the round's block after the skill's text, sidebar sections and lines or transcript lines to you; nothing leaves the machine
4. Persists: in $.store, the on/off setting, and while a revert check runs the snapshot that holds the fix and the reverted files; the hunt itself lives in memory and ends with the session
5. Hostile input: the proof command is the model's and runs with your permissions, as a Bash call would, but without a shell; a finding's fields are checked before they are kept
Limits
- The gate reads Edit, Write and NotebookEdit. A file changed through Bash (
sed -i, a redirect, a script) is not held. - The revert check shows that the proof depends on the files the fix modified. It cannot tell whether the proof asserts the right behaviour.
- The revert check reverts only tracked files the fix modified. A fix that only adds files has nothing to revert, so its
PASSis rejected. Outside a git repository, noPASSis recorded. - While the check runs (at most one more proof run), the fixed files hold the old code. Another process that reads them in that window sees the bug.
- The mod measures that the skill was delivered, not that the model read it.
- A collab step that runs out of time keeps running in the background until it ends; the mod no longer waits for it.
- The test engine cannot start a subagent, so the collab waits (hand-back, early answer, time limit, failed end) are tested in
pipeline.tswith fake engine calls, and the whole run is checked live. Live on 2.1.284: a two-round hunt recorded FAIL then PASS, carried the fingerprint into round 2 and ended there; a collab kept the scanner's finding, read the critic's verdict, and its three hand-backs started no turn. A round in a git repository recordedPASSafter the reverted run failed, the fix was back in place afterwards, andgit stash liststayed empty. - There is no bypass of a round's gates.
/bughunt stopends the hunt, and/bughunt offturns the mod off.
Development
make install # eslint, typescript-eslint, typescript
make lint # complexity limit 10, the build fails above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test

