The case for it

You could build all of this yourself

Making a page that rearranges itself around its readers takes several separate jobs. You could write every one of them yourself, and it would work.

The work

Who writes each part

What each job takes on your own, and what comes with Loom
On your ownWith Loom
Somewhere to keep the shape of the pageso that moving a section is not a code changeYou build it✓
Counting what readers dowhich parts they reach, how long they stay, what they pressYou wire it up✓
Asking a model for a changethe request, and a shape for the answer that comes backYou write it✓
Checking a change against your own rulesbefore anybody reading the page sees itYou write it✓
Putting a change backwithout working out by hand what it replacedYou write it✓
Your componentsthe React you have already writtenYoursYours
Which AI model it usesLoom is AI model agnosticYoursYours

What stays yours

You still write your components and choose your model

Your components

Loom does not write code into your components and it does not replace them. You say which ones it is allowed to use.

Your model

Loom is AI model agnostic. Point it at the model you already use, or at one of your own.

Your rules

You write what an AI model is allowed to change on your page. Anything outside that is rejected, and Loom tells you why.

What comes with it

The rest of it is already written

Your page is kept as data rather than as code, so changing it is a write rather than a deploy. Your components do not change at all.

Your page reports what readers do with it, in a form your model can read. You do not have to pick an analytics product and then translate its charts into something a model can act on.

Every change is checked against your rules before anybody reading the page sees it, and it is stored with the way back. Putting one back is a single press.

What you build with

Every one of these comes with it

All 109 come with the install. Some are a whole section of a page and some are one piece inside it.

ActionArticleArticle gridAvatarAvatar rowBackdropBadgeBannerBefore afterBookBook gridBrandButtonCalloutCardCarouselCodeCode spanComparisonComparison rowComparison tableCredentialCredential gridDialogDisclosureDisclosure listDividerEmbedEmphasisEmpty stateEventEvent gridFAQFAQ listFeatureFeature gridFeedFieldFooterFormFrameGridHaloHeadingHeroIconInline linkKbdLightboxLinkLink listLink pagerLink trailListList itemListingListing gridLogoLogo cloudMarqueeMediaMenuMessageMessage listMeterMilestoneMilestone listMilestone rowMosaicNavOfferingOffering gridOptionOrbitOverlayPagePerkPerk listPerk list itemPersonPerson gridPinPlatePopoverProductProduct gridProseQuoteQuote gridRatingRecordingRecording gridRevealSectionSpecSplitStackStatStat chartStat gridTableTable cellTable rowTallyTierTier tableTrendVoicesWaiting state

Ready made

The sections come built as well as the parts

You do not place every part of a page one at a time.

How it works

Three steps and the reader is done

One sentence under the title. Say what the steps add up to, not what each of them is.

  1. 01

    The first step

    A short title and two lines under it. Say what the reader does, not what happens inside.

  2. 02

    The second step

    Keep the three roughly the same length. A long middle step reads as the hard one.

  3. 03

    The third step

    End on the thing the reader wanted. The last step is the one they remember.

72sections that come already built
22of them make a landing page
288parts that page is made of

What you write

Adding a component of your own takes two files

The first file is ordinary React. You have written components like it before, and Loom never edits it. The second is everything you tell Loom about it.

tsx
export type PriceTagProps = {
  readonly amount: string
  readonly was?: string | undefined
}

export const PriceTag = ({ amount, was }: PriceTagProps) => (
  <p className="price-tag">
    {was === undefined ? null : <s>{was}</s>} <strong>{amount}</strong>
  </p>
)
price-tag.tsx
tsx
import { z } from "zod"

import type { LoomPrimitiveProps } from "@jam-overture/loom/react"
import { definePrimitive } from "@jam-overture/loom/sdk"

import { PriceTag } from "./price-tag"

const priceTagProps = z
  .object({ amount: z.string(), was: z.string().optional() })
  .strict()

type Settings = z.infer<typeof priceTagProps>

export const priceTag = definePrimitive({
  type: "shop.price-tag",
  description: "A price, with any earlier price beside it.",
  props: priceTagProps,
  component: ({ loom, props }: LoomPrimitiveProps<Settings>) => (
    <span {...loom.editable}>
      <PriceTag amount={props.amount} was={props.was} />
    </span>
  ),
})
price-tag.loom.tsx

That is the setup. Your page can ask for shop.price-tag from here on, and so can your AI model, within the rules you set.

Starting from nothing

Loom writes the first files for you

Run this in your project and it writes what you would otherwise write by hand.

bash
npx loom init
  1. A part of your own to fill in
  2. The list of what AI is allowed to use
  3. A test that catches a part the portal cannot see
Read the guide

On a page

What they look like together

Every piece of this is a part from the list above.

Fresh coffee every Friday

