my chrome extensions are just prompts
The author built a tool called Prompt in a Box that lets you write a Chrome extension as a Markdown prompt, with a manifest for permissions and a config file for settings. The extension runs as a small agent inside the browser, with undo, audit logs, and a way to compile repeatable parts into fixed scripts.
- An extension is three files: prompt.md (the program), manifest.json (what it can access), and config.json (user-facing settings). Swapping the prompt changes what the same runtime does.
- Tools are gated by Chrome permissions. If the manifest doesn't grant bookmarks, the bookmark tools never appear in the model's tool list.
- "code_mode" lets the model write a short script that reads 50 tabs in parallel instead of making 50 slow LLM round trips, cutting runs from minutes to seconds in some cases. The script runs in a sandboxed iframe with no network and no chrome APIs, so it can only call the permission-checked tools.
- Scripts the agent writes can be saved and bound to browser events, so repeatable logic can compile down to near-zero token cost over time.
The author has built a Chrome extension framework where the entire behavior of an extension lives in a Markdown prompt file rather than in code. An extension is three files: prompt.md says what it should do, manifest.json declares what Chrome permissions it can reach, and config.json holds user-facing knobs like allowed models, schedules, and UI settings. The runtime itself knows nothing about tabs or bookmarks. Swap the prompt and the same code becomes a different tool. A one-line prompt like "De-duplicate my tabs" is enough to start, though you can add schedules, exclusions, and content-awareness rules as you go. The project, now called "Studio," adds a UI for editing icons and permissions, a JSON schema for deterministic popup rendering, an undo journal for when the non-deterministic agent gets something wrong, and a full audit trail so you can debug and refine prompts.
The architecture is the most interesting part. The service worker exposes roughly 50 Chrome APIs as tools (tab_list, bookmark_search, history_search and so on), but each is gated by its manifest permission, so the model simply never sees tools the extension hasn't been granted. State lives in two places: OPFS serves as a file system for artifacts, the audit log, and an event queue, while chrome.storage.local holds settings and the undo journal. Runs are triggered either by things the user is waiting on, like a context menu click, or by ambient events such as a tab opening, which get queued and processed on the next run. After each run the service worker sleeps, since Chrome kills it when idle. API keys stay in the browser, and network calls go only to the chosen model provider (Gemini, Claude, or GPT, since the Chrome Prompt API isn't capable enough yet).
The most useful engineering detail is "code_mode." Naively, organizing 50 tabs means 50 sequential LLM round trips, which is slow and expensive. Instead, the model writes a short async script that runs in parallel across tabs and returns only a distilled result to the conversation. The author reports this cuts some runs from minutes to seconds. Getting it to work required routing around Chrome's strict content security policy, which blocks eval in service workers. The generated code runs in a sandboxed iframe hosted by an offscreen document, with an opaque origin, no chrome.* APIs, and no network access (connect-src 'none'), so the only thing the script can do is call back into the tool set. That workaround is the piece other extension builders are most likely to reuse.