{"id":46506120,"url":"https://github.com/varun29ankus/mif-spec","last_synced_at":"2026-03-12T21:06:20.809Z","repository":{"id":342509748,"uuid":"1174200278","full_name":"varun29ankuS/mif-spec","owner":"varun29ankuS","description":"MIF — Memory Interchange Format. A vendor-neutral JSON schema for portable AI agent memories. Convert between mem0, CrewAI, LangChain, and more.","archived":false,"fork":false,"pushed_at":"2026-03-06T14:20:13.000Z","size":139,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-09T22:08:04.747Z","etag":null,"topics":["ai","ai-agents","ai-memory","crewai","interchange-format","json-schema","langchain","llm","mcp","mem0","memory","mif","model-context-protocol","portability"],"latest_commit_sha":null,"homepage":"https://varun29ankus.github.io/mif-spec/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varun29ankuS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-06T07:11:13.000Z","updated_at":"2026-03-06T14:20:17.000Z","dependencies_parsed_at":"2026-03-07T16:06:04.510Z","dependency_job_id":null,"html_url":"https://github.com/varun29ankuS/mif-spec","commit_stats":null,"previous_names":["varun29ankus/mif-spec"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/varun29ankuS/mif-spec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varun29ankuS%2Fmif-spec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varun29ankuS%2Fmif-spec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varun29ankuS%2Fmif-spec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varun29ankuS%2Fmif-spec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varun29ankuS","download_url":"https://codeload.github.com/varun29ankuS/mif-spec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varun29ankuS%2Fmif-spec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30348854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agents","ai-memory","crewai","interchange-format","json-schema","langchain","llm","mcp","mem0","memory","mif","model-context-protocol","portability"],"created_at":"2026-03-06T15:00:25.007Z","updated_at":"2026-03-11T20:00:55.584Z","avatar_url":"https://github.com/varun29ankuS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Memory Interchange Format (MIF)\n\n[![PyPI](https://img.shields.io/pypi/v/mif-tools?label=PyPI\u0026logo=python\u0026logoColor=white)](https://pypi.org/project/mif-tools/)\n[![npm](https://img.shields.io/npm/v/@varunshodh/mif-tools?label=npm\u0026logo=npm\u0026logoColor=white)](https://www.npmjs.com/package/@varunshodh/mif-tools)\n[![License](https://img.shields.io/github/license/varun29ankuS/mif-spec)](https://github.com/varun29ankuS/mif-spec/blob/main/LICENSE)\n[![Tests](https://img.shields.io/github/actions/workflow/status/varun29ankuS/mif-spec/validate.yml?label=tests\u0026logo=github)](https://github.com/varun29ankuS/mif-spec/actions/workflows/validate.yml)\n[![Docs](https://img.shields.io/github/actions/workflow/status/varun29ankuS/mif-spec/pages.yml?label=docs\u0026logo=github)](https://varun29ankus.github.io/mif-spec/)\n\n**Your AI agent has 6 months of memories in System A. You want to try System B. Without MIF, you lose everything. With MIF:**\n\n```bash\npip install mif-tools\nmif convert mem0_export.json --to shodh -o memories.mif.json\n```\n\nDone. Your memories are portable.\n\n## What is MIF?\n\nA vendor-neutral JSON envelope for AI agent memories. Like vCard for contacts or iCalendar for events — a minimal schema so memories move between providers without data loss.\n\n**3 required fields.** That's it.\n\n```json\n{\n  \"mif_version\": \"2.0\",\n  \"memories\": [\n    {\n      \"id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n      \"content\": \"User prefers dark mode across all applications\",\n      \"created_at\": \"2026-01-15T10:30:00Z\"\n    }\n  ]\n}\n```\n\nEverything else — memory types, tags, entities, embeddings, knowledge graph, vendor extensions — is optional. Add what you have, ignore what you don't.\n\n## Install\n\n```bash\n# Python\npip install mif-tools              # core (zero dependencies)\npip install mif-tools[validate]    # with JSON Schema validation\npip install mif-tools[mcp]         # with MCP server\n\n# Node.js / TypeScript\nnpm install @varunshodh/mif-tools\n```\n\n## Convert Between Formats\n\n```bash\n# mem0 → MIF\nmif convert mem0_export.json --from mem0 -o memories.mif.json\n\n# MIF → Markdown (Obsidian/Letta style)\nmif convert memories.mif.json --to markdown -o memories.md\n\n# Auto-detect source format\nmif convert any_memory_file.json -o output.mif.json\n\n# Inspect any memory file\nmif inspect memories.json\n\n# Validate MIF document\nmif validate memories.mif.json\n```\n\n## Python API\n\n```python\nfrom mif import load, dump, convert, MifDocument, Memory\n\n# Load from any format (auto-detects mem0, markdown, generic JSON, MIF)\ndoc = load(open(\"mem0_export.json\").read())\nprint(f\"{len(doc.memories)} memories loaded\")\n\n# Convert between formats in one line\nmarkdown = convert(data, from_format=\"mem0\", to_format=\"markdown\")\n\n# Create memories from scratch\ndoc = MifDocument(memories=[\n    Memory(\n        id=\"123e4567-e89b-12d3-a456-426614174000\",\n        content=\"User prefers dark mode\",\n        created_at=\"2026-01-15T10:30:00Z\",\n        memory_type=\"observation\",\n        tags=[\"preferences\", \"ui\"],\n    )\n])\nprint(dump(doc))  # MIF v2 JSON\n\n# Deep validation (UUIDs, references, timestamps, embedding dimensions)\nfrom mif import validate_deep\nok, warnings = validate_deep(open(\"export.mif.json\").read())\n```\n\n## Add MIF to Your MCP Server (10 lines)\n\n```python\nfrom mif import load, dump\n\n# Export handler\ndef export_memories(user_id: str) -\u003e str:\n    memories = my_storage.get_all(user_id)\n    return dump(memories)\n\n# Import handler — auto-detects mem0, markdown, generic JSON, MIF\ndef import_memories(data: str) -\u003e dict:\n    doc = load(data)\n    for mem in doc.memories:\n        my_storage.save(mem.id, mem.content, mem.created_at)\n    return {\"memories_imported\": len(doc.memories)}\n```\n\n## Supported Formats\n\n| Format | ID | Auto-detect | Description |\n|--------|----|-------------|-------------|\n| **MIF v2** | `shodh` | `\"mif_version\"` in JSON | Native format, lossless round-trip |\n| **mem0** | `mem0` | JSON array with `\"memory\"` field | mem0 memory exports |\n| **CrewAI** | `crewai` | JSON array with `\"task_description\"` | CrewAI LTMSQLiteStorage exports |\n| **LangChain** | `langchain` | JSON array with `\"namespace\"` + `\"value\"` | LangChain/LangMem Item format |\n| **Generic JSON** | `generic` | JSON array with `\"content\"` field | Any JSON memory array |\n| **Markdown** | `markdown` | Starts with `---` | YAML frontmatter (Letta/Obsidian style) |\n\n## Full Spec\n\nMIF supports optional fields for rich memory data:\n\n- **Memory types** — `observation`, `decision`, `learning`, `error`, `context`, `conversation`, and custom types\n- **Entity references** — named entities with type and confidence\n- **Embeddings** — model name, dimensions, vector (reuse or regenerate)\n- **Knowledge graph** — entities and relationships with confidence scores\n- **Vendor extensions** — system-specific metadata preserved on round-trip\n- **Privacy** — PII detection and redaction markers\n\nFull specification: [`spec/mif-v2.md`](./spec/mif-v2.md) | JSON Schema: [`schema/mif-v2.schema.json`](./schema/mif-v2.schema.json)\n\n## MCP Server\n\nExpose MIF tools to any MCP-compatible AI client:\n\n```bash\npip install mif-tools[mcp]\nmif mcp\n```\n\nTools: `export_memories`, `import_memories`, `validate_memories`, `inspect_memories`, `list_formats`\n\n## Adapters \u0026 Implementations\n\n| System | Status | Type |\n|--------|--------|------|\n| [shodh-memory](https://github.com/varun29ankuS/shodh-memory) | Production | Built-in HTTP API (`/api/export/mif`, `/api/import/mif`) |\n| [mif-tools (PyPI)](https://pypi.org/project/mif-tools/) | Production | Python package with CLI + MCP server |\n| [@varunshodh/mif-tools (npm)](https://www.npmjs.com/package/@varunshodh/mif-tools) | Production | TypeScript/Node.js package with CLI |\n| mem0 | Adapter ready | Python + npm |\n| CrewAI | Adapter ready | Python + npm |\n| LangChain | Adapter ready | Python + npm |\n| Generic JSON | Adapter ready | Python + npm |\n| Markdown (YAML frontmatter) | Adapter ready | Python + npm |\n\n## Design Principles\n\n1. **Minimal** — 3 required fields. Everything else is optional.\n2. **Extensible** — Unknown fields and vendor extensions MUST be preserved on round-trip.\n3. **Vendor-neutral** — The schema doesn't favor any implementation.\n4. **Forward-compatible** — Importers MUST ignore unknown fields.\n\n## Contributing\n\nWe welcome adapter implementations for any memory system. See [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## Related\n\n- [Documentation](https://varun29ankus.github.io/mif-spec/) — Full docs site\n- [MCP SEP #2342](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2342) — Original proposal to the Model Context Protocol\n- [tower-mcp #531](https://github.com/joshrotenberg/tower-mcp/issues/531) — Tracking issue in tower-mcp\n- [shodh-memory](https://github.com/varun29ankuS/shodh-memory) — Reference implementation (Rust)\n- [mif-tools on PyPI](https://pypi.org/project/mif-tools/) — Python package\n- [@varunshodh/mif-tools on npm](https://www.npmjs.com/package/@varunshodh/mif-tools) — npm package\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarun29ankus%2Fmif-spec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarun29ankus%2Fmif-spec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarun29ankus%2Fmif-spec/lists"}