mergetrain

mergetrain is a skill for Claude Code, Codex from yongjip/mergetrain. It costs 75 tokens per session (614 once invoked), scanned A, original, MIT.

A workflow for combining committed branches from multiple coding agents working in separate Git worktrees. A worktree is a separate local checkout of the same repository, and the workflow integrates branches in a specified order.

In plain words
What is it for?
Use it to enqueue finished agent branches, merge them in order, run the authorized validation workflow, push the integration result, and recover from an interrupted push when permitted.
Why use it?
It gives one authorized runner responsibility for merging, validation, and pushing, reducing conflicts over shared integration branches. It also defines boundaries for queueing, deployment, recovery, and destructive actions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to enqueue finished agent branches, merge them in order, run the authorized validation workflow, push the integration result, and recover from an interrupted push when permitted.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yongjip/mergetrain/baseline
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.

Any agent
npx skills add yongjip/mergetrain --skill baseline
Clone the repo
git clone --depth 1 https://github.com/yongjip/mergetrain

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 mergetrain

README.md
[![agentmods](https://agentmods.dev/badge/skills/yongjip/mergetrain/baseline.svg)](https://agentmods.dev/skills/yongjip/mergetrain/baseline)
Your own site
<a href="https://agentmods.dev/skills/yongjip/mergetrain/baseline"><img src="https://agentmods.dev/badge/skills/yongjip/mergetrain/baseline.svg" alt="Measured on agentmods" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 614 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00075 $0.00614
Opus 5 $0.00037 $0.00307
Sonnet 5 $0.00015 $0.00123
Haiku 4.5 $0.00007 $0.00061

Measured 2d ago against content hash 3c083b1fa32f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

mergetrain 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 2d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

benchmarks/discovery/eligibility/baseline-skill.md · 52 lines

How it starts

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

Integrate parallel coding-agent branches

Purpose: Serialize committed local task branches through one merge/test/push/verify runner.

Rules

  1. Work on a task-specific branch and worktree.
  2. Commit a clean HEAD before handing work off.
  3. Read mergetrain status --json and follow its next action before changing queue state.
  4. Enqueue every named finished branch in the requested order using only its task and branch; mergetrain resolves the worktree and captures the exact commits. Stop after the last successful enqueue unless the user explicitly authorized validation or the complete validation-and-deployment workflow.
  5. Never push configured integration refs directly. One authorized runner owns validation and deployment; recovery and destructive actions require their stated approval.

Safety boundary

  • A task agent enqueues every named finished branch, then stops. "Queue for validation" authorizes enqueue only; only an explicit request to run validation or the complete end-to-end workflow authorizes validate.
  • Only a separately authorized runner uses deploy or a daemon.
  • Deployment requires either confirmation of the human-readable exact plan or prior bounded unattended approval. Agents never select train IDs or supply plan hashes; structured evidence may include identifiers for inspection.
  • Unattended approval is bound to the exact destination and execution policy. Any change blocks before push.
  • Recovery and destructive cleanup require their stated approval. Follow status.next_action; never rewrite permanent deploy audit refs.

Stable machine contract

  • Every JSON payload carries contract_version; ignore unknown keys and fail closed on unknown safety actions.
  • deploy means the atomic Git ref update plus configured verification. A downstream provider release is separate.

Use the plugin's MCP tools when they are available. Start with mergetrain_status; its next action is guidance, not deployment authority. Routine task agents call mergetrain_enqueue for every named committed, clean branch in order and stop after the last successful handoff.

Read the full file on GitHub · 52 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. 2d ago First seen · 52 lines · 75 tokens per session scan A 3c083b1fa32f

Subscribe to this mod's changes

mergetrain is a skill published in the GitHub repository yongjip/mergetrain (3 stars, last pushed 2d ago), licensed MIT. It adds 75 tokens to every session and 614 once invoked, about $0.0004 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-09-05.

Related

Other skills, from other repositories

dev-task

A set of rules for handling development work in approved repositories, including when to use the main branch or a separate worktree, which is an isolated copy of a repository.

yunsii/wezdeck · 69 tokens

prep-pr-close-keyword-auto-closes-issue

Diagnose and prevent the trap where a scaffolding/prep/planning/handoff PR (one that ships a paste-ready prompt, an ADR, an implementation plan, or any docs-only artefact describing FUTURE work) contains a close-keyword like closes #N / fixes #N / resolves #N in its TITLE or BODY, which GitHub auto-applies at merge…

wan-huiyan/agent-traffic-control · 493 tokens

cross-worktree-spec-handoff-via-checkout-paths

Pass a shared file between two parallel sessions in different worktrees or branches, without merging to main first — a design spec, docs, a handoff prompt, a mockup. git checkout -- stages it. Use when a session says "the file doesn't exist". Not co editing.

wan-huiyan/agent-traffic-control · 79 tokens

docs-branch-off-feature-branch-smuggles-code

Catch the bug class where a "docs follow-up" PR silently ships the parent feature's code under a docs(sN): title because the docs branch was created from the current working branch (a feature branch), not from origin/main. Use when: (1) you just opened a PR titled docs(...) or chore(...) after wrapping up a feature…

wan-huiyan/agent-traffic-control · 454 tokens

parallel-pr-scope-overlap-tiebreaker-delta-check

Before applying a handoff prompt's tiebreaker default ("merge the first-mover", "the clean-against-main one", "the one with reviewer APPROVE") to pick a winner between two parallel PRs that implemented the SAME scope, run gh pr diff on BOTH and audit for substantive deltas. Use when: (1) a session prompt or handoff…

wan-huiyan/agent-traffic-control · 384 tokens

pr-conflict-from-mid-flight-merges

A pull request that was clean when you opened it now says on GitHub "This branch has conflicts that must be resolved", because others landed on main over the days it sat open. Use when gh pr view N --json mergeable,mergeStateStatus returns CONFLICTING and DIRTY, when your branch carries commits you do not recognise…

wan-huiyan/agent-traffic-control · 146 tokens