synapse-memory-sdk
v1.1.0
Published
TypeScript SDK for Synapse Memory API — persistent memory for AI agents
Maintainers
Readme
synapse-memory — TypeScript SDK for Synapse
TypeScript SDK for the Synapse Memory API — persistent memory for AI agents.
Install
npm install synapse-memory-sdkQuick Start
import { Synapse } from 'synapse-memory';
const synapse = new Synapse({
baseUrl: 'https://synapse.schaefer.zone',
mindKey: 'your-mind-key-uuid',
});
// Recall all memories (LLM-formatted text)
const text = await synapse.memory.recall();
console.log(text);
// Store a new memory
await synapse.memory.store({
category: 'fact',
content: 'User is Michael Schäfer',
key: 'user_name',
priority: 'critical',
source: 'user',
});
// Search memories
const results = await synapse.memory.search('insolvenz');
// Chat with the human
const { messages } = await synapse.chat.poll();
if (messages.length > 0) {
console.log(messages[0].content);
await synapse.chat.reply('Got it!');
}
// Persistent variables (survive container restarts)
await synapse.scheduler.setVar('last_run', String(Date.now()));
const lastRun = await synapse.scheduler.getVar('last_run');API Reference
synapse.memory
recall()— Get all memories as LLM-formatted textlist({ category?, tag?, limit?, offset? })— List with filtersstore({ category, content, key?, tags?, priority?, source?, confidence? })— Store/upsertsearch(q, limit?)— Full-text search (FTS5)semanticSearch(q, limit?, threshold?)— Semantic search (embeddings)update(id, { ... })— Update by IDdelete(id)— Delete by IDstats()— Statistics (counts, verified/unverified, etc.)unverified(limit?)— List unverified memoriescontradictions(withinSeconds?)— Detect contradictionsaudit(limit?, action?)— Audit logrelated(id)— Related memories by shared tagsbyTag(tag)— Filter by tagdiff(since)— Incremental syncexpiring(withinSeconds?)— Soon-to-expire memorieshealth()— Mind health checksync(memories[])— Bulk syncexport(format?)— Export mind as JSON/CSV
synapse.chat
poll(sinceId?)— Poll for new human messagesreply(content, replyToId?)— Send a replystatus()— Online status (online/idle/offline)history(limit?)— Full history (JWT-only)unread(role?)— Unread count (JWT-only)
synapse.scheduler
listCrons()/createCron(params)/deleteCron(id)/toggleCron(id)listVars()/getVar(key)/setVar(key, value?)/deleteVar(key)
License
MIT
