# How AI changes a board

> How to change a Dockito board through the API, CLI or MCP: each edit with a short example, and how new items find their place.

Your AI changes a board with `edit_board`, at the version it read. It sends a list of ops. All of them apply, or none do, as one change and one save.

```json
{
  "doc": "b9w3h7k2f5xe",
  "base": 128,
  "note": "Group the retro",
  "ops": [
    { "op": "add", "items": [{ "kind": "sticky", "text": "Concrete pour beat the rain", "in": "f1" }] },
    { "op": "cluster", "in": "f1", "groups": [
      { "title": "On site", "ids": ["s2", "s6", "@0"] },
      { "title": "Owners", "ids": ["s3", "s5"] }
    ] }
  ]
}
```

The reply names each op's new items, then notes:

```text
v129: add → s43; cluster → t1 t2
"On site": s2 s6 s43
"Owners": s3 s5
f1 grew to 1400×1100 to fit
```

## Ops

| Op | Example |
|---|---|
| `add` | `{"op":"add","items":[{"kind":"sticky","text":"Flaky tests","color":"pink","in":"f2"}]}` |
| `set` | `{"op":"set","ids":["k1"],"props":{"owner":"Priya N.","due":"2026-11-04","status":"Done"}}` |
| `text` | `{"op":"text","id":"s12","find":"Tues","with":"Tuesday"}` |
| `move` | `{"op":"move","ids":["s12"],"in":"f3"}` |
| `delete` | `{"op":"delete","ids":["s40"]}` |
| `connect` | `{"op":"connect","from":"h2","to":"h3","label":"if green"}` |
| `frame` | `{"op":"frame","title":"Actions","ids":["s3","s7"]}` |
| `arrange` | `{"op":"arrange","in":"f2","as":"grid"}` |
| `cluster` | `{"op":"cluster","in":"f1","groups":[{"title":"Testing","ids":["s3","s9"]}]}` |
| `z` | `{"op":"z","ids":["s3"],"to":"front"}` |
| `group`, `ungroup` | `{"op":"group","ids":["s3","s4"]}` |
| `card` | `{"op":"card","ids":["s12"]}` |
| `board.set` | `{"op":"board.set","props":{"title":"Sprint 14 retro"}}` |

- **`set`** takes `null` to remove a field. Tags and statuses can be given by name.
- **`text`** also takes `html` (the whole text), `insert`, `delete` with `expect`, and `append`. `field` picks a card's `desc` or a connector's `label`.
- **`delete`** on a frame leaves its items where they are, unless it says `"contents": true`. Connectors to a deleted item go with it.
- **`card`** turns stickies into cards. Their place, text, colour, tags and votes stay.

## Refs within one call

`"@0"` is what op 0 made (ops count from 0). `"@0.1"` is its second item. So one call can add a frame and fill it:

```json
[
  { "op": "frame", "title": "Parking lot" },
  { "op": "add", "items": [{ "kind": "sticky", "text": "Porch option for lot 14", "in": "@0" }] }
]
```

## Where items go

| | |
|---|---|
| `"in": "f2"` | Into the frame's next free spot. A full frame grows down. |
| `"near": "s5"` | Beside `s5`, or below it if the right is taken, in its frame. |
| `"at": [x, y]` | Exactly there. With `in`, in the frame's own units. |
| None | To the right of everything, outside any frame. The reply says so. |

`move` follows the same rules, so moving a sticky into a frame is one op.

## Arrange and cluster

AI is good at meaning and bad at coordinates. So it picks, and Dockito lays out.

- **`arrange`** lays items out `as` a `grid`, `row`, `column`, `tree` or `flow`. Trees and flows follow the connectors between the items. `in` alone arranges everything in a frame.
- **`cluster`** takes groups your AI chose, each with a title, and lays them out as labelled columns in a frame. `"as": "blocks"` makes blocks instead. Up to 50 groups.

Neither puts anything on top of what's already there. The frame grows to fit, and never shrinks. Clustering the same groups again changes nothing.

## Lighting up first

`intent` lights up items for people watching, before a change lands: `{"items": ["f1"], "say": "Grouping the stickies"}`. Sent alone, without ops, it lights them for up to 20 seconds while your AI thinks.

## When someone else got there first

If a person changed an item after the version your AI read, the call is refused and names them. Your AI reads again and retries. A text `find` and `with` still lands.

`dryRun` works a call out without saving it. The same call sent twice applies once.

## Limits

| | Limit |
|---|---|
| Edits in one call | 500. An op naming several items counts each. |
| One call | 1 MB |
| Text into one item, in one call | 10,000 characters |
| Groups in one `cluster` | 50 |
| `intent` | 20 items, 20 seconds |
