|
| 1 | +--- |
| 2 | +title: "Represent deleted files in diff" |
| 3 | +--- |
| 4 | + |
| 5 | +Author(s): [anna239](https://github.com/benbrandt) |
| 6 | + |
| 7 | +## Elevator pitch |
| 8 | + |
| 9 | +> What are you proposing to change? |
| 10 | +
|
| 11 | +Add flag `deleted` to [Diff](https://agentclientprotocol.com/protocol/tool-calls#diffs) entity type for the case of a deleted file. |
| 12 | + |
| 13 | +## Status quo |
| 14 | + |
| 15 | +> How do things work today and what problems does this cause? Why would we change things? |
| 16 | +
|
| 17 | +Currently, in Diff entity type `newText` is not nullable, so it's not possible to distinguish between a deleted file and empty file. |
| 18 | + |
| 19 | +## What we propose to do about it |
| 20 | + |
| 21 | +> What are you proposing to improve the situation? |
| 22 | +
|
| 23 | +Add flag `deleted` to [Diff](https://agentclientprotocol.com/protocol/tool-calls#diffs) entity type for the case of a deleted file. |
| 24 | + |
| 25 | +**Current structure (cannot distinguish deleted file from empty file):** |
| 26 | + |
| 27 | +```json |
| 28 | +{ |
| 29 | + "type": "diff", |
| 30 | + "path": "/home/user/project/src/config.json", |
| 31 | + "oldText": "{\n \"debug\": false\n}", |
| 32 | + "newText": "" |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +**Proposed structure with `deleted` flag:** |
| 37 | + |
| 38 | +```json |
| 39 | +{ |
| 40 | + "type": "diff", |
| 41 | + "path": "/home/user/project/src/config.json", |
| 42 | + "oldText": "{\n \"debug\": false\n}", |
| 43 | + "newText": "", |
| 44 | + "deleted": true |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +Note: we would ideally make newText nullable, but that would break existing clients. |
| 49 | + |
| 50 | +## Shiny future |
| 51 | + |
| 52 | +> How will things will play out once this feature exists? |
| 53 | +
|
| 54 | +It is possible for the agent to distinguish between a deleted file and an empty file. |
| 55 | + |
| 56 | +## Implementation details and plan |
| 57 | + |
| 58 | +> Tell me more about your implementation. What is your detailed implementation plan? |
| 59 | +
|
| 60 | +Adding the new field will be a non-breaking change, and clients that update can better distinguish between deleted and empty files. |
| 61 | + |
| 62 | +## Frequently asked questions |
| 63 | + |
| 64 | +> What questions have arisen over the course of authoring this document or during subsequent discussions? |
| 65 | +
|
| 66 | +**Do we need to represent moved files?** |
| 67 | + |
| 68 | +An agent could represent that with a deleted file at the old path and a new file at the new path. |
| 69 | + |
| 70 | +We need to rework the entire diff structure to handle more cases, and binary files, but in the meantime this provides a stop-gap until we can implement a more comprehensive solution. |
| 71 | + |
| 72 | +### What alternative approaches did you consider, and why did you settle on this one? |
| 73 | + |
| 74 | +We considered making newText nullable, but that would break existing clients. |
| 75 | + |
| 76 | +## Revision history |
| 77 | + |
| 78 | +2026-02-20: Initial draft |
0 commit comments