neo4j-graphiti-migration

donbr's avatarfrom donbr

Assists with migrating data from Neo4j Memory to Graphiti temporal knowledge graphs

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 13, 2025

When & Why to Use This Skill

This Claude skill facilitates the seamless migration of data from Neo4j Memory to Graphiti temporal knowledge graphs. It specializes in transforming entity-first architectures into episode-based structures, ensuring that AI agent memories retain temporal context through valid_at and invalid_at tracking. By automating complex conversions, namespace isolation, and validation, it helps developers upgrade their agent's long-term memory infrastructure with minimal data loss and high integrity.

Use Cases

  • Migrating legacy AI agent memory: Transitioning from static Neo4j entity storage to Graphiti's temporal framework to allow agents to understand how information changes over time.
  • Structured data transformation: Converting raw entity observations into formatted episode templates (Person, Experience, Organization, etc.) to optimize LLM extraction and retrieval.
  • Namespace isolation and organization: Using Group ID classification rules to partition migrated data into distinct logical domains like career history, technical patterns, or research data.
  • High-volume data transfer management: Implementing batch processing and exponential backoff strategies to handle large-scale migrations without hitting rate limits.
  • Migration validation and quality assurance: Running automated checks on episode counts, entity discovery, and relationship extraction to verify the accuracy of the transferred knowledge graph.
nameneo4j-graphiti-migration
descriptionAssists with migrating data from Neo4j Memory to Graphiti temporal knowledge graphs

Neo4j Memory to Graphiti Migration Skill

When to Use This Skill

Invoke this skill when the user asks about:

  • Migrating data from Neo4j Memory to Graphiti
  • Converting entities to episodes
  • Episode format templates
  • Migration validation
  • Group ID classification
  • Rate limiting strategies

Core Concepts

Source System: Neo4j Memory (MCP_DOCKER)

  • Entity-first architecture (direct node creation)
  • Observations as array properties on entities
  • Simple typed relationships
  • No temporal tracking, no embeddings

Target System: Graphiti (graphiti-local)

  • Episode-first architecture (LLM extraction)
  • Temporal tracking (valid_at, invalid_at)
  • group_id namespace isolation
  • Auto-generated embeddings

Entity-to-Episode Conversion Templates

Person Entities (source: text)

{Name} is a {role/title} with {experience summary}.
{Key professional details}.

Key observations:
- {observation 1}
- {observation 2}
- {observation N}

Experience Entities (source: json)

{
  "name": "Role/Position Name",
  "type": "Experience",
  "years": "YYYY-YYYY",
  "duration": "N years",
  "company": "Company Name",
  "details": ["detail 1", "detail 2"]
}

Organization Entities (source: text)

{Organization Name} is a {type} organization.
{Description and context}.

Key divisions/teams:
- {division 1}
- {division 2}

Leadership: {key people and roles}

JobPosting Entities (source: json)

{
  "title": "Job Title",
  "company": "Company",
  "salary_range": "$XXK-$YYK",
  "requirements": ["req1", "req2"],
  "posted_date": "YYYY-MM"
}

Pattern/Architecture Entities (source: text)

{Pattern Name} Pattern

Description: {what it does}

When to use:
- {use case 1}
- {use case 2}

Trade-offs:
- Pros: {benefits}
- Cons: {limitations}

Related patterns: {related}

Group ID Classification Rules

Entity Type group_id
Don Branson, Experience, Skills, Credentials don_branson_career
Organization (Disney*), Team, BuyingCenter disney_knowledge
JobPosting, Recruiter career_opportunities
Pattern, Architecture technical_patterns
research, Project (other) ai_engineering_research

Rate Limiting

Sequential Mode (don_branson_career)

  • 1 episode at a time
  • 2 second pause between calls
  • For CRITICAL priority data

Batch Mode (all others)

  • Up to 10 episodes per batch
  • 0.3 second delay within batch
  • 3 second pause between batches

Exponential Backoff on 429 Errors

Base delay → 2x → 4x → 8x → 16x (max 60s)

Validation Queries

After each group_id migration, verify:

  1. Episode count: get_episodes(group_ids=[group_id])

    • Pass threshold: ≥80% of expected
  2. Entity discovery: search_nodes(query="entity name", group_ids=[group_id])

    • Pass threshold: ≥80% of key entities found
  3. Relationship extraction: search_memory_facts(query="relationship query")

    • Pass threshold: ≥3 relevant facts per query

Migration State File

Location: migration/progress/migration_state.json

{
  "started_at": "ISO timestamp",
  "current_phase": 1,
  "completed_groups": ["group1"],
  "in_progress_group": "group2",
  "completed_episodes": {"group1": ["entity1", "entity2"]},
  "validation_results": {"group1": {...}},
  "last_checkpoint": "ISO timestamp"
}

Quick Reference Commands

# Dry run
uv run python migration/orchestrate_migration.py --dry-run

# Run specific phase
uv run python migration/orchestrate_migration.py --phase 1

# Resume from checkpoint
uv run python migration/orchestrate_migration.py --resume

# Verbose logging
uv run python migration/orchestrate_migration.py -v

Rollback

Per-group rollback (DANGEROUS - requires confirmation):

# Clear specific namespace
mcp__graphiti-local__clear_graph(group_ids=["group_id"])

Source Neo4j Memory remains unchanged as read-only reference.