Create pr

From glowingkitty/OpenMates · View interactive version

Create pr is an AI agent skill from the GitHub repository glowingkitty/OpenMates. Create a pull request from dev to main with proper formatting and draft release

How to use this skill

Skill file

Instructions

IMPORTANT: Only create a PR when the user explicitly asks.

Invoke this workflow with /create-pr. Keep this file static: execute

commands explicitly during the workflow rather than using command-template

shell expansion in SKILL.md.

Before the Step 0 changelog summary, read the private deployment handoff at

~/.openmates/deployment-notes/pr-dev-to-main.md (expand ~ at runtime).

Use its current status and unresolved gates when preparing this PR and the

private production handoff. If the file is unavailable, report that gap before

release decisions; do not infer that its rollout gates are complete. Keep

deployment sequence, approvals, and operational details out of the public PR

body. A PR request does not authorize a production domain cutover.

Step 0 — Summarize Changelog Markdown Before Asking Questions (CRITICAL)

Identify the most recent merged dev → main PR using --state merged and

its mergedAt value. Read every compact

docs/releases/daily/YYYY-MM-DD.md on or after that merge date and every

docs/releases/weekly/YYYY-Www.md whose covered date range overlaps the

post-merge period.

Do not refresh or write release-intelligence artifacts yet.

Start with explicit read-only discovery:

git fetch origin main dev
latest_pr=$(gh pr list --base main --head dev --state merged --limit 1 \
  --json number,title,mergedAt,mergeCommit,headRefOid,url)
latest_head=$(printf '%s' "$latest_pr" | jq -r '.[0].headRefOid // empty')
if [ -n "$latest_head" ] && ! git merge-base --is-ancestor "$latest_head" origin/main; then
  printf 'Blocked: previous dev PR head %s is not an ancestor of origin/main. Repair merge history before preparing another PR.\n' "$latest_head"
  exit 1
fi

repo=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
merge_policy=$(gh api "repos/$repo" \
  --jq '[.allow_merge_commit, .allow_squash_merge, .allow_rebase_merge] | @tsv')
expected_merge_policy=$(printf 'true\tfalse\tfalse')
if [ "$merge_policy" != "$expected_merge_policy" ]; then
  printf 'Blocked: repository must allow merge commits only; squash and rebase rewrite dev commit ancestry.\n'
  exit 1
fi

printf '%s\n' "$latest_pr"
git rev-list --left-right --count origin/main...origin/dev
git diff --stat origin/main...origin/dev

This merge-history gate is mandatory. It prevents a squash or rebase promotion

from making previously released dev commits appear unreleased and preserves

their exact hashes on main. Do not continue by substituting a tree-diff check:

identical trees do not prove that commit ancestry was retained.

Use the merged PR's mergedAt date to select the daily Markdown files, then

inspect weekly Markdown files whose stated date range overlaps that boundary.

Read the selected files in full before producing the summary. For the merge-day

file, include only entries supported by commits in origin/main..origin/dev;

exclude entries already reachable from the prior PR's merge commit. This keeps

changes made later on the merge day without repeating the prior release.

Before asking any clarifying question, give the user one concise, source-grounded summary with these headings:

Use Markdown companions as the primary source. Use origin/main..origin/dev, changed files, companion YAML, and full commit messages only as supporting evidence or to resolve ambiguity. Do not claim a feature is released merely because its code is in dev.

Step 1 — Ask Exactly Five Clarifying Questions (CRITICAL)

After presenting the changelog summary, ask exactly five clarifying questions before changing feature availability, reconciling branches, drafting the PR body, or creating the PR.

with the evidence-based preferred answer and rationale, plus Examples: with

task-specific options or outcomes.

If uncertain, recommend the safest reversible default and state the uncertainty.

After the fifth answer, summarize the confirmed decisions and execution plan,

then continue autonomously through the readiness gates and PR creation. Do not

ask for a separate plan approval; the user's explicit /pullrequest invocation

and five answers authorize the workflow. Stop only for a failed required gate,

an unclassified feature introduced after the questions, or another concrete

safety/reconciliation decision that the five answers could not cover.

Step 2 — Resolve Worktree Readiness (CRITICAL)

Before release intelligence or PR drafting, fetch dev and run reconciliation readiness against its exact remote commit:

git fetch origin dev
python3 scripts/sessions.py worktree release-readiness --target origin/dev

The gate blocks stale, blocked, orphaned, malformed, unique unresolved, and unclassified worktrees. Do not merge or delete

worktree content manually to bypass it. Run the reported sessions.py worktree reconcile action and stop when meaningful unique

work still needs an operator decision.

Recent active work may remain outside this release only after the user explicitly confirms the exclusion. Rerun with one flag

per confirmed session, for example:

python3 scripts/sessions.py worktree release-readiness \
  --target origin/dev \
  --exclude-active 253b

Record the excluded session IDs in the PR preparation summary, rerun the gate after any cleanup or deploy, and continue only

when it reports Ready: yes for the final exact origin/dev commit.

Step 3 — Verify Remote Refs And Main-Only Commits (CRITICAL)

ALWAYS use remote refs (origin/main, origin/dev) — never local refs. Local refs can be stale and produce wildly incorrect commit counts.

git fetch origin main dev
git rev-list --left-right --count origin/main...origin/dev
git log --format="%h %s%n%b" origin/dev..origin/main
git log --oneline origin/main..origin/dev

Confirm the commit count makes sense and classify every main-only commit before reconciling branches. If the commits are legitimate fixes or merge history and reconciliation is conflict-free, follow the user's approved strategy. Stop and ask about unexpected commits or behavioral conflicts.

