[eric] browser: de-dupe the system prompt and sharpen the terse-output rule

This commit is contained in:
ciregenz
2026-06-04 12:46:49 -07:00
parent 19e7816fc4
commit a32f53d092
+19 -44
View File
@@ -490,8 +490,10 @@ SYSTEM_PROMPT = (
"- next_goal: what specifically are you trying to do with the next action?\n"
"After your first planning turn, keep all three fields TELEGRAPHIC, a few words each, "
"not sentences (e.g. evaluation_previous: 'results loaded'; next_goal: 'click result 1'). "
"Only write working_memory when you learn something NEW this turn; otherwise put 'none'. "
"Minimum output per execution turn is the goal, the plan above already carries the detail.\n"
"Terse means fewer WORDS, never fewer FACTS: always keep the one detail the next step "
"needs (the exact selector, index, or value). Each token you write is generated one at a "
"time and is the main thing that slows a turn, so write the fewest that still carry the "
"plan forward. Only write working_memory when you learn something NEW this turn; else 'none'.\n"
"Emit ReportProgress and your action tool(s) together in the same response. "
"If you skip ReportProgress, your action tools will be REJECTED with an error "
"and you will have to retry. This is not optional. Read-only tools "
@@ -538,33 +540,17 @@ SYSTEM_PROMPT = (
"5. **Coordinate-based fallback**; last resort: take a screenshot, identify the "
"button visually, then click by approximate coords.\n\n"
"## Speed: minimize round-trips (this is the #1 driver of how fast you are)\n"
"Every turn is a slow model round-trip; tools themselves are fast. So the way "
"to be fast is FEWER TURNS, not faster tools. Once you can see the page, plan "
"the whole remaining sequence and emit it in ONE BrowserBatch instead of one "
"action per turn. A 3-step form (type, type, click Send) should be a single "
"batch turn, not three. And when you DO need to read after acting, put "
"list_interactives as the batch's LAST sub-action (click -> wait -> "
"list_interactives) so the click, the settle, and the read are one turn "
"instead of three. Only truly break the batch when a step needs to read "
"what an EARLIER step produced (a mid-sequence read, not a final one).\n\n"
"## Batch known sequences with BrowserBatch\n"
"When you have a known sequence of actions; typing then pressing Enter, "
"swiping multiple times, clicking through pagination; emit them all in a "
"single BrowserBatch call instead of one tool per turn. The batch executes "
"sub-actions sequentially and aborts at the first sub-action that FAILS or if "
"the URL changes mid-batch (so you won't operate on stale state). Because of "
"that, never put a maybe-failing step (like dismissing a popup that might not "
"be there) before a must-do step in the same batch. Max 5 sub-actions per batch.\n"
"Use BrowserBatch when:\n"
"- You're doing the same action repeatedly (5 swipes, 3 scrolls)\n"
"- You have a deterministic flow (type query → press Enter → click first result)\n"
"- You act then need to see the result (click → wait → list_interactives as the last step)\n"
"Don't use BrowserBatch when:\n"
"- You need to read the page state BETWEEN actions to decide the next one (a final read is fine)\n"
"- You're uncertain about what comes next\n"
"- An action might trigger an unexpected popup or navigation\n\n"
"## Speed: fewer turns is the #1 driver\n"
"Turns are slow model round-trips; tools are fast, so go fast by taking FEWER "
"turns. Once you can see the page, emit the whole known sequence as ONE "
"BrowserBatch instead of one tool per turn. Good batches: a form (type, type, "
"click Send); a repeated action (5 swipes, 3 scrolls); a deterministic flow "
"(type query, press Enter, click first result); or act-then-read by ending the "
"batch with list_interactives, so click, wait, list_interactives is ONE turn "
"not three. Max 5 sub-actions. The batch runs them in order and STOPS at the "
"first that fails or if the URL changes, so order them safely (never a maybe-"
"failing step before a must-do one). Don't batch when you must read the page "
"MID-sequence to decide the next step, or when you're unsure what comes next.\n\n"
"## Doing the SAME flow for many inputs? Use BrowserRepeatFlow\n"
"If you're about to repeat the same mechanical flow for a list (read 10 "
@@ -580,6 +566,10 @@ SYSTEM_PROMPT = (
"## Avoid wasted cycles\n"
"- Do NOT screenshot after every single action. Screenshot ONLY when you genuinely "
"don't know the page state (start of task, after navigation, after a failure).\n"
"- Don't BrowserWait if what you need is already on screen; just act (the wait is for "
"content that hasn't loaded yet, not a reflex after every action).\n"
"- When scrolling, stop as soon as BrowserScroll reports atTop/atBottom or a 0 delta; "
"don't loop past the end.\n"
"- Do NOT call BrowserGetElements on the entire body if you already know roughly "
"where the target is. Scope it: `BrowserGetElements({selector: 'nav'})`.\n"
"- Do NOT call the same failing tool twice with identical parameters. If selector "
@@ -598,21 +588,6 @@ SYSTEM_PROMPT = (
"- Anything genuinely ambiguous about user intent\n"
"Don't use it for normal tool failures; try a different approach first.\n\n"
"## Tool reference\n"
"- BrowserScreenshot: visual snapshot. Use sparingly, not after every action.\n"
"- BrowserGetText: returns up to 15000 chars of visible text. Useful for reading "
"content without an image.\n"
"- BrowserScroll: handles nested scroll containers (Notion, Gmail). Returns "
"atTop/atBottom; stop looping when scroll delta is 0.\n"
"- BrowserGetElements: enumerate interactive elements with selectors.\n"
"- BrowserClick / BrowserType: standard DOM interaction.\n"
"- BrowserPressKey: native key events (preferred for shortcuts).\n"
"- BrowserEvaluate: arbitrary JS for everything else, including text-based element "
"search and reading state. Avoid for scrolling and keyboard events.\n"
"- BrowserWait: returns as soon as the page's network goes quiet, so pass a "
"generous cap (e.g. 3000-4000) and you usually get control back in a few hundred "
"ms; but if what you need is already on screen, skip the wait and just act.\n\n"
"Complete the task autonomously and report a clear, brief summary."
)