docs.rs failed to build memrecd-0.6.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
memrecd-0.5.0
MemRec Daemon — AI Memory Persistence Server
The daemon server for MemRec AI memory persistence system, providing persistent storage, semantic search, and project isolation.
Overview
memrecd is the core server component of the MemRec ecosystem. It runs as a background daemon, exposing a JSON-RPC 2.0 API over Unix socket for memory operations, semantic search, and project management.
Features
- Persistent Storage: RocksDB-based storage for metadata and vector embeddings
- Semantic Search: Vector similarity search using ONNX models (MiniLM-L6-v2, BGE-M3)
- Project Isolation: Separate memory spaces per project with automatic detection
- Unix Socket API: JSON-RPC 2.0 interface for local communication
- Importance Scoring: Automatic importance calculation based on recency, access count, and relevance
- Chunked Storage: Support for large memories with automatic chunking
- Embedding Generation: Integration with fastembed for efficient embeddings
Installation
From crates.io (Recommended)
Using mr-install (All-in-one)
Usage
Starting the Daemon
# Start the daemon (will run in background)
# Start with verbose logging
RUST_LOG=debug
# Check daemon status
Configuration
The daemon reads configuration from ~/.memrec/config.toml:
= "0.3.0"
[]
= "minilm-l6-v2" # or "bge-m3"
= "huggingface"
= 384 # 1024 for BGE-M3
[]
= "~/.memrec/memrecd.sock"
= "~/.memrec/data"
= "~/.memrec/vectors"
= "~/.memrec/memrecd.log"
# Model files with SHA256 hashes for security
[[]]
= "model.onnx"
= "bbd7b466f6d58e646fdc2bd5fd67b2f5e93c0b687011bd4548c420f7bd46f0c5"
= true
[[]]
= "tokenizer.json"
= "da0e79933b9ed51798a3ae27893d3c5fa4a201126cef75586296df9b4d2c62a0"
= true
Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Unix Socket │────▶│ JSON-RPC 2.0 │────▶│ Request Router │
│ Interface │ │ Handler │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Vector Store │◀───▶│ Embedding Gen │◀───▶│ Model Config │
│ (RocksDB) │ │ (fastembed) │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Metadata Store │ │ Project Detect │ │ Importance │
│ (RocksDB) │ │ (.mr_pid) │ │ Calculator │
└─────────────────┘ └─────────────────┘ └─────────────────┘
API Reference
JSON-RPC Methods
The daemon supports the following JSON-RPC 2.0 methods:
Memory Operations
add_memory- Add a new memory with optional tags and importanceget_memory- Retrieve a memory by IDupdate_memory- Update an existing memorydelete_memory- Soft delete a memorylist_memories- List memories with paginationsearch_memories- Semantic search with relevance scoring
Project Operations
get_project_info- Get current project informationset_project- Manually set project contextlist_projects- List all projects
System Operations
ping- Health checkstats- Get server statisticsversion- Get server version
Example API Usage
# Using curl to interact with the socket
|
Development
Building from Source
# Clone repository
# Build in release mode
# Run tests
Running Tests
# Run all tests
# Run specific test categories
Logging
The daemon uses tracing for structured logging:
# Different log levels
RUST_LOG=error RUST_LOG=warn RUST_LOG=info RUST_LOG=debug RUST_LOG=trace
Performance
Memory Usage
- Metadata: ~50 bytes per memory entry
- Vectors: 384 bytes (MiniLM-L6-v2) or 1024 bytes (BGE-M3) per memory
- Index: Additional ~20% overhead for vector indices
Throughput
- Embedding: ~1000 texts/second on CPU
- Search: ~10,000 vectors/second for nearest neighbor search
- Storage: ~10,000 writes/second for metadata
Scalability
- Supports millions of memories per project
- Automatic memory chunking for large contents
- Background importance recalculation
Security
Data Protection
- Project isolation prevents cross-project data access
- Unix socket permissions restrict access to owner
- Configuration files are user-mode only (600 permissions)
Model Security
- SHA256 hash verification for downloaded models
- Optional
--skip-hash-verifyflag with security warnings - Support for trusted mirrors with hash validation
Service Security
- Runs as user service (not root)
- No network exposure by default
- Hardened service configuration files
Troubleshooting
Common Issues
-
Socket Connection Failed
# Check if daemon is running | # Check socket permissions # Restart daemon -
Model Download Failed
# Check network connectivity # Use mirror # Skip hash verification (security risk) -
Storage Issues
# Check disk space # Repair database # Re-run mr-install to recreate
Logs
- Service logs:
~/.memrec/memrecd.log - System logs:
journalctl --user -u memrecd(Linux) - Launchd logs:
log stream --predicate 'subsystem == "cn.itcraft.memrecd"'(macOS)
Contributing
See CONTRIBUTING.md for development guidelines.
License
Apache License 2.0 - see LICENSE for details.