merge_branch
Merges a branch session's changes into a target session using an automatic merge base from the fork point. Returns conflicts for manual resolution, then re-merges with resolutions to complete the merge.
Instructions
Session-aware three-way merge: merge a branch session's changes into a target session. The merge base is resolved automatically from the branch's recorded fork point (set by create_branch), so -- unlike merge_knowledge -- you never supply the base yourself. On success, commits the merged result as a new version of the target session. On conflict, returns a 'conflicts' list (object_id, target_diff, source_diff) instead of merging. Do not call merge_branch again unchanged after a conflict -- retry it with a 'resolutions' argument covering each conflicting object_id (see the 'resolutions' parameter), which merges everything -- non-conflicting changes and now-resolved conflicts alike -- in this one call; identities you don't supply a resolution for are reported again. Only if you'd rather change the target session's content directly, apply your resolution there with evolve_knowledge and retry merge_branch with no resolutions. Either way, close_session the source branch once it has been fully integrated.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resolutions | No | Optional. Per-object conflict resolution strategies. Keys are object IDs. Values: 'branch_a' (take target's version), 'branch_b' (take source branch's version), null (drop the object), or a complete object definition to use as the merged result. | |
| base_version_id | No | Optional. Overrides the merge base with a specific version id from the target session's history. Only needed if source_session_id wasn't created with create_branch's 'version_id' parameter. | |
| source_session_id | Yes | The branch session being merged in. | |
| target_session_id | Yes | The session to merge into. |