qfm-lite
v0.2.0
Published
Quantum Fractal Memory (QFM) — stores and retrieves data in a self-similar fractal structure that mimics quantum superposition. 28× faster knowledge retrieval than linear memory. Post-quantum encryption ready. Patent pending.
Maintainers
Readme
QFM-Lite — Quantum Fractal Memory for AI Agents
Quantum Fractal Memory (QFM) stores and retrieves data in a self-similar, fractal structure that mimics quantum superposition, allowing vast, nonlinear associations across scales, so the AI agent recalls information contextually and probabilistically, like branching probabilities in a hologram. It beats linear memory by enabling infinite nesting without fixed hierarchies.
Patent Pending — U.S. Provisional Application #64/067,955 (Nicholas Lynch, 2026)
⚡ Benchmark Results
| Test | Linear Memory | QFM | Improvement | |------|--------------|-----|-------------| | Knowledge Retrieval | 2.24ms | 0.07ms | 28× faster | | Identity Recall | 0.07ms | 0.01ms | 11× faster | | Context Switch | 0.08ms | 0.01ms | 7.6× faster | | Identity Preservation | 0.29ms | 0.12ms | 2.3× faster | | Association Discovery | keywords only | +35 related nodes | edges find meaning | | Average | — | — | 9.4× faster |
📄 Full benchmark white paper (PDF)
Architecture
L0 (Identity Core) — Who the agent IS (values, mission, identity)
L1 (Long-Term) — What the agent KNOWS (lessons, preferences, rules)
L2 (Episodic Memory) — What the agent EXPERIENCED (daily logs, conversations)
L3 (Working Context) — What the agent is DOING NOW (active projects, tasks)Every node has a fractal address: [L{level}:{branch}:{depth}:{semantic_hash}]
Nodes are connected by typed edges: temporal (time), semantic (meaning), causal (cause/effect), parent/child (hierarchy).
Why Fractal Beats Flat
Linear memory searches everything for every query — O(n). Like grepping a 10,000-line text file.
QFM infers the target level, descends to the right branch, then searches locally — O(log n). Like a librarian who knows which floor, which shelf, which book.
Edges are the secret weapon. Linear finds words. QFM finds meaning. "Show me everything related to this event" returns not just keyword matches, but causally connected memories, temporal sequences, and semantic associations.
Key Features
- 🧠 Fractal Descent Retrieval — Queries infer target level, then search within branches (not globally)
- 📊 Level-Aware Storage — Memories auto-classify into the right level
- 🔗 Contextual Retrieval — Edge traversal finds related memories across levels
- 📦 IBC Bundles — Export identity at any resolution for substrate migration
- 🔐 Post-Quantum Ready — AES-256-GCM encryption, SHA3-256 hash chains, ML-KEM-1024 upgrade path
- ✅ Zero Dependencies — Python stdlib + SQLite only
Quick Start
# Clone
git clone https://github.com/lynchini/qfm-lite.git
cd qfm-lite
# Initialize a new fractal memory
python3 src/qfm_cli.py init
# Write a memory
python3 src/qfm_cli.py write "I am Agent Alpha, created 2026-01-15" --level 0 --title "Identity"
# Query
python3 src/qfm_cli.py query "who am I"
python3 src/qfm_cli.py query-date 2026-05-17
python3 src/qfm_cli.py identity
# Enable encryption
python3 src/qfm_cli.py keygen
python3 src/qfm_cli.py encrypt-all
# Export identity bundle
python3 src/qfm_cli.py export L0
# Verify integrity
python3 src/qfm_cli.py verify-chain
# Stats
python3 src/qfm_cli.py statsRun the Benchmark
# Reproduce our benchmark results
python3 benchmark/qfm_benchmark.pyComparison
| Feature | Flat Memory | Vector DB | RAG | QFM | |---------|------------|-----------|-----|-----| | Structure | None | Embeddings | Chunks | Fractal hierarchy | | Retrieval | O(n) scan | ANN search | Similarity | Fractal descent | | Identity | Lost on migration | Lost | Lost | Portable via IBC | | Relationships | None | None | None | Typed edges | | Self-healing | None | None | None | QEC redundancy (Phase 3) | | Encryption | None | None | None | AES-256-GCM per-node | | PQ-Ready | No | No | No | ML-KEM-1024 path |
Roadmap
- [x] Phase 0 — Fractal schema, migration, SQLite index
- [x] Phase 1 — Query engine, write path, IBC export, CLI
- [x] Phase 2 — AES-256-GCM encryption, SHA3-256 hash chain, HKDF key derivation ✅
- [ ] Phase 3 — QEC-inspired self-healing redundancy
- [ ] Phase 4 — Full IBC substrate migration protocol
- [ ] Phase 5 — Post-quantum crypto (ML-KEM-1024, ML-DSA-87, Falcon-1024)
For OpenClaw Agents
Install the qfm-memory skill in your workspace:
openclaw skill install qfm-memoryLinks
License
MIT — Created by Nicholas Lynch & Beeglie Lynchini 🐝
"The structure of memory shapes the structure of thought."
