Skip to content

Quick Start

Get SubCortex running in your agent in under 5 minutes.

1. Create a project

Sign up at app.subcortex.ai, create an organisation, then create a project. Copy your API key from the project's Integrations tab.

2. Install the SDK

bash
npm install @subcortex/sdk
bash
yarn add @subcortex/sdk
bash
pnpm add @subcortex/sdk

3. Initialise the client

typescript
import { SubCortexClient } from '@subcortex/sdk'

const scx = new SubCortexClient({
  endpoint: 'https://engine.subcortex.ai',
  apiKey: 'scx_live_your_api_key'
})

4. Store your first fact

typescript
await scx.assertions.create({
  subject: 'user:alice',
  predicate: 'role',
  value: 'Engineering Manager',
  confidence: 0.99
})

5. Query it back

typescript
const facts = await scx.assertions.query('user:alice')
console.log(facts)
// [{ subject: 'user:alice', predicate: 'role', value: 'Engineering Manager', ... }]

6. Identify a user before a session

The most powerful entrypoint — call users.identify() before each conversation. It returns a fully assembled context document with everything SubCortex knows about that user, ready to inject into your system prompt.

typescript
const context = await scx.users.identify({
  userId: 'user:alice',
  agentId: 'agent:support-bot'
})

// context.xml — inject directly into your system prompt
const systemPrompt = `You are a helpful assistant.\n\n${context.xml}`

Next steps

Released under the MIT License.