Thank you for your interest in contributing to VKRA Protocol! This document provides guidelines and instructions for contributing to this open source project.
By participating in this project, you agree to abide by our Code of Conduct. Please read it before contributing.
- Check if the bug has already been reported in GitHub Issues
- If not, create a new issue with:
- Clear title and description
- Steps to reproduce
- Expected vs actual behavior
- Environment details (Python version, OS, etc.)
- Error messages or logs (sanitized, no API keys)
- Check if the feature has already been suggested
- Open an issue with the "feature request" label
- Include:
- Use case description
- Proposed API changes (if applicable)
- Benefits to developers
- Example implementation (if possible)
-
Fork the repository
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Follow the architecture patterns
- Keep core logic separate from adapters (Ports & Adapters pattern)
- Follow interface-first design
- Keep features modular and testable
- Add proper type hints
-
Write tests (see Testing Guidelines below)
- Add unit tests for new features
- Add integration tests for vertical slices
- Ensure all tests pass
-
Update documentation
- Update README if needed
- Add/update docstrings
- Update CHANGELOG.md for user-facing changes
-
Run code quality checks
uv run ruff format . uv run ruff check . uv run mypy src/ uv run pytest
-
Commit your changes
git commit -m 'Add amazing feature'- Use clear, descriptive commit messages
- Reference issue numbers if applicable
-
Push to your fork
git push origin feature/amazing-feature
-
Open a Pull Request
- Provide clear description
- Reference related issues
- Request review from maintainers
- Python 3.11 or higher
- uv package manager (recommended) or pip
- Git
-
Clone your fork:
git clone https://github.com/your-username/vkra-protocol.git cd vkra-protocol -
Install dependencies:
# With uv (recommended) uv sync --dev # Or with pip pip install -e ".[dev]"
-
Verify installation:
python -c "from vkra_protocol import LLMAOrchestrator; print('✅ Installation successful!')"
- Follow PEP 8 style guide
- Use type hints for all functions and methods
- Use
async/awaitfor all I/O operations - Keep functions focused and small
- Add docstrings for public functions and classes
- Maximum line length: 100 characters (configured in ruff)
- Interface First: All modules use abstract base classes
- Database Agnostic: No hardcoded database dependencies
- Core Isolation: Core business logic should be testable without external dependencies
- Ports & Adapters: Separate core logic from infrastructure adapters
- Modular Design: Each module is independently testable
src/vkra_protocol/
├── __init__.py # Public API exports
├── interfaces.py # Abstract interfaces (VectorDatabase, UserProfileStore)
├── orchestrator.py # Main orchestrator
├── schemas.py # Pydantic models
└── modules/ # Pluggable modules
├── base.py # Abstract base classes
├── presentation/ # Presentation modules
├── commission/ # Commission modules
├── prediction/ # Prediction modules
├── ranking/ # Ranking modules
└── user_preferences/ # User preference modules
VKRA Protocol follows a Core + Vertical Slice Architecture with Ports & Adapters pattern. Our testing strategy reflects this architecture:
- Purpose: Test business logic in total isolation
- Strategy: Mock only outbound ports/interfaces (adapters), not internal code
- Mocked Interfaces:
VectorDatabaseinterfaceUserProfileStoreinterface- OpenAI client (for embeddings)
- What's Real: All core logic (orchestrator, modules) runs with real implementations
- Location:
tests/unit/
Example:
# Mock the adapter interface, test real core logic
mock_vector_db = MockVectorDatabase()
orchestrator = LLMAOrchestrator(
vector_db=mock_vector_db, # Mock adapter
profile_store=mock_profile_store, # Mock adapter
openai_client=mock_openai, # Mock adapter
generate_embedding=mock_embedding,
)
# Test real orchestrator logic
response = await orchestrator.execute_search(request)- Purpose: Test entire features from top to bottom
- Strategy: "Sociable" unit tests - real core logic, mock only final adapters
- Approach:
- Use real
LLMAOrchestratorand all module implementations - Mock only the final adapters that touch external services
- Test complete feature flows (e.g., search request → response)
- Use real
- Location:
tests/integration/
- Don't Mock Your Own Code: Only mock outbound ports (interfaces) that connect to external services
- Isolate Core: Core business logic should be testable without any external dependencies
- Test Vertical Slices: Integration tests should test complete feature flows with real core logic
- Separate Adapter Tests: Adapter implementations are tested separately in the private API repo
# Run all tests
uv run pytest
# Run only unit tests
uv run pytest tests/unit/
# Run only integration tests
uv run pytest tests/integration/
# Run with coverage
uv run pytest --cov=src/vkra_protocol --cov-report=html
# Run specific test file
uv run pytest tests/unit/test_orchestrator.py- README.md: User-facing documentation, installation, quick start
- CONTRIBUTING.md: This file - contributor guidelines
- CODE_OF_CONDUCT.md: Community standards
- CHANGELOG.md: Version history and changes
- Docstrings: All public functions and classes should have docstrings
Use Google-style docstrings:
async def execute_search(
self,
request: SearchRequest,
) -> tuple[SearchResponse, float, float, bool]:
"""Execute the complete LLMA pipeline.
Args:
request: Search request with query and context
Returns:
Tuple of (SearchResponse, embedding_time_ms, search_time_ms, cache_hit)
"""- Maintainers will review your PR
- Address any feedback or requested changes
- Once approved, your PR will be merged
- Thank you for contributing!
- Issues: GitHub Issues
- Email: hello@vkra.org
- Documentation: https://docs.vkra.org
By contributing, you agree that your contributions will be licensed under the MIT License.
Note: For AdAPI-specific integration details (private API repository), see .github/CONTRIBUTING.md.