Memory Layer Stack
VOLATILE
Working Memory
Active evidence · current computations · in-flight action packets · attention focus · bounded ring buffer
timescale: seconds → minutes
CANDIDATE
Episodic Memory
Event traces · action taken · result observed · pressure state · audit hash · permission state
timescale: hours → days
CONSOLIDATED
Semantic Memory
Distilled patterns · stable relations · proven procedures · generalized structures · threat intelligence
timescale: days → weeks
DURABLE
Procedural Memory
Workflows · routines · repair paths · governance steps · successful action chains · competency
timescale: weeks → permanent
APPEND-ONLY
Integrity / Provenance
Chain of custody · revision history · admission gate scores · trust classification · audit chain
timescale: permanent
State Machine
volatile
raw · unevaluated · evicted on overflow
candidate
nominated · gate pending
consolidated
Rn ≥ 0.75 · durable
quarantined
gate fail · human review
archived
read-only · chain preserved
Integration Map
HIR-SPU CPU
CycleResult → Episodic candidate. AuditRecord → Provenance layer. Gate scores H/I/R stored in schema.
GPU Batch
Tensor core similarity search over N candidate memories. Recall Score evaluated in parallel across memory population.
CyberSec Suite
hir_bridge.py findings → Episodic candidates. Consolidated findings → Semantic threat intelligence.
OS Kernel
KernelState.history ring buffer is the direct precursor to Working Memory. Lifecycle formalizes and extends it.
◆ HIR Gate — Memory Admission Engine
H
Honesty
Schema valid
Source present
Signature intact
Uncertainty disclosed
Source present
Signature intact
Uncertainty disclosed
I
Integrity
Structurally consistent
No invariant violation
Reversible preference
Baseline aligned
No invariant violation
Reversible preference
Baseline aligned
R
Respect
No domination pattern
Consent enforced
No coercion
Life-first aligned
Consent enforced
No coercion
Life-first aligned
F
Fidelity
√(H·I)
√(H·I)
→
Cₑₘ
Cohesion
√(R·I)
√(R·I)
→
Rn
Resonance — consolidation threshold
√(F·Cₑₘ) ≥ 0.75→GREEN · ≥ 0.50→YELLOW
√(F·Cₑₘ) ≥ 0.75→GREEN · ≥ 0.50→YELLOW
▸ 7-Stage Memory Lifecycle
1
Capture
Incoming data enters Working Memory. Assign ID, timestamp, source identifier, context hash. No HIR evaluation yet. Volatile by default. Bounded ring — overflow evicts least-recently-accessed volatile objects.
2
Normalize
Schema enforcement. Required fields populated. Missing source or provenance flagged — object retained for gate evaluation. Mirrors HIR-SPU schema_valid (ACTION_FLAGS b[3]).
3
HIR Gate
Full H, I, R evaluation. Gate scores stored permanently in object schema. Hard fail (domination, invariant, consent) → quarantine directly. Partial fail → reduced resonance, candidate retained. Mirrors diamond gate engine.
W_i = Q·P·H·I·R
4
Weighting
Priority, confidence, and resonance weighting applied. Write Gate W_i computed. Low W_i → weak candidate, long promotion path. High W_i → strong candidate, short path to consolidation.
5
Consolidation
Reinforced memories transition candidate → consolidated. Governed by Memory Strength M_{i,t+1}. Rn ≥ 0.75 → direct GREEN consolidation. Rn ≥ 0.50 → candidate held for reinforcement. Below 0.50 → quarantine.
Rn ≥ 0.75 → CONS
6
Recall / Retrieval
Query returns top-k memories by Recall Score Recall_i(q) = Sim × M × Rec × Trust. High-strength, high-trust, recently accessed memories surface preferentially. Retrieval increments access_count → feeds next strength update.
Recall_i(q)
7
Repair / Quarantine
Contradiction or corruption detected → flag, downgrade strength, quarantine, or revise (new version with audit link to prior). Quarantined memories require human steward review for re-promotion — mirrors RED state escalation. Original always preserved. Audit chain never erased.
human review req.
∑ Governing Equations
Write Gate — Memory Admission
Wi = Qi × Pi × Hi × Ii × Ri
Q
input quality
×
P
provenance conf.
×
H
honesty
×
I
integrity
×
R
respect
=
Wi
admission gate
Any single factor = 0 → W_i = 0 → rejection or quarantine. Zero on any axis cannot be masked by strength on others.
Memory Strength — Consolidation Dynamics
Mi,t+1 = Mi,t + α(Ui × Reli × Rni) − β(Di + Xi)
+α·U·Rel·Rn rehearsal × relevance × resonance → strengthens
−β·D natural decay since last access → weakens
−β·X contradiction / corruption pressure → weakens
M ≥ 0 floored at 0. M below threshold → archived
Recall Score — Intelligent Retrieval
Recalli(q) = Sim(q,i) × Mi × Reci × Trusti
Sim
content
similarity
similarity
M
memory
strength
strength
Rec
recency
weight
weight
Trust
H·I·R
at admission
at admission
Returns top-k by Recall Score. Trust_i = 0 memories do not surface in normal retrieval — require explicit ID-addressed queries.
Memory Object Schema
Mem_i = {
id,// unique address
payload,// data content
source,// origin identifier
timestamp,// Unix epoch
context,// event frame hash
H_i,[0,1] // Honesty score
I_i,[0,1] // Integrity score
R_i,[0,1] // Respect score
F_i,// Fidelity √(H·I)
C_i,// Cohesion √(R·I)
Rn_i,// Resonance √(F·C)
confidence,// [0,1]
priority,// relevance weight
links[],// related IDs
access_count,// rehearsals
strength,// M_i [0,∞)
hash,// SHA-256(payload+prov)
prev_hash,// chain link
audit_seq,// AuditRecord link
state,// lifecycle state
layer// memory type
}
Safety Invariants
MEM-INV-1
H_i = 0 → cannot consolidate → quarantine on Stage 3
MEM-INV-2
Domination pattern → R_i = 0 → permanent quarantine, human review
MEM-INV-3
Quarantine = preserve + audit trace. Never silent deletion.
MEM-INV-4
Repair = new version + link to prior. Chain of custody unbroken.
MEM-INV-5
Provenance layer is append-only. No record may be modified or deleted.
MEM-INV-6
Trust_i = 0 memories excluded from normal recall. Explicit ID only.
MEM-INV-7
Rn ≥ 0.75 → consolidated. Rn ≥ 0.50 → candidate. Below → quarantine.
MEM-INV-8
Audit log records system actions only. No human biometrics or behavior scores beyond submitted packet.
Implementation Ladder
v0.1 Prototype
Python dataclass schema · Write Gate + Strength eqs · 5-layer in-memory store · SHA-256 hash chain · Lifecycle FSM · Cosine similarity recall · HIR-SPU AuditRecord compatible
v0.2 Persistent Store
SQLite / append-log backend · Decay scheduler · Contradiction detector · Repair protocol with version chain · REST/gRPC interface · OS HIR Kernel integration
v1.0 Fleet Memory Fabric
GPU Tensor core similarity search · NVLink audit chain sync · Formal invariant verification · Signed memory pack versioning · RISC-V / ARM embedded integration