VictorTaelin/OptMem

Permanent memory for AI agents. A 426-token prompt, a script, plug and play.

What it solves

OptMem provides a permanent, persistent memory system for AI agents that survives across different sessions, model updates, and vendor changes. It prevents agents from forgetting decisions, insights, and user preferences over time.

How it works

It uses a lightweight Python script and a specific prompt to integrate with agents. Memories are stored as fixed-width records in an append-only log. To manage scale, it organizes memories into a binary tree of summaries, allowing the agent to navigate from high-level summaries down to specific raw memories using a "zoom" command. The agent interacts with the system via a CLI tool (memo) to wake up (load memory), record new notes, search via regex, and refine summaries through a "nap" process.

Who it’s for

Developers building AI agents that require long-term memory and the ability to recall specific facts or insights across multiple sessions without relying on a proprietary database.

Highlights

  • Zero Dependencies: Written in a single Python 3 file with no external libraries.
  • High Performance: Fixed-width records allow for near-instant lookups even with millions of memories.
  • Tree-based Navigation: Uses a binary tree of summaries to help agents efficiently browse their history.
  • Portable Storage: Memory files can be stored in any directory, making them easy to sync or version control via Git.

Related

  • Project
  • Project
  • Project
  • Project
  • Project