Skip to main content
Upstash Redis is the clean fix for Lucia’s current fragile in-memory continuity/session state problem.

Runbook phase mapping

  • Phase 1 — account access and secret references
  • Phase 6 — add shared short-lived continuity/session state for hosted Lucia
Primary runbook page: 08 - Live Transition Runbook

Why Redis is being added

Lucia’s current continuity/session behavior is not fully launch-safe if it only lives in-process. Redis gives us a practical bridge:
  • short-lived shared session state
  • continuity across deploys/instances more cleanly
  • fast read/write for operational memory that should not live only in Node memory
  • minimal setup pain

Lucia role

Use Redis for:
  • session continuity
  • distress continuity state
  • short-lived operator memory
  • temporary action coordination
  • low-latency ephemeral state

Lucia role not to force onto Redis

Do not turn Redis into Lucia’s permanent memory brain. Use Redis for:
  • fast
  • temporary
  • shared
  • expir­ing
Use Postgres for:
  • durable
  • auditable
  • structured
  • long-horizon

Candidate Redis keys / concepts

Key PatternPurposeTTL
lucia:session:{id}operator session continuity15m–60m
lucia:distress:{id}distress streak + stageshort-lived
lucia:focus:{id}pending follow-up contextshort-lived
lucia:action:{id}temporary action coordinationshort-lived
lucia:rate:{id}optional lightweight rate controlsshort-lived

Setup checklist

Stage 1 — account and DB

  • create Upstash account
  • create Redis database
  • document region
  • document endpoint and token references

Stage 2 — Lucia integration

  • define key naming conventions
  • define TTL rules
  • move in-memory continuity logic to Redis-backed adapter
  • test continuity across redeploy/restart
  • test fallback behavior if Redis is unavailable

Stage 3 — guardrails

  • keep only short-lived state here
  • avoid overstuffing payloads
  • define purge / TTL review policy

Credentials + account reference

Account access

ItemValue
Account email
Dashboard URL
Team / org
MFA method

Database references

ItemValue
Redis database name
Region
REST URL
TCP endpoint (if used)
Read region(s)

Keys and secrets

Secret / TokenValue or 1Password ReferenceNotesRotated
REST URL
REST token
password / auth tokenif applicable

Environment variable tracker

VariableValue / ReferenceUsed In
UPSTASH_REDIS_REST_URLEngine
UPSTASH_REDIS_REST_TOKENEngine
REDIS_URLoptional
REDIS_TOKENoptional

Key design notes

TTL policy

  • session continuity TTL:
  • distress continuity TTL:
  • pending follow-up TTL:
  • fallback behavior if expired:

Failure behavior

  • If Redis is down:
  • Lucia should:
  • Operator impact:
  • Alerting path:

Notes / gotchas

  • Redis is the bridge, not the cathedral.
  • It solves a real problem right now: shared short-lived continuity.