AI agent memory using Modern Hopfield Networks — no LLM calls, no database, one matrix multiply. MCP server for Cursor, Claude Code, and other AI coding agents.
<div align="center">
# MHN AI Agent Memory
### Associative Memory for AI Agents Using Modern Hopfield Networks
[](https://www.python.org/downloads/)
[](LICENSE)
[](#development)
[](https://arxiv.org/abs/2008.02217)
**A Python library for deterministic associative memory in AI agents.**
[Install](#install) • [Quick Start](#30-second-example) • [Features](#features-at-a-glance) • [How It Works](#how-it-works-plain-english) • [API Reference](#project-structure)
</div>
---
<div align="center">
```
┌─────────────────────────────────────────────┐
│ │
│ xi_new = X @ softmax( beta * X^T @ xi ) │
│ │
│ One equation. One matrix multiply. │
│ Deterministic. Microseconds. Free. │
│ │
└─────────────────────────────────────────────┘
```
</div>
---
## 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](https://arxiv.org/abs/2008.02217) update rule directly, exposing transformer-style attention as an explicit, controllable memory.
1. Store text in a database
2. Call an LLM to reason about it (costs money, takes seconds, non-deterministic)
3. Hope the LLM doesn't hallucinate about what it stored
| | Traditional (LLM + DB) | This Library |
|---|---|---|
| **Retrieval** | LLM API call | One matrix multiply |
| **Latency** | Seconds | Microseconds |
| **Cost** | Per-token | Zero after storage |
| **Determinism** | Non-dAgent that generates comprehensive documentation, API references, architecture diagrams, and developer onboarding guides from existing code.
Agent configuration for systematic bug investigation that traces issues from error logs through the codebase to root cause with suggested fixes.
Agent for integrating third-party APIs including SDK setup, type generation, error handling, retry logic, and rate limit management.
Cursor's built-in autonomous coding agent that can make multi-file edits, run terminal commands, search the codebase, and iteratively build features with minimal human intervention.
Cloud-based autonomous coding agent that runs in the background on remote sandboxed environments, handling complex multi-step tasks while you continue working.
Cursor's multi-file editing agent within Composer mode that can create, edit, and delete files across your entire project in a single conversation.