Lab: Checkpoints, resumable runs and a careful memory
41 min read·13 Oct 2026
Module 8 · Lab · About 75 minutes · Needs: the Module 3 lab'stools.py, Module 5's loop (Lesson 1), and lessons 1 and 2 (RunRecord,Checkpoints,run_checkpointedand idempotency keys; the memory gate,remember,recallandforget)
What you are building
This lab moves both lessons' code into one file, returns_desk/state.py, which imports Module 3's tools.py and never replaces it. Its first half keeps a run safe: a run record beside the transcript, a checkpoint after every turn in SQLite, a resume after a crash, and an idempotency key on every write that leaves BrightCart, the email included. Its second half is a careful memory: a gate on what may be stored, a scope taken from the session, recall as data, superseding and forgetting. Tests pin both halves. Everything at BrightCart is simulated.