vios_app 0.1.1

Small JSON vaults: Argon2id + AES-GCM, with optional AAD binding.
Documentation
use std::fs;
use crate::naorix::naorix_memory::MemoryTrace;
use serde_json::json;

/// Log the memory trace into the evolution file
pub fn log_evolution(memory: &MemoryTrace, path: &str) {
    let mut log: Vec<serde_json::Value> = match fs::read_to_string(path) {
        Ok(contents) => serde_json::from_str(&contents).unwrap_or_default(),
        Err(_) => Vec::new(),
    };

    let entry = json!({
        "vault_id": memory.vault_id,
        "tone": memory.tone,
        "intent": memory.intent,
        "reem_code": memory.reem_code,
        "timestamp": memory.timestamp,
        "cia_hash": memory.cia_hash,
        "parent_hash": memory.parent_hash,
    });

    log.push(entry);
    let serialized = serde_json::to_string_pretty(&log).unwrap();
    fs::write(path, serialized).expect("❌ Failed to write evolution log.");
}