@becomerpackage/sdk
v0.1.0
Published
Persistent memory API for AI applications — 94.4% LongMemEval, zero tokens per recall
Maintainers
Readme
becomer — JavaScript / Node.js SDK
Persistent memory API for AI apps. Zero dependencies. Node 18+.
const { Client } = require('becomer');
const mem = new Client('bcm_your-api-key');
await mem.store('User prefers dark mode and speaks French');
const memories = await mem.recall('user preferences');
// → ['User prefers dark mode and speaks French']→ Get your free API key · Docs · Benchmarks
Install
npm install @becomerpackage/sdkZero dependencies. Uses Node's built-in fetch (Node 18+).
Quick start
const { Client } = require('becomer');
// ESM: import { Client } from 'becomer';
const mem = new Client('bcm_your-api-key');
await mem.store('User is Sarah, senior engineer at Stripe');
await mem.store('User prefers TypeScript and dark mode');
const context = await mem.recall('what do I know about the user?');
// → ['User is Sarah, senior engineer at Stripe', ...]
// Inject into your LLM call
const system = 'You are a helpful assistant.\n\nContext:\n' + context.join('\n');Multi-tenant (one key, many users)
Pass userId to isolate memories per end-user under one master key.
// Constructor-level (all calls scoped to alice)
const memAlice = new Client('bcm_your-api-key', { userId: 'alice-123' });
await memAlice.store('Alice prefers TypeScript');
// Different user — completely isolated
const memBob = new Client('bcm_your-api-key', { userId: 'bob-456' });
await memBob.recall('preferences'); // → [] (cannot see Alice's memories)
// Or override per-call
const mem = new Client('bcm_your-api-key');
await mem.store('Charlie loves Rust', { userId: 'charlie-789' });
await mem.recall('languages', { userId: 'charlie-789' });Billing counts against the master key. Browse per-user memories in your dashboard.
OpenAI
const OpenAI = require('openai');
const { Client } = require('becomer');
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const mem = new Client(process.env.BECOMER_API_KEY);
async function chat(message, userId) {
const context = await mem.recall(message, { userId });
const system = context.length
? 'You are helpful.\n\nContext:\n' + context.join('\n')
: 'You are helpful.';
const res = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'system', content: system }, { role: 'user', content: message }],
});
const reply = res.choices[0].message.content;
await mem.store(`User: ${message}`, { userId });
await mem.store(`Assistant: ${reply}`, { userId });
return reply;
}Anthropic
const Anthropic = require('@anthropic-ai/sdk');
const { Client } = require('becomer');
const claude = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const mem = new Client(process.env.BECOMER_API_KEY);
async function chat(message, userId) {
const context = await mem.recall(message, { userId });
const system = context.length
? 'You are helpful.\n\nContext:\n' + context.join('\n')
: 'You are helpful.';
const res = await claude.messages.create({
model: 'claude-opus-4-8',
max_tokens: 1024,
system,
messages: [{ role: 'user', content: message }],
});
const reply = res.content[0].text;
await mem.store(`User: ${message}`, { userId });
await mem.store(`Assistant: ${reply}`, { userId });
return reply;
}API reference
new Client(apiKey, options?)
| Option | Type | Description |
|--------|------|-------------|
| userId | string | Default sub-user ID applied to all calls |
| baseUrl | string | Override API base URL |
Methods
| Method | Returns | Description |
|--------|---------|-------------|
| store(content, opts?) | Promise<{ok}> | Store a memory |
| recall(query, opts?) | Promise<string[]> | Retrieve top-k relevant memories |
| forget(opts?) | Promise<{ok}> | Delete all memories (or sub-user's) |
| sync(opts?) | Promise<{ok}> | Consolidate working memory |
All methods accept opts.userId to override the sub-user for that call.recall also accepts opts.topK (default: 5).
Examples
| File | Framework | |------|-----------| | quickstart.js | Plain Node.js | | openai.js | OpenAI SDK | | anthropic.js | Anthropic SDK | | langchain.js | LangChain.js |
Requirements
- Node.js 18+ (uses built-in
fetch) - Zero npm dependencies
Built by
Obsidex Pvt Limited · Aravind Balaji, Founder · [email protected]
