Skip to content

Commit b1ae9f2

Browse files
aRustyDevclaude
andauthored
feat(agents): add skill-pr-addresser agent for PR feedback processing (#806)
### Added - Complete Python agent for addressing PR feedback on skills - Subagents: feedback-analyzer, feedback-fixer, substantive-checker - Cost tracking and tracing for API usage - Dry-run mode for testing without changes - Session management with locking - Git worktree integration - Comprehensive test suite (17 test files) - Handlebars templates for PR comments - uv-based dependency management ### Features - Discovers open PRs with review feedback - Filters for substantive vs. style feedback - Orchestrates fixes via Claude subagents - Commits changes atomically - Posts iteration comments to PRs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 722f423 commit b1ae9f2

68 files changed

Lines changed: 17812 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
---
2+
description: Address PR review feedback for skills, continuing development until approved
3+
tools: [Read, Write, Edit, Bash, Glob, Grep, Task]
4+
---
5+
6+
# Skill PR Addresser
7+
8+
Address PR review feedback for skills, continuing development until the PR is approved.
9+
10+
## Overview
11+
12+
This agent picks up where `skill-reviewer` leaves off. When a PR has review feedback requesting changes, this agent:
13+
14+
1. **Discovers** PRs with pending feedback (blocking reviews, unresolved threads)
15+
2. **Analyzes** the feedback using the `feedback-analyzer` sub-agent
16+
3. **Fixes** issues using the `feedback-fixer` sub-agent with model escalation
17+
4. **Commits** and pushes changes to the PR branch
18+
5. **Comments** on the PR summarizing what was addressed
19+
6. **Requests re-review** when all feedback is addressed
20+
7. **Repeats** until approved or max iterations reached
21+
22+
## Usage
23+
24+
### Address feedback on a specific PR
25+
26+
```bash
27+
just -f .claude/agents/skill-pr-addresser/justfile address 795
28+
```
29+
30+
### Check status of a PR
31+
32+
```bash
33+
just -f .claude/agents/skill-pr-addresser/justfile status 795
34+
```
35+
36+
### With options
37+
38+
```bash
39+
# Dry run - show what would be done without making changes
40+
just -f .claude/agents/skill-pr-addresser/justfile address-dry 795
41+
42+
# Specify skill explicitly (instead of auto-detecting from changed files)
43+
just -f .claude/agents/skill-pr-addresser/justfile address-skill 795 components/skills/lang-rust-dev
44+
45+
# Force addressing even if no pending feedback detected
46+
just -f .claude/agents/skill-pr-addresser/justfile address 795 --force
47+
```
48+
49+
### Session management
50+
51+
```bash
52+
# List active sessions
53+
just -f .claude/agents/skill-pr-addresser/justfile sessions
54+
55+
# List all sessions (including completed)
56+
just -f .claude/agents/skill-pr-addresser/justfile sessions-all
57+
```
58+
59+
## Sub-Agents
60+
61+
| Agent | Model | Purpose |
62+
| ------------------- | ---------- | ------------------------------------ |
63+
| `feedback-analyzer` | Haiku 3.5 | Parse and categorize feedback items |
64+
| `feedback-fixer` | Sonnet 4 | Implement fixes in skill files |
65+
66+
### Model Escalation
67+
68+
The fixer uses automatic model escalation:
69+
- **Simple nitpicks** (2 or fewer): Haiku 3.5
70+
- **Complex changes**: Sonnet 4
71+
72+
## Architecture
73+
74+
```
75+
skill-pr-addresser/
76+
├── skill-pr-addresser.md # This file (discovered by Claude Code)
77+
├── main.py # CLI entry point
78+
├── justfile # Task runner recipes
79+
├── pyproject.toml # Python package config
80+
├── src/
81+
│ ├── app.py # Cement CLI application
82+
│ ├── discovery.py # PR and session discovery
83+
│ ├── github_pr.py # GitHub PR operations
84+
│ ├── feedback.py # Feedback analysis/fixing
85+
│ ├── addresser.py # Main orchestration loop
86+
│ ├── templates.py # Mustache template rendering
87+
│ └── exceptions.py # Custom exceptions
88+
├── subagents/
89+
│ ├── feedback-analyzer/ # Analyzes feedback into items
90+
│ │ ├── prompt.md
91+
│ │ └── config.yml
92+
│ └── feedback-fixer/ # Implements fixes
93+
│ ├── prompt.md
94+
│ └── config.yml
95+
├── templates/
96+
│ ├── iteration_comment.hbs # PR comment for each iteration
97+
│ ├── ready_comment.hbs # "Ready for review" comment
98+
│ └── skipped_feedback.hbs # Skipped items summary
99+
├── data/
100+
│ ├── config.json # Runtime configuration
101+
│ └── sessions/ # Session state (gitignored)
102+
└── tests/
103+
└── *.py # Unit tests
104+
```
105+
106+
### Shared Library
107+
108+
Uses `skill-agents-common` for:
109+
- GitHub operations (`github_ops.py`)
110+
- Worktree management (`worktree.py`)
111+
- Session tracking (`session.py`, `models.py`)
112+
113+
### Worktree Reuse
114+
115+
Reuses worktrees created by `skill-reviewer` when available:
116+
- Pattern: `/private/tmp/worktrees/<project_id>/issue-<number>/`
117+
- Uses `get_or_create_worktree()` to find or create
118+
119+
### Session Continuity
120+
121+
Links to original `skill-reviewer` session:
122+
- Finds by issue number: `find_session_by_issue()`
123+
- Finds by PR number: `find_session_by_pr()`
124+
- Creates new if needed: `create_session_from_pr()`
125+
- Tracks iterations and results in session data
126+
127+
## Feedback Loop
128+
129+
```
130+
┌──────────────────────────────────────────────────────────────────┐
131+
│ Feedback Addressing Loop │
132+
├──────────────────────────────────────────────────────────────────┤
133+
│ │
134+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
135+
│ │ Discovery │───▶│ Analyzer │───▶│ Fixer (Haiku/ │ │
136+
│ │ (gh CLI) │ │ (Haiku) │ │ Sonnet) │ │
137+
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
138+
│ │ │ │
139+
│ │ ┌──────────────────────┘ │
140+
│ │ │ │
141+
│ │ ▼ │
142+
│ │ ┌─────────────────┐ │
143+
│ │ │ Commit & Push │ │
144+
│ │ │ (git CLI) │ │
145+
│ │ └─────────────────┘ │
146+
│ │ │ │
147+
│ │ ▼ │
148+
│ │ ┌─────────────────┐ │
149+
│ │ │ Post Comment │ │
150+
│ │ │ (gh CLI) │ │
151+
│ │ └─────────────────┘ │
152+
│ │ │ │
153+
│ │ ▼ │
154+
│ │ ┌─────────────────┐ │
155+
│ └────────▶│ Check Complete? │◀───────────────────────────│
156+
│ │ success >= 90% │ │
157+
│ └─────────────────┘ │
158+
│ │ │
159+
│ Yes │ No (iterate) │
160+
│ ┌───────┴───────┐ │
161+
│ ▼ ▼ │
162+
│ ┌────────────────┐ (loop) │
163+
│ │ Request Review │ │
164+
│ │ (gh CLI) │ │
165+
│ └────────────────┘ │
166+
│ │
167+
└──────────────────────────────────────────────────────────────────┘
168+
```
169+
170+
## Configuration
171+
172+
### Environment Config
173+
174+
See `config/skill-pr-addresser.conf`:
175+
176+
```ini
177+
[skill-pr-addresser]
178+
repo_owner = aRustyDev
179+
repo_name = ai
180+
max_iterations = 3
181+
rate_limit_delay = 1.0
182+
worktree_base = /private/tmp/worktrees
183+
184+
[otel]
185+
enabled = false
186+
endpoint = http://localhost:4317
187+
service_name = skill-pr-addresser
188+
```
189+
190+
### Runtime Config
191+
192+
Edit `data/config.json` for batch settings:
193+
194+
```json
195+
{
196+
"review_labels": ["review", "skills"],
197+
"max_parallel": 3,
198+
"max_cost_per_pr": 2.0
199+
}
200+
```
201+
202+
## Cost Estimation
203+
204+
Per PR addressing cycle (typical):
205+
206+
| Model | Calls | Cost/call | Total |
207+
| ---------- | ----- | --------- | ------- |
208+
| Haiku 3.5 | 1-2 | ~$0.02 | ~$0.04 |
209+
| Sonnet 4 | 1-2 | ~$0.35 | ~$0.70 |
210+
| **Total** | | | ~$0.75 |
211+
212+
Complex PRs with multiple iterations: ~$1-2
213+
214+
## Related
215+
216+
- **skill-reviewer**: Creates the initial PR from issues
217+
- **skill-agents-common**: Shared library for both agents

0 commit comments

Comments
 (0)