Crate thermogram

Crate thermogram 

Source
Expand description

§Thermogram

A plastic memory capsule with dirty/clean states, rule-governed deltas, and hash-chained auditability.

§Core Concept

Traditional storage is either:

  • Mutable (databases, files) - fast but no audit trail
  • Immutable (Engram, Git) - auditable but can’t evolve

Thermogram combines both:

  • Dirty state (append-only deltas) - fast, mutable, auditable
  • Clean state (consolidated snapshot) - efficient reads
  • Plasticity rules (STDP-like) - when to update vs create new
  • Hash chain - cryptographic audit trail
  • Consolidation cycles - dirty → clean on schedule
  • Engram export - archive without deletion

§Use Cases

  1. LLM Activation Mining - Cluster centroids evolve as new patterns discovered
  2. Agent Memory - Episodic memory with replay and consolidation
  3. Knowledge Graphs - Concepts strengthen/weaken over time
  4. Neural Weights - Save checkpoints with full training history

§Example

use thermogram::{Thermogram, PlasticityRule, Delta};

// Create new thermogram for LLM activation clusters
let mut thermo = Thermogram::new("llm_clusters", PlasticityRule::stdp_like());

// Apply delta (cluster centroid update)
let new_centroid = vec![0.5_f32; 2048];
let delta = Delta::update(
    "cluster_0",
    bincode::serialize(&new_centroid)?,
    "llm_mining",
    0.8,
    thermo.dirty_chain.head_hash.clone(),
);
thermo.apply_delta(delta)?;

// Read current state (dirty + clean merged)
let centroid = thermo.read("cluster_0")?;

// Consolidate (dirty → clean)
thermo.consolidate()?;

// Export to JSON
thermo.export_to_json("llm_knowledge_v1.json")?;

Re-exports§

pub use crate::core::Thermogram;
pub use crate::delta::Delta;
pub use crate::delta::DeltaType;
pub use crate::plasticity::PlasticityRule;
pub use crate::plasticity::UpdatePolicy;
pub use crate::consolidation::ConsolidationPolicy;
pub use crate::consolidation::ConsolidationTrigger;
pub use crate::hash_chain::HashChain;
pub use crate::error::Error;
pub use crate::error::Result;
pub use crate::plasticity_engine::NeuromodState;
pub use crate::plasticity_engine::NeuromodSyncConfig;
pub use crate::plasticity_engine::PlasticityEngine;
pub use crate::embedded_snn::EmbeddedSNN;
pub use crate::embedded_snn::EmbeddedSNNConfig;
pub use crate::ternary::TernaryWeight;
pub use crate::ternary::PackedTernary;
pub use crate::ternary::TernaryLayer;

Modules§

consolidation
Consolidation - Dirty → Clean state transitions
core
Core Thermogram implementation
delta
Delta - Represents a change to the Thermogram state
embedded_snn
Embedded SNN - Small spiking neural network for Thermogram plasticity
error
Error types for Thermogram
export
Export - Archive Thermogram to Engram
hash_chain
Hash Chain - Cryptographic audit trail for deltas
plasticity
Plasticity Rules - STDP-like policies for memory updates
plasticity_engine
Plasticity Engine - SNN-based delta generation
ternary
Ternary Weight System - BitNet-style quantization for neural weights