# action-receipt [![CI](https://github.com/JeremiahM37/action-receipt/actions/workflows/ci.yml/badge.svg)](https://github.com/JeremiahM37/action-receipt/actions/workflows/ci.yml) [![CodeQL](https://github.com/JeremiahM37/action-receipt/actions/workflows/codeql.yml/badge.svg)](https://github.com/JeremiahM37/action-receipt/actions/workflows/codeql.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Python 3.11 | 3.12 | 3.13](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue.svg)](pyproject.toml) A deterministic effect oracle for browser agents, shipped as an MCP server. Every action returns a **receipt**: *dispatch → settlement → delta → verdict + recovery hint*. No model is involved anywhere in the loop — the receipt is a pure function of the live page. ``` verdict: no_op evidence: [no_observable_change] hint: the document has overflow:hidden, so wheel/keyboard scrolling of the window is disabled; scrollable containers on the page: div#panel (0/450); try scroll(selector=) settlement: settled_by=quiet_window elapsed=88ms (network 0 pending, dom 0 late mutations) ``` ## Why Agents are told an action succeeded when nothing happened, and then plan the next step from a false premise. This is a shape that recurs across unrelated codebases, not one project's bug (all verified in source on 2026-09-02 — see [`docs/PREMISE.md`](docs/PREMISE.md) for file, line and commit): 1. **browser-use** — the default `scroll` (`ScrollAction.pages = 1.0`) returns a non-error `ActionResult` with memory text `Scrolled down 1000px` even when the page could not move; `completed_scrolls` is never consulted and nothing in the dispatch chain reads the scroll position ([#5361](https://github.com/browser-use/browser-use/issues/5361), [#5438](https://github.com/browser-use/browser-use/issues/5438), and since then [#5486](https://github.com/browser-use/browser-use/issues/5486) — all open, nine fix PRs open, none merged, no maintainer reply). 2. **UI-TARS-desktop** — the ADB operator returns `{status: 'success'}` before un-awaited swipe/scroll/type promises settle, so the next screenshot is taken before the gesture lands ([#1952](https://github.com/bytedance/UI-TARS-desktop/issues/1952), open). Same consequence, different stage: that one is a *settlement* failure. 3. **Skyvern** — [PR #3080](https://github.com/Skyvern-AI/skyvern/pull/3080) (merged 2025-08-04) renders `skipped` actions with success styling in the UI. And the "wait for the UI to be ready" step is a magic constant everywhere: Anthropic's computer-use reference sleeps **2.0 s** before every screenshot, OSWorld's runner defaults to **0.0** and its Claude runner to **0.5**, playwright-mcp brackets its network wait with two **500 ms** sleeps, browser-use waits **0.1 s** between actions. None is measured. The receipt replaces the constant with a measurement: which signal settled, and how long it took. ## Install Not on PyPI yet; install from the repository (Python ≥ 3.11): ```bash pip install git+https://github.com/JeremiahM37/action-receipt # into the current environment pipx install git+https://github.com/JeremiahM37/action-receipt # or as an isolated CLI: `action-receipt` playwright install chromium # once, if no Chromium is cached yet ``` Pin a release with `@v0.2.0` after the URL. For a local checkout: ```bash git clone https://github.com/JeremiahM37/action-receipt && cd action-receipt python3 -m venv .venv && . .venv/bin/activate make install # pip install -e '.[dev]' + playwright install chromium make test-unit # < 5 s, no browser; `make test` runs every tier (~3 min) ``` Tested with Playwright 1.62 / Chromium 151 and `mcp` 2.1. ## MCP configuration Claude Code (`claude mcp add`) or `~/.claude.json`: ```json { "mcpServers": { "action-receipt": { "command": "/home/you/.venvs/action-receipt/bin/action-receipt", "args": [] } } } ``` Claude Desktop (`claude_desktop_config.json`) uses the same block. Options: | flag / env | effect | |---|---| | `--cdp ws://127.0.0.1:9222/devtools/browser/` or `--cdp http://127.0.0.1:9222` (`AR_CDP`) | attach to a running Chromium instead of launching one; required for **wrap mode** around another tool's tabs | | `--cdp-new-context` | with `--cdp`: work in an isolated incognito context, never touching existing tabs (wrap mode then only sees our own tabs) | | `--cdp-listen PORT` (`AR_CDP_LISTEN`) | launch our own Chromium with a remote-debugging port on `127.0.0.1` and work in its default context, so another tool attached to `http://127.0.0.1:PORT` (playwright-mcp `--cdp-endpoint`) drives the same tabs; the browser starts with the server. Exclusive with `--cdp` | | `--headed` | launch a visible Chromium | | `--enforce-done` (`AR_ENFORCE_DONE=1`) | refuse `done` while the last receipt is `no_op` / `blocked` / `unknown` or no action has been performed — see *Enforcing the receipt* | | `--max-refusals N` (`AR_MAX_REFUSALS`, default 2) | with `--enforce-done`: accept `done` anyway (`overridden: true`) after N refusals of the same claim | | `AR_QUIET_MS` (default 100) | length of the quiet window settlement must observe | | `AR_SETTLE_TIMEOUT_MS` (default 10000) | hard cap on settlement | | `AR_BODY_GRACE_MS` (default 1500) | how long a response whose headers arrived but whose body never finishes keeps the network signal busy (pages routinely never read a fetch body; Chromium never reports such a request finished) | ## Running beside playwright-mcp Already driving the browser with [`@playwright/mcp`](https://github.com/microsoft/playwright-mcp)? Keep doing so. `action-receipt --cdp-listen 9222` launches the Chromium and publishes its remote-debugging port; `@playwright/mcp --cdp-endpoint http://127.0.0.1:9222` attaches to the same browser and the same tabs, and each of its actions gets a receipt through `receipt_begin` / `receipt_end`. The config block for Claude Code and Claude Desktop, the agent-side protocol, the limits and a runnable example are in [`docs/using-with-playwright-mcp.md`](docs/using-with-playwright-mcp.md) and `examples/playwright-mcp/`. Verified with `@playwright/mcp@0.0.80` (`tests/e2e/test_playwright_mcp.py` runs the flow against the pinned package). ## Tools Every action tool returns `{"result": ..., "receipt": {...}}`. Anything that prevents a receipt (no tab open yet, `receipt_end` without `receipt_begin`, the browser gone) comes back as `{"error": {"type", "message"}, "receipt": null}` — a structured result, never a protocol error. Every element-targeting tool takes `frame=