agentleFS
redf0x1redf0x1/camofox-browser/AGENTS.md

camofox-browser

AGENTS.md438 starsChanged 8 months agoMITView on GitHub

Headless browser automation server for AI agents. Run locally or deploy to any cloud provider. Use /api/docs for interactive Swagger UI and /openapi.json for the machine-readable OpenAPI 3.1 subset. Returns: {"tabId": "abc123", "url": "...", "title": "..."} Returns accessibility tree with refs: direction supports up, down, left, and right. Parameters: - userId (string) — Session owner - ref (string, optional) — Element ref like e12 (from /snapshot) - selector (string, optional) — CSS selector (use "html" for page-level scrolling) - deltaY…

  • Reads credentials
  • Installs packages

The file

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

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Use /api/docs for interactive Swagger UI and /openapi.json for the machine-readable OpenAPI 3.1 subset.

    line 28
  2. Distinctive:

    Use these instead of constructing URLs:

    line 138
  3. Very specific:

    Call /snapshot to get current refs

    line 161
  4. Very specific:

    Use ref in /click or /type

    line 162
  5. Very specific:

    Delete all user data: DELETE /sessions/:userId

    line 170

≈ “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

camofox-browser Agent Guide

Headless browser automation server for AI agents. Run locally or deploy to any cloud provider.

Quick Start for Agents

# Install and start
npm install && npm start
# Server runs on http://localhost:9377

Core Workflow

  1. Create a tab → Get tabId
  2. Navigate → Go to URL or use search macro
  3. Get snapshot → Receive page content with element refs (e1, e2, etc.)
  4. Interact → Click/type using refs
  5. Repeat steps 3-4 as needed

API Reference

API Docs

GET /api/docs
GET /openapi.json

Use /api/docs for interactive Swagger UI and /openapi.json for the machine-readable OpenAPI 3.1 subset.

Create Tab

POST /tabs
{"userId": "agent1", "sessionKey": "task1", "url": "https://example.com"}

Returns: {"tabId": "abc123", "url": "...", "title": "..."}

Navigate

POST /tabs/:tabId/navigate
{"userId": "agent1", "url": "https://google.com"}
# Or use macro:
{"userId": "agent1", "macro": "@google_search", "query": "weather today"}

Get Snapshot

GET /tabs/:tabId/snapshot?userId=agent1

Returns accessibility tree with refs:

[heading] Example Domain
[paragraph] This domain is for use in examples.
[link e1] More information...

Click Element

POST /tabs/:tabId/click
{"userId": "agent1", "ref": "e1"}
# Or CSS selector:
{"userId": "agent1", "selector": "button.submit"}

Type Text

POST /tabs/:tabId/type
{"userId": "agent1", "ref": "e2", "text": "hello world"}

Scroll

Scroll the page vertically or horizontally.

POST /tabs/:tabId/scroll
{"userId": "agent1", "direction": "down", "amount": 500}

direction supports up, down, left, and right.

Scroll Element

Scroll a specific scrollable container (modals, sidebars, overflow divs) by ref from snapshot or a CSS selector.

Parameters:

  • userId (string) — Session owner
  • ref (string, optional) — Element ref like e12 (from /snapshot)
  • selector (string, optional) — CSS selector (use "html" for page-level scrolling)
  • deltaY (number, optional) — Vertical delta (default: 300 if no scrollTo)
  • deltaX (number, optional) — Horizontal delta (default: 0)
  • scrollTo (object, optional) — Absolute position: { "top"?: number, "left"?: number }

Auth: conditional — Authorization: Bearer $CAMOFOX_API_KEY when CAMOFOX_API_KEY is set

POST /tabs/:tabId/scroll-element
{"userId": "agent1", "selector": "div.modal-body", "deltaY": 400}
# Or absolute positioning:
{"userId": "agent1", "ref": "e12", "scrollTo": {"top": 0}}

