Status: operational reference. The technologies the system runs on and the recurring code
patterns we apply, with the why for each. Choices are Cloudflare-first (P-9); the deep
rationale lives in BACK-OFFICE.md (BO-*) and ARCHITECTURE.md
(D-*). Companion to SYSTEM-DESIGN.md and PRINCIPLES.md.
1. Runtime substrate (Cloudflare)
Layer
Tech
Role / notes
Durable orchestration
Cloudflare Workflows
GA durable execution: per-step retries, persisted state, waitForEvent for human gates. The orchestration spine (BO-2).
Stateful agents
Cloudflare Agents SDK (agents)
Each agent is a Durable Object (identity, SQLite state, WebSockets, scheduling, agents/observability). Avoid preview bits on the critical path.
Request handlers
Workers (+ Hono for services)
console-api and agents are Workers; Hono is the HTTP framework.
No ORM — typed access modules over raw prepared statements; the row shape is a JSON payload + a few promoted/indexed columns (see @namaste-ji/catalog). Parse payload → contract on read; keep indexed columns in sync on write.
Non-safety knobs; anything safety-shaped goes in the Control DO, not KV.
Vectors
Vectorize (cloud) / Qdrant (local)
Behind a VectorIndex port; one multimodal index (dim 1024) for retrieval/dedup/diversity/analysis.
3. Model & AI layer
Concern
Tech
Notes
Model interface
Vercel AI SDK (ai) behind ModelPort / EmbedderPort
Provider-agnostic LanguageModel/EmbeddingModel; our own interface so a provider swap is config (BO-2).
Routing/cost/cache/logs
AI Gateway
All production model calls route through it; BYOK (provider keys live in the gateway, not code).
Prompt registry + tracing + evals
Langfuse
Prompts resolved by name@label (cache + last-known-good fallback); resolved version logged in the trace. AI Gateway routes; Langfuse registers/traces — separate concerns (AK-6).
Text LLM (local)
Ollama (OSS models)
Local dev loop; behavioural parity, not identical to prod model.
Multimodal embeddings (local)
Infinity + jina-clip-v2
Ollama can’t embed images; Infinity is the local CLIP workhorse.
Multimodal embeddings (cloud)
Jina CLIP v2 / Cohere embed-v4 / Voyage or Workers AI
Behind EmbedderPort; Matryoshka-truncatable to the index dim.
Considered, not adopted:Mastra (great TS agent framework, but brings its own
durable-workflow + memory model that overlaps Workflows + Agents-SDK-on-DO — we borrow its ideas,
e.g. evals-first, not its runtime, BO-2).
4. Contracts, types & validation
Zod versioned contracts in @namaste-ji/shared are the interface between
components: the brief, the Content Strategy (strategy@vN), FeedPolicy,
OnboardingSignals. A downstream agent consumes one cold, so contracts are immutable +
versioned + reproducible (CP-3, FL-2, P-13).
TypeScript everywhere (incl. infra — Alchemy is pure TS). @cloudflare/workers-types on Workers.
5. Control, auth & governance
Concern
Tech
Autonomy / gates / kill switch
Control Durable Object (policy engine, WebSocket broadcast)
BO auth
Cloudflare Access (perimeter SSO/MFA) + D1 RBAC (@namaste-ji/rbac) — coarse in Access, fine in app
Consumer auth
Better Auth on Workers (D1-native, phone-OTP + social, no per-MAU fee)
Secrets
Cloudflare Secrets Store (secrets_store_secrets bindings)
Experimentation
Statsig — deferred to the consumer/frontend plane; the BO uses KV + Control DO + vars