Night shift · priority-aware, adversarial code review

It hunts the bugs while you sleep.

bugsweep investigates runtime bugs for Claude Code and Codex. Local evidence guides where to start; each bounded slice moves through context, hunt, review, and checkpoint. It traces security, lifecycle, and data-integrity failures across files. Fixes require your chosen fix mode, fresh reviews, and executable proof. Completed runs land or record their work and verify cleanup of their own Git resources.

Claude Code & Codex v0.8.0 · bounded investigation No telemetry MIT licensed
The one thing to understand

A completed run leaves no Git debris.

During the hunt-and-fix loop, bugsweep never touches your checkout or pushes. It uses one isolated branch, lands one commit per bug, and re-runs checks after every fix. Closeout locally integrates verified work or records and recovery-bundles the rest, then removes the exact run branch and worktree.

Coordinator code checks source identity, review evidence, execution receipts, and exact resource ownership before integration or cleanup. Missing proof blocks automatic fixes. Source review can continue in detect-only mode when execution is unavailable.

01

Isolated run only. One exact branch in a linked worktree — never your checkout.

02

No Git remotes during the run. No push, pull, fetch, or PR. Local integration happens only after verification; tracker upserts record unfinished work.

03

Exact cleanup only. No wildcard deletes, no reset --hard on your content, no rewritten history.

04

Your work is preserved. Every run uses an isolated linked worktree, leaving your checkout untouched until verified local integration.

05

One bug, one commit, evidence preserved. Each fix needs immutable assertion proof and a verified suite receipt.

06

Only eligible bugs get fixed. Every automatic fix needs fresh native review under frozen operator host, model, and prompt settings.

07

Minimal, surgical fixes only. No refactors, renames, or reformatting.

08

Explicit budgets. File, byte, iteration, and fix limits bound planned work. Deadline checkpoints retain partial progress; a hard kill can leave recovery pending.

09

Everything is logged. Every iteration lands in a run ledger — an overnight run is auditable.

10

Close the loop. Land verified work or tracker-record it, then prove the exact run branch and worktree are gone.


Evidence before confirmation

Every finding faces a tribunal.

Hunter, Skeptic, and Referee examine each candidate from different roles. Every fix-eligible finding needs a strict majority of the configured fresh reviews, at every severity, plus executable red/green proof. Repeated model reviews do not establish statistical independence or a measured precision rate.

01
Finds

The Hunter

Investigates a bounded slice and its cross-file dependencies, using source context and relevant anti-pattern catalogs. Each candidate needs a trigger and an evidence trail.

02
Disproves

The Skeptic

Looks for alternate explanations, guarding code paths, alternate callers, and tests that contradict the claim. Repository comments and instructions are evidence to check.

03
Decides

The Referee

Assesses a frozen source packet without seeing prior verdicts. Captured reviews determine eligibility; confirmation alone does not replace the execution and fix gates.

Hunter Skeptic Referee — --recall can report near misses for human review; they never authorize fixes.


Priority intelligence · why now

It starts where the risk is moving.

Recent changes matter. So do failing checks, reachable sensitive code, repeated repairs, active incidents, user impact, and what earlier hunts actually found. Bugsweep combines those signals into an explainable queue—without turning the selected-scope hunt into a diff scan.

priority-context.json — schematic, not sample results
MUST FOCUS  payments/checkout.ts
            release blocker · affected users · live sink

HIGH        auth/session.py
            changed since hunt · repeated repairs

ELEVATED    api/webhooks.go
            recent change · stale audit

SCOPE LOCK   every selected tracked file stays eligible
PROOF LOCK   Hunter → Skeptic → Referee unchanged

Value instincts, with receipts.

The collector reads only bounded local evidence: same-branch Git changes, completed-hunt fingerprints, baseline failures, reachability, repository-local bugs, and durable prior outcomes. Fresh incident, release, product, or support facts can enter through a provider-neutral local inbox—Bugsweep itself never calls those remote systems.

Hard-focus evidence may promote a whole batch, but only inside explicit batch and file budgets. The application receipt records what was actually promoted or skipped. Later runs credit a signal only when a finding explicitly carries that reason code; coincidence stays unattributed, and weights never silently rewrite themselves.

Available in detect-only mode. Local history and prior audit evidence still guide the queue when checks cannot run. An unavailable baseline stays unknown.

◆ signal → target → tribunal → attributed outcome

Built for a fleet, not one session

The overnight orchestrator.

A loop that runs unattended isn't enough — a scheduler needs to trust what it kicked off. bugsweep ships the plumbing: a machine-readable result contract, isolation for running many hunts on one repo at once, and teardown that never guesses.

A contract a scheduler can read

Finalization reduces the ledger into run-summary.json with coverage, findings, and priority outcomes. Degraded or missing artifacts remain explicit limitations; terminal readback decides whether closeout actually completed.

One audit, one worktree

Subagents and resumed sessions reuse the audit’s exact branch and linked worktree. A separate concurrent audit requires an explicit isolation reason and recorded ownership.

Terminal recovery is explicit

