feat(browser): specialize browser prompt

Draft
GR
3mo ago
+53-280

Summary

  • Replace the 1,519-word generic GPT prompt with a 177-word browser-task prompt.
  • Reduce the browser-execute skill from 1,758 to 362 words while preserving current V4 auto-connect, reattachment, navigation-error, screenshot, and timeout guidance.
  • Emphasize bounded browser calls, structured checkpoints, record identity, required-field auditing, and explicit evidence-backed limitations.
  • Keep the provider text-verbosity defaults unchanged.

Evaluation evidence

The earlier 106-task experiment bundle improved from 81/106 to 88/106 while agent cost fell from $176.92 to $141.91 and timeouts fell from 6 to 3. Non-cached input per model call fell from about 8,110 to 2,231 tokens.

That run also included a BrowserCode version upgrade and eval-adapter hardening, so it is directional evidence rather than an isolated prompt A/B. This PR ports only the context-reduction changes onto current main. The GPT-5.5 medium-verbosity override is intentionally excluded because it was not isolated.

Verification

  • Pre-push filtered typecheck: 17/17 packages passed.
  • browser-execute skill tests: 2/2 passed.
  • Full bcode-browser suite: 35 passed, 8 skipped, with one unrelated existing workspace cache-busting test failure (temporary imported module not found).

Summary by cubic

Specializes the agent’s system prompt for browser tasks and condenses the browser_execute skill. This reduces token usage while keeping V4 auto-connect, reattach behavior, navigation-error handling, screenshot auto-attach, and timeout guidance. Directionally improved evals (81→88/106), lower cost ($176.92→$141.91), and fewer timeouts (6→3).

  • packages/opencode/src/session/prompt/gpt.txt: Replaces a ~1.5k-word generic prompt with a ~177-word browser-native prompt. Emphasizes bounded CDP calls, persistent session reuse, evidence-backed outputs, and required-field auditing. Removes broad editing/formatting guidance; confirm no workflows depend on that guidance.
  • packages/bcode-browser/skills/browser-execute/SKILL.md: Shrinks ~1.7k→~360 words. Preserves attach and reattach on -32001, Page.navigate.errorText handling, screenshot auto-attachment, cache-busted await import(...), and ERR_TUNNEL_CONNECTION_FAILED guidance. Removes step-by-step Chrome launch and Browser Use Cloud provisioning examples; verify the remaining connect/attach examples still cover common flows.

Rollout

  • No runtime code changes; provider verbosity defaults unchanged. No migrations required.
  • Verified: typecheck 17/17, skill tests 2/2, browser suite 35 pass (8 skipped), with one unrelated workspace cache-busting test failure. Monitor non-browser tasks for regressions due to removed general guidance.