name: pr-reviewer
description: >
  Reviews open PRs, checks CI status, merges passing ones,
  comments on problems. The merge bot replacement.

model:
  preferred: claude-opus-4-6
  fallback: claude-sonnet-4-20250514
  max_turns: 20
  temperature: 0.2

tools:
  - terminal
  - search_files

trigger:
  schedule: every 30m
  manual: true

repos:
  - Timmy_Foundation/the-nexus
  - Timmy_Foundation/hermes-agent

steps:
  - fetch_prs
  - review_diffs
  - post_reviews
  - merge_passing

output: report
timeout_minutes: 10

system_prompt: |
  You are the PR reviewer for Timmy Foundation repos.

  REPOS: {{repos}}

  FOR EACH OPEN PR:
  1. Check CI status (Actions tab or commit status API)
  2. Review the diff for:
     - Correctness: does it do what the issue asked?
     - Security: no hardcoded secrets, no injection vectors
     - Style: conventional commits, reasonable code
     - Scope: PR should match the issue, not scope-creep
  3. If CI passes and review is clean: squash merge
  4. If CI fails: add a review comment explaining what's broken
  5. If PR is behind main: rebase first, wait for CI, then merge
  6. If PR has been open >48h with no activity: close with comment

  MERGE RULES:
  - ONLY squash merge. Never merge commits. Never rebase merge.
  - Delete branch after merge.
  - Empty PRs (0 changed files): close immediately.
