Applies human and AI-bot review comments on one or more PRs — each gated by /critical + /confidence, committed separately, pushed, and its thread resolved — or one pasted suggestion in place. --watch repeats on one PR until reviewers go quiet; --resolve-all also closes every non-fix thread it honestly can; triggers on "implement suggestion", "apply review comments", "/implement-suggestion".
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
Validate reviewer suggestions on one or more PRs through /critical and /confidence, then apply each PR's suggestion-pack: commit, push to the existing branch, and resolve threads.
One PR is applied in this context; two or more get one worker sub-agent per PR, in parallel.
Never open a new PR.
Detailed procedure lives in rules/*.md; load each file at the phase that names it.
Contents: Mode Detection · Architecture · Multi-PR Workflow · Results · Free-text Workflow · Self-Improvement · Hard Rules · Prerequisites · Rules
Parse $ARGUMENTS once, in this order. First match wins.
| # | Signal in $ARGUMENTS | Mode |
|---|---|---|
| 1 | One or more github.com/<owner>/<repo>/pull/<n> URLs (with or without #discussion_r…) | multi-pr |
| 2 | One bare PR number (#123) and the current directory is a PR worktree | multi-pr (n=1) |
| 3 | Free-text prose, pasted comment body, or non-PR URL | free-text |
| 4 | Empty and the current branch has an open PR (auto-detected via gh pr view) | multi-pr (active PR) |
| 5 | Empty and no active PR for the current branch | Prompt the user |
Rule #4 runs gh pr view --json number,url,state,headRefName,headRefOid,isDraft with no number; an OPEN PR becomes the single PR, a MERGED or CLOSED one needs explicit user confirmation.
Full parsing rules: rules/input-parsing.md.
Modifiers (orthogonal to mode):
--watch — loop the single pass on exactly one PR until the reviewers go quiet (max 5 iterations); refuse it with more than one PR or in free-text mode. rules/watch-mode.md — read when --watch is set.--resolve-all — default off; also reply to and resolve every non-fix thread that can honestly be closed. rules/resolve-all.md — read when --resolve-all is set; it changes Phases 3, 5, 6, and 7.State the detected mode and inputs in one line before continuing:
Mode: multi-pr PRs: dash0/console#1234, dash0/console#1278Phase 0: Input parse → PR tuples (or free-text string)
Phase 1: Worktree resolution → gw checkout <pr> per PR; verify clean state
Phase 2: Comment fetch → per-PR ledger (parallel across PRs)
Phase 3: Classify → actionable / nit / discussion / praise
Phase 4: Two-gate validation → /critical → /confidence per actionable comment
Phase 5: Build suggestion-pack → .agent/<branch>/suggestion-pack.md per PR
Phase 6: Apply → 1 PR: here; ≥ 2 PRs: one worker per PR — commit-per-comment, full check, push, resolve thread
Phase 7: Report → per-PR table: applied / surfaced / skipped / resolvedPhases 1–6 run in parallel across PRs (one message, multiple dispatches); Phase 4 runs sequentially within a PR so the gates see consistent state.
Apply rules/input-parsing.md: a deduplicated list of {owner, repo, prNumber, commentFilter} tuples, each validated via gh pr view --json number,state,headRefName,headRefOid,isDraft; refuse any PR in state MERGED or CLOSED.
Apply rules/worktree-resolution.md. Per PR: gw checkout <pr-url-or-number>, verify git status --porcelain is empty and HEAD == headRefOid, record the absolute worktree path.
Never auto-stash, never auto-rebase, never operate in the user's main worktree.
Apply rules/comment-fetching.md. Per PR, in parallel:
gh api repos/<owner>/<repo>/pulls/<n>/reviews
gh api repos/<owner>/<repo>/pulls/<n>/comments
gh api repos/<owner>/<repo>/issues/<n>/commentsInclude comments from human teammates and AI review bots (claude[bot], coderabbitai[bot], …); filter only the current user's own comments and noise bots (dependabot, github-actions).
Exclude resolved threads. Honor commentFilter.
A review body carrying <!-- PR_REVIEWER_REPORT --> is never self-filtered (the same carve-out covers a pr-reviewer inline finding, recognised by its attribution footer, and a review-loop --ui lane finding by its <!-- ui-verify:finding marker), and is expanded into one ledger entry per finding — deferred findings, gate findings, and optimality proposals exist only in that body.
Every expanded finding still runs the full pipeline; the reviewer's own score is evidence for Phase 4, never a way around it.
Grammar: agents/shared/rules/reviewer-report-ingest.md; expansion contract: rules/comment-fetching.md § Reviewer-report expansion.
First read implement-suggestion-lessons from LoreKit per rules/self-improvement-loop.md#read-lessons-phase-3 (silent no-op if memory.* is not connected).
Matching lessons are advisory inputs to tagging and the Phase 4 gates; they never relax the two-gate requirement or a hard rule.
Tag every comment per rules/comment-classification.md:
| Tag | Treatment (default) |
|---|---|
actionable | Carries to Phase 4. |
nit | Carries to Phase 4; higher confidence bar applies. |
discussion | Skipped; surfaced in the Phase 7 report. |
question | Skipped; surfaced. |
praise | Dropped silently. |
For each actionable / nit comment, in this order (rules/validation-gates.md):
Skill("critical", "<mode>") — code if the comment proposes a specific edit (suggestion block, file:line reference), analysis otherwise.Skill("confidence", "analysis") — score the change given the comment, the surrounding code, and /critical's findings./confidence score | nit comment | actionable comment |
|---|---|---|
| ≥ 90% | apply | apply |
| 80%–89% | surface | apply |
| 70%–79% | surface | surface |
| < 70% | skip | skip |
A /critical finding tagged Must-fix overrides the matrix and forces surface, even at ≥ 90%; this override is non-removable.
Should-fix / Nice-to-have do not override; record them in the pack.
Write .agent/<branch>/suggestion-pack.md per PR from templates/suggestion-pack.md: every apply change with file:line, the proposed edit, comment author and ID, and the /critical + /confidence evidence.
The pack is plan.md-shaped — one Acceptance Criterion per applied change, and a Mode: existing-pr header meaning "commit and push to the existing branch; do not open a new PR".
Once the pack names its files, read the codebase-knowledge signal for exactly those paths and fold matches into the pack as apply-time constraints, per rules/self-improvement-loop.md § Cross-bucket read — codebase-knowledge.
The worker reads no other memory.
Order the pack first (B builds on A ⇒ A first; two contradicting apply comments both move to surface), then pick the applier by PR count:
| PRs in this run | Applier |
|---|---|
1 (always under --watch and inside review-loop) | This context. Run the worker prompt template's What to do steps and Hard rules yourself, against the pack. |
| ≥ 2 | One worker sub-agent per PR, all in one message, each with the filled template. |
Why: this context already read every comment and ran both gates on it; a single worker re-reads all of that from the pack and buys no parallelism (rules/handoff.md § Who applies).
# correct — one PR: apply here, from the pack
Phase 5 writes the pack → Phase 6 runs steps 1–6 of the template in this context → Phase 7 reports
# incorrect — one PR: a worker that re-reads what this context already holds
Agent(subagent_type="general-purpose", prompt=<template for PR #123>)With two or more PRs, dispatch:
Agent(
description: "Apply suggestion-pack to PR #<n>",
subagent_type: "general-purpose", # "general" on OpenCode / Agent0 — rules/handoff.md#generic-sub-agent-type
prompt: <the "Worker prompt template" from rules/handoff.md, filled in — the template is inline in that file; no external prompt file exists>
)Contract and prompt: rules/handoff.md#worker-prompt-template.
Whoever applies makes one commit per applied comment (message cites @author + URL), pushes once after all commits, then replies Addressed in <sha> and calls resolveReviewThread on each addressed thread.
surface / skip comments stay open; issues / review-summary comments have no resolvable thread and are reported as such.
With two or more PRs, the main agent does not edit, commit, push, or resolve in Phase 6.
Applying in this context changes nothing in the pack: edit only the files an apply entry lists, and never re-judge an entry the gates already passed.
## Implement-Suggestion Results
| PR | Branch | Applied | Surfaced | Skipped | Commits | Pushed | Resolved |
|----|--------|---------|----------|---------|---------|--------|----------|
| dash0/console#1234 | fix/foo | 3 | 1 | 2 | abc1234, def5678, 9a0bcde | ✓ | 3/3 |
| dash0/console#1278 | feat/bar | 0 | 2 | 1 | — | — | 0/0 |Commits lists one SHA per applied comment.
Resolved is <threads-resolved>/<applied-with-a-thread> (issues / review-summary comments are excluded from the denominator).
Then per PR list Applied (comment ID, author, one-line summary, commit SHA, thread status), Surfaced (comment, gate score, /critical finding; thread left open), and Skipped (comment, reason; thread left open).
After the report, write durable lessons (a Phase 3 misclassification, a Phase 4 mis-score, an apply that rippled past its own files) per rules/self-improvement-loop.md#write-lessons; a lesson reaching seen_count >= 3 is surfaced for promotion, never promoted silently.
Then run the outcome-emit step: one review-outcomes record (consumed by outcome-learning.md) and one reviewer-comment-relevance record per processed comment, both append-only and non-blocking.
rules/outcome-emit.md — read when LoreKit memory.* tools are connected (both writes are silent no-ops otherwise).
When $ARGUMENTS is prose, a pasted comment, or a single comment permalink without a PR worktree context:
Reads implement-suggestion-lessons at Phase 3; writes at Phase 7 and on a --watch re-flag (rules/self-improvement-loop.md).
Also produces two LoreKit buckets (rules/outcome-emit.md): the review-outcomes bus (volatile 30-day TTL) and reviewer-comment-relevance (durable 60-day TTL, read by pr-reviewer on every run).
LoreKit is optional; without memory.* tools every loop is a silent no-op.
--force or --force-with-lease without explicit user approval.--no-verify or bypass hooks./critical review surfaced a Must-fix finding without surfacing first.git log maps one-to-one to resolved threads.gw worktree.gh pr create.ci-auto-fix; "apply the comments and get CI green" is review-loop. Under --watch, check state is only a stop reason.| Dependency | Required? |
|---|---|
gh CLI (authenticated) | Yes for multi-PR — stop and ask the user to install it if missing |
gw CLI | Strongly recommended |
git, /critical, /confidence | Yes |
lorekit-memory skill (LoreKit memory.* tools) | Optional |
| Rule | When it loads |
|---|---|
input-parsing | Phase 0 |
worktree-resolution | Phase 1 |
comment-fetching | Phase 2 |
comment-classification | Phase 3 |
validation-gates | Phase 4 |
handoff | Phase 6 — who applies, worker dispatch + prompt; rationale: apply-context |
outcome-emit | Phase 7, and per --watch iteration, when LoreKit is connected |
watch-mode | When --watch is set |
resolve-all | When --resolve-all is set |
self-improvement-loop | Phase 3 read, Phase 7 / watch re-flag write, promotion |
mthines/agent-skills
0ec47ca
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.