Returns: {"ok": true, "scrollPosition": {"scrollTop": 400, "scrollLeft": 0, "scrollHeight": 1200, "clientHeight": 600, "scrollWidth": 800, "clientWidth": 800}}

Evaluate JavaScript

Execute a JavaScript expression in the page context and return the JSON-serializable result.

Parameters:

  • userId (string) — Session owner
  • expression (string, required) — JavaScript expression (max 64KB)
  • timeout (number, optional) — Milliseconds (min 100, max 30000, default 5000)

Auth: conditional — Authorization: Bearer $CAMOFOX_API_KEY when CAMOFOX_API_KEY is set on the server

POST /tabs/:tabId/evaluate
Authorization: Bearer $CAMOFOX_API_KEY
{"userId": "agent1", "expression": "({url: window.location.href, links: document.querySelectorAll('a').length})", "timeout": 5000}

Returns (success): {"ok": true, "result": {"url": "https://...", "links": 123}, "resultType": "object", "truncated": false}

Returns (error): {"ok": false, "error": "...", "errorType": "js_error" | "timeout"}

Navigation

POST /tabs/:tabId/back     {"userId": "agent1"}
POST /tabs/:tabId/forward  {"userId": "agent1"}
POST /tabs/:tabId/refresh  {"userId": "agent1"}

Get Links

GET /tabs/:tabId/links?userId=agent1&limit=50

Close Tab

DELETE /tabs/:tabId?userId=agent1

Search Macros

Use these instead of constructing URLs:

MacroSite
@google_searchGoogle
@youtube_searchYouTube
@amazon_searchAmazon
@reddit_searchReddit search (JSON)
@reddit_subredditReddit subreddit (JSON)
@wikipedia_searchWikipedia
@twitter_searchTwitter/X
@yelp_searchYelp
@spotify_searchSpotify
@netflix_searchNetflix
@linkedin_searchLinkedIn
@instagram_searchInstagram tags
@tiktok_searchTikTok
@twitch_searchTwitch

Element Refs

Refs like e1, e2 are stable identifiers for page elements:

  1. Call /snapshot to get current refs
  2. Use ref in /click or /type
  3. Refs reset on navigation - get new snapshot after

Session Management

  • userId isolates cookies/storage between users
  • sessionKey groups tabs by conversation/task (legacy: listItemId also accepted)
  • Stage 1 idle cleanup defaults to 30 minutes via CAMOFOX_IDLE_TIMEOUT_MS; Stage 2 daemon exit uses CAMOFOX_IDLE_EXIT_TIMEOUT_MS
  • Delete all user data: DELETE /sessions/:userId

Running Engines

Camoufox (Default)

npm start
# Or: ./run.sh

Firefox-based with anti-detection. Bypasses Google captcha.

Testing

npm test              # Full Jest suite (pretest builds dist/)
npm run test:live     # Live Google tests
npm run test:debug    # With server output

Docker

docker build -t camofox-browser .
docker run -p 9377:9377 camofox-browser

Environment Variables

VariableDefaultDescription
CAMOFOX_API_KEY(empty)When set, guards protected endpoints via Authorization: Bearer header. Unset = no auth enforced.
CAMOFOX_ADMIN_KEY(empty)Required for POST /stop (sent via x-admin-key header)
CAMOFOX_HOST127.0.0.1Bind host; non-loopback binds require CAMOFOX_API_KEY
CAMOFOX_HEADLESStrueDisplay mode: true (headless), false (headed), virtual (Xvfb)
CAMOFOX_VNC_RESOLUTION1920x1080x24Virtual Xvfb display resolution (WIDTHxHEIGHTxDEPTH)
CAMOFOX_VNC_TIMEOUT_MS120000Max VNC session duration in ms before auto-stop
CAMOFOX_IDLE_TIMEOUT_MS1800000Stage 1 idle cleanup threshold
CAMOFOX_IDLE_EXIT_TIMEOUT_MS1800000Stage 2 daemon exit quiet window

Key Files

  • src/server.ts - Express server entrypoint
  • Dockerfile - Production container

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.