Skip to content

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

Append the automatic Ask note after the WebMCP guidance it replaces

Claude8f7e7e3b0fc9
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index b2ff1c680..594c00c12 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -35017,13 +35017,14 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (mode === 'dev') {
prompt += `\n\n${SYSTEM_PROMPT_DEV_APPENDIX.trim()}`;
}
- if (mode === 'ask' && tabId != null && this._autoModeEscalationTabs.has(tabId)) {
- prompt += `\n\n${AUTO_MODE_ASK_NOTE}`;
- }
if (this.webMcpEnabled && !lean && (!this._isActionMode(mode) || tier !== 'compact')) {
const webMcpPrompt = this._isActionMode(mode) ? SYSTEM_PROMPT_WEBMCP_ACT : SYSTEM_PROMPT_WEBMCP_ASK;
prompt += `\n\n${webMcpPrompt}`;
}
+ // Last among the mode guidance, so it also overrides the WebMCP text above.
+ if (mode === 'ask' && tabId != null && this._autoModeEscalationTabs.has(tabId)) {
+ prompt += `\n\n${AUTO_MODE_ASK_NOTE}`;
+ }
// Universal cookie/paywall guidance. Always relevant for http(s)
// browsing; cheap enough to carry on chrome:///file:// pages too
diff --git a/test/auto-mode.mjs b/test/auto-mode.mjs
index ac2e11733..243886109 100644
--- a/test/auto-mode.mjs
+++ b/test/auto-mode.mjs
@@ -777,6 +777,21 @@ for (const build of BUILDS) {
assert.ok(system.indexOf(AUTO_MODE_ASK_NOTE) > SYSTEM_PROMPT_ASK.length, 'the note follows the instructions it replaces');
});
+ test(`${build}: the automatic note follows the WebMCP guidance it replaces`, async () => {
+ // The WebMCP Ask text tells the model to switch to Act/Dev; the note only
+ // supersedes what is above it, so it has to come last.
+ const { SYSTEM_PROMPT_WEBMCP_ASK } = await import(`../src/${build}/src/agent/tools.js`);
+ const { AUTO_MODE_ASK_NOTE } = await import(`../src/${build}/src/agent/auto-mode.js`);
+ const f = fixture(Agent, { replies: [done('Answer.')] });
+ f.agent.webMcpEnabled = true;
+ await f.run('What is on this page?');
+ const system = f.calls[0].messages[0].content;
+ if (SYSTEM_PROMPT_WEBMCP_ASK && system.includes(SYSTEM_PROMPT_WEBMCP_ASK)) {
+ assert.ok(system.indexOf(AUTO_MODE_ASK_NOTE) > system.indexOf(SYSTEM_PROMPT_WEBMCP_ASK), 'the note comes after the WebMCP text');
+ }
+ assert.ok(system.includes(AUTO_MODE_ASK_NOTE));
+ });
+
test(`${build}: an automatic read-only answer is not offered a one-click switch to Act`, async () => {
// "Would you like me to open it?" after a routed answer: the user's "yes"
// is routed and hands the turn off, so the Ask-to-Act button is noise.