mif-tools
Vendor-neutral memory portability for AI agents. Convert between memory formats (mem0, markdown, generic JSON) and the Memory Interchange Format (MIF).
Install
pip install mif-tools
# With schema validation support:
pip install mif-tools[validate]
CLI
# Convert mem0 export to MIF
mif convert memories.json --from mem0 --to shodh -o memories.mif.json
# Convert with auto-detection
mif convert memories.json -o output.mif.json
# Convert MIF to markdown
mif convert memories.mif.json --to markdown -o memories.md
# Validate MIF document
mif validate memories.mif.json
# Inspect any memory file
mif inspect memories.json
# List available formats
mif formats
Python API
from mif import load, dump, convert, MifDocument, Memory
# Load from any format (auto-detects)
doc = load(open("mem0_export.json").read())
print(f"{len(doc.memories)} memories loaded")
# Access memories
for mem in doc.memories:
print(f"[{mem.memory_type}] {mem.content}")
# Convert between formats
markdown = dump(doc, format="markdown")
mif_json = dump(doc, format="shodh")
# One-liner conversion
result = convert(input_data, from_format="mem0", to_format="shodh")
# Create from scratch
doc = MifDocument(memories=[
Memory(
id="123e4567-e89b-12d3-a456-426614174000",
content="User prefers dark mode",
created_at="2026-01-15T10:30:00Z",
memory_type="observation",
tags=["preferences", "ui"],
)
])
print(dump(doc))
# Validate
from mif import validate
is_valid, errors = validate(mif_json)
Supported Formats
| Format | ID | Description |
|---|---|---|
| MIF v2 (Shodh) | shodh |
Native MIF v2 JSON, lossless round-trip |
| mem0 | mem0 |
mem0 JSON array ([{"memory": "..."}]) |
| Generic JSON | generic |
JSON array with content field |
| Markdown | markdown |
YAML frontmatter blocks (Letta/Obsidian style) |
MCP Integration
Any MCP memory server can add MIF support:
from mif import load, dump
# In your export_memories tool handler:
def handle_export(user_id: str) -> str:
memories = my_storage.get_all(user_id)
return dump(memories)
# In your import_memories tool handler:
def handle_import(data: str) -> dict:
doc = load(data) # auto-detects mem0, markdown, generic, MIF
imported = 0
for mem in doc.memories:
my_storage.save(mem.id, mem.content, mem.created_at)
imported += 1
return {"memories_imported": imported}
License
Apache 2.0
Metadata
Release files for mif-tools 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mif_tools-0.2.2.tar.gz | 31.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mif_tools-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.7 kB
Release files / mif_tools-0.2.2.tar.gz
| Download URL | mif_tools-0.2.2.tar.gz |
|---|---|
| Size | 31.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d722cfba997f59e8318bdbdaab4b5ec303c7f3d577e9e1915e7b236db88a5029
|
|
BLAKE2b-256 checksum How to use checksums |
b0ac76fd76b2f204fcbc24529c4a386d26bf412a19806bbddba8e73543fc0ac1
|
| 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 6, 2026.
Transparency logRelease files / mif_tools-0.2.2-py3-none-any.whl
| Download URL | mif_tools-0.2.2-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c133cfed2a875f58d3ac0b359f77c98ce4e4e50fcd7aa49886fabccb9f925469
|
|
BLAKE2b-256 checksum How to use checksums |
456c030697aa20b94859e4aa4a71d13fbac6f0ef517487cdc558b2b4be146338
|
| 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 6, 2026.
Transparency logSecurity for mif-tools 0.2.2
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mif_tools-0.2.2.tar.gz
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 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.