Skip to main content
When a pull request opens, an agent reviews it the way a teammate would. It reads the pull request and the issue it fixes, looks at the code around the change, checks the tests and CI, and posts a review comment on the pull request with a confidence score, a diagram of the change, and notes on the lines that need one. A review is reads and writes over scattered context, a pull request, its issue, CI and the code around the change, and that is the work Mirage is built for. The agent reaches all of it from one terminal, with fewer tokens than calling the same services as MCP tools (VFS-Bench 1.0). It is also a task with clear boundaries, one repository to read and one pull request to comment on, so a managed terminal suits it best. Here it runs as an in-process terminal on a Mirage server, without a VM or sandbox.

Setup

Files

/repo, a clone of the repository in memory, read-only. /workspace for the review the agent writes.

CLIs

gh calls GitHub with a token the Mirage server holds. git clones the repository.

Policy

A session profile and guard.py let the agent run only review commands. It can comment, never merge.
You need the mirage CLI and a GitHub token, GITHUB_TOKEN, that can read the repository and comment on its pull requests. GitHub says how to create one.
The policy runs on Monty, a small sandboxed Python interpreter:
workspace.yaml mounts /repo and /workspace in memory, installs gh and git, and defines the reviewer profile every agent terminal gets:
workspace.yaml
  • mounts in the profile makes /repo read-only for the agent. The clone below runs in the default session, which has no profile.
  • commands.allow is the whole list of what the agent can run. rm, mv and curl are not on it. Of gh, it has the four commands that read a pull request, its issue and CI, and gh pr comment to post the review. gh pr merge, gh pr edit and gh api are refused.
An allow rule matches the start of a command, so gh pr comment alone would also let the agent pick another repository with -R or delete a comment with --delete-last. guard.py sees the command after the shell has expanded it, and accepts a comment only in one form:
guard.py
Create the workspace, clone ky into /repo at the commit pull request 880 merged as, and open a terminal for the agent under the reviewer profile:
The local server reads GITHUB_TOKEN when it starts, so mirage daemon restart stops a server that started without it. To review your own repository, change the clone’s URL and commit, and the repo of gh in workspace.yaml.

Example

The agent reviews pull request 880 of ky, a small HTTP client on GitHub. The pull request fixes how ky.extend() replaces an AbortSignal. These are the commands the agent runs, in the agent terminal Setup created, which starts in /repo. Your agent sends each one with mirage shell -s agent, or through MCP, the HTTP API, RPC or SSH.
1

Read the pull request and its issue

gh reads GitHub with the token the Mirage server holds.
The pull request is merged and fixes issue #879, which says undefined and null should both reset the signal.
2

Read the code around the change

The repository is a read-only clone at /repo, so sed reads it like any file.
The fix handles undefined, but a null still keeps the parent’s signal.
3

Check the tests and CI

Three new tests, none for null. All 6 checks pass.
4

Write and post the review

The agent writes a score, a diagram of the change and a note on merge.ts:228 to /workspace/review.md, then posts it.
The review is a comment on the pull request, the one write the profile allows.
5

Everything else is refused

The profile and guard.py are checked before each command, and /repo is read-only. Each prints Permission denied or the file system’s error, and the reason:
Each line runs in the agent’s terminal with mirage shell -s agent.
See Session Profiles for the rules a profile takes, and Policy for checks a list cannot express.