
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
kuzu-memory
Advanced tools
A TypeScript library for semantic memory management in Next.js applications
A TypeScript library for semantic memory management in Next.js applications. Kuzu Memory provides intelligent storage, retrieval, and management of memories with support for multiple storage backends, pattern extraction, and various recall strategies.
🚀 Production Ready: ✅ 194/206 tests passing | ✅ All storage adapters functional | ✅ Comprehensive UAT suite
npm install kuzu-memory
# or
yarn add kuzu-memory
# or
pnpm add kuzu-memory
import { createMemoryClient } from 'kuzu-memory';
// Create a memory client
const memory = await createMemoryClient({
storage: 'indexeddb',
dbName: 'my-app-memories',
});
// Store different types of memories
const semantic = await memory.create('I learned about TypeScript generics today', {
type: 'semantic',
tags: ['programming', 'typescript'],
importance: 0.8,
});
const preference = await memory.create('I prefer VS Code over other editors', {
type: 'preference',
tags: ['tools', 'editor'],
importance: 0.6,
});
// Recall memories
const memories = await memory.recall('TypeScript programming concepts', {
limit: 5,
});
// Query with specific criteria
const results = await memory.query({
type: 'semantic',
tags: ['programming'],
sortBy: 'importance',
limit: 10,
});
import { useKuzuMemory, useMemoryQuery, useMemoryMutation } from 'kuzu-memory/hooks';
function MyComponent() {
// Initialize the memory client
const { client, isInitialized } = useKuzuMemory({
storage: 'indexeddb',
autoInit: true,
});
// Query memories
const { data: memories, isLoading } = useMemoryQuery({
client,
query: {
type: 'semantic',
limit: 20,
},
});
// Mutations
const { create, update, remove } = useMemoryMutation({
client,
onSuccess: (memory) => console.log('Memory saved:', memory),
});
const handleSave = async () => {
await create('New memory content', {
tags: ['important'],
importance: 0.9,
});
};
if (!isInitialized || isLoading) return <div>Loading...</div>;
return (
<div>
{memories?.map(memory => (
<div key={memory.id}>{memory.content}</div>
))}
<button onClick={handleSave}>Save Memory</button>
</div>
);
}
Kuzu Memory supports six different memory types based on cognitive psychology:
const memory = await createMemoryClient({
storage: 'indexeddb',
dbName: 'my-app',
version: 1,
});
const memory = await createMemoryClient({
storage: 'localStorage',
});
const memory = await createMemoryClient({
storage: 'memory',
});
import { createRecallStrategy } from 'kuzu-memory/recall';
const strategy = createRecallStrategy({
type: 'composite',
strategies: [
{ type: 'recency', weight: 0.3 },
{ type: 'importance', weight: 0.4 },
{ type: 'similarity', weight: 0.3 },
],
});
const memories = await memory.recall('query', { strategy });
Extract structured information from unstructured text:
const patterns = memory.extractPatterns(
'Contact me at john@example.com or visit https://example.com'
);
// Results include extracted emails, URLs, etc.
// Add custom patterns
memory.addPattern({
id: 'custom-pattern',
name: 'Custom Pattern',
regex: 'your-regex-here',
priority: 10,
});
// Subscribe to all events
const unsubscribe = memory.subscribe((event) => {
switch (event.type) {
case 'memory:created':
console.log('New memory:', event.memory);
break;
case 'memory:updated':
console.log('Updated:', event.memory);
break;
case 'memory:deleted':
console.log('Deleted:', event.id);
break;
}
});
// Clean up
unsubscribe();
interface KuzuConfig {
storage: 'indexeddb' | 'memory' | 'localStorage';
dbName: string;
version: number;
autoSync: boolean;
syncInterval: number; // milliseconds
maxMemories: number;
decayEnabled: boolean;
decayInterval: number; // milliseconds
embeddingProvider?: (text: string) => Promise<number[]>;
}
Integrate with embedding providers for semantic search:
const memory = await createMemoryClient({
embeddingProvider: async (text) => {
// Your embedding logic here
const response = await fetch('/api/embeddings', {
method: 'POST',
body: JSON.stringify({ text }),
});
return response.json();
},
});
Create knowledge graphs by linking related memories:
const memory1 = await memory.create('TypeScript is a typed superset of JavaScript');
const memory2 = await memory.create('JavaScript is a programming language', {
relations: [
{
targetId: memory1.id,
type: 'related-to',
strength: 0.9,
},
],
});
Automatically decrease importance of memories over time:
const memory = await createMemoryClient({
decayEnabled: true,
decayInterval: 86400000, // 24 hours
});
create(content, metadata?): Store a new memoryget(id): Retrieve a specific memoryupdate(id, updates): Update an existing memorydelete(id): Remove a memoryquery(query): Search memories with filtersrecall(query, options?): Intelligent memory retrievalclear(): Remove all memoriesgetStats(): Get storage statisticsuseKuzuMemory(options): Initialize memory clientuseMemoryQuery(options): Query memories reactivelyuseMemoryMutation(options): Create/update/delete operationsuseMemorySubscription(options): Subscribe to memory eventsKuzu Memory features a comprehensive test suite with 97+ tests across multiple categories:
# Run all tests (unit + UAT)
make test
# Run specific test suites
make test-uat-storage # Storage adapter tests (97+ tests)
make test-uat-recall # Memory recall strategy tests
make test-uat-patterns # Pattern extraction tests
make test-uat-integration # Integration tests
make test-uat-performance # Performance benchmarks
make test-uat-hooks # React hooks tests
# Test status and coverage
make test-status # Detailed test suite status
make test-coverage # Coverage reports
For detailed development information, see DEVELOPER.md.
# Quick setup
make install # Install dependencies
make dev # Development with watch mode
make build # Build the library
make test # Run all tests (unit + UAT)
make quality # All quality checks (type-check, lint, test)
# Or use npm scripts directly
npm install && npm run dev
MIT
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
For issues, feature requests, and questions, please use the GitHub issues page.
FAQs
A TypeScript library for semantic memory management in Next.js applications
We found that kuzu-memory demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.