agentleFS
zen-mcpzen-mcp/browser/.agents/AGENTS.md

browser

AGENTS.md2 starsChanged 7 months agoApache-2.0View on GitHub

This file is the source of truth for AI coding agents working in this repo. Keep it concise, update it when project commands or safety rules change, and prefer linking to .agents/ for details. browser-mcp is an MCP server that exposes browser automation over HTTP/SSE. It combines direct Playwright tools with a browser-use agent flow for complex multi-step browser tasks. Read .agents/ARCHITECTURE.md before changing runtime lifecycle, tool registration, or artifact handling. Main runtime pieces: 1. For any code writing, review,…

  • Installs packages

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

18 rules. About 1 is common, 3 are distinctive, and 14 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 14

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep it concise, update it when project commands or safety rules change, and prefer linking to .agents/ for details.

    line 4
  2. Very specific:

    Read .agents/ARCHITECTURE.md before changing runtime lifecycle, tool registration, or artifact handling.

    line 15
  3. Very specific:

    Read .agents/RULES.md for safety and MCP boundary rules.

    line 30
  4. Very specific:

    Read .agents/REPO_RULES.md for project-specific gotchas.

    line 31
  5. Very specific:

    If adding or changing a skill, update .agents/SKILLS.md and keep tests passing.

    line 33
  6. Very specific:

    Do not introduce pyproject.toml, uv, ruff, mypy, or OpenTelemetry in this foundation pass unless a later task explicitly asks for it.

    line 47
  7. Very specific:

    Keep direct Playwright access behind BrowserRuntime.

    line 53
  8. Very specific:

    Keep browse_and_act string-compatible for existing clients.

    line 58
  9. Distinctive:

    Use clear tool descriptions/docstrings so MCP clients can choose tools well.

    line 60
  10. Very specific:

    Avoid cross-imports between src/tools/* modules except shared lightweight helpers.

    line 61
  11. Very specific:

    All artifact/download file reads must go through BrowserRuntime.resolve_file_path().

    line 66
  12. Very specific:

    All artifact writes must use BrowserRuntime.build_artifact_path().

    line 68
  13. Very specific:

    Never commit headless=False in runtime code.

    line 69
  14. Common:

    Never log or return raw cookies, auth headers, API keys, passwords, or TOTP secrets.

    line 70
  15. Very specific:

    Do not write runtime artifacts to paths outside /data in the container or ./data on the host.

    line 72
  16. Very specific:

    Do not add outbound HTTP from tool code outside Playwright/browser-use flows.

    line 74
  17. Distinctive:

    Keep AI-first docs and runtime contract changes scoped.

    line 87
  18. Distinctive:

    Update tests with behavior changes, especially MCP output shape or path safety.

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md - browser-mcp

This file is the source of truth for AI coding agents working in this repo. Keep it concise, update it when project commands or safety rules change, and prefer linking to .agents/ for details.

Project

browser-mcp is an MCP server that exposes browser automation over HTTP/SSE. It combines direct Playwright tools with a browser-use agent flow for complex multi-step browser tasks.

Architecture

Read .agents/ARCHITECTURE.md before changing runtime lifecycle, tool registration, or artifact handling.

Main runtime pieces:

  • main.py: thin local/container entrypoint that adds src to sys.path.
  • src/server.py: creates FastMCP, loads settings, wires runtime, LLM, tools.
  • src/browser.py: owns Playwright/browser-use lifecycle and data path helpers.
  • src/tools/: MCP tools split by domain.
  • tests/: lightweight unit and validation tests.

Before Work

  1. For any code writing, review, or refactor, read and apply .agents/skills/guidelines/SKILL.md.
  2. Read .agents/RULES.md for safety and MCP boundary rules.
  3. Read .agents/REPO_RULES.md for project-specific gotchas.
  4. For multi-step browser workflows, check .agents/SKILLS.md first.
  5. If adding or changing a skill, update .agents/SKILLS.md and keep tests passing.

Commands

ActionCommand
Install depspython3 -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt
Run serverpython3 main.py
Docker rundocker compose up --build
Unit testspython3 -m unittest discover -s tests -p "test_*.py"
Runtime tests onlypython3 -m unittest tests/test_browser_runtime.py
Syntax checkpython3 -m compileall -q src tests main.py

Do not introduce pyproject.toml, uv, ruff, mypy, or OpenTelemetry in this foundation pass unless a later task explicitly asks for it.

Code Rules

  • Python 3.11+ style, async-first for browser and MCP tool I/O.
  • Keep direct Playwright access behind BrowserRuntime.
  • MCP tools should return dict payloads with ok: bool unless preserving an existing legacy contract.
  • Errors should be converted at the MCP tool boundary to {ok: false, error, error_type}. Helper/internal functions may raise normally.
  • Keep browse_and_act string-compatible for existing clients. Add structured sibling tools rather than breaking that return type.
  • Use clear tool descriptions/docstrings so MCP clients can choose tools well.
  • Avoid cross-imports between src/tools/* modules except shared lightweight helpers.

Safety Boundaries

  • All artifact/download file reads must go through BrowserRuntime.resolve_file_path().
  • All artifact writes must use BrowserRuntime.build_artifact_path().
  • Never commit headless=False in runtime code.
  • Never log or return raw cookies, auth headers, API keys, passwords, or TOTP secrets.
  • Do not write runtime artifacts to paths outside /data in the container or ./data on the host.
  • Do not add outbound HTTP from tool code outside Playwright/browser-use flows.

AI-First Assets

  • .agents/: repo-local AI-first architecture, rules, skills, and commands.
  • .cursor/rules/: Cursor project rules derived from this file.
  • .github/copilot-instructions.md: Copilot mirror of the core instructions.
  • skills/: deprecated compatibility placeholder; canonical skills live in .agents/skills/.

Change Discipline

  • The worktree may contain user changes. Do not revert unrelated edits.
  • Keep AI-first docs and runtime contract changes scoped.
  • Update tests with behavior changes, especially MCP output shape or path safety.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.