Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

feat(actions): save every screenshot unless the caller opts out

Shahriard515b393c345
diff --git a/lib/actions/page/screenshot.ts b/lib/actions/page/screenshot.ts
index 9c80f4d..44230b6 100644
--- a/lib/actions/page/screenshot.ts
+++ b/lib/actions/page/screenshot.ts
@@ -5,7 +5,7 @@ import { documentBounds, resolveTarget, targetSchema } from './dom';
export const screenshot = defineAction({
name: 'page.screenshot',
description:
- 'Capture the tab as a PNG/JPEG image — the full scroll view, the current viewport, or a single targeted element. Optionally save it under ~/browsentic/screenshot/.',
+ 'Capture the tab as a PNG/JPEG image — the full scroll view, the current viewport, or a single targeted element. The image is saved under ~/browsentic/screenshot/ and the result reports the path as savedTo; pass save: false to capture without writing a file.',
input: z.object({
target: targetSchema
.optional()
@@ -33,8 +33,10 @@ export const screenshot = defineAction({
.describe('Downscale the result so its longest side is at most this many pixels.'),
save: z
.boolean()
- .default(false)
- .describe('Save the image to ~/browsentic/screenshot/ (written by the local Browsentic daemon).'),
+ .default(true)
+ .describe(
+ 'Write the image to ~/browsentic/screenshot/ (done by the local Browsentic daemon, which adds savedTo to the result). Set false to capture without touching the disk.',
+ ),
filename: z
.string()
.optional()
diff --git a/mcp/skills/browser-control.md b/mcp/skills/browser-control.md
index 8b44dd5..cea245b 100644
--- a/mcp/skills/browser-control.md
+++ b/mcp/skills/browser-control.md
@@ -44,7 +44,7 @@ Content behind a hover — dropdowns, tooltips — needs `page_hoverElement` bef
`page_screenshot` captures the tab as an image. By default it captures the **full scroll view** and hands the picture back to you to look at — reach for it when you need to *see* layout or rendering that the text inventory can't convey. Narrow it when asked: `{ fullPage: false }` for just the current viewport, or `{ target: { text: "Pricing" } }` to capture a single element or block.
-It writes a file **only when you ask it to.** When the user wants to **save, keep, download, or store** a screenshot, pass `save: true` — the image is written under `~/browsentic/screenshot/` and the result reports the exact path, which you should relay back. Pass `filename` when the user names one; otherwise it is auto-named. Without `save: true` nothing touches the disk, so never tell the user you saved a screenshot unless you actually set `save: true` and got a path back.
+**Every capture is saved.** The image is written under `~/browsentic/screenshot/` and the result reports the exact path as `savedTo` — **always relay that path**, because the side panel renders your reply as text and turns images into links, so the path is the only way the user can actually open the picture. Pass `filename` when the user names one; otherwise it is auto-named. Pass `save: false` only when the user explicitly does not want a file, and then say nothing about a saved path. If the result carries `saveError` instead, the capture worked but the write did not — say so rather than naming a file that is not there.
## 7. Multi-step tasks
diff --git a/mcp/src/daemon.ts b/mcp/src/daemon.ts
index 8e7297a..706fbc7 100644
--- a/mcp/src/daemon.ts
+++ b/mcp/src/daemon.ts
@@ -58,7 +58,7 @@ function persistScreenshot(
if (action !== 'page.screenshot' || !result.ok) return result;
const args = (input ?? {}) as { save?: unknown; filename?: unknown };
const data = result.data as { dataUrl?: unknown } | null;
- if ((args.save !== true && !saveTo) || typeof data?.dataUrl !== 'string') return result;
+ if ((args.save === false && !saveTo) || typeof data?.dataUrl !== 'string') return result;
try {
const savedTo = saveScreenshot(data.dataUrl, {
dir: saveTo?.dir,
diff --git a/mcp/src/server.ts b/mcp/src/server.ts
index 3b26b19..c6e15db 100644
--- a/mcp/src/server.ts
+++ b/mcp/src/server.ts
@@ -113,7 +113,9 @@ export function createMcpServer(bridge: Bridge, version: string, opts: { agentRu
instructions:
'Controls the user’s browser through the Browsentic extension. Tools act on the active tab. ' +
'Start with page_getPageInfo (or the browsentic://page/diagram resource) to learn what is on the page and ' +
- 'get stable selectors, then target elements by selector or visible text.',
+ 'get stable selectors, then target elements by selector or visible text. ' +
+ 'page_screenshot saves every capture to disk unless you pass save: false, and reports the file as savedTo. ' +
+ 'Always show the user the screenshot itself — read savedTo back so the image renders — and include that path in your reply.',
},
);
@@ -212,7 +214,9 @@ function renderScreenshot(result: ActionResult) {
const notes = [
`Captured ${data.width}×${data.height} ${data.format ?? 'image'}.`,
data.truncated ? 'The page was taller than the capture limit, so the bottom is cut off.' : '',
- data.savedTo ? `Saved to ${data.savedTo}.` : '',
+ data.savedTo
+ ? `Saved to ${data.savedTo}. Show this screenshot to the user: read that path so the image renders, and include the path in your reply.`
+ : '',
data.saveError ? `Requested save failed: ${data.saveError}.` : '',
]
.filter(Boolean)