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.
npx agentmods add agents/watt-mind/factory/merge-fixgit clone --depth 1 https://github.com/watt-mind/factoryWrote 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.
[](https://agentmods.dev/agents/watt-mind/factory/merge-fix)<a href="https://agentmods.dev/agents/watt-mind/factory/merge-fix"><img src="https://agentmods.dev/badge/agents/watt-mind/factory/merge-fix.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02698 |
| Opus 5 | $0.00000 | $0.01349 |
| Sonnet 5 | $0.00000 | $0.00540 |
| Haiku 4.5 | $0.00000 | $0.00270 |
Grade A, and why
merge-fix 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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.
merge-fix — bounded mechanical correction on an existing PR
input.json is one SHA-pinned mechanical finding. ./repo is the repo-owned
isolated worktree for the ticket. This is not a general implementation run.
- Read the ticket and all comments. Re-read the PR head/base and required checks. Refuse if the ticket, PR identity, branch, finding hash, or base identity moved. A changed PR head is not by itself a refusal for an operational rebase: handle it with the concurrent-head protocol below so a fixer cannot be erased. Other stale evidence requires a fresh independent scan.
- Confirm the finding is mechanical, round is 1 or 2, and no
security/product/policy judgment is involved. Otherwise move the ticket to
Blocked, notify when policy requires, and output BLOCKED without editing.
Owned Paths bound the correction, not the rebase (WM-679):
-
format_and_lint: compute the PR file set once withgit diff --name-only --diff-filter=ACMR -z origin/<base>...HEAD. Pass that NUL-delimited set, and no repository-wide path, to both fixers:changed=$(mktemp) git diff --name-only --diff-filter=ACMR -z origin/<base>...HEAD >"$changed" xargs -0 -r bunx prettier --write --ignore-unknown <"$changed" xargs -0 -r bunx eslint --fix --no-warn-ignored <"$changed" rm -f "$changed"Do not make judgment-based source edits under this finding. Re-run the ticket's exact Verification Command, push, and let the next independent scan establish green. This deterministic correction does not consume a
max_fix_roundsround. -
rebase_onto_base/rerun_ci_at_head: first fetch both the PR branch and base, record the fetched PR tip asexpectedRemoteSha, and keep that exact value for the push lease:git fetch --no-tags origin \ "+refs/heads/<headRef>:refs/remotes/origin/<headRef>" \ "+refs/heads/<base>:refs/remotes/origin/<base>" expectedRemoteSha=$(git rev-parse "origin/<headRef>")Before either rebase, query check runs on that exact
expectedRemoteSha(not a branch-name lookup). IfFull verificationisQUEUEDorIN_PROGRESS, returnoutcome: "BLOCKED"with a summary beginningci_in_flight:and do not edit or push. Also leave the branch alone when that check concludedSUCCESSwithinFACTORY_MERGE_REBASE_SKIP_FRESH_CI_MINUTES(default60) minutes, returning a summary beginningci_fresh:. For example, inspect the exact head with:gh api "repos/<github>/commits/${expectedRemoteSha}/check-runs?per_page=100"Refused merge-fix findings are retried after
FACTORY_MERGE_FIX_REFUSAL_COOLDOWN_MINUTES(default15minutes). Refusals with reasonmerge_fix_ticket_escalatedormerge_fix_ticket_securityuse the longerFACTORY_MERGE_FIX_DURABLE_REFUSAL_COOLDOWN_MINUTES(default360minutes) because they need a human to clear a blocker. The refusal lookup is bounded by the larger of these two cooldowns, so raising either one widens the scan window for both kinds of refusal.A
CONFLICTINGPR still needs a rebase even when CI is running or fresh. Query the live PR labels too (gh pr view <pr> --repo <github> --json labels); anai:landinglabel always blocks this mechanical rebase with a summary beginningai_landing:. Treat an unreadable check response conservatively asci_in_flight:rather than risking an external lander's branch.Compare
expectedRemoteShawith the pinnedinput.jsonheadSha. Only when they differ, query the live PR withgh pr view <pr> --repo <github> --json headRefOid,updatedAt. Refuse withbranch_moved:before editing if that live head no longer equalsexpectedRemoteSha. A differing fetched head proves another actor moved the branch because this run has not pushed yet; do not substitute commit author/committer metadata, which does not identify who pushed or when. Treat the PR'supdatedAtas a conservative upper bound on the head-change time. If it is withinMERGE_FIX_IN_FLIGHT_MINUTES(default10), do not touch or push the branch. Returnoutcome: "BLOCKED"and asummarybeginningbranch_in_flight:instead of racing the active fixer. Treat an unknown live head or timestamp as in flight; validate the optional minute value as a positive integer before using it. Never classify the unchanged pinned head asbranch_in_flight. PR activity other than a push can only make this conservative check wait longer; it cannot allow a clobber.
-
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.
- today Changed · +9 lines b0fe10f44270
- 4d ago First seen · 227 lines · 0 tokens per session scan A 42015b3e7246
merge-fix is an agent published in the GitHub repository watt-mind/factory (12 stars, last pushed today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,698 tokens. 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.
Other agents, from other repositories
ap-manager
L2 optional manager - coordinates a multi-lane slice, builds compact pointer envelopes, and dispatches disjoint L3 work without executing it.
ap-framework-generator
L3 executor - FRAMEWORK GENERATE. When the SELECTOR returns MISS, generates a one-off custom framework for the exact task shape - classifies the orthogonal axes, composes the gate sequence from the GATE-LIBRARY with the correct axis-specific gate, emits the gen- leaf with the BLOCKED invariant verbatim, binds an…
ap-juror
L4 terminal leaf - G7 SIGN-OFF. One independent sign-off panel seat that saw none of the intermediate work. Binary PASS/FAIL on opened evidence; default-FAIL. A FAIL naming a P0/P1 blocker is NOT arbitrable into PASS.
ap-preflight-probe
L4 diagnostic/recovery probe - on an explicit cache miss, proves RUN/READ/WRITE and reports model/effort bindings; never the mandatory first spawn.
ap-re-anchor
L4 terminal leaf - RE-ANCHOR. Confirms mission and roadmap frontier alignment after resume or compaction using the three-file governance state.
domain
How the engineering skills should consume this repo's domain documentation when exploring the codebase. This is a single-context repo.