Browser Workflows
A small Codex plugin for predictable browser work: one connection entry, Page by default, Surface when needed, and background task tabs that respect the user's working context.
中文说明 · Browser skill · API reference
Why I built this
I wanted an agent to help with real work while I kept using my computer: checking course requirements, reviewing deadlines, researching websites, and validating local projects.
The browser APIs already existed. The friction was in how the agent found and used them. Across tasks, I saw repeated plugin discovery, confusion between JavaScript environments, hardcoded runtime versions, browser windows interrupting my work, and requests for me to open tabs the tool could create itself. Timeouts were sometimes described as permission failures, and large instruction dumps obscured the intended workflow.
This project grew out of correcting those concrete failures. Its goal is to make the existing APIs easier to use consistently, through a thin wrapper and focused instructions.
What changed
| Friction | Approach |
|---|---|
| Repeated searches for an entry point | One connectBrowser() entry initializes the installed browser runtime. |
| Updates break hardcoded paths | Resolve the newest numeric installed Chrome package version in the known package directory. |
| Unclear Page/Surface priorities | Page handles initial inspection and routine actions; Surface fills a demonstrated visual or semantic gap. |
| User must open missing tabs | connection.newTab() creates a task tab in Chrome's account context or a hidden in-app preview. |
| Browser work interrupts the foreground | Check focus/selected tabs around Chrome creation and visibility for in-app previews. Preserve the new tab ID when a change is detected. |
| Large manuals loaded per connection | A compact routine API reference; additional capability documentation as needed. |
| Repeated reads and vague failures | Retain results, classify the actual failure stage, and bound recovery attempts. |
| File selection mistaken for submission | Optional Canvas helpers distinguish chooser, file selection, submission, and receipt evidence. |
These are engineering changes, not benchmark claims. Focus checking detects changes after creation; it is not an operating-system focus lock. Version selection is not a guarantee of future API compatibility.
Requirements and scope
- Local Codex with its trusted Node REPL browser service and bundled Chrome/browser runtime installed.
- An available browser connection and the account required by the task. Chrome and the in-app browser do not share login state.
- Python 3.11+ for installation (older Python needs
tomli); Node.js 20+ for isolated tests. - Developed and manually exercised on macOS. Other platforms are not verified.
The browser client, extension, transport, and permission system are external dependencies. OpenAI's bundled runtime is not distributed here. Host access restrictions remain in effect.
The CLI in this repository is the plugin installer. Browser actions use the JavaScript API inside Codex's supported host; this is not a standalone shell browser driver.
Install
Preview changes from the repository root:
python3 scripts/install-local.py
Apply:
python3 scripts/install-local.py --apply
The installer copies the plugin to ~/.codex/plugins/browser-workflows, registers it in ~/.agents/plugins/marketplace.json, updates its enabled entry in ~/.codex/config.toml, and adds a managed first-read block to ~/.codex/AGENTS.md. It backs up existing files and preserves unrelated settings. An explicitly disabled plugin is left disabled.
The JSON result reports configKey. With a Codex CLI supporting local plugins, activate that key. For a new default marketplace:
codex plugin add browser-workflows@browser-workflows-local --json
If your marketplace has another name, use the returned configKey. Open a new chat or reload the plugin catalog. Registration cannot supply a browser service absent from the host.
Use --home /absolute/test-home for an isolated installation check; it changes the install destination, not the live browser's account or runtime.
Use in Codex's Node REPL
var { connectBrowser } = await import(
nodeRepl.homeDir + '/.codex/plugins/browser-workflows/skills/browser-workflow/scripts/connect-browser.mjs'
);
var connection = await connectBrowser({ sessionName: '🔎 Research' });
var tab = await connection.newTab();
await tab.goto('https://example.com');
var session = connection.session(tab);
nodeRepl.write(await session.read());
For an existing tab, choose an observed result of connection.browser.user.openTabs() and pass it to user.claimTab(...). Preserve the user's account and task scope.
For public/local preview work without Chrome's account state:
var preview = await connectBrowser({ browserType: 'iab', sessionName: '🔎 Preview' });
var tab = await preview.newTab();
The operation interfaces are the original host objects: session.page === tab.playwright, and session.surface === tab.ax (or null when unavailable). See the API reference for interaction and cleanup. The Canvas skill adds course workflows on the same connection.
Verify
These tests use mocks and temporary directories; they do not access your browser or accounts:
node --test tests/*.test.mjs
python3 -m unittest discover -s tests -p 'test_*.py'
Coverage includes runtime resolution, connection reuse, tab-focus checks, preserved errors, file-transfer ordering, submission receipts, duplicate-attempt guards, and installer settings preservation.
Manual host checks during development verified blank Chrome tab creation/read/close without changes to observed window focus or the selected user tab, plus hidden in-app creation. They do not establish behavior for every website, login flow, or page-driven popup.
Layout and license
skills/browser-workflow/: connection, native API wrapper, recovery guidance and optional helpers.skills/canvas/: course workflows and submission verification helpers.scripts/install-local.py: dry-run/apply installer CLI.tests/: isolated tests.
MIT for the original code and instructions in this repository. Third-party runtimes and services retain their own terms. This is an independent project, not an official OpenAI product.