Accessibility-first browser & computer use for AI agents — one MCP server for every harness (Codex, Claude Code, OpenCode, Antigravity). Instruments the DOM/accessibility tree via CDP instead of screenshot loops: diffed snapshots, stable element refs, trusted input, typed errors. Zero dependencies
JavaScript agentic-automationai-agentsbrowser-automationbrowser-usecdpchrome-devtools-protocolcomputer-usecuamcpmodel-context-protocolrpaweb-automation
Benchmark harness: isolated agent home, re-scoring, results notes
soloratech7ad8a7a8b983
diff --git a/bench/suite/PLAYWRIGHT-COMPARISON.md b/bench/suite/PLAYWRIGHT-COMPARISON.mdnew file mode 100644index 0000000..b760138--- /dev/null+++ b/bench/suite/PLAYWRIGHT-COMPARISON.md@@ -0,0 +1,58 @@+# axuse vs Playwright MCP — benchmark result++Same harness (Codex CLI), same model (`gpt-5.6-luna`, reasoning `medium`), same 23 tasks,+same machine. Only the browser layer differs: axuse MCP vs `@playwright/mcp` 0.0.83+(`--headless --isolated --caps vision`). Both arms ran in an isolated Codex home with no+built-in `cua` / `node_repl` / bundled browser plugins, so neither arm could reach another+browser layer. Scoring is server-side ground truth, as in `README.md`.++## Result (71 runs per arm)++| | Playwright MCP | axuse |+|---|---|---|+| Passed (strict rules) | 71/71 | 71/71 |+| Median time per task | 16 s | **13 s** |+| Total time | 1493 s | **1183 s** (-21%) |+| Median total tokens | 168k | **144k** |+| Total tokens | 15.38 M | **11.84 M** (-23%) |+| Median tool calls | 8 | **5** |+| Total tool calls | 673 | **402** (-40%) |++Per task, axuse is equal or lower than Playwright on 21 of 23 tasks for time and 23 of 23+for tool calls. It is **behind on tokens in 9 tasks** (t1, t3, t8, t9, t12, t13, t14, t15,+t17, mostly by small margins) and **behind on time in 2** (t5, t10).++## Provenance (read before quoting)++The table merges two runs, as agreed, instead of re-running everything:++- **22 tasks** (all but t7): 3 repetitions each, build *v3* (post-action settling, stale-ref+ recovery, slimmer tool text, screenshot pixel-ratio fix). `results/pw-v3-full2.jsonl`.+- **t7** (infinite-scroll feed): 5 repetitions, build *v4* = v3 + the `ax_observe find`+ fix. `results/pw-t7-v4.jsonl`. The other 22 tasks were **not** re-run on v4.+- Merged file: `results/final-vs-playwright.jsonl` (each row carries its `build`).++The raw per-run logs (`results/*.jsonl`) record local file paths and are not committed; they are available on request ([email protected]). The harness that produced them is in this folder (see `README.md`, "Comparing against another MCP browser tool").++On v3, axuse **failed 2 of 3 t7 runs** (it liked the neighbouring post because `find`+printed the previous article's Like button next to the match; the task cannot recover from a+wrong like). Those two failures are the reason the t7 rows were replaced; the same v3 run had+Playwright at 3/3 on t7. After the fix, t7 is 5/5 for both arms. 5 runs is a small sample.++## Scoring notes++- Strict rule: a run is disqualified if any call reaches another arm's browser layer.+ `rescore.mjs` also reports a narrower rule (disqualify only if the foreign call touched+ the task site). On this merged set strict and narrow agree: 71/71 for both arms.+- An earlier axuse run was disqualified under the strict rule for one stray+ `cua.getState()` call (correct answer). The isolated Codex home removes that possibility+ for both arms.+- An invalid first full run (Playwright arm never started because of a config error in the+ new isolated home) is kept only as `results/INVALID-pw-v3-full-playwright-arm-never-started.jsonl`.++## Not covered++Public fixture pages with no login and no bot protection: this measures speed, tokens and+accuracy on generic browser tasks, not axuse's other advantages (the user's signed-in+Chrome, challenge handling, workflow plugins). Playwright MCP is also not slow here; the+gap is a median of 3 s and 24k tokens per task.diff --git a/bench/suite/README.md b/bench/suite/README.mdindex 23ad051..9136c8f 100644--- a/bench/suite/README.md+++ b/bench/suite/README.md@@ -10,6 +10,7 @@ layer:| `codex-chrome` | Codex's own browser use: the Codex Chrome extension in the user's real Chrome (Codex's built-in plugin + skill) || `axuse` | the axuse MCP server (its own headless Chromium) || `browser-use` | [browser-use](https://github.com/browser-use/browser-use) 0.13 CLI + its official `SKILL.md`, attached to a dedicated headless Chrome via `BU_CDP_URL` |+| `playwright` | Microsoft's [`@playwright/mcp`](https://github.com/microsoft/playwright-mcp) (pinned local install via `--playwright-cli`), headless Chrome, isolated profile, `--caps vision` |## Tasks@@ -90,3 +91,24 @@ node bench/suite/portability.mjs --harness claude,opencodeResults land in `results/*.jsonl` (one line per run, with the session filepath for audit).++### Comparing against another MCP browser tool, in a clean agent home++```bash+# pinned Playwright MCP, installed once+mkdir -p ~/.axbench-tmp/pw-mcp && (cd ~/.axbench-tmp/pw-mcp && npm init -y && npm i @playwright/[email protected])++# a Codex home with the same login but none of Codex's bundled browser /+# computer-use plugins (the --disable flags do not remove its built-in `cua`+# and `node_repl` servers, so without this an arm can still reach another layer)+mkdir -p ~/.axbench-tmp/codex-home && cp ~/.codex/auth.json ~/.axbench-tmp/codex-home/ && : > ~/.axbench-tmp/codex-home/config.toml++node bench/suite/run.mjs --arms axuse,playwright --reps 3 --tag compare --codex-home ~/.axbench-tmp/codex-home --axuse-cli /path/to/axuse-frozen/src/cli.js --playwright-cli ~/.axbench-tmp/pw-mcp/node_modules/@playwright/mcp/cli.js+node bench/suite/summarize.mjs bench/suite/results/compare.jsonl+node bench/suite/rescore.mjs bench/suite/results/compare.jsonl # strict vs "touched the task site" rule+```++`auth.json` holds your login: delete the benchmark home when you are done. A run+that produces no agent session prints the agent's own error (`NO-SESSION`) instead of+a bare FAIL. The result of one such comparison, with its caveats, is in+`PLAYWRIGHT-COMPARISON.md`.diff --git a/bench/suite/rescore.mjs b/bench/suite/rescore.mjsnew file mode 100644index 0000000..1cb77c4--- /dev/null+++ b/bench/suite/rescore.mjs@@ -0,0 +1,52 @@+/**+ * Re-score recorded runs under the narrower "touched the task site" rule.+ *+ * run.mjs disqualifies a run when a call into another arm's browser layer+ * appears at all (strict). That also catches harmless calls: a status+ * inspection that returns nothing about the page. The relaxed rule keeps the+ * purpose of the check: a foreign call only disqualifies when it touched the+ * task site (its arguments reference this run's id or the tunnel host). It is+ * applied identically to every arm and every run, and the strict result is+ * always reported next to it.+ *+ * node bench/suite/rescore.mjs results/a.jsonl [results/b.jsonl ...]+ */+import { readFileSync } from "node:fs";++const FOREIGN = {+ // Same patterns run.mjs uses to decide a call belongs to another arm's layer.+ axuse: (c) => (c.name === "js" && /cua\.|tabs\.new|playwright/.test(c.args)) || /browser-use/.test(c.args),+ playwright: (c) => /^ax_|mcp__axuse/.test(c.name) || /mcp__axuse|browser-use/.test(c.args) || (c.name === "js" && /cua\.|tabs\.new/.test(c.args)),+ "browser-use": (c) => /^ax_|mcp__axuse/.test(c.name) || /mcp__axuse/.test(c.args) || (c.name === "js" && /cua\.|tabs\.new/.test(c.args)),+ "codex-chrome": (c) => /^ax_|mcp__axuse/.test(c.name) || /mcp__axuse|browser-use/.test(c.args),+};++function calls(file) {+ const out = [];+ for (const line of readFileSync(file, "utf8").split("\n")) {+ if (!line.trim()) continue;+ let o; try { o = JSON.parse(line); } catch { continue; }+ const p = o.payload ?? {};+ if (p.type === "function_call" || p.type === "custom_tool_call") out.push({ name: p.name, args: String(p.arguments ?? p.input ?? "") });+ }+ return out;+}++const rows = [];+for (const f of process.argv.slice(2)) {+ for (const l of readFileSync(f, "utf8").trim().split("\n")) rows.push(JSON.parse(l));+}+const by = {};+for (const r of rows) {+ const isForeign = FOREIGN[r.arm] ?? (() => false);+ let touched = false;+ if (r.foreign && r.sessionFile) {+ touched = calls(r.sessionFile).some((c) => isForeign(c) && (c.args.includes(r.run) || /trycloudflare\.com/.test(c.args)));+ }+ const relaxed = r.scored && !r.violations?.length && r.evidence && !touched;+ (by[r.arm] ??= { n: 0, strict: 0, relaxed: 0, answer: 0 });+ by[r.arm].n++; by[r.arm].strict += r.success ? 1 : 0; by[r.arm].relaxed += relaxed ? 1 : 0; by[r.arm].answer += r.scored ? 1 : 0;+ if (r.success !== relaxed) console.log(`re-scored: ${r.task} ${r.arm} r${r.rep} strict=${r.success} relaxed=${relaxed} (foreign call touched task site: ${touched})`);+}+console.log("\narm runs strict relaxed answer-correct");+for (const [a, v] of Object.entries(by)) console.log(`${a.padEnd(14)} ${String(v.n).padStart(4)} ${String(v.strict).padStart(6)} ${String(v.relaxed).padStart(7)} ${String(v.answer).padStart(14)}`);diff --git a/bench/suite/run.mjs b/bench/suite/run.mjsindex 73d6068..cd4db67 100644--- a/bench/suite/run.mjs+++ b/bench/suite/run.mjs@@ -9,6 +9,8 @@* axuse axuse MCP server (its own headless Chromium)* browser-use browser-use 0.13 CLI + its official SKILL.md (dedicated* headless Chromium via BU_CDP_URL)+ * playwright Microsoft's @playwright/mcp (pinned, --playwright-cli) driving+ * the same headless Chrome build, isolated profile** Fixtures are served over public HTTPS (Cloudflare quick tunnels) because the* Codex extension refuses localhost / private IPs. Success is scored on@@ -31,6 +33,12 @@ import { locateBrowser } from "../../src/core/cdp.js";const AXUSE_DIR = process.env.AXBENCH_AXUSE_DIR ?? join(dirname(fileURLToPath(import.meta.url)), "..", "..");const WORK = process.env.AXBENCH_WORK ?? join(homedir(), ".axbench-tmp");const SESSIONS_ROOT = join(homedir(), ".codex", "sessions");+// --codex-home <dir>: run every arm except codex-chrome in an isolated Codex+// home (same login, no bundled browser/computer-use plugins). The feature and+// plugin --disable flags do not remove Codex's built-in `cua`/node_repl REPL+// servers, so an arm could still reach another browser layer; a clean home+// takes them away for every arm identically.+const ISO_HOME = (() => { const i = process.argv.indexOf("--codex-home"); return i >= 0 ? process.argv[i + 1] : null; })();const arg = (n, d) => { const i = process.argv.indexOf(n); return i >= 0 ? process.argv[i + 1] : d; };const MODEL = arg("--model", "gpt-5.6-luna");const EFFORT = arg("--effort", "medium");@@ -113,9 +121,15 @@ const DISABLE_NATIVE = ["-c", 'plugins."unified-computer-use@openai-bundled".enabled=false', "-c", 'plugins."computer-use@openai-bundled".enabled=false',];const NO_AXUSE = ["-c", "mcp_servers.axuse.enabled=false"];+// An isolated Codex home has no axuse entry to disable, and disabling an+// undefined server is an invalid config (Codex refuses to start).+const NO_AXUSE_ISO = ISO_HOME ? [] : NO_AXUSE;// The axuse arm runs a FROZEN copy (--axuse-cli), so edits to the working// tree can never leak into a benchmark in flight.const AXUSE_CLI = arg("--axuse-cli", null);+// The playwright arm runs a pinned local install of @playwright/mcp (cli.js).+const PW_CLI = arg("--playwright-cli", null);+const PW_FLAGS = PW_CLI ? ["-c", `mcp_servers.playwright.command="node"`, "-c", `mcp_servers.playwright.args=["${PW_CLI.replaceAll("\\", "/")}","--headless","--isolated","--caps","vision","--executable-path","${locateBrowser().replaceAll("\\", "/")}"]`] : [];const AXUSE_FLAGS = AXUSE_CLI ? ["-c", `mcp_servers.axuse.command="node"`, "-c", `mcp_servers.axuse.args=["${AXUSE_CLI.replaceAll("\\", "/")}","mcp"]`] : [];const COMMON_RULES =@@ -139,8 +153,15 @@ const ARM = {evidence: (calls) => calls.some((c) => /ax_/.test(c.name) || /mcp__axuse__ax_/.test(c.args)),foreign: (calls) => calls.some((c) => (c.name === "js" && /cua\.|tabs\.new|playwright/.test(c.args)) || /browser-use/.test(c.args)),},+ playwright: {+ flags: [...DISABLE_NATIVE, ...NO_AXUSE_ISO, ...PW_FLAGS],+ env: {},+ directive: () => "Use the Playwright MCP browser tools (browser_navigate, browser_snapshot, browser_click, …) for this task. They launch their own browser.\n",+ evidence: (calls) => calls.some((c) => /mcp__playwright__browser_/.test(c.args) || /playwright/.test(c.name)),+ foreign: (calls) => calls.some((c) => /^ax_|mcp__axuse/.test(c.name) || /mcp__axuse|browser-use/.test(c.args) || (c.name === "js" && /cua\.|tabs\.new/.test(c.args))),+ },"browser-use": {- flags: [...DISABLE_NATIVE, ...NO_AXUSE],+ flags: [...DISABLE_NATIVE, ...NO_AXUSE_ISO],env: {},directive: () =>"Use the browser-use CLI (`browser-use`, already installed and on PATH) for this task. A dedicated Chrome is already running and configured via BU_CDP_URL. " +@@ -155,7 +176,7 @@ function runCodex(armName, prompt, cwd, extraEnv) {const args = ["exec", "-s", "danger-full-access", "--skip-git-repo-check", "-m", MODEL, "-c", `model_reasoning_effort="${EFFORT}"`, ...arm.flags, prompt];return new Promise((resolve) => {const t0 = Date.now();- const child = spawn("codex", args, { cwd, env: { ...process.env, ...arm.env, ...extraEnv }, stdio: ["ignore", "pipe", "pipe"] });+ const child = spawn("codex", args, { cwd, env: { ...process.env, ...arm.env, ...extraEnv, ...(ISO_HOME && armName !== "codex-chrome" ? { CODEX_HOME: ISO_HOME } : {}) }, stdio: ["ignore", "pipe", "pipe"] });let stdout = "", stderr = "";child.stdout.on("data", (d) => (stdout += d));child.stderr.on("data", (d) => (stderr += d));@@ -170,6 +191,7 @@ function findSession(sessionId) {const hits = [];const walk = (d) => { let es; try { es = readdirSync(d, { withFileTypes: true }); } catch { return; } for (const e of es) { const p = join(d, e.name); if (e.isDirectory()) walk(p); else if (e.name.includes(sessionId)) hits.push(p); } };walk(SESSIONS_ROOT);+ if (ISO_HOME) walk(join(ISO_HOME, "sessions"));return hits[0] ?? null;}const outText = (p) => typeof p.output === "string" ? p.output : Array.isArray(p.output) ? p.output.map((x) => x.text ?? "").join("") : "";@@ -219,6 +241,7 @@ function violations(calls, hosts) {// ------------------------------------------------------------------ mainasync function main() {+ if (ARMS.includes("playwright") && !PW_CLI) throw new Error("playwright arm needs --playwright-cli <path to @playwright/mcp/cli.js>");if (ARMS.includes("browser-use") && !BU_SKILL) throw new Error("bench/suite/browser-use-SKILL.md missing (run: browser-use skill show > that file)");const suite = await startSuite();const [tp, tc] = await Promise.all([startTunnel(suite.parentPort), startTunnel(suite.childPort)]);@@ -275,7 +298,7 @@ async function main() {};appendFileSync(OUT, JSON.stringify(rec) + "\n");const tok = s.tokens ? `${s.tokens.total_tokens?.toLocaleString()} (in ${s.tokens.input_tokens?.toLocaleString()}, cached ${s.tokens.cached_input_tokens?.toLocaleString()}, out ${s.tokens.output_tokens?.toLocaleString()})` : "?";- console.log(`${success ? "PASS" : "FAIL"} ${task.padEnd(4)} ${armName.padEnd(12)} r${rep} ${String(Math.round(r.wallMs / 1000)).padStart(4)}s turns=${s.turns} calls=${s.calls.length} tok=${tok}${viol.length ? " VIOLATION" : ""}${!evidence ? " NO-EVIDENCE" : ""}${foreign ? " FOREIGN" : ""}${!scored ? ` [answer="${answer.slice(0, 40)}"]` : ""}`);+ console.log(`${success ? "PASS" : "FAIL"} ${task.padEnd(4)} ${armName.padEnd(12)} r${rep} ${String(Math.round(r.wallMs / 1000)).padStart(4)}s turns=${s.turns} calls=${s.calls.length} tok=${tok}${viol.length ? " VIOLATION" : ""}${!evidence ? " NO-EVIDENCE" : ""}${foreign ? " FOREIGN" : ""}${!scored ? ` [answer="${answer.slice(0, 40)}"]` : ""}${!file ? ` NO-SESSION [codex: ${String(r.stderr).trim().split("\n").slice(-1)[0].slice(0, 160)}]` : ""}`);try { rmSync(cwd, { recursive: true, force: true }); } catch {}return rec;};