name: await-greptile description: Autonomous PR review agent that monitors Greptile, fixes issues, and merges when approved. Runs in background after PR creation. Loops until 5/5 confidence score then auto-merges. Use after creating a PR for fully hands-off review workflow.
Await Greptile - Autonomous PR Review Agent
A background agent that monitors Greptile code reviews, automatically fixes any issues found, and merges when the review passes with high confidence. Runs autonomously until complete.
Trigger
Use this skill when:
- Just created a PR and want fully autonomous review handling
- Want hands-off PR workflow: create → fix → merge
- User invokes
/await-greptileor/await-greptile <PR#>
Arguments
<PR#>— Optional PR number. If omitted, detects from current branch.--no-merge— Don't auto-merge, just fix issues and report--max-iterations=N— Maximum fix/review cycles (default: 5)
Workflow
Step 1: Gather Context
Get repo details from git remote:
git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/'If PR number not provided, detect from current branch:
git branch --show-currentThen use
mcp__plugin_greptile_greptile__list_pull_requestswithsourceBranchfilter.Get full PR context via
mcp__plugin_greptile_greptile__get_merge_request:- PR title and description (THE INTENT)
- Changed files list
- Current review status
- Existing comments
Step 2: Load Agent Persona
Read the agent definition from:
~/.claude/skills/await-greptile/AGENT.md
This contains:
- Issue categorization strategies
- Fix approaches for each category
- Safety rails
- Output formats
Step 3: Launch Background Agent
Use the Task tool to spawn the autonomous agent:
Task(
subagent_type: "general-purpose",
run_in_background: true,
description: "PR Review Agent for #{pr_number}",
prompt: """
<agent-context>
{contents of AGENT.md}
</agent-context>
<pr-context>
PR: #{pr_number}
Title: {pr_title}
Repo: {owner/repo}
Branch: {branch_name}
## Original PR Description (THE INTENT)
{pr_description}
## Files Changed
{list of changed files with paths}
## Configuration
Max iterations: {max_iterations}
Auto-merge: {true/false}
</pr-context>
Begin the review loop now. Start by checking the current review status.
"""
)
Step 4: Notify User
Immediately after launching:
🤖 Autonomous PR Review Agent started
**PR:** #{pr_number} - {title}
**Task ID:** {task_id}
The agent will:
1. ⏳ Wait for Greptile to review
2. 🔧 Fix any issues found (up to {max_iterations} cycles)
3. ✅ Merge when 5/5 confidence achieved
**Check status:** TaskOutput(task_id: "{task_id}", block: false)
Continue working - the PR will be handled automatically.
Agent Behavior Reference
The spawned agent follows the full protocol in AGENT.md, including:
Issue Categories
- Type/Schema Issues — Fix type mismatches, branded type access
- Missing Validation — Add Zod schemas or runtime guards
- Error Handling — Add try/catch, meaningful errors
- Performance Issues — Fix N+1, add caching, optimize
- Test Quality — Replace placeholders with real assertions
- Code Style — Extract constants, improve naming
- Security Issues — Sanitize inputs, never commit secrets
- Architecture — Fix boundary violations, circular deps
Safety Rails
- Max 5 iterations (prevents infinite loops)
- Tests run before every push
- Specific file adds only (never
git add .) - No force pushes
- Stops on security issues for human review
- Always references original PR intent
Decision Points
- 5/5 confidence + no issues → Merge and stop
- Issues found → Fix, push, wait for re-review
- Max iterations → Stop without merging
- Test failure → Stop and report
- Ambiguous/security issue → Stop for human review
Example Output
🤖 Autonomous PR Review Agent started
**PR:** #42 - Fix Probability API mismatch
**Task ID:** task_abc123
The agent will:
1. ⏳ Wait for Greptile to review
2. 🔧 Fix any issues found (up to 5 cycles)
3. ✅ Merge when 5/5 confidence achieved
Continue working - the PR will be handled automatically.
---
[Background agent output - check with TaskOutput]
## Iteration 1/5
**Status:** COMPLETED
**Confidence:** 4/5
### Issues Found: 2
| # | Category | File | Issue | Status |
|---|----------|------|-------|--------|
| 1 | Type | test.ts:42 | .value on branded number | ✅ Fixed |
| 2 | Test | spec.ts:10 | Missing assertion | ✅ Fixed |
### Tests: PASSED ✅
### Commit: abc123
**Next:** Waiting for re-review...
---
## Iteration 2/5
**Status:** COMPLETED
**Confidence:** 5/5
**Issues Found:** 0
### 🎉 Merging PR #42...
---
## PR Review Complete
**PR:** #42 - Fix Probability API mismatch
**Final Status:** MERGED ✅
**Iterations:** 2
**Fixes Applied:** 2
**Time:** 4m 32s
Manual Invocation
# Full autonomous loop
/await-greptile
# Specific PR
/await-greptile 42
# Don't auto-merge
/await-greptile 42 --no-merge
# Limit iterations
/await-greptile --max-iterations=3