Human-in-the-Loop Task Manager for AI Agents
Tested November 30, 2026 | All Tutorials

AI Code Review on Every Pull Request

A pull request opens at 10 am and gets its first review the next afternoon. When the review comes, half of it is things a machine could have caught: a missing test, a value that can go negative, two writes that should be one transaction. The reviewer spends their hour on those, and the author spends a day waiting for them.

This tutorial gives the first pass to an agent. Add the agent-review label to a pull request, and GitHub calls AgentRQ. An agent with its own clone of the repository checks the branch out, runs the tests, reads the diff against your team's checklist and replies in AgentRQ with a card: the findings ranked by severity, with Post review and Skip buttons. Click Post review and it posts one GitHub review with a comment on each line it found something on. When a developer disagrees, tell the agent once: it saves the rule to memory and never raises it again in that repository.

There is no polling and no bot to host: one skill, one event, one hook. The screenshots come from the AgentRQ app on November 30, 2026, fed with pull_request deliveries in GitHub's own format, signed with the webhook secret, the same requests the hook checks in production.

The flow: once, you save a code-review skill, make a reviewer workspace with the checklist in its mission, a review_requested event with a trigger for reviewer, and a github hook that only passes the agent-review label. Every pull request labeled agent-review fires review_requested, and reviewer checks out the branch, runs the tests and replies with a findings card with Post review and Skip. Post review, then Allow Once on gh api, posts the review on GitHub with one comment per finding on its line. Skip posts nothing. When a developer disagrees, you reply in the task, reviewer saves the rule to memory as review-exceptions.md, and every later review loads it first, so the same comment never comes back

What You Build

Piece Setting What it does
code-review skill One SKILL.md in your account, turned on for reviewer The team's review playbook: how to check out, rank, ask and post
reviewer workspace Its own clone of the repository. YOLO mode off The agent that reviews, and asks before it posts anything
review_requested event A trigger that gives reviewer "Review {{EVENT_SUBJECT}}" One task for every pull request that gets the label
github hook registration Branches: main. Labels: agent-review. Route: pr.labeled to review_requested Turns GitHub's webhook into your event, and drops every other label
GitHub webhook Pull requests only, application/json, the shared secret GitHub calls AgentRQ when a label is added
review-exceptions.md memory Written by the agent, read before every review What not to flag in this repository, and why

Four ideas make it work:

  • → A hook brings GitHub in. A hook checks GitHub's signature on every request and turns a labeled pull request into one of your events. The built-in github hook does this with no code, and only for the labels you list.
  • → An event gives the work to a workspace. An event is a name for something that happened, like review_requested. Its trigger creates a task in a workspace each time it fires, with what GitHub sent pasted in.
  • → A skill is the team's review, written once. Distributed skills live in your AgentRQ account, not in one laptop's folder, so every agent you turn the skill on for reviews the same way, and one edit reaches all of them.
  • → Memory makes it learn. Workspace memory keeps what a developer told the agent, so a rule said once holds for every later review.

Before You Start

  • → An AgentRQ account, and a computer where the agent will run. See machines and the connect agents guidelines.
  • → An agent that connects to AgentRQ: Claude Code over MCP, or Codex, Gemini CLI and others through the ACP Gateway.
  • → A separate clone of the repository for the reviewer, ~/code/shop-review here, so gh pr checkout never switches the branch under someone's open editor.
  • → The GitHub CLI on that computer, signed in with gh auth login. Give it a fine-grained token with Pull requests: Read and write and Contents: Read-only on the repository: enough to check out branches and post reviews, not enough to push or merge.
  • → Whatever the tests need to run locally: here, Go for go test ./... in acme/shop.
  • → Admin access to the GitHub repository, to add a webhook and the agent-review label.

Step 1: Save the code-review Skill

Ask your agent to save this as the skill code-review, or paste it into Settings, then Skills. It is the playbook every review follows:

markdown
---
name: code-review
description: How the team reviews a pull request. Check it out, run the tests, rank findings by severity, ask before posting, then post one review with inline comments.
---

# Code review

1. Load memory first. Never raise anything listed in the memory review-exceptions.md.
2. gh pr checkout <number>, then gh pr diff <number>, then run the tests (go test ./...).
3. Read the whole diff before you comment. Comment only on lines the pull request changed.
4. Rank each finding:
   - critical: a wrong result, lost data, a security hole
   - major: a bug in an edge case, new behavior with no test
   - minor: naming, a simpler way, a missing comment
   Skip what a linter or formatter already catches.
5. Reply in the task with a card: the counts by severity, each finding with file:line,
   and two buttons, Post review and Skip. Post nothing before Post review.
