feat(clone-website): add optional ego-browser backend - #68
Conversation
Adds a "Browser Backend" section letting users pick between the existing browser MCP (default, unchanged) and ego-browser (opt-in). ego-browser composes multi-step browser work as one JavaScript pass and returns only the fields you build, so extraction uses far fewer tool calls and much less context token than re-dumping a DOM/accessibility tree each round. Extraction scripts stay backend-agnostic: a translation table maps the existing "via browser MCP" wording to ego-browser equivalents, so the rest of the document is byte-for-byte unchanged and existing users are unaffected. Regenerated all 9 platform copies via scripts/sync-skills.mjs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 153ee703e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| | This doc says (browser MCP) | ego-browser equivalent | | ||
| | --- | --- | | ||
| | evaluate a snippet | `await js(...)` with a `String.raw` template — returns a real JS value; **do not `JSON.stringify` inside** the snippet, serialize in the Node body via `cliLog` | |
There was a problem hiding this comment.
Avoid double-encoding ego extraction results
When an agent uses the new ego-browser backend and pastes the unchanged extraction snippets later in this skill, this guidance conflicts with those snippets: the Asset Discovery and Per-component scripts still return JSON.stringify(...), while the heredoc also does cliLog(JSON.stringify(data, null, 2)). In that ego-browser path the captured output becomes a quoted/escaped JSON string instead of the object the rest of the workflow expects, which can contaminate specs or asset manifests with double-encoded data; either update the snippets for ego or make the wrapper log string results directly.
Useful? React with 👍 / 👎.
What
Adds an optional ego-browser backend to the clone-website skill, alongside the existing browser MCP (which stays the default and completely unchanged).
Why
ego-browser drives a real Chromium through a Node runtime and composes multi-step browser work as a single JavaScript pass, returning only the fields you build — instead of re-dumping a full DOM / accessibility tree into context each round. For this skill's heavy
getComputedStyleextraction that means far fewer tool calls and much less context token per clone.How
scripts/sync-skills.mjs(net:SKILL.md+36/-1).Testing
captureScreenshot()returns a temp PNG path (not base64),cdp Emulation.setDeviceMetricsOverrideworks,js()returns a real JS value.npm run buildpassed (Next 16, TypeScript clean) → dev-server render verified via ego to match the source (h1 24px/700, linkrgb(51, 68, 136)underline, verbatim text). Demo artifacts were not committed — this PR is skill files only.