Skip to main content

MIF (Memory Interchange Format) — vendor-neutral memory portability for AI agents

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mif_tools-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mif_tools-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file mif_tools-0.1.0.tar.gz.

File metadata

  • Download URL: mif_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mif_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 61715e8a418b7c33881dfb5b25d2a9f4a01de3400e6a22bf5bc798d3b024cc63
MD5 b3be1d159611d7b25c262d326be4f52e
BLAKE2b-256 82d89671a0725e7b9d19a6db69f75a087c5b118de690bcd6ab7ca7eb11c6c038

See more details on using hashes here.

Provenance

The following attestation bundles were made for mif_tools-0.1.0.tar.gz:

Publisher: publish.yml on varun29ankuS/mif-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mif_tools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mif_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mif_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b500d3055663b19253d522887008e511f4f5cd08d56e5572f6d27fac9b2c4ca1
MD5 8cf1b1a4986f635854598677db027ed8
BLAKE2b-256 0953fcaff1d11edd19f6c90d8b262aadcf63a9ef21908267b504051f0c9308ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for mif_tools-0.1.0-py3-none-any.whl:

Publisher: publish.yml on varun29ankuS/mif-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page