Pr workflow manager

From jleechanorg/claude-commands · View interactive version

Pr workflow manager is an AI agent skill from the GitHub repository jleechanorg/claude-commands. PR workflow entry point: discover canonical skills, verify source ownership, publish draft PRs, and drive applicable stages.

How to use this skill

Skill file

PR Workflow Manager

Find the skills before inventing a workflow

This discovery section is the bootstrap: apply it before executing any workflow, native-goal activation or helper rule below. First read applicable target-repository and higher-priority user/safety/authority instructions to resolve source intent. The target PR's base/head SHA is not the skills-source revision; merely reading this entry point does not authorize its operational rules or establish that an alias already ran a helper.

  1. Pin intent. Apply target-repository policy and the task's explicit skills-source ref, including an intentionally older revision. If neither selects a revision, resolve the official jleechanorg/jleechan-skills default-branch tip from current trusted source evidence or a read-only remote-ref query. Resolve the selected ref to an immutable commit; record the repository identity, requested ref, resolved SHA and evidence in the existing execution record. Do not infer intent from a familiar checkout path, installation date, version label or cached remote-tracking ref. Unresolved conflicting requirements need clarification before dependent work.
  2. Compare candidates. Inspect the known official checkout's remote, HEAD and local changes, and any discovered installed source's provenance. Bind the manager, lifecycle files and their loaded dependencies (including any executable helpers) to the pinned commit (for example, by comparing bytes against that commit or verified revision-bound package hashes); a remote URL or claimed version alone is insufficient. A checkout at another commit is stale for this task even if official; an installed copy is not automatically newer or authoritative. Missing provenance or modified instruction files cannot establish an exact-revision match.
  3. Select without overwriting. Use a verified matching installed source or matching checkout; prefer the verified installed source when the known checkout is stale. Otherwise obtain the exact pinned revision in an unused isolated source directory from verified local Git objects, or clone https://github.com/jleechanorg/jleechan-skills.git and fetch only what is needed when network access is available and authorized. Verify the resulting HEAD and loaded files against the pin. Never update, reset, stash, switch branches in, or overwrite the incumbent dirty checkout or installed tree to resolve instructions. Unrelated dirty work may remain when the loaded files are verified unchanged.
  4. Load one revision. Record the selected source path and verification result, then load pr-workflow-manager/SKILL.md, pr-lifecycle/SKILL.md and their required dependencies from that same verified skills tree (.claude/skills/ in a checkout). Reconcile their operational rules with higher-priority instructions before executing them; the selected manager replaces this bootstrap copy's operational rules. Retain this verified source selection rather than restarting an older manager's unpinned discovery. Do not mix a selected lifecycle with another revision's manager, references or helpers. Before any helper execution, verify its availability, provenance and interface compatibility with the selected rules. If an alias already attempted activation, inspect actual state without replaying an unverified command; prior execution is not proof of compatibility. Keep the pin for the run; an intentional revision change requires re-verification and reassessment of affected obligations.
  5. Reconcile command semantics as well as helper compatibility. A revision pin establishes which instructions were selected; it does not establish that their runtime command examples still have the same meaning. Before using any goal query, capability probe, or composer command, verify its read/write semantics against the active runtime's supported interface and current documentation. Never treat /goal active as a status query solely because a pinned source says so: on Claude Code versions where /goal <condition> sets a goal, that command mutates state. Inspect goal state, including whether the user cleared, paused, or stopped it, through a verified read-only native API or a provenance- and interface-verified status helper. For goal inspection, use a composer command only when its exact form is documented read-only for that runtime. Intentional goal-setting commands remain subject to the reconciled activation contract and user authority. If semantics are unknown, do not probe by invoking it; report the state as unverified and use the lifecycle's unsupported/unavailable fallback. Check native API semantics independently of helper presence; a missing helper does not make a supported native read API unavailable, and helper availability does not prove command compatibility.
  6. Handle gaps explicitly. A missing or incompatible helper required by the reconciled contract keeps its dependent action/gate open: report the missing capability and continue independent authorized work. Never borrow an executable from another revision silently. If the selected contract permits an unsupported-capability fallback, record that fallback without claiming activation. Offline or unavailable Git/network access does not require an update: use locally verifiable material when it satisfies the intended pin. If intent, freshness evidence or required files cannot be verified, report the exact missing ref/provenance/capability, keep dependent gates open and continue independent authorized work. Do not silently substitute an older or unproven source, or claim it current.

