osyra_ome.cli.migrate.from_mem0
Private pre-release / network boundary: The currently usable customer surface is offline verification of an existing signed artifact against an out-of-band trust anchor. Memory/network RPC APIs and host snippets on this page describe protocol and interface shape; the public Edge bridge, package publication, and release acceptance remain pending. Do not treat
api.osyra.ai:443examples as a released customer route.
``osyra-ome migrate from-mem0`` — ENG-850 / Tier-4 T4-9.
Migrates memory records from Mem0 (a direct competitor) into the OME memory store via main's gRPC ``OmeClient.memory.write_claim`` surface (T4-2).
Mem0 organizes memories around ``(user_id, agent_id, memory_id, hash, metadata, content)``; OME organizes around ``(workspace, subject, kind, parents, issuer, content_hash, embedding_hash, body)``. The translator preserves intent without lossy projection — see the end-of-run Mem0 differential report.
Strategy:
- Open a Mem0 client with the operator-supplied API key.
- Query memories for the specified ``user_id`` (with optional
agent_id/run_idfilters). - Transform each Mem0 memory to an OME :class:`Claim` —
see :func:
_mem0_to_claim. - Per-record write via :meth:`OmeClient.memory.write_claim` (main's v1.0.0 surface).
- Generate the Mem0 differential report at end-of-run.
Mem0 vs OME (differential report fields):
- OME memories are versioned via the redactable JMT; Mem0 memories
are not. Re-importing the same
memory_idstores both versions. - OME memories are Ed25519-signed; Mem0 memories are not.
- OME claims carry ``workspace_id`` (IAM-bound); Mem0 memories carry
user_id(sometimes IAM-bound, sometimes free-form). - OME supports derivation DAGs (``Claim.parents``); Mem0 supports
flat user-id-grouped lists. We migrate as
ASSERTIONonly. - OME has GDPR-Art-17 tombstones (post-V1 GA); Mem0 ``delete()`` is irrevocable.
References:
- Mem0 Python SDK: https://docs.mem0.ai/python-sdk
- OME differential discussion: ``docs/migrations.md`` §Mem0 differential.
Constants
| Name | Value |
| --- | --- |
| SOURCE_NAME | 'mem0' |
Functions
from_mem0
def from_mem0(api_key: str = typer.Option('', '--api-key', envvar='MEM0_API_KEY', help='Mem0 API key. **Prefer** `MEM0_API_KEY` env var over the flag — flag values land in shell history.'), user_id: str = typer.Option(..., '--user-id', help='Mem0 user_id whose memories to migrate.'), agent_id: str = typer.Option('', '--agent-id', help='Optional Mem0 agent_id filter. Default: all agents under the user_id.'), run_id: str = typer.Option('', '--run-id', help='Optional Mem0 run_id filter.'), mem0_base_url: str = typer.Option('', '--mem0-base-url', envvar='MEM0_BASE_URL', help='Override the Mem0 service endpoint. Useful for self-hosted Mem0.'), reembed: bool = typer.Option(False, '--reembed', help="Re-embed records using OME's default embedder instead of preserving the Mem0 vector. Default: preserve when present."), ome_endpoint: str = typer.Option(..., '--ome-endpoint', help="OME gRPC target as 'host:port' (e.g. 'api.osyra.ai:443')."), ome_token: str = typer.Option('', '--ome-token', envvar='OSYRA_OME_TOKEN', help='OME bearer token. Prefer OSYRA_OME_TOKEN env var.'), ome_workspace: str = typer.Option(..., '--ome-workspace', help="OME workspace ID (e.g. 'ws-prod')."), ome_workspace_tier: str | None = typer.Option(None, '--ome-workspace-tier', help='Deprecated: Edge derives the effective tier server-side.', hidden=True), target_namespace: str = typer.Option(..., '--target-namespace', help='OME logical namespace to write into. REQUIRED.'), batch_size: int = typer.Option(100, '--batch-size', help='Memories per progress-advance window. Default 100.'), dry_run: bool = typer.Option(False, '--dry-run', help='Read + transform + validate; do NOT write to OME.'), resume_from_checkpoint: Path = typer.Option(None, '--resume-from-checkpoint', help='Resume from a previously-emitted checkpoint file.'), checkpoint_out: Path = typer.Option(None, '--checkpoint-out', help='Emit progress checkpoints to this file after each batch.'), audit_file: Path = typer.Option(None, '--audit-file', help='Append per-record JSON audit events to this file. Default: stderr.'), include_pii: bool = typer.Option(False, '--include-pii', help='Log user_id / memory_id verbatim. Default: false (IDs are hashed).'), strict_audit: bool = typer.Option(False, '--strict-audit', help='Treat audit-emission failures as fatal. Default: warn-and-continue.'), verbose: bool = typer.Option(False, '--verbose', '-v', help='Print per-memory progress to stderr.'), insecure: bool = typer.Option(False, '--insecure', help='Dial an insecure gRPC channel (no TLS). ONLY for local dev.')) -> NoneMigrate memory records from Mem0 into OME.
Example:
export MEM0_API_KEY=m0_...
export OSYRA_OME_TOKEN=osyra_...
osyra-ome migrate from-mem0
--user-id customer-alpha
--ome-endpoint api.osyra.ai:443
--ome-workspace ws-prod
--target-namespace ome-prod
--dry-run