# Changesets

> Group changes into a changeset, review the plan, and apply every change together or discard them.

Source: https://docs.ligament.ai/guides/building-apps/changesets/

A changeset is a named draft of one or more changes to pages or access artefacts. It lets one person (or an agent) prepare a change and another review and apply it, and it applies everything in it together: either every item goes live, or none does. Use one when the person making a change can’t or shouldn’t apply it alone, when a change spans several artefacts, or when an AI agent proposes it.

Changesets live in **Build › Changes**.

## The life of a changeset

| Status | Shown as | What can happen next |
| --- | --- | --- |
| `open` | **Draft** | Add or replace items, mark it ready, apply it, discard it |
| `ready` | **Ready for review** | Reopen it, apply it, discard it |
| `applied` | **Applied** | Nothing: it’s read-only and records who applied it and when |
| `discarded` | **Discarded** | Nothing: it’s kept read-only with its activity, and nothing in it was applied |

Marking a changeset ready is a signal to reviewers, not a lock: a ready changeset can still be applied by anyone allowed to, and reopened for more edits.

## Propose a change

**From a builder.** In the page builder, select **Save as changeset** (or **Plan**, then **Save as changeset** in the plan dialog). The builder creates a changeset called *Draft:* and stays open on it: the header shows **Draft · 1 change** and the changeset’s name, and its buttons become **Save to changeset** and **Apply changeset**. Further edits go into the same changeset until you apply it or leave.

**From the API, CLI or MCP.** Create the changeset with its items in one call:

```bash
curl -s -X POST -H "Authorization: Bearer $LIGAMENT_API_KEY" -H 'content-type: application/json' \
  https://app.ligament.ai/api/changesets \
  -d '{
    "title": "Loans desk: show up to 25 loans",
    "note": "The desk has more than 10 loans out most weeks.",
    "ready": true,
    "items": [ { "address": "page/loans_desk", "baseHash": "7b4300da2d088767", "doc": { … } } ]
  }'
```

The response is `201` with the changeset, including its `id`, `status` (`ready` here), who created it and its `url` (`/build/changes/<id>`). An item without `baseHash` starts from the artefact’s current version. The [CLI](https://docs.ligament.ai/reference/cli/index.md) has the same operations as `ligament changeset create | add | ready | plan | apply | discard`, and MCP clients get the `changeset_*` tools.

A changeset holds one item per artefact; adding an item for an artefact that’s already in it replaces that item. `PATCH /api/changesets/<id>` changes the title, note or status (`open` or `ready`).

## Review it

Open the changeset in **Build › Changes**. The **Open & ready** filter shows what’s waiting.

\[Screenshot: A changeset titled Loans desk: show the due-back date, Ready for review, proposed by Max Maker, with its plan and the Impact panel\]

-   The **Plan** tab plans every item against what’s live now: create, update, delete or reset, which layer it writes (*This workspace*, or a customisation of an app’s shipped version), and a line per change. The note the proposer wrote is shown above it. **Re-plan** refreshes it.
-   The **Impact** panel lists the permissions applying needs and whether you hold them, whether the change touches access rules or code, the workspace’s policy for changes made with API keys, and the layers involved. A plan that changes access artefacts also shows who gains or loses access (see [Reviewing access changes](https://docs.ligament.ai/guides/access/reviewing-access-changes/index.md)).
-   The **Artefacts** tab lists the items, each with the hash it started from.
-   The **Activity** tab records every step: created, each change proposed, marked ready, applied or discarded, and refused applies.

If someone changed an artefact after the changeset started from it, the plan shows the item merged with those newer changes, which is what **Apply** writes. If the same values changed on both sides, the plan shows the conflict, and nothing is applied until it’s resolved.

## Apply or discard it

Select **Apply** to apply every item together. If any item fails (it no longer validates, conflicts, or needs a permission you don’t hold), nothing is applied and the changeset stays as it was. **Discard** closes it without applying anything.

Each applied artefact gets a new version that names the changeset, so its history leads back to the review.

\[Screenshot: The Activity tab of an applied changeset: created by Max Maker, change proposed, marked ready for review, applied by Ada Admin\]

## Who may do what

| Action | Who |
| --- | --- |
| See changesets | Anyone with access to Build |
| Propose: create, edit, mark ready, discard | Anyone with access to Build, except viewers; API keys with `spec:propose` |
| Apply | People who hold the build permission for every item (`build:pages`, `build:access`); API keys with `spec:apply` whose creator holds them, within the workspace’s [agent policy](https://docs.ligament.ai/guides/building-apps/agents-propose/index.md) |

Proposing is free: it changes nothing live. Owners and admins hold every build permission; owners can grant them to other roles in **Settings › Access › Roles**.

When someone without the permission opens a changeset, the review page says so and **Apply** is disabled:

\[Screenshot: The same changeset seen by Max, whose role lacks build:pages: a notice says he can't apply it, the Impact panel shows build missing and Apply is disabled\]

## API

| Method and path | Scope | Does |
| --- | --- | --- |
| `GET /changesets?status=open,ready` | `spec:read` | Changesets, newest first |
| `POST /changesets` | `spec:propose` | Create one: `{ title, note?, items?, ready? }` |
| `GET /changesets/<id>` | `spec:read` | Items, base hashes and activity |
| `PATCH /changesets/<id>` | `spec:propose` | `{ title?, note?, status: "open" | "ready" }` |
| `PUT /changesets/<id>/items` | `spec:propose` | Add or replace `{ items }` |
| `DELETE /changesets/<id>/items?address=` | `spec:propose` | Remove one item |
| `POST /changesets/<id>/plan` | `spec:read` | Plan every item against what’s live |
| `POST /changesets/<id>/apply` | `spec:apply` | Apply every item, all or nothing (`{ onConflict?: "merge" }`) |
| `POST /changesets/<id>/discard` | `spec:propose` | Discard it |

Paths are relative to `https://app.ligament.ai/api`. Request and response shapes are in the [REST API reference](https://docs.ligament.ai/reference/rest-api/index.md#changesets).
