multi-agents-browser AGENTS.md

Project instructions for a browser-control agent whose command line and MCP interface communicate with a background service, which controls Chrome through the Chrome DevTools Protocol. They describe tab state, event buffering, command dispatch, and user-interface rules.

In plain words
What is it for?
Developing CLI or MCP browser commands, routing requests to handlers, managing Chrome tabs, tracking network and console events, and maintaining short tab IDs and event sequence numbers.
Why use it?
They give contributors the architecture and invariants needed to add browser commands without breaking communication, tab tracking, or event handling.

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/zzhan111/multi-agents-browser/agents-md
Clone the repo
git clone --depth 1 https://github.com/zzhan111/multi-agents-browser

Made for: Codex, OpenCode.

Per session 1,685 This file is loaded in full into every session.
When invoked 1,685 The same file — it is already loaded in full.
Security scan A 0 findings. 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.01685 $0.01685
Opus 5 $0.00843 $0.00843
Sonnet 5 $0.00337 $0.00337
Haiku 4.5 $0.00169 $0.00169

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

Security

Grade A, and why

multi-agents-browser AGENTS.md scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 154 lines

How it starts

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

ma-browser Agent 开发规范

架构

CLI (packages/cli) ──HTTP──▶ Daemon (packages/daemon) ──CDP WebSocket──▶ Chrome
MCP (packages/mcp) ──HTTP──┘       │
                              ┌────┴────┐
                              │  HTTP   │
                              │ Server  │
                              └────┬────┘
                                   │
                         ┌─────────┼─────────┐
                         │         │         │
                    CdpConnection  │  CommandDispatch
                    (WebSocket)    │  (request → handler)
                                   │
                            TabStateManager
                            (短 ID, seq 序号,
                             per-tab 事件缓冲)

Daemon 组件:

  • CdpConnection — 维持到 Chrome DevTools Protocol 的 WebSocket 长连接。自动发现 Chrome,管理 session 复用(每个 tab 一个 session)。
  • TabStateManager — 管理 per-tab 状态。分配短 ID(targetId 末 4+ 位 hex,保证唯一)。维护全局单调递增 seq 计数器。每个 tab 持有环形缓冲事件集合(network/console/errors)。
  • CommandDispatch — 将 Request.action 映射到处理函数。所有处理器接收 CdpConnection 和解析后的 TabState,返回带 tab(短 ID)和 seqResponse

核心概念:

  • 短 tab ID — 取 CDP targetId 末尾,最少 4 字符,碰撞时自动扩展。所有请求/响应中用短 ID 标识 tab。
  • seq 计数器 — 全局单调递增整数,每次操作和每个捕获事件都递增。支持 since 过滤做增量查询。
  • Per-tab 事件缓冲 — 环形缓冲(network: 500 条, console: 200 条, errors: 100 条),带 seq 标签。通过 sincefiltermethodstatuslimit 查询。

共享类型定义:packages/shared/src/protocol.ts

添加新命令

3 个文件:

  1. packages/shared/src/protocol.ts — 添加 ActionType + Request 字段 + ResponseData 字段
  2. packages/daemon/src/command-dispatch.ts — 在 dispatchRequest 中添加处理分支
  3. packages/cli/src/commands/<name>.ts + packages/cli/src/index.ts — CLI 命令 + 路由

可选:packages/mcp/src/index.ts — 如果需要暴露为 MCP tool

设计不变量

改代码前必读。违反任何一条都是 bug。

  • INV-1: 所有操作响应必须包含 tab(短 ID)和 seq(序号)
  • INV-2: 观察类响应(network/console/errors)必须包含 cursor
  • INV-3: 无效 tab ID 必须报错,不允许静默 fallback
  • INV-4: seq 全局单调递增,不可回退
  • INV-5: per-tab 事件隔离 — tab A 的事件不会出现在 tab B 的查询中
  • INV-6: tab 关闭时释放短 ID,清除事件缓冲
  • INV-7: tab_new 在零 tab 时仍可工作(在 ensurePageTarget 之前处理)

Read the full file on GitHub · 154 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 · 154 lines · 1,685 tokens per session scan A 70da149a6574

Subscribe to this mod's changes

multi-agents-browser AGENTS.md is an instructions file published in the GitHub repository zzhan111/multi-agents-browser (1 stars, last pushed 2mo ago), licensed MIT. It adds 1,685 tokens to every session, about $0.0084 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.