rebase

A command that rebases a pull request (moves its changes onto the newest main branch) and handles straightforward merge conflicts automatically.

In plain words
What is it for?
Use it to update a pull request with the latest main branch, resolve routine conflicts, and refresh its signed attestation when the content changes.
Why use it?
It reduces the time spent repeatedly rebasing pull requests by hand. More complex conflicts and failed checks are sent back for human attention, while safer force-pushing protects other changes.

Command

Part of the ai-sdlc plugin — 1 skill, 16 commands, 9 agents shipped together

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/ai-sdlc-framework/ai-sdlc/rebase
Clone the repo
git clone --depth 1 https://github.com/ai-sdlc-framework/ai-sdlc

Or install ai-sdlc, the plugin that ships this one along with the rest of its 1 skill, 16 commands, 9 agents.

Per session 47 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,983 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00047 $0.03983
Opus 5 $0.00023 $0.01992
Sonnet 5 $0.00009 $0.00797
Haiku 4.5 $0.00005 $0.00398

Measured 3d ago against content hash 0fdb151de827, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rebase scanned grade A with 0 findings 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 3d ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

ai-sdlc-plugin/commands/rebase.md · 346 lines

How it starts

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

Rebase PR #$ARGUMENTS onto latest origin/main by spawning the rebase-resolver subagent. This command exists because manual rebase loops were eating significant orchestrator time across PRs #113, #114, and #115 (AISDLC-105). The mechanical 80% (CHANGELOG overlaps, test additions, prettier drift) is delegated to the subagent; the architectural 20% (modify-vs-delete, semantic conflicts, verification failures) escalates back here for human attention.

Why this command lives in the slash command body (not a subagent middleman)

Same reason as /ai-sdlc execute: plugin subagents cannot use the Agent tool (the harness filters it out one level deep regardless of frontmatter — empirical proof in AISDLC-69.2 / AISDLC-98). The slash command body runs in the main Claude Code session which DOES have Agent, so it can spawn rebase-resolver directly.

Hard rules (NEVER violate)

  1. Never merge a PR. Do not run gh pr merge.
  2. Never force-push with plain --force / -f. Always use --force-with-lease (mirrors agent-role.yaml block list).
  3. Never push to main or master. Refuse early.
  4. Never close PRs or issues. No gh pr close, gh issue close.
  5. Never delete branches. No git branch -D / -d.
  6. Never edit .ai-sdlc/** or .github/workflows/**.
  7. Never write GitHub Actions CI-skip magic tokens (AISDLC-88) — the five literal substrings ([skip ci], [ci skip], [no ci], [skip actions], [actions skip]) silently disable workflows. The re-attestation chore commit body composed by Step 5 below is sanitised the same way /ai-sdlc execute Step 10 sanitises it.

Step 0 — Validate input

PR=$ARGUMENTS
if [ -z "$PR" ] || ! echo "$PR" | grep -qE '^[0-9]+$'; then
  echo "ERROR: pass a PR number, e.g. /ai-sdlc rebase 115"
  exit 1
fi

Step 1 — Locate PR + worktree

gh pr view "$PR" --json number,title,headRefName,headRefOid,body,state \
  > /tmp/rebase-pr-${PR}.json

BRANCH=$(jq -r '.headRefName' /tmp/rebase-pr-${PR}.json)
HEAD_SHA=$(jq -r '.headRefOid' /tmp/rebase-pr-${PR}.json)
TITLE=$(jq -r '.title' /tmp/rebase-pr-${PR}.json)

# Refuse on main/master (Hard Rule 3).
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
  echo "ERROR: refusing to rebase $BRANCH — protected branch"
  exit 1
fi

# Derive task ID from branch (pattern: ai-sdlc/<prefix>-<numeric>[.<sub>]-<slug>).
# IMPORTANT: this regex MUST be portable across BSD sed (macOS) and GNU sed
# (linux). BSD sed has no `+?` non-greedy quantifier, and even on GNU sed
# `+?` would stop at the first dash, mangling task IDs like `aisdlc-105`
# down to `aisdlc`. Use an explicit `<letters>-<digits-and-dots>` shape
# instead — captures `aisdlc-105`, `aisdlc-100.2`, etc.
TASK_ID_LOWER=$(echo "$BRANCH" | sed -E 's|^ai-sdlc/([a-z]+-[0-9.]+).*|\1|')
WORKTREE_PATH=".worktrees/$TASK_ID_LOWER"

Read the full file on GitHub · 346 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. 3d ago First seen · 346 lines · 47 tokens per session scan A 0fdb151de827

Subscribe to this mod's changes

rebase is a command published in the GitHub repository ai-sdlc-framework/ai-sdlc (92 stars, last pushed 9d ago), licensed Apache-2.0. It adds 47 tokens to every session and 3,983 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.