Skip to content

wellsa-ai/Memmini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MemMini

MemMini is a Python library for layered memory in AI agents. It stores full memory records in L2, generates compact summaries in L1, and keeps short routing hints in L0 so an agent can load only the context it needs.

The package is framework-neutral. It can be used directly through MemoryCore or connected to agent frameworks through adapters.

Features

  • L0/L1/L2 layered memory model
  • File, vector, and hybrid storage backends
  • Namespace isolation for multiple users or agents
  • TTL-based expiration and cleanup
  • Positive and negative keyword filters
  • Async wrapper
  • mini:// resolver for layer and search references
  • LangChain, AutoGen, and OpenClaw adapters
  • Atomic file writes for local JSON and Markdown storage

MemMini does not bundle or require a model provider. The default layer generation path is rule-based. Projects that want model-generated summaries can inject their own provider through the LayerGenerator interface.

Installation

pip install memmini

Optional vector storage dependencies:

pip install "memmini[vector]"

Optional framework adapters:

pip install "memmini[langchain]"
pip install "memmini[autogen]"
pip install "memmini[openclaw]"

Quick Start

from memmini import open_memory

memory = open_memory(
    "./memory",
    auto_layer_update=False,
)

memory.add(
    "Project started: MiniPM-v2 uses React and Node.js.",
    metadata={"category": "project", "tags": ["minipm"]},
)

memory.update_layers()

print(memory.retrieve(layer="L0"))

for item in memory.search("MiniPM", limit=3):
    print(item["content"])

For custom storage backends, instantiate MemoryCore directly:

from memmini import MemoryCore
from memmini.storage.file import FileStorage

memory = MemoryCore(storage=FileStorage(base_path="./memory"))

Storage Backends

Backend Package Use case
FileStorage memmini Local JSON and Markdown files
VectorStorage memmini[vector] ChromaDB-backed similarity search
HybridStorage memmini[vector] File persistence with vector search

Layer Model

Layer Purpose Typical use
L0 Short routing hints Decide whether deeper context is needed
L1 Compact summaries Load relevant context for the current task
L2 Original records Preserve full source memory

Examples

python examples/basic_memory.py
python examples/smart_search.py
python examples/vector_storage.py

examples/vector_storage.py requires pip install "memmini[vector]".

Adapters

from memmini import MemoryCore
from memmini.adapters import LangChainAdapter
from memmini.storage.file import FileStorage

core = MemoryCore(storage=FileStorage(base_path="./memory"))
adapter = LangChainAdapter(core)

history = adapter.load_memory_variables({})["history"]

License

MemMini is released under the MIT License.

About

L0/L1/L2 hierarchical memory system for AI agents

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages