playwriter AGENTS.md

A set of project instructions for developing and maintaining the Playwriter browser extension and its connected tools. The extension controls Chrome through a local WebSocket connection, a way for programs to exchange messages in real time.

In plain words
What is it for?
Use it when changing the Playwriter extension, its message protocol, local MCP server, WebSocket relay, or command-line tools.
Why use it?
It keeps changes compatible with older extension versions and explains how the extension, local server, and browser-automation client fit together.

Instructions file for CodexOpenCode

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 instructions/remorses/playwriter/agents-md
Clone the repo
git clone --depth 1 https://github.com/remorses/playwriter

Made for: Codex, OpenCode.

Per session 11,237 This file is loaded in full into every session.
When invoked 11,237 The same file — it is already loaded in full.
Security scan A 1 finding. 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.11237 $0.11237
Opus 5 $0.05618 $0.05618
Sonnet 5 $0.02247 $0.02247
Haiku 4.5 $0.01124 $0.01124

Measured 2d ago against content hash 42183193e192, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

playwriter AGENTS.md scanned grade A with 1 finding 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 2d ago.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sL https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol/master/pdl/domains/Target.pdl # manage “targets”: pages, iframes, workers, etc., and attach/detach sessions
AGENTS.md · 946 lines

How it starts

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

this is the playwriter codebase

the extension uses chrome.debugger to manage the user browser

read ./README.md for an overview of how this extension and mcp work read playwriter/src/skill.md to understand the MCP docs (source of truth)

backward compatibility

breaking changes to the WS protocol MUST never be made. publishing the extension code will never be instant, which means the extension must keep working with newer versions of the MCP and WS relay server.

architecture

  • user installs the extension in chrome. we assume there is only one chrome window for now, the first opened.
  • extension connects to a websocket server on port 19988. if this server is not yet open, it retries connecting in a loop
  • the MCP spawns the ws server if not already listening on 19988, in background. the mcp then connects to this same server with a playwright client
  • the server exposes /cdp/client-id which is used by playwright clients to communicate with the extension
  • the extension instead connects to /extension which is used to receive cdp commands and send responses and cdp events.
  • some events are treated specially for example because
    • we need to send attachedToTarget to let playwright know which pages are available
    • we need to send detachedFromTarget when we disable the extension in a tab
    • a few more events need custom handling
  • tabs are identified by sessionId or targetId (CDP concepts) or tabId (chrome debugger concept only)

mcp.ts MUST never use console.log. only console.error

write code that will run on all platforms: mac, linux, windows. especially around paths handling and command execution

development

running MCP locally

to test the MCP server with local changes, add it to your MCP client config with tsx:

{
  "mcpServers": {
    "playwriter": {
      "command": "tsx",
      "args": ["/path/to/playwriter/playwriter/src/mcp.ts"]
    }
  }
}

Read the full file on GitHub · 946 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. 2d ago First seen · 946 lines · 11,237 tokens per session scan A 42183193e192

Subscribe to this mod's changes

playwriter AGENTS.md is an instructions file published in the GitHub repository remorses/playwriter (3,846 stars, last pushed 6d ago), licensed MIT. It adds 11,237 tokens to every session, about $0.0562 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.