r/BASE • • Oct 29 '26

Base Discussion [Builder] agentkit-cleanweb: 87% Token Noise Reduction & Base EIP-712 Oracle Provider for Coinbase AgentKit

Hi Base builders! 🔵

We just released **`agentkit-cleanweb`** (v1.0.0) on npm — an open Action Provider built for autonomous AI agents on Base using Coinbase AgentKit.

### The Problem

When autonomous agents browse the live web or research whitepapers, raw HTML noise (cookie banners, scripts, navigation clutter, ads) consumes **70%–90% of the LLM context window**. On GPT-4o or Claude 3.5, scraping a single 80KB page burns ~$0.05 just in junk tokens.

### What CleanWeb Solves:

  1. **87% Token Noise Reduction**: Strips HTML boilerplate into clean, LLM-ready structured Markdown (80KB -> ~10KB). Saves **86.2%** in net token inference costs.
  2. **Base Mainnet (8453) EIP-712 Attestation Proofs**: Cryptographically signs the ground-truth hash on-chain so downstream smart contracts can trust the scraped facts.
  3. **Research PDF & YouTube Extraction**: 2-second whitepaper PDF parsing and YouTube Gemini 3.8 Flash video transcript summaries.
  4. **Gasless x402 Micropayments**: Supports pre-funded Base USDC vaults for sub-millisecond execution.

### Try it in 1 second (No wallet / Zero-friction proxy):

```bash

curl https://x402-cleanweb-agent-212942243360.asia-northeast3.run.app/r/https://base.org

10 Upvotes

2 comments sorted by

1

u/IntrepidDarkness Oct 29 '26

87% less junk tokens is the kind of thing you notice immediately once you run a few scrapes. Curious how the EIP-712 proof handles pages that change between the scrape and the on-chain verification though, feels like the hash would go stale fast on anything dynamic.

1

u/EstablishmentTough18 Oct 29 '26

Great catch and really sharp question!

The short answer: **The EIP-712 proof anchors an *immutable sanitized snapshot* of what the agent actually consumed, not a live URL re-fetch.**

Here is the exact architectural pipeline under the hood:

  1. **Deterministic Sanitized Snapshot (`CleanwebResult.content_hash`)**:

    When the agent scrapes the page, the Cleanweb scrubber strips zero-width steganography, hidden CSS injection containers (`font-size: 0`, off-screen divs), and tracking pixels. The resulting payload is frozen into a canonical normalized string, and hashed (`payloadHash = keccak256(sanitized_text)`).

  2. **Decoupled from Web Page Drift**:

    The on-chain smart contract (e.g. `SecurityGateOMSPolicy` or Base Safe Guard) doesn't re-scrape the live URL—it uses `ecrecover` to cryptographically verify:

    *"Did the Security Gate Oracle inspect and clear this exact payload at timestamp $T$, and is the agent's proposed transaction strictly grounded in it?"*

    Even if the live website changes 2 seconds later, the provenance of what the agent acted upon remains immutable and auditable.

  3. **Strict Replay Prevention (`expiresAt` Window)**:

    For dynamic/time-sensitive data (e.g., market prices, IoT logistics), every EIP-712 attestation carries a strict validity TTL (typically 300s to 600s). The transaction must be submitted on Base/Polygon within that window. If it takes too long, the contract reverts with `AttestationExpired()`, forcing the agent to grab a fresh verified snapshot.

  4. **Semantic NLI Grounding**:

    If the agent extracts numbers from a dynamic page to execute a trade/escrow deposit, our sub-5ms NLI engine cross-checks the agent's extraction against the snapshot to ensure zero hallucination before minting the EIP-712 signature.

In short: dynamic page updates won't invalidate inflight proofs, while the short TTL prevents stale/replayed market data!