factory-merge

factory-merge is a command for coding agents from watt-mind/factory. It costs 14 tokens per session (3,987 once invoked), scanned A, original, Apache-2.0.

A command that reviews open GitHub pull requests and merges the changes that meet the project’s review requirements. A pull request is a proposed code change awaiting review before it is added to the main codebase.

In plain words
What is it for?
Use it to review all open pull requests or selected ones, find orphaned or ticket-less changes, resolve fixable problems, and merge approved work one repository at a time.
Why use it?
It brings review, CI checks, conflicts, tickets, and merge ordering into one controlled process, reducing the chance of landing unsafe or incomplete work.

Command

Part of the core plugin — 2 skills, 13 commands, 4 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/watt-mind/factory/factory-merge
Clone the repo
git clone --depth 1 https://github.com/watt-mind/factory

Or install core, the plugin that ships this one along with the rest of its 2 skills, 13 commands, 4 agents.

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 factory-merge

README.md
[![agentmods](https://agentmods.dev/badge/commands/watt-mind/factory/factory-merge.svg)](https://agentmods.dev/commands/watt-mind/factory/factory-merge)
Your own site
<a href="https://agentmods.dev/commands/watt-mind/factory/factory-merge"><img src="https://agentmods.dev/badge/commands/watt-mind/factory/factory-merge.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 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,987 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.00014 $0.03987
Opus 5 $0.00007 $0.01994
Sonnet 5 $0.00003 $0.00797
Haiku 4.5 $0.00001 $0.00399

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

Security

Grade A, and why

factory-merge 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 4d 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.

plugins/core/commands/factory-merge.md · 118 lines

How it starts

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

Review and land the open PRs for this repository. My invoking this command is the human merge decision for routine changes — but the review must be real, and sensitive changes still come back to me.

Interpret $ARGUMENTS as specific PR numbers or Linear issue IDs; default is every open PR in this repo (gh pr list, cross-checked against the team's In Review tickets so orphaned PRs and ticket-less PRs both surface).

Merge serialization & per-repo lock: Merges are strictly serialized per repository. Never run concurrent merge supervisors or merge processes against the same repository; a merge run holds exclusive lock over merge execution for that repo to prevent race conditions where one process merges PRs another process has escalated or modified.

--include-escalated is a one-off override used only by the foreground TUI's explicitly confirmed merge all action. It means the human has decided that existing escalated labels are not a hold for this run: include those PRs in the review and merge them when they otherwise meet the normal MERGE bar. Do not treat it as permission to merge with red CI, unresolved conflicts, a failing base/smoke check, or a blocking review finding. Do not apply this override merely because an escalated PR is visible; it must be present in $ARGUMENTS.

Per PR, in this order

1. Review first — always, even when CI is green

Start from the ticket's ## Handoff comment — dispatch posts one per PR (PR link, verification result, UX critique verdict, files vs Owned Paths, risks). It tells you where to concentrate: a stated risk gets read first, a FIX-FIRST resolved critique means re-checking those fixes, an exceptions line on Files means the Owned Paths check below already has a suspect. A missing or vague Handoff is a (minor) protocol finding to note — and a reason to trust the diff less, not to skip the review.

CI passing is not the bar. Prefer spawning the factory-merge-reviewer agent for this step — one per PR, with the ticket, Handoff comment, Owned Paths, and the repo's escalate_paths in its prompt — so the full diff never enters this session's context; act on its MERGE/FIX/ESCALATE report (it never merges or edits; you do). Where subagents are unavailable, read the full diff yourself. Either way the review covers:

Read the full file on GitHub · 118 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. 4d ago First seen · 118 lines · 14 tokens per session scan A 1f9e9578c220

Subscribe to this mod's changes

factory-merge is a command published in the GitHub repository watt-mind/factory (12 stars, last pushed yesterday), licensed Apache-2.0. It adds 14 tokens to every session and 3,987 once invoked, about $0.0001 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-31.