6. On Post review, write .agentrq/review-<number>.json:
   {"event": "COMMENT", "body": "<summary>", "comments": [{"path": "...", "line": 0, "side": "RIGHT", "body": "..."}]}
   and run gh api repos/<owner>/<repo>/pulls/<number>/reviews --input .agentrq/review-<number>.json.
   Always COMMENT: approving and requesting changes is for people.
7. Reply with the review's link, then complete the task.
8. When a developer disagrees and is right, save the rule to the memory review-exceptions.md:
   the repository, what not to flag, why, and who said so.

1. One skill, the team's review playbook. 2. On for agents: agents find it with searchSkills and load it when a task needs it. 3. Turned on for reviewer, and for any other workspace you tick. 4. The steps every review follows.

Step 1: the code-review skill's page in the reviewer workspace's settings, with its name, the Available to agents switch on, reviewer ticked under Workspaces, and the start of SKILL.md, with arrows at each

The skill belongs to your account, not to the workspace. Turn it on for a second reviewer workspace, for another repository, and both review the same way. To give it to your whole team, share it from a team: see use a teammate's skills.

Step 2: Make the reviewer Workspace

Create a workspace named reviewer. Its mission is the checklist, in the order the agent should apply it:

text
You review pull requests in acme/shop when someone labels them agent-review.
Check, in this order:
1. Correctness: wrong results, missed edge cases, error and nil handling.
2. Security: secrets, injection, missing authorization checks.
3. Money and data: amounts in integer cents, writes that must happen together.
4. Tests: new behavior has a test, and go test ./... passes on the branch.
5. Readability, only where it hides a bug.
Rank every finding critical, major or minor. Never approve, merge or push.

In its settings, set the Working Directory to the reviewer's clone, ~/code/shop-review, and start its agent. Leave YOLO mode off.

With YOLO off the agent asks before every command. For Claude Code, the clone's .claude/settings.json can allow the commands that only read and keep asking for the one that posts:

json
{
  "permissions": {
    "allow": ["Bash(gh pr checkout:*)", "Bash(gh pr diff:*)", "Bash(gh pr view:*)", "Bash(go test:*)", "Edit(.agentrq/**)"],
    "ask": ["Bash(gh api:*)"]
  }
}

Add .agentrq/ to the clone's .git/info/exclude, so the review files never end up in a commit.

Step 3: Create the review_requested Event and Its Trigger

Open Events, click + New Event, and name it review_requested. In its payload guidelines, say what it carries: "Sent by the github hook when a pull request to main in acme/shop gets the agent-review label: the number, title, author, branches and link."

On the event's page, click + Add Trigger. 1. reviewer gets the task. 2. Its title is "Review {{EVENT_SUBJECT}}". The github hook fills {{EVENT_SUBJECT}} with "GH P#" and the number and title, so each task is named after its pull request. 3. Its instructions start with {{EVENT_PAYLOAD}} and {{EVENT_FAQ}}, which bring in what GitHub sent. 4. The steps load the skill and post nothing until you click. 5. YOLO mode is off, so the post waits for you too. Save the trigger.

Step 3: the review_requested event's Edit trigger form, with reviewer as the workspace,

The instructions this run used:

text
Review this pull request in acme/shop.

{{EVENT_PAYLOAD}}

{{EVENT_FAQ}}

Load the code-review skill and follow it.
1. Check the branch out and run go test ./...
2. Reply with the findings card. Post nothing until I click Post review.
3. Post review: post one review with inline comments, reply with its link and complete this task.
4. Skip: complete this task without posting.

Step 4: Register the github Hook

Open Events, then Hooks, and click New registration. Name it, for example "acme/shop agent reviews", and pick the built-in github hook.

1. A webhook secret: click Generate, then Copy, because GitHub needs the same value. 2. Pull requests into main: for pull requests, Branches matches the base branch, the one the pull request merges into. 3. Only this repository: acme/shop. 4. Only the agent-review label. A pull request labeled anything else fires nothing.

Step 4: the New registration form's settings for the github hook, with a generated webhook secret, main under Branches, acme/shop under Repositories and agent-review under Labels for pr.labeled, with arrows at each

Under Routes, 1. route pr.labeled to review_requested. 2. Leave pr.review_requested Not routed. It fires whenever anyone's review is requested, from any reviewer, because the hook has no reviewer filter: routed, it would give the agent a task each time someone asks a colleague for a review. Leave every other GitHub event Not routed too, then click Create Registration.

Step 4, continued: the Routes column, with pr.labeled going to review_requested and pr.review_requested left Not routed, with arrows at both

