MCPcopy Index your code
hub / github.com/ericshang98/Perfect-Web-Clone

github.com/ericshang98/Perfect-Web-Clone @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
2,209 symbols 6,228 edges 219 files 1,436 documented · 65%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Perfect Web Clone

Open Source Agent Co-work System

Claude Code for web cloning. A vertical AI agent with 40+ specialized tools.

English | 中文 | 日本語 | 한국어 | Español | Português | Deutsch | Français | Tiếng Việt

License: MIT Next.js React Python FastAPI Playwright Claude

Don't want to self-host? Use the Perfect Web Clone Skill directly in Claude Code.

A true AI agent — not just a wrapper around an LLM. Multi-agent collaboration with real tools, self-correction loops, and a complete sandbox environment to build production-ready code from scratch.

Others guess from screenshots. We extract the real code — DOM, styles, components, interactions. Pixel-perfect cloning that screenshot-based tools simply cannot achieve.

https://github.com/user-attachments/assets/248af639-20d9-45a8-ad0a-660a04a17b68

Open Source Multi-Agent Architecture

This entire multi-agent system is open source. Learn from it, use it, build upon it.

Why Cowork?

Working with a single AI is like asking one coworker to handle everything alone — they get overwhelmed. Traditional single-model approaches hit a wall: - Context window overflow on large pages - Hallucinations when juggling too many responsibilities - Slow, sequential processing

Our solution: A team of specialized agents working together, like coworkers each focused on what they do best. Less back-and-forth, more getting things done.

Why Not Just Use Cursor / Claude Code / Copilot?

Cursor Claude Code GitHub Copilot vs Nexting

We tried. Even with the complete extracted JSON — full DOM tree, all CSS rules, every asset URL — single-model tools struggle:

Challenge Multi-Agent
50,000+ line DOM tree ❌ Context overflow, truncates critical parts ✅ Task distributed to worker agents
3,000+ CSS rules ❌ Loses specificity, misses variables ✅ Parallel processing by workers
Component detection ❌ Guesses boundaries, creates monoliths ✅ Structured workflow ensures consistency
Responsive breakpoints ❌ Often hardcodes single viewport ✅ Extracts all media queries
Hover/animation states ❌ Cannot see, cannot reproduce ✅ Browser automation captures all
Output quality ❌ "Close enough" approximation ✅ Pixel-perfect, production-ready

The core problem: A 200KB extracted JSON exceeds practical context limits. Even if it fits, a single agent can't maintain coherence when context gets polluted with too much information. The solution isn't smarter agents — it's task distribution with reliable workflows.

Honest limitation: Complex animations are still hard to extract perfectly — but that's a crawler problem, not an agent problem. The multi-agent architecture itself is capable of far more than web cloning. Imagine: automated refactoring, codebase migration, documentation generation, or any task too large for a single agent to handle.

The Agent + Tools + Sandbox Pattern

┌─────────────────────────────────────────────────────────┐
│                    Multi-Agent System                    │
├─────────────────────────────────────────────────────────┤
│                  ┌───────────────┐                      │
│                  │  Main Agent   │                      │
│                  │  (Coordinator)│                      │
│                  └───────┬───────┘                      │
│                          │ distributes tasks            │
│         ┌────────────────┼────────────────┐             │
│         ▼                ▼                ▼             │
│  ┌───────────┐    ┌───────────┐    ┌───────────┐       │
│  │  Worker   │    │  Worker   │    │  Worker   │  ...  │
│  │  Agent 1  │    │  Agent 2  │    │  Agent N  │       │
│  └─────┬─────┘    └─────┬─────┘    └─────┬─────┘       │
│        └────────────────┼────────────────┘              │
│                         ▼                               │
│  ┌─────────────────────────────────────────────────┐   │
│  │                    Tools                         │   │
│  │  • File Operations  • Code Analysis             │   │
│  │  • Browser Control  • API Calls                 │   │
│  └─────────────────────────────────────────────────┘   │
│                         │                               │
│                         ▼                               │
│  ┌─────────────────────────────────────────────────┐   │
│  │              Sandbox (BoxLite)                   │   │
│  │  Isolated execution environment for safe        │   │
│  │  code generation, testing, and preview          │   │
│  └─────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────┘

This pattern — Agent + Tools + Sandbox — is reusable for any AI agent product:

Component Purpose In Nexting
Main Agent Coordinates workflow and distributes tasks Analyzes page, spawns workers, merges results
Worker Agents Execute subtasks with scoped permissions Process sections in parallel, isolated context
Tools Capabilities agents can invoke File I/O, Browser automation, API calls
Sandbox Safe execution environment BoxLite - Embedded micro-VM runtime

BoxLite: Hardware-level isolated micro-VMs for AI agents. No root access needed, runs OCI containers with true kernel isolation. → github.com/boxlite-ai/boxlite

Connect With Me

Building something with this architecture? Have questions? Reach out:

Twitter GitHub Discord


Table of Contents

Agent Toolkit

Built on Claude Agent SDK — the same foundation as Claude Code. This isn't a chatbot with API calls; it's a real agent that thinks, plans, executes, and self-corrects in an isolated sandbox.

40+ Tools Across 10 Categories

