AIToday
Large Language ModelsHacker NewsPublished: Jul 7, 2026, 19:00 JST

Shadow Web cuts LLM web-page tokens 64–97% with open-source tool

Shadow Web cuts LLM web-page tokens 64–97% with open-source tool

3 Key Points

  1. What happened

    A new open-source Python package called Shadow Web compresses HTML pages before sending them to AI agents, reducing token costs by 64–97% on real websites. A Wikipedia page drops from 99,343 tokens to 16,462 tokens (−83%), and GitHub Trending falls from 167,875 to 37,833 tokens (−77%).

  2. Why it matters

    AI agents often waste tokens on unused scripts, styles, and hidden DOM elements. Shadow Web keeps only interactive elements, semantic labels, and clean data structures—letting AI developers lower API costs and improve agent reliability without cloud infrastructure.

  3. What to watch

    The tool is available now as a pip-installable package (shadow-web) and includes built-in support for Cursor and Claude via a 22-tool MCP server; it also parses tables, forms, and lists into JSON or CSV, and works offline.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

Web pages contain far more HTML than AI agents need to see: inline stylesheets, JavaScript bundles, tracking pixels, and dynamically-rendered shadow DOM elements buried in Web Components. Most of this noise becomes tokens sent to an LLM, inflating API bills without adding semantic value. Shadow Web sits between the browser and the LLM, reading the live DOM (including shadow trees), stripping decorative markup, and organizing what remains into a sparse Action Map—a list of clickable elements with labels and semantic groups (like "Login", "Cart", "Navigation"). This cuts raw token load by 64–97% depending on the page.

The tool also solves a secondary pain point: Playwright and other browser automation libraries struggle to reach elements inside shadow DOM or closed Web Components, and selectors break when the DOM changes. Shadow Web provides self-healing selectors that first try fuzzy local recovery, then fall back to LLM verification if needed—no cloud roundtrip required for most failures. For teams building AI agents that navigate the web, this combination of compression, structural parsing (SchemaSnap), and local selector repair reduces both API costs and error rates.

The package is pip-installable and includes turnkey integrations for Cursor and Claude via an MCP (Model Context Protocol) server. It works offline and produces no side effects on the original page, making it safe to use with any framework (React, Vue, Svelte, etc.). Benchmarks on real sites show token reductions of 6× on Wikipedia and 4.4× on GitHub Trending.

FAQ
How much does Shadow Web reduce token usage?
On a Wikipedia page, raw HTML costs 99,343 tokens; Shadow Web reduces it to 16,462 tokens (−83%). On GitHub Trending, it drops from 167,875 tokens to 37,833 tokens (−77%).
Does Shadow Web require cloud infrastructure?
No. The tool works offline as a local Python package. It includes an optional FastAPI server for LLM-powered selector healing, but core compression, schema parsing, and self-healing all run locally.
What data can Shadow Web extract from a page?
It parses tables into columns, types, and rows; forms into fields with validation rules; and lists into typed items. All output can be exported as JSON or CSV.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleBritish startup launches autonomous lab to orbit to study disease proteins