| Crates.io | halldyll_memory_model |
| lib.rs | halldyll_memory_model |
| version | 0.2.0 |
| created_at | 2026-01-20 15:00:12.821384+00 |
| updated_at | 2026-01-20 15:00:12.821384+00 |
| description | Multi-user, multi-model memory system for distributed AI agents (Halldyll ecosystem) |
| homepage | https://github.com/Mr-soloDev/Halldyll-Memory-Model |
| repository | https://github.com/Mr-soloDev/Halldyll-Memory-Model |
| max_upload_size | |
| id | 2056747 |
| size | 284,779 |
Multi-user, multi-model distributed memory system for AI agents. Designed for cloud deployment with PostgreSQL + Redis backend.
A sophisticated memory management system enabling AI agents (like Halldyll) to:
┌─────────────────────────────────────────────────────┐
│ MemoryEngine (Orchestrator) │
├─────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────┐ │
│ │ User Mgmt │ │ Embedding │ │ Context │ │
│ │ (RBAC) │ │ Generation │ │ Builder │ │
│ └──────────────┘ └──────────────┘ └──────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────┐ │
│ │ Processor │ │ Searcher │ │ Models │ │
│ │ (Ingestion) │ │ (Retrieval) │ │ Registry │ │
│ └──────────────┘ └──────────────┘ └──────────┘ │
│ │
│ ┌─────────────────────────────────────────────┐ │
│ │ StoragePool (Connection Management) │ │
│ │ ┌──────────────────┐ ┌──────────────────┐ │ │
│ │ │ PostgreSQL │ │ Redis │ │ │
│ │ │ (Data Layer) │ │ (Cache Layer) │ │ │
│ │ └──────────────────┘ └──────────────────┘ │ │
│ └─────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────┘
git clone https://github.com/Mr-soloDev/Halldyll-Memory-Model
cd Halldyll-Memory-Model
cp .env.example .env
docker-compose up -d
sqlx migrate run --database-url postgresql://halldyll:halldyll_dev_password@localhost/halldyll_memory
[dependencies]
halldyll_memory_model = "0.2"
# Or from Git:
halldyll_memory_model = { git = "https://github.com/Mr-soloDev/Halldyll-Memory-Model" }
use halldyll_memory_model::{Config, MemoryEngine};
use halldyll_memory_model::models::{Conversation, Message, Role};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create and initialize engine
let config = Config::default();
let engine = MemoryEngine::new(config).await?;
engine.initialize().await?;
// Create a conversation
let mut conversation = Conversation::new("My First Conversation");
conversation.add_message(Message::new(Role::User, "Hello!"));
conversation.add_message(Message::new(Role::Assistant, "Hi there!"));
// Store memory
let user_id = "user-123";
engine.store_memory(user_id, Memory::Conversation(conversation)).await?;
// Search memories
let results = engine.search(user_id, "hello", 10).await?;
println!("Found {} memories", results.len());
Ok(())
}
# PostgreSQL
DATABASE_URL=postgresql://user:password@host:5432/db
# Redis
REDIS_URL=redis://host:6379
# Embeddings
EMBEDDING_MODEL_PATH=./models/all-MiniLM-L6-v2.onnx
EMBEDDING_DIMENSION=384
# Search
SEARCH_TOP_K=10
SIMILARITY_THRESHOLD=0.7
# Cache
CACHE_SIZE=1000
# TTL
EPHEMERAL_FACT_TTL_DAYS=30
MAX_CONTEXT_TOKENS=4000
# Database
DB_POOL_SIZE=5
# Logging
RUST_LOG=info,halldyll_memory_model=debug
src/
├── core/ # Fundamental types and errors
│ ├── config.rs # Configuration
│ ├── error.rs # Error types
│ └── id.rs # ID generation
├── models/ # Data models
│ ├── conversation.rs
│ ├── fact.rs
│ ├── image.rs
│ ├── memory.rs
│ ├── transcription.rs
│ └── user_model.rs
├── user/ # User management
│ ├── manager.rs
│ └── permissions.rs
├── storage/ # Persistence layer
│ ├── pool.rs # Connection pooling
│ ├── postgres.rs # PostgreSQL operations
│ └── redis.rs # Redis caching
├── embedding/ # Vector embeddings
├── ingest/ # Data ingestion
├── retrieval/ # Memory search
├── context/ # Prompt context building
├── engine/ # Main orchestrator
└── utils/ # Utility functions
# Unit tests
cargo test --lib
# Integration tests (requires database)
cargo test --test '*' -- --test-threads=1
# All tests with logging
RUST_LOG=debug cargo test -- --nocapture
# Debug
cargo build
# Release (optimized)
cargo build --release
# Format
cargo fmt
# Lint
cargo clippy -- -D warnings
# Check
cargo check
# Full validation
cargo check && cargo fmt && cargo clippy && cargo test
cargo doc --no-deps --open
docker build -t halldyll-memory:latest .
docker run -e DATABASE_URL=postgresql://... \
-e REDIS_URL=redis://... \
halldyll-memory:latest
apiVersion: apps/v1
kind: Deployment
metadata:
name: halldyll-memory
spec:
replicas: 2
selector:
matchLabels:
app: halldyll-memory
template:
metadata:
labels:
app: halldyll-memory
spec:
containers:
- name: memory
image: halldyll-memory:latest
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: db-credentials
key: url
- name: REDIS_URL
valueFrom:
secretKeyRef:
name: redis-credentials
key: url
Compatible with RunPods serverless and pod deployments. Ensure PostgreSQL and Redis are accessible.
pub async fn store_memory(
&self,
user_id: &str,
memory: Memory,
) -> MemoryResult<()>
pub async fn search(
&self,
user_id: &str,
query: &str,
limit: usize,
) -> MemoryResult<Vec<Memory>>
pub async fn create_user(
&self,
username: String,
email: String,
role: UserRole,
) -> MemoryResult<UserModel>
Supported model specialties:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)MIT License - see LICENSE file for details
Roy Géryan - Halldyll Creator
For issues, questions, or suggestions:
Built with ❤️ for Halldyll and the AI community