> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open4rena.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Git and code review

> Review the changes o4 made, commit them, and ask for a code review.

o4 works in your files directly, so you should look over what it changed before you keep it. This page covers the diff view, the `/commit` slash command, code reviews and pull requests, and the session debrief.

## Review changes with /diff

`/diff` opens the **Session Diff** view, which shows how the files in your working directory changed during the latest turn:

```text theme={null}
/diff
```

You can also press `Ctrl+D` (from the prompt or from Navigation Mode) or `Alt+D`. You can rebind `Alt+D` with the `toggle_diff_pane` action; see [Keyboard shortcuts](/reference/keyboard-shortcuts). After the first turn of a session that changes files, o4 shows a hint with a summary, for example `Changes this turn: 2 files changed (+42/−7). Press Ctrl+D to review.` It shows the hint once per session. When a turn changes files and your prompt asked for a review, o4 also offers a **View Diff** action chip under the reply.

In the diff view:

| Key | Action |
| - | - |
| `Up` / `Down`, or `j` / `k` | Scroll. |
| `s` | Switch between split (side-by-side) and unified diffs. Split view needs a window at least 120 columns wide; in a narrower window the view stays unified. |
| `Esc` or `q` | Close the view. |

Each file starts with a heading that shows its path and the lines added and removed. A new or deleted file is marked as such. The bottom border shows the keys, the total lines added and removed, and the current layout, for example `+42/-7 lines  [split]`. When nothing changed, the view says `No file changes in this session.`

What the diff compares against:

* o4 takes a snapshot of your files each time it sends a prompt to the model. `/diff` compares the files now with the snapshot from your latest prompt, so it shows what changed during that turn, whoever changed it: the agent, you, or another program.
* Closing the view marks those changes as reviewed. If you open it again before your next prompt, it only shows changes made after you closed it. Closing a turn diff from the Time Machine does the same.
* It isn't a git diff. It works outside git repositories, and it doesn't show changes from earlier turns. To see everything that changed, use `git diff`, or ask the model to summarize its changes.

The view covers text files with common source extensions (such as `.rs`, `.ts`, `.py`, `.go`, `.md`, `.json`, `.yaml` and `.toml`) up to 500 KB each, and up to 500 files. It skips folders such as `.git`, `node_modules`, `target`, `dist`, `build` and `.venv`. For anything else, use git.

<Tip>
  To see what an earlier turn changed, open the Time Machine with `/rewind`, select the turn, and press `d`. See [Undo and rewind](/guides/checkpoints).
</Tip>

## Commit with /commit

`/commit` commits all your changes with a message that o4 builds from `git status`. It doesn't call the model:

```text theme={null}
/commit
```

o4 shows the message and asks `Commit with this message?`. The message starts with `chore:` and the last line of `git diff --stat HEAD`, then lists the changed files from `git status --porcelain` with a status letter: `M` modified, `A` added, `D` deleted, `R` renamed, `?` untracked, and `~` for anything else. If `git diff --stat HEAD` prints nothing, for example when only untracked files changed, the summary is `update N files` instead.

```text theme={null}
chore: 3 files changed, 42 insertions(+), 7 deletions(-)

Files changed:
  M src/auth/session.rs
  M src/auth/mod.rs
  ? tests/session_test.rs
```

Press `Y` or `Enter` to commit, or `N` or `Esc` to cancel (`Commit cancelled.`). If you confirm, o4 runs `git add -A` and then `git commit -m` with that message, and shows git's output under **Git Commit**. If either step fails, it shows the error from git, for example `git commit failed: ...`. You can't edit the message in the dialog.

<Warning>
  `/commit` stages everything: every modified, deleted and untracked file in the repository that isn't ignored by `.gitignore`, including changes that have nothing to do with the task. That includes the `.o4/` folder o4 creates in your project, unless your `.gitignore` lists it. Check `git status` first, or commit by hand if you want to choose what goes in. The message always starts with `chore:` and doesn't describe what the change does.
</Warning>

`/commit` reports `Not a git repository.` outside a repository, `git not found in PATH.` when git isn't installed, and `No changes to commit.` when the working tree is clean. It doesn't push and doesn't open a pull request.

For a better message, or to commit only part of your changes, ask the model instead:

```text theme={null}
Commit the changes to src/auth with a message that explains the fix. Leave the other files alone.
```

o4 includes a built-in `commit` skill for this, which tells the model to check the diff, stage files by name, match your repository's commit style, and add a `Co-Authored-By: o4 <noreply@open4rena.com>` trailer. It also tells the model not to push unless you ask. The model can load it when you ask for a commit. It runs `git` through its shell tool, so the command follows your [permission mode](/safety/permissions).

## Open a pull request

