Contributing¶
Thank you for your interest in contributing to Memori! This guide will help you get started.
Quick Start¶
- Fork the repository on GitHub
- Clone your fork locally
- Install development dependencies
- Make your changes
- Submit a pull request
Development Setup¶
Prerequisites¶
- Python 3.8+
- Git
Installation¶
# Clone your fork
git clone https://github.com/GibsonAI/memori.git
cd memori
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
Development Dependencies¶
The development installation includes:
- pytest
- Testing framework
- black
- Code formatting
- ruff
- Linting
- mypy
- Type checking
- mkdocs
- Documentation
Project Structure¶
memori/
โโโ memorisdk/ # Main package
โ โโโ core/ # Main memory interface and database
โ โโโ config/ # Configuration management
โ โโโ agents/ # Memory processing agents
โ โโโ database/ # Database connectors and queries
โ โโโ integrations/ # LLM provider integrations
โ โโโ utils/ # Helpers and utilities
โ โโโ tools/ # Memory search tools
โโโ tests/ # Test suite
โโโ docs/ # Documentation
โโโ examples/ # Usage examples
โโโ archive/ # Archived old files
Development Workflow¶
1. Code Style¶
We use black
for code formatting and ruff
for linting:
# Format code
black memorisdk/ tests/
# Lint code
ruff check memorisdk/ tests/
# Type checking
mypy memorisdk/
2. Testing¶
# Run all tests
pytest
# Run with coverage
pytest --cov=memorisdk
# Run specific test file
pytest tests/test_memory.py
# Run specific test
pytest tests/test_memory.py::test_memory_recording
3. Documentation¶
Documentation is built with MkDocs:
# Install docs dependencies
pip install -r docs/requirements.txt
# Serve docs locally
mkdocs serve
# Build docs
mkdocs build
Contributing Guidelines¶
Code Quality¶
- Follow PEP 8 - Use
black
for formatting - Add type hints - Use Python type annotations
- Write docstrings - Use Google-style docstrings
- Add tests - Maintain high test coverage
- Update docs - Keep documentation current
Commit Messages¶
Use clear, descriptive commit messages:
feat: add PostgreSQL connection pooling
fix: resolve memory leak in agent processing
docs: update configuration examples
test: add integration tests for LiteLLM
Pull Requests¶
- Create a feature branch from
main
- Make focused changes - One feature per PR
- Add tests for new functionality
- Update documentation if needed
- Ensure CI passes - All tests and checks must pass
Types of Contributions¶
๐ Bug Reports¶
Use the GitHub issue template: - Clear description of the bug - Steps to reproduce - Expected vs actual behavior - Environment details
โจ Feature Requests¶
Before implementing a new feature: 1. Check existing issues - Avoid duplicates 2. Open a discussion - Propose the feature first 3. Wait for approval - Ensure it aligns with project goals
๐ Documentation¶
Documentation improvements are always welcome: - Fix typos and grammar - Add examples and tutorials - Improve clarity and organization - Translate to other languages
๐งช Testing¶
Help improve test coverage: - Add unit tests for untested code - Create integration tests - Add performance benchmarks - Test edge cases
Development Tips¶
Running Examples¶
Test your changes with the examples:
Database Testing¶
Test with different databases:
# SQLite (default)
python -c "from memori import Memori; m = Memori(); print('SQLite OK')"
# PostgreSQL (requires setup)
python -c "from memori import Memori; m = Memori(database_connect='postgresql://...'); print('PostgreSQL OK')"
Integration Testing¶
Test with real LLM providers:
Memory Inspection¶
Check memory storage during development:
from memori import Memori
memori = Memori()
memori.enable()
# ... your code ...
# Inspect memories
stats = memori.get_memory_stats()
print(f"Stored memories: {stats}")
memories = memori.get_memories(limit=5)
for memory in memories:
print(f"Memory: {memory}")
Architecture Guidelines¶
Code Organization¶
- Separation of concerns - Each module has a clear purpose
- Dependency injection - Use configuration for external dependencies
- Error handling - Use custom exceptions with context
- Type safety - Full type annotations and validation
Database Design¶
- SQL in query modules - Centralized query management
- Connection pooling - Efficient resource usage
- Migration support - Schema versioning
- Multi-database - Support SQLite, PostgreSQL, MySQL
API Design¶
- Simple interface - Minimal required configuration
- Pydantic validation - Type-safe data structures
- Error context - Detailed error information
- Backwards compatibility - Careful API evolution
Getting Help¶
- GitHub Issues - Bug reports and feature requests
- Discussions - General questions and ideas
- Email - Direct contact for sensitive issues
Recognition¶
Contributors will be: - Listed in the project README - Credited in release notes - Invited to join the maintainers team (for significant contributions)
Thank you for helping make Memori better!