Real Threads

Real Threads

The Lexical Loom — Primer

Project Primer: Lexical Loom

Origins

Lexical Loom began from a question: what would it look like to weave a portrait of a week from the things the world was reaching for? Every Monday at 00:01 UTC, the Loom pulls the previous Mon–Sun window of English Wikipedia pageviews, ranks the 25 most-read articles, and hands that list to an AI Artist who picks ONE as the week's lens. A second AI Technician then fabricates a self-contained 3D Sculpture around that choice — its vocabulary tokenised from the chosen article's own prose. The result is a living archive of what the world was thinking about, one article at a time.

The earlier prototype tokenised raw Wikipedia edit comments; that turned out to be too noisy (bots, citation cleanups, template maintenance) to carry weekly signal. The current shape — "pick the article people actually read, then build the piece from its words" — keeps the typographic ornament feature but routes it through an editorial human-scale choice.

Structure

The project has three public layers:

  1. Latest (/projects/lexical-loom) — this week's published Sculpture, with the chosen-article kicker, the Artist's reflection, and a live 3D scene rendered in a sandboxed iframe.
  2. Archive (/projects/lexical-loom/archive) — reverse-chronological index of every past week.
  3. Detail (/projects/lexical-loom/archive/[week]) — a specific week by ISO week-date (e.g. 2026-W22), rendered identically to the day it was published.

Behind the scenes, a weekly Vercel cron drives a six-stage pipeline (Ingest → Artist → Tokenise → Technician → Validate → Persist) and writes Sculptures into Supabase. An admin review surface at /admin/sculptures lets the site owner publish or skip each generated draft, with all 25 candidate articles visible alongside the chosen one for context.

Key Concepts

  • Sculpture: A single weekly artefact. Identified by an ISO week-date (YYYY-Www). Contains the 25 candidate articles, the Artist's chosen article + rationale, the Artist's title, medium, visual description, and reflection; the article-derived word list; the Technician's self-contained HTML payload; and review status.
  • The Artist: An AI agent (Claude Sonnet 4.5 via Vercel AI Gateway) that receives the week's top 25 articles, picks ONE as the lens, and conceives the sculpture — its title, medium, visual description, and reflective text. May call a web-search tool (Tavily, max 2 calls) to ground its interpretation in current events around the chosen article. Biased toward life-affirming choices; instructed to avoid TV/film/game-franchise releases (which would otherwise dominate every week) and to not repeat any title from the rolling 8-week "recent picks" list.
  • The Technician: A second AI agent (same model) that takes the Artist's brief plus the article-derived top words and fabricates the sculpture as a single self-contained HTML document using Three.js r184. Uses an MCP-served fetch tool to consult Three.js documentation, scoped to an allowlist.
  • Top articles: The 25 most-viewed enwiki articles for the Mon–Sun UTC window, summed across the 7 daily pageviews snapshots. Maintenance pages (Main_Page, anything with :Special:*, Wikipedia:*, User:*, etc.) are filtered before ranking.
  • Chosen article: The Artist's pick from those 25. Stored as {title, url, rationale} and rendered on the public page as the "THIS WEEK'S LENS" kicker.
  • Top words: Up to 50 most-frequent non-stopword tokens (length ≥ 3, non-numeric) tokenised from the chosen article's plaintext extract, fetched via the MediaWiki action API. These are the words the Technician embeds as etched/inlaid/threaded ornament on the Sculpture itself.
  • ISO week: Mon–Sun UTC window encoded as YYYY-Www (e.g. 2026-W22). The pipeline's canonical key for idempotency.
  • Sandboxed renderer: Sculptures are served from a separate subdomain (sculpture.realthreads.io) and embedded with sandbox="allow-scripts" — no allow-same-origin. This makes the host's cookies, storage, and DOM inaccessible to Sculpture code.
  • Review states: Each Sculpture is DRAFT, PUBLISHED, SKIPPED, or FAILED. Only PUBLISHED rows are visible to the public via the sculptures_public view.

Thematic Clusters

  • Collective attention: The project treats Wikipedia pageviews as a barometer of what humans reached for in a given week. Each chosen article is a stake driven into the week's defining curiosity.
  • Editorial choice as creative act: The "pick one of 25" step is deliberate — without it, the loudest articles every week (entertainment, sports, recent celebrity deaths) would crowd out the genuinely this-week signal. The Artist's rationale field makes that choice legible to the visitor.
  • Two-agent collaboration: The Artist–Technician pair mirrors a creative-direction / fabrication split, and shows how separating "concept" from "execution" produces richer outputs than a single all-in-one prompt.
  • Generative archaeology: Over time the archive accumulates into a strange new kind of historical record — a museum of weeks, each anchored to the encyclopaedia article the species was reading most that week.
  • Safe execution of AI-generated code: Sandboxing, CSP, and a draft/review gate let the project run untrusted model-authored JavaScript without exposing the host site.
  • Weekly ritual: Monday at 00:01 UTC is the heartbeat. The cadence is part of the work.

