π Hermes Fractal Memory Engine
Hierarchical Vectorless Episodic Memory, Procedural Attractor Clustering, and $O(1)$ Complex Coordinate Anchoring for Hermes Agent (Nous Research).
Community Plugin Submission for The Hermes Agent Plugin Hackathon by Nous Research (Nov 2026)
Developed solo by @pCwOrM / Volkan Dagli.
π Disclosure & Operational Scope
Disclosure β fractal-memory-engine runs 100% locally inside the Hermes Agent Python process with zero external network calls, zero third-party API keys, and zero background processes or shell execution:
- Profile-Isolated Atomic Persistence: Memory items and turn counters are persisted per-profile as UTF-8 JSON inside the sanctioned Hermes per-plugin data directory (
<HERMES_HOME>/plugin-data/fractal-memory-engine/fractal_memory.jsonresolved dynamically per call viaplugins.plugin_storage.plugin_data_dir("fractal-memory-engine")/hermes_constants.get_hermes_home()), or at a user-configuredstorage_path, using atomic temp-file writes (os.replace) so mid-write crashes never corrupt or truncate the store. - Turn Context Injection (
pre_llm_call): Before each LLM turn,pre_llm_callqueries the local 3-ring memory manifold against the active user prompt and returns a compact<150 tokencontext block ({"context": "[FRACTAL-ACTIVE-MEMORY...]"}) when resonant memories exceedmin_recall_resonance(default0.30). Can be toggled viaauto_inject_context. - Orbital Decay (
post_llm_call): After each completed turn,post_llm_callapplies exponential half-life decay to Ring 1 (Sensory, $\times 0.82$) and Ring 2 (Task, $\times 0.96$) while keeping Ring 3 (Invariant Core, $\times 1.00$) permanent, and triggers automatic consolidation when Sensory buffer occupancy reaches 75%.
β‘ The Memory Wall Problem in Autonomous Agents
Autonomous AI agents face a crippling architectural bottleneck when running complex, multi-turn, real-world tasks:
- Vector Database & Embedding Overhead ($O(N)$ Bloat): Running heavy embedding models or local vector databases (Chroma, FAISS, Qdrant) introduces external dependencies, API costs, RAM bloat, and startup latency on edge/desktop machines.
- Context Dilution & Forgetting: Dumping raw conversational history or verbose RAG chunks into the prompt saturates the context window, breaks prompt caching, and triggers attention degradation.
- Lack of Biological Consolidation: Traditional memory stores treat yesterday's transient log output with the same permanence as foundational user rules or system invariants.
The Hermes Fractal Memory Engine (fractal-memory-engine) solves this deterministically. Instead of external vector databases, memories are anchored onto a continuous complex coordinate manifold ($c \in [-2.0, 0.5] \times [-1.2, 1.2]$) with polynomial escape-time depth ($z_{n+1} = z_n^2 + c$) and governed by a 3-Ring Orbital Resonance Hierarchy.
ποΈ 3-Tier Orbital Memory Architecture
[ INCOMING USER PROMPT / AGENT TURN ]
β
ββββββββββββββββββββββ΄βββββββββββββββββββββ
β β
[pre_llm_call Hook] [post_llm_call Hook]
β’ Queries Resonant Attractors β’ Advances Turn Counter
β’ Returns {"context": ...} β’ Applies Orbital Decay
β’ Preserves System Prompt Cache β’ Auto-Consolidates at 75%
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β THE 3-TIER FRACTAL MEMORY MANIFOLD β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Ring 1: Sensory Ephemeral Buffer (0.60x Zoom) β β
β β β’ Short-term conversational scratchpad (Capacity: 64 items) β β
β β β’ Rapid half-life decay (Ξ³ = 0.82 / turn) β β
β β β’ Transient noise pruned automatically upon consolidation β β
β ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ β
β β (Hebbian Reinforcement: β₯2 hits) β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Ring 2: Contextual Task Memory (1.00x Zoom) β β
β β β’ Active task goals, intermediate tool outputs, active constraints β β
β β β’ Gentle half-life decay (Ξ³ = 0.96 / turn) β β
β β β’ Promoted from Ring 1 when repeatedly referenced β β
β ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ β
β β (High Salience Promotion: β₯0.80) β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Ring 3: Invariant Core Memory (1.60x Zoom - Invariant Attractor) β β
β β β’ Permanent facts, user preferences, mathematical laws, identities β β
β β β’ STRICT ZERO DECAY (Ξ³ = 1.00) β Inviolable ground truths β β
β β β’ Governed by Boundary Dynamics (Polynomial Escape Resistance) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β [CRYPTOGRAPHIC STATE INTEGRITY SEAL: sha256 -> FRACTAL-MEM-SEAL:xxxx] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π οΈ Provided Tools (toolset="fractal_memory")
All 5 tool handlers accept (args: dict, **kwargs) and return a structured JSON string:
1. fractal_remember
Stores or updates a memory atom on the manifold with automatic or explicit ring assignment.
- Input:
{ "key": "user_preferences", "content": "User prefers concise Python code and strictly forbids unverified dependencies.", "ring": "invariant", "salience": 0.95, "tags": ["coding_rules", "python"] } - Output:
{ "status": "stored", "key": "user_preferences", "ring": "invariant", "salience": 0.95, "cx": -0.743612, "cy": 0.131844, "escape_time": 24, "state_seal": "[FRACTAL-MEM-SEAL:d41d8cd98f00b204]" }
2. fractal_recall
Retrieves top-$K$ resonant memories matching a natural language prompt via composite lexical Jaccard, character trigram morphology, and complex-plane geometric proximity scoring:
$$R(q, m) = \big(0.55 \cdot S_{\text{lex+tri}}(q, m) + 0.45 \cdot S_{\text{geom}}(q, m)\big) \times m.\text{salience} \times \text{Stability} \times W_{\text{ring}}$$
- Input:
{"query": "What are the user's coding constraints?", "limit": 3} - Output: JSON array of sorted memories with computed resonance scores and automatic Hebbian access reinforcement.
3. fractal_consolidate
Executes orbital memory consolidation across rings:
- Promotes frequently accessed task memories ($S \ge 0.80$, accesses $\ge 3$) into the zero-decay Invariant Core.
- Prunes decayed ephemeral noise ($S < 0.35$) from Ring 1 & Ring 2.
4. fractal_memory_inspect
Inspects real-time ring occupancy, decay telemetry, total items, storage path, and the SHA-256 cryptographic state seal.
5. fractal_memory_wipe
Protected memory reset tool with mandatory safety confirmation flag (confirm: true), supporting selective wiping of sensory, task, all_non_invariant, or full_factory_reset.
β‘ Lifecycle Hooks (pre_llm_call & post_llm_call)
pre_llm_call(pre_llm_call_hook):- Fires once per turn before the tool-calling loop.
- Queries the manifold for the top 3 memories exceeding
min_recall_resonance(default0.30). - Returns
{"context": "[FRACTAL-ACTIVE-MEMORY: Top Resonant Invariants & Context]\n..."}, which Hermes appends to the current turn's user message while preserving the system prompt cache prefix.
post_llm_call(post_llm_call_hook):- Fires once per turn after the tool-calling loop completes.
- Advances the turn counter, applies orbital decay across Ring 1 ($\times 0.82$) and Ring 2 ($\times 0.96$), and triggers automatic consolidation when the sensory buffer reaches 75% capacity.
β¨οΈ In-Session Slash Commands
/fractal: Displays a rich ASCII telemetry dashboard showing ring capacities, decay factors, storage path, and the SHA-256 state seal:π Hermes Fractal Memory Telemetry π ======================================== State Seal : [FRACTAL-MEM-SEAL:e8b420261105af71] Turn Count : 14 | Total Items: 28 Data File : ~/.hermes/plugin-data/fractal-memory-engine/fractal_memory.json ---------------------------------------- β’ Ring 1 (Sensory 0.60x) : 8/64 items (Decay: 0.82) β’ Ring 2 (Task 1.00x) : 14/128 items (Decay: 0.96) β’ Ring 3 (Invariant 1.60x): 6/1024 items (Decay: 1.00) ======================================== Tip: Use /remember <key> <content> to pin an invariant rule directly./remember <key> <content>: Instant shortcut to anchor a permanent invariant directly into Ring 3.
βοΈ Configuration (config_schema)
Configurable under plugins.entries.fractal-memory-engine.settings in config.yaml or via the Hermes Desktop Settings β Plugins UI:
| Setting | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| storage_path | str | "" | Custom file path for fractal_memory.json. Defaults to <HERMES_HOME>/plugin-data/fractal-memory-engine/fractal_memory.json. |
| auto_inject_context | bool | true | Automatically inject top resonant memories into pre_llm_call turn context. |
| min_recall_resonance | float | 0.30 | Minimum composite resonance score (0.0 to 1.0) required for automatic pre_llm_call injection. |
π§ͺ Testing & Admission Validation
# Run the full pytest suite (manifest, catalog schema, hooks, tools, and manifold math)
python -m pytest tests/ -v
# Validate with Hermes Plugin CLI
hermes plugins validate . --install-deps
π Global Records, Formal Proofs, Curated Awesome Merges & On-Chain Infrastructure
1. Certified Mathematical Records & Formal Verification (0 sorry)
- π₯ NSF ICARM Elliptic Curve Rank Leaderboard (
elliptic-rank.icarm.cloud/user/114): 230 certified high-rank elliptic curves (#4308β#4537) over $\mathbb{Q}$ with 100% complete prime conductor factorization ($\log N$) up to Rank $\ge 19$ (#4323), achieving 30 First-Place (#1 Gold) Records, 80 Podium (Top-3), and 418 Top-10 placements across 43 categories (building upon the foundational fibration families of Elkies, Dujella, Rubinstein, and Klagsbrun; supported under NSF GrantDMS-2425401). - π₯ SchΓΆnhage Trilinear Multiplication Tensor Bound (
arXiv:2610.14263β’CrocSwap/integer-mult-bounds#226): Constructive 15-round bipartite carrier matching at dimensions $h=23, 25$ eliminating 185 carrier roles and 377,890 physical wires ($W = 177,284,805 \to 176,906,915$), certifying $\kappa = 826,215,307 / 20,000,000,000,000 \approx 4.131076535 \times 10^{-5}$ ($1.377\times$ net gain over PR #49), formally incorporated intoCrocSwap/integer-mult-bounds(commit 50d76881) and verified in Lean 4 (0 sorry). - π 170+ Machine-Checked Theorems in Lean 4 (
0 sorry,0 unproven axioms):- General Divisor Theorem (
GDT v3.0): 81 theorems/lemmas (0 sorry) formalizing Dan Hawkley's residue density framework (10.5281/zenodo.23316068). - Computational Group Theory (
gap-lean4-port): 35 theorems (0 sorry) formalizing Charles Sims' Schreier-Sims stabilizer chains (GAP-0299), backtrack ordered partitions (GAP-0332), and modular ring inverses (GAP-0331) (arXiv:2609.38492). - Procedural Boundary Synthesis & EVM/Cairo Fixed-Point Bounds: 40+10 theorems (
WerracleProof.lean,0 sorry) verifyingZMod 9($\mathbb{Z}/9\mathbb{Z}$) principal ideal closure ($\mathcal{I}_3 = {0,3,6}$), Q16.16 overflow safety, and unitary Page curve S-matrix conservation (arXiv:2609.33066). - 24D Niemeier Lattice $A_8^3$, WerreduR & GΓΌneΕ Dili: Complete formal specifications (
0 sorry) across lattice unimodularity ($\chi=24, \ell=9$), horizon complementarity ($B(t)+S(t)=1$), and deterministic morphological parsing.
- General Divisor Theorem (
2. Curated Ecosystem Recognitions & Benchmark Evaluations
- Merged Upstream Pull Requests:
- β
wbierbower/awesome-physics#16: Featured in Quantum Physics for unitary Black Hole Page Curve simulation. - β
34j/best-of-lean4#292: Indexed in the curated Best of Lean 4 theorem proving directory. - β
yh-yao/awesome-edge-ai-agents#13: Featured for bothwerr/answerrandWerreduRedge reflex engines. - β
MartinuzziFrancesco/awesome-scientific-machine-learning#9
: Featured under Model Discovery. - β
meta-introspector/lean-workers-union#2: Registered verified member (gap-lean4-port). - β
Jev Ecosystem & Agentic Benchmarks: Listed on
awesome-jev#69/madewithjev; 100% (49/49) on WindTunnel WebMCP (3.35 ms,0 VRAM); 100% Tool Schema Adherence (0.38 ms) on Sierra Tau-Bench; 23.74 on JevBench v1.4.1 (7.32 ms); 38.0Γ speedup on Jevenator 2.
- β
3. Sovereign On-Chain Deployments (Werrium / $WERR), Multi-Chain Testnets & Grant Pipelines
- π Base L2 Mainnet (
Chain ID: 8453) β Live & BaseScan Verified:- Werrium (
$WERR) Token Contract:0xFfa2c95b68B76af00FBD84295cBA5e5268a996d2(Fixed 1,000,000,000 supply, No-Mint, EIP-2612 Gasless Permit,burnForATPmetabolic compute quota &burnForReflexon-chain decision sealing β’ Optimism Superchain Token List PR #1391). - Gnosis Safe 2/3 Multisig Treasury:
0x7CC5fd367e210F4678Bcfca054cbe0F87291E355(949,501,000 WERRlocked). - WerrTreasuryTimelock (Vesting & Cliff):
0x839A6d7E726D60EA2B587e793aE36342297e8C63(40,000,000 WERRlocked). - Aerodrome Finance DEX Liquidity Pools (Base Mainnet):
vAMM-WERR/USDC&vAMM-WERR/WETH.
- Werrium (
- π Multi-Chain Testnets & Grant Tracks:
- Starknet Foundation Seed Grant (In Screening): Cairo 2.x / Sierra
WerracleTripodZMod9(single felt252seed,~1,420 Cairo steps, Ekubo v2 LVR extension). - Ethereum Sepolia Testnet (
Chain ID: 11155111):Werrium ($WERR)at0xe6ecc9575B4D52642c55FCf64E8E2d3baa6e6EF7&Werraclelive liquidation arbitrage telemetry. - NEAR Aurora Testnet (
Chain ID: 1313161555) & Bare-Metal EVM Node (Chain ID: 4242): LiveWerracle.sol&WerracleFeeHook.soldeployments (radar.werracle.com). - Active Research Proposals: Flashbots MEV Research (
FRP #205&PR #206), Morpho DAO (MIP-81OEV Observatory), Uniswap v4 / Unichain Hook Grants.
- Starknet Foundation Seed Grant (In Screening): Cairo 2.x / Sierra
## π License & Citations
Licensed under the MIT License. Created by Volkan Dagli (@pCwOrM).
Part of the open-source Fractal Neural Synthesis (FNS) and WERR Canonical Research Corpus.
README from the reviewed commit 40fc72c; it updates when the author re-pins.

pCwOrM