Developer Hub

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/algorithmsCopy
TypeScriptApache 2.0Zero Dependencies276 Tests
12Algorithmen
7Memory Layers
276Tests
0Dependencies
Apache 2.0Lizenz
In 5 Minuten loslegen

Dein erstes Memory in 3 Schritten

1

Installieren

Ein npm install — keine weiteren Dependencies.

npm install @zensation/core @zensation/algorithms
2

Konfigurieren

MemoryCoordinator erstellen — eine Zeile.

import { MemoryCoordinator, InMemoryStorage } from '@zensation/core';

const coordinator = new MemoryCoordinator({
  storage: new InMemoryStorage(),
});
3

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' }]
Neuroscience-Inspired Architecture

7 Memory Layers, ein Coordinator

🧠
Working MemoryAktiver Task-Fokus
Baddeley 2000
⏱️
Short-TermSession-Kontext
Atkinson & Shiffrin 1968
📸
EpisodicKonkrete Erfahrungen
Tulving 1972
📚
SemanticFaktenwissen
Tulving 1972
⚙️
ProceduralGelernte Abläufe
Squire 2004
💎
CorePersistente Identität
Conway 2005
🔗
Cross-ContextKontext-übergreifend
Moscovitch 2005

MemoryCoordinator

Orchestriert alle 7 Layers: auto-routing store(), cross-layer recall(), consolidate(), decay(), FSRS review queue

Systemarchitektur

MCPServersClientReact · CLI · MCPREST APIExpress · JWT · Rate-LimitService LayerClaude · RAG · Agents · ToolsMemory SystemHiMeS 4-Layer · FSRS · KGData LayerPostgreSQL · pgvector · Redis
Ready-to-Use Patterns

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-5

Semantic 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 → decayed

Full 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);
Warum ZenBrain?

Mehr als ein Key-Value Store

FeatureZenBrainMem0ZepLangMem
Sleep Consolidation
FSRS Spaced Repetition
Hebbian Learning
Confidence Intervals
MemoryCoordinator
Zero Dependencies
Self-Hosted
276Tests, 100% passing
12Algorithmen, peer-reviewed
0Runtime Dependencies
276Tests, 100% passing
12Algorithmen, peer-reviewed
0Runtime Dependencies
Works With Your Stack

Ü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

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/coreCopy

Apache 2.0 · TypeScript · Zero Dependencies · Made in Germany