feat: MIF v2 vendor-neutral schema with format adapters#62
Merged
varun29ankuS merged 2 commits intomainfrom Feb 22, 2026
Merged
feat: MIF v2 vendor-neutral schema with format adapters#62varun29ankuS merged 2 commits intomainfrom
varun29ankuS merged 2 commits intomainfrom
Conversation
Redesign Memory Interchange Format as a vendor-neutral standard: - MIF v2 schema: raw UUIDs, typed entities, vendor extensions for shodh-specific metadata (importance, tier, Hebbian state, LTP) - Adapter pattern: MifAdapter trait with detect/to_mif/from_mif for extensible format support (shodh, mem0, generic JSON, markdown) - AdapterRegistry: auto-detection via ordered detect() calls - Streaming export: entity types resolved from GraphMemory (no more "UNKNOWN"), per-memory vendor extensions, PII redaction - UUID-preserving import: new remember_with_id() for explicit MemoryId, O(1) content-hash dedup via SHA256 (replaces O(n*k) recall queries) - File split: multimodal/robotics search moved to handlers/search.rs - Dead code removal: encryption stubs, old v1 types, duplicate PII code - handlers/mif.rs rewritten from 1688 to ~300 lines (thin HTTP layer)
entity_refs on memories are empty (entities come through experience.entities path instead), so UUID-based graph lookup always missed. Added name-based fallback for both code paths: entity_refs and experience.entities now resolve types from the graph entity name map. Resolves 97.3% of entity types (was 0%).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Redesigns the Memory Interchange Format (MIF) as a vendor-neutral standard with pluggable adapters, fixing all known issues with the v1 implementation.
What was broken (v1)
handlers/mif.rswas 1688 lines with search handlers mixed inWhat's fixed (v2)
New module:
src/mif/schema.rs— Vendor-neutral types: MifDocument, MifMemory, MifKnowledgeGraph, MifTodo, MifProject, MifReminder with vendor extensionsexport.rs— Streaming export with entity type resolution from GraphMemory, per-memory vendor extensions, PII redactionimport.rs— UUID-preserving import viaremember_with_id(), O(1) SHA256 content-hash dedup, graph reconstructionpii.rs— PII detection/redaction (email, phone, SSN, API key, credit card)Adapter pattern:
src/mif/adapters/MifAdaptertrait withdetect(),to_mif(),from_mif()shodh.rs— MIF v2 JSON (lossless round-trip) + v1 backward compatmem0.rs— mem0 format:[{memory, metadata, ...}]generic.rs— Generic JSON array:[{content, timestamp, tags, ...}]markdown.rs— Markdown with YAML frontmatter (Letta/Obsidian style)AdapterRegistrywith auto-detection (most specific → generic fallback)Handler cleanup
handlers/mif.rsrewritten: 1688 → ~300 lines (thin HTTP layer)handlers/search.rsNew API endpoint:
GET /api/mif/adapters— lists available formatsFiles changed
src/mif/Test plan
cargo check— clean ✅cargo clippy— no warnings in new files ✅redact_pii=true