---
title: "edit.undo: Undo — Note kit command — Kition"
description: "Takes back the caller's last edit (the person's or, with `scope: \"agent\"`, the agent's) without touching the other's edits; answers whether there was one."
canonical: "https://developer.kition.ai/docs/kits/note/commands/edit.undo"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/note/commands/edit.undo](https://developer.kition.ai/docs/kits/note/commands/edit.undo)

# edit.undo

**Undo.** Takes back the caller's last edit (the person's or, with `scope: "agent"`, the agent's) without touching the other's edits; answers whether there was one.

- Kit: Note 0.3.0 (Markdown (.md)); reference: [Note kit commands](https://developer.kition.ai/docs/kits/note.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `scope` | `"person" \| "agent"` | no | Whose last step to undo: the person's or the agent's. By default the scope of whoever runs it (an agent undoes only its own steps). |

## Call through note_run

```text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "edit.undo" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `scope`. note_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `damage` | `object` | yes | What the step made stale on screen. |
| `done` | `boolean` | yes | Whether there was a step to take; false changes nothing. |

```json
{
  "additionalProperties": false,
  "properties": {
    "damage": {
      "additionalProperties": false,
      "description": "What the step made stale on screen.",
      "properties": {
        "kind": {
          "description": "Nothing, the whole view, or the rectangles in rects.",
          "enum": [
            "none",
            "full",
            "rects"
          ],
          "type": "string"
        },
        "rects": {
          "description": "With kind rects: the areas to draw again, in document pixels.",
          "items": {
            "description": "[x0, y0, x1, y1]",
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array"
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    },
    "done": {
      "description": "Whether there was a step to take; false changes nothing.",
      "type": "boolean"
    }
  },
  "required": [
    "damage",
    "done"
  ],
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "scope": {
      "description": "Whose last step to undo: the person's or the agent's. By default the scope of whoever runs it (an agent undoes only its own steps).",
      "enum": [
        "person",
        "agent"
      ],
      "type": "string"
    }
  },
  "type": "object"
}
```

Generated from kition-sdk packages/script/kits/note.ts and the kit itself (kition-note@69e14d9).
