Setup
Files
/repo, a clone of the repository in memory, read-only. /workspace for the review the agent writes.Policy
A session profile and
guard.py let the agent run only review commands. It can comment, never merge.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.
Installation
Installation
The policy runs on Monty, a small sandboxed
Python interpreter:
- pip
- npm
workspace.yaml
workspace.yaml
workspace.yaml mounts /repo and /workspace in memory, installs gh and
git, and defines the reviewer profile every agent terminal gets:workspace.yaml
mountsin the profile makes/reporead-only for the agent. The clone below runs in the default session, which has no profile.commands.allowis the whole list of what the agent can run.rm,mvandcurlare not on it. Ofgh, it has the four commands that read a pull request, its issue and CI, andgh pr commentto post the review.gh pr merge,gh pr editandgh apiare refused.
guard.py
guard.py
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
/repo at the commit pull request 880
merged as, and open a terminal for the agent under the reviewer profile:
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 howky.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.undefined and null should both reset the signal.2
Read the code around the change
The repository is a read-only clone at The fix handles
/repo, so sed reads it like any file.undefined, but a null still keeps the parent’s signal.3
Check the tests and CI
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 The review is a comment on the pull request, the one write the profile allows.
merge.ts:228 to /workspace/review.md, then posts it.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:Full commands
Full commands
Each line runs in the agent’s terminal with
mirage shell -s agent.