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
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository14 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/001-camofox-core.mdcCursor rule
- .cursor/rules/010-cli-commands.mdcCursor rule
- .cursor/rules/020-api-endpoints.mdcCursor rule
- .cursor/rules/030-workflows.mdcCursor rule
- .cursor/rules/040-anti-patterns.mdcCursor rule
- .cursor/rules/050-cli-dev.mdcCursor rule
- .cursor/rules/060-routes-dev.mdcCursor rule
- .cursor/rules/070-search-macros-presets.mdcCursor rule
- camofox-browserSkill
- camofox-cliSkill
- dogfoodSkill
- gemini-imageSkill
- redditSkill
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
- Very specific: line 28
Use /api/docs for interactive Swagger UI and /openapi.json for the machine-readable OpenAPI 3.1 subset.
- Distinctive: line 138
Use these instead of constructing URLs:
- Very specific: line 161
Call /snapshot to get current refs
- Very specific: line 162
Use ref in /click or /type
- Very specific: line 170
Delete all user data: DELETE /sessions/:userId
≈ “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.
Files
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:9377Core Workflow
- Create a tab → Get
tabId - Navigate → Go to URL or use search macro
- Get snapshot → Receive page content with element refs (
e1,e2, etc.) - Interact → Click/type using refs
- Repeat steps 3-4 as needed
API Reference
API Docs
GET /api/docs
GET /openapi.jsonUse /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=agent1Returns 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 ownerref(string, optional) — Element ref likee12(from/snapshot)selector(string, optional) — CSS selector (use"html"for page-level scrolling)deltaY(number, optional) — Vertical delta (default:300if noscrollTo)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 ownerexpression(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=50Close Tab
DELETE /tabs/:tabId?userId=agent1Search Macros
Use these instead of constructing URLs:
| Macro | Site |
@google_search | |
@youtube_search | YouTube |
@amazon_search | Amazon |
@reddit_search | Reddit search (JSON) |
@reddit_subreddit | Reddit subreddit (JSON) |
@wikipedia_search | Wikipedia |
@twitter_search | Twitter/X |
@yelp_search | Yelp |
@spotify_search | Spotify |
@netflix_search | Netflix |
@linkedin_search | |
@instagram_search | Instagram tags |
@tiktok_search | TikTok |
@twitch_search | Twitch |
Element Refs
Refs like e1, e2 are stable identifiers for page elements:
- Call
/snapshotto get current refs - Use ref in
/clickor/type - Refs reset on navigation - get new snapshot after
Session Management
userIdisolates cookies/storage between userssessionKeygroups tabs by conversation/task (legacy:listItemIdalso accepted)- Stage 1 idle cleanup defaults to 30 minutes via
CAMOFOX_IDLE_TIMEOUT_MS; Stage 2 daemon exit usesCAMOFOX_IDLE_EXIT_TIMEOUT_MS - Delete all user data:
DELETE /sessions/:userId
Running Engines
Camoufox (Default)
npm start
# Or: ./run.shFirefox-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 outputDocker
docker build -t camofox-browser .
docker run -p 9377:9377 camofox-browserEnvironment Variables
| Variable | Default | Description |
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_HOST | 127.0.0.1 | Bind host; non-loopback binds require CAMOFOX_API_KEY |
CAMOFOX_HEADLESS | true | Display mode: true (headless), false (headed), virtual (Xvfb) |
CAMOFOX_VNC_RESOLUTION | 1920x1080x24 | Virtual Xvfb display resolution (WIDTHxHEIGHTxDEPTH) |
CAMOFOX_VNC_TIMEOUT_MS | 120000 | Max VNC session duration in ms before auto-stop |
CAMOFOX_IDLE_TIMEOUT_MS | 1800000 | Stage 1 idle cleanup threshold |
CAMOFOX_IDLE_EXIT_TIMEOUT_MS | 1800000 | Stage 2 daemon exit quiet window |
Key Files
src/server.ts- Express server entrypointDockerfile- Production container
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
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.

