merge-upstream

merge-upstream is a skill for Claude Code, Codex from code-yeongyu/senpi. It costs 52 tokens per session (1,601 once invoked), scanned A, original, MIT.

A workflow for merging changes from an upstream Git repository into a fork while preserving commit history. A fork is a separate copy of a repository, and upstream is the original repository.

In plain words
What is it for?
Checking remotes and branch state, merging an upstream branch, resolving conflicts, and preparing a safe non-destructive fork update.
Why use it?
It keeps local commit hashes intact and avoids rewriting history or force-pushing while synchronising the fork.

Skill for Claude CodeCodex

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 skills/code-yeongyu/senpi/merge-upstream
Any agent
npx skills add code-yeongyu/senpi --skill merge-upstream
Clone the repo
git clone --depth 1 https://github.com/code-yeongyu/senpi

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for merge-upstream

README.md
[![agentmods](https://agentmods.dev/badge/skills/code-yeongyu/senpi/merge-upstream.svg)](https://agentmods.dev/skills/code-yeongyu/senpi/merge-upstream)
Your own site
<a href="https://agentmods.dev/skills/code-yeongyu/senpi/merge-upstream"><img src="https://agentmods.dev/badge/skills/code-yeongyu/senpi/merge-upstream.svg" alt="Measured on agentmods" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,601 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.00052 $0.01601
Opus 5 $0.00026 $0.00800
Sonnet 5 $0.00010 $0.00320
Haiku 4.5 $0.00005 $0.00160

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

Security

Grade A, and why

merge-upstream 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 5d 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.

.github/agent/skills/merge-upstream/SKILL.md · 168 lines

How it starts

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

Merge Upstream

Sync the current fork branch with upstream/<branch> using a merge commit by default. Preserve local commit hashes, keep push non-destructive, and never rewrite history.

Usage

Treat these as equivalent triggers:

/merge-upstream [--base=<branch>] [--ff-allow]
merge upstream [--base=<branch>] [--ff-allow]
sync fork with upstream

Options:

  • --base=<branch>: use that upstream branch instead of auto-detecting the upstream default branch.
  • --ff-allow: allow git merge --ff-only when the current branch has no unique local commits. Without this, use git merge --no-ff to leave an explicit sync commit.

Invariants

  • Do not run git rebase.
  • Do not run git push --force or git push --force-with-lease.
  • Do not bypass hooks or signing with --no-verify or --no-gpg-sign.
  • Ask before pushing.

Workflow

  1. Validate the repository:

    git rev-parse --is-inside-work-tree
    git branch --show-current
    git remote get-url upstream
    git remote get-url origin
    

    Abort on detached HEAD or missing upstream. If origin is missing, continue locally and skip push.

  2. Require a clean worktree:

    worktree_status=$(git status --porcelain) || exit 1
    test -z "$worktree_status"
    

    If dirty, stop and ask the user to clean or commit the changes, or use a clean task worktree.

  3. Detect the upstream target branch:

    • If --base=<branch> is provided, fetch and verify upstream/<branch>.
    • Otherwise run git remote set-head upstream -a, then read refs/remotes/upstream/HEAD.
    • If detection fails, ask the user for --base=<branch>.
  4. Fetch enough history for a reliable merge base:

    git rev-parse --is-shallow-repository
    git fetch --tags upstream "+refs/heads/${upstream_branch}:refs/remotes/upstream/${upstream_branch}"
    origin_branch_exists=false
    if git remote get-url origin >/dev/null 2>&1; then
      if ! origin_branch=$(git ls-remote --heads origin "refs/heads/${current_branch}"); then
        echo "failed to inspect origin/${current_branch}" >&2
        exit 1
      elif [ -n "$origin_branch" ]; then
        git fetch origin "+refs/heads/${current_branch}:refs/remotes/origin/${current_branch}" || exit 1
        origin_branch_exists=true
      else
        echo "origin/${current_branch} does not exist; current branch is unpublished"
      fi
    fi
    git merge-base HEAD "upstream/${upstream_branch}"
    

Read the full file on GitHub · 168 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. 5d ago First seen · 168 lines · 52 tokens per session scan A 8e07c9ecdb30

Subscribe to this mod's changes

merge-upstream is a skill published in the GitHub repository code-yeongyu/senpi (420 stars, last pushed today), licensed MIT. It adds 52 tokens to every session and 1,601 once invoked, about $0.0003 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.

Related

Other skills, from other repositories

transformers

This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning…

synthetic-sciences/openscience · 63 tokens

generate-image

Generate or edit images using AI models (FLUX, Gemini). Use for general-purpose image generation including photos, illustrations, artwork, visual assets, concept art, and any image that isn't a technical diagram or schematic. For flowcharts, circuits, pathways, and technical diagrams, use the scientific-schematics…

synthetic-sciences/openscience · 67 tokens

pi

Use when needing a minimal, extensible terminal AI coding agent harness in TypeScript with plugin architecture. Pi: minimalist terminal AI coding agent emphasizing simplicity and composability.

znlgis/opengis-skills · 35 tokens

speckit-archive

Archive a feature specification into main project memory after merge, resolving gaps and conflicts.

opsmill/infrahub-mcp · 21 tokens

speckit-critique-run

Perform a dual-lens critical review of the specification and plan from both product strategy and engineering risk perspectives before implementation.

opsmill/infrahub-mcp · 31 tokens

speckit-extract-run

Extract knowledge, guidelines, and ADRs from one or more completed spec directories into the project documentation system.

opsmill/infrahub-mcp · 28 tokens