Skip to main content
Glama
README.md
<div align="center">

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="./docs/assets/hero-dark.svg">
  <img alt="WebSearchCrawl v3.0 - Detachable Web Intelligence Microkernel for Windows AI Agents" src="./docs/assets/hero-light.svg" width="100%">
</picture>

<br/>

[![Windows CI](https://github.com/mortal7520/web-search-crawl/actions/workflows/ci.yml/badge.svg)](https://github.com/mortal7520/web-search-crawl/actions/workflows/ci.yml)
[![Version](https://img.shields.io/badge/release-v3.0.0-0ea5e9?style=flat)](https://github.com/mortal7520/web-search-crawl/releases/tag/v3.0.0)
[![Platform](https://img.shields.io/badge/platform-Windows_11_%2B_WSL2-2563eb?style=flat)](./ARCHITECTURE.md)
[![Microkernel](https://img.shields.io/badge/capsules-10_%3C%3D250_LOC-8b5cf6?style=flat)](./modules.toml)
[![MCP](https://img.shields.io/badge/MCP-2025--11--25_%2B_5_Stdio-6366f1?style=flat)](#connect-your-ai-clients-in-one-command)
[![Footprint](https://img.shields.io/badge/NTFS_footprint--61.24%25-10b981?style=flat)](#verified-benchmarks)
[![License Firewall](https://img.shields.io/badge/license_firewall-222_pkgs_%7C_0_GPL-10b981?style=flat)](#security-and-license-firewall)
[![License: MIT](https://img.shields.io/badge/license-MIT-3b82f6?style=flat)](./LICENSE)

**English** | [简体中文](./README.zh-CN.md) | [60s Quickstart](#get-started-in-60-seconds) | [v3.0 Capsules](#new-in-v30--detachable-microkernel--governance) | [What You Can Do](#what-your-agent-can-do-2-minutes-later) | [Compare](#how-does-it-compare) | [Benchmarks](#verified-benchmarks) | [Architecture](./ARCHITECTURE.md)

</div>

---

**Give Claude Code, Codex, Antigravity, Cursor, or WSL2 the entire internet from your own Windows PC, with zero SaaS bills and zero private cookie uploads.**

Instead of wiring separate API keys for web search, Cloudflare scraping, PDF parsing, social reading, and MCP servers, **WebSearchCrawl v3.0** unifies 59 search platforms, 10 hot-swappable `<=250 LOC` capability capsules, tiered anti-detect browsers, Rust PDF/Markdown wheels, offline WARC contracts, local Matryoshka vector/graph memory, and a `5.49 ms` Go thin CLI behind one auditable Windows microkernel.

---

## Get Started in 60 Seconds

### Option 1: Let your AI agent install it for you

Paste this into **Claude Code**, **Codex**, or **Antigravity**:

```text
Clone https://github.com/mortal7520/web-search-crawl, run .\scripts\bootstrap.ps1 -SyncClients, and verify the stack with scripts\doctor.py --offline.
```

### Option 2: Run 3 commands in PowerShell

Works on any Windows 10/11 machine (PowerShell 5.1 or 7+). All virtualenvs, caches, and browsers stay isolated inside `%LOCALAPPDATA%\WebSearchCrawl` (or pass `-AppRoot D:\Apps\WebSearchCrawl` / set `WSC_APP_ROOT`):

```powershell
git clone https://github.com/mortal7520/web-search-crawl.git
cd web-search-crawl
.\scripts\bootstrap.ps1 -Profile full -WithBrowsers -SyncClients
```

Preview every action without modifying your disk first:

```powershell
.\scripts\bootstrap.ps1 -DryRun -Profile full -WithBrowsers -SyncClients
```

---

## New in v3.0 — Detachable Microkernel & Governance

Every high-leverage subsystem in **v3.0** is packaged as an isolated `<= 250 LOC` capsule governed by [`modules.toml`](./modules.toml), [`tach.toml`](./tach.toml), and [`provenance.json`](./provenance.json) with zero sibling coupling:

- **10 Detachable Capsules (`wsc/capsules/`)**: `transport_pool` (100-stream H2 semaphore + `CurlOpt.RESOLVE` SSRF lock), `edge_negotiator` (`Accept: text/markdown` + Next.js `RSC: 1` Flight + `Content-Signal: use=immediate`), `identity_coherence` (Chrome 158 TLS/Client-Hints lock), `shadow_api_replay` (`Unbrowse` same-site XHR/GraphQL pure-HTTP replay), `async_browser_pool` (multi-context CDP + `140ms` event settle + W3C `WebMCP`), `single_pass_distiller` (`9.39x` single-pass Lexbor + KaTeX + Rust Markdown), `neuro_extractor` (`__row__` Row-AST + `1.16 ms` zero-token selector self-healing), `bandit_frontier` (per-host token buckets + Manku `4x16-bit` Pigeonhole SimHash + Thompson Sampling), `mrl_memory_graph` (`1024d -> 128d` Matryoshka slice + AST breadcrumbs + 2-hop ego PPR), and `hedged_search` (intent pruning + quorum cancellation).
- **One-Flag Detach & Progressive MCP Profiles**: Detach any capsule via `WSC_DISABLE_CAPSULES=shadow_api_replay` or private `<WSC_APP_ROOT>\local\overlay.toml` (`DETACHED` with built-in fallback), and slim `/mcp` tool exposure via `WSC_MCP_PROFILE=core|standard|full` (`6` / `10` / `13` tools).
- **Built-In Audit, Canary & Shadow A/B CLI (`wsc.exe`)**:

```powershell
wsc capsules     # Inspect ACTIVE / DETACHED / DEGRADED slots and exact LOC counts
wsc audit        # <250ms tach.toml AST boundary check + boolean SPDX license gate
wsc canary       # <200ms zero-network ISO 28500 .warc.gz contract suite
wsc bench ab     # Head-to-head v2 vs v3 benchmark with cryptographic SHA-256 receipt
```

---

## What Your Agent Can Do 2 Minutes Later

### 1. Search 59 platforms at once (keyless by default)

Queries Exa, GitHub, Reddit, X, YouTube, ArXiv, HuggingFace, PubMed, Wikidata, Bilibili, Zhihu, Xiaohongshu, and more with automatic fallback, Rust `rensa` deduplication, and local reranking:

```powershell
agent-reach search all "MCP 2025-11-25 streamable http" --rerank --limit 5
```

```json
{
  "ok": true,
  "query": "MCP 2025-11-25 streamable http",
  "platforms_queried": ["web", "github", "reddit", "arxiv"],
  "deduped_count": 14,
  "results": [
    {
      "rank": 1,
      "source": "github",
      "title": "modelcontextprotocol/modelcontextprotocol (2025-11-25 spec)",
      "url": "https://github.com/modelcontextprotocol/modelcontextprotocol",
      "score": 0.94
    }
  ]
}
```

### 2. Crawl JS-heavy and Cloudflare-protected pages to clean Markdown

Domain affinity learns what each host needs. Static pages stay on millisecond Rust TLS (`wreq` / `impit` / `curl_cffi`); JS shells and WAF challenges automatically escalate to a warm `Patchright` pool, `CloakBrowser`, `fingerprint-chromium`, or `Camoufox`:

```powershell
crawl fetch https://example.com --engine auto
```

```markdown
# Example Domain
Fetched via: wreq (HTTP/2 TLS impersonation, 304 cache enabled)
Clean body extracted by selectolax.lexbor + Rust html-to-markdown (0.325 ms parse)
```

### 3. Parse local PDFs in `0.31 ms` without uploading confidential files

Native digital PDFs hit Rust `pdf_oxide` (`0.308 ms`); complex layouts fall back to `xberg` or an isolated warm `IBM Docling` worker with zero cloud upload:

```powershell
crawl doc .\quarterly-report.pdf --backend auto
```

### 4. Monitor docs and changelogs at zero LLM token cost

`Watch + Diff` combines HTTP `ETag`/`304`, `XXH3` exact hashing, and `simhash64` Hamming distance so unchanged pages never spend a single LLM token:

```powershell
crawl watch add https://modelcontextprotocol.io/specification --name mcp-spec
crawl watch list
crawl watch rss
```

### 5. Replay offline and query your own Knowledge Graph

Every archived crawl can be saved as standard ISO 28500 `.warc.gz` (with sensitive headers stripped and post-decompression SHA-256 verified) and indexed into SQLite WAL (`FTS5` CJK + `sqlite-vec` / `usearch` + 3-table Personalized PageRank graph):

```powershell
crawl warc replay https://example.com
crawl memory search "streamable http tasks" --top-k 5
crawl graph search "BanditRouter" --top-k 8
```

---

## Live Local Explorer (`/ui`) & Unified MCP `2025-11-25`

Start the warm daemon (or let `wsc.exe` auto-start it on demand) to expose unified Streamable HTTP `/mcp`, idempotent `SEP-1686` durable `tasks`, and a read-only localhost-only explorer at `http://127.0.0.1:<port>/ui` with Light and Dark themes:

<div align="center">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="./docs/assets/explorer-dark.png">
  <img alt="WebSearchCrawl v2.0 Warm Daemon Local Explorer Dashboard" src="./docs/assets/explorer-light.png" width="100%">
</picture>
</div>

---

## How Does It Compare?

WebSearchCrawl builds on top of strong open-source projects including `Agent-Reach`, `Crawl4AI`, `Scrapling`, `Patchright`, and `CloakBrowser`, unifying them behind one fast Go CLI, warm local daemon, and shared SQLite memory.

| Capability | WebSearchCrawl v3.0 | Cloud APIs (Firecrawl / Tavily / Exa) | Single-Layer Scrapers (Crawl4AI / Scrapling / Playwright) |
| --- | --- | --- | --- |
| **Monthly cost** | **`$0` local-first** (optional paid APIs with daily USD cap) | `$16` to `$100+` / month metered credits | `$0` local library |
| **59-platform search + social** | Built-in (`BanditRouter` + local CLI & OpenCLI fallback) | Web search only | Bring your own search layer |
| **Anti-detect browser escalation** | Auto tiered (`wreq` -> `Patchright` -> `CloakBrowser` -> `Camoufox`) | Managed cloud browsers | Single engine per library |
| **Local PDF parsing speed** | **`0.308 ms`** Rust `pdf_oxide` -> `xberg` -> warm `Docling` | Upload to cloud API | External library required |
| **Offline WARC + 0-token Watch** | Built-in ISO 28500 `.warc.gz` + `ETag`/`XXH3`/`simhash64` | Paid add-on or unavailable | Build yourself |
| **Private cookies & data locality** | 100% on your PC (`127.0.0.1` loopback, scrubbed logs) | Leaves your machine | Local |
| **Multi-client MCP auto-sync** | 1 command -> Antigravity, Codex, Claude Code, WSL2 | Manual JSON config per client | Manual setup |

---

## Verified Benchmarks

Measured on Windows 11 x64 (`Intel i9-13900HX`, `RTX 5070 Ti Laptop GPU`, NVMe) via `scripts/bench_v2_verify.py` and `scripts/slim_and_compact.py`. Local compute hot paths are reported separately from live network fetches, which remain physically bounded by WAN RTT and origin TTFB.

### Hot-Path Latency

| Workload | Legacy / Cold Baseline | v3.0 Measured | Speedup | Notes |
| --- | ---: | ---: | ---: | --- |
| Digital PDF to Markdown (`pdf_oxide`) | Cold `Docling` (`~10,000 ms`) | **`0.308 ms`** | **`32,467.5x`** | Native digital PDFs; scanned docs route to `xberg` / warm `Docling` |
| React 19 RSC Flight Distillation | Chromium cold boot (`~2,500 ms`) | **`0.244 ms`** | **`10,245x`** | Direct `RSC: 1` / `__next_f` extraction (`1.000` F1) |
| Zero-Token Selector Drift Self-Healing | Local/Cloud LLM repair (`~1,200 ms`) | **`1.157 ms`** | **`1,037x`** | `Scrapling`-style structural relocation (`0` LLM tokens) |
| Content Fingerprint (`xxhash` `XXH3`) | Pure Python `simhash64` (`8.81 ms`) | **`0.00782 ms`** | **`1,126x`** | Exact change gate (`20 KB` HTML) |
| Warm Daemon Dispatch (`/v1/dispatch`) | Heavy Python cold import (`1,881.3 ms`) | **`15.778 ms`** | **`119.2x`** | `127.0.0.1` Keep-Alive + Bearer auth |
| Go Thin CLI (`wsc.exe --help`) | Python CLI cold `--help` (`169.7 ms`) | **`5.49 ms`** | **`30.9x`** | `113.22 us` Go-to-Python loopback RTT |
| Single-Pass Lexbor + KaTeX + Rust Distill | Double `trafilatura` (`6.25 ms/page`) | **`0.666 ms`** | **`9.39x`** | Preserves LaTeX `$...$`, `1.000` 4-gram F1 (`wsc bench ab`) |
| ISO 28500 Offline Replay (`warcio`) | Live network re-fetch | **`0.264 ms`** | Deterministic | Zero-network replay + post-decompression SHA-256 |

### Physical Disk Reduction (`-61.24%`)

Measured with NTFS `(st_dev, st_ino)` hardlink deduplication plus Win32 `GetCompressedFileSizeW` actual allocated bytes:

| Storage Metric | Before V2 | After V2 | Saved |
| --- | ---: | ---: | ---: |
| Combined physical NTFS footprint | `10,287.45 MiB` | **`3,986.97 MiB`** | **`-6,300.48 MiB` (`-61.24%`)** |
| Vector stack (`lancedb`+`pyarrow` -> `sqlite-vec`+`usearch`) | `362.6 MiB` | **`< 2 MiB`** | **`-360+ MiB`** |
| `C:` drive `Camoufox` allocation | `2,584.5 MiB` | **`0 MiB`** (NTFS junction -> `D:` + `LZX`) | **`-2,584.5 MiB` on `C:`** |

> **Optional Zero-PyTorch GPU Sidecar (`gpu/llama_sidecar.py`)**: Detects Vulkan GPUs via `llama.cpp b12921 win-vulkan-x64` (`36.3 MiB` binary) for local embeddings, `--pooling rank` reranking, and GBNF structured JSON extraction without multi-GB CUDA or PyTorch installs.

---

## Connect Your AI Clients in One Command

Run idempotently to wire **5 native stdio MCP servers**, **32 User PATH CLIs**, **5 Windows + WSL skill mirrors**, and **7 default-first routing surfaces** (automatic config backups retained to 10 snapshots):

```powershell
python scripts\sync_mcp_and_skills.py
```

| Client | Auto-Wired MCPs & Rules |
| --- | --- |
| **Antigravity (AGY)** | `~/.gemini/config/mcp_config.json` (5 MCPs), always-on plugin `web-search-crawl-default`, skill mirror |
| **Codex (Windows & WSL)** | `~/.codex/config.toml` (5 MCPs), `~/.codex/AGENTS.md`, skill mirror |
| **Claude Code (Windows & WSL)** | `~/.claude.json` (5 MCPs), `~/.claude/CLAUDE.md`, skill mirror |
| **WSL2 DSH & Workspace** | `~/.dsh/AGENTS.md`, workspace `AGENTS.md` (WSL user auto-detected via `core.env.wsl_user()` or overridden via `WSC_WSL_USER`) |

**5 Stdio MCP Servers Registered**: `agent-reach` (7 tools), `crawl-kit` (10 tools), `github` (`github-mcp-server v2.3.0`, 28 read-only tools with in-memory `gh` token injection), `context7` (2 live library docs tools), and `deepwiki` (3 repo wiki tools over SSRF-guarded stdio bridge).

---

## Security and License Firewall

Full threat model and disclosure process live in [`SECURITY.md`](./SECURITY.md).

- **SSRF & Redirect Guard (`core/net_guard.py`)**: Enforces `http`/`https`, blocks loopback, RFC1918, CGNAT, link-local, cloud metadata, IPv4-mapped IPv6, and integer/hex/octal IP literals, and re-validates every HTTP redirect hop unless `--private` is explicitly passed.
- **Process & Daemon Isolation (`core/subproc.py`, `daemon/server.py`)**: Child commands run inside Windows Job Objects with hard wall-clock deadlines and stdout byte caps. The warm daemon binds strictly to `127.0.0.1`, enforces a per-instance random `Bearer` token, and rejects cross-origin requests (`HTTP 403` with body drain and `Connection: close`).
- **License Firewall (`scripts/license_audit.py --strict` & `wsc audit`)**: Evaluates boolean SPDX `AND`/`OR` expressions across project dependency closures (`222` packages, `0` GPL/AGPL/SSPL violations) and exports CycloneDX 1.5 SBOMs.
- **Verified Quality Gates**: `pytest tests` (`118 passed`), `agent-reach` Windows (`771 passed`) + WSL POSIX (`791 passed, 0 skipped`), `wsc audit` (`0` boundary violations, all capsules `<=248 LOC`), `wsc canary` (`3/3` offline WARC contracts), and `adversarial_verify.py` (`9/9 PASS`).

---

<details>
<summary>Architecture Overview, Verification Commands & Upstream Reuse Matrix</summary>

```mermaid
flowchart TD
    Hosts["AI Clients: Antigravity / Codex / Claude Code / WSL2"]
    CLI["Go Thin CLI: wsc.exe (5.49 ms)"]
    MCP["5 Stdio MCPs + Streamable HTTP /mcp (2025-11-25)"]
    Daemon["Warm Local Daemon (127.0.0.1 Keep-Alive + Bearer + Origin 403 + /ui)"]

    Hosts --> MCP
    Hosts --> CLI
    CLI -->|"113 us RTT"| Daemon
    MCP --> Daemon

    Daemon --> L1["Layer 1: 59-Platform Search (BanditRouter + Convex Fusion + rensa)"]
    Daemon --> L2["Layer 2: Adaptive Crawl (wreq/impit -> Scrapling/C4AI -> Pool) + Rust PDF"]
    L2 --> L3["Layer 3: Anti-Detect Browsers (CloakBrowser -> fp-chromium -> Camoufox)"]
    L2 --> Mem["Memory & Frontier: SQLite FTS5 + vec/usearch + WARC + Watch + PPR Graph"]
    Mem -.-> GPU["Optional Vulkan Sidecar: llama.cpp b12921 (Zero PyTorch)"]
```

### Run Verification Locally

```powershell
pytest tests -v
python scripts\doctor.py
python scripts\selftest_all.py
python scripts\adversarial_verify.py
python scripts\bench_v2_verify.py
python scripts\license_audit.py --strict
```

Full module contracts, upstream commits/SHA-256 hashes, and design tokens live in [`ARCHITECTURE.md`](./ARCHITECTURE.md), [`UPSTREAM-REUSE.md`](./UPSTREAM-REUSE.md), [`DESIGN.md`](./DESIGN.md), [`CHANGELOG.md`](./CHANGELOG.md), and [`CONTRIBUTING.md`](./CONTRIBUTING.md).

</details>

## License

Released under the [MIT License](./LICENSE). Third-party components retain their respective permissive upstream licenses documented in [`UPSTREAM-REUSE.md`](./UPSTREAM-REUSE.md).