Getting Started
Quickstart

Quickstart

Get Cortex running in under 5 minutes.

1. Get an API Key

Sign up at console.askcortex.in (opens in a new tab) and create an API key.

2. Install the SDK

npm install @cortex/memory

3. Initialize the Client

import { CortexClient } from '@cortex/memory';
 
const cortex = new CortexClient({
  apiKey: process.env.CORTEX_API_KEY
});

4. Store Your First Memory

const memory = await cortex.memories.create({
  content: "User prefers dark mode for all editors",
  source: "manual"
});
 
console.log(memory.id); // mem_abc123

5. Search Memories

const results = await cortex.memories.search({
  query: "editor preferences"
});
 
for (const memory of results.memories) {
  console.log(memory.content);
}

6. Recall with Context

The recall method is the most powerful feature. It returns relevant memories plus the user's profile, beliefs, and learnings - everything an AI needs for context.

const context = await cortex.recall({
  query: "What are the user's preferences?",
  includeProfile: true
});
 
console.log(context.profile);    // User profile summary
console.log(context.memories);   // Relevant memories
console.log(context.beliefs);    // Extracted beliefs
console.log(context.learnings);  // Discovered learnings

What's Next?