o4 has no slash command for pull requests. `/commit-push-pr` only runs `/commit`; see [Slash commands](/reference/slash-commands#other-names-for-listed-commands). Ask the model instead:

```text theme={null}
Open a pull request for this branch against main.
```

The built-in `pull-request` skill guides the model: it reviews every commit and the full diff since the branch left the base branch, stops if requested changes are still uncommitted, writes a title under 70 characters and a body with a summary and a test plan, pushes the branch if needed, and creates the pull request with the GitHub CLI (`gh pr create`). It returns the pull request URL. You need `gh` installed and logged in.

## Get a code review

o4 has no built-in `/review` command. If you or a plugin add a skill named `review`, `/review` runs it; see [Skills](/extend/skills). Otherwise, ask for a review in a prompt and say what to review:

```text theme={null}
Review the uncommitted changes. Look for bugs, missing error handling, and anything that doesn't match the rest of the codebase. Don't change any files.
```

```text theme={null}
Review the changes on this branch compared with main. List the problems by severity, with file and line.
```

The model reads your git state with its read-only `git_info` tool, which runs `git status`, `git diff` and `git log`, and reads the surrounding code with its other tools.

For a security review, ask for one in a prompt: o4 includes a built-in `security-review` skill that focuses on authorization, injection, secrets, dependencies and trust boundaries, and the model can load it. The `/security-review` slash command doesn't run it; in 0.2.74 it only prints a note. See [Skills](/extend/skills) for how skills work and how to add your own review checklist.

<Tip>
  Saying "don't change any files" is usually enough. To enforce it, use the `plan` permission mode (switch modes with `Alt+A`), which denies every tool call that would need approval, including edits and shell commands. The model can still read files and use `git_info`. See [Permissions](/safety/permissions).
</Tip>

For a review in CI, run the same prompt in [print mode](/guides/print-mode) with `--permission-mode plan`.

## Summarize the session with /debrief

`/debrief` builds a report of the session so far and opens it in the **Session Debrief** pane. It runs right away, even while the model is working:

```text theme={null}
/debrief
```

The report is Markdown with six sections:

| Section | What it lists | Where it comes from |
| - | - | - |
| Files changed | Each changed file with the lines added and removed, marked `new file` or `deleted file` where that applies. | The same snapshot as `/diff`: changes since your latest prompt, or since you last closed the diff view. |
| Commands run | Each shell command the model ran with its `bash` tool, and each `test_run` call with its options, in order. | The model's tool calls in the current conversation. |
| Verified | Subagent tasks that o4 was set to check itself: the `agent` call's contract had a `verify` command, or named more than one file in `touch_only` and had a `done_when` check. | The model's `agent` tool calls. |
| Assumed | Subagent tasks with a contract but no check of their own, including ones with `verify` set to `false`. | The model's `agent` tool calls. |
| Open threads | Unresolved questions and unfinished work. | A request to the model. |
| Decisions | Explicit decisions made during the session. | A request to the model. |

A section with nothing in it shows `None`. **Verified** only means that o4 set up a check for the task; the debrief doesn't record whether the check passed. Subagent calls without a contract aren't listed. See the `agent` tool in the [tools reference](/reference/tools#agents-and-teams) for contracts.

```markdown theme={null}
# Session Debrief

## Files changed
- `src/auth/session.rs` (+12/-3)
- `tests/session_test.rs` (+40/-0) — new file

## Commands run
- `bash`: `cargo test -p auth`

## Verified
- None

## Assumed
- None

## Open threads
- The token refresh path still has no test

## Decisions
- Keep the session cookie name unchanged
```

For the open threads and decisions, o4 sends the conversation (up to about 1 MB of it) to the current model and asks it to list only unresolved threads and explicit decisions, as JSON. So each `/debrief` makes one model request. If the request fails or the reply isn't valid JSON, both sections show `None`.

<Note>
  In 0.2.74 the **Session Debrief** pane has a single row, **Current session**, and shows the report in its preview area. The preview only has room for the first three lines (the title and the `## Files changed` heading), and `Enter` doesn't open the rest. To read the whole report, open the copy o4 saves when the session ends.
</Note>

### Saved debriefs

When you quit, or switch to another session with `/resume` or the session picker, o4 builds the debrief again and saves it to `.o4/debriefs/<session-id>.md` in the directory you started o4 in. At that point it waits at most 3 seconds for the model's open threads and decisions; if the model takes longer, those sections are saved as `None`. o4 keeps the 20 most recent debriefs for each directory and deletes older ones.

The open threads from that debrief are also added to [Workspace Radar](/guides/code-intelligence#workspace-radar) as `Open thread: ...` items.

The next time you start o4 in the same directory, the chat opens with the counts from the last saved debrief:

```text theme={null}
Previous session
2 file(s) changed; 1 command(s) run.
0 verified; 0 assumed.
1 open thread(s); 1 decision(s).
```

## Other git commands

Other git commands don't have slash commands: `/branch`, `/issue`, `/pr-comments` and `/autofix-pr` only print a note in 0.2.74. Run git yourself with a `!` prefix, for example `!git log --oneline -5`, or ask the model to run it. See [Writing prompts](/guides/prompting). To work on a branch without touching your checkout, the model can create a git worktree with its `enter_worktree` tool; see [Tools](/reference/tools#worktrees).

## Related pages

* [Undo and rewind](/guides/checkpoints): undo o4's edits, or rewind the files to an earlier turn.
* [Permissions](/safety/permissions): control which commands the model can run without asking.
* [Skills](/extend/skills): the built-in skills and how to write your own.
