Skip to main content

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

The API server will be available at http://localhost:8000

Testing

MemSync includes comprehensive test suites for all components:

Running Tests

Test Categories

Test individual components like memory extraction, embedding generation, and vector operations.
Test API endpoints and database interactions.
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 at http://localhost:8000/docs or test with curl:

Adding New Endpoints

  1. Define request/response models in server/main.py
  2. Implement the endpoint function
  3. Add tests in tests/
  4. Update API documentation
Example endpoint structure:

Configuration Options

Memory Configuration

Customize memory extraction and storage:

Integration Configuration

Configure external service integrations:

Debugging

Common Issues

Ensure PostgreSQL is running and pgvector extension is installed:
Check LLM configuration and API keys:
Verify embeddings are being generated correctly:

Logging

Enable detailed logging for debugging:

Contributing

Development Workflow

  1. Fork and clone the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make changes and add tests
  4. Run tests: pytest
  5. Run linting: ruff check .
  6. Commit changes: Follow conventional commit format
  7. 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

  1. Environment variables: Configure all required environment variables
  2. Database: Set up PostgreSQL with pgvector in production
  3. Redis: Configure Redis for task queue
  4. Monitoring: Set up Datadog or similar monitoring
  5. Security: Configure CORS, rate limiting, and authentication

Docker Deployment

For more detailed deployment instructions, see the deployment guide.

Need Help?