Living Document Notice
Published 2026-09-14. The evolving architecture, revisions, and connected notes for this dispatch live in the Stax Digital Garden.

Preserving Web Provenance Without Preserving Ad Clutter

Preserving Web Provenance Without Preserving Ad Clutter: High-contrast P4 paper white and amber dual-trace vector CRT macro showing provenance vector beam piercing shield to reach clean document card

Summary

Maintaining complete cryptographic provenance to source URLs and capture timestamps while stripping affiliate trackers, tracking scripts, and bloated DOM payloads.

Saving a recipe requires knowing its origin without dragging along megabytes of payload. Modern food blogs are heavily monetized, often wrapping a simple 400-word recipe inside 5 megabytes of tracking scripts, affiliate redirection chains, and promotional video embeds. When users attempt to save these pages using traditional web clippers, their personal notes inherit all of this digital waste.

Galley solves this by decoupling provenance from presentation: we record durable origin metadata while stripping tracking mechanisms and advertising clutter.

The Provenance Ledger

Every imported recipe retains an immutable origin record stored alongside the recipe data:

  1. Canonical URL: Cleaned of query parameters, referral tokens, and tracking beacons.
  2. Capture Timestamp: ISO-8601 UTC timestamp recording exactly when the document was fetched.
  3. Source Checksum: A SHA-256 hash of the sanitized DOM content at capture time.
  4. Author Attribution: Preserving credit for the recipe creator.
┌──────────────────────────────────────────────────────────┐
│                   Provenance Ledger                      │
├──────────────────────────────────────────────────────────┤
│ Source URL:    https://example.com/classic-bouillabaisse  │
│ Clean Hash:    e3b0c44298fc1c149afbf4c8996fb92427ae41e46 │
│ Captured At:   2026-09-10T14:30:00Z                      │
│ Attribution:   Chef Julia Vance (Classic Maritime)       │
└──────────────────────────────────────────────────────────┘

This ledger lives directly in SQLite and can be exported as frontmatter fields in Markdown notes. If a web source later disappears behind a paywall or domain expiry, the user retains both the recipe text and cryptographic proof of when and where the document was originally collected.

Sanitizing Incoming Payloads

Before any parsing occurs, incoming HTML passes through a sanitization pipeline that strips junk while preserving semantic markup:

import re
from urllib.parse import urlparse, urlunparse
 
def sanitize_provenance_url(raw_url: str) -> str:
    # Strip marketing tags and query bloat
    parsed = urlparse(raw_url)
    clean_query = re.sub(r"(utm_[^&]+|fbclid|ref|gclid)=[^&]*&?", "", parsed.query).rstrip("&")
    return urlunparse((
        parsed.scheme,
        parsed.netloc.lower(),
        parsed.path.rstrip("/"),
        parsed.params,
        clean_query,
        ""
    ))

In addition to URL sanitization, DOM elements such as script tags, iframe embeds, nav bars, aside panels, and external tracker scripts are stripped before the text reaches the recipe parser.

Local Offline Snapshotting

Rather than storing the full HTML blob with external asset references, Galley generates a clean, read-only snapshot of the core article text. Images referenced in the recipe steps are downloaded and stored locally in the vault’s media folder, preventing broken image links when third-party CDN servers rotate their URLs or remove older blog uploads.

Keeping local asset copies ensures that recipe instructions remain fully illustrated even when viewing notes completely offline in remote environments without cellular service.

Cryptographic Content Verification

To verify that an archived note has not been accidentally corrupted or modified by external editing tools, the provenance record includes a SHA-256 hash calculated directly over the normalized ingredient and instruction text.

When opening an archived recipe, the reader can recompute the content digest and compare it against the provenance manifest. Any divergence between the recorded hash and current file state is flagged in the interface, alerting the operator to external file edits.

Storage Efficiency Comparison

Cleaning the web payload at the front door drastically reduces vault storage and index overhead:

Content TierRaw Web Page CaptureSanitized Galley ArchiveEfficiency Gain
HTML DOM Payload4.2 MB average18 KB cleaned text99.5% reduction
Asset Requests120+ external scripts0 external requestsComplete network isolation
Tracking Tokens14 ad / analytic keys0 tracking parameters100% telemetry eliminated
Local Disk UsageHigh fragmentationPredictable SQLite row sizeHigh write durability

The result is a clean, permanent recipe document that honors the original author’s contribution without compromising the reader’s privacy or storage performance.


  • Directus Target: galley
  • Garden Source Reference: Provenance Ledger, DOM Sanitization, Source Context, MOC - Culinary & Domain Workspaces, MOC - The Kitchen Chaos Factor, MOC - Bosun PKM Tools