Nodes/Continuity Director/CD · Three-Way Merge
ComfyUI Node

CD · Three-Way Merge

When two people edit the same production, something has to reconcile

By xinjian0101·Created 3 months ago·Updated 2 months ago· 0
CD · Three-Way Merge
    • merged_json
    • conflicts_json
    • has_conflicts
    base_json{}
    current_json{}
    incoming_json{}

    You and a teammate edited the same shot list. Your version has the new camera angles; theirs has the reshuffled scene order. One of you is going to overwrite the other's work unless something reconciles them - and "something" should not be whoever happens to save last. CDThreeWayMerge is the node that does a proper three-way merge on two edited JSON states, using a common base to figure out which changes to keep and which ones genuinely conflict.

    It's from Continuity Director, a 20-node pack for repeatable AI video production, and it's the second collaboration node - the one that makes the pack usable by more than one person at a time.

    What you feed it

    • base_json - the state both people started from. This is the crucial third input that makes it a three-way merge rather than guesswork.
    • current_json - your version (the local edits).
    • incoming_json - their version (the edits arriving from elsewhere).

    How the merge thinks

    The logic is the standard git-like rule set: if both sides made the same change, keep it. If only one side changed something, take that change. If both sides changed the same field differently - that's a conflict. It recurses through nested objects, tracks concurrent additions, and treats deletions carefully (delete-vs-change and change-vs-delete are both flagged as conflicts rather than silently resolved). When there's a conflict, the merged output takes the current side's value by default and records it in the conflict list with its path, the base value, and both competing values, so a human can resolve it deliberately.

    Outputs are merged_json (the reconciled document), conflicts_json (the list of every path that needs a human decision, each with a resolution field that currently says current), and has_conflicts (a boolean you can gate on - wire it into a "send this to a human" branch).

    Installing it

    Continuity Director is an unusually clean install: no model downloads, no API keys, zero Python dependencies (requirements.txt literally just declares that). Search "Continuity Director" in ComfyUI Manager and restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/xinjian0101/continuity-director.git ComfyUI-ContinuityDirector
    

    Restart ComfyUI - nodes show up as CD · ..., plus a Continuity Director sidebar with an "Add starter chain" scaffold. Update with git pull.

    Where people get burned

    Three traps. First, the base actually matters: if you feed it a stale or fabricated base, the merge makes confident decisions on wrong information. Always merge against the real common ancestor, which in this pack is naturally the last manifest or shot-chain JSON both of you exported from. Second, conflicts resolve to current by default - read the conflicts_json before shipping a merged result, or you'll quietly adopt your own version of every disputed field. Third, this is JSON merge, not a human negotiation: it tells you where the disagreements are, and the disagreements are still yours to settle. Use it as the referee, not the decision-maker, and it saves you from the actual production sin of silent overwrites.

    CategoryContinuity Director/05 Collaboration

    Inputs (3)

    NameTypeDefaultDescription
    base_jsonSTRING{}
    current_jsonSTRING{}
    incoming_jsonSTRING{}

    Outputs (3)

    NameTypeDescription
    merged_jsonSTRING
    conflicts_jsonSTRING
    has_conflictsBOOLEAN