Thank you for your interest in contributing to mainloop! This document provides guidelines for contributing to the project.
- Fork the repository and clone it locally
- Set up your environment:
cp .env.example .env # Edit .env with your configuration make setup-claude-creds # Setup Claude Code credentials make dev # Start local development environment
-
Create a new branch for your changes:
git checkout -b feature/your-feature-name
-
Make your changes following the project conventions (see Code Style below)
-
Test your changes locally:
make dev # Ensure everything works -
Commit your changes with clear, descriptive commit messages
-
Push to your fork and create a Pull Request
- Use Python 3.13+ features and type hints
- Use
uvfor dependency management (uv add <package>) - Never manually edit
pyproject.tomldependencies - Follow existing patterns in the codebase
- Use Pydantic models for all data validation
- Import shared models from the
models/package
- Use Svelte 5 runes:
$state,$derived,$effect,$props - Follow mobile-first responsive design patterns
- Use the shared theme from
@mainloop/ui/theme.css - Use
$lib/api.tsfor API calls - never hardcode endpoints - Type everything with TypeScript
- Mobile-first: Design for mobile, enhance for desktop
- Delete old code: Don't keep unused code for backward compatibility
- Avoid over-engineering: Keep solutions simple and focused
- Use Makefile targets: Always run
makecommands from repo root
mainloop/
├── backend/ # Python FastAPI + DBOS workflows
├── frontend/ # SvelteKit + Tailwind v4
├── claude-agent/ # Claude Code CLI container
├── models/ # Shared Pydantic models
├── packages/ui/ # Design tokens + theme
└── k8s/ # Kubernetes manifests
# Start all services with hot reload
make dev
# Backend development
cd backend
uv run mainloop # Run server
uv add <package> # Add dependency
# Frontend development
cd frontend
pnpm dev # Dev server
pnpm check # Type check
# Deployment
make deploy # Full deploy to k8s
make deploy-loop # Watch for changes and auto-deploy- Use Pydantic models from
models/package for data validation - Use DBOS workflows for durable task execution (see
docs/DBOS.md) - Import shared models:
from models import Conversation, Message
- Import theme:
@import '@mainloop/ui/theme.css'in app.css - Use stores in
$lib/stores/for state management - API calls go through
$lib/api.ts
When modifying DBOS workflows:
- Bump
WORKFLOW_VERSIONindbos_config.pywhen changing workflow logic - DBOS replays workflows from checkpoints - changing step order/logic breaks running workflows
- Current version tracked in workflow config
- Keep PRs focused: One feature or fix per PR
- Write clear descriptions: Explain what and why
- Update documentation: If you change behavior, update docs
- Test thoroughly: Ensure local dev environment works
- Follow existing patterns: Match the style of surrounding code
- Check existing issues and discussions
- Read the documentation in
docs/ - See
CLAUDE.mdfor detailed development guide
By contributing, you agree that your contributions will be licensed under the same Sustainable Use License as the project.