Developers

TypeScript SDK

The temporal-continuity package is a client for the hosted service. It does not run the continuity service locally.

What the SDK actually does

Think of the model as the engine generating the next answer and Temporal Continuity as the durable relationship record. The application associates a user with an authorized relationship, records contributions, and asks the service for context when the next turn begins. Clearing a browser cache or changing the cognition provider does not delete that server-side relationship.

The SDK is not a substitute for your model API, and it does not make every past detail appear automatically. Your application still has to use the retrieved context or the composition interface, and the result depends on the context projection and the cognition model.

Install

npm install temporal-continuity

Configure and run

Set the API key, base URL, organization ID, project ID and environment ID in your server environment. Never put an API key into browser-side code. This example creates a new test relationship, records a contribution, then reads its context and history.

import { RMS } from "temporal-continuity";

const rms = new RMS({
  apiKey: process.env.TEMPORAL_CONTINUITY_API_KEY,
  baseUrl: process.env.TEMPORAL_CONTINUITY_BASE_URL,
  organizationId: process.env.TEMPORAL_CONTINUITY_ORGANIZATION_ID,
  projectId: process.env.TEMPORAL_CONTINUITY_PROJECT_ID,
  environmentId: process.env.TEMPORAL_CONTINUITY_ENVIRONMENT_ID,
});

const participant = await rms.createParticipant();
const relationship = await rms.createRelationship({
  humanParticipantId: participant.participant.id,
});
const before = await rms.getContext(relationship.relationship.id);
await rms.addContribution(relationship.relationship.id, {
  content: "The deployment review happens on Friday.",
});
const after = await rms.getContext(relationship.relationship.id);
const history = await rms.getHistory(relationship.relationship.id);
console.log({ before, after, history });

The response should be inspected rather than assumed to contain a particular memory projection. An authorized relationship associated with a user is required for continuity operations.

Provider-neutral cognition

compose() accepts an application-supplied cognition callback and an existing managed userId. The server resolves the relationship and enforces credit accounting.

await rms.compose({
  userId,
  content: "Remember that I prefer concise answers.",
  idempotencyKey: crypto.randomUUID(),
  cognition: async projection => invokeRegisteredCognition(projection),
});
SDK method and route reference