Cloudflare RLM Army

type: architecture

description: 5-worker Cloudflare Workers deployment forming the edge nervous system for Genesis RLM (Recursive Language Model) memory bloodstream. Gateway, Query, Ingestion, Evolution, and Sync workers. Hybrid with Elestio (brain stem).


RLM Gateway Worker

type: entity

description: API gateway worker at /api/rlm/* routing all RLM operations. Handles auth (X-Genesis-Token via KV), routes to query/ingest/health/entity endpoints. Service bindings to all other workers.

worker_name: rlm-gateway


RLM Query Worker

description: Semantic search worker using Cloudflare Vectorize (768-dim bge-base-en-v1.5 embeddings) with KV caching (5-min TTL). Target: sub-50ms p50 latency globally. Falls back to Qdrant for deep/complex queries.

worker_name: rlm-query


RLM Ingestion Worker

description: Queue consumer worker processing new memories. Flow: Queue message -> Workers AI embedding -> Vectorize upsert -> KV hot cache -> R2 blob -> Hyperdrive PostgreSQL sync -> Evolution queue event.

worker_name: rlm-ingest


RLM Evolution Worker

description: Surprise detection and axiom generation worker. Scores events using Violation(0.35)+Novelty(0.25)+Impact(0.25)+Rarity(0.15). HIGH surprise (>=0.70) triggers axiom generation via Llama 3.1 8B. Finds related entities via Vectorize similarity.

worker_name: rlm-evolve


RLM Sync Worker

description: Bidirectional sync between Cloudflare edge and Elestio PostgreSQL. Cron every 15 minutes + on-demand. Pull new entities from PG, embed, upsert to Vectorize/KV. Push edge-originated entities to PG. Elestio wins on conflict.

worker_name: rlm-sync


Hybrid Architecture Decision

type: decision

description: Cloudflare = nervous system (fast edge queries, embeddings, async pipelines). Elestio = brain stem (PostgreSQL source of truth, complex queries, preference learning). Neither alone is sufficient. Combined cost: ~$57/mo for global sub-50ms memory.


name: D1 Exclusion Decision (Rule 7 Compliance)

description: D1 (SQLite at edge) intentionally excluded from RLM architecture despite being technically different from local SQLite. Uses KV+Vectorize+R2+Hyperdrive instead. Strict Rule 7 compliance. May revisit if Kinan explicitly approves D1 exception.


Cloudflare RLM Army Cost Model

Estimated $10.70/mo for full Cloudflare army (Workers Paid $5 + AI embeddings $0.60 + AI text gen $0.30 + KV writes $2.50 + Queues $0.80 + rest within free tiers). Combined with Elestio $46/mo = $57/mo total for global edge memory system. One $497 customer covers 6+ months.


RLM Army Deployment Timeline

type: timeline

description: Phase 1 (Foundation): Feb 26 - 2-3hr. Phase 2 (Gateway+Query): Feb 27 - 4-6hr. Phase 3 (Ingest+Sync): Feb 28 - 4-6hr. Phase 4 (Evolution): Mar 1 - 3-4hr. Phase 5 (Integration): Mar 1 - 3-4hr. Full army online: March 1, 2026. Total: 16-23 hours build time.


rlm_dep_ax_001 Refinement

Original axiom 'Cloudflare Workers unsuitable for Python AI workloads' REMAINS VALID. The Cloudflare RLM Army works AROUND this limitation: Workers handle routing/caching/KV/queues, Workers AI handles embeddings/text-gen natively on GPU fleet (no Python), Elestio handles complex ML/SQL. No Python on Workers.


Cloudflare Vectorize for Genesis

description: Globally distributed vector database. 10M vectors per index, 50K indexes per account, 1536 max dimensions (using 768 for bge-base-en-v1.5). Cosine metric. 20 results with metadata, 100 without. Free tier: 5M stored vectors, 30M queried dimensions/mo. Replaces Qdrant for hot-path queries.


Cloudflare Hyperdrive for Genesis

description: Connection pooling and caching layer between Workers and Elestio PostgreSQL. Eliminates cold connection overhead. Supports Postgres and MySQL. Default-on query caching for popular queries. Free tier: 100K queries/day. This is the BRIDGE between edge and source of truth.


Workers AI Embedding Models for RLM

description: Primary: @cf/baai/bge-base-en-v1.5 (768-dim, $0.020/M tokens). Fallback: @cf/baai/bge-small-en-v1.5 (384-dim, $0.020/M tokens). Reranker: @cf/baai/bge-reranker-base. Multilingual: @cf/baai/bge-m3 ($0.012/M tokens). All run natively on Cloudflare GPU fleet — no Python needed.


Genesis Cloudflare Account Assets

type: infrastructure

description: API Token: hrpgSOIfHPjd... (exists). Zone: sunaiva.com (20892d5597c...). NS: bob/kim.ns.cloudflare.com. Existing wrangler config: supermemory-mcp/wrangler.jsonc. Workers Paid plan: NEEDS ACTIVATION ($5/mo).