mergetrain

mergetrain is a skill for Claude Code, Codex from yongjip/mergetrain. It costs 60 tokens per session (587 once invoked), scanned A, a copy of mergetrain, MIT.

A workflow for combining completed work from several local coding branches in a set order. A branch is a separate line of code changes; the workflow queues those branches for one integration process that can test and publish the combined result when authorized.

In plain words
What is it for?
Use it to queue parallel agent branches, preserve their exact commits, run an approved integration and test process, and recover an existing integration queue.
Why use it?
It prevents multiple coding agents from integrating the same branches in conflicting ways. It also defines who may validate, deploy, or recover the integration and when those actions are allowed.

Skill for Claude CodeCodex

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

Good fit Use it to queue parallel agent branches, preserve their exact commits, run an approved integration and test process, and recover an existing integration queue.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yongjip/mergetrain/candidate
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 candidate
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/candidate.svg)](https://agentmods.dev/skills/yongjip/mergetrain/candidate)
Your own site
<a href="https://agentmods.dev/skills/yongjip/mergetrain/candidate"><img src="https://agentmods.dev/badge/skills/yongjip/mergetrain/candidate.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 587 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 88% copy Near-identical to another mod 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.00060 $0.00587
Opus 5 $0.00030 $0.00293
Sonnet 5 $0.00012 $0.00117
Haiku 4.5 $0.00006 $0.00059

Measured 3d ago against content hash 0e6d64df7287, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 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.

Origin

This is a copy

88% identical to mergetrain — 8 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

benchmarks/discovery/eligibility/candidate-skill.md · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 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 · 46 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 · 46 lines · 60 tokens per session scan A 0e6d64df7287

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 60 tokens to every session and 587 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 88% identical to mergetrain, differing in 8 lines, and is treated as a copy.

Related

Other skills, from other repositories

subagent-driven-branch-ref-froze-stranded-commits

Diagnose and recover from "PR merged, but half my work is missing from main" cases in superpowers:subagent-driven-development (or similar one-fresh-subagent-per-task) sessions, where committed work survives in the worktree's HEAD chain but never makes it into the pushed branch ref. Use when ANY of these appears: (1)…

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

git-add-u-after-async-post-commit-hook

Prevent (and recover from) git add -u + git commit --amend + git push --force-with-lease catastrophically rolling thousands of unrelated tracked-file deletions into an amended commit when the project has an async post-commit hook that mutates tracked files (e.g. regenerates docs/site/.html, docs/site/index.html…

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

async-post-commit-hook-commit-orphaned-by-squash-merge

In a repo with an ASYNC/background post-commit hook (one that fires after a commit and creates its OWN follow-up commit — [auto-docs] …, a docs/site regen, a changelog/checkbox tick), the hook's commit can land LOCAL-ONLY after your git push already captured just your work commit, so it is never in the PR and gets…

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

working-tree-edits-stranded-on-squash-merge

Diagnose and prevent "I made the fix but it's not on main" cases where the fix was applied in the working tree via Edit / Write but never git added before the squash-merge. Use when: (1) you squash-merged a PR and the user reports the issue is back, (2) git status after the merge shows uncommitted changes for files…

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

sidecar

Use the sidecarsync CLI to read, update, and synchronize Sidecar notes or state in repos with .sidecar configurations. Covers peer selection, standalone repos, per-file rules, and fork recovery.

anteprojector/sidecar · 44 tokens

git-amend-hits-async-post-commit-hook-commit

Use when a git commit --amend silently rewrites the WRONG commit in a repo that has an async/background post-commit hook. Trigger: after a normal commit, git log shows an unexpected extra commit on top that a background hook created ([auto-docs] ..., a docs/site regen, a changelog/checkbox tick) — and a later --amend…

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