Persistence model
Molt persists a small notebook document, not a running notebook session.
Durable state
Section titled “Durable state”Molt saves:
- Four tab entries.
- Each tab’s numeric index.
- Each cell’s identity.
- Each cell’s Python source.
- Cell order through array order.
This is enough to reconstruct the visible editing surface.
Transient state
Section titled “Transient state”The following fields are deliberately excluded:
- Cell outputs.
- Execution counts.
- Idle, running, success, or error states.
- Notebook execution counters.
- Toolbar kernel state.
- Python globals, imports, objects, open files, or package state.
- Active tab and editor focus.
On load, persisted cells receive fresh transient defaults. Every kernel begins as a new Python process when ensured.
Debounced writes
Section titled “Debounced writes”After a source or cell-order change, Molt waits about 1.5 seconds before saving. A new change restarts that delay.
A write is skipped when only transient state changed. Running a cell therefore does not write merely because outputs or execution labels changed. Editing source, inserting a cell, deleting a cell, moving a cell, or clearing a tab changes the persisted snapshot and triggers a write.
Molt orders saves so that an older write cannot replace a newer snapshot. A failure remains pending and appears in a warning banner; a later durable change or the best-effort quit-time save can retry it.
Initial-load safety
Section titled “Initial-load safety”Molt waits for the initial load attempt before showing the notebook or enabling autosave. This prevents blank initial state from overwriting existing data before it has been read.
If no file exists, Molt keeps its default four one-cell notebooks.
If loading or validation fails, Molt shows a warning, continues with defaults, and disables autosave for that session so it cannot overwrite the invalid file. There is no in-app repair interface.
File-level consequences
Section titled “File-level consequences”Persistence atomically replaces one JSON file rather than using a database or one file per tab. This makes backups and manual inspection simple, but it also means:
- Clear can quickly replace an entire tab’s source in the next autosave.
- Manual edits should be performed only while Molt is quit.
- A malformed file can prevent source restoration.
- There is no built-in history, versioning, conflict resolution, or cloud synchronization.
Use Manage saved work for safe backup and recovery procedures.
Configuration is separate
Section titled “Configuration is separate”config.toml and notebooks.json share the Molt Application Support directory but have separate lifecycles:
- Configuration is read when Molt starts and rewritten when Settings is saved.
- Notebook data is loaded when the editing surface starts and saved after durable changes.
Changing a configuration field does not modify notebook source. Resetting notebooks.json does not reset the interpreter or appearance setting.
