Skip to Content
screw bugs docs

Architecture

The parts of screw-bugs, and what happens from an agent's request to a finished report.

screw-bugs is a CLI and an MCP server around a platform-free engine. It has no AI of its own: your coding agent writes the cases, and screw-bugs runs them in a real headless browser and decides every status in code.

The parts

src/ holds one folder per module. schema, core and report are their own package, @screw-bugs/core, which screw-bugs re-exports.

ModuleOwnsCode
schemaSchemas of every file a run reads or writes: JobSpec, CaseLedger, ReportBundle, Findingspackages/core/src/schema/job.ts
coreThe engine (Engine, runCase) and the services it runs on: Browser, Storage, ReportRenderer, AccountBookpackages/core/src/core/engine.ts
reportThe renderers: renderHtmlReport, renderWalkthrough, renderPrSummary, renderLivePagepackages/core/src/report/html.ts
browser-playwrightThe Browser service on Playwright: launches Chrome, Edge or Chromium, runs steps, takes screenshots, records videosrc/browser-playwright/launch.ts
store-localThe Storage and AccountBook services on disk, under .screw-bugs/src/store-local/storage.ts
cliThe CLI commands, the MCP server, the local report server and the sign-in live viewsrc/cli/mcp.ts

Why the split

@screw-bugs/core depends only on effect: no Node, no Playwright. pnpm lint and pnpm check:workers keep it that way, so it runs on Cloudflare Workers.

The life of a run

  1. Plan. The agent writes a job: a URL, a summary, and cases of structured steps.
  2. Start. It calls the MCP tool start_run (or you run screw-bugs run --spec job.json). The reply is a job ID, right away.
  3. Record. The engine saves job.json and starts ledger.json in .screw-bugs/runs/<job-id>/.
  4. Run. Cases run in order, in one browser session. Each step acts, waits or checks; screenshots and one continuous video are saved as it goes.
  5. Judge. Code sets each case to passed, failed, blocked or not_verified. A live page, live.html, follows the run.
  6. Report. When the run ends it writes evidence.json, report.html and walkthrough.html.
  7. Review. The agent reads the evidence pack from run_status, then sends its write-up with submit_findings.
  8. Re-render. screw-bugs checks the write-up against the run, saves findings.json, draws annotated/ screenshots and writes the report again.
agent ──start_run──▶ MCP server ──▶ Engine ──▶ Browser (Playwright, headless)
                                      │              │
                                      ▼              ▼
                     .screw-bugs/runs/<job-id>/  evidence/ video/
                     job.json ledger.json evidence.json
                                      │
agent ◀──run_status── evidence pack ◀─┘
agent ──submit_findings──▶ findings.json ──▶ report.html + walkthrough.html

How Cloud reuses it

screw-bugs Cloud runs the same engine from @screw-bugs/core on Cloudflare Browser Run, and renders shared reports with its renderers. See Cloud runs.

NextCases and steps

On this page