SDK Converters
PAM SDKs convert provider-specific exports into the portable PAM format. Each SDK targets a single language and provides both a CLI and a programmatic API.
Official SDK: CLI and library for converting, validating, and building PAM files
AvailableNode.js package for PAM conversion and validation
Coming soonNative Go module for PAM processing
PlannedPAM reader/writer for Rust
PlannedJVM library for PAM integration
Planned.NET library for PAM support
PlannedPython SDK
Section titled “Python SDK”The official Python SDK is the first reference implementation. It supports converting, validating, inspecting, and building PAM documents.
Install
Section titled “Install”pip install portable-ai-memory # core SDK (models, I/O, validation, converters)pip install 'portable-ai-memory[cli]' # + CLI tool (pam command)Convert via CLI
Section titled “Convert via CLI”# Convert a provider export to a PAM bundle (auto-detects provider)pam convert ~/chatgpt-export/ -o ./pam-bundle/ --owner-id user-123
# Force a specific providerpam convert export.json -o ./pam-bundle/ --provider claude
# Validate the resultpam validate ./pam-bundle/
# Inspect the outputpam inspect ./pam-bundle/memory-store.jsonConvert programmatically
Section titled “Convert programmatically”The SDK auto-detects the provider format and converts conversations, memories, and metadata into PAM documents.
import jsonfrom pathlib import Path
from portable_ai_memory.converters import detect_providerfrom portable_ai_memory import ProviderNotDetectedError
try: converter = detect_provider("conversations.json") data = json.loads(Path("conversations.json").read_text()) conversations = converter.convert_conversations( data, owner_id="user-123", )except ProviderNotDetectedError as e: print(f"Unknown format: {e}")Supported providers
Section titled “Supported providers”| Provider | Source format |
|---|---|
| OpenAI (ChatGPT) | conversations.json |
| Anthropic (Claude) | conversations.json + memories.json |
| Google (Gemini) | Takeout JSON or HTML |
| xAI (Grok) | prod-grok-backend.json |
| Microsoft (Copilot) | CSV exports |
To list registered converters:
from portable_ai_memory.converters import list_converters
print(list_converters()) # ['chatgpt', 'claude', 'gemini', 'grok', 'copilot']See the Provider pages for details on each provider’s export format and field mappings.
Build from scratch
Section titled “Build from scratch”MemoryObject.create() auto-fills content_hash, temporal, and provenance metadata.
from portable_ai_memory import MemoryStore, MemoryObject, Owner, save
store = MemoryStore( schema_version="1.0", owner=Owner(id="user-123"), memories=[ MemoryObject.create( id="mem-001", type="preference", content="User prefers dark mode.", platform="my-app", ) ],)save(store, "memory-store.json")
# Convenience lookupsmem = store.get_memory_by_id("mem-001")prefs = store.get_memories_by_type("preference")What each converter does
Section titled “What each converter does”- Auto-detects the provider’s export format
- Maps fields to PAM schema
- Computes content hashes per spec §6 normalization
- Outputs valid, schema-compliant PAM documents
- Generates companion conversation files with full message history
- Copies attachments when present in the source export