Files and schemas
Application data directory
Section titled “Application data directory”~/Library/Application Support/molt/| File | Owner | Format | Created when |
|---|---|---|---|
config.toml |
Rust configuration layer | TOML | First configuration load when missing, or Settings save |
notebooks.json |
React persistence hook through Rust file commands | Compact JSON | First persistable notebook change after load |
The code falls back to a relative working-directory path only if the operating system configuration directory cannot be resolved.
Notebook schema version 1
Section titled “Notebook schema version 1”A representative file is:
{ "version": 1, "tabs": [ { "tabIndex": 0, "cells": [ { "id": "0f4a9e9a-72de-4b04-a180-56e0c44fbf05", "type": "code", "source": "value = 21\nvalue * 2" } ] }, { "tabIndex": 1, "cells": [ { "id": "1ec4e25e-81e4-4b44-8429-07ff095e8052", "type": "code", "source": "" } ] }, { "tabIndex": 2, "cells": [ { "id": "97f8ef11-6248-4cd8-bc4f-e1386ec69cc0", "type": "code", "source": "" } ] }, { "tabIndex": 3, "cells": [ { "id": "9b87faef-1524-4f13-b64d-8a0cf4701303", "type": "code", "source": "" } ] } ]}Field reference
Section titled “Field reference”| Field | Type | Meaning | Validation on load |
|---|---|---|---|
version |
Number | Persistence format marker; writer emits 1 |
Must equal 1 |
tabs |
Array | Persisted tab entries | Must be an array |
tabIndex |
Number | Matches frontend notebook index | Unique integer from 0 through 3 |
cells |
Array | Ordered cell records | Empty array is replaced with one fresh code cell |
id |
String | Stable cell identity, normally a browser-generated UUID | Nonempty and unique across all tabs |
type |
code or markdown |
Reserved cell kind | Restored, but UI still renders a Python editor |
source |
String | Raw Python source | Restored verbatim |
Fields not stored
Section titled “Fields not stored”The writer strips:
executionCountoutputsstate- Notebook
kernelState - Notebook
executionCounter - Global
activeTab - Focus and command-mode state
Load behavior
Section titled “Load behavior”- Rust returns the file contents as a JSON string or
nullwhen missing. - The React hook parses the string.
- The frontend validates the version, tabs, indices, cells, IDs, types, and sources.
- Valid matching tabs replace their cell arrays.
- Each restored cell receives
executionCount: null,outputs: [], andstate: "idle". - Existing notebook kernel and execution-counter defaults remain.
- The just-loaded persistable snapshot is remembered to prevent an immediate no-op rewrite.
If reading or validation fails, Molt shows a warning and disables autosave so the existing file is not overwritten with defaults.
Write behavior
Section titled “Write behavior”- The JSON is serialized compactly with
JSON.stringify. - Writes occur after a 1.5-second debounce.
- Identical persistable snapshots are skipped.
- Saves are serialized so older writes cannot finish after newer ones.
- Rust creates the directory if necessary and atomically replaces the file through a temporary file.
- A pending write is attempted during frontend unmount but cannot be awaited there.
There is no cross-process file lock, backup rotation, or built-in history. Avoid concurrent manual edits.
