Add reference-site skill: let the agent see sites users link#3644
Draft
lezama wants to merge 4 commits into
Draft
Add reference-site skill: let the agent see sites users link#3644lezama wants to merge 4 commits into
lezama wants to merge 4 commits into
Conversation
Adds a fetch_webpage tool (public-URL-only, SSRF-guarded) and a reference-site skill: when a user references an external website by URL, the agent screenshots it (existing take_screenshot) and reads its content to brief design and copy, as inspiration rather than a clone target. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…kill # Conflicts: # apps/cli/ai/system-prompt.ts
| export function extractPageText( html: string ): string { | ||
| // Drop content that never contributes readable copy before matching. | ||
| const cleaned = html | ||
| .replace( /<script\b[^>]*>[\s\S]*?<\/script>/gi, ' ' ) |
A single above-the-fold desktop capture carries the design language; viewport:"all" and offset pagination just add payload on tall reference sites (stripe.com was 14k/20k px tall) without adding signal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
The code, the
reference-siteskill prose, the tests, and this PR description were all drafted with Claude Code, then reviewed by me. The approach (a skill plus one fetch tool that reuses the existing screenshot tool) and the SSRF guard parity were verified against a working reference implementation and smoke-tested live.Proposed Changes
When someone references an existing website while building — "a candy shop like gumroad.com", "build a site for lhab.org", "base the about page on acme.com/about" — the agent currently can't see that site. It guesses from the string and the result drifts (e.g. "lhab.org" free-associates into the wrong theme entirely).
This teaches the agent to look before it builds:
take_screenshottool) to read palette, typography, layout rhythm, and signature components.fetch_webpagetool) to learn the site's identity, audience, voice, and key vocabulary.A new user-invokable
reference-siteskill orchestrates this, and thevisual-design/site-specskills now hand off to it when a URL is present.fetch_webpageonly reaches public http(s) URLs: localhost, private/reserved IPs, non-HTML responses, and oversized bodies are refused, and every redirect hop is re-validated.Why a Proof of Concept: the visual side is handled "for free" by the existing multimodal screenshot path, so the brief here is largely prompt/skill design plus one guarded tool. Open questions worth a team look before this lands: whether URL handling belongs in a skill vs. deeper in the agent loop; whether full DNS-pinning SSRF defense is warranted (currently out of scope, matching the reference implementation); and how aggressively the agent should trigger it vs. asking first.
Testing Instructions
npm run cli:buildstudio codesession, try a build prompt that references a site, e.g. "build a landing page for a candy shop like stripe.com". The agent should load thereference-siteskill, screenshot stripe.com, and read its content before designing.http://localhost:8080orhttp://169.254.169.254/is refused byfetch_webpage.npm test -- apps/cli/ai/tests/fetch-webpage-helpers.test.ts— 15 unit tests cover URL normalization, the SSRF guard (scheme / localhost / single-label / private IPv4 / loopback + link-local + IPv4-mapped IPv6), and the HTML→brief extractor.Pre-merge Checklist