Use case · Page companion

In-page copilot for your app

An AI agent that reads your live DOM and answers questions about whatever the user is looking at. No state-plumbing, no useCopilotReadable, no glue code — Linda reads /page/dom.html natively.

  • @linda/core
  • PageMount
  • VFS
  • onObserve

Try it live → Run the page-companion demo with your own API key.

The shape

You have a SaaS dashboard, an admin panel, a CRM, a docs site. You want to add an AI that can read whatever the user is looking at and answer questions about it — without writing a useCopilotReadable for every piece of state.

Linda’s PageMount snapshots your live DOM as /page/dom.html. The agent reads it on demand, no glue code.

Code

import { Linda } from "@linda/core";

const linda = new Linda({
  transport: { mode: "proxy", url: "/api/linda" },
  config: {
    persona: "You are an in-page copilot for Acme Cloud. Answer questions about whatever the user is looking at on this page.",
    target: { type: "page" },
    primitives: ["observe", "extract"], // not "act" — read-only
  },
});

linda.attach();

What the agent sees

When the user asks “what does this page show?”, the model calls read /page/dom.html and gets the live DOM. Not a snapshot from build time — the actual current state, including dynamic content, React rendering, charts.

Three modes

Observe — agent only reads the page. Safe default for Q&A.

Extract — agent can pull structured data into the chat (e.g., “give me this table as CSV”).

Act — agent can also write to the page (click buttons, fill forms). Use with explicit user consent and a scope guard restricting which paths it can write to.

Why this beats CopilotKit

CopilotKit requires you to mark every piece of state as readable via useCopilotReadable. That works, but it’s a lot of glue. Linda just reads the DOM. If the user can see it, the agent can see it. No instrumentation.

See the full comparison →

When to pick this shape

  • You’re adding AI to an existing app.
  • The data you want the AI to see is already rendered.
  • You don’t want to wire every state slice.
  • You want the AI to “just work” on every route.

FAQ

Does it work on SPA route changes?

Yes — the PageMount listens to the browser History API and re-snapshots the DOM on navigation. The agent always sees the current page.

How does it handle long DOM trees?

The DOM is dehydrated and chunked. The model reads /page/dom.html in segments via the `read` tool with offset/limit, just like reading a long file.

Ship an agent-driven flow this afternoon.

Install Linda, paste a config, and your form turns into an agent that fills its own inputs.