pr-submit
Agent-side signal to captain that your branch is ready for PR landing. Runs preconditions (clean tree, pushed, matching QGR receipt) then dispatches captain with a structured payload. Captain's /pr-captain-land picks it up. Replaces the distributed "agent creates PR" model with a captain-owned PR lifecycle (the-agency#296).
适合你,如果团队使用 captain 主导的 PR 生命周期。
npx oh-my-skill add the-agency-ai/the-agency/pr-submitcurl -fsSL https://oh-my-skill.com/install.sh | bash -s -- the-agency-ai/the-agency/pr-submitnpx oh-my-skill verify the-agency-ai/the-agency/pr-submit怎么用
商店整理自技能原文 · 版本 dd2430b · 表述以原文为准安装后,Claude 会检查你的分支是否满足合并 PR 的前置条件(工作目录干净、已推送、有质量保证收据)。如果满足,它会向指挥官发送“PR 就绪”通知,由指挥官负责后续的 PR 创建、版本升级和合并等操作。
当你成功运行 /pr-prep 并将分支推送到远程后,对 Claude 输入 /pr-submit 命令时触发。注意,不能从 master/main 分支执行。
技能原文 SKILL.md
<!-- allowed-tools intentionally omitted — inherits Bash() from .claude/settings.json. Subcommand-level restriction at the skill level silently blocked fleet agents in the past (flag #62/#63; devex dispatch #171). This skill composes git-safe, dispatch, and diff-hash — tool-level narrow restriction would work but needs maintenance as composed tools evolve. Inherit Bash() is safer. -->
pr-submit
Agent-side handoff to captain: "my branch is ready for PR landing." Captain picks up the dispatch and runs /pr-captain-land to own the remaining PR lifecycle (version bump, PR creation, CI wait, merge, release, fleet-notify).
Why this exists
Per the-agency#296: the distributed "agent creates PR, captain merges" model causes four failure modes that the captain-owned lifecycle eliminates:
- Version-bump races — two agents bump
agency_versionsimultaneously against the sameorigin/masterbaseline; one loses. - QGR hash races — captain's coord commits land on master between an agent's QG and that agent's PR creation, invalidating the receipt mid-flow.
- Split release responsibility — agent opens PR but captain creates the release; ownership is asymmetric and release steps get skipped.
- Inconsistent PR descriptions — each agent writes their own; no fleet-wide coherence for review or history-mining.
Solution: captain owns the PR lifecycle end-to-end. Agent owns substance + QG. /pr-submit is the single handoff point — a structured dispatch with branch, SHA, diff-hash, receipt path, and scope summary.
Required reading
Before running, Read the files listed in required_reading: frontmatter.
REFERENCE-CODE-REVIEW-LIFECYCLE.md— where this skill sits in the end-to-end PR flow.REFERENCE-RECEIPT-INFRASTRUCTURE.md— the five-hash receipt chain this skill verifies against.REFERENCE-ISCP-PROTOCOL.md— the dispatch protocol the handoff uses.
The dispatch payload schema itself is in this skill's reference.md.
Usage
/pr-submit --scope "one-line PR summary" /pr-submit --scope "..." --priority high
--scope: required. One-line summary of what this PR delivers (becomes part of the dispatch subject + body).--priority normal|high: optional. Defaults tonormal.highraises dispatch visibility in captain's queue.
Preconditions
The script enforces all of these before dispatching; any failure exits non-zero with a clear error and no dispatch is sent:
- Running in an agent worktree (
.claude/worktrees/<name>/), not the main checkout. - Current branch is not
master/main/HEAD(not detached). - Tree is clean —
git status --porcelainempty. - Current branch is pushed to origin and
origin/<branch>equals localHEAD. - A QGR receipt exists at
agency/workstreams/**/qgr/*qgr-pr-prep-*-{hash}.mdwhere{hash}matches the currentdiff-hashagainstorigin/master.
If preconditions 3 or 4 fail, fix them (commit/push via /git-safe-commit or /sync) and retry. If precondition 5 fails, you need to re-run /pr-prep to sign a fresh receipt.
Flow / Steps
Step 1: Preflight
scripts/pr-submit computes all preconditions. If any fail, exit 1 with a one-line reason. No partial state.
Step 2: Resolve identity + branch state
- Resolve agent identity via
./agency/tools/agent-identity(principal + agent + repo). - Capture
BRANCH=git rev-parse --abbrev-ref HEAD. - Capture
SHA=git rev-parse HEAD. - Verify
git rev-parse "origin/$BRANCH"equalsSHA.
Step 3: Compute diff-hash
./agency/tools/diff-hash --base origin/master --json
Capture the full SHA-256 and the 7-char short form. The 7-char short form is what matches the receipt filename suffix.
Step 4: Locate receipt
Glob for agency/workstreams/**/qgr/*qgr-pr-prep-*-{hash-short}.md. Exactly one receipt should match. If zero, exit 1 — agent must re-run /pr-prep. If multiple, pick the most recent and warn.
Step 5: Compose dispatch payload
Follow the schema in reference.md (protocol v1.0). Envelope:
to: <org>/{principal}/captain
type: pr-submit
priority: normal | high
subject: "Ready for PR landing: {branch} — {scope}"
Body is the markdown template in reference.md — branch, SHA, diff-hash, receipt path, scope, captain-action list.
Step 6: Emit dispatch
./agency/tools/dispatch create \
--to <org>/{principal}/captain \
--type pr-submit \
--subject "<subject>" \
--body "<body>"
Capture the dispatch ID. Report to the agent: "Submitted to captain as dispatch <id>. Captain will run /pr-captain-land <branch>; you'll receive a master-updated dispatch when the PR lands."
Step 7: Stand by
Agent does NOT:
- Create the PR
- Bump
agency_version - Merge
- Create the release
Agent stands by to respond to review comments via /pr-respond if any come. On merge, a master-updated dispatch arrives with PR URL + release tag.
Failure modes
- Preflight fails (Step 1): exit 1 with the failing precondition. No mutation, no dispatch. Fix the precondition and retry.
- Origin mismatch (Step 2.4): local HEAD and
origin/<branch>diverge. Push or pull first (./agency/tools/git-push <branch>orgit-safe fetch+ merge). - Receipt missing (Step 4): no QGR matching current diff-hash. Re-run
/pr-prepto regenerate. - Dispatch emission fails (Step 6): ISCP tool error. Script exits 1; agent retries. Dispatch creation is idempotent-safe (duplicate dispatches just clutter the queue — captain can resolve).
- Captain never picks up: a non-failure but a stall. Agent can re-dispatch with
--priority highor flag the captain directly.
What this does NOT do
- Does not create the PR. That's captain's
/pr-captain-land. Agent must not rungh pr createor/pr-createafter this. - Does not bump
agency_version. Captain is the single writer. - Does not merge anything. Agent has no write access to master.
- Does not modify the branch. The branch stays exactly as
/pr-prepleft it. - Does not wait for captain. Fire-and-forget dispatch; agent returns to other work.
Status
active (v2, agency-skill-version 2 from birth — this skill is the Phase 1 pilot for the-agency#296 captain-owned PR lifecycle). Ready for fleet-wide dogfood on designex / patient / of-mobile next PRs.
Related
/pr-captain-land— captain-side companion; consumes this skill's dispatch/pr-prep— the QG-before-PR-create that produces the receipt this skill verifies/pr-respond— agent-side skill for handling captain review comments (planned)agency/tools/dispatch— the ISCP tool this skill wraps for emissionagency/tools/diff-hash— receipt-matching hashagency/tools/agent-identity— principal/agent/repo resolutionreference.md— dispatch payload schema (protocol v1.0)examples.md— happy-path + failure-mode examples- the-agency#296 — PR lifecycle ownership design
- the-agency#298 — skill refactor recommendation
- the-agency#314 — upstream package MAR summary
- the-agency#315 — V1→V2 migration master issue
OFFENDERS WILL BE FED TO THE — CUTE — ATTACK KITTENS!