Browse / Software development / mhn-ai-agent-memory
mhn-ai-agent-memory
shahzebqazi
AI agent memory using Modern Hopfield Networks — no LLM calls, no database, one matrix multiply.
Open shahzebqazi/mhn-ai-agent-memory → Does not match the four rules.
agent-frameworkagent-memoryaiai-agentsassociative-memoryattention-mechanismclaude-codecontext-engineeringcontrastive-learningcursorenergy-based-modelshopfield
Built for cursor
ships .cursor and nothing for other agents.
In its own words
MCP server for Cursor, Claude Code, and other AI coding agents.
Associative Memory for AI Agents Using Modern Hopfield Networks
A Python library for deterministic associative memory in AI agents.
Status: toy / research memory. Deterministic associative recall for small agent fact stores and learning Modern Hopfield networks. Useful for Cursor project working memory and offline experiments. Not a production replacement for vector DB + LLM memory systems.
Experiments: EXPERIMENTS.md — 43 tests, retrieve latency (~16 µs/op at dim=256), reproducible benchmarks/ (see repulsive A/B v2).
What is this?
Many agent memory systems store text in a database, then ask an LLM to interpret it at query time. This library does something else: it applies the Modern Hopfield Network update rule directly, exposing transformer-style attention as an explicit, controllable memory.
- Store text in a database
- Call an LLM to reason about it (costs money, takes seconds, non-deterministic)
- Hope the LLM doesn't hallucinate about what it stored
Store a fact as a pattern in the energy landscape. Query with a partial cue, and the network relaxes toward the nearest stored pattern. The retrieval weight gives you a confidence signal.
30-Second Example
No API keys, database, or config files. The memory is a NumPy array.
Features at a Glance
Pluggable Encoders
Choose an encoder based on quality, cost, and dependencies.
Contradiction Detection
Flag likely conflicts before storing new facts.
The repository's own description, then 28% of its README. Read the rest on GitHub ↗
Read from the repository's git tree on 2026-08-17.