AI Learning Hub › Learn AI › Self-Paced Courses › Cursor: Plan, Build, Debug, and Review › Read and Review the Code
Module 6 ยท Beginner to intermediate
Read and Review the Code
Undo, Keep or Review arrives after the edit is already on disk. Read the diff line by line, then make one improvement of your own.
By the end
- Read a multi-file diff and say what changed and why
- Use the review controls Cursor offers after an edit
- Improve one line of the agent’s work yourself
- Say what a checkpoint recovers and what a commit records
The agent has written the feature and told you it is done. That message is a claim about the code, and this module is about checking it.
What Cursor offers after an edit
A bar appears above the message box once files have changed.
Undo reverses the change. Keep accepts it. Review opens the comparison. The file count on the left expands to show which files are involved.
These arrive after the edit is on disk, which is why reading the diff is something you go and do rather than a prompt you answer. Four places report the same change at once: the inline diff in the chat, a marker beside the file in the tree, your editor’s source control view, and git status in a terminal.
Exercise: read the whole diff
Open the comparison, through Review or through the source control view. Read every changed line. For the evening filter there should be very few.
Work through it with three questions, hunk by hunk.
What does this line do?
Not roughly. If a line is opaque, that is the line to ask about, and asking is free.
Did I ask for this?
The useful question. A renamed variable, a reordered block, a tidied comment: each may be an improvement, and none of them was the request.
What would I check to know it works?
Answer before running anything. Deciding what success looks like after seeing the result is a weaker test.
For this feature the answer to the third question is concrete: three cards are marked as open in the evening, so turning the filter on should leave three cards showing, and combining it with a category should narrow further.
Say out loud, or write down, what the change does. If you cannot, that is worth knowing before you keep it.
What the diff should contain
In index.html, a labeled checkbox added to the controls area beside the category dropdown. In script.js, a reference to that checkbox, a second condition in the function that decides whether a card is visible, and a listener so that ticking the box re-runs the filter. Possibly a small style rule, and possibly a line in the README.
Anything beyond that — reorganized functions, renamed variables, reformatted blocks, new colors — is work you did not request. It may be fine. It is still yours to approve rather than to inherit.
Exercise: improve one line
Now change something yourself, by hand, in the editor.
Pick one: sharpen the checkbox label if it reads awkwardly, add the word evening to the empty-state message so it explains itself better, or simplify a line in script.js that says in two steps what it could say in one.
Save, reload, and confirm the page still behaves.
This step is small and it is the point of the course. Supervising an agent well means staying someone who edits the code, not only someone who approves it.
Checkpoints, and what they are for
Cursor takes a snapshot of your files before an agent makes significant changes, and the chat timeline lets you restore one. Restoring puts the files back; the conversation stays where it is.
The word gets used two ways, including elsewhere on this hub. In general writing about Git, a checkpoint often means a commit — a saved point you can return to. In Cursor it names a specific feature: an automatic local snapshot taken during an agent session. This module means Cursor's.
Checkpoints are stored locally and sit outside Git. Cursor’s own guidance is to use them for undoing agent changes and to use Git for permanent version control.
| Checkpoint | Commit |
|---|---|
| Taken automatically during an agent session | Made when you decide to make one |
| Restores files to a moment in that session | Records what changed, and why, with a message |
| Local to your machine | Travels with the project to anyone who has it |
| Gets you out of the last ten minutes | Tells you in six months what happened today |
You can watch this happen. Before restoring, run git status and note what it says. Then use the curved-arrow control on an earlier message in the chat. Cursor confirms first — in the version tested for this course the dialog read Discard all changes up to this checkpoint? You can always undo this later.
Afterwards, git rev-parse HEAD returns the same commit it did before, and the project’s history is untouched. What git status reports depends on where you restored to. Restore to a point before anything changed since your last commit and the tree comes back clean. Restore to a point where files were already modified and they stay listed as modified, with different contents inside them.
That second case is worth seeing, because it is the one that surprises people. When this was tested on a project whose files were already modified, the git status output was character-for-character identical before and after the restore, while the contents of all three files had gone back. git status reports which files differ from your last commit, so a file that was already modified stays modified whatever a checkpoint puts inside it.
The checkpoint reached your working files. Git’s record of the project stayed where it was, and the conversation stayed in the chat alongside the restored state.
Then rebuild, or copy in the finished files from fallback/02-feature-complete.
Committing your work is the durable version of keeping it. GitHub Without the Jargon covers staging, commit messages and history properly; for this course, a commit after a change you understand is a good habit and nothing more is needed.
Before the next module
- You have read every line of the feature diff
- You can explain the change without rereading it
- You have made one improvement of your own by hand
- You have seen a checkpoint restore files while Git history stayed put