API Reference
Complete documentation for the CLS++ Memory API. Teach, recall, and forget facts that persist across every LLM provider.
Base URL:
https://www.clsplusplus.comAuthentication
All API requests require authentication via Bearer token in the Authorization header.
Authorization: Bearer cls_your_api_key_hereQuick Start
// npm install clsplusplus
import { Brain } from 'clsplusplus';
const brain = new Brain('alice', {
apiKey: process.env.CLS_API_KEY!,
});
// Teach it anything — natural language
await brain.learn('I work at Google as a senior engineer');
await brain.learn('I prefer Python over JavaScript');
// Ask it anything — semantic recall across any LLM
const facts = await brain.ask("What's my job?");
// → ["I work at Google as a senior engineer"]
// Get LLM-ready context for a prompt
const context = await brain.context('coding help');
// Use with OpenAI
const response = await openai.chat.completions.create({
model: 'gpt-4',
messages: [
{ role: 'system', content: context },
{ role: 'user', content: 'Help me with a coding task' },
],
});Endpoints
POST
/v1/memory/writeTeach the brain a fact. Flows into the memory engine and is promoted as its salience warrants.
Request
{
"text": "I work at Google as a senior engineer",
"namespace": "alice",
"source": "user"
}Response
{
"id": "mem_abc123",
"store_level": "L1",
"text": "I work at Google as a senior engineer",
"trace_id": "trc_9f2a"
}POST
/v1/memory/readSemantic recall across all stores plus cross-session memory. Returns the most relevant facts.
Request
{
"query": "What's my job?",
"namespace": "alice",
"limit": 5
}Response
{
"items": [
{
"id": "mem_abc123",
"text": "I work at Google as a senior engineer",
"namespace": "alice",
"confidence": 0.94
}
],
"trace_id": "trc_9f2a"
}GET
/v1/memory/listList stored memories for a namespace.
Request
// Query params:
?namespace=alice
&limit=20Response
{
"items": [
{
"id": "mem_abc123",
"text": "I work at Google as a senior engineer",
"namespace": "alice"
}
]
}DELETE
/v1/memory/forgetForget a fact by text or by memory ID (GDPR right to be forgotten).
Request
{
"text": "I work at Google as a senior engineer",
"namespace": "alice"
}Response
{
"success": true,
"forgotten": 1
}Rate Limits
| Plan | Requests/Day | Requests/Minute |
|---|---|---|
| Free | 50 | 10 |
| Pro | 10,000 | 100 |
| Enterprise | Unlimited | Custom |