1. Copy the payload URL, which ends in ?agentrq_hook_token=. It is shown only this once. If you lose it, Rotate Token makes a new one, and the old URL stops working. 2. The one route is listed on the registration.

Step 4, the registration: its payload URL with Copy URL and Rotate Token and the warning that the token is shown only once, and the route pr.labeled to review_requested, with arrows at the URL and the route

Step 5: Add the Webhook and the Label in GitHub

In GitHub, open the repository's Settings, then Webhooks, then Add webhook:

  1. Payload URL: the URL you copied, token included.
  2. Content type: application/json. GitHub's default, application/x-www-form-urlencoded, is rejected.
  3. Secret: the webhook secret from the registration. It is not the hook token.
  4. Which events: Let me select individual events, untick Pushes, and tick Pull requests. Adding a label is one of its actions.
  5. Add webhook.

Then open Issues, Labels, and create the label agent-review. Label names are matched without regard to case, so Agent-Review works too.

Step 6: Label a Pull Request

Priya opened #245, "checkout: pay part of an order with a gift card", and added the agent-review label. GitHub sent a pull_request delivery. The github hook checked the signature, saw a label on a pull request into main, matched agent-review and fired pr.labeled, which the registration routes to review_requested. The trigger did the rest.

1. One task per labeled pull request, named after it. 2. What GitHub sent: the number, the author, the label, the title, the branches and the link. 3. A short FAQ with the repository, the pull request's link and the label.

Step 6: the reviewer workspace with the task

The payload looks like this, the same lines in every review_requested task:

text
Pull request #245 by priya-n labeled `agent-review` in acme/shop: checkout: pay part of an order with a gift card
`feat/gift-card-checkout` → `main`
https://github.com/acme/shop/pull/245

Step 7: The Agent Replies with a Findings Card

The agent picked the task up, loaded the skill and its memory, ran gh pr checkout 245 and go test ./..., and read the diff. Its reply is a card, not a wall of text. 1. Findings by severity, counted at the top, with the test run under them. 2. Each finding with its file, its line and why: here, the gift card's balance check and its debit run outside a transaction, so two checkouts at once can spend the same $50. 3. Post review or Skip, two buttons that answer the agent.

Step 7: the task's conversation with the findings card

The card is an agent card the agent sends with its reply, and the same findings are in the reply's text, so a push notification or an email says everything the card does. Nothing has touched GitHub yet. If the findings are wrong or not worth a comment, Skip completes the task and nothing is posted.

Step 8: You Approve the Post

Clicking Post review answers the agent in the task. It wrote the review file, one COMMENT review with a comment for each finding, and asked to run gh api with it. 1. The exact command that posts the review. 2. Allow Once posts it. The card also reaches your phone through notifications.

Step 8: an Authorization Required card for Bash with the command gh api repos/acme/shop/pulls/245/reviews --input .agentrq/review-245.json, and the buttons Allow Once, Always Allow and Deny, with arrows at the command, Allow Once and Always Allow

3. Always Allow is wider than this one command. It saves a rule on the command's first word, gh, so from then on the agent runs every gh command in this workspace without asking, gh pr merge included. Step 12 shows the rule and how to take it back.

1. Your click on Post review, as your reply. 2. The review, on GitHub, with where each inline comment went and the suggested fix. 3. Completed after posting.

Step 8, continued: the task's conversation with your

The agent only ever posts a COMMENT review. Approving and requesting changes stay with the people who own the code, and the token from Before You Start could not merge even if the agent tried.

Step 9: Teach It What Not to Flag

Priya disagreed with the minor finding: in acme/shop, each package's tests share one Postgres database, so t.Parallel() makes them flaky. Reply in the task, even though it is completed. A reply reopens the task and reaches the agent.

1. A developer disagrees, in your words. 2. Saved to memory: the agent wrote the rule to review-exceptions.md, replied on the inline comment on GitHub and completed the task again.

Step 9: the task's conversation with your reply that t.Parallel() makes acme/shop's tests flaky and should not be flagged, and the agent's reply that it saved this to memory as review-exceptions.md, with arrows at both

Open Settings, Memories, to see what it wrote. 1. One memory for review exceptions, listed in the workspace's MEMORY.md index. 2. The rule, why, and who said it, under the repository it applies to.

Step 9, continued: the reviewer workspace's Memories tab with review-exceptions.md open:

Step 10: The Next Review Remembers

Lee labeled #248, "shipping: free shipping over $50 for members". Its new tests don't call t.Parallel() either. 1. One finding this time, a real one: the cart and checkout compare the $50 threshold against different subtotals. 2. The memory, applied: the agent says what it left out and which memory said so. 3. Post review, clicked, and the card keeps the choice.