Step 4 — Refresh Release Intelligence

Before writing the PR body, always refresh the current daily changelog so the last 24 hours are represented:

today=$(date -u +%F)
python3 scripts/release_intelligence.py daily \
  --since "24 hours ago" \
  --date "$today" \
  --write \
  --output "docs/releases/daily/${today}.yml"

Use the most recent merged dev → main PR boundary established in Step 0. Re-read the refreshed daily Markdown companion and update the changelog summary if it materially changed.

latest_pr_date=$(gh pr list --base main --head dev --state merged --limit 1 --json mergedAt --jq '.[0].mergedAt // empty' | cut -dT -f1)
ls docs/releases/daily/*.md | while read -r file; do
  day=$(basename "$file" .md)
  if [ -z "$latest_pr_date" ] || [ "$day" = "$latest_pr_date" ] || [ "$day" ">" "$latest_pr_date" ]; then
    echo "$file"
  fi
done

Use the Markdown overview, grouped changes, and newsletter guidance to build the PR body. Keep unreleased/disabled-feature work out of public release/newsletter language, but include it in the PR when it is part of the code diff. Use companion YAML fields such as sections, marketing_candidates, and unreleased_progress only when deeper structured evidence is required.

Apply the same merge-day commit-evidence filter used in Step 0 before adding

items from the refreshed Markdown companion.

Step 5 — Feature Readiness Gate (CRITICAL)

Before drafting or creating the PR, run and read the deterministic feature readiness report:

latest_pr_date=$(gh pr list --base main --head dev --state merged --limit 1 --json mergedAt --jq '.[0].mergedAt // empty' | cut -dT -f1)
if [ -n "$latest_pr_date" ]; then
  next_daily_date=$(date -u -d "${latest_pr_date} +1 day" +%F)
  python3 scripts/release_intelligence.py pr-readiness \
    --from-ref origin/main \
    --to-ref origin/dev \
    --daily-start-date "$next_daily_date" \
    --format markdown \
    --stdout
else
  python3 scripts/release_intelligence.py pr-readiness \
    --from-ref origin/main \
    --to-ref origin/dev \
    --format markdown \
    --stdout
fi

Use this report to list every changed user-facing or potentially user-facing feature area, especially default-disabled platform features and app/skill/provider work such as projects, tasks, plans, workflows, teams, Revolut Business finance, and code image-to-HTML/image-to-code.

Reconcile this deterministic report with the five confirmed answers. If the report introduces a feature area that the questions did not cover, stop for a focused follow-up decision. Do not silently infer release readiness, draft the final PR body, or run gh pr create while any listed feature remains unclassified.

If the user says a feature is not ready, keep the code but deactivate access through the existing feature availability model:

Continue automatically when the five answers classify every reported feature

and confirm that the remaining accessible features are ready for the PR. Do not

request the same confirmation again at this gate.

Step 6 — Analyze Remaining Commit Details

Use raw commit history only as supporting evidence or to fill gaps not covered by daily changelogs. Read the full commit messages (not just one-liners):

git log origin/main..origin/dev --format="%h %s%n%b"

Group commits into:

Step 7 — Write PR Title And Description

Title rules. The title tells users what they will notice, not what changed

internally:

speed improvements, lower costs and big bug fixes. Never lead with, or

include, internal or technical work (Rust core, CI, infrastructure,

refactors, tooling); that belongs in the body under Internal/Platform Work.

Release: unified Memories with suggestions, new creative skills, and ... and

Release: richer visual results, better voice calling and dictation:

Release: plus two to four short, plain-language highlights.

Check them with

gh pr list --base main --head dev --state merged --limit 5 --json number,title.

tagged (/create-release, Step 9), and the PR is merged before that tag exists.

Do not copy vX.Y from older titles.

state it plainly in the summary.

in the title; gated, dev-only or already shipped work does not.

Description rules. The Summary starts with a short user-facing section

("What you will notice") listing the same highlights in plain language, including

any price change. Technical sections (Internal/Platform Work, validation) come

after it.

Write a human-readable PR description — not a commit dump. Structure:

## Summary
<short user-facing list of what users will notice: new or activated features, speed, cost changes (price increases stated plainly), big bug fixes; then one sentence on the technical background work and gated features>

## Features
- <grouped by feature area>

## Bug Fixes
- <grouped by fix area>

## Internal/Platform Work
- <technical background work: Rust core, CI, infrastructure, refactors, tooling>

## Future Release Preparation
- <briefly summarize included code for explicitly unreleased features without claiming availability>

## Other Changes
- <docs, chore, config items>

Only include sections that have content. The Summary is written for users; the

sections after it are for developers — specific and clear.

Apply this guidance when creating or updating a PR description. The public body

describes the included changes, their purpose, and concise factual validation.

Keep production rollout plans, SSH/server operations, manual post-deployment

testing plans, internal approvals, gate waivers/bypass instructions, and agent

coordination in the private task conversation, outside the public description.

Report only validation actually performed; do not imply unrun checks passed.

If validation coverage matters to reviewers, state that a check was not run

without publishing the internal waiver or deployment plan.

Step 8 — Create the PR

gh pr create --base main --head dev --title "Release: <user-noticeable highlights, no version, no technical work>" --body "$(cat <<'EOF'
<PR description>
EOF
)"

Present the PR URL to the user.

Step 9 — Offer Draft Release

After PR creation, ask the user if they want a draft release prepared. If yes, use the /create-release skill. Tell the user:

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.