Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Missing-value rule: a page default is not a value the user gave

Claude5c4a4e43986a
diff --git a/src/chrome/src/agent/tools.js b/src/chrome/src/agent/tools.js
index 2cefeb364..27c70f314 100644
--- a/src/chrome/src/agent/tools.js
+++ b/src/chrome/src/agent/tools.js
@@ -2446,7 +2446,7 @@ INDEX INSTABILITY β€” read this:
- If clicking by text returns success but nothing happens after 1-2 attempts, the click likely landed on a non-interactive child element (label/span inside a button). Switch strategy: (1) inspect the latest page/tree or auto-screenshot/visual context, (2) click by x/y coordinates targeting the button center, or (3) call get_interactive_elements and use click({index: N}).
FORMS β€” read this:
-- Type only values the user gave or the page already shows. When the task needs a value that has neither (a booking date, an amount, which of two contacts with the same name), ask with clarify (set require_explicit_answer:true, so a timeout or Instant cannot pick one) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
+- Type only values the user gave or facts the page states (a product, its price); a default the page pre-fills for a date, an amount or a recipient is not the user's choice. When the task needs a value that has neither (a booking date, an amount, which of two contacts with the same name), ask with clarify (set require_explicit_answer:true, so a timeout or Instant cannot pick one) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
- Before submitting an important multi-field HTML form (clicking Submit/Save/Create/Send/Publish), call verify_form() to double-check that every field has the intended value. urlFilter inspects child frames only; omit it for a main-document form.
- verify_form() returns a structured list of all field names, types, and current values, plus a viewport screenshot. Compare each field against what you intended to type.
- If a text field is wrong, correct it and call verify_form() again before submitting. After a validation-rejected submit, call verify_form exactly once; if the same checkbox remains unchecked, go directly to set_checked({ref_id, checked:true}) and require checkedAfter:true before resubmitting. Do not verify or toggle-loop on unchanged state.
@@ -2539,7 +2539,7 @@ RULES:
15. CAPTCHA: stop and ask the user to complete verification manually. Never dismiss, close, or resubmit the challenge. Report blocked work with done({outcome:"partial"}).
16. Before filling an external email/message/post composer, formulate the exact recipient, subject, and body. For more than a one-line body, save the complete text as \`[pending draft]\` with scratchpad_write first so it can be recovered if the UI fails; never mark it sent until verified.
17. Recover incomplete source text with read_page or return to its observed URL. Pending uploads need available waits/reads. Complete independent authorized destinations before done; preserve unresolved submissions/challenges and stop for real blockers, cancellation, or limits.
-18. Type only values the user gave or the page already shows. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify({question, options, require_explicit_answer:true}) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
+18. Type only values the user gave or facts the page states (a product, its price); a default the page pre-fills for a date, an amount or a recipient is not the user's choice. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify({question, options, require_explicit_answer:true}) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
${SENSITIVE_PAGE_DATA_GUIDANCE}
@@ -2660,7 +2660,7 @@ DEFAULT LOOP:
4. Repeat. When done, call done({summary, outcome:"success"}) after confirming success.
TYPING:
-- Type only values the user gave or the page already shows. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify (require_explicit_answer:true, so a timeout or Instant cannot pick one) instead of choosing one.
+- Type only values the user gave or facts the page states (a product, its price); a default the page pre-fills for a date, an amount or a recipient is not the user's choice. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify (require_explicit_answer:true, so a timeout or Instant cannot pick one) instead of choosing one.
- For text fields prefer set_field({ref_id, text, submit}) β€” one call that focuses, clears, verifies, and only then optionally submits. Prefer submit:true for search fields. Otherwise type_ax({ref_id, text}) after reading the tree.
- DRAFT CHECKPOINT: before filling an external email/message/post composer, formulate the exact recipient(s), subject (when applicable), and body. If the body is more than a short one-liner, save the complete text as \`[pending draft]\` with scratchpad_write before typing; never label it sent until the UI verifies sending.
- HARD RULE: after click_ax on a text field, your NEXT call MUST be type_ax/set_field on the SAME ref. Do not click_ax again or re-read the tree first.
@@ -2753,7 +2753,7 @@ TOOLS:
- press_keys({key}): Enter, Escape, Tab or an arrow key.
- scroll({direction}), navigate({url}), wait_for_stable(): move around, and let the page settle after an action.
- upload_file: attach the user's file to a file input, using only an attachmentId or downloadId the conversation gave you; never invent a file path.
-- clarify({question, options}): ask only when the request is genuinely ambiguous or a value it needs is missing (a date, an amount, which of two people with the same name); never fill one in yourself, and for a missing value set require_explicit_answer:true so a timeout or Instant cannot pick one. Put the safe choice first, and set consequence for questions about deleting, money, credentials, the recipient or publishing.
+- clarify({question, options}): ask only when the request is genuinely ambiguous or a value it needs is missing (a date, an amount, which of two people with the same name; a default the page pre-fills does not count as given); never fill one in yourself, and for a missing value set require_explicit_answer:true so a timeout or Instant cannot pick one. Put the safe choice first, and set consequence for questions about deleting, money, credentials, the recipient or publishing.
- done({summary, outcome}): finish. The summary is shown to the user as your answer, so include the actual result. Use "success" only after you checked it, "partial" for useful unfinished work, and "failed" for a blocker.
WORKING LOOP:
diff --git a/src/firefox/src/agent/tools.js b/src/firefox/src/agent/tools.js
index be488c9fd..03393e4f9 100644
--- a/src/firefox/src/agent/tools.js
+++ b/src/firefox/src/agent/tools.js
@@ -2009,7 +2009,7 @@ RULES:
15. CAPTCHA: stop and ask the user to complete verification manually. Never dismiss, close, or resubmit the challenge. Report blocked work with done({outcome:"partial"}).
16. Before filling an external email/message/post composer, formulate the exact recipient, subject, and body. For more than a one-line body, save the complete text as \`[pending draft]\` with scratchpad_write first so it can be recovered if the UI fails; never mark it sent until verified.
17. Recover incomplete source text with read_page or return to its observed URL. Pending uploads need available waits/reads. Complete independent authorized destinations before done; preserve unresolved submissions/challenges and stop for real blockers, cancellation, or limits.
-18. Type only values the user gave or the page already shows. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify({question, options, require_explicit_answer:true}) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
+18. Type only values the user gave or facts the page states (a product, its price); a default the page pre-fills for a date, an amount or a recipient is not the user's choice. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify({question, options, require_explicit_answer:true}) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
${SENSITIVE_PAGE_DATA_GUIDANCE}
@@ -2284,7 +2284,7 @@ INDEX INSTABILITY β€” read this:
- If clicking by text returns success but nothing happens after 1-2 attempts, the click likely landed on a non-interactive child element (label/span inside a button). Switch strategy: (1) inspect the latest page/tree or auto-screenshot/visual context, (2) click by x,y coordinates targeting the button center, or (3) call get_interactive_elements and use click({index: N}).
FORMS β€” read this:
-- Type only values the user gave or the page already shows. When the task needs a value that has neither (a booking date, an amount, which of two contacts with the same name), ask with clarify (set require_explicit_answer:true, so a timeout or Instant cannot pick one) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
+- Type only values the user gave or facts the page states (a product, its price); a default the page pre-fills for a date, an amount or a recipient is not the user's choice. When the task needs a value that has neither (a booking date, an amount, which of two contacts with the same name), ask with clarify (set require_explicit_answer:true, so a timeout or Instant cannot pick one) before filling or opening anything; never choose one yourself. For a recipient, use purpose message_recipient.
- Before submitting an important multi-field HTML form (clicking Submit/Save/Create/Send/Publish), call verify_form() to double-check that every field has the intended value. urlFilter inspects child frames only; omit it for a main-document form.
- verify_form() returns a structured list of all field names, types, and current values, plus a viewport screenshot. Compare each field against what you intended to type.
- If a text field is wrong, correct it and call verify_form() again before submitting. After a validation-rejected submit, call verify_form exactly once; if the same checkbox remains unchecked, go directly to set_checked({ref_id, checked:true}) and require checkedAfter:true before resubmitting. Do not verify or toggle-loop on unchanged state.
@@ -2419,7 +2419,7 @@ DEFAULT LOOP:
4. Repeat. When done, call done({summary, outcome:"success"}) after confirming success.
TYPING:
-- Type only values the user gave or the page already shows. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify (require_explicit_answer:true, so a timeout or Instant cannot pick one) instead of choosing one.
+- Type only values the user gave or facts the page states (a product, its price); a default the page pre-fills for a date, an amount or a recipient is not the user's choice. When a needed value has neither (a date, an amount, which of two people with the same name), ask with clarify (require_explicit_answer:true, so a timeout or Instant cannot pick one) instead of choosing one.
- For text fields prefer set_field({ref_id, text, submit}) β€” one call that focuses, clears, verifies, and only then optionally submits. Prefer submit:true for search fields. Otherwise type_ax({ref_id, text}) after reading the tree.
- DRAFT CHECKPOINT: before filling an external email/message/post composer, formulate the exact recipient(s), subject (when applicable), and body. If the body is more than a short one-liner, save the complete text as \`[pending draft]\` with scratchpad_write before typing; never label it sent until the UI verifies sending.
- HARD RULE: after click_ax on a text field, your NEXT call MUST be type_ax/set_field on the SAME ref. Do not click_ax again or re-read the tree first.
@@ -2512,7 +2512,7 @@ TOOLS:
- press_keys({key}): Enter, Escape, Tab or an arrow key.
- scroll({direction}), navigate({url}), wait_for_stable(): move around, and let the page settle after an action.
- upload_file: attach the user's file to a file input, using only an attachmentId or downloadId the conversation gave you; never invent a file path.
-- clarify({question, options}): ask only when the request is genuinely ambiguous or a value it needs is missing (a date, an amount, which of two people with the same name); never fill one in yourself, and for a missing value set require_explicit_answer:true so a timeout or Instant cannot pick one. Put the safe choice first, and set consequence for questions about deleting, money, credentials, the recipient or publishing.
+- clarify({question, options}): ask only when the request is genuinely ambiguous or a value it needs is missing (a date, an amount, which of two people with the same name; a default the page pre-fills does not count as given); never fill one in yourself, and for a missing value set require_explicit_answer:true so a timeout or Instant cannot pick one. Put the safe choice first, and set consequence for questions about deleting, money, credentials, the recipient or publishing.
- done({summary, outcome}): finish. The summary is shown to the user as your answer, so include the actual result. Use "success" only after you checked it, "partial" for useful unfinished work, and "failed" for a blocker.
WORKING LOOP:
diff --git a/test/prompt-missing-values.mjs b/test/prompt-missing-values.mjs
index 2dc5392bf..5ddaa40fe 100644
--- a/test/prompt-missing-values.mjs
+++ b/test/prompt-missing-values.mjs
@@ -11,6 +11,11 @@ for (const build of ['chrome', 'firefox']) {
assert.match(prompt, /which of two (?:contacts|people) with the same name/, name);
assert.match(prompt, /never (?:choose one yourself|fill one in yourself)|instead of choosing one/, name);
}
+ // A value the page pre-fills (a default date) is not one the user gave.
+ for (const [name, prompt] of [['full', tools.SYSTEM_PROMPT_ACT], ['mid', tools.SYSTEM_PROMPT_ACT_MID], ['lean', tools.SYSTEM_PROMPT_ACT_LEAN], ['compact', tools.SYSTEM_PROMPT_ACT_COMPACT]]) {
+ assert.match(prompt, /pre-fills/, name);
+ assert.doesNotMatch(prompt, /Type only values the user gave or the page already shows/, name);
+ }
// A timeout or Instant must not answer for the user, so every tier asks for an explicit answer.
for (const [name, prompt] of [['full', tools.SYSTEM_PROMPT_ACT], ['mid', tools.SYSTEM_PROMPT_ACT_MID], ['lean', tools.SYSTEM_PROMPT_ACT_LEAN], ['compact', tools.SYSTEM_PROMPT_ACT_COMPACT]]) {
assert.match(prompt, /require_explicit_answer:true/, name);