On this page
State persistence for claudewheel.
#claudewheel.state
#claudewheel.state
Save selections, launch count, and recent directories to state.json.
#load_state_value
def load_state_value(key: str)Read a single value fresh from state.json on disk.
Returns None if the file is missing, unreadable, or lacks the key. Unlike ConfigManager.state, this never uses an in-memory copy -- it is for code paths (e.g., the auth wizard) that run outside the TUI's ConfigManager lifecycle.
#save_state_value
def save_state_value(key: str, value) -> NoneRead-modify-write a single key in state.json (atomic tmp + rename).
Only key is touched; all other keys on disk are preserved. Counterpart of load_state_value() for writers that don't hold a ConfigManager.
#merge_out_of_band_keys
def merge_out_of_band_keys(state: dict) -> NoneRe-read keys written straight to state.json by out-of-band writers.
The auth wizard writes AUTH_BROWSER_KEY directly to disk while the TUI holds its own in-memory state (loaded at startup). Any wholesale ConfigManager.save_state() must call this first so it doesn't clobber those fresh on-disk values with stale in-memory ones.
#save_launch_state
def save_launch_state(cfg: ConfigManager, selections: dict[str, str | None]) -> NoneSave current selections to state.json before launch.
#record_inode
def record_inode(directory: str) -> NoneRecord the inode of a project directory for rename detection.