Cancel pr

From ianjamesburke/PLEXI · View interactive version

Cancel pr is an AI agent skill from the GitHub repository ianjamesburke/PLEXI. Use when a PR attempt has failed and needs to be abandoned — close without merging, audit what went wrong, rewrite the issue so the next agent starts closer to done with fewer wrong turns.

How to use this skill

Skill file

Cancel PR

Abort a failed PR attempt, extract learnings, and rewrite the issue so the next run is faster.


Phase 1 — Close the PR

gh pr close <N> --comment "Closing — <one sentence: what failed and why>. Rewriting issue with learnings."

Do NOT delete the branch yet. The diff is evidence.


Phase 2 — Foot-Gun Audit

Pull the full diff and the conversation context. Answer each question:

Implementation mistakes:

Navigation mistakes:

Spec mistakes (what the issue failed to say):

Capture each finding as a concrete bullet. Vague findings ("agent was confused") are useless. Name the specific file, wrong assumption, or missing constraint.


Phase 3 — Rewrite the Issue

Rule: rewrite the body, never append. An issue body that accumulates addendums forces the next agent to reconcile contradictions. A clean rewrite is a fresh spec.

Fetch the current body:

gh issue view <N> --json title,body,comments --jq '{title:.title, body:.body}'

Rewrite with this structure:

## Goal
[One sentence: what done looks like]

## Context
[Relevant existing code shape — file paths, key types/structs, current behavior]
[Include anything the failed attempt had to discover mid-run]

## Constraints
[Hard constraints discovered or confirmed: what must not change, what already exists, what the code shape forces]

## Acceptance Criteria
[Concrete, checkable. "cargo test passes" is not enough — name the behavior.]

## Prior Attempts

**Attempt N:** [What was tried — specific approach, not vague]
**Why it failed:** [Root cause — the actual constraint or wrong assumption]
**What to try next:** [Specific next direction, if known]

Write the rewritten body:

gh issue edit <N> --body "$(cat <<'EOF'
<rewritten body>
EOF
)"

Phase 4 — Cleanup

# Uninstall the PR build and remove its ~/.plexi-pr-<PR> and ~/.local/share/plexi/pr-<PR> directories
just channel-clean "pr-<PR_NUMBER>"

# Unclaim any linked stint task so the next agent can claim it cleanly
stint unclaim <stint-id>

# Re-label (if GitHub issue-backed): remove in-progress, add ready
gh issue edit <N> --remove-label "in progress" --add-label "ready"

# Delete the remote branch
git push origin --delete <branch-name>

# Remove the worktree
wtp remove <branch-name>

Confirm the worktree is gone:

git worktree list

Quality Bar for the Rewrite

The rewrite succeeds if a fresh agent reading only the issue (no session context) would:

  1. Know which files to read first
  2. Know what shape the existing code has
  3. Know what constraints cannot be violated
  4. Know what the last attempt tried and why it failed

If any of those four are missing, the rewrite is incomplete.


What Not to Do

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.