Conceptual Vocabulary

  • Pageviews API: The Wikimedia REST endpoint (/metrics/pageviews/top/en.wikipedia/all-access/{YYYY}/{MM}/{DD}) that returns the top 1000 most-read enwiki articles for a given UTC day. Public, no auth, requires a policy-compliant User-Agent.
  • MediaWiki extracts API: The action-API endpoint used to fetch the chosen article's plaintext (action=query&prop=extracts&explaintext=true) for tokenisation.
  • Stopword: A high-frequency function word (the, of, a, …) removed before counting; plus a small wiki-editing list kept from the earlier design (harmless on article prose).
  • MCP (Model Context Protocol): The protocol used to expose a tool (the Three.js docs fetcher) to the Technician agent, in-process via @modelcontextprotocol/sdk.
  • Tavily: The web-search tool the Artist may call (max 2 calls) to ground its interpretation of why the chosen article surged this week.
  • Importmap: HTML feature the Technician uses to pin Three.js modules to the exact unpkg.com/[email protected] URLs allowed by the validator.
  • Run ledger: The sculpture_runs table, recording each cron execution's outcome, stage, token usage, and any failure reason.
  • Preview token: A short-lived HS256 JWT (5-minute TTL) the admin page mints so the renderer can fetch a DRAFT row by id.
  • Recent-picks guard: The cron route reads the last 8 published/draft/skipped chosen_article_title values via listRecentChosenArticles(8) and passes them to the Artist as titles to avoid, so the rolling archive never repeats an article within a 2-month window.

Related Projects

  • Atmospheric Collider — the closest cousin. Both run a daily/weekly cron, both have an AI agent (or pair) author a generative artefact from real-world data, both maintain an archive. The Collider draws mandalas from NOAA solar data; the Loom weaves sculptures from Wikipedia pageviews.
  • The Road to Reality — shares the interactive 3D / canvas lineage and the impulse to make abstract systems tangible.
  • Vector Atlas — also computational/generative; shares an interest in extracting structure from large bodies of text.
  • Energy — another project treating live data as creative raw material.

Agent Guidance

Tone: Speak about Lexical Loom as a weekly portrait of human attention, lensed through whichever Wikipedia article the world reached for most. Honour both the data side (pageviews, the 25-article shortlist, the chosen article's own prose) and the artistic side (the Artist's choice + reflection, the Technician's fabrication).

Common visitor questions:

  • "What am I looking at?" — A self-contained 3D scene generated this week by an AI Technician, built around an AI Artist's pick of the most-viewed Wikipedia article from the previous Mon–Sun. The ornamental words on the piece are drawn from that article's own text.
  • "Why this article?" — The "THIS WEEK'S LENS" kicker shows the Artist's one- or two-sentence rationale. It will usually point at the event, anniversary, or cultural moment that drew everyone to that page.
  • "Why is the latest Sculpture missing?" — The cron runs Monday at 00:01 UTC. Drafts then await the site owner's review at /admin/sculptures before being published. There may also be no Sculpture if a run failed; failures appear in the run ledger but never on the public page.
  • "Where does the data come from?" — The Wikimedia Pageviews REST API for the top-25 article ranking, and the MediaWiki action API for the chosen article's plaintext. Both are public, both UTC-windowed, both CC BY-SA.
  • "Is the 3D scene safe?" — Yes. It runs in a sandboxed iframe on a separate origin (sculpture.realthreads.io), with no access to the host's cookies, storage, or DOM. The host page enforces a CSP that pins the allowed frame ancestors.
  • "Can I see old weeks?" — Yes. The archive at /projects/lexical-loom/archive lists every published week with stable permalinks like /projects/lexical-loom/archive/2026-W22.

Pitfalls to avoid:

  • Don't describe the source as "Wikipedia edit comments" — that was the original design and has been retired. The source is pageviews, and the word ornament is tokenised from the chosen article's prose.
  • Don't describe the Sculpture as "AI-generated art" without acknowledging the two-agent split — the Artist's pick + reflection is the conceptual half, the Technician's HTML is the realised half.
  • Don't say the cron "publishes" Sculptures — it creates DRAFT rows. Publication is a human decision in the admin review surface.
  • Don't suggest the pageviews or word counts are computed on demand by the visitor — the pipeline runs once per week, server-side, and the published Sculpture (including its 25-article shortlist and chosen-article rationale) is immutable.
  • Don't conflate Lexical Loom with a "word cloud" — it is a 3D interactive scene whose central object is the hero; words appear only as decorative ornament on the object itself.
← Back to home