A deadline checkpoint records the run at every phase boundary. An interrupt or an unavailable provider can still leave recovery work; terminal readback decides whether the run is complete or blocked.

Crash-safe teardown

An optional reaper reclaims worktrees and branches only on positive evidence a run is dead and done. Anything dirty, unmerged, or ambiguous is preserved — nothing unreviewed gets deleted.

Integration preserves proof

Closeout locally integrates eligible fixes under the selected fix mode. Each attempt preserves its evidence, verifies the combined source, and rejects paths that could overwrite the proof before switching trees.

Flaky results block automation

Reruns can help diagnose a failure, but they do not establish a waiver. A flaky classification blocks automatic integration and sends the finding to the tracker with its recovery state.

Analyzer hints, opt-in

Explicit CodeQL/Semgrep configurations run through the execution provider and import captured SARIF evidence. No automatic tool discovery or rule downloads. Hints guide investigation; they never confirm a bug or authorize a fix.


New in v0.8.0 · bounded context

Build context. Hunt. Review. Checkpoint.

Configurable file and byte limits split the work into deterministic slices. Each admitted slice completes its investigation before the next is modeled; deferred work remains visible in a partial report. Trace cross-file behavior through lifecycle, shared state, transactions, API contracts, error propagation, and security boundaries.

run-summary.json — the machine-readable contract
// schemas/run-summary.schema.json (shape, not sample data)
{
  "status": "complete" | "partial" | "stalled",
  "coverage": { audited, frontier, stale … },
  "counts": { critical, high, medium … },
  "findings": [ { evidence trail per bug } ],
  "fixed" / "quarantined" / "confirmed_unfixed": […],
  "root_cause_clusters": […],
  "priority": { targets, signal_health, application, yield },
  "follow_up": "where to look next"
}

Audit coverage and operational closeout are separate.
A partial or blocked run is not a completed audit.

Context from the checkout being audited

Run-local indexes follow the audited worktree. Changes to directed call edges or entry points invalidate affected reachability conclusions, even when the node list stays the same.

The structured report separates audited coverage, deferred work, and findings. Modeling a file does not count as auditing it. Investigation stays focused on concrete runtime failures with testable triggers.

◆ context → hunt → review → checkpoint

Coverage-first · not a diff scanner

Resume from recorded audit evidence.

The whole repo—or the path you explicitly select—stays in scope. .bugsweep/state/ persists an audit log, a risk map, attributed signal outcomes, and the anti-pattern catalog version across runs. Each run reprioritizes toward the never-audited, stale, content-changed, high-risk, and actively impacted—while fixed weights keep production outcomes from silently changing policy. Exact audit membership is stored separately from the short display summary, so larger histories do not make audited files look new.

  • Night 1Starts with changed code, failing checks, live sinks, and explicit project priorities—then records exact completed-hunt fingerprints.
  • Night 2Distinguishes fresh work from content that moved since its last real hunt and pushes into never-audited modules.
  • Night 3Replays variant queries and revisits reasons that produced explicitly attributed outcomes.
  • OngoingRe-checks stale files as the catalog evolves. Evidence compounds across runs; weights and safety gates change only through reviewed code.

Evaluation · evidence status

Measure verified bugs, time, and cost.

The evaluation harness compares Claude and Codex separately with frozen source, prompts, and budgets. Its reduced detect-only task does not measure the full operational skill. Optional context on/off and cold/warm comparisons record provenance and accounting for a paired experiment.

Verification

Unique runtime defects

A candidate needs an independently checked runtime oracle and source evidence. Repeated reports of the same defect count once.

Precision and timing

Review the findings

False positives require human adjudication. Time to the first verified finding remains unavailable until an external verifier records it.

Equal budgets

Include the whole cost

Account for context building, every review stage, and failed or skipped runs. Missing usage and cost stay unknown.

What is not established yet

No measured detection or precision improvement is claimed for v0.8.0. Fresh runtime oracles, live paired runs, and calibrated human review remain incomplete. Historical pilots and passing regression tests do not validate the current evaluation protocol. Candidate counts, scanned files, and model confidence do not establish better detection.

Read the evaluation protocol and evidence limits.


Get started

Install v0.8.0. Start with detection.

Requires Python 3.12+ and jsonschema==4.26.0. The installer checks these prerequisites without installing them. Download and inspect the script, then choose Claude Code, Codex, or both.

$ curl -fsSL https://raw.githubusercontent.com/shanemhamilton/bugsweep/v0.8.0/install.sh -o /tmp/bugsweep-install.sh

After inspecting the downloaded script, run:

$ bash /tmp/bugsweep-install.sh --claude --version v0.8.0

Replace --claude with --codex or --all to choose the host. Both the script and payload above are pinned to v0.8.0. For the latest stable release, use the current install instructions. --edge explicitly selects development main.

/bugsweep detect and record  ·  --fix verify and fix  ·  --approve ask before edits  ·  --autonomous repeat within configured caps

Fixes require an external execution policy and native review capability. Without them, source investigation can continue in detect-only mode. Existing installations can use /bugsweep --update before starting a new audit.