Step 10: the findings card

Each disagreement makes every later review a little quieter. Read review-exceptions.md now and then: a rule that no longer holds is one line to delete.

Step 11: Check Every Delivery

The registration lists what GitHub sent and what became of it. 1. #245 labeled agent-review: a task. 2. GitHub's Redeliver: no second task. The same delivery sent again is marked Duplicate and fires nothing. 3. Wrong secret: rejected, with the reason. 4. #248: a task. 5. The one route. The needs-design label Sam added to #245 has no row at all: a request that fires nothing is accepted and not kept.

Step 11: the registration's page with the route pr.labeled to review_requested and its Deliveries, newest first: Published pr.labeled, Rejected

Step 12: If You Clicked Always Allow

On #248 the post was approved with Always Allow. Open the workspace's Settings, then Automations. 1. The saved rule is gh followed by a wildcard, so it covers every gh command, not just the review. 2. Delete it with the trash icon and click Update Workspace to be asked again.

Step 12: the reviewer workspace's Automations tab with one rule in the Auto-Allow List, Bash gh *, and YOLO mode off, with arrows at the rule and its delete icon

If you want the post to run without a second click, keep the rule but rely on the token: with Contents: Read-only the agent's gh cannot push or merge, whatever the rule allows. The Post review button stays your approval either way.

Traps to Avoid

  • → pr.review_requested has no reviewer filter. It fires for every review request on every pull request into main, whoever is asked. Routed, it gives the agent a task each time someone asks a colleague. Use the label, or see Make It Yours.
  • → Labels and Authors only filter pr.labeled. They do nothing for pr.opened or pr.review_requested, which fire for any label and any author.
  • → Branches means the base branch. For pull requests the hook matches where the pull request merges into, not its own branch. A pull request into release/1.4 is dropped while Branches is main.
  • → Pull requests is not ticked. GitHub sends no pull_request event and nothing happens when you add the label. Pushes, GitHub's default, fire nothing here, because only pr.labeled is routed.
  • → The content type is still form-encoded. Every request is Rejected with "the body is not JSON". Change it to application/json in GitHub's webhook settings.
  • → Always Allow covers every gh command. One click saves a rule for gh and anything after it, so the agent runs every gh command in the workspace without asking, from gh pr merge to gh repo delete if the token can. Use Allow Once, or a token that cannot do harm.
  • → A label added twice is two reviews. Removing agent-review and adding it again sends a new delivery, so the agent reviews again. That is how to ask for a second pass after new commits.
  • → Memory names end in .md. A memory is saved as lowercase words joined by hyphens, like review-exceptions.md. A name without .md is refused, and the agent has to save it again.
  • → The reviewer shares nothing with your editor. Point it at its own clone. gh pr checkout in your working copy switches your branch while you work.

Make It Yours

  • → Review on request, not on label. Make a GitHub account for the agent, such as acme-reviewbot, route pr.review_requested to review_requested too, and add to the instructions: "If the payload does not say review requested from acme-reviewbot, complete this task with one line." The others still make a short task each.
  • → Review every pull request. Route pr.opened to review_requested and leave Labels empty. Better for a small team than for a busy repository.
  • → Only some authors. Put logins under Authors for pr.labeled, such as new team members, so only their labeled pull requests are reviewed.
  • → More than one repository. Turn the code-review skill on for a second reviewer workspace in the other repository's clone. The skill is shared, each workspace keeps its own memory, and one skill edit updates both.
  • → Hand it the fix. Add a third button, Fix it, that tells the agent to push a commit to the branch. Give that workspace a token that can push, and keep its YOLO mode off.

FAQ

Can the agent approve or merge? Not with the setup here. The skill says COMMENT only, every gh api call waits for Allow Once, and the token has Contents: Read-only, which GitHub requires to be read and write for a merge.

Does it post anything before I click? No. The trigger and the skill both say to post nothing until Post review, and with YOLO off the post itself waits for your approval.

What if the review is wrong? Click Skip, or reply in the task with what is wrong. If it already posted, reply anyway: it can answer on GitHub, and if you tell it the finding does not apply here, it saves that to memory.

Can the whole team use the same review rules? Yes. The skill is stored in your account and turned on per workspace, and a team can share it with every member's workspaces. See use a teammate's skills.

How long does a review take? As long as the checkout, the tests and the reading take on your machine: minutes for a pull request like #245. The task timeline shows each step.

Which agents can run reviewer? Any that connects to AgentRQ: Claude Code, or Codex, Gemini CLI and others through the ACP Gateway.

Start Free