Thank you for your interest in contributing to MemGuard. This guide will help you get started.
- Python 3.12+
- Node.js 20+
- Docker & Docker Compose
- uv (recommended) or pip
# Clone the repo
git clone https://github.com/ac12644/MemGuard.git
cd MemGuard
# Start dependencies
docker-compose up -d postgres redis
# Backend
uv venv && uv pip install -e ".[dev]" psycopg2-binary
source .venv/bin/activate
alembic upgrade head
uvicorn src.main:app --reload --port 8001
# Dashboard (separate terminal)
cd dashboard && npm install && npm run dev# Unit tests (fast, no DB required)
pytest tests/unit/ -v
# Integration tests (requires running server)
pytest tests/integration/ -v
# Lint
ruff check src/ tests/
# Dashboard type check
cd dashboard && npx tsc --noEmit- Open an issue with a clear title and description
- Include steps to reproduce, expected behavior, and actual behavior
- Add relevant logs or screenshots
- Open an issue with the
enhancementlabel - Describe the problem you're solving and your proposed solution
- Consider how it fits with the existing architecture
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Run tests:
pytest tests/unit/ -v - Run lint:
ruff check src/ tests/ - Commit with a clear message
- Push and open a PR against
main
- Keep PRs focused on a single change
- Add tests for new functionality
- Update docs if you change API behavior
- Follow the existing code style
- Async everywhere for DB and HTTP operations
- Type hints on all function signatures
- Pydantic for API input/output validation
- SQLAlchemy ORM for all database queries (no raw SQL)
- 120 character line length (enforced by Ruff)
- Google-style docstrings on public functions
- snake_case for variables, functions, modules
- camelCase for variables and functions
- PascalCase for components
- Prefer functional components with hooks
- Use @tanstack/react-query for data fetching
- Follow the Obsidian Intelligence design system tokens
Use clear, imperative-mood messages:
Add Zep connector with graph search support
Fix trust score calculation for zero-retrieval memories
Update dashboard memory cards with expand/collapse
src/
api/routes/ # FastAPI route handlers
connectors/ # Memory system adapters (implement BaseConnector)
engine/ # Validation strategies + trust scoring
models/ # SQLAlchemy ORM models
scheduler/ # Celery tasks + prioritizer
quarantine/ # Quarantine management
mcp/ # MCP server for agent integration
utils/ # Shared utilities
dashboard/src/
pages/ # Route-level page components
components/ # Shared UI components
api/client.ts # API client (typed fetch wrapper)
- Create
src/connectors/myconnector.pyimplementingBaseConnector - Add it to
src/connectors/registry.py - Add a form section in
dashboard/src/pages/Connectors.tsx - Add tests in
tests/unit/test_myconnector.py
- Create
src/engine/strategies/mystrategy.py - Register it in
src/engine/validator.py - Add a strategy card in
dashboard/src/pages/Validations.tsx - Add tests in
tests/unit/test_mystrategy.py
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.