1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! # 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
//!
//! ```rust,no_run
//! use thermogram::{Thermogram, PlasticityRule, Delta};
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//!
//! // 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")?;
//! # Ok(())
//! # }
//! ```
// Re-exports
pub use crateThermogram;
pub use crate;
pub use crate;
pub use crate;
pub use crateHashChain;
pub use crate;
pub use crate;
pub use crate;