Development Environment Setup
This guide covers setting up MemSync for local development, testing, and contributing to the project.Prerequisites: Python 3.9+, PostgreSQL, and Redis are required for local development.
Local Installation
Step 1: Clone the Repository
Step 2: Install Dependencies
MemSync uses Poetry for dependency management:Step 3: Environment Configuration
Create a.env
file in the project root:
Step 4: Database Setup
Initialize the PostgreSQL database with pgvector extension:Step 5: Start Development Server
http://localhost:8000
Testing
MemSync includes comprehensive test suites for all components:Running Tests
Test Categories
Unit Tests
Unit Tests
Test individual components like memory extraction, embedding generation, and vector operations.
Integration Tests
Integration Tests
Test API endpoints and database interactions.
Memory Buffer Tests
Memory Buffer Tests
Test the buffered memory system for conversation processing.
Integration Testing
Test external integrations with sample data:Development Tools
Code Quality
MemSync uses several tools to maintain code quality:Available Make Commands
Performance Testing
Benchmarking
MemSync includes comprehensive benchmarking against the Locomo dataset:Performance Metrics
Key metrics tracked:- Memory extraction accuracy: How well facts are extracted from conversations
- Search relevance: Quality of semantic search results
- Storage efficiency: Memory usage vs. retrieval accuracy
- Processing speed: Time to index and search memories
API Development
Testing API Endpoints
Use the interactive API documentation athttp://localhost:8000/docs
or test with curl:
Adding New Endpoints
- Define request/response models in
server/main.py
- Implement the endpoint function
- Add tests in
tests/
- Update API documentation
Configuration Options
Memory Configuration
Customize memory extraction and storage:Integration Configuration
Configure external service integrations:Debugging
Common Issues
Database Connection Errors
Database Connection Errors
Ensure PostgreSQL is running and pgvector extension is installed:
Memory Extraction Not Working
Memory Extraction Not Working
Check LLM configuration and API keys:
Vector Search Issues
Vector Search Issues
Verify embeddings are being generated correctly:
Logging
Enable detailed logging for debugging:Contributing
Development Workflow
- Fork and clone the repository
- Create a feature branch:
git checkout -b feature/your-feature
- Make changes and add tests
- Run tests:
pytest
- Run linting:
ruff check .
- Commit changes: Follow conventional commit format
- Push and create PR
Code Standards
- Follow PEP 8 style guidelines
- Add type hints for all functions
- Write tests for new functionality
- Update documentation as needed
- Use conventional commit messages
Testing Requirements
All PRs must include:- Unit tests for new functionality
- Integration tests for API changes
- Performance benchmarks for core features
- Documentation updates
Deployment
Production Setup
- Environment variables: Configure all required environment variables
- Database: Set up PostgreSQL with pgvector in production
- Redis: Configure Redis for task queue
- Monitoring: Set up Datadog or similar monitoring
- Security: Configure CORS, rate limiting, and authentication
Docker Deployment
Need Help?
- Documentation: Check our API Reference
- Issues: Report bugs on GitHub Issues
- Community: Join our Discord community
- Email: Contact us at dev@memsync.ai