bisect-driver
Skill0 starsChanged 45 days agoMITView on GitHub
Drives git bisect: known-good ref, bad ref (default HEAD) and a repro command in, first bad commit out; always resets bisect state, refuses on a dirty tree. Use when: "bisect this", "which commit broke X", "when did this test start failing".
In this repository34 other files it gives its agents.
- audit-codeSkill
- audit-docsSkill
- auditSkill
- coding-conventionsSkill
- commit-gateSkill
- compact-ioSkill
- cron-task-manageSkill
- cve-auditSkill
- data-integrity-auditSkill
- decision-logSkill
- deck-builderSkill
- determinism-guardSkill
- etl-validateSkill
- experiment-logSkill
- fetch-firstSkill
- flaky-test-detectorSkill
- github-repo-polishSkill
- golden-lockSkill
- history-leak-scanSkill
- landing-checkSkill
- llm-eval-harnessSkill
- local-secrets-manageSkill
- long-taskSkill
- milestone-trackSkill
- opus-workersSkill
- path-quirk-auditSkill
- reorg-proposalSkill
- research-briefSkill
- seed-controlSkill
- shell-portabilitySkill
- skill-vetSkill
- small-taskSkill
- token-squeezeSkill
- venue-fitSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 86
Read-only toward the world: it only mutates the target repo's transient bisect state, which it restores.
- Very specific: line 108
Do not pass node -e "<quoted code>" as the repro on this machine — PS 5.1 mangles quoted -e and leaves 0-byte junk files.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
bisect-driver — find the commit that introduced a change
The engine is bisect-driver.js (portable Node, zero deps). You hand it a commit
where the behavior was still correct (--good), a commit where it is broken
(--bad, default HEAD), and a repro command; it drives git bisect run over
the range, parses the culprit, prints its sha + subject + author date, and
always runs git bisect reset so the repo ends where it started. This is the
catalog's regression-blame — the same operation under a different name.
Commands
node bisect-driver.js --good <ref> [--bad <ref>] --cmd "<repro command>" [--dir <repo>]
node bisect-driver.js --canary
node bisect-driver.js --help- --good
<ref>a commit known to still behave correctly (required). - --bad
<ref>a commit where the behavior is broken (defaultHEAD). - --cmd
"<...>"the repro, run per candidate commit viagit bisect run sh -c. - --dir
<repo>repo to bisect (default: current directory).
The repro command's exit code IS the verdict
git bisect run classifies each commit by the repro's exit status:
| exit code | meaning |
0 | commit is good |
1–124 | commit is bad (avoid 126/127 — POSIX-shell reserved) |
125 | skip — source can't be tested at this commit |
>=128 | abort the bisect |
So write the repro to exit 0 while the behavior is still correct and non-zero
once it is broken. Examples: a test runner that already exits non-zero on
failure works as-is; to blame an output change, run.py ... && diff -q got.txt
want.txt (0 when it still matches). Wrap a build that must pass first as
make || exit 125; ./repro so uncompilable commits are skipped, not blamed.
Examples
- A frozen regression started drifting (a report pinned to hold byte-exact):
find the good commit before the drift, then
node bisect-driver.js --good <sha-before> --cmd "python run_backtest.py --report && diff -q report.txt frozen/report.txt" --dir /path/to/repo. The culprit is the commit that first broke the pin. - A frozen regression test started failing: point
--cmdstraight at the test (python -m pytest tests/test_frozen.py -q) — pytest exits non-zero on failure, which is exactly "bad". - An API endpoint changed behavior:
node bisect-driver.js --good <last-known-good> --cmd "pytest tests/test_api.py::test_signup -q" --dir /path/to/backend.
Safety
- Refuses (exit 2) on a dirty working tree. Bisect checks out historic commits during the run and would clobber uncommitted work — commit, stash, or clean first. "Dirty" includes untracked files.
- Refuses (exit 2) on an in-progress bisect — run
git bisect resetfirst. - Always resets. The bisect state is torn down in a
finally, and best-effort on Ctrl-C (SIGINT), so an interrupted run still restores your HEAD. The tool verifies HEAD is back where it started and warns if not.- SIGTERM on Windows is the exception, and it cannot be fixed in code.
Windows delivers it via
TerminateProcess, which gives no JS handler a chance to run, sokill -TERMcan leave bisect state active and HEAD detached. The next run refuses on that state (exit 2) and tells you to rungit bisect reset. Use Ctrl-C, notkill -TERM.
- SIGTERM on Windows is the exception, and it cannot be fixed in code.
Windows delivers it via
- Re-tests its own answer before reporting it (exit 1 if it does not hold).
git bisectnever re-checks the classifications it made, so ONE bad classification anywhere in the search produces a confident, wrong culprit — andgit bisect runstill exits 0 with no warning. Measured 2026-08-20: a Ctrl-C mid-run killed one repro invocation, that commit was misclassified, and the driver reported a commit two places past the real defect with no hedge. The driver now re-runs the repro on the reported culprit and its parent: the culprit must fail, the parent must pass. If either half does not hold, no culprit is reported. This also catches a flaky or nondeterministic repro, and a commit where the build itself was broken. Cost: two extra repro runs per bisect. - Read-only toward the world: it only mutates the target repo's transient bisect state, which it restores.
- Refuses (exit 2) when the repro misclassifies the endpoints.
git bisecttrusts the marked--good/--badrefs and never re-tests them — it only tests commits between them. So a repro that never actually flips to "bad" on historic checkouts (wrong path, missing script, an always-exit 0command, or the opposite — an always-non-zero command) would otherwise yield a confident but false culprit. Guard: before starting, the tool checks out each endpoint and runs the repro itself — the--goodref must exit0and the--badref must exit1–124. If not, it refuses with an actionable message instead of handing back a silent false positive. (This costs two extra repro runs up front; on a slow repro that is the price of not trusting a broken one.)
Windows notes
- The repro is executed as
git bisect run sh -c "<cmd>"; Git for Windows ships theshit needs (bisect has always depended on it), so this works under both PowerShell 5.1 and Git Bash. - PowerShell 5.1: wrap the whole
--cmdvalue in double quotes —--cmd "pytest -q && diff -q a b". PS 5.1 has no&&at the pipeline level, but here&&lives inside the quoted string and is interpreted bysh, so it is fine. - Do not pass
node -e "<quoted code>"as the repro on this machine — PS 5.1 mangles quoted-eand leaves 0-byte junk files. Point the repro at a real script file instead.
Exit codes
0 culprit found · 1 no culprit parsed / bisect error · 2 usage error or
preflight refusal (dirty tree, in-progress bisect, unresolvable ref, or a repro
that misclassifies the --good/--bad endpoints).
Verification (the done-check)
node bisect-driver.js --canaryBuilds a throwaway git repo of ~8 commits with a behavior change planted at a
known middle commit, then proves both directions: the culprit is identified
as exactly the planted commit and the repo is restored + bisect-state clean
(good direction), AND a dirty tree, an in-progress bisect, an unresolvable ref,
an always-good repro (bad endpoint passes), and an always-bad repro (good
endpoint fails) are each refused with exit 2 (bad direction). Cleans up after
itself. MUST print CANARY PASS 16/16 before you trust a result. Never bisects
a real repo.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

