Nodes with parent_node_id references were inserted in a single batch, causing FK violations when children were inserted before their parents. Now inserts roots first, flushes, then children in subsequent passes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>