ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 KilimcininKorOglu

bughunt

使用 /bughunt: 執行證明驅動的錯誤搜尋輪次,每輪都通過 mod 自身執行的失敗命令來證明 one 錯誤,修復它並證明修復,並且循環在被阻止或未經驗證的輪次中停止。 /bughunt 合作依序執行唯讀掃描器、規劃器和評論器。

KilimcininKorOglu@KilimcininKorOglu

KilimcininKorOglu/claude-code-mods/tree/main/plugins/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

  1. /bughunt [--rounds N] [target] starts a hunt of 1 to 25 rounds over the target, or over the whole project. --rounds may stand anywhere among the arguments. The hunt starts at any point of the session.

  2. 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 the bughunt:hunt skill, which holds the full rules; while a round runs, the mod appends the round's block to the skill's text.

  3. 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 FAIL too. 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.
  4. The model calls mcp__bughunt__proof with phase: "before" and the proof command's argv. The mod runs the command (5 minutes at most) and records FAIL only when it exits non-zero and prints a line that starts with FAIL. A setup or import error that prints no such line is rejected. After the fix, phase: "after" with the same argv runs the command again and needs exit 0 and a line that starts with PASS. The model reads the exit code, the last 20 lines of output and the reason.

  5. Before it records the PASS, the mod checks that the proof reaches the fix. When the FAIL was recorded, it took a snapshot of the working tree (git stash create, which adds no stash entry, or HEAD on a clean tree). After an accepted PASS run 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. The PASS counts only when that reverted run exits non-zero with a FAIL line. 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 the git restore command that brings the fix back.

  6. 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-verified goes on only when the mod recorded FAIL then PASS in the round; otherwise the hunt stops.
    • no-proven-bug goes 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.

  7. A prompt you write yourself ends the hunt; /bughunt commands do not.

Collab

  1. /bughunt collab <paths>, or the model's mcp__bughunt__collab tool, 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.
  2. 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.
  3. 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, revise or reject.
  4. 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.
  5. When the critic gives no verdict line, the verdict is no-verdict, never approve.
  6. 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.
  7. 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

  1. Restart Claude Code.
  2. Run /bughunt in 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 PASS is rejected. Outside a git repository, no PASS is 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.ts with 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 recorded PASS after the reverted run failed, the fix was back in place afterwards, and git stash list stayed empty.
  • There is no bypass of a round's gates. /bughunt stop ends the hunt, and /bughunt off turns 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

更多類似作品