gitwtfhub

wtf is betterwright?

curiosityos/betterwright — explained in plain English

Analysis updated 2026-05-18

15JavaScriptAudience · developerComplexity · 3/5Setup · moderate

TL;DR

A persistent, token-efficient browser toolkit built for AI agents, with compressed page snapshots, an encrypted credential vault, and CAPTCHA solving.

Mindmap

mindmap
  root((BetterWright))
    What it does
      Browser for AI agents
      Token efficient snapshots
      Persistent session
    Key pieces
      Credential vault
      Network policy
      CAPTCHA solving
      Proof screenshots
    Tech stack
      Node.js
      Playwright
      Chromium fork
    Use cases
      Agent driven browsing
      Login and checkout flows

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Give a coding agent a persistent browser session that survives across turns

REASON 2

Cut token usage on browser automation tasks with compressed page snapshots

REASON 3

Let an agent log into a site without ever seeing the raw password

REASON 4

Automate a multi-step browser flow like a login, cart, and checkout

What's in the stack?

JavaScriptNode.jsPlaywrightChromiumMCP

How it stacks up

curiosityos/betterwrightadindazu/fextractoranonymousraid/osint-mapping-tool
Stars151515
LanguageJavaScriptJavaScriptJavaScript
Setup difficultymoderatehardeasy
Complexity3/51/52/5
Audiencedevelopergeneralresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires Node.js 22+ and a one-time ~200MB browser download during setup.

Wtf does this do

BetterWright is a browser tool built specifically for AI agents rather than for human developers writing test scripts. It wraps Playwright, the browser automation library, but changes how the agent sees each page so that every observation costs as few tokens as possible, since burning thousands of tokens on a raw HTML dump or a full accessibility tree is one of the main ways an agent's context window runs out. Instead of returning the whole page every time, BetterWright returns a compressed, distilled view of what is on screen, with short reference markers the agent can act on directly. After an action, it can return just what changed rather than the full page again, and it keeps one browser session alive across many turns so the agent does not have to log back in or navigate back to where it was. The README reports a benchmark where this approach solved 14 of 15 tasks correctly against 12 of 15 for a comparable setup, while using noticeably fewer turns to reach the same answer. Other pieces round out the tool. An encrypted credential vault fills in login forms without ever putting the actual password into the conversation the model sees. A network policy layer checks every outgoing request and always blocks requests to cloud metadata endpoints, a common target in security exploits. It can take tagged proof screenshots the agent can point to as evidence a task was completed, and it includes local solvers for common CAPTCHA types like checkboxes and sliders, handing harder image based CAPTCHAs off to the agent's own vision. It installs as an npm package on Node.js 22 or newer, downloads its own browser on first setup, and can be wired into Claude Code, Codex, or any MCP compatible agent with a single command, or driven directly through its own JavaScript API for custom integrations.

Yoink these prompts

Prompt 1
Set up betterwright as a browser tool for my Claude Code agent using the skill install command.
Prompt 2
Explain how betterwright's compressed agent snapshots reduce token usage compared to a raw accessibility tree.
Prompt 3
Show me how to use the credential vault so my agent can log in without seeing the password.
Prompt 4
Walk me through running a multi-step browser task with betterwright's repl mode.

Frequently asked questions

wtf is betterwright?

A persistent, token-efficient browser toolkit built for AI agents, with compressed page snapshots, an encrypted credential vault, and CAPTCHA solving.

What language is betterwright written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js, Playwright.

How hard is betterwright to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is betterwright for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.