@@ -40,22 +40,25 @@ Use `read_agent` with `wait: true` to wait for each background agent.
4040## Step 1: Get the Diff and Build Inventory
4141
4242``` bash
43- BASE=$( git merge-base upstream/main HEAD 2> /dev/null \
44- || git merge-base origin/main HEAD 2> /dev/null)
45- if [ -z " $BASE " ]; then
46- echo " ERROR: Cannot find upstream/main or origin/main."
47- exit 1
43+ # Primary: use gh pr diff (works in cloud agent + any PR context).
44+ # Fallback: git merge-base for local non-PR usage.
45+ if gh pr diff --name-only > /dev/null 2>&1 ; then
46+ echo " ---STAT---"
47+ gh pr diff --name-only
48+ echo " ---DIFF---"
49+ gh pr diff
50+ else
51+ BASE=$( git merge-base upstream/main HEAD 2> /dev/null \
52+ || git merge-base origin/main HEAD 2> /dev/null \
53+ || git merge-base main HEAD 2> /dev/null)
54+ echo " Reviewing changes since: $BASE "
55+ git diff " $BASE " ..HEAD --stat
56+ git diff " $BASE " ..HEAD
4857fi
49- echo " Reviewing changes since: $BASE "
50- git diff " $BASE " ..HEAD --stat
51- git diff " $BASE " ..HEAD -- ' *.rs' ' *.toml' ' examples/' | head -2000
5258```
5359
5460If the diff is empty, stop and report: "No changes found to review."
5561
56- ** Scope rule:** Focus on code files (` *.rs ` , ` *.toml ` , examples). Do NOT pass
57- docs/config diffs to agents.
58-
5962** Build a risk-classified inventory.** List every changed function, struct,
6063impl, trait, pub item, and significant code block. Number them and tag with
6164risk predicates:
@@ -106,8 +109,10 @@ Use `model: "gpt-5.4"` in the task tool call (provides model diversity).
106109> Get the diff:
107110> ```
108111> BASE=$(git merge-base upstream/main HEAD 2>/dev/null \
109- > || git merge-base origin/main HEAD 2>/dev/null)
110- > git diff "$BASE"..HEAD -- '*.rs' '*.toml' 'examples/'
112+ > || git merge-base origin/main HEAD 2>/dev/null \
113+ > || git merge-base main HEAD 2>/dev/null)
114+ > # If no merge-base, use: gh pr diff
115+ > git diff "$BASE"..HEAD # or: gh pr diff
111116> ```
112117>
113118> Key regorus constraints:
@@ -161,8 +166,10 @@ Use `model: "claude-opus-4.6"` in the task tool call.
161166> Get the diff AND read full source files for context:
162167> ```
163168> BASE=$(git merge-base upstream/main HEAD 2>/dev/null \
164- > || git merge-base origin/main HEAD 2>/dev/null)
165- > git diff "$BASE"..HEAD -- '*.rs' '*.toml' 'examples/'
169+ > || git merge-base origin/main HEAD 2>/dev/null \
170+ > || git merge-base main HEAD 2>/dev/null)
171+ > # If no merge-base, use: gh pr diff
172+ > git diff "$BASE"..HEAD # or: gh pr diff
166173> ```
167174> Then use `view` to read the full source files that were changed.
168175>
@@ -219,8 +226,10 @@ Use the default model (no `model` parameter).
219226> Get the diff:
220227> ```
221228> BASE=$(git merge-base upstream/main HEAD 2>/dev/null \
222- > || git merge-base origin/main HEAD 2>/dev/null)
223- > git diff "$BASE"..HEAD -- '*.rs' '*.toml' 'examples/'
229+ > || git merge-base origin/main HEAD 2>/dev/null \
230+ > || git merge-base main HEAD 2>/dev/null)
231+ > # If no merge-base, use: gh pr diff
232+ > git diff "$BASE"..HEAD # or: gh pr diff
224233> ```
225234> Use `view` to read surrounding context.
226235>
@@ -439,8 +448,10 @@ Launch **1 general-purpose agent in background mode**.
439448> Get the diff:
440449> ```
441450> BASE=$(git merge-base upstream/main HEAD 2>/dev/null \
442- > || git merge-base origin/main HEAD 2>/dev/null)
443- > git diff "$BASE"..HEAD -- '*.rs' '*.toml' 'examples/'
451+ > || git merge-base origin/main HEAD 2>/dev/null \
452+ > || git merge-base main HEAD 2>/dev/null)
453+ > # If no merge-base, use: gh pr diff
454+ > git diff "$BASE"..HEAD # or: gh pr diff
444455> ```
445456> Use `view` to read full source files.
446457>
@@ -481,8 +492,8 @@ Launch **1 general-purpose agent in background mode**.
481492
482493## Step 5: Synthesize and Report
483494
484- **IMPORTANT :** This is the primary output. Everything above was preparation .
485- Keep the report COMPACT — one finding per block, no filler prose .
495+ **CRITICAL :** Write the report to `/tmp/deep-review-report.md` FIRST, then display it .
496+ Use a shell command to write the file before any other output in this step .
486497
487498Apply verdicts from the adversarial verifier:
488499- **CONFIRMED**: keep at stated severity
@@ -522,3 +533,9 @@ would catch it. If not, name the minimal test that should exist.
522533X findings (N critical, N high, N medium, N low). Y "likely" findings.
523534Z dropped (one-line reasons).
524535Risk assessment in one sentence.
536+
537+ ---
538+
539+ **Remember:** The report above MUST be written to `/tmp/deep-review-report.md` at the
540+ START of Step 5 (before displaying it). Use shell: `cat > /tmp/deep-review-report.md << 'REPORT_EOF'`
541+ ... report content ... `REPORT_EOF`
0 commit comments