Source identity and freshness do not grant authority or replace target-repository policy. Preserve every applicable gate, branch/source ownership rule and separate merge/credential authorization; selecting an older source is not permission to bypass those requirements.

Terminal goal and entry contract

An unqualified /prw (/pr-workflow) defaults to driving the PR to FINAL_READY across all applicable gates under one continuous session goal, unless the user explicitly requests an earlier milestone. Intermediate checkpoints (opening draft, pushes, initial approval, undrafting, stage labels) are not task completion; merge authority remains separate. For canonical completion and exit conditions, follow pr-lifecycle. Apply six-stage.md title and label rules only when the target repository explicitly opts into that workflow.

Start sequence (in this order, in the first turn unless a bootstrap gap keeps a step open):

  1. Complete the discovery bootstrap above.
  2. Make the single goal-activation decision below and print its Goal: line before the first PR-mutating action.
  3. Capture accepted_at (UTC time the task was accepted) in the task context; copy it unchanged into the execution record when that record is first written, never substituting PR creation time. Use UNKNOWN when acceptance was not observed, and keep the original value on resume.
  4. Preflight the route and record it in the execution record: the selected route and the evidence kind each claim needs under evidence standards (for example video for an interaction claim); the coverage each source vote's COVERAGE: must show before it counts (static-review § Scope: the complete diff and every changed path at both revisions); and the votes required, with each candidate seat's account and current availability from a timestamped probe or quota hint (never a review dispatch), counting each eligible separate cold seat once (advice § Identity). If available eligible seats cannot fill the quorum, report that now with the UNAVAILABLE lines and earliest reset; the gate stays open and independent work continues; once every seat in the order of attempts has a receipt or an evidenced skip reason, pr-lifecycle's self-review fallback keeps the PR moving with final approval withheld. Record merge_authorization from authority already in hand: authorized only with a quoted source that pr-lifecycle's merge authorization rule accepts (an operator statement covering merging this PR, a standing approval whose stated conditions apply, or that rule's tier needing no human approval, citing the tier and counted delta); a request to drive the PR or general goodwill never counts. Only when none applies, ask once whether merge is authorized and record not authorized, or not asked when the question cannot be posed; continue without waiting and update the record if an answer arrives. authorized is required for the final step to merge and waives no gate or other merge-authority check; without it the run ends at FINAL_READY unmerged and reports that, without a separate stop to ask. Redo the route preflight when the route changes; retain applicable authorization and re-evaluate its conditions against the current candidate.

Carry the advice candidate roster and attempt report into orchestration delegates' task briefs (not cold reviewer prompts), including authorized backups and the remaining dispatch budget. Record the reason for each unattempted candidate; a health check is not a review launch.

  1. Name the earliest unmet obligation and start it in the same turn; for an opted-in six-stage repository, a newly created draft gets its current stage label then.

One operational contract

Before selecting a branch, stage, or gate, inspect the target repository's AGENTS.md, CLAUDE.md, and scoped instructions. Local repository instructions take precedence within their domain. Where local instructions are silent, apply the canonical pr-lifecycle completion loop.

Repository overlay. Then load the repository's PR overlay, if any: .claude/pr-overlay.md read from the PR's actual base ref (for example git show origin/<base>:.claude/pr-overlay.md), so a PR cannot loosen its own rules; if the PR edits the file, the base version still governs. If there is none, use the operator overlay at ${XDG_CONFIG_HOME:-$HOME/.config}/jleechan-skills/pr-overlays/<owner>/<repo>.md when it exists. An overlay is plain Markdown with up to three headings:

Precedence, highest first: target AGENTS.md/CLAUDE.md, then the repository overlay, then the operator overlay, then the shared defaults. Either overlay may relax a repository rule only by quoting the operator instruction that grants the exception, with its date and where it was given (session, PR comment or message), so a reviewer can trace it. If the PR's reviewer cannot locate the cited message, the grant counts for nothing. A repository overlay's grant counts once it has merged through the repository's normal review. An operator overlay's grant lapses when a repository overlay lands. Otherwise the repository rule wins. In the PR's stage or execution record, name the overlay and its commit or file hash, and copy verbatim every repository rule it relaxed and the grant quoted for it.

Verify ownership and exact branch

gh pr view <N> --json url,headRefName,headRefOid,headRepository,baseRefName. Inspect remotes, local status, and upstream; a similarly named branch or a log grep is not source binding.

Per-PR execution ownership

The persistent driver owns the single native session goal under the

manager's start contract. Each PR-specific task objective belongs in its worker

brief and execution record, not in a separate subagent native goal.

For every accepted PR, create a row in the existing execution record and name

at least one execution subagent. Give it a PR-specific task objective, primary

obligation, candidate SHA, permitted actions, and expected artifact. This task

objective is an assignment brief, not a requirement to activate a separate

native goal for the subagent. Use one writer per branch and retain independent

review roles.

Follow review-records

for per-PR execution, verified waits, and failure recovery.

A worker assignment or acknowledgment does not prove start. Confirm a start from

an observed task-scoped action or verified live job against the PR revision.

Keep the driver accountable until execution ownership is observed and recorded.

If a worker fails to start or exits, inspect its output and side effects,

then take the next bounded safe action as driver or recover on an eligible host.

Prefer the current host when it has task-specific headroom. For a host-specific

blocker, measure the alternate host and use /lm for Mac-to-Linux or /mac-mirror

for Linux-to-Mac portable work when that route is eligible; verify the worker's

actual start on the intended PR SHA. Apply the existing safe-retry limit and

never loop on assignments, polls, or sleeps. Record an exact blocker, owner,

next action, and real resumption trigger when work cannot start. A wait or

failure on one PR does not gate intake of independent PRs.

Practical publication guidance

Apply these compact defaults where explicit repository instructions are silent; existing global merge/push safety remains canonical:

gh pr create --repo <verified-base-owner/repo> --draft --base <verified-base> --head <verified-branch>; in a repository that opts into six-stage, also pass --label <current stage label> so the draft is labeled at creation. If that fails (missing label or permission):

1. Check whether the failed call already opened the PR: gh pr list --repo <verified-base-owner/repo> --head <verified-branch> --base <verified-base> --json number,headRefOid,isCrossRepository,baseRefName, accepting only a same-repository match into the verified base whose headRefOid equals the pushed SHA (--head matches branch names only, so a same-name fork PR is not ours).

2. Create without the label only if no such PR exists, then apply it with gh pr edit <that PR number> --repo <verified-base-owner/repo> --add-label <current stage label>.

3. If labeling still fails, record the label as missing in the readback, keep label sync open for the next transition, and continue rather than stalling.

Autonomous execution and boundaries

Drive the PR through the pr-lifecycle completion loop, which owns route selection, gate order, obligation records, asynchronous work, evidence applicability and final claim-to-proof checks. Load six-stage.md stage rules only when the target repository opts into that workflow; its evidence publication section applies to every PR under the selected route. Load the relevant on-demand routing/recovery references when their decisions are needed. Open new PRs as drafts; undraft only after its applicable draft gates pass, except an early undraft under the preview-deploy exception when a repository's preview workflow (e.g. a GCP preview gated on non-draft PRs) must run to produce evidence. The self-review fallback is the other case: once every seat in the order of attempts has a receipt or an evidenced skip reason and the source votes are still short, undraft after every other draft gate passes.

Headless PR owner (`--nudge`)

/pr --nudge <PR> hands execution to a headless PR owner under pr-owner-nudger: resolve the jleechan-skills source checkout holding scripts/pr_nudger_round.py, verify or create a dedicated checkout on the PR head branch, write the per-PR scope from the PR's /ironclad contract, run scripts/pr_nudger_round.py enroll with the chosen --cli (codex or agy) and --model, start the first tick with scripts/pr_nudger_round.py retry-now --kick, and turn the current session into the independent Stage 5 verifier rather than writing on the branch. /pr --nudge --stop <PR> retires the target via scripts/pr_nudger_round.py retire. Enabling dispatch (enabled: true) and merging stay with the operator.

Boundaries

Creating or updating a PR does not authorize merge, deployment, credential changes, new quota, native/account operations, schedule changes or another owner's source work. Merge authority remains repository/user-specific and must be satisfied separately. Stage title and label presentation follows six-stage.md only when the target repository explicitly opts into it; every PR follows six-stage.md's evidence publication contract and review-records, including the selected route's exemptions. Stage-specific exit records apply only to opted-in repositories; shared publication requirements do not adopt stage titles or labels.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.