This repo is the standalone web home of Thingy, Jamie Thingelstad's sidekick
and the librarian for his public archive:
https://thingy.thingelstad.com/.
Surfaces: the chat app (/chat/), sign-in (/signin/), the live
shared-conversation pages (/c/<token> - a share link mounts the real
thread so visitors can ask follow-ups in place), and two static
content pages - /about/ (what Thingy is, the archive inventory, and how it
works) and /connect/ (adding the Librarian MCP server at
librarian.thingelstad.com/mcp to Claude, ChatGPT, Claude Code, or any MCP
client), with a technical reference for every MCP tool at
/connect/reference/. While signed in, the chat page also registers the archive tools
with the browser's model context (WebMCP, beta). The backend - retrieval,
auth, conversations, MCP - lives in the librarian-thing repo.
For product-surface alignment across the web app and Librarian API, see
docs/THINGY_SURFACES.md.
These parameters are intentionally small affordances for links from Jamie's other properties, newsletters, and future broadcast surfaces.
Highlights where the visitor came from in the cross-site navigation. Prefer passing the actual sending URL so Thingy can return the visitor to the specific page they came from.
Examples:
https://thingy.thingelstad.com/chat/?from=https%3A%2F%2Fwww.thingelstad.com%2Fhttps://thingy.thingelstad.com/chat/?from=https%3A%2F%2Fweekly.thingelstad.com%2Farchive%2Fhttps://thingy.thingelstad.com/chat/?from=https%3A%2F%2Fanother.thingelstad.com%2Fepisodes%2F
Known hostnames and legacy word aliases:
thingelstad.com,www.thingelstad.com,blog,jamieWeekly Thing,weekly.thingelstad.com,newsletterAnother Thing,another.thingelstad.com,podcastThings I’ve built,thingelstad.xyz,projects(name and URL fromweb/contracts/sites.json)
When from matches one of the known properties, that navigation link is
highlighted and labeled Return. If from is a URL, the matching link points
back to that exact URL. Unknown values are ignored.
Seeds the question box. Signed-in readers auto-submit when the link came
from one of Jamie's sites; guests, and readers arriving from anywhere else,
get the composer prefilled and press send themselves (crawler protection:
the blog's explore links were auto-firing a guest model call for every
JS-executing crawler that followed them, 2026-09-02; and any page could
link ?prompt= with words the reader never typed). The trusted referrers
are Thingy itself, thingelstad.com and its subdomains, and exactly
https://thingelstad.xyz (added 2026-10-21). When prompt is
present, Thingy skips the generated welcome and starts with the prompt
instead.
Example:
https://thingy.thingelstad.com/chat/?prompt=What%20has%20Jamie%20written%20about%20AI%3F
The preferred parameter for "Explore with Thingy" buttons on source pages.
Takes the canonical https: URL of the page the visitor is exploring. Thingy
composes the exploration question itself (so the question copy can improve
without regenerating static pages), auto-submits it after auth, and uses the
URL as the Return link. An explicit prompt overrides the composed
question; explore still supplies the return link.
Example:
https://thingy.thingelstad.com/chat/?explore=https%3A%2F%2Fwww.thingelstad.com%2F2026%2F08%2F28%2Fsome-post.html
Weekly Thing sugar: an issue number. Composes a guided-look question for that
issue and defaults the return link to the issue's archive page. Wins over
explore for the question; an explicit explore URL still sets the return
link. Non-numeric or out-of-range values are ignored.
Example:
https://thingy.thingelstad.com/chat/?issue=348
The id of the conversation to open. The chat app keeps this parameter in sync as you move between conversations - permalinks work, back/forward walk the conversations you visited, and reload restores the open one. Signed-in readers only; guests never adopt a deep-linked id. This is the one Thingy parameter deliberately not stripped before analytics loads.
The cross-site origin tag Jamie's sites put on links to each other
(ref=<origin>-<placement>, e.g. ref=weekly-issue), read by
Tinylytics' Sources report. Thingy never reads it and never strips it; the
chat's first URL sync keeps it so analytics still sees it, Back to that
entry keeps it, and later conversation pushes drop it (Jamie, 2026-10-21:
"Keep the ref. Don't remove it.").
Example:
https://thingy.thingelstad.com/chat/?prompt=What%20about%20kubb%3F&ref=weekly-issue
Links Thingy renders to the sister sites carry their own ref:
thingy-source (source cards and citation links in answers),
thingy-about (the About page's source cards), thingy-family (the
home page's family tiles), thingy-return (the chat's Return link) and
thingy-<placement> for the other template links. Identity links (the
footer h-card, rel=me) carry none.
Prefills the subscriber email field and starts the auth check.
Example:
https://thingy.thingelstad.com/chat/?email=reader@example.com
One-time magic-link token created by the Librarian API. When present, Thingy
redeems it with /auth and removes it from the browser URL after the attempt.
These links are sent by email from thingy@thingelstad.com.
The web app is a Vite-built static app. In production the generated
web/_site directory is served from a private S3 bucket behind CloudFront
(the thingy-web CloudFormation stack in infra/); there is no Node server
in production.
cd web
npm install
LIBRARIAN_API_URL=/api LIBRARIAN_STREAM_URL=/api npm run serve -- --port=8080The dev server proxies /api to the live Librarian (see librarianProxy in
web/vite.config.ts), keeping cookie sign-in same-origin on localhost.
Build:
cd web
LIBRARIAN_API_URL="$LIBRARIAN_API_URL" LIBRARIAN_STREAM_URL="$LIBRARIAN_STREAM_URL" npm run buildLIBRARIAN_API_URL and LIBRARIAN_STREAM_URL are required at build time.
Production gets them from GitHub repository variables; local shells can export
the same values from the Librarian stack outputs (librarian-thing).
Key web files:
web/index.html,web/chat/index.html,web/signin/index.html,web/about/index.html,web/connect/index.html,web/connect/reference/index.html: static route shells.web/src/app/: the SPA entry (main.tsx, TanStack Router) serving /chat, /signin, and /c/.web/src/react/: the React components (chat, sign-in, share).web/src/pages/: boot scripts for the static marketing pages.web/src/shared/: browser-side app modules.web/src/styles/: shared styles imported by the page entrypoints.web/public/: static files copied as-is to_site.web/vite.config.ts: build-time config injection and multi-page inputs.web/vite.mcp-reference.ts: renders/connect/reference/at build time from the vendored MCP surface (web/contracts/mcp-surface.json).
librarian-thing owns the versioned Librarian request, response, and SSE contract. Thingy
vendors web/contracts/librarian-api.json (synced from librarian-thing's
apps/librarian/contracts/librarian-api.json) and validates successful responses directly
against that generated artifact. The Librarian repo publishes the artifact and its SHA-256
checksum; Thingy generates CSP-safe runtime validators and TypeScript contract types from
the same JSON. Requests carry x-librarian-contract-version; the backend also returns it so
an incompatible deployment fails clearly instead of being accepted through TypeScript casts.
After changing the authoritative contract in librarian-thing:
cd web
npm run contract:synccontract:sync fetches the Librarian repo's published main artifact by default, so it
works in a clean checkout without a sibling repository. Set LIBRARIAN_CONTRACT_SOURCE to a local JSON path
when developing both repositories together. npm run contract:check verifies the checksum,
the vendored artifact, and the generated client; the scheduled drift workflow
(.github/workflows/drift.yml) runs it daily against upstream main, and the AWS deploy
gate runs contract:generate:check inside npm run verify before building. The Librarian's
contract test also verifies its generated checksum.
librarian-thing also exports its MCP surface (apps/librarian/contracts/mcp-surface.json
plus .sha256): the tools exactly as tools/list declares them, which doors offer each,
resources, prompts, error codes, budgets, and OAuth facts. Thingy vendors it as
web/contracts/mcp-surface.json, and the build renders it into static HTML at
/connect/reference/, so the page cannot drift from the server's declarations.
cd web
npm run mcp-surface:sync # from librarian-thing main
npm run mcp-surface:sync -- --local # from the sibling checkout
npm run mcp-surface:check # fail if the vendored copy is staleThe drift workflow runs mcp-surface:check daily against upstream main.
Thingy uses its own Tinylytics site ID via TINYLYTICS_SITE_UID, falling back to
the production ID in web/vite.config.ts.
Enabled Tinylytics features:
- Page hits with the Tinylytics script
(
https://tinylytics.app/js/script.jswithdata-site, no query parameters; since 2026-11-02 the options below are set in the site's Tinylytics dashboard settings, not in the URL). - Click/event tracking (
events). - Beacon delivery for outbound links (
beacon). - Tinylytics Webmention endpoint in the document head.
The script also counts the chat's history changes (pushState, replaceState, popstate) on its own, so the loader adds it once per page load and never re-injects it.
The Tinylytics script loads on every page (since 2026-09-01;
previously homepage-only, which silenced all app events). The loader
strips one-time login values and other control parameters from the URL
BEFORE the embed executes, and the session credential is an HttpOnly
cookie no script can read. Event hooks remain safe no-ops when the embed
is absent (localhost, tinylytics_ignore).
Public hit counters, country flags, and kudos are intentionally not shown in the current chat-client UI.
Before loading Tinylytics, the app strips Thingy control parameters from the browser URL after the app has read them:
emailpromptfromexploreissuescopecorpuslogin_tokenmagic_token
This keeps Tinylytics page URLs clean and avoids recording typed emails or prompts in analytics.
A successful sign-in replaces any legacy browser token with the session cookie. Saved-history requests and signed-in messages confirm (and, when needed, refresh) the session before sending. History and search show a sign-in or retry action when they fail, rather than presenting a failed request as an empty archive.
When the chat opens on a session the server no longer honors (the 30-day cookie lapsed between visits, or it was revoked), the page forgets its local signed-in state and hands off to sign-in, returning to the same conversation with the email prefilled. It never renders the rail as signed out while the account menu still names the reader.