
- 30 Oct 2026 (abb553a9): after a kernel restart, module imports (guard) and closure state (the DONE queue) may be lost even when names appear defined. Rebuild: sys.path.insert(0, tools); import guard; rebuild done/flush from plans/<date>.tasks.json and skip ids already in TD/batch*.json. 4 completions were nearly lost this way.

- 30 Oct 2026 10:45Z (f7622389): it happened AGAIN after a context compaction (no restart): the revived mark()/flush() kept a private globals dict where TD was None, so 29 completions queued silently and flush wrote nothing; recovered from mark.__globals__['done']. Durable fix: mark() appends each completion to TD/pending.jsonl on disk and flush() reads that file, so kernel state never holds the only copy. After any resume, check `mark.__globals__ is globals()` and re-define helpers if False.