AI service for theblueprintcode. Tenant-aware knowledge hub (RAG), agents (LangGraph) and MCP tools, sitting beside engine. Full plan: ../docs/ai-module-plan.md.
cp .env.example .env # set JWT_ACCESS_SECRET to the same value as engine/.env
createdb cortex # on the local Postgres (:5432); needs the pgvector extension available (Postgres.app ships it)
uv sync
uv run uvicorn app.main:app --reload --port 5202
uv run pytestGET /healthchecks the AI database.GET /v1/whoami(Bearer token from the engine's/auth/login) shows the AI schema Cortex derived from the token.
Cortex trusts only the engine-signed JWT. Tenant tokens map to schema ai_<accountId>, root (platform) tokens map to public. The schema is never read from the request body or headers. All DB access goes through app/db.py:tenant_connection.