TypeScript SDK
The MemoryLayer TypeScript SDK (@scitrera/memorylayer-sdk) provides a fully typed client for the MemoryLayer server from TypeScript and JavaScript applications. It is an Apache-2.0 licensed ESM package with no runtime dependencies, and it requires Node.js 18+ or another runtime with fetch.
Installation
npm install @scitrera/memorylayer-sdkFeatures
- Full TypeScript Support — Complete type definitions included, no
@typespackages needed - Memory Operations — Remember, recall (including temporal filters and token budgets), reflect, forget, decay, browse
- Relationship Graph — Create, update, delete, and traverse typed relationships
- Entity Registry — Resolve and merge canonical entities
- Sessions — Working memory with TTL and commit, plus checkpoints, context packs, and context deltas
- Chat Threads — Conversation history with decomposition into memories
- Skills, MCP Servers, Knowledgebase, RPG —
client.skills,client.mcpServers,client.kb,client.rpg - On-Behalf-Of — Per-call or scoped authority headers
- Retries and Custom Transport — Automatic backoff for idempotent requests, and a pluggable
fetch - Error Handling — Typed exception hierarchy
Quick Start
import { MemoryLayerClient, MemoryType } from "@scitrera/memorylayer-sdk";
const client = new MemoryLayerClient({ baseUrl: "http://localhost:61001", workspaceId: "my-workspace",});
// Store a memoryconst memory = await client.remember("User prefers dark mode", { type: MemoryType.SEMANTIC, importance: 0.8, tags: ["preference", "ui"],});
// Recall memoriesconst result = await client.recall("What are the user's UI preferences?", { limit: 5, minRelevance: 0.7,});
console.log(result.memories);Configuration
const client = new MemoryLayerClient({ baseUrl: "http://localhost:61001", // Default apiKey: process.env.MEMORYLAYER_API_KEY, // Optional for local dev workspaceId: "my-workspace", sessionId: "optional-session-id", // Auto-include in requests timeout: 30000, // Request timeout in ms maxRetries: 3, // Retries for idempotent requests});Next Steps
- Quick Start Guide — Step-by-step tutorial
- API Reference — Complete method reference
- Authority Headers (OBO) — On-behalf-of requests and Aether routing
Other SDKs
- Python SDK —
memorylayer-client(async and sync) - Go SDK —
github.com/scitrera/memorylayer/memorylayer-sdk-go