Category Tools Purpose
File Operations read_file, write_file, edit_file, delete_file, rename_file, create_directory CRUD operations on project files
Search & Discovery glob, grep, ls, search_in_file, search_in_project Find files and content (ripgrep-powered)
Task Management todo_read, todo_write, task, get_subagent_status Track progress, spawn sub-agents
System Execution bash, run_command, shell Run any command in sandbox
Network web_fetch, web_search Fetch URLs, search the web
Terminal create_terminal, send_terminal_input, get_terminal_output, install_dependencies, start_dev_server Manage multiple terminal sessions
Preview take_screenshot, get_console_messages, get_preview_dom, get_preview_status Inspect live preview state
Diagnostics verify_changes, diagnose_preview_state, analyze_build_error, get_comprehensive_error_snapshot Debug and validate
Self-Healing start_healing_loop, verify_healing_progress, stop_healing_loop Auto-fix build errors
Source Query list_saved_sources, get_source_overview, query_source_json Query extracted website data

Design Philosophy

┌─────────────────────────────────────────────────────────────────────────────┐
│                         Frontend (localhost:3100)                            │
│  ┌─────────────────┐   ┌─────────────────┐   ┌─────────────────────────┐   │
│  │   Chat Panel    │   │    Code IDE     │   │        Preview          │   │
│  │    (Agent)      │   │    (Monaco)     │   │       <iframe>          │   │
│  └────────┬────────┘   └────────┬────────┘   │  src="https://github.com/ericshang98/Perfect-Web-Clone/raw/main/localhost:8080"   │   │
│           │ Agent              │ User        └────────────┬────────────┘   │
│           │ writes code        │ writes code              │ loads directly │
│           └─────────┬──────────┘                          │                │
│                     ▼                                     │                │
│  ┌──────────────────────────────────────┐                 │                │
│  │           useBoxLite hook            │                 │                │
│  │  writeFile(path, content)            │                 │                │
│  │           ↓                          │                 │                │
│  │  sendMessage({                       │                 │                │
│  │    type: "write_file",               │                 │                │
│  │    payload: { path, content }        │                 │                │
│  │  })                                  │                 │                │
│  └──────────────────┬───────────────────┘                 │                │
└─────────────────────┼─────────────────────────────────────┼────────────────┘
                      │ WebSocket :5100                     │ HTTP :8080
                      ▼                                     │
┌─────────────────────────────────────────────────────────────────────────────┐
│                         Backend (localhost:5100)                             │
│  ┌──────────────────────────────────────┐                 │                │
│  │       BoxLiteSandboxManager          │                 │                │
│  │                                      │                 │                │
│  │  write_file(path, content):          │                 │                │
│  │           ↓                          │    File         │                │
│  │  Writes to disk:                     │    Watcher      │                │
│  │  /tmp/boxlite-sandboxes/             │        ↓        │                │
│  │    {sandbox_id}/                     │                 │                │
│  │      src/App.jsx                     │                 │                │
│  │      src/main.jsx                    │                 │                │
│  │      ...                             │                 │                │
│  └──────────────────┬───────────────────┘                 │                │
│                     │                                     │                │
│                     ▼                                     ▼                │
│  ┌──────────────────────────────────────────────────────────────────────┐  │
│  │                      Vite Dev Server (npm run dev)                    │  │
│  │  - Watches file changes                                              │  │
│  │  - Auto HMR (Hot Module Replacement)                       WebSocket │  │
│  │  - Port: 8080                                                  HMR ──┼──┘
│  └──────────────────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────────────────┘

What makes this different from ChatGPT/Claude chat? - Persistent state: Agent remembers context across the entire session - Tool chaining: Can execute 10+ tools in sequence without human intervention - Self-correction: Detects errors, diagnoses root cause, fixes automatically - *

Extension points exported contracts — how you extend this code

AppSidebarProps (Interface)
* App Sidebar Props
frontend/src/components/app-sidebar.tsx
ProjectHeaderProps (Interface)
* Project Header Props
frontend/src/components/boxlite/project-header.tsx
SelectedSourceInfo (Interface)
Selected source info for image download
frontend/src/components/boxlite/boxlite-ide.tsx
LayoutTabProps (Interface)
* Layout Tab Props
frontend/src/components/extractor/layout-tab.tsx
StylesTabProps (Interface)
* Styles Tab Props
frontend/src/components/extractor/styles-tab.tsx

Core symbols most depended-on inside this repo

get
called by 1366
backend/cache/memory_store.py
cn
called by 388
frontend/src/lib/utils.ts
get
called by 151
backend/extractor/cache_manager.py
send_to
called by 24
backend/boxlite/routes.py
execute_action
called by 19
backend/agent/websocket_manager.py
get_state
called by 17
backend/boxlite/sandbox_manager.py
send
called by 17
backend/agent/websocket_manager.py
clear
called by 16
backend/cache/memory_store.py

Shape

Method 868
Function 744
Class 269
Interface 268
Route 60

Languages

Python66%
TypeScript34%

Modules by API surface

backend/tests/test_boxlite_tools.py69 symbols
backend/boxlite/routes.py51 symbols
backend/agent/mcp_tools.py50 symbols
frontend/src/lib/rag-chunker.ts47 symbols
backend/boxlite/sandbox_manager.py42 symbols
backend/agent/task_contract.py42 symbols
backend/boxlite/boxlite_mcp_executor.py39 symbols
frontend/src/types/agent.ts38 symbols
backend/agent/tools/webcontainer_tools.py38 symbols
backend/boxlite/replay_recorder.py37 symbols
backend/extractor/models.py36 symbols
backend/agent/websocket_manager.py35 symbols

For agents

$ claude mcp add Perfect-Web-Clone \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact