# Local Memory First Consumer — 2026-08-23 ## Scope Enabled the first explicit local-memory execution path without silently changing the existing Zep default. ## Changes - Added `MEMORY_BACKEND=zep|local`; unknown values fail closed. - Added per-request local entity-reader factory scoped by `organization_id` and `graph_id`. - Added worker-owned SQLAlchemy session lifecycle for local readers. - `SimulationManager` now accepts `entity_reader_factory` and uses it during preparation. - `/api/simulation/entities/*` selects the configured reader and closes it after each request. - `/api/simulation/prepare` uses the configured reader for preview and background preparation. - `OasisProfileGenerator` supports `use_zep_context=False`; local mode does not initialize Zep context for profile enrichment. - Default remains `MEMORY_BACKEND=zep` until remaining consumers and data migration are ready. ## Evidence - Switch/route tests: 3 passed. - Reader factory/entity parity/injection tests: passed. - Full backend suite after this slice: **55 passed**. - Frontend suite: **10 passed**. - Build, compileall, and Alembic upgrade/check: passed. ## Boundary This is not a full Zep removal. Profile generation still uses the legacy flow outside the explicit local preparation path, and graph tools/report consumers still need migration.