Thermogram π§
Living knowledge files with embedded SNN plasticity
Thermogram is a plastic memory capsule that combines:
- Hot/Cold tensor states - High plasticity session layer + crystallized personality backbone
- Embedded SNN plasticity engine - STDP, homeostasis, competition, decay
- Hash-chained audit trail - Cryptographic verification of all changes
- Optional neuromod sync - Colony-wide chemical balance coordination
- Consolidation cycles - Crystallize hot β cold, warm cold β hot
- Engram export - Archive to immutable format without deletion
The Problem
Traditional storage is either:
- Mutable (databases, files) - Fast but no audit trail, hard to prove integrity
- Immutable (Git, Engram) - Auditable but can't evolve organically
Brains don't work like either - they're plastic with constraints. Connections strengthen and weaken based on rules (STDP, homeostasis), not arbitrary writes.
The Solution
Thermogram is a single file with dual thermal states:
- Hot tensors - High plasticity, volatile, session-local (fast learning)
- Cold tensors - Crystallized, stable, personality backbone (slow change)
- Delta chain - Append-only audit log (hash-chained)
- Plasticity engine - Small SNN that generates deltas via spiking dynamics
- Neuromodulation - Optional sync with external chemical balance
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Thermogram: llm_clusters.thermo β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Hot Tensors (Session-Local, High Plasticity) β
β ββ Recent activations [sparse] β
β ββ Volatile associations β
β ββ Fast-updating weights β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Cold Tensors (Crystallized, Stable) β
β ββ Concept Prototypes [100 x 2048] β
β ββ Associative Weights (sparse) β
β ββ Personality backbone β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Delta Chain (Append-Only, Hash-Chained) β
β ββ DELTA_PROTO(cluster_5, Ξvector, lr, evidence) β
β ββ DELTA_EDGE(12, 34, Ξw, stdp, evidence) β
β ββ CRYSTALLIZE(key, hotβcold) β
β ββ WARM(key, coldβhot) β
β ββ ... (hash-chained audit trail) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Plasticity Engine (Embedded SNN) β
β ββ 100 neurons (spiking) β
β ββ STDP: cells that fire together wire together β
β ββ Homeostasis: prevent runaway strengthening β
β ββ Competition: winner-take-most β
β ββ Decay: natural forgetting β
β ββ Gating: context-dependent activation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Neuromodulation (Synced or Independent) β
β ββ Dopamine: 0.6 (learning rate β) β
β ββ Serotonin: 0.5 (decay rate β) β
β ββ Norepinephrine: 0.4 (competition β) β
β ββ Acetylcholine: 0.7 (attention β) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Colony Architecture
Multiple Thermograms can coexist as independent organisms or sync neuromodulation for colony-wide coordination:
Astromind (Central)
ββ InnerPilot SNN
β ββ Neuromodulation: {dopamine, serotonin, norepinephrine, acetylcholine}
β
ββ Thermogram Colony
ββ llm_clusters.thermo β syncs neuromod
ββ dialogue_patterns.thermo β syncs neuromod
ββ trust_graph.thermo β independent
ββ code_knowledge.thermo β independent
// Dopamine spike in Astromind β all synced Thermograms increase learning rate
// Stress β all synced Thermograms increase decay, prune weak connections
Installation
Add to your Cargo.toml:
[]
= "0.1"
Or with optional Engram integration:
[]
= { = "0.1", = ["engram-export"] }
Usage
Basic Example
use ;
// Create Thermogram for LLM activation clusters
let mut thermo = new;
// Apply delta (e.g., cluster centroid update from LLM mining)
let new_centroid = vec!;
let delta = update;
thermo.apply_delta?;
// Read current state (dirty + clean merged)
let cluster = thermo.read?;
// Manual consolidation (or auto-trigger after N deltas)
let result = thermo.consolidate?;
println!;
// Save to disk (hot file)
thermo.save?;
// Export to JSON
thermo.export_to_json?;
With Embedded SNN Plasticity
use ;
// Create SNN plasticity engine
let config = default; // 100 neurons
let mut snn = new;
// Process activation from LLM layer
let activation = vec!; // From layer 16 hidden state
let neuromod = baseline;
// SNN generates deltas via plasticity rules:
// - STDP strengthens co-firing neurons
// - Homeostasis prevents runaway
// - Competition enforces sparsity
// - Decay prunes weak connections
let deltas = snn.process?;
// Apply deltas to Thermogram
for delta in deltas
Colony with Neuromod Sync
use ;
// Central neuromodulation state (from Astromind)
let mut central_neuromod = baseline;
// SNN 1: Full sync with central state
let config1 = default;
let mut snn1 = new;
// SNN 2: Independent (sync_rate = 0.0)
let config2 = default;
let mut snn2 = new;
// Reward signal β increase dopamine
central_neuromod.reward;
// Sync to colony
snn1.sync_neuromod; // Picks up dopamine spike
// snn2 runs independently with NeuromodState::baseline()
// Process activations with synchronized neuromod
let activation = vec!;
let deltas1 = snn1.process?; // Uses synced state
let deltas2 = snn2.process?; // Independent
Key Features
1. Plastic Memory with Audit Trail
- Every change is a rule-governed delta (not arbitrary overwrites)
- Hash-chained for tamper evidence
- Can replay full history to verify integrity
2. Brain-Like Plasticity
- STDP: Cells that fire together wire together
- Homeostasis: Prevent runaway strengthening
- Competition: Winner-take-most (enforces sparsity)
- Decay: Natural forgetting of unused connections
- Gating: Context-dependent activation
3. Hot File Format
- Lives on disk as active, processable file
- Can be opened, processed, consolidated, closed
- ThermogramManager handles colony lifecycle
- Automatic consolidation triggers
4. Scalable Colonies
- Each Thermogram specializes in a domain
- Independent or synchronized neuromodulation
- Add new Thermograms without touching existing ones
- Colony can scale to hundreds of specialized memories
5. Archive Without Deletion
- Export to Engram (immutable) when saturated
- Keep full learning history
- Never lose the "why" and "how"
- Cold storage for non-active knowledge
Architecture Decisions
See engineering/ for detailed design rationale:
- Colony architecture: Independent organisms with optional chemical sync
- Embedded SNN: Why spiking dynamics instead of backprop
- Hot/Cold thermal states: Session plasticity vs crystallized personality
- Hash chains: Why cryptographic audit trail matters
- Plasticity rules: How STDP/homeostasis/competition interact
Performance
CPU-only, production-ready β‘
| Operation | Time | Throughput |
|---|---|---|
| Read | 17-59ns | 17M+ ops/sec |
| Write (delta) | 660ns | 1.5M ops/sec |
| Consolidation | 17Β΅s (1000 deltas) | 60K/sec |
| SNN tick | 151Β΅s (100 neurons) | 6.6K/sec |
| Neuromod sync | 4ns | 244M/sec |
- No GPU required - Pure Rust, runs anywhere
- Low memory - 1-10MB per Thermogram
- Edge-friendly - Suitable for embedded/offline deployments
See PERFORMANCE.md for comprehensive benchmarks and scaling analysis.
Testing & Security
60/60 tests passing β
- 36 unit tests - Core functionality
- 15 adversarial tests - Hash tampering, invalid chains, corrupted deltas, fork attacks, NaN/Inf protection
- 8 concurrency tests - Thread safety, race conditions, state isolation
- 1 doc test - API correctness
Security verified:
- β SHA-256 hash-chained audit trail
- β Tamper detection at every delta link
- β Fork attack prevention
- β Corruption detection through hash recomputation
- β NaN/Inf protection in SNN
See HARDENING_SUMMARY.md for complete testing report.
Status
v0.1.0 - Production Ready π
- β Core delta/hash chain/consolidation
- β Embedded SNN with STDP/homeostasis/competition/decay
- β Neuromodulation with optional sync
- β Save/load to disk
- β JSON export
- β Comprehensive testing (60/60 passing)
- β Benchmarked (8 benchmark suites)
- β Security verified (adversarial testing)
- β Performance documented (see PERFORMANCE.md)
- π§ ThermogramManager (colony lifecycle)
- π§ Engram export (requires engram-rs integration)
- π§ Astromind integration (next phase)
Next Steps
- Astromind Integration - Wire into LLM activation mining pipeline
- ThermogramManager - Manage colony lifecycle, auto-consolidation triggers
- Engram Export - Consolidate to immutable archive format
- Real-world testing - Use for actual LLM knowledge extraction on Qwen-2.5-3B
License
MIT OR Apache-2.0