Skip to content
Development
Agent

bisection

When reasoning stalls, *search*. Halving the problem space repeatedly finds the culprit in log₂(N) steps instead of N. Bisection applies to three spaces: **history** (which commit), **code** (which statement), and **input** (which data).

From plugin
skills
954 skills54 agents

Claude Code

$ npx -y skills add vanara-agents/skills --agent claude-code

Agent definition

bisection.md

Bisection — Binary Search for Bugs

When reasoning stalls, *search*. Halving the problem space repeatedly finds the culprit in log₂(N) steps instead of N. Bisection applies to three spaces: **history** (which commit), **code** (which statement), and **input** (which data).

1. History: `git bisect`

When a bug appeared "sometime in the last 200 commits," let git binary-search them. Mark a known-bad and known-good revision; git checks out the midpoint and you tell it good or bad until it names the culprit.

git bisect start
git bisect bad                 # current HEAD is broken
git bisect good v1.4.0         # this old tag worked
# git checks out the midpoint; test it, then:
git bisect good                # ...or: git bisect bad
# repeat until git prints "<sha> is the first bad commit"
git bisect reset               # return to where you started

Automate it when you have a script that exits 0 (good) / non-zero (bad):

git bisect start HEAD v1.4.0
git bisect run npm test -- --testPathPattern=checkout

`git bisect run` will drive the entire search unattended and print the first bad commit. Keep the test fast and deterministic, or the search inherits its flakiness.

2. Code: bisect the execution path

Within a single bad function, find *where* the state goes wrong by checking the midpoint. Print or assert the suspect value halfway through; if it's already wrong, the bug is in the first half — otherwise the second. Repeat on the bad half.

function process(x) {
  step A          // assert(valid) here -> OK?  search lower half
  step B
  step C          // <-- midpoint probe: value already corrupt? bug is A/B
  step D
  step E          // assert(valid) here -> still OK?  bug is D/E
}

A "wolf-fence" probe (a single well-placed log of the suspect value) beats scattering ten prints.

3. Input: bisect the data

A 100k-row file that crashes the parser? Don't read 100k rows. Feed the first half — still crashes? The offending row is in that half. Halve again. ~17 iterations isolate one row out of 100k. The same works for narrowing a failing config to one key, or a failing request to one field.

Pitfalls

  • **Non-deterministic test → useless bisect.** Flaky good/bad answers send the search to the wrong commit.

Stabilize the repro first.

  • **Skipping untestable midpoints.** If a midpoint commit won't build, use `git bisect skip` — don't guess.
  • **Forgetting `git bisect reset`** leaves you on a detached checkout.
  • **Too-coarse halving.** Bisect to the *commit*, then bisect *within* it to the statement; don't stop at

"this 400-line commit did it."

Read more
@vanara-agents
Ships withskills

🐒 Free agents, skills & packs for Claude Code One subscription. An army of Claude Code agents. 30 production-grade agents, skills, and packs for Claude Code — free, Apache-2.0, install with one command.

917 skills54 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
9
Star history of vanara-agents/skills on GitHub, a chart by star-history.com

Other agents on skills.

AGENT

AGENT

Agent

Use when designing a new HTTP/GraphQL API or changing an existing one — modeling resources, defining endpoint contracts, choosing…

review-notes

review-notes

Agent

This shows how the api-designer agent reviews a flawed draft. Findings are severity-ranked so the implementer fixes the…

contract-and-openapi

contract-and-openapi

Agent

The contract is the deliverable. Express it as an **OpenAPI 3.1** document so it is human-readable *and* machine-checkable. This…

design-checklist

design-checklist

Agent

Run through this before declaring an API contract done. It is ordered the way you should *design*: resources first, cross-cutting…

pr-comment-template

pr-comment-template

Agent

Copy-paste templates for leaving review comments. Keep each comment to one finding: an anchor, the problem, and the fix.

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc12d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react1d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex1d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman2d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about bisection.

Which coding agents can use bisection?
bisection installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.