Skip to content

Diff

The Diff tab shows every file in the thread’s project that differs from the last push, and what changed in it. The files are on the left as a tree, and the one you pick is on the right, side by side: the file at the last push on the left, the file now on the right.

When the project is a folder inside a larger repository, only that folder’s files are compared, and the header says in <folder>/. Files elsewhere in the repository are never listed or read. The status bar’s counts cover the same folder, while its commits ahead and behind are the whole repository’s.

On a thread with a tree of its own, the default, those are the tree’s files on the tree’s branch, enso/<thread-id>, not your checkout’s. See Thread trees.

A thread whose tree is a copy of the project, as a project with no commit yet always gets, has no git of its own. There the tab shows the files changed in the thread’s copy since the copy was made, read from the thread’s snapshots, under a header that names the project’s folder. A copy has no branch and no last push, so the header says nothing about either, and files the project’s repository ignores are not listed.

It reads git, not pi’s tool calls. So a change shows up however it was made: an edit, a write, a sed -i or a formatter run through bash, or your own editor. Commits you have not pushed yet count, and so do staged and unstaged edits, deletions, renames and new files.

While the model is writing a write or an edit, a dashed section above the files shows it as being written — not applied yet, with the path, the size so far and the content’s latest stretch. It is the same model output the call’s row in the Chat shows, and no guard has judged it yet. When the call is complete and waiting on the guards, the permission rules or the tool, it still says not applied yet. Once the tool has run, the section goes and the file shows in the diff. If the call is refused or fails, the section says so with the reason, and the content is no longer shown. While a run is in progress and nothing differs yet, the tab says Nothing differs yet: a run is in progress · 7m 12s.

  • Open a thread from the rail, then choose the Diff tab at the top of the thread.
  • It reads again whenever a tool call finishes and when a run ends, so you can leave it open while pi works.

The Diff tab

  1. What the files are compared with. Here, no remote to compare with — only uncommitted changes count, because the demo project has no remote.
  2. The tree of changed files. Each file shows its status letter (A added, M modified, D deleted, R renamed, C copied, T type changed, such as a file that became a symlink, U new and untracked) and the lines added and removed. A folder shows the total for the files under it, and folds away when clicked.
  3. The file on screen, with its status and counts.
  4. The change itself: the removed line on the left, the added line on the right, each with its line number.

pi changed one line of src/config.ts: Bun.env.DATABASE_URL became required('DATABASE_URL'). The tree has that one file, and the diff pairs the old line with the new one, so an edit reads as one row, not a deletion and an addition.

The row above the lines, ⋯ 5 unchanged lines, is git’s summary of what it left out before this part of the file. git sends three lines of context around each change, and the tab counts the rest. Click the count to show those lines, numbered on both sides, and click it again to hide them. The lines after the last change get a count of their own. The code is coloured by its language, in the theme’s own colours.

Hover the comparison line at the top to see that it is what this copy of the repository last saw of the remote. The status bar says the same in short: enso/6d771f16 · 1 unstaged.

  • It never fetches, pushes or changes anything in git. “The last push” is what this copy last saw of the remote; run git fetch yourself to update it. How the baseline is chosen is in Sessions and projects.
  • It shows what differs, not who changed it. An edit you made before the session appears beside pi’s.
  • A binary file, one too large to send to the page, or one git did not produce a diff for is listed without a diff, and says why. Past 500 files the list stops and says so.
  • The unchanged lines are shown from the file’s version at the baseline. When that version is larger than 512 KiB, they stay as counts, marked too large to expand. A file whose lines no longer match its diff, because it changed again after the diff was read, is marked changed since this diff until the tab reads again. Run git diff on the file to see it whole.
  • Only a file inside the project is read whole. A project inside a larger repository never reads a file outside its own folder.
  • Syntax colours cover common languages, such as TypeScript, JavaScript, Python, Go, Rust, shell, JSON, YAML, CSS, HTML and Markdown. A file in any other language is shown uncoloured, and so is a line longer than 1000 characters.
  • Routes: GET /api/threads/:threadId/changes, GET /api/threads/:threadId/changes/file for one file whole, and GET /api/threads/:threadId/git for the state the status bar shows.
  • Sessions and projects: the git readout in the status bar, and what “last push” means.