Skip to main content

memv

memv

/mɛm-viː/ · Structured, temporal memory for AI agents

Docs • Getting Started • PyPI

PyPI version Python 3.13+ License: MIT Pydantic AI


Most memory systems extract everything and rely on retrieval to filter it. memv extracts only what the model failed to predict — importance emerges from prediction error, not upfront scoring.

Typical Approach memv
Extract all facts upfront Extract only what we failed to predict
Overwrite old facts Invalidate with temporal bounds
Retrieve by similarity Hybrid vector + BM25 + RRF
Timestamps only Bi-temporal: event time + transaction time

Quick Start

uv add memvee
# or: pip install memvee
from memv import Memory
from memv.embeddings import OpenAIEmbedAdapter
from memv.llm import PydanticAIAdapter

memory = Memory(
    db_url="memory.db",  # or "postgresql://user:pass@host/db"
    embedding_client=OpenAIEmbedAdapter(),
    llm_client=PydanticAIAdapter("openai:gpt-4o-mini"),
)

async with memory:
    await memory.add_exchange(
        user_id="user-123",
        user_message="I just started at Anthropic as a researcher.",
        assistant_message="Congrats! What's your focus area?",
    )

    await memory.process("user-123")

    result = await memory.retrieve("What does the user do?", user_id="user-123")
    print(result.to_prompt())

Features

Predict-Calibrate Extraction · Only extracts what the model failed to predict. Based on Nemori.

Bi-Temporal Validity · Track when facts were true (event time) vs when you learned them (transaction time). Based on Graphiti.

Hybrid Retrieval · Vector similarity + BM25 text search with Reciprocal Rank Fusion.

Episode Segmentation · Groups messages into coherent conversation episodes.

Contradiction Handling · New facts invalidate conflicting old facts. Full audit trail preserved.

SQLite + PostgreSQL · SQLite for local dev, PostgreSQL with pgvector for production. Set db_url to choose between them.

Multiple Embedding Providers · OpenAI, Voyage, Cohere, or local via fastembed. Dimensions detected from the adapter.


Point-in-Time Queries

memv's bi-temporal model lets you query knowledge as of a specific point in time:

from datetime import datetime

# What did we know about user's job in January 2024?
result = await memory.retrieve(
    "Where does user work?",
    user_id="user-123",
    at_time=datetime(2024, 1, 1),
)

# Show full history including superseded facts
result = await memory.retrieve(
    "Where does user work?",
    user_id="user-123",
    include_expired=True,
)

Architecture

Messages → Episodes → Knowledge → Vector Index + Text Index
                                   (sqlite-vec / pgvector)  (FTS5 / tsvector)
  1. Messages buffered until threshold
  2. Segmented into coherent episodes
  3. Predict what episode should contain (given existing KB)
  4. Compare prediction vs actual — extract the gaps
  5. Store with embeddings + temporal bounds

Framework Integration

class MyAgent:
    def __init__(self, memory: Memory):
        self.memory = memory

    async def run(self, user_input: str, user_id: str) -> str:
        context = await self.memory.retrieve(user_input, user_id=user_id)
        response = await self.llm.generate(
            f"{context.to_prompt()}\n\nUser: {user_input}"
        )
        await self.memory.add_exchange(user_id, user_input, response)
        return response

See Examples for PydanticAI, LangGraph, LlamaIndex, CrewAI, and AutoGen integrations.


Documentation


Contributing

git clone https://github.com/vstorm-co/memv.git
cd memv
make install
make all

See CONTRIBUTING.md for details.


MIT — see LICENSE

Built by vstorm

Metadata

Release files for memvee 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memvee 0.1.2
File Size Uploaded
memvee-0.1.2.tar.gz 48.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for memvee 0.1.2
File Interpreter ABI Platform
memvee-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 121.4 kB

Release files / memvee-0.1.2.tar.gz

Download URL memvee-0.1.2.tar.gz
Size 48.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b2b489999eed55bae612e9efb19e2c69a336784e3a1614a7eafceb2765126c98
BLAKE2b-256 checksum
How to use checksums
81f858445cd463cbe99b372db068a60a494987254e1f15c96a97b351c15dfaff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.

Transparency log

Release files / memvee-0.1.2-py3-none-any.whl

Download URL memvee-0.1.2-py3-none-any.whl
Size 72.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c8819f4b597867848bdd30b1c2e1be79689452132e0269170d63c643f34640a
BLAKE2b-256 checksum
How to use checksums
c069266f78b2c1bb80676facc433d4ab1a74a9a5cabd2f062d119ae75dafa372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page