---
title: "LLM-based three-way merge of a user edit with the current LLM output"
method: POST
path: "/context-documents/tree/{tree_id}/files/automerge"
tags: ["Context Documents"]
---

# LLM-based three-way merge of a user edit with the current LLM output

`POST /context-documents/tree/{tree_id}/files/automerge`

Semantic auto-merge for a single file.

Uses Claude to combine the user's saved content with the fresh LLM
baseline: preserve user framing, absorb new facts. Saves the result as
an updated content edit and returns the refreshed tree.

Only works on DRAFT trees that have an active content edit and a
captured LLM baseline for the path.

## Path parameters

- `tree_id` string, required

## Request body

- AutomergeRequest
  - `path` string, required — File path to auto-merge.

## Response `200`

Successful Response

- TreeResponse
  - `tree_id` string, required
  - `status` string, required
  - `version` integer, required
  - `files` TreeFile[], nullable, required
    - `path` string, required
    - `content` string, required
    - `tier` string, required
    - `team` string, nullable, required
    - `updated_at` string, required
  - `error` string, nullable, required
  - `created_at` string, date-time, required
  - `completed_at` string, date-time, nullable, required
  - `meta` object, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/hyperspell/apis/hyperspell-api.md) · [All operations](https://skmtc.net/hyperspell/apis/hyperspell-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hyperspell/hyperspell-api/revisions/5721acd588e6/schema)
