motionboard
AGENTS.md73 starsChanged 30 days agoMITView on GitHub
The template every site is built from: React 19 + TanStack Start/Router/Query + Tailwind CSS v4 + coss ui (Base UI), prerendered and served by one Cloudflare Worker. Demo: https://template.krisyang.dev. Status and log: ~/code/home/projects/site-template.md. Shared site rules: ~/code/home/lines/sites.md. Look and tokens: DESIGN.md.
- Reads credentials
- Sends data out
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Ryan-yang125/motion-lexiconword for word, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 1
- Ryan-yang125/motion-lexicon★ 73100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- motionboardSkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
Keep other per-request work small: no heavy SSR, no large JSON parsing or image work in a Worker.
- Very specific: line 94
Add a credit pack: add an entry to src/site/plans.ts (code, credits, price in minor units, currency, Dodo product ids per mode).
- Very specific: line 95
Add a paid action (a generation kind): add a provider to src/site/generation.ts (cost, run).
- Very specific: line 96
Add a queue job of another kind: same path.
- Very specific: line 97
Add an admin view: a list query in src/core/admin/queries.ts, a route in src/routes/api/admin/ (requireAdmin first, audit() for any write), …
- Very specific: line 99
Use an existing password hash format (users moved in from an older auth): set password in src/site/auth.ts to { hash, verify }.
- Very specific: line 130
After editing content: npm run stamp (-- --minor <slug> for a typo fix), then npm test (unit tests, build, output checks) and npm run …
- Very specific: line 135
If the code is not in src/core/locale-data.ts, or src/core/messages/<code>.ts does not exist, add them in the template (copy en.ts, …
- Very specific: line 137
Add content: content/guides/<code>/…, content/legal/<code>/…, content/about/<code>/about.mdx, a <code> block in each content/tools/*.json …
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Site template: notes for agents
The template every site is built from: React 19 + TanStack Start/Router/Query + Tailwind CSS v4 + coss ui (Base UI), prerendered and served by one Cloudflare Worker. Demo: https://template.krisyang.dev. Status and log: ~/code/home/projects/site-template.md. Shared site rules: ~/code/home/lines/sites.md. Look and tokens: DESIGN.md.
Commands
npm run dev: dev server on http://127.0.0.1:3000.npm run build: writes the generated public files (robots,_redirects,_headers, llms.txt, the sitemaps, feed.xml), then builds and prerenders every page in every language into.cloudflare/output/v1/workers/default/assets.npm test: unit tests (Vitest), build, thenscripts/test.mjschecks the output: sitemap index and child sitemaps (well formed,lastmod, no priority/changefreq, each page in the child of its type), their union = exactly the indexable pages, feed.xml and changelog/rss.xml, content hashes (npm run stamp), hreflang (per page: its indexable languages plus x-default), canonical (self), titles (length, unique), descriptions (length, unique per language), exactly one h1 that contains the keyword, hub pagination pages (self-canonical, not in the sitemap, linked), item pages (ImageObject/VideoObject, media with alt and size, 4-level breadcrumb, noindex items out of sitemap, llms.txt and hub lists), the compare/alternatives/glossary/use-case/gallery/changelog pages (visible "Updated" date = JSON-LD date, disclosure line, table of 6 rows, gallery images with alt, size and lazy loading, changelog sections and feed), the about page's Organization node (/about/#org),<html lang dir>, JSON-LD (valid, types per page type, no FAQPage, visible breadcrumb = JSON-LD breadcrumb = registry), og:image, year in title =updatedyear, internal links, redirects, robots, headers, llms.txt, noindex outside the sitemap, and that no page starts its JS before LCP or links an external stylesheet.npm run seo-report: per page type (per collection for items) and language, how many pages are indexable and which are noindex, with the reasons from the quality gates, and the stale pages (comparison and alternatives older than 180 days, guides older than 365; a warning only). Reads content only, no build. Exits 1 when a collection is aboveseo.maxNoindexShare.npm run typecheck:tsc --noEmit(run after a build or dev start, which generatessrc/routeTree.gen.ts).npm run stamp: setsupdatedto today in every content file whose content changed and records the hashes incontent/.hashes.json(commit it).npm run stamp -- --minor <slug>records a change and keeps the date (typo fixes). See "Freshness, sitemaps, feed".npm run deploy: build,cf deploy(never wrangler), crawler check (npm run check-crawlers), IndexNow ping (npm run indexnow;-- --allpings every URL).npm run e2e: the money path end to end in Chromium (Playwright) against the built Worker on http://127.0.0.1:3000 with the mocks on: sign up → verification email → signup credits → buy a pack through the mock Dodo checkout (real signed webhook into the real handler) → replayed webhook grants nothing → generate (hold → commit) → a failing generation is refunded → admin bootstrap, sign-in, credit adjust, audit row. Passing =1 passed. Stopnpm run devfirst (same port). Against the live demo:E2E_BASE_URL=https://template.krisyang.dev E2E_BOOTSTRAP_TOKEN=$(security find-generic-password -s site-template-admin-bootstrap -a template -w) npm run e2e. Playwright prints request headers when a step fails, so rotate the bootstrap token after a failed live run.npm run db:generateafter editingsrc/core/db/schema.ts(writesmigrations/NNNN_*.sql);npm run db:migrate:local/db:migrate:remoteapply them (cf d1 migrations apply).npm run lighthouse -- --url <url> [--perf 99]: local Lighthouse gate (95 per category by default). Its performance numbers run behind the local proxy and come out lower; pagespeed.web.dev mobile is the reference for the 99 gate (the anonymous PSI API quota is often used up, so use the web page).
Who owns what
Sites merge template updates, so the split matters:
- Template-owned (sites do not edit; fix it in the template and merge):
src/core/**,scripts/**,src/router.tsx,vite.config.ts,vitest.config.ts,tsconfig.json,components.json,DESIGN.md, this file's template sections. - Site-owned (each site edits freely):
site.config.ts,cloudflare.config.ts,src/site/**,content/**,public/**(except the generated files), the route files a site adds,README.md, the "Site notes" section at the end of this file. - Shared route files under
src/routes/(root, locale layout, tools, guides, hubs, about, legal) ship with the template; a site may change them, accepting a merge conflict when the template changes them too.
Where things are
site.config.ts: domain, name, languages, home title/description, OG image, contact email, PostHog key variable, IndexNow key, llms.txt switch, CSP allowlist. The only place for these values; scripts import it too.- i18n: the language list is
languages(+defaultLang) insite.config.ts; everything that depends on a language reads it, so adding a language changes no code.src/core/locale-data.ts(registry: hreflang, og, intl, dir, name per URL code),src/core/i18n.ts(pure rules: default language at the root, others under/<lang>/; paths passed around are default-language paths with leading and trailing slash;HTML_LANG,OG_LOCALE,DIR,INTL_LOCALE,formatDate,formatNumber; it checks the config on import and throws an error saying what to fix),src/core/locale.tsx(useLocale(),useLocaleParam(),useMessages(),useCoreMessages()). Routes live undersrc/routes/{-$locale}/;route.tsxthere 404s unknown prefixes and the default language's prefix. UI strings:src/core/messages/<code>.ts(one file per language: shell, page templates, account/app pages, emails;en.tsdefines the type),src/site/messages.ts(site,Record<Locale, …>). Admin is English only. Links in the current language:<Link to="/{-$locale}/tools/$slug/" params={{ locale: useLocaleParam(), slug }}>. - No fallback for content: a page exists in a language only when that language has content for it (
pageLocales(page)insrc/core/pages.ts: the languages with a title). A missing translation means no page in that language (404, no sitemap entry, no hreflang), never another language's text under/<code>/. Home exists in every language (SITE.titleanddescriptionneed every language). The tools and guides hubs exist in a language only when they have a text block there and at least one member. The language switcher links to the same page where it exists, else to that language's home. - SEO:
seoHead()and JSON-LD helpers insrc/core/seo.ts; every route'shead()uses it.seoHead({ breadcrumb })writes the BreadcrumbList from the sameCrumb[]the page shows (trail()and<Breadcrumb crumbs>insrc/core/pages/HubPage.tsx). Every page's graph points at the Organization by@id(ORG_ID,/about/#org). There is no FAQPage JSON-LD: the FAQ is visible content only. The page list for the sitemap, llms.txt and redirects issitePages()insrc/core/pages.ts(each page hastype,keyword,indexable/reasons,lastmod,breadcrumb); extra static pages go insrc/site/pages.ts(ExtraPage). The sitemaps are written from the same list byscripts/generate.mjs(see "Freshness, sitemaps, feed"); the TanStack sitemap plugin is off. - Content contract:
src/core/content/schema.ts(zod). Every tool JSON and MDX frontmatter is validated whensitePages()reads it; a bad file stops the build with its path and field. Each indexable page has per languagekeyword(unique per language across the site, contained in the title),demand({source, note, checked}: where the demand for the keyword was checked;noneis not allowed on tools and guides),title(60 characters, 32 CJK, without the site name),description(120-160, 50-90 CJK),lede, optionalh1(default: the keyword); pluspublishedandupdated(YYYY-MM-DD). Guides addkind. In MDX frontmatter, nested values (demand,sources,faq,products,table,seeAlso) are one-line JSON. - Page types and templates (each route is a thin file over a template in
src/core/pages/, built from the blocks insrc/core/ui/page/: Breadcrumb, Byline, FaqList, RelatedGrid, StepsList, SourcesList, Pagination, Evidence, Examples):- Tool:
content/tools/<slug>.json(ToolPage.tsx; a tool needs a widget id fromsrc/site/tools/index.ts, a page without a tool is a guide); fields beyond the common ones:steps(3-4),examples,limits,sections(1-3),faq,related. - Guide, about, legal: MDX in
content/guides/<lang>/,content/about/<lang>/about.mdx,content/legal/<lang>/(DocPage.tsx). MDX can use<Evidence caption="…">for first-hand tables and images. Guides takesourcesandrelated(slugs, guides then tools) in the frontmatter; guide and about takefaq. - Hub:
content/hubs/<id>.json(HubPage.tsx; id =tools,guidesor a collection id) andcontent/hubs/<collection>/<category>.jsonfor a category hub:keyword,demand(noneallowed),intro, optionalname(breadcrumb name of a collection or category hub),sections/faq,pageSize(default and maximum 60). Members are the hub's indexable pages. A collection hub links its category hubs. Further pages are/<hub>/page/<n>/(route filespage/$n.tsx): prerendered, self-canonical, a numbered title and h1, never in the sitemap, linked with plain<a href>. A hub exists in a language only when it has a text block there and at least one member. Without a hub file there is no hub page and the Tools/Guides breadcrumb level is left out. - Item (programmatic page): a collection declared in
src/site/collections.ts, one file per item incontent/collections/<id>/<slug>.json, at/<id>/<slug>/(ItemPage.tsx, loaderloadCollectionPage). Fields:category(category ids),tags, optionalrelated(slugs), optionalmedia(image or video),data(the collection's zod schema), and per languagename, optionalownName,keyword,demand,title,description,lede,body(blocks{h2, body}),alt(required with media),faq(0-4). The language block exists only when it hasname,keywordandbody. Order: breadcrumb (Home, collection, category, name), h1 =name, lede, media, the site'sitemDataslot, body, FAQ, related items (3 to 8: the item'srelated, else same category, then shared tags, chosen at build time). JSON-LD: BreadcrumbList and ImageObject or VideoObject (uploadDate=published) for the main media; no FAQPage. - Compare (
content/compare/<lang>/<a>-vs-<b>.mdx,/compare/<a>-vs-<b>/,ComparePage.tsx), glossary term (content/glossary/<lang>/<slug>.mdx,/glossary/<slug>/,GlossaryPage.tsx): MDX with one-line JSON frontmatter values. Alternatives (content/alternatives/<product>.json,/alternatives/<product>/), use case (content/use-cases/<slug>.json,/for/<slug>/), gallery (content/gallery/<slug>.json,/gallery/<slug>/): JSON with a text block per language like a tool. Changelog:content/changelog/changelog.json,/changelog/(entries{date, slug, title, items}, newest first, 50 per page,/changelog/page/<n>/, RSS at/changelog/rss.xml). Fields and minimums: "Adding a page". A compare hub (content/hubs/compare.json,/compare/) and a glossary index (content/hubs/glossary.json,/glossary/) use the hub machinery and exist only when the site adds those hub files. - Slots:
src/site/slots.tsx(PageSlotsinsrc/core/ui/page/slots.ts:afterLede,afterContent,card,itemData) lets a site add visuals to these templates without forking a route. - Admin slots (types in
src/core/admin/types.ts):src/site/admin.ts(adminSite.nav, read in the browser) appends entries to the admin nav (pages insrc/routes/admin/<name>.tsx);src/site/admin-jobs.ts(adminJobs, server only) replaces thejobstable as the admin's job source (dashboard counts, Jobs page, user page jobs). Unset = template behaviour. Test:src/core/admin/queries.test.ts.
- Tool:
- Quality gates:
src/core/seo/quality.tsdecides per page and language whether it may be indexed (minimum content per type: tool 250 words / 450 CJK characters, 3-4 steps, 4 FAQ items, 1 example; guide 600 / 1100, 2 H2, 3 in-copy internal links, 1 first-hand element; hub 6 indexable members and a 50-word intro, lowered withseo.hubMinMembersinsite.config.ts; about 150 / 280; legal 100 / 180 ornoindex: true; item 80 words / 150 CJK characters of its own text (lede, body, FAQ,dataText), an image or video or a data block of 10 entries, 3 related items, no near-duplicate in its collection and language: 5-word shingles, 4-character for CJK, Jaccard above 0.6 fails, and the later item of a pair is the one that fails; compare, alternatives, glossary, use case, gallery and changelog: see "Adding a page"; their near-duplicate check runs within the type and language, at 0.4 for use cases). An item below its minimum is not a build error; the build fails only when more thanseo.maxNoindexShare(default 0.2 insite.config.ts) of a collection's items in one language are noindex, with a message naming the collection and the noindex items. A page below its minimum is still built and linkable, but noindex (noindex,follow, no canonical or hreflang), out of the sitemap, llms.txt, hub lists and the hreflang sets of its other languages.SitePage.noindex(language → reasons),SitePage.indexableandindexableLocales(page)carry the result; the app reads it from the content registry modules built insrc/core/pages.ts. Runnpm run seo-reportto see the reasons. Registry modules:virtual:content-indexis loaded on every page and holds only what the shell and heads need (languages and noindex state of every page except collection items, hub names, categories; no descriptions;seoState(),isIndexable(),pageExists()insrc/core/content/exists.ts). Text for lists loads on demand inside route loaders:virtual:content-lists(tools and docs with descriptions) andvirtual:content-collection/<id>(one collection's items: names, descriptions, languages, noindex, related, plus a lazy import per item file;loadCollection()insrc/core/content/collection.ts). So the every-page bundle does not grow with the number of items, andmembers(),relatedEntries()andrelatedItemEntries()are async: call them in loaders only. Restartnpm run devafter adding a content file. - Content folders:
content/{tools,guides,legal,about,hubs,collections,compare,alternatives,glossary,use-cases,gallery,changelog};content/renamed.json,content/videos.json,content/.hashes.json. Page blocks added for these types:CompareTable(src/core/ui/page/), templatesComparePage,AlternativesPage,GlossaryPage,UseCasePage,GalleryPage,ChangelogPage(src/core/pages/), JSON loaderssrc/core/content/pagefiles.ts,definedTermLdinsrc/core/seo.ts, stale pages insrc/core/seo/freshness.ts. Demo images for the gallery:public/gallery/. - Generated public files:
scripts/generate.mjs(run by the build):robots.txt,_redirects(fromcontent/renamed.json, every language, with and without trailing slash),_headers(security headers + CSP fromsrc/core/headers.ts, immutable caching for/assets/*and/fonts/*),llms.txt,sitemap.xml(index) with its child sitemaps,sitemap-video.xml(fromcontent/videos.jsonand the video items),feed.xml,changelog/rss.xml. Everypublic/sitemap*.xmlis generated. They are gitignored. - Analytics:
src/core/track.ts(PostHog capture API, cookieless, no SDK; no key = console +window.__events),src/core/Analytics.tsx($pageview, errors →$exception,data-ctalink clicks), page types insrc/site/analytics.ts. Every event carriessiteandlang. Events use PostHog's cookieless mode (distinct_id: $posthog_cookieless, PostHog hashes the id server-side per day, nothing stored in the browser), the landing URL's UTM/click-id/refparams, and the country from/cdn-cgi/trace(the first flush waits up to 1.5 s for it); bot user agents send nothing. Cloudflare Web Analytics is turned on per zone in the dashboard, not in code. - Shell:
src/core/shell/(Header, Footer, ThemeToggle, LanguageSwitch, NotFound), nav links insrc/site/nav.ts. Theme:.darkclass set before paint byTHEME_SCRIPT(src/core/theme.ts);SITE.theme.default'system' follows the system preference, 'light' stays light until the visitor picks dark;SITE.theme.colorgives the theme-color metas. - coss ui:
src/core/ui/(shadcn CLI,components.json, registry@coss). Only components in use are kept: every class insrc/ends up in the CSS inlined in every page. Add withnpx shadcn@latest add @coss/<name>.
Performance rules (PSI mobile 99+)
- Workers Paid since 2026-11-28 ($5/month, spend cap $5, alert at $1). Every site and job shares one account. Included each month: 10M requests and 30M CPU-ms; D1 25B rows read, 50M written, 5 GB; 1,000 cron triggers. A request may use 30 s CPU by default (5 min max). Going over the included amounts costs money, and the old Free limits no longer stop a runaway job: a CPU-heavy bug or a loop over a table now shows up on the bill. The rules below keep usage small.
- Public pages, sitemaps, feeds and llms.txt are prerendered static assets: Cloudflare serves them from its cache without running the Worker. Never move a public page or a sitemap to SSR or an API route.
- D1 on a request path: no full-table scans. Every
WHERE,JOINandORDER BYcolumn has an index (src/core/db/schema.ts). AlwaysLIMIT, and paginate with a cursor, notOFFSET. Check a new query withEXPLAIN QUERY PLAN: it must saySEARCH ... USING INDEX, neverSCAN. - Bulk jobs (imports, backfills, migrations of data, cron sweeps): estimate rows read and written first (rows × passes) and write the estimate in the commit or PR. Process only changed rows, in small batches. Stop at the first error. Never loop over a whole table per item.
- Write only when data actually changes. Cron, queue and retry paths guard every
UPDATEwith the old value in itsWHERE(e.g.status = 'held'), so a repeat or redelivery writes 0 rows. Never rewrite a row with the values it already has. Inserts that may repeat useonConflictDoNothing. The ledger (src/core/credits/ledger.ts), cron, queue and webhook follow this. - Imports into D1: one pass with foreign keys and triggers off (
PRAGMA defer_foreign_keys = ONand drop/recreate triggers around the load, or load into tables before they get triggers). Measure rows read and written on a small table first (meta.rows_read/rows_writtenfromcf d1 query), multiply by the real row count, and check the total is small against the monthly included amounts before running the full import. - R2 bills storage and operations above its free tier (10 GB, 1M Class A, 10M Class B per month). Every upload goes through
putObject(src/core/storage/r2.ts), which refuses objects overMAX_OBJECT_BYTES(10 MB). Every prefix that grows has a bound: a rate limit on what creates objects (jobs: 20 per user per minute), and deletion of what expires (the cron deletes mock emails after a day). No per-requestliston a large prefix. - Password hashing: scrypt at N=2^14, r=8, p=5 (
src/core/auth/hash.ts, OWASP-equivalent, ~115 ms CPU). Cloudflare's WebCrypto refuses PBKDF2 above 100k iterations in production, though local workerd allows it. Each hash stores its parameters, so older PBKDF2 hashes keep verifying, and a sign-in with one stores a new hash (template hasher only). A site hasher (src/site/auth.ts) keeps its own format. - Keep other per-request work small: no heavy SSR, no large JSON parsing or image work in a Worker.
- Every public page is prerendered; all CSS is inlined in
<head>(?inlineimport in__root.tsx); fonts fromSITE.fonts(src/core/head.ts): bodyinter(self-hosted Inter Latin, preloaded) orsystem(nothing loaded), plus an optionaldisplayheading font (h1-h3, prose headings,font-heading), preloaded; every self-hosted font has a metric-matched local fallback, so the swap causes no layout shift. Site colours, radius and surfaces: override the coss tokens insrc/site/styles.css. src/core/Scripts.tsxreplaces TanStack's<HeadContent>/<Scripts>: the app JS (entry + modulepreloads) is only added once every element with anelementtimingattribute in the first viewport has painted (3 s fallback). Mark the LCP element withelementtiming="lcp"(images alsofetchPriority="high"). Otherwise Lighthouse counts the JS toward LCP and mobile scores drop to 90–95 (seen on Motionboard).- Popup components (menu, select, dialog, sheet, toast, tooltip, popover) never render in the first screen of a content page and are never imported by the shell; FAQs are native
<details>; widgets load after hydration inside a fixed-height slot. - Measured 2026-11-26 on template.krisyang.dev, PSI mobile: home 100/100/100/100, tool page 100/100/100/100.
Freshness, sitemaps, feed
npm run stampafter editing content. Each tool JSON, guide, legal, about, hub and collection item file has a hash incontent/.hashes.json(the content withoutupdated). Changed files getupdatedset to today, solastmodstays true.npm testfails while a hash differs, naming the file. A typo fix:npm run stamp -- --minor <slug>(the slug names every language of the page, or<collection>/<slug>). New files are recorded as they are. Pages fromextraPagesare not stamped; they set their ownlastmod. A new page type adds its content folder toSTAMP_DIRSinsrc/core/seo/stamp.ts. The changelog'supdatedmust not be before its newest entry; itslastmodisupdated.sitemap.xmlis an index. Children:sitemap-tools.xml(tools),sitemap-guides.xml(guides),sitemap-hubs.xml(all hubs, page 1 only),sitemap-<collection>.xml(items of a collection),sitemap-items.xml(item pages without a collection),sitemap-pages.xml(home, about, legal, compare, alternatives, glossary, use case, gallery, changelog),sitemap-video.xml. Search Console shows the indexed share per file. A child over 45,000 URLs continues insitemap-<name>-2.xml; an empty child is not written. Every URL haslastmodand the hreflang alternates of its head, no priority or changefreq. A hub'slastmodis its newest member'supdated. Code:src/core/seo/sitemaps.ts./feed.xmlis RSS 2.0: guides, compare and alternatives pages and the changelog entries in the default language, newest first (pubDate=updated, or the entry's date; an entry links to its#<date>-<slug>anchor), at most 50 items, linked from every page's head./changelog/rss.xmlholds the changelog entries only and is linked from the changelog page.src/core/seo/feed.ts, written byscripts/generate.mjs.- Deploy: after
cf deploy,scripts/check-crawlers.mjsfetches/as Googlebot, Bingbot, OAI-SearchBot, PerplexityBot, Claude-SearchBot and Applebot and expects 200; a block fails the deploy and names the agent (turn off Cloudflare "Block AI bots").SITE.seo.allowTraining: falsemakes robots.txt disallow GPTBot, ClaudeBot and Google-Extended. - IndexNow pings only URLs whose
lastmodchanged since the last successful ping (.indexnow-sent.json, gitignored; without it, the first run pings everything).
Accounts, credits, payments (layer 1)
Everything runs in the same Worker as the pages: src/server.ts is the entry (fetch → TanStack Start, queue → job consumer, scheduled → cron every 10 min). Turn accounts off with SITE.accounts.enabled = false (the header link and account APIs go away).
- Env:
src/core/server/env.ts(AppEnv,appEnv(),flag()); bindings incloudflare.config.ts. Local values in.dev.vars(copy.dev.vars.example). Only bindings declaredbindings.secret()take local values from.dev.vars(text bindings cannot be overridden locally), which is whyBETTER_AUTH_URLis a secret. Production secrets:cf workers secrets update <NAME> --worker <worker> --type secret_text --text …forBETTER_AUTH_URL(https://<domain>),BETTER_AUTH_SECRET,ADMIN_BOOTSTRAP_TOKEN, and when usedDODO_PAYMENTS_API_KEY,DODO_PAYMENTS_WEBHOOK_SECRET,RESEND_API_KEY,TURNSTILE_SECRET_KEY,POSTHOG_KEY,GOOGLE_CLIENT_ID/SECRET. The template demo's values live in the macOS keychain (site-template-*). Never print or commit them. - Mocks (
MOCK_PAYMENTS,MOCK_EMAIL,MOCK_GENERATION=true): a mock Dodo checkout page (/api/mock/dodo/checkout) whose Pay button signs a Dodo-format webhook with the webhook secret and hands it to the real webhook handler; emails stored in R2 undermock-emails/and readable atGET /api/mock/emailswith thex-bootstrap-tokenheader; generation bysrc/core/jobs/mock-provider.ts(a prompt containing "fail" fails). The template demo runs fully on mocks. - DB:
src/core/db/schema.ts(Drizzle, D1). Better Auth tables +credit_accounts,credit_transactions(append-only, unique(type, source_type, source_id)so nothing applies twice),credit_reservations,payment_orders,payment_webhook_events,jobs,rate_limits,admin_users,admin_sessions,admin_audit_logs. - Auth:
src/core/auth/server.ts(Better Auth: email + password with required verification, Google when its keys are set, Dodo plugin, signup credits in the user-create hook),session.ts(getSessionUser,requireUser),client.ts. Site hooks insrc/site/auth.ts(authSite): password hasher, basePath, cookie prefix, trusted origins, account options, extra plugins, verification mail, afterUserCreated; empty = template behaviour. Pages:src/routes/{-$locale}/{login,signup,forgot-password,reset-password,account,app}.tsx(noindex, rendered per request, never prerendered:PRIVATE_PATHSinsrc/core/pages.ts). - Credits: only
src/core/credits/ledger.tschanges balances (grant,hold,commit,refund,adjust; each one D1 batch guarded so a failed check changes nothing). Tests:ledger.test.tson in-memory SQLite. - Payments:
src/core/billing/(checkout.tscreates an order then a Dodo checkout session;webhooks.tsverifies amount/currency/product, records the event once, grants credits once, marks the order paid; refunds and failures update the order;handleDodoWebhookRequest(request, secret)receives Dodo at a site's own path). Packs:src/site/plans.ts. Portal:POST /api/billing/portal. - Jobs:
POST /api/jobs→src/core/jobs/create.ts(Turnstile, rate limit, hold credits, queue message) →queue.ts(runs the provider fromsrc/site/generation.ts, stores the file in R2, commits; retries 3×, then fails and refunds) →cron.tssettles stale reservations. Files:GET /api/files/<key>(owner only). - Abuse:
src/core/security/rate-limit.ts(D1 fixed window, one atomic upsert),turnstile.ts(skipped when no secret key is set). - Email:
src/core/email/send.ts(Resend HTTP API),templates.ts(verify, reset, receipt; per locale). - Server analytics and errors:
src/core/server/track.ts(trackServer,captureServerException→ PostHog$exception). Server events carry$lib: posthog-server, and inside a request also its user agent andrequest.cf.country. - Admin: separate identity (not Better Auth).
src/core/admin/+src/routes/api/admin/*+src/routes/admin/*(English, no site chrome). First admin:curl -X POST https://<domain>/api/admin/bootstrap -H "x-bootstrap-token: …" -H 'content-type: application/json' -d '{"email":"…","password":"…"}'(also resets that admin's password and sessions). Every credit adjust and login is in the audit log.
Where layer 1 came from
Ported from ShotFrames (~/Documents/imagesaas/apps/api/src), same semantics, rewritten for Drizzle + TanStack Start server routes:
credits/ledger.ts←services/credits.ts+ the reserve/commit/refund part ofservices/images.tsbilling/*←services/payments.ts,services/payments/,domain/payment-plans.ts(Dodo through@dodopayments/better-authinstead of the hand-written client)auth/server.ts←services/better-auth.tsadmin/*,routes/api/admin/*←services/admin-auth.ts,routes/admin*.ts,utils/crypto.tssecurity/rate-limit.ts←services/rate-limit.ts(made atomic);security/turnstile.ts←services/turnstile.tsserver/track.ts←services/track.tsdb/schema.ts←migrations/0001_initial.sql,0005_admin_identity.sql,0022_payment_provider_orders.sql,0023_better_auth.sqlNew here: the mock Dodo checkout, mock emails in R2, the Playwright e2e, account/app pages (coss ui). Layer 0 pieces from Motionboard:src/core/Scripts.tsx(JS after LCP), the font fallback approach,scripts/test.mjschecks, IndexNow script.
Recipes
- Add a credit pack: add an entry to
src/site/plans.ts(code, credits, price in minor units, currency, Dodo product ids per mode). Create the product in the Dodo dashboard (test mode first) and paste its id.npm run e2ebuysplans[0]. - Add a paid action (a generation kind): add a provider to
src/site/generation.ts(cost,run); the client posts{ kind, input }to/api/jobs. Nothing else changes: holding, retries, refunds and storage are core. - Add a queue job of another kind: same path; a provider's
runcan do any work that returns a file. Work that returns no file belongs in a new core handler; ask before adding one. - Add an admin view: a list query in
src/core/admin/queries.ts, a route insrc/routes/api/admin/(requireAdminfirst,audit()for any write), a page insrc/routes/admin/usingsrc/core/admin/ui.tsx, and a link insrc/routes/admin/route.tsx. - Change the schema: edit
src/core/db/schema.ts,npm run db:generate,npm run db:migrate:local, test, thennpm run db:migrate:remotebefore deploying. - Use an existing password hash format (users moved in from an older auth): set
passwordinsrc/site/auth.tsto{ hash, verify }; core passes it to Better Auth asemailAndPassword.password. Test:src/core/auth/password.test.ts(ShotFrames'i2s-pbkdf2:<salt>:pbkdf2-sha256:<n>:<hash>format through a real sign-in). - Receive the payment webhook at another path (e.g. a URL already registered in Dodo live mode): add a site route file, e.g.
src/routes/payments/webhooks/dodo.ts, whosePOSTreturnsauth().handler(new Request(new URL('/api/auth/dodopayments/webhooks', request.url), request)). Signature checks and idempotency are unchanged. - Move existing credit data in: map each user's balance to one
credit_accountsrow (available,frozen); history rows tocredit_transactionswithtypegrant|purchase|hold|commit|refund|adjust,source_type/source_id(dedupe on the unique(type, source_type, source_id)first), andavailable_after/frozen_after; open holds tocredit_reservationswith statusheld(otherscommitted/refunded). The balance is thecredit_accountsrow, kept byledger.ts; the DB has no triggers, so drop any balance triggers from the old database. - Go live with real payments: in Dodo create the live products and a webhook to
https://<domain>/api/auth/dodopayments/webhooks; setDODO_PAYMENTS_ENVIRONMENT=live_mode,MOCK_PAYMENTS=falseand the two Dodo secrets. Real payments need Rui's OK.
Adding a page
Pick the type from the table, record where the demand for the keyword was checked, create the files, then npm run stamp, npm test, npm run seo-report. The slug is ASCII kebab-case and the same in every language; a language with no text block or file has no page. Paths below are default-language paths.
| Type | Files to create | URL | Fields beyond the common ones | Minimums (below: noindex) |
| Tool | content/tools/<slug>.json, widget in src/site/tools/index.ts | /tools/<slug>/ | tool, steps, examples, limits, sections, faq, related | 250 words, 3 to 4 steps, 4 FAQ, 1 example |
| Guide | content/guides/<lang>/<slug>.mdx | /guides/<slug>/ | kind, sources, related | 600 words, 2 H2, 3 internal links, 1 first-hand element |
| Hub | content/hubs/<id>.json (tools, guides, compare, glossary, a collection) | /<id>/ | intro, sections, faq, pageSize | 6 indexable members (glossary 8), intro 50 words |
| Item | content/collections/<id>/<slug>.json ("Add a collection") | /<id>/<slug>/ | category, media, data, body, alt | 80 words, media or 10 data entries, 3 related |
| Compare | content/compare/<lang>/<a>-vs-<b>.mdx | /compare/<a>-vs-<b>/ | products (2, each ours or third-party), verdict, table (factor, a, b, chooseIf), pricing (asOf, a, b), sources | 700 words, 6 table rows, 3 sources |
| Alternatives | content/alternatives/<product>.json | /alternatives/<product>/ | product, criteria, entries (name, url, bestFor, price, relation, notes), sections, sources, faq | 5 entries of 40 words each, 600 words, 3 sources |
| Glossary | content/glossary/<lang>/<slug>.mdx | /glossary/<slug>/ | definition, example (text, caption), seeAlso, useIt (name, path) | definition 40 to 60 words, definition and body 200 words, 3 see-also, 1 try-it link |
| Use case | content/use-cases/<slug>.json | /for/<slug>/ | audience, problems (3), workflow (3 to 6), examples, cta, faq (3 to 6) | 400 words, 3 examples of 20 words each, near-duplicate at 0.4 |
| Gallery | content/gallery/<slug>.json, images in public/ | /gallery/<slug>/ | intro, entries (media, alt, title, caption, facts, link), faq | intro 80 words, 6 entries with 15-word captions |
| Changelog | content/changelog/changelog.json | /changelog/ | entries (date, slug, title, items), newest first | 1 entry |
CJK minimums are 1.8 times the word counts (compare 1260, alternatives 1080, glossary 360, use case 720, gallery intro 144). A text block in JSON has keyword, demand, title, description, optional h1, lede; the file has slug, published, updated (use YYYY-MM-DD of today, UTC). In MDX the same fields are frontmatter lines.
Rules for the copy: write for a term someone searches, and check page 1 shows pages of the same type (record it in demand.note; none is only for hubs, about, legal and the changelog). The title is at most 60 characters (30 CJK) and contains the keyword; the description is 120 to 160 characters (50 to 90 CJK) and answers the query in the first clause; the lede answers in one or two sentences. The h1 contains the keyword. H2s name the reader's questions. Every fact about another product has a source with the date checked, and a price appears only when a source states it; write "not checked" otherwise. Pages with one of our products next to third-party ones show the disclosure line by themselves (relation: 'ours'). Alt text describes the image (at most 125 characters). A year in a title only on guides and comparisons, and it must be the year of updated. The FAQ is visible text; there is no FAQPage markup.
What fails the build (npm run build, npm run seo-report): invalid JSON or frontmatter; any schema error (missing field, bad date or slug, title width over 60, description length, keyword not in the title or h1, demand: none outside hub/about/legal/changelog, a file name that differs from its slug, a compare slug that is not <a>-vs-<b>, updated before published, a changelog out of order or with a repeated <date>-<slug> or an updated before its newest entry); a keyword, title or description used twice in a language; a collection with more noindex items than seo.maxNoindexShare. npm test also fails while content/.hashes.json differs from the content (run npm run stamp) and on any post-build check.
What becomes noindex (the page is built and linkable, with noindex,follow, no canonical or hreflang, and left out of the sitemap, llms.txt, hub lists and feeds): content below the minimums above, a near-duplicate of an older page of the same type and language (the later one fails), a hub with too few indexable members, a legal page with noindex: true. npm run seo-report lists each with its reasons.
JSON-LD (always plus BreadcrumbList, from the visible breadcrumb): compare and alternatives Article, glossary DefinedTerm, use case, gallery and changelog the breadcrumb only. "Updated <date>" is visible on guides, compare, alternatives, glossary, use case and the changelog, and is the same date as dateModified. Sitemap child for all six: sitemap-pages.xml. Hubs: add content/hubs/compare.json once there are 6 comparisons and content/hubs/glossary.json at 8 terms (without the file the page has no hub and the Compare/Glossary breadcrumb level is left out); other types have no hub. Inbound links come from the copy of other pages and from src/site/nav.ts; the demo content links to its pages from the case-converter guide.
After editing content: npm run stamp (-- --minor <slug> for a typo fix), then npm test (unit tests, build, output checks) and npm run seo-report (noindex reasons, stale pages). Replace the demo pages with the site's own; the template's tests for them run only while the demo files exist.
Add a language
No code changes.
site.config.ts: add the code tolanguagesand its text totitleanddescription.- If the code is not in
src/core/locale-data.ts, orsrc/core/messages/<code>.tsdoes not exist, add them in the template (copyen.ts, translate) and merge into the sites. - Fill the new entries in
src/site/messages.ts,src/site/nav.tsand the otherRecord<Locale, …>data of the site (npm run typechecklists them). - Add content:
content/guides/<code>/…,content/legal/<code>/…,content/about/<code>/about.mdx, a<code>block in eachcontent/tools/*.jsonandcontent/hubs/*.json. Pages without a translation do not exist in that language. npm test.
Add a collection
A collection is a set of programmatic pages, one per item (symbols, recipes, prompts), each with its own data. The demo is symbols.
src/site/collections.ts: adddefineCollection({ id, categories, data, dataEntries?, dataText? }).idis the folder name and the URL segment (/<id>/<slug>/);categoriesare the category ids;datais a zod schema for thedataof an item;dataEntries(data)returns the entries of its data block (10 or more count as main content when there is no media);dataText(data)returns item-specific text insidedata.- Routes: copy
src/routes/{-$locale}/symbols/(four files) and renamesymbolsto the id. - Hubs:
content/hubs/<id>.jsonandcontent/hubs/<id>/<category>.jsonfor every category. A slug cannot be a category id. - Items:
content/collections/<id>/<slug>.json(fields in "Page types", example incontent/collections/symbols/). Media files go inpublic/. Show the data in theitemDataslot insrc/site/slots.tsx. npm run seo-reportlists every noindex item with its reasons;npm test.
An item is noindex (kept out of the sitemap, llms.txt, hub lists and hreflang, still built and linkable) when it has fewer than 80 words / 150 CJK characters of its own text, has no media and fewer than 10 data entries, has fewer than 3 related items, or is a near-duplicate of an older item. The build fails when more than seo.maxNoindexShare of a collection's items are noindex: fix the items, do not raise the limit. A schema error, a duplicate keyword, title or description also fails the build. A language the item has no text for has no page.
Starting a new site from the template
gh repo create krisyangdev/<slug> --privateand clone the template into~/code/sites/<slug>(git clone git@github.com:krisyangdev/site-template.git <slug>), thengit remote rename origin templateandgit remote add origin <new repo>;git push -u origin main.- Edit
site.config.ts(id, name, domain, worker, languages, copy, email, IndexNow key +public/<key>.txt),src/site/styles.css(--brandlight/dark),public/favicon.svg,public/og.png,cloudflare.config.ts(bindings). - Replace the demo content in
content/,src/site/home/,src/site/tools/,src/site/nav.ts. npm test,npm run deploy, check the live URL and PSI.
Taking template updates into a site
git fetch template && git merge template/main, resolve conflicts (site-owned files keep the site's version), npm install, npm test, deploy. Make shared fixes in the template first, then merge them into each site; never fix src/core/ only in a site.
Adopting the template in an existing site (e.g. Motionboard)
Add the template as a remote and merge with unrelated histories (git remote add template …; git fetch template; git merge template/main --allow-unrelated-histories), or start from a fresh clone and copy the site's content in. Then move: site config values into site.config.ts; the duplicated /zh/ route tree into {-$locale} routes; seo.ts/track.ts/Scripts.tsx/scripts to the core versions; hand-written CSS to Tailwind + coss tokens; keep site-only parts (data generators, video components, D1 bindings) under src/site/ and scripts/site/. Acceptance: same URLs (sitemap diff empty), npm test green, PSI mobile ≥ 99 on home and one deep page.
Decisions (2026-11-26, template dev)
- npm, single package (no monorepo), Node 22 (type stripping for
site.config.tsin scripts). - i18n with the official
{-$locale}optional segment and plain typed dictionaries per locale (no Paraglide compile step): our sites carry few UI strings; page text lives in content files that are loaded per page. - MDX through
@mdx-js/rollup+import.meta.glob(no Content Collections): fewer moving parts, one chunk per document. - Fonts: Inter only (coss default), Latin subset self-hosted; Geist Mono dropped for the system mono.
- coss
html { font-sans font-mono }from the registry was a bug (everything rendered mono); fixed tofont-sansinapp.css. - Template demo runs on
template.krisyang.dev(a throwaway subdomain of an existing zone).
Site notes: Motionboard
motionboard.app: 58 launch-film shot recipes and a free HyperFrames skill for Claude Code and Codex. Status, next steps and log: ~/code/home/projects/motionboard.md. This repo is built from the template: the template remote is site-template (a local path until it moves to GitHub), updates come in with git fetch template && git merge template/main. Sections above are the template's; this section is Motionboard's.
What lives where
- Config:
site.config.ts(template shape: domain, name, id, languages, home title and description,ogImage= the hero film cover, IndexNow key,llmsTxt, CSP with the media host). Motionboard extras (media host, GitHub URL, skill install command, H1 copy) are insrc/site/config.ts.cloudflare.config.tsis Motionboard's own (Workermotionboard, D1DB) and must not import anything the app imports: the Cloudflare Vite plugin adds every file the config imports to Vite'sfs.deny, and the dev server then answers 500 ("Failed to load url /site.config.ts"). Its name and domain repeatSITE.workerandSITE.domain;scripts/site/test.mjschecks they match. - Content: recipes are the template collection
recipes(declared insrc/site/collections.ts): one file per recipe,content/collections/recipes/<slug>.json, with the item text per language (keyword, demand, title, description, lede = one-line definition, name = common name, ownName = Motionboard shot name, body = how-to, alt = poster description, faq) anddata(number, film id, original samples, and the long recipe text per language: why, spec, prompt, says, vs). The template gates, lists, breadcrumbs and JSON-LDs them like any collection. Hubs and guides incontent/pages/<id>.json(schema insrc/site/data/content.ts), 301s incontent/renamed.json(default-language paths, the template adds every language and the no-slash form). - Routes:
src/routes/{-$locale}/has home,recipes/$slug(Motionboard's ownRecipePageon the template'sloadItem,relatedItemEntriesanditemHead; there is no/recipes/hub, it 301s to/, and the home page links every recipe),$hub(the five hub pages; itsparams.parsedeclines other single-segment paths such as/zh/, so they reach the home route),guides/$idandsaved(noindex). Same URLs as before the migration. - App code:
src/site/components/(home: compact heroHeroFilm.tsx= one H1 line + search + chips, then the shelves with the grid on the first screen; film tiles: desktop tiles loop while ≥50% in view after page load, phones play the one nearest the centre, nothing under reduced motion, first-shelf first 4 posters eager and the first fetchpriority high; posters use srcset-xs.jpg480w /-m.jpg960w (media(t, 'jpgXs'); new films need the-xs.jpgtoo, made from the 1920 poster and uploaded with upload-media.sh); on phones the card Copy pill sits on the poster's bottom-right, from 768px in the title row; recipe page, content pages),src/site/data/(typed access to the recipe data;gen/is generated),src/site/lib/(saved list in localStorage, like and copy counts with a React store, GSAP registration, locale-aware links),src/site/server/stats.ts(D1 server functions),src/site/seo.ts(head data on the template'sseoHead()and JSON-LD helpers),src/site/messages.ts(UI strings),src/site/nav.ts(header and footer links),src/site/brand.tsx(logo mark),src/site/styles.css(--brandand the few rules Tailwind cannot express: hero and compare-block sizing, copy burst, view-transition timing). - Sitemap,
_redirects,_headers, llms.txt and the video sitemap come from the template'sscripts/generate.mjs. Recipe pages and recipe films come from the collection (one video sitemap entry per recipe and language). Motionboard feeds the rest throughsrc/site/pages.ts: hub and guide pages, the showcase films (extraVideos, three on/guides/launch-video-examples/),/r/<old>.mdredirects, theX-Robots-Tag: noindexblock for/r/*(extraHeaders), the llms.txt text, andsitemapExclude(saved list,#recipes, the/r/*.mdfiles the crawler finds).scripts/site/recipes.mjswrites the lists it reads intosrc/site/data/gen/before every dev start and build (predev/prebuild). - Scripts in
scripts/site/:recipes.mjs(recipe files for agents inpublic/r/andskills/motionboard/recipes/,public/source, README tables,gen/),zone-redirects.mjs(keeps the zone's trailing-slash rule in step with_redirects, runs innpm run deploy),upload-media.sh(npm run upload-media -- <files>),test.mjs(Motionboard's output checks, run bynpm testafter the template's). - Analytics: events
page_view,copy(withrecipe),cta_click(links markeddata-cta: GitHub and skills.sh),video_play. PostHog key in.env.production(VITE_POSTHOG_KEY). - Look: prototype C "Bright reel" (Rui 2026-11-28; prototype in
~/Library/Application Support/Claude/side-session-notes/local_08c08a06-7bf4-404e-9c7d-e1e9a83b6f8e/visual/motionboard/c/). Tokens insrc/site/styles.cssoverride the coss tokens (red primary#d9381f, warm surfaces, soft-shadow white cards 24-28px, sky-to-peach gradientsbg-hero/bg-recipe/bg-hub, position dot colours) and add Motionboard utilities (bg-surface,shadow-card,rounded-card,font-display…); dark is derived from the same tokens.site.config.ts:theme.default: 'light',fonts.body: 'system',fonts.display= Bricolage Grotesque (public/fonts/bricolage-grotesque-latin.woff2, Latin, weights 700-800). Copy is visible without hover on every card and on the recipe page. Tracking:copycarriesfrom= page type of the page the Copy was on (home, hub, recipe, guide, saved);$pageviewcarriesprev_path(template). The header (template shell) is made sticky and translucent fromstyles.css; its nav row is hidden below 768px. Containers use--site-width(82rem).
Commands
npm run dev(http://127.0.0.1:3000),npm run build,npm run preview(http://127.0.0.1:4173),npm test(Vitest, build, the template's checks, Motionboard's checks),npm run typecheck(needs a build or dev start first forrouteTree.gen.ts),npm run deploy(build,cf deploy, zone redirect rule, IndexNow).- Video renders never run on the Mac.
Checks before reporting a UI change
npm testpasses.node ~/code/home/tools/design-check/check.mjs --allow posthog.com --allow cloudflareinsights.com --allow motionboard.app <url>. Known false positive: it reportsload failed: ...-m.mp4on pages withmedia="(max-width: 767px)"sources, because the browser fireserroron a<source>whosemediadoes not match.- Home and one recipe page on pagespeed.web.dev, mobile (the local Lighthouse numbers run behind a proxy and come out lower). The first-screen posters carry
elementtiming="poster"andfetchPriority="high"; a new LCP image needs both sosrc/core/Scripts.tsxholds the app JS back until it is on screen.
Handoff (2026-11-16)
The repo moved from ~/Documents/motion-lexicon-site to ~/code/sites/motionboard. The task-3 audit table: ~/Library/Application Support/Claude/side-session-notes/local_b345c0d6-e7e0-4bab-8a09-d8143b50b9a1/mb-task3-audit.md.
Launch-film showcase and film tools (task 10, 2026-11-26)
/guides/launch-video-examples/is a guide page built from theshowcaseblock (src/site/data/content.ts, rendered byShowFilminsrc/site/components/page/ContentPage.tsx). Films arelaunch-<product>-<tool>{.mp4,-m.mp4,.jpg}on R2; the video sitemap lists the films whose name ends in-motionboard(scripts/site/recipes.mjs).- Skill
film/join.mjssnaps cuts to the beat of the bundled tracks (tempo table at the top of the file) and mixes per-shotsfxcues (render clock) fromfilm/sfx/(CC0). Film sources and v3 joins: winlinux~/mb/film-test/motionboard-v2/<product>/launch-film/(film-v3.json), Mac copies inmarketing/film-test/(git-excluded). Web encodes: winlinux~/mb/showcase/enc.sh <src> <base> [poster s]. - Long unbroken links in zh body text overflow at 390 px; the content column has
overflow-wrap: break-word.
Adding recipes (task 11, 2026-11-26)
- A recipe =
content/collections/recipes/<slug>.json(en and zh blocks with a checkeddemandand analtwritten from the film) +skills/motionboard/source/<video>/+ afilm/shots.jsonslot + five media files (<video>.mp4,-m.mp4,-s.mp4,.jpg,-m.jpg, posters 960x540) +orig-<youtubeId>-<startSec>.{mp4,jpg}per sample.npm run buildregenerates recipe md, README tables, llms.txt, the sitemap lists and the video sitemap. - Original clip names collide when two recipes sample the same film at the same start second (
orig-TNhX1uR2vO8-0serves light-reveal, text-object-interleave and text-behind-object-effect). Reuse the existing file; never re-encode it over the R2 copy. - The batch kit's
merge.py(in~/Library/Application Support/Claude/side-session-notes/local_b345c0d6-e7e0-4bab-8a09-d8143b50b9a1/mb-batch-kit/) still writes the old terms.json/en.json/seo files, which no longer exist (task 15, v8.4.0). Change it to write onecontent/collections/recipes/<slug>.jsonper recipe before batch 2.
Plan to 100: where batch 1 stopped (2026-11-26)
- Plan:
~/Library/Application Support/Claude/side-session-notes/local_582a33d3-16af-453e-b9c7-f939718a155c/mb-plan-100.md(5 batches, one minor release each, v8.0.0 at 100). Batch 1 (#49–58) shipped as v7.1.0 (95e6407). Rui stopped the work after batch 1 (「做完第一批停下来」); start batch 2 only when Rui or the lead says so. - Batch kit (copies of the scratchpad files):
~/Library/Application Support/Claude/side-session-notes/local_b345c0d6-e7e0-4bab-8a09-d8143b50b9a1/mb-batch-kit/:BRIEF.md(film builder brief for Sonnet subagents, hyperframes check rules at the end),COPY.md+FORMAT-example.json(copy brief; each subagent writes<slug>.jsonas {terms, en, seo, shot}),merge.py(merge into the recipe files and shots.json; needs the change above),sheet.sh <folder> "<times>" <tag>,dl.sh/dl2.sh(yt-dlp downloads of the original moments). - winlinux
~/mb/p100/:sheet.sh+cj.py,render.sh <folder> <poster s>(renders, thenenc.sh, CRF env default 20, -m CRF+3, -s CRF+7, grainy films needCRF=27),orig/out/(encoded original clips),orig/raw/(raw downloads for batches 2–3,<ytid>-<startSec-1>.mp4). - Batch-1 lessons: review every film from contact sheets before rendering (builders usually needed 1–3 rounds: framing, text size, headlines 72px+, captions 26px+, a lockup hold of at least 2.2 s, cold-seek
fromToerrors);text_occludedand contrast errors on blurred or flare layers are false positives. - Batch 2 needs, in order: read the batch-2 rows in mb-plan-100.md; download and encode the originals (check
orig/raw/first); brief one builder per film, review the sheets, then render; collect copy JSONs and runmerge.py; add hub links and bump the counts (58→68) the way 95e6407 did (the count also sits insite.config.tsandcontent/pages); ship withnpm run upload-media -- <files>,npm test, design-check, commit, push,npm run deploy,gh release create v7.2.0; check live (200, both sitemaps, playback at 1440 and 390); run PSI on 2 new pages and report to the lead. The Netflix-style page uses"link": trueon its sample, so no clip is self-hosted.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