Posted the morning it is ground.

Choose your roast

Light, medium or dark.

Pause any week

No phone call.

No contract

Stop whenever you like.

1Hero
2Feature grid

What your page reports

What one report looks like

Every few seconds the page above posts what it saw to your own server. This is one of those posts.

json
{
  "treeId": "t_fern1",
  "revision": 0,
  "sentAt": 1793784678000,
  "view": "9f14c0a7b65d4e2318ab7d90c4e6f512",
  "signals": [
    { "kind": "viewed", "nodeId": "n_fern6", "type": "loom.hero", "at": 1793784659240 },
    { "kind": "dwelled", "nodeId": "n_fern6", "type": "loom.hero", "ms": 7420 },
    { "kind": "viewed", "nodeId": "n_fern10", "type": "loom.feature-grid", "at": 1793784667100 },
    { "kind": "dwelled", "nodeId": "n_fern10", "type": "loom.feature-grid", "ms": 2680 }
  ]
}
one report from the page above

Every line names a part of the page and how long it was on screen. Nothing in it says who was reading, because there is no field for a person.

The one random key ties a few seconds of a single visit together. Your page throws it away afterwards. A press is reported the same way, against the control somebody pressed.

Hook up your model

Connecting your own model is one function

Loom has no AI model of its own. You point it at the one you already use, and this is all you write to do it.

ts
import type { ModelClient } from "@jam-overture/loom"
import { err, ok } from "@jam-overture/loom"

export const yourModel = (apiKey: string, endpoint: string): ModelClient => ({
  complete: async (request, options) => {
    const answer = await fetch(endpoint, {
      method: "POST",
      signal: options?.signal ?? null,
      headers: {
        authorization: `Bearer ${apiKey}`,
        "content-type": "application/json",
      },
      body: JSON.stringify({
        model: request.model,
        max_output_tokens: request.maxTokens,
        instructions: request.system,
        input: request.userMessage,
        reply_shape: request.outputSchema,
      }),
    })

    if (answer.status === 401 || answer.status === 403) {
      return err({ code: "misconfigured", detail: "the key was refused" })
    }

    if (!answer.ok) {
      return err({ code: "unavailable", detail: `status ${answer.status}` })
    }

    const body = (await answer.json()) as { text: string; model: string }

    return ok({ text: body.text, servedBy: body.model })
  },
})
your-model.ts

Each line pairs something Loom hands you with the name your provider expects for it. That translation is the only part that changes when you switch providers.

A key that will never work comes back as misconfigured and a service that is briefly down comes back as unavailable. Loom waits for the second one and tells you about the first.

Who is reading it

The same page arranged for someone else

The first of these is the page above. The second is what a visitor who came looking for a gift gets.

As you built it

Fresh coffee every Friday

Posted the morning it is ground.

Choose your roast

Light, medium or dark.

Pause any week

No phone call.

No contract

Stop whenever you like.

For a visitor buying a gift

Send fresh coffee every Friday

Posted the morning it is ground.

Send it as a gift

With a note you write.

Choose your roast

Light, medium or dark.

Pause any week

No phone call.

What allowed it

What changed and what let it through

The two pages above are one page. Loom turned the first into the second with three edits.

The three edits, as Loom wrote them down
What happenedThe words
The heading was rewrittenSend fresh coffee every Friday
A Feature was addedSend it as a gift
A Feature came offNo contract

Your rules allowed all three, so your page changed without waiting for you.

Putting it back is three more edits. Loom works them out while it is deciding rather than when somebody asks.

A bigger version of the same change does not go through.

Taking all three away at once is more than your rules let a page do unasked, so Loom stops and asks you.

On your own site

Two calls put a Loom page on your route

This is the whole of a route in a Next.js app.

tsx
import { livePageOf, startPullingLivePages } from "@jam-overture/loom/live"
import { renderLoomTree } from "@jam-overture/loom/react"

import { components, homePage } from "./loom"

const live = startPullingLivePages({
  deployment: process.env.LOOM_URL ?? "",
  key: process.env.LOOM_PROJECT_KEY ?? "",
})

const Page = async () => {
  const page = livePageOf(await live.ready(), homePage.treeId) ?? homePage

  return renderLoomTree(page, {
    resolver: components,
    validator: components,
  }).element
}

export default Page
app/page.tsx

The first call runs once per server rather than once per reader.

That ?? is the whole fallback. If Loom has not answered yet, or has nothing for this page, your reader gets the page your code built.

A change your rules allowed, or one you said yes to, is on your site within a minute. There is no pull request, no merge and no deploy in between.

Next

Try it on a page of your own

This site is a Loom application too, built out of the same set. Putting it in a project you already have is what the docs are for.

Read the docs

What to read next

Before this

Home

Next

Examples