Bio-inspired Temporal Cascaded Memory Engine
ChronoCascade Memory Engine is a bio-inspired temporal cascaded memory engine that simulates the "molecular timer cascade" process from short-term to long-term memory. Based on the latest Nature research findings, the system combines salience evaluation + repetition detection with cascade gates to automatically determine memory promotion or forgetting.
| Layer | Biological Correspondence | Time Scale | Characteristics |
|---|---|---|---|
| Layer 0 | Thalamus/CAMTA1 | Hours~Days | Fast write, easy decay |
| Layer 1 | TCF4/Structural Support | Days~Weeks | Structured, association enhancement |
| Layer 2 | ASH1L/Chromatin Remodeling | Weeks~Months | Persistent, Schema formation |
- Cascade Gates: Simulates the gradual transformation process of biological memory
- Repetition: Repeated events gain higher promotion priority
- Replay: Periodic replay of important memories to enhance retention
- Decay: Each layer decays at different rates
- Structural Support: Mid-term layer establishes associations between events
✅ Three-Layer Hierarchical Storage: Separation of short-term, mid-term, and long-term memory
✅ Automatic Promotion Mechanism: Based on multiple factors including salience, repetition, reward
✅ Replay Consolidation: Periodic replay to enhance important memories
✅ Intelligent Forgetting: Garbage collection based on score, age, and utility
✅ Explainability: Complete promotion/forgetting logging system
✅ Vector Retrieval: Supports semantic similarity search
✅ Schema Integration: Automatic compression and abstraction of long-term memory
npm installimport { CascadeMemorySystem } from './src';
// Create ChronoCascade engine instance
const system = new CascadeMemorySystem();
// 1. Ingest event
const event = system.ingest({
content: { message: 'User prefers dark mode' },
source: 'user_interaction',
contextId: 'user_123',
tags: ['preference', 'ui'],
reward: 0.8 // Optional: reward signal
});
// 2. Retrieve memories
const results = system.retrieve({
contextId: 'user_123',
tags: ['preference'],
topK: 5
});
// 3. Run maintenance cycle (promotion + forgetting)
const stats = await system.runMaintenanceCycle();
console.log(`Promotions: ${stats.replay.layer0Promotions}`);
console.log(`Forgotten: ${stats.forgetting.totalPruned}`);
// 4. View system statistics
const systemStats = system.getStats();
console.log(`Total events: ${systemStats.totalEvents}`);
console.log(`Layer 0: ${systemStats.layer0.size}`);
console.log(`Layer 1: ${systemStats.layer1.size}`);
console.log(`Layer 2: ${systemStats.layer2.size}`);┌─────────────────────────────────────────────────────┐
│ CascadeMemorySystem (Main Controller) │
├─────────────────────────────────────────────────────┤
│ EventEncoder │ ReplayWorker │ ForgettingService │
└─────────────────────────────────────────────────────┘
↓
┌───────────────┼───────────────┐
↓ ↓ ↓
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Layer 0 │ │ Layer 1 │ │ Layer 2 │
│ ShortTerm │→│ MidTerm │→│ LongTerm │
│ Buffer │ │ Store │ │ Store │
├──────────────┤ ├──────────────┤ ├──────────────┤
│ - Fast write │ │ - Association│ │ - Schema │
│ - Repeat det.│ │ - Centrality │ │ - Compression│
│ - Time decay │ │ - Structural │ │ - Slow decay │
└──────────────┘ └──────────────┘ └──────────────┘
TAU: [
24 * 3600, // Layer 0: 1 day
7 * 24 * 3600, // Layer 1: 7 days
30 * 24 * 3600 // Layer 2: 30 days
]PROMO_THRESH: [
0.7, // Layer 0 → 1
0.8 // Layer 1 → 2
]SALIENCE_WEIGHTS: {
alpha: 0.4, // Raw salience
beta: 0.3, // Repetition factor
gamma: 0.3 // Reward signal
}ingest(raw: RawEvent): Event- Ingest single eventingestBatch(raws: RawEvent[]): Event[]- Batch ingestretrieve(query: RetrievalQuery): RetrievalResult[]- Retrieve memoriesrunMaintenanceCycle()- Run maintenance cyclegetStats(): SystemStats- Get system statisticsgetLogSummary(): StatsSummary- Get log summarydeleteEvent(id: string): boolean- Manually delete eventclear()- Clear all data
interface Event {
id: string;
vector: number[]; // Embedding vector
metadata: EventMetadata;
layerState: LayerState; // Current layer
scores: Scores; // Layer scores
history: HistoryEntry[]; // History trail
createdAt: number;
lastAccessedAt: number;
}interface RetrievalQuery {
vector?: number[]; // Vector similarity query
contextId?: string; // Context filter
tags?: string[]; // Tag filter
minScore?: number; // Minimum score
layer?: LayerState; // Specific layer
topK?: number; // Return count
}# Run all tests
npm test
# Run tests with watch
npm run test:watch# Build
npm run build
# Development mode
npm run devUser expresses preferences multiple times → From short-term to long-term, eventually becomes user profile schema
Discovers effective strategies across multiple tasks → Promotes memories and reuses in similar situations
Important documents/knowledge points promoted to long-term storage through repeated access and high ratings
- Retention Efficiency: Ratio of memories promoted to long-term layer / total ingested events
- Retrieval Accuracy: Relevance of retrieval results
- Forgetting Precision: Impact of deleted memories on performance
- Storage Cost: Capacity utilization of each layer
- Biologically Inspired: Strictly maps molecular mechanisms of biological memory formation
- Explainability: Every promotion/forgetting has clear reasoning
- Efficiency First: Maximizes long-term utility under cost constraints
- Tunable Parameters: Supports online adjustment of strategies and thresholds
- Real vector embedding model integration (BERT/Sentence Transformers)
- Distributed storage backend (Redis/PostgreSQL)
- ANN vector indexing (Faiss/Milvus)
- Real-time monitoring dashboard
- A/B testing framework
- Adaptive parameter tuning
- Nature (2024): "Thalamocortical transcriptional gates coordinate memory formation"
- Medical Xpress: "How the brain decides what to remember"
- ScienceDaily: "Why some memories last a lifetime"
MIT
Issues and Pull Requests are welcome!