bugbot

A reference and workflow for Bugbot, a system that detects possible software problems and can act on requests to fix them. It uses code changes, pull requests, issues, and review comments as context.

In plain words
What is it for?
Use it to detect potential problems after pushes or on demand, review findings in pull requests, and handle requested fixes through issue or review comments.
Why use it?
It helps track whether reported findings are new, already known, or resolved, instead of treating every scan result as unrelated.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/vypdev/copilot/bugbot
Clone the repo
git clone --depth 1 https://github.com/vypdev/copilot

Made for: Cursor.

Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,623 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00025 $0.02623
Opus 5 $0.00013 $0.01311
Sonnet 5 $0.00005 $0.00525
Haiku 4.5 $0.00003 $0.00262

Measured yesterday against content hash b74d0f21f198, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

bugbot scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/bugbot.mdc · 129 lines

How it starts

The opening of the file, as written. The whole thing — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Bugbot – technical reference

Bugbot has two main modes: detection (on push or single action) and fix/do (on issue comment or PR review comment). All Bugbot code lives under src/usecase/steps/commit/bugbot/ and src/usecase/steps/commit/ (DetectPotentialProblemsUseCase, user_request_use_case).


1. Detection flow (push or single action)

Entry: CommitUseCase (on push) calls DetectPotentialProblemsUseCase; or SingleActionUseCase when action is detect_potential_problems_action.

Steps:

  1. Guard: OpenCode must be configured; issueNumber !== -1.
  2. Load context: loadBugbotContext(param) → issue comments + PR review comments parsed for markers; builds existingByFindingId, issueComments, openPrNumbers, previousFindingsBlock, prContext, unresolvedFindingsWithBody. Branch is param.commit.branch (or options.branchOverride when provided). PR context includes prHeadSha, prFiles, pathToFirstDiffLine for the first open PR.
  3. Build prompt: buildBugbotPrompt(param, context) – repo context, head/base branch, issue number, optional ai-ignore-files, and previousFindingsBlock (task 2: which previous findings are now resolved). OpenCode is asked to compute the diff itself and return findings + resolved_finding_ids.
  4. Call OpenCode: askAgent(OPENCODE_AGENT_PLAN, prompt, BUGBOT_RESPONSE_SCHEMA).
  5. Process response: Filter findings: safe path (isSafeFindingFilePath), not in ai-ignore-files (fileMatchesIgnorePatterns), meetsMinSeverity (min from bugbot-severity), deduplicateFindings. Apply applyCommentLimit(findings, bugbot-comment-limit)toPublish, overflowCount, overflowTitles.
  6. Mark resolved: markFindingsResolved(execution, context, resolvedFindingIds, normalizedResolvedIds) – for each existing finding in context whose id is in resolved set, update issue comment (and PR review comment if any) via replaceMarkerInBody to set resolved:true; if PR comment, call resolveReviewThread when applicable.
  7. Publish: publishFindings(execution, context, toPublish, overflowCount?, overflowTitles?) – for each finding: add or update issue comment (always); add or update PR review comment only when finding.file is in prContext.prFiles (using pathToFirstDiffLine when finding has no line). Each comment body is built with buildCommentBody(finding, resolved) and includes the marker <!-- copilot-bugbot finding_id:"id" resolved:false -->. Overflow: one extra issue comment summarizing excess findings.

Read the full file on GitHub · 129 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 129 lines · 25 tokens per session scan A b74d0f21f198

Subscribe to this mod's changes

bugbot is a cursor rule published in the GitHub repository vypdev/copilot (2 stars, last pushed yesterday), licensed MIT. It adds 25 tokens to every session and 2,623 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.