OpenCode Browse Rust Rewrite Cuts Memory 97%

OpenCode's Dax Raad rebuilt browser automation tool in Rust for $60: binary 53-64MB to 4.3MB, connector memory 190MB to 5.6MB

Table of contents
  1. 1.Introduction & Key Highlights
  2. 2.Core Metrics & Parameter Comparison
  3. 3.Deep Dive & Implementation Details
  4. 3.1.Architecture Refactor & Protocol Selection
  5. 3.2.Memory & Size Optimization Mechanics
  6. 3.3.Feature Trade-offs & Known Limitations
  7. 4.Scenario-Based Selection & Pitfall Checklist
  8. 5.FAQ
  9. 6.Sources & References
OpenCode Browse Rust Rewrite Cuts Memory 97%

Introduction & Key Highlights

OpenCode developer Dax Raad recently disclosed that the browser automation component OpenCode Browse has been rewritten in Rust at an outsourcing cost of $60. Core metrics show dramatic improvement: binary size compressed from 53–64 MB in the Node version to 4.3 MB; per-connector memory usage dropped from approximately 190 MB to 5.6 MB (a 97% reduction); relay service idle memory sits at 6 MB and 6.6 MB after serving, far below the old version’s 353 MB after six days of runtime. The rewrite retains Chromium extension and Chrome DevTools Protocol (CDP) support, introduces QuickJS for executing Agent scripts, but drops timezone/locale spoofing and download tooling. Stealth Bench v2 scores 85% versus Browser Use Cloud’s 90.5%. This briefing targets readers tracking AI coding agent infrastructure, lightweight browser automation, and Rust-as-Node-replacement scenarios.

Core Metrics & Parameter Comparison

Metric Old Version New Version Change Notes
Binary size 53–64 MB 4.3 MB -92% to -93% Single-file distribution
Connector memory ~190 MB 5.6 MB -97% Steady state after repeated calls
Relay idle memory 353 MB (after 6 days) 6 MB -98% Long-run comparison
Relay post-service memory Same as above 6.6 MB -98% Includes session state
Stealth Bench v2 Not disclosed 85% — Browser Use Cloud 90.5%
Rewrite cost — $60 — Outsourcing fee
Protocol stack Playwright + Patchright CDP + WebSocket + QuickJS Architecture simplified Node runtime dependency removed
Missing features Timezone/locale spoofing, download tooling Removed Chrome extension limits Busy-loop eval interruption issue retained

Deep Dive & Implementation Details

Architecture Refactor & Protocol Selection

The rewrite keeps the existing Chromium extension, communicating with the Rust relay via WebSocket and directly invoking the Chrome DevTools Protocol (CDP) for browser operations, Agent sessions, recording, and network capture. The original Node version relied on Playwright to drive automation and Patchright for detection evasion; the new version removes both heavy dependencies entirely, using native CDP capabilities to slash runtime overhead. The relay embeds a QuickJS interpreter to execute Agent-injected JavaScript, completely eliminating the Node.js runtime dependency and enabling single-binary deployment.

Memory & Size Optimization Mechanics

Rust’s ownership model and zero-cost abstractions eliminate garbage-collection pauses and runtime metadata; combined with static linking they produce a 4.3 MB single file. Connector memory falls from 190 MB to 5.6 MB mainly by: removing V8/Node heap, event loop, and module caches; establishing CDP sessions on demand with no long-lived objects; QuickJS allocating memory only during script execution. Relay memory after six days drops from 353 MB to 6.6 MB, confirming no-leak behavior suitable for long-lived AI agent sidecar scenarios.

Feature Trade-offs & Known Limitations

To achieve extreme lightness, the team deliberately dropped timezone/locale spoofing and file download tooling — the former restricted by extension permissions, the latter blocked by Chrome extension policy. A legacy issue remains: Agent-initiated busy-loop eval cannot be interrupted from the extension, same as the old version. Stealth Bench v2 measures 85%, slightly below the cloud offering’s 90.5%, but the PR provides no old-version baseline so the actual regression in anti-detection capability is not disclosed in source. Authentication pairing, origin validation, and other security mechanisms are fully preserved.

Scenario-Based Selection & Pitfall Checklist

  1. AI coding agent local sidecar: Single binary, <10 MB memory, zero runtime dependencies — fits developer workstations or concurrent CI containers.
  2. Long-running browser automation services: Relay memory steady at ~6 MB, avoids Node-version long-cycle leaks, lowering container resource quotas and cost.
  3. Privacy-sensitive / offline environments: No telemetry, no external CDN dependencies, paired with QuickJS sandbox for untrusted script execution.
  4. Pitfall: High anti-detection scraping needs: Stealth score 85% plus missing timezone/locale spoofing means fingerprint resistance weaker than mature cloud services; custom evasion layer required.
  5. Pitfall: File downloads & long-script interruption: Download functionality blocked by Chrome extension policy; busy-loop eval cannot be externally terminated — implement timeout guards on the Agent side.

FAQ

Does the rewrite fully replace Playwright functionality?

No. It implements only the CDP subset actually used by OpenCode Browse, dropping Playwright advanced features such as timezone/locale spoofing and download tooling; full feature coverage is not disclosed in source.

What work scope does the $60 cost cover?

The source only states “rebuilt … for $60” with no breakdown of labor hours, test cycles, or code-review costs, nor any disclosure of the contractor’s qualifications or contract details.

How does the new relay handle concurrent Agent sessions?

The source mentions “agent sessions” managed via CDP but does not disclose concurrent connection limits, session isolation mechanisms, or load-test data.

Sources & References

Spotted outdated pricing, stock, or expired coupons?See methodology & report an update →

Related articles