overview

Contextune gives customer-facing AI agents behavioural context they normally can't see, so they can respond to what the user is doing, not just what the user typed.

It captures a live view of what the user is doing in the browser, the pages they visit, where they click and scroll, where they hesitate, and injects it into the agent's context window. The agent can then infer intent from behaviour instead of from the latest message alone.

It's built for cases where what the user just did on the page changes what the agent should say: travel concierges, in-product support agents, and ecommerce shopping assistants.

Contextune sits client-side between your existing tracking layer (Segment, Google Analytics, Mixpanel) and your agent stack (OpenAI, Anthropic, Vercel AI, LangChain), turning behavioural cues into structured context for the agent.
contextune reads from your existing tracking layer and hands structured behavioural context to whichever agent stack you already run.

@contextune/sdk is the client-side piece. It maintains that behavioural profile in the browser and exposes it as structured JSON, or TOON ↗ for a more token-efficient format, that you can drop into your model's prompt. It runs in plain JavaScript or TypeScript with no framework or model assumptions.

It's MIT-licensed and runs entirely in the browser. The snapshot lives in memory in the user's session; nothing is sent anywhere by default, and we never see it.

hello-world.tsts
import { Contextune } from '@contextune/sdk';

Contextune.init();
const snapshot = Contextune.getSnapshot();
// inject snapshot into your agent's system prompt

Read the full quickstart →

Using a coding agent? Add with your agent → wires the integration from a single prompt. No key to mint.

two modes

The SDK works in two modes that can be combined freely:

what the snapshot contains

Every block is optional.

next steps