{"id":"sort-external-merge","text":"`Sort` stage spills sorted chunks to temp JSONL files when the in-memory buffer exceeds `memory_limit`, then uses `heapq.merge` with a `KeyedRecord` wrapper (seq tiebreaker) for stable k-way merge","truth_value":"IN","source":"entries/2026/05/29/batch-word-count-pipeline.md","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{},"explanation":{"steps":[{"node":"sort-external-merge","truth_value":"IN","reason":"premise"}]}}