Skip to main content

Server (apps/server)

The single Django service that hosts every business decision. Client surfaces are thin; this is where the real logic, the database, and the LLM calls live.

Django apps

AppPurposeURL prefix
recordingIdempotent ingest of CloneEvent rows; sessions and event detail./api/recording/
memoriesProfile, semantic facts, episodes, raw memory; promotion pipeline./api/memory/
predictionsPredict, batch-predict, feedback, list, stats./api/predictions/
accountsSignup, login, JWT refresh, invite/waitlist, API keys./api/auth/
accessPer-account member list, invite/approve/decline./api/access/
voiceElevenLabs voice synthesis endpoints./api/voice/
sourcesSource connectors (per-integration adapter scaffolding)./api/sources/
newsCurated news feed for the marketing site./api/news/
monitoringRead-only health and stats endpoints./api/monitoring/
jobsBackground-job records (one row per LLM call etc.)./api/jobs/
configProject URL conf.N/A

Stack

  • Django 6 + Django REST Framework
  • djangorestframework-simplejwt for JWT (60-min access, longer-lived refresh)
  • Postgres 16 in production (DATABASE_URL), SQLite in development
  • anthropic Python SDK for prediction and memory promotion
  • jsonschema for validating CloneEvent payloads against packages/schema/events.schema.json
  • uv for dependency management (pyproject.toml + uv.lock)

Run it

cd apps/server
uv sync
uv run python manage.py migrate
uv run python manage.py runserver 0.0.0.0:8001
uv run python manage.py test # required before merging

Authentication

Every endpoint above requires IsAuthenticated. Two credentials are accepted:

  • JWTAuthorization: Bearer <access> (60-min lifetime; refresh via POST /api/auth/token/refresh/).
  • API keyX-Clone-API-Key: clone_… (long-lived; rotate from POST /api/auth/keys/).

Per-user data is filtered server-side on request.user — clients cannot see other users' rows even with a valid token. See Authentication.

Anthropic integration

Prediction (predictions/llm.py) and memory promotion (memories/promotion.py) are the only paths that call Anthropic. Both share the same SUPPORTED_MODELS allow-list and the same DRF error mapping (APIKeyMissing → 503, RateLimitError → 429, AuthenticationError → 503, APIConnectionError → 503, APIStatusError → 502). The default model is claude-sonnet-4-6.