arinhub-code-reviewer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Reviewer

代码审查工具

Orchestrate a comprehensive code review by running multiple review strategies in parallel, merging and deduplicating findings into a review file. Supports both remote PRs and local uncommitted changes.
通过并行运行多种审查策略来统筹全面的代码审查,将审查结果合并并去重后写入审查文件。支持远程PR和本地未提交的变更。

Input

输入

  • PR number or URL (optional): Accepts
    123
    ,
    #123
    , or full URL. If omitted, reviews local changes.
  • PR编号或URL(可选):支持
    123
    #123
    或完整URL。如果省略,则审查本地变更。

Procedure

流程

1. Determine Review Target

1. 确定审查目标

  • Remote PR: If the user provides a PR number or URL (e.g., "Review PR #123"), target that remote PR. Set
    MODE=remote
    .
  • Local Changes: If no specific PR is mentioned, or if the user asks to "review my changes", target the current local file system changes (staged and unstaged). Set
    MODE=local
    .
  • 远程PR:如果用户提供了PR编号或URL(例如“Review PR #123”),则以该远程PR为审查目标。设置
    MODE=remote
  • 本地变更:如果未指定具体PR,或者用户要求“review my changes”,则以当前本地文件系统的变更(已暂存和未暂存)为审查目标。设置
    MODE=local

2. Resolve Identifier and Repository

2. 解析标识与仓库

If
MODE=remote
:
Extract the PR number. Determine the repository name from git remote or the provided URL.
PR_NUMBER=<extracted number>
REPO_NAME=<repository name, e.g. "my-app">
REVIEW_FILE=~/.agents/arinhub/code-reviews/pr-code-review-${REPO_NAME}-${PR_NUMBER}.md
If
MODE=local
:
Determine the repository name from git remote. Use the current branch name for identification, sanitizing slashes to dashes so file paths remain valid.
REPO_NAME=<repository name>
BRANCH_NAME=$(git branch --show-current | tr '/' '-')
REVIEW_FILE=~/.agents/arinhub/code-reviews/local-code-review-${REPO_NAME}-${BRANCH_NAME}.md
Create
~/.agents/arinhub/code-reviews/
and
~/.agents/arinhub/diffs/
directories if they do not exist.
MODE=remote
提取PR编号。从git远程仓库或提供的URL中确定仓库名称。
PR_NUMBER=<提取的编号>
REPO_NAME=<仓库名称,例如"my-app">
REVIEW_FILE=~/.agents/arinhub/code-reviews/pr-code-review-${REPO_NAME}-${PR_NUMBER}.md
MODE=local
从git远程仓库确定仓库名称。使用当前分支名称作为标识,将斜杠替换为短横线以确保文件路径有效。
REPO_NAME=<仓库名称>
BRANCH_NAME=$(git branch --show-current | tr '/' '-')
REVIEW_FILE=~/.agents/arinhub/code-reviews/local-code-review-${REPO_NAME}-${BRANCH_NAME}.md
如果
~/.agents/arinhub/code-reviews/
~/.agents/arinhub/diffs/
目录不存在,则创建它们。

3. Initialize Review File

3. 初始化审查文件

If
MODE=remote
:
Create the review file with a header:
markdown
undefined
MODE=remote
创建带有头部信息的审查文件:
markdown
undefined

PR Review: ${REPO_NAME} #${PR_NUMBER}

PR审查:${REPO_NAME} #${PR_NUMBER}

Date: <current date> PR: <PR URL>
日期: <当前日期> PR: <PR URL>

Issues

问题

<!-- Issues from parallel review agents merged below. No duplicates. -->

**If `MODE=local`:**

Create the review file with a header:

```markdown
<!-- 以下是并行审查Agent合并后的问题,无重复项。 -->

**若`MODE=local`:**

创建带有头部信息的审查文件:

```markdown

Local Review: ${REPO_NAME} (${BRANCH_NAME})

本地审查:${REPO_NAME} (${BRANCH_NAME})

Date: <current date> Branch: ${BRANCH_NAME}
日期: <当前日期> 分支: ${BRANCH_NAME}

Issues

问题

<!-- Issues from parallel review agents merged below. No duplicates. -->
undefined
<!-- 以下是并行审查Agent合并后的问题,无重复项。 -->
undefined

4. Prepare Diff and Working Tree

4. 准备Diff与工作区

Save the diff to a shared file so subagents can read it. In remote mode, also check out the PR branch so tools that require a working tree (e.g.,
react-doctor
) operate on the correct code.
If
MODE=remote
:
bash
DIFF_FILE=~/.agents/arinhub/diffs/pr-diff-${REPO_NAME}-${PR_NUMBER}.diff
将Diff保存到共享文件中,以便子Agent读取。在远程模式下,还需检出PR分支,确保需要工作区的工具(如
react-doctor
)能基于正确的代码运行。
MODE=remote
bash
DIFF_FILE=~/.agents/arinhub/diffs/pr-diff-${REPO_NAME}-${PR_NUMBER}.diff

Save the current branch so we can return to it after the review.

保存当前分支,以便审查完成后返回。

ORIGINAL_BRANCH=$(git branch --show-current)
ORIGINAL_BRANCH=$(git branch --show-current)

Stash any uncommitted local changes to prevent data loss during checkout.

暂存所有未提交的本地变更,防止检出PR时数据丢失。

git stash --include-untracked -m "arinhub-code-reviewer: auto-stash before PR checkout"
gh pr diff ${PR_NUMBER} > ${DIFF_FILE}
git stash --include-untracked -m "arinhub-code-reviewer: auto-stash before PR checkout"
gh pr diff ${PR_NUMBER} > ${DIFF_FILE}

Check out the PR branch to ensure the working tree reflects the PR code for subagents that require it (e.g., react-doctor).

检出PR分支,确保工作区与PR代码一致,供需要工作区的子Agent(如react-doctor)使用。

gh pr checkout ${PR_NUMBER}

**If `MODE=local`:**

```bash
DIFF_FILE=~/.agents/arinhub/diffs/local-diff-${REPO_NAME}-${BRANCH_NAME}.diff
git diff HEAD > "${DIFF_FILE}"
No checkout is needed in local mode — the working tree already contains the changes.
gh pr checkout ${PR_NUMBER}

**若`MODE=local`:**

```bash
DIFF_FILE=~/.agents/arinhub/diffs/local-diff-${REPO_NAME}-${BRANCH_NAME}.diff
git diff HEAD > "${DIFF_FILE}"
本地模式无需检出分支——工作区已包含变更内容。

5. Detect React Code

5. 检测React代码

Spawn a subagent to analyze
${DIFF_FILE}
and determine whether the changes contain React code. The subagent must read the diff file and return
HAS_REACT=true
or
HAS_REACT=false
.
Set
HAS_REACT=true
if any of these conditions are found in the diff:
  • File extensions: Changed files include
    .tsx
    ,
    .jsx
    , or paths under common React directories (e.g.,
    components/
    ,
    hooks/
    ,
    pages/
    )
  • React core imports:
    import ... from 'react'
    ,
    import ... from "react"
    ,
    require('react')
    ,
    require("react")
  • React DOM:
    import ... from 'react-dom'
    ,
    import ... from 'react-dom/client'
  • JSX syntax: Diff hunks contain JSX elements (
    <Component
    ,
    <div
    ,
    />
    ,
    React.createElement
    )
  • React hooks: Usage of
    useState
    ,
    useEffect
    ,
    useRef
    ,
    useMemo
    ,
    useCallback
    ,
    useContext
    ,
    useReducer
    ,
    useLayoutEffect
    , or custom
    use*
    hooks
  • React ecosystem packages: Imports from
    react-router
    ,
    react-hook-form
    ,
    @tanstack/react-query
    ,
    @tanstack/react-table
    ,
    react-redux
    ,
    zustand
    ,
    jotai
    ,
    recoil
    ,
    next
    ,
    @next/
    ,
    styled-components
    ,
    @emotion/
    , or similar React-centric libraries
Otherwise set
HAS_REACT=false
.
启动一个子Agent来分析
${DIFF_FILE}
,判断变更中是否包含React代码。该子Agent必须读取Diff文件并返回
HAS_REACT=true
HAS_REACT=false
如果Diff中存在以下任一条件,则设置
HAS_REACT=true
  • 文件扩展名:变更文件包含
    .tsx
    .jsx
    ,或位于常见React目录下(例如
    components/
    hooks/
    pages/
  • React核心导入
    import ... from 'react'
    import ... from "react"
    require('react')
    require("react")
  • React DOM
    import ... from 'react-dom'
    import ... from 'react-dom/client'
  • JSX语法:Diff块中包含JSX元素(
    <Component
    <div
    />
    React.createElement
  • React Hooks:使用了
    useState
    useEffect
    useRef
    useMemo
    useCallback
    useContext
    useReducer
    useLayoutEffect
    或自定义
    use*
    hooks
  • React生态包:导入了
    react-router
    react-hook-form
    @tanstack/react-query
    @tanstack/react-table
    react-redux
    zustand
    jotai
    recoil
    next
    @next/
    styled-components
    @emotion/
    或类似的React相关库
否则设置
HAS_REACT=false

6. Launch Parallel Review Subagents

6. 启动并行审查子Agent

Spawn subagents in parallel (do not wait for one to finish before starting the next). Subagents A, B, and C must return ONLY a structured list of issues using the format from the Issue Format Reference section below. Subagent D (if launched) must return both a structured list of issues and the full
react-doctor
diagnostic report (the report is appended separately in Step 9). No subagent may submit a review — they only return findings.
Pass the diff file path (
${DIFF_FILE}
) to each subagent so they can read the diff directly. Inform each subagent that the working tree is already on the correct branch (PR branch in remote mode, current branch in local mode). No subagent should run
gh pr checkout
or switch branches.
  • If
    HAS_REACT=true
    : spawn four subagents (A, B, C, D).
  • If
    HAS_REACT=false
    : spawn three subagents (A, B, C) — skip Subagent D.
并行启动子Agent(无需等待前一个完成再启动下一个)。子Agent A、B、C必须仅返回结构化的问题列表,格式参考下方的“问题格式参考”部分。子Agent D(若启动)必须同时返回结构化的问题列表完整的
react-doctor
诊断报告(报告将在步骤9中单独追加)。所有子Agent不得提交审查——仅返回审查结果。
将Diff文件路径(
${DIFF_FILE}
)传递给每个子Agent,以便它们直接读取Diff。告知每个子Agent工作区已处于正确分支(远程模式下为PR分支,本地模式下为当前分支)。禁止任何子Agent运行
gh pr checkout
或切换分支。
  • HAS_REACT=true
    :启动四个子Agent(A、B、C、D)。
  • HAS_REACT=false
    :启动三个子Agent(A、B、C)——跳过子Agent D。

Subagent A: code-reviewer

子Agent A: code-reviewer

If
MODE=remote
:
Spawn a subagent to review PR
${PR_NUMBER}
using the
code-reviewer
skill. Pass
${DIFF_FILE}
for diff context. If
MODE=local
:
Spawn a subagent to review local changes using the
code-reviewer
skill. Pass
${DIFF_FILE}
for diff context.
Instruct it to return only the list of issues found — no review submission.
MODE=remote
启动一个子Agent,使用
code-reviewer
skill审查PR
${PR_NUMBER}
。传递
${DIFF_FILE}
作为Diff上下文。
MODE=local
启动一个子Agent,使用
code-reviewer
skill审查本地变更。传递
${DIFF_FILE}
作为Diff上下文。
要求它仅返回发现的问题列表——不得提交审查。

Subagent B: octocode-roast

子Agent B: octocode-roast

Spawn a subagent to invoke the
octocode-roast
skill. Pass
${DIFF_FILE}
so it can read the diff directly.
If
MODE=remote
:
Instruct it to review the diff in
${DIFF_FILE}
for PR
${PR_NUMBER}
. If
MODE=local
:
Instruct it to review the diff in
${DIFF_FILE}
for local changes.
Instruct it to return only the list of issues found — no review submission.
启动一个子Agent调用
octocode-roast
skill。传递
${DIFF_FILE}
以便它直接读取Diff。
MODE=remote
要求它审查
${DIFF_FILE}
中PR
${PR_NUMBER}
的Diff。
MODE=local
要求它审查
${DIFF_FILE}
中的本地变更Diff。
要求它仅返回发现的问题列表——不得提交审查。

Subagent C: pr-review-toolkit

子Agent C: pr-review-toolkit

If
MODE=remote
:
Spawn a subagent to review PR
${PR_NUMBER}
using the
pr-review-toolkit:review-pr
command with
all parallel
mode. Pass
${DIFF_FILE}
for diff context. If
MODE=local
:
Spawn a subagent to review local changes using the
pr-review-toolkit:review-pr
command with
all parallel
mode. Pass
${DIFF_FILE}
for diff context.
Instruct it to return only the list of issues found — no review submission.
MODE=remote
启动一个子Agent,使用
pr-review-toolkit:review-pr
命令、以
all parallel
模式审查PR
${PR_NUMBER}
。传递
${DIFF_FILE}
作为Diff上下文。
MODE=local
启动一个子Agent,使用
pr-review-toolkit:review-pr
命令、以
all parallel
模式审查本地变更。传递
${DIFF_FILE}
作为Diff上下文。
要求它仅返回发现的问题列表——不得提交审查。

Subagent D: react-doctor (only if
HAS_REACT=true
)

子Agent D: react-doctor(仅当
HAS_REACT=true
时启动)

Spawn a subagent to run
react-doctor
on the working tree. The tool runs via
npx -y react-doctor@latest . --verbose --diff
and requires the working tree to be on the correct branch (already ensured by Step 4).
If
MODE=remote
:
Inform the subagent that the PR branch is already checked out. Instruct it to review the React code in the current working tree with diff context from
${DIFF_FILE}
. If
MODE=local
:
Inform the subagent that the working tree already contains the local changes. Instruct it to review the React code in the current working tree with diff context from
${DIFF_FILE}
.
Instruct it to diagnose React-specific issues (performance, hooks misuse, component anti-patterns, security) and return both the structured list of issues (using the Issue Format Reference) and the full
react-doctor
diagnostic report. No review submission.
启动一个子Agent在工作区运行
react-doctor
。该工具通过
npx -y react-doctor@latest . --verbose --diff
运行,要求工作区处于正确分支(步骤4已确保)。
MODE=remote
告知子Agent PR分支已检出。要求它结合
${DIFF_FILE}
的Diff上下文,审查当前工作区中的React代码。
MODE=local
告知子Agent工作区已包含本地变更。要求它结合
${DIFF_FILE}
的Diff上下文,审查当前工作区中的React代码。
要求它诊断React相关问题(性能、Hooks误用、组件反模式、安全),并返回结构化的问题列表(遵循问题格式参考)完整的
react-doctor
诊断报告
。不得提交审查。

7. Merge and Deduplicate Issues

7. 合并并去重问题

Collect issues from all subagents (three or four, depending on
HAS_REACT
) and deduplicate:
  1. Parse each subagent's response into individual issues.
  2. For each issue, create a fingerprint from:
    file path
    +
    line number range
    +
    concern category
    .
  3. Two issues are duplicates if they share the same file, overlapping line ranges (within ±5 lines), and address the same concern (use semantic comparison, not exact string matching).
  4. When duplicates are found, keep the most detailed/actionable version.
  5. Tag each kept issue with its source(s):
    [code-reviewer]
    ,
    [octocode-roast]
    ,
    [pr-review-toolkit]
    ,
    [react-doctor]
    , or combination if multiple agents found it.
收集所有子Agent的问题(根据
HAS_REACT
状态为3或4个)并去重:
  1. 将每个子Agent的响应解析为单个问题。
  2. 为每个问题生成指纹:
    文件路径
    +
    行号范围
    + 问题类别。
  3. 如果两个问题的文件相同、行号范围重叠(±5行以内)且关注的问题相同(使用语义比较,而非精确字符串匹配),则视为重复。
  4. 发现重复问题时,保留最详细/可操作的版本。
  5. 为每个保留的问题标记来源:
    [code-reviewer]
    [octocode-roast]
    [pr-review-toolkit]
    [react-doctor]
    ,若多个Agent发现同一问题则标记组合来源。

8. Write Issues to Review File

8. 将问题写入审查文件

Append deduplicated issues to the review file, grouped by severity:
markdown
undefined
按严重程度分组,将去重后的问题追加到审查文件中:
markdown
undefined

Critical

严重问题

  • [source]
    path/to/file.ts:42
    — Description of the issue.
    ts
    // the problematic code from the PR diff
    const result = unsafeOperation(input);
    diff
    - const result = unsafeOperation(input);
    + const result = safeOperation(sanitize(input));
  • [来源]
    path/to/file.ts:42
    — 问题描述。
    ts
    // PR Diff中的问题代码
    const result = unsafeOperation(input);
    diff
    - const result = unsafeOperation(input);
    + const result = safeOperation(sanitize(input));

Improvements

优化建议

  • [source]
    path/to/file.ts:88-95
    — Description of the issue.
    ts
    // the problematic code from the PR diff
    items.forEach((item) => {
      process(item);
    });
    diff
    - items.forEach(item => {
    -   process(item);
    - });
    + await Promise.all(items.map(item => process(item)));
  • [来源]
    path/to/file.ts:88-95
    — 问题描述。
    ts
    // PR Diff中的问题代码
    items.forEach((item) => {
      process(item);
    });
    diff
    - items.forEach(item => {
    -   process(item);
    - });
    + await Promise.all(items.map(item => process(item)));

Nitpicks

细节优化

  • [source]
    path/to/file.ts:12
    — Description of the issue.
    ts
    // the relevant code snippet
    let x = getValue();

Total issues: N (X critical, Y improvements, Z nitpicks) Sources: code-reviewer, octocode-roast, pr-review-toolkit[, react-doctor] (include react-doctor only if HAS_REACT=true)
undefined
  • [来源]
    path/to/file.ts:12
    — 问题描述。
    ts
    // 相关代码片段
    let x = getValue();

总问题数: N(X个严重问题,Y个优化建议,Z个细节优化) 来源: code-reviewer, octocode-roast, pr-review-toolkit[, react-doctor](仅当HAS_REACT=true时包含react-doctor)
undefined

9. React Health Report (only if
HAS_REACT=true
)

9. React健康报告(仅当
HAS_REACT=true
时)

If
HAS_REACT=true
, append the full output from the
react-doctor
subagent (Subagent D) to the review file under a dedicated section:
markdown
undefined
HAS_REACT=true
,将子Agent D(react-doctor)的完整输出追加到审查文件的专属章节中:
markdown
undefined

React Health

React健康状况

<full react-doctor report> ```
This section captures React-specific diagnostics (performance, hooks, component patterns, security) separately from the general deduplicated issues above.
If
HAS_REACT=false
, skip this section entirely.
<完整的react-doctor报告>

本章节单独记录React特定的诊断信息(性能、Hooks、组件模式、安全),与上方的通用去重问题区分开。

若`HAS_REACT=false`,则跳过本章节。

10. Verify Requirements Coverage

10. 验证需求覆盖

Spawn a subagent to verify requirements coverage using the
arinhub-verify-requirements-coverage
skill. Pass the diff file path (
${DIFF_FILE}
) so the subagent can read the diff directly without fetching it again. The subagent must return the full requirements coverage report in markdown format.
If
MODE=remote
:
Pass PR
${PR_NUMBER}
and
${DIFF_FILE}
to the subagent. It will use the diff file for analysis and resolve the linked issue automatically.
If
MODE=local
:
Pass
${DIFF_FILE}
to the subagent. The subagent will attempt to extract the linked issue number from the branch name (e.g.,
feature/42-description
,
fix/42
,
issue-42-description
). If no issue can be determined, the subagent will skip coverage verification and report that no linked issue was found.
Append the returned coverage report to the end of the review file under a new section:
markdown
undefined
启动一个子Agent,使用
arinhub-verify-requirements-coverage
skill验证需求覆盖。传递Diff文件路径(
${DIFF_FILE}
),以便子Agent直接读取Diff,无需再次获取。子Agent必须返回完整的Markdown格式需求覆盖报告。
MODE=remote
传递PR
${PR_NUMBER}
${DIFF_FILE}
给子Agent。它将使用Diff文件进行分析,并自动解析关联的需求。
MODE=local
传递
${DIFF_FILE}
给子Agent。子Agent将尝试从分支名称中提取关联的需求编号(例如
feature/42-description
fix/42
issue-42-description
)。若无法确定需求,则子Agent将跳过覆盖验证,并报告未找到关联需求。
将返回的覆盖报告追加到审查文件的新章节中:
markdown
undefined

Requirements Coverage

需求覆盖

<coverage report content from arinhub-verify-requirements-coverage> ```
<来自arinhub-verify-requirements-coverage的覆盖报告内容>
undefined

11. Submit PR Review (only if
MODE=remote
)

11. 提交PR审查(仅当
MODE=remote
时)

Skip this step if
MODE=local
.
Spawn a subagent to submit the review for PR
${PR_NUMBER}
using the
arinhub-submit-code-review
skill. Pass the review file path (
${REVIEW_FILE}
) so the subagent reads issues from it. The subagent must follow the
arinhub-submit-code-review
procedure for deduplication against existing PR comments before submission.
本地模式跳过此步骤。
启动一个子Agent,使用
arinhub-submit-code-review
skill提交PR
${PR_NUMBER}
的审查。传递审查文件路径(
${REVIEW_FILE}
),以便子Agent从中读取问题。子Agent必须遵循
arinhub-submit-code-review
的流程,在提交前与现有PR评论去重。

12. Restore Working Tree (only if
MODE=remote
)

12. 恢复工作区(仅当
MODE=remote
时)

Skip this step if
MODE=local
.
Return to the original branch and restore any stashed changes from Step 4:
bash
git checkout ${ORIGINAL_BRANCH}
本地模式跳过此步骤。
返回原分支,并恢复步骤4中暂存的变更:
bash
git checkout ${ORIGINAL_BRANCH}

Restore stashed changes if the stash was created in Step 4.

若步骤4中创建了暂存,则恢复暂存的变更。

git stash list | grep -q "arinhub-code-reviewer: auto-stash" && git stash pop
undefined
git stash list | grep -q "arinhub-code-reviewer: auto-stash" && git stash pop
undefined

13. Report to User

13. 向用户报告

If
MODE=remote
:
Present a summary:
  • Path to the review file
  • Total issues found (by severity)
  • PR coverage percentage
  • Whether the review was submitted successfully
  • The PR URL for reference
If
MODE=local
:
Present the review file (
${REVIEW_FILE}
) content to the user and a summary:
  • Path to the review file
  • Total issues found (by severity)
  • Requirements coverage percentage (if available)
  • Branch name and list of changed files reviewed
MODE=remote
展示摘要信息:
  • 审查文件路径
  • 发现的总问题数(按严重程度分类)
  • PR需求覆盖百分比
  • 审查是否提交成功
  • 参考用的PR URL
MODE=local
向用户展示审查文件(
${REVIEW_FILE}
)的内容及摘要:
  • 审查文件路径
  • 发现的总问题数(按严重程度分类)
  • 需求覆盖百分比(若可用)
  • 分支名称及已审查的变更文件列表

Issue Format Reference

问题格式参考

Each issue in a subagent response must follow this structure:
markdown
- **Severity:** critical | improvement | nitpick
  **File:** path/to/file.ts
  **Line(s):** 42 (or 42-50)
  **Description:** Clear explanation of the problem.
  **Code:**
  ```ts
  // the problematic code from the PR diff
  const result = unsafeOperation(input);
  ```
  **Suggestion:**
  ```diff
  - const result = unsafeOperation(input);
  + const result = safeOperation(sanitize(input));
  ```
子Agent响应中的每个问题必须遵循以下结构:
markdown
- **Severity:** critical | improvement | nitpick
  **File:** path/to/file.ts
  **Line(s):** 42(或42-50)
  **Description:** 清晰的问题说明。
  **Code:**
  ```ts
  // PR Diff中的问题代码
  const result = unsafeOperation(input);
  ```
  **Suggestion:**
  ```diff
  - const result = unsafeOperation(input);
  + const result = safeOperation(sanitize(input));
  ```

Important Notes

重要说明

  • Review subagents run in parallel to minimize total review time (three or four, depending on whether the changes contain React code).
  • The
    react-doctor
    subagent is only launched when the diff contains
    .tsx
    /
    .jsx
    files or React imports. This avoids unnecessary React diagnostics on non-React changes.
  • The review file is the single source of truth — all findings are merged there before submission.
  • Deduplication uses semantic comparison: if two agents flag the same concern on the same code, only one entry is kept.
  • The review file persists at
    ~/.agents/arinhub/code-reviews/
    for future reference and audit.
  • If a subagent fails or times out, proceed with results from the remaining agents and note the failure in the review file.
  • The diff file persists at
    ~/.agents/arinhub/diffs/
    and is shared read-only across all subagents. The PR branch checkout happens once in Step 4 before subagents launch — no subagent should run
    gh pr checkout
    or switch branches on its own.
  • In
    MODE=local
    , step 11 (Submit PR Review) is skipped — the review is output only to the review file and presented to the user. Step 10 (Verify Requirements Coverage) runs if a linked issue can be determined from the branch name or user input.
  • 审查子Agent并行运行以减少总审查时间(根据变更是否包含React代码,启动3或4个)。
  • 仅当Diff中包含
    .tsx
    /
    .jsx
    文件或React导入时,才会启动
    react-doctor
    子Agent。避免对非React变更进行不必要的React诊断。
  • 审查文件是唯一的可信来源——所有审查结果在提交前都会合并到该文件中。
  • 去重采用语义比较:如果两个Agent标记了同一代码的同一问题,仅保留一条记录。
  • 审查文件将保存在
    ~/.agents/arinhub/code-reviews/
    ,供后续参考和审计。
  • 若某个子Agent失败或超时,将继续使用其他Agent的结果,并在审查文件中记录失败情况。
  • Diff文件保存在
    ~/.agents/arinhub/diffs/
    ,所有子Agent均可只读访问。PR分支的检出仅在步骤4中进行一次,子Agent启动前完成——禁止任何子Agent自行运行
    gh pr checkout
    或切换分支。
  • 本地模式下,跳过步骤11(提交PR审查)——审查结果仅输出到审查文件并展示给用户。步骤10(验证需求覆盖)仅当能从分支名称或用户输入中确定关联需求时才会运行。