Skip to main content

Retained artifacts and content jobs

Cortex stores generated documents, code, CSV sheets and suggestions as durable backend content jobs and retained artifact versions. Conversation titles use the same governed execution policy.

import type { CortexRuntimeClient } from '@cortexmemory/sdk/runtime';

export async function createDocument(client: CortexRuntimeClient, requestId: string, prompt: string) {
const job = await client.submitContentJob({ version: 1, requestId, intent: 'text', prompt });
return client.getContentJob(job.jobId);
}

Supported intents are title, text, code, sheet and suggestions. Title requires a conversation; suggestions require an exact { artifactId, version }. Keep a stable request ID for the same intent, and recover retained state with getContentJob, listContentJobs or reconcileContentJob.

Jobs persist before inference. Reconciliation recovers an existing saved operation/draft; an unknown provider submission does not cause another generation. cancelContentJob fences local publication.

Apply a selected suggestion with applyContentSuggestion({ jobId, suggestionId, artifactVersion }). The selected artifact version must still be current; concurrent edits require a new reviewed intent. Suggestions are proposed before application, never silently applied by generation.

Automatic conversation titles share the real parent run budget. An explicit content job owns one logical budget including its secondary title call. Replay and fallback cannot reset that budget. See model policy.

getArtifact(artifactId) returns the authorized retained version, pointer, content and streaming state. File artifacts carry immutable private asset selectors; media jobs and assets retain bytes separately. The lower-level artifact API supports explicit server editing and version administration.