clawft

Persistence

What is persisted to disk at 0.8.4: the chain and tree checkpoints, cluster and app catalogs, and the JSON save/load helpers for the causal graph and HNSW index.

Persistence in the kernel is several separate mechanisms, not one coordinator. This page lists each, says what writes it, and marks the helper module that nothing calls yet.

What the kernel writes on its own

StateFile and writerSource
Chain checkpointRVF checkpoint (primary) with a JSON fallback beside it, written by Kernel::shutdown; the chain location is pinned once at bootboot.rs shutdown, chain_storage.rs
Resource tree checkpoint<chain checkpoint>.tree.json, written at shutdownboot.rs shutdown
Cluster peerspersisted to disk so joins survive restartsboot.rs, "Cluster peer membership persists to disk"
Installed appsatomic apps.jsonboot.rs, "Installs survive kernel restarts via atomic apps.json"
Runtime filessocket, pid, log and lock files under the runtime root ($WEFTOS_RUNTIME_DIR, else the project's .weftos/runtime, else legacy ~/.clawft)crates/clawft-types/src/runtime_paths.rs

Chain details are on the ExoChain page and the shutdown order is on Boot Sequence.

The persistence helper module

crates/clawft-kernel/src/persistence.rs is a tested helper for saving and loading the causal graph and the HNSW index as JSON. At the 0.8.4 base, git grep over crates/ finds no caller of save_all, load_all or PersistenceConfig outside that file, so neither the kernel boot nor the daemon uses it. An earlier version of this page showed a Kernel::boot_with_state call that does not exist. Treat the module as a building block until a caller is added.

pub struct PersistenceConfig {
    pub data_dir: PathBuf,                    // default ".weftos/state"
    pub auto_save_interval_secs: Option<u64>, // not used by any timer
}

File names the helper uses under data_dir:

causal_graph.json   CausalGraph nodes, edges and next_node_id
hnsw_index.json     HNSW vectors, metadata and index configuration
exochain.jsonl      chain events as line-delimited JSON (chain_path())

Functions: save_causal_graph, load_causal_graph, save_hnsw, load_hnsw, save_all, load_all, plus save_all_with_chain and load_all_with_chain, which also append a chain event. Loads return an empty instance when a file is missing and an io::Error when the JSON is corrupt or truncated (the module's own tests cover both). There is no file locking.

Other save and load helpers

  • eml_persistence.rs saves and loads the EML models as JSON under .weftos/eml-models/; its header says kernel shutdown and boot use it, but no call site was found in crates/ outside tests, so the same caveat applies. The retry model in clawft-core reads from eml-models/ under the runtime dir (llm_adapter.rs).
  • ecc_segment.rs defines RVF segment types in the 0x50 to 0x5F block for ECC payloads; its header says moving on-disk chain blobs onto them is follow-up work.
  • The HNSW service appends an hnsw.save chain event when it saves (hnsw_service.rs).

On this page