integrate-pr

A command that takes an approved pull request through integration: rebasing, checking CI, merging, cleaning up, closing the linked issue, and recording lessons.

In plain words
What is it for?
Use it to finish a pull request from approval to merged status, including branch cleanup and review-learning updates.
Why use it?
It combines the many steps after approval into one workflow, reducing the chance that cleanup or follow-up work is missed.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/xsovad06/sova/integrate-pr
Clone the repo
git clone --depth 1 https://github.com/xsovad06/sova

Made for: Claude Code.

Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,981 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00027 $0.03981
Opus 5 $0.00014 $0.01990
Sonnet 5 $0.00005 $0.00796
Haiku 4.5 $0.00003 $0.00398

Measured yesterday against content hash 735af9ac3f08, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

integrate-pr scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

PUSHED=$(cat .claude/agent-control/integrate-pushed 2>/dev/null || echo 0)
.claude/commands/integrate-pr.md · 340 lines

How it starts

The opening of the file, as written. The whole thing — 340 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Integrate PR

Full integration pipeline for a PR. Rebases onto the base branch, waits for CI, merges, cleans up branches/worktrees/stashes, closes the linked issue, captures review learnings, promotes confirmed patterns to project knowledge, and updates agent memory. Replaces the need to run /after-merge and /extract-knowledge separately. Works for both manual invocation and autonomous agent use.

# Benchmark logging (entry)
bash .claude/benchmark/log.sh "integrate_pr_start" "" "" 2>/dev/null || true

PR: $ARGUMENTS

Instructions

Phase 1: Identify the PR

Determine the PR number from available context, in priority order:

  1. From arguments ($ARGUMENTS): use directly if a number is provided
  2. From current branch: query for an open PR on the current branch:
    gh pr view --json number,title,body,state,baseRefName,headRefName,statusCheckRollup,reviewDecision,commits,mergeable
    
  3. From recent PRs: if on the base branch, list recent open PRs authored by the current user:
    gh pr list --author @me --state open --limit 10
    
    Ask the user which one to integrate (unless running autonomously, in which case stop and report ambiguity).

If no PR can be identified, stop and report clearly.

Once identified, fetch full PR metadata:

gh pr view <PR_NUMBER> --json number,title,body,state,baseRefName,headRefName,statusCheckRollup,reviewDecision,commits,mergeable

Stop if:

  • PR state is CLOSED -- report and stop.
  • PR state is MERGED -- skip to Phase 5 (cleanup only).

Extract the linked issue number from the PR body (patterns: Closes #N, Fixes #N, Resolves #N) or title (#N). This is optional -- the pipeline works without a linked issue.

Log the review decision status (APPROVED, CHANGES_REQUESTED, etc.) but do NOT require formal approval to proceed. The user invoking this command is the approval.

Phase 2: Rebase and Push

Ensure you are on the PR's head branch:

git fetch origin
git worktree prune
git checkout <HEAD_BRANCH>
git rebase origin/<BASE_BRANCH>

Read the full file on GitHub · 340 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 340 lines · 27 tokens per session scan B 735af9ac3f08

Subscribe to this mod's changes

integrate-pr is a command published in the GitHub repository xsovad06/sova (2 stars, last pushed 2d ago), licensed Apache-2.0. It adds 27 tokens to every session and 3,981 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.