Massive Bug Hunt And Fix
Discover ClawPatch findings readonly, rank them, then resolve selected findings in a separate explicit run
ClawPatch bug work has two explicit phases with a human selection between them.
$bug-discovery-phase runs ClawPatch readonly, writes a report and a durable ledger, and ranks the
findings. It stops before any source change. $bug-resolution-phase starts only when the operator
selects one finding, or a bounded batch, in a new explicit request.
- Use this when: the team wants tool-backed bug discovery and triage, then resolution of chosen findings.
- It gives you: a report, a
.clawpatch/ledger, ranked findings with a recommended next phase, and per-finding classification, changes, and ClawPatch state. - It ends with: discovery stops at the ranked report; resolution ends each finding as resolved and revalidated, routed to debugging, recorded as debt, triaged false positive, or blocked.
- Wrapped skills:
$bug-discovery-phase,$bug-resolution-phase, ClawPatch, and on routes$debugging-phaseand$docs-ingest-phase.
Both phases are explicit-only (disable-model-invocation: true, allow_implicit_invocation: false).
The agent does not start them on its own. ClawPatch findings are static-review candidates, not proven
runtime root causes.
Discovery To Resolution
Scope Policy
Both phases default to the smallest certain target:
- open pull-request changes;
- a highlighted diff;
- supplied code portions;
- named files, paths, packages, apps, domains, or features.
A full-codebase scan runs only when no pull request is open and no certain scope exists, or when the user asks for it. The bounded scope goes into every ClawPatch command or prompt that accepts path, diff, file, feature, package, or scope guidance. Resolution edits stay inside the same scope unless source inspection proves a directly required support change.
Discovery
-
Preflight Record. Before any long AFK run, record the run contract in the conversation, goal handoff, or local run notes:
repo root: <absolute path> scope: <whole repo | path | feature/project selector> provider: <automatic current agent/launcher default | explicit override> model: <automatic default | explicit override | unset> limit: <number or unset> jobs: <number or unset> state dir: <repo>/.clawpatch/ report path: <repo>/.clawpatch/reports/<name>.md dirty posture: include dirty changes? <yes|no> -
Provider. ClawPatch inherits the current agent or launcher provider. Commands add
--provideror--modelonly when the user chose an override. -
Readiness. Run
doctorandstatus, and reuse existing.clawpatch/state. -
Discovery run. Use
reviewfor normal AFK discovery, orcifor CI-shaped discovery. Then runreport. Use--include-dirtyonly on request; otherwise say that dirty work was excluded. -
Report output.
report --output <path>writes Markdown. For JSON, redirect--jsonstdout to a file;--outputis always the Markdown file. -
Ranking. Score every important finding
0-10before any recommendation (see below). -
Stop. Discovery ends before mutation. Fixing needs a new explicit resolution request.
triage and revalidate are allowed during discovery because they change no source. Discovery never
runs clawpatch fix --finding or clawpatch open-pr, and it creates no tech-debt docs.
Ranking
The score explains priority. It does not claim runtime proof. Each scored finding records ClawPatch
severity and confidence, whether clawpatch next selected it, branch relevance, evidence freshness,
current user pain, evidence type (static-only, runtime-suspected, or runtime-proven), and the
recommended route.
| Score | Typical finding | Recommended route |
|---|---|---|
| 8-10 | Branch-relevant, high severity or confidence, fresh, or matches current user pain | $bug-resolution-phase when the fix target is clear; $debugging-phase when runtime proof is missing |
| 5-7 | Plausible and relevant, but mixed confidence, freshness, or impact | Inspect more, revalidate, or defer to debt classification |
| 0-4 | Stale, low confidence, not branch-relevant, duplicate, or likely false positive | Triage or revalidate if useful; otherwise stop |
The discovery report lists the report path, the ledger path, the Preflight Record values, each
command and its completion, the ranked finding IDs, the static-candidate statement, and the next
phase per finding: $bug-resolution-phase (including debt classification), $debugging-phase, or
none. The report and .clawpatch/ paths are the resume key for later resolution runs.
When the user asks for fixing, discovery stops and returns the exact $bug-resolution-phase
invocation with the finding ID and report path. A finding that needs runtime reproduction gets a
$debugging-phase recommendation. Debt classification belongs to $bug-resolution-phase; discovery
itself creates no tech-debt docs.
Resolution
$bug-resolution-phase reads the selected finding with clawpatch show, captures its ID, report and
state paths, evidence, affected files, claimed behavior, status, scope, and provider, then classifies
it:
-
resolve-now: ownership is clear and verification exists. Optionally readclawpatch fix --finding <id> --dry-runfor context only. Patch through normal Harness edits, run focused tests, type checks, smoke checks, or docs validation, then runclawpatch revalidate --finding <id>. When revalidation is unavailable or inconclusive, add a triage note. -
needs-runtime-debugging: stop resolution edits and route to$debugging-phasewith the finding ID, report path, source evidence, expected and observed behavior, scenario, and any failed revalidation. Debugging owns hypotheses, runtime evidence, the fix, and verification. After the fix, the operator re-invokes$bug-resolution-phasewith the finding ID and the debugging result; that run revalidates withclawpatch revalidate --finding <id>. -
tech-debt: the finding is real or plausible but too broad, needs a product or architecture decision, lacks acceptance criteria, or needs a larger spec. Update ClawPatch triage first, then run$docs-ingest-phaseto create or update the canonical debt file<wiki-root>/content/docs/project/tech-debt/<domain>/<spec>/<debt-slug>.md, the input of$resolve-debt-phase. The file has statusdraft, the domain, the originating spec, a linked backlog mirror when present, evidence, a proposed resolution, and these fields:- ClawPatch finding ID;
- report path or state path;
- source evidence and affected paths;
- classification reason;
- a concrete human-review question;
- why immediate resolution is unsafe or too broad.
The debt file stays small and points at the report instead of copying it.
-
false-positive: record the proof, then runclawpatch triage --finding <id> --status false-positive --note "<reason>". -
blocked: record the blocker and the missing item, leave source unchanged, optionally note it in triage, and report the next human action.
clawpatch fix --finding and open-pr run only on a clear user request. Resolution does not invoke
review; a review of the change is a separate explicit $review-phase run.
Batches
A batch needs explicit user bounds and at least one shared constraint: root cause, owned file set,
validation path, or contract or test gap. With parallel: true, workers resolve findings
concurrently under these rules:
- Each worker brief names finding IDs, the classification route, owned and forbidden files, allowed validation, ClawPatch context, and handoff expectations.
- Shared files, generated files, lockfiles, migrations, docs, and schemas have one owner.
- When two workers need the same file or root-cause patch, fan-out pauses for that subset.
- The coordinator checks the combined diff, runs final validation and
clawpatch revalidate, and makes every status decision centrally.
Related Pages
Known Gaps
- The IP-170 spec and grill describe an explicit "all-in-one" discover-and-resolve goal. No current skill text supports it, so this page does not document it as a mode.