Baue AI-Systeme,
die sich wirklich erinnern
Neuroscience-basiertes Memory für deine AI-Agents. npm install. TypeScript. Zero Dependencies.
$ npm install @zensation/core @zensation/algorithmsCopyDein erstes Memory in 3 Schritten
Installieren
Ein npm install — keine weiteren Dependencies.
npm install @zensation/core @zensation/algorithmsKonfigurieren
MemoryCoordinator erstellen — eine Zeile.
import { MemoryCoordinator, InMemoryStorage } from '@zensation/core';
const coordinator = new MemoryCoordinator({
storage: new InMemoryStorage(),
});Nutzen
store() zum Speichern, recall() zum Abrufen.
// Store a memory (auto-routes to semantic layer)
await coordinator.store('User prefers dark mode', {
type: 'fact',
confidence: 0.9,
});
// Recall relevant memories
const results = await coordinator.recall('user preferences');
// → [{ content: 'User prefers dark mode', score: 0.92, layer: 'semantic' }]7 Memory Layers, ein Coordinator
MemoryCoordinator
Orchestriert alle 7 Layers: auto-routing store(), cross-layer recall(), consolidate(), decay(), FSRS review queue
Systemarchitektur
Von einfach bis produktionsreif
Einfaches Memory
store() + recall() Basics
const id = await coordinator.store('User prefers dark mode', {
type: 'fact', confidence: 0.9,
});
const results = await coordinator.recall('user preferences');Spaced Repetition
FSRS-Scheduler für Lern-Apps
import { getRetrievability } from '@zensation/algorithms';
// Check if a fact needs review
const retention = getRetrievability(fsrsState); // 0.0–1.0
// Use the coordinator's built-in FSRS review queue
const queue = await coordinator.getReviewQueue(10);
await coordinator.recordReview(queue[0].id, 4); // grade: 1-5Semantic Search
Cross-Layer Suche mit Ranking
const results = await coordinator.recall('machine learning basics', {
layers: ['semantic', 'episodic'],
limit: 5,
minConfidence: 0.7,
});Sleep Consolidation
Nächtliche Memory-Optimierung
import { selectForReplay, simulateReplay, pruneWeakConnections }
from '@zensation/algorithms';
const candidates = selectForReplay(memories, SLEEP_CONSOLIDATION_CONFIG);
const replayed = simulateReplay(candidates, SLEEP_CONSOLIDATION_CONFIG);
const pruned = pruneWeakConnections(memories, 0.1);Hebbian Learning
Co-Aktivierung stärkt Verbindungen
import { computeHebbianStrengthening, computeHebbianDecay }
from '@zensation/algorithms';
// Strengthen connection weight through co-activation
const newWeight = computeHebbianStrengthening(0.5); // current weight → strengthened
// Apply time-based decay to connection weight
const decayedWeight = computeHebbianDecay(0.8); // current weight → decayedFull Pipeline
Store → Consolidate → Decay → Review
// Store → Consolidate → Decay → Review
await coordinator.store('Meeting notes from standup', { type: 'episode' });
const consolidated = await coordinator.consolidate();
const decayed = coordinator.decay();
const queue = await coordinator.getReviewQueue(10);
await coordinator.recordReview(queue[0].id, 4);Mehr als ein Key-Value Store
| Feature | ZenBrain | Mem0 | Zep | LangMem |
|---|---|---|---|---|
| Sleep Consolidation | ✓ | ✗ | ✗ | ✗ |
| FSRS Spaced Repetition | ✓ | ✗ | ✗ | ✗ |
| Hebbian Learning | ✓ | ✗ | ✗ | ✗ |
| Confidence Intervals | ✓ | ✗ | ✗ | ✗ |
| MemoryCoordinator | ✓ | ✗ | ✗ | ✗ |
| Zero Dependencies | ✓ | ✗ | ✗ | ✗ |
| Self-Hosted | ✓ | ✓ | ✓ | ✗ |
Überall integrierbar
Node.js / Express
import { MemoryCoordinator } from '@zensation/core';
app.post('/chat', async (req, res) => {
const context = await coordinator.recall(req.body.message);
const response = await llm.chat(req.body.message, { context });
await coordinator.store(response, { type: 'episode' });
res.json({ response });
});Next.js / React
'use server';
import { coordinator } from '@/lib/memory';
export async function chat(message: string) {
const context = await coordinator.recall(message);
const response = await generateText({ prompt: message, context });
await coordinator.store(response, { type: 'fact', source: 'ai' });
return response;
}CLI / Scripts
import { MemoryCoordinator } from '@zensation/core';
import { createFileAdapter } from '@zensation/adapter-sqlite';
const coordinator = new MemoryCoordinator({
storage: createFileAdapter('./memory.db'),
});
await coordinator.store('Batch processed 1000 docs');Auch kompatibel mit: Deno · Bun · Cloudflare Workers
Open Source. Open Community.
GitHub
Star, Fork, Contribute
npm
@zensation/core · @zensation/algorithms
Discord
Fragen, Showcase, Support
Documentation
API Reference, Examples, FAQ
First Good Issues auf GitHub — lies CONTRIBUTING.md
Developer FAQ
Brauche ich eine Datenbank?
Nein. InMemoryStorage für Prototypen, SQLite-Adapter für Zero-Config Persistenz, PostgreSQL+pgvector für Production.
Wie groß ist das Bundle?
Tree-shakeable. @zensation/algorithms hat 0 Runtime-Dependencies.
Kann ich eigene Memory Layers schreiben?
Ja. Implementiere das Layer-Interface und übergib es dem Coordinator.
Was ist der Unterschied zu Mem0?
7 Layers statt Key-Value, Sleep Consolidation, FSRS Spaced Repetition, Confidence Intervals — alles was Mem0 nicht hat.
Ist das Production-ready?
276 Tests, 100% passing. ZenAI nutzt ZenBrain-Algorithmen intern seit Phase 125.
Wie funktioniert Sleep Consolidation?
Basiert auf Stickgold & Walker 2013: selectForReplay → simulateReplay → pruneWeakConnections. Episodische Memories werden zu semantischem Wissen konsolidiert.
MCP Server?
Coming in v0.3.0 — IDE-Integration für VS Code, Cursor und andere MCP-kompatible Tools.
Lizenz?
Apache 2.0. Kommerziell nutzbar. Keine Einschränkungen.
Bereit loszulegen?
$ npm install @zensation/coreCopyApache 2.0 · TypeScript · Zero Dependencies · Made in Germany