The SPARC Memory Bank is a sophisticated, distributed memory management system designed for multi-agent collaborative development environments. It provides persistent, searchable, and conflict-resistant storage with advanced features including CRDT-based synchronization, vector search, namespace isolation, and multiple storage backends.
- Dual Storage Backends: SQLite for performance, Markdown for human-readability and git integration
- Advanced Caching: Multiple eviction strategies with TTL support and performance metrics
- Vector Search: Semantic similarity search with embeddings and indexing
- CRDT Conflict Resolution: Automatic conflict resolution for concurrent updates
- Namespace Isolation: Multi-tenant support with permissions and access control
- Replication: Distributed synchronization across multiple instances
- Import/Export: Multiple formats with compression and encryption
- Full-Text Search: Integrated FTS5 search for SQLite backend
import { MemoryManager } from '@sparc/memory-bank';
// Initialize with SQLite backend
const memory = new MemoryManager({
backend: 'sqlite',
storage: { path: './memory.db' },
cache: { enabled: true, maxSize: 100 * 1024 * 1024 }, // 100MB
indexing: { vectorSearch: true }
});
// Store a memory item
const item = await memory.store({
id: 'task-001',
category: 'implementation',
content: 'Implemented user authentication system',
tags: ['auth', 'security', 'backend'],
metadata: {
assignee: 'alice',
priority: 'high',
completion: 0.8
}
});
// Query memories
const results = await memory.query({
category: 'implementation',
tags: ['auth'],
fullText: 'authentication',
limit: 10
});- Architecture Overview - System design and component interactions
- API Reference - Complete API documentation
- Usage Guide - Practical examples and best practices
- Backends - Storage backend configuration and capabilities
- Configuration - Complete configuration reference
- Performance - Optimization and monitoring
- Security - Security features and best practices
- Deployment - Production deployment guide
- Troubleshooting - Common issues and solutions
# Using npm
npm install @sparc/memory-bank
# Using deno
import { MemoryManager } from 'https://deno.land/x/sparc_memory@latest/mod.ts';Memory items are the fundamental unit of storage in the SPARC Memory Bank:
interface MemoryItem {
id: string; // Unique identifier
category: string; // Logical grouping
content: string; // Main content
tags: string[]; // Searchable tags
namespace?: string; // Isolation boundary
metadata?: Record<string, unknown>; // Additional data
embedding?: number[]; // Vector representation
version: number; // CRDT version
vectorClock: Record<string, number>; // Conflict resolution
created: Date; // Creation timestamp
updated: Date; // Last modification
checksum: string; // Integrity verification
}SQLite Backend: Optimized for performance with FTS5 search, WAL mode, and proper indexing.
Markdown Backend: Human-readable storage with git integration for version control and collaboration.
Intelligent caching layer with multiple eviction strategies:
- LRU: Least Recently Used (default)
- LFU: Least Frequently Used
- FIFO: First In, First Out
- TTL: Time To Live based expiration
Semantic similarity search using vector embeddings:
- Automatic embedding generation
- Cosine similarity matching
- Configurable similarity thresholds
- Integration with external embedding services
- Runtime: Node.js 18+ or Deno 1.30+
- Storage: SQLite 3.38+ (for SQLite backend)
- Memory: Minimum 512MB RAM (varies with cache size)
- Disk: Variable (depends on data volume and caching)
MIT License - see LICENSE for details.
See CONTRIBUTING.md for development setup and guidelines.
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions