Thank you for your interest in contributing! This guide will help you get started.
- Docker & Docker Compose
- Python 3.11+
- Node.js 20+
- Git
# 1. Clone the repository
git clone https://github.com/kagura-ai/memory-cloud.git
cd memory-cloud
# 2. Copy environment config
cp .env.example .env.local
# 3. Start services
docker compose up -d
# 4. Run database migrations
cd backend && alembic upgrade head
# 5. Verify
curl http://localhost:8080/health # Backend
open http://localhost:3000 # FrontendSee the README for platform-specific instructions (WSL, macOS, Linux).
- Naming:
snake_case(functions/variables),PascalCase(classes),UPPER_SNAKE_CASE(constants) - Type hints: Required on all function signatures
- Docstrings: Google style on public functions
- Logger: Use
structlogviafrom utils.logger import get_logger— neverprint() - Database: Always use async SQLAlchemy (
AsyncSession) — synchronous only for OAuth2 (Authlib) - SQL: Never use f-strings for SQL queries — use SQLAlchemy ORM or
text()with bind parameters
# Lint
cd backend && ruff check src/ tests/
# Format
cd backend && ruff format src/ tests/
# Type check
cd backend && pyright src/- Components:
PascalCase(MemoryCard.tsx) - Utilities:
camelCase(formatDate.ts) - Types:
PascalCasewith descriptive names - Forbidden: No
anytype, noconsole.log, no hardcoded API URLs
cd frontend && npm run build# All tests
cd backend && pytest -v --maxfail=5
# Smoke tests (fast, no DB required)
make test-smoke
# E2E tests
make test-e2e
# URL validation (all routes)
make test-urls
# Integration tests (DB, migrations, attachments)
make test-integration
# Frontend tests
make test-frontend
# With coverage
cd backend && pytest --cov=src --cov-report=html- Place test files in
backend/tests/{module}/test_{name}.py - Use
pytest-asynciofor async tests - Mock auth with
app.dependency_overrides[get_current_user] - Target coverage: 90%+
main (default)
├── {issue-number}-feat/{description} # New features
├── {issue-number}-fix/{description} # Bug fixes
├── {issue-number}-refactor/{description}
├── {issue-number}-test/{description}
└── {issue-number}-docs/{description}
- Branch from
main, merge back tomain(squash merge) - Branch lifespan: max 7 days
- Keep up to date:
git rebase origin/main - Releases: tag-based (
v1.0.0,v1.1.0, ...)
Follow Conventional Commits:
<type>(<scope>): <subject> (#issue-number)
[optional body]
Types: feat, fix, refactor, test, docs, chore
Scopes: api, mcp, auth, db, infra, frontend, docs
Examples:
feat(mcp): add create_context tool (#309)
fix(api): apply scope filter to memory list count (#296)
test: add smoke/E2E/URL validation tests (#300)
- Create a branch from
main - Make your changes
- Run quality checks:
make lint && make test-local - Push and create a PR against
main - Fill in the PR template
PR title: Keep under 70 characters, use Conventional Commits format.
Migrations are managed with Alembic:
# Create a new migration
make migrate-create name="add_new_column"
# Run pending migrations
make migrate
# Check current status
make migrate-status
# Rollback last migration
make migrate-downImportant: Review auto-generated migrations before applying — remove any legacy schema differences.
This project includes pre-configured Claude Code tooling in .claude/. See the README — Getting Started with Claude Code for setup instructions.
- Slash commands:
/test,/quality,/self-review,/self-maint,/issue-start,/remember,/recall - Hooks: Auto-format (ruff/prettier), secret detection, SQL injection prevention, memory sync
- Agents:
code-reviewer,test-runner - Rules: Backend, frontend, and security coding standards (auto-loaded by file path)
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.