MockServer is a testing server and proxy that imitates APIs, records and changes network traffic, and deliberately introduces failures. It is for developers testing applications against unavailable dependencies, debugging requests, and checking how systems handle degraded services across several network protocols. The catalogue add-ons help operate, configure, and test MockServer.
Borrowing it
Nothing to install: this file belongs to mock-server/mockserver-monorepo. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/mock-server/mockserver-monorepo/master/.claude/commands/worktree-merge.mdgit clone --depth 1 https://github.com/mock-server/mockserver-monorepoWrote 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/commands/mock-server/mockserver-monorepo/worktree-merge)<a href="https://agentmods.dev/commands/mock-server/mockserver-monorepo/worktree-merge"><img src="https://agentmods.dev/badge/commands/mock-server/mockserver-monorepo/worktree-merge/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/mock-server/mockserver-monorepo/worktree-merge"><img src="https://agentmods.dev/badge/commands/mock-server/mockserver-monorepo/worktree-merge.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00022 | $0.01055 |
| Opus 5.5 | $0.00009 | $0.00422 |
| Sonnet 5.5 | $0.00004 | $0.00211 |
| Haiku 4.5 | $0.00002 | $0.00105 |
Grade A, and why
worktree-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 1mo 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.
What it actually says
Follow the worktree merge workflow in .opencode/rules/worktree-workflow.md (steps 3–8). Do not skip any gate unless the user explicitly says "skip gate X".
Run all four gates in order. Any failure stops the merge and leaves the worktree intact for inspection — never delete a worktree on a failed merge.
-
Sanity check — confirm CWD is inside a worktree (
git rev-parse --git-common-dirdiffers from.git). If not, refuse and tell the user to/worktreefirst. -
Gate 1 — Tests. Detect changed modules from
git diff --name-only origin/master...and run targeted Maven tests plus mockserver-core always:./mvnw verify -pl :mockserver-core $(...) -DforkCount=1 -DreuseForks=false -fae -Djacoco.skip=trueFor long runs, launch the build in the background (
Bash run_in_background, or./cmd > log 2>&1 &) and poll the log. -
Gate 2 — Lint / checkstyle / type checks. Maven's
validatephase runs checkstyle. For frontend changes also runnpm run lint && npm run build. -
Gate 3 — Adversarial review. Spawn
review-finalsubagent ongit diff origin/master...HEAD. Block on BLOCK verdict. Quote any concerns back to the user. -
Gate 4 — Summary & proceed. Under the DVRR operating model (
.opencode/rules/operating-model.md), gates 1–3 are the authority — they replace human pre-approval. Show:git diff --stat origin/master...HEAD- List of changed files
- Gate 1/2/3 results in one line each Then proceed automatically to the locked rebase. Do NOT wait for approval. Fail-closed: if any of gates 1–3 did not return a clean PASS, stop and leave the worktree intact. A user can interject at any time to halt.
-
Locked rebase (linear history — never a merge commit). Time the wait to acquire
flock --timeout 300 "$(git rev-parse --git-common-dir)/agent-rebase.lock"(the common dir so all worktrees share one lock — a relative.git/…path resolves per-worktree and would not serialise; e.g. capture an epoch before and after theflock), then inside the lock:git fetch origin master --quiet git rebase origin/master # rebase, never merge git push origin HEAD:master # always a fast-forward after the rebaseAlways rebase, never merge —
masteris kept a strictly linear history with no merge commits. Do NOTgit mergethe worktree branch into master, do NOT usegit pullwithout--rebase, and when several worktrees are ready, rebase them one at a time under the lock (never via an intermediate "integration branch"). See.opencode/rules/worktree-workflow.md→ Linear History — No Merge Commits. Ifflockis missing (older macOS), fall back to themkdir-based mutex documented in the rule.Serialisation telemetry (§18.7 /
[[decision-log]]). If the lock wait was non-trivial, recordserialisation.merge_lock_s(seconds waited onflock) into this unit's.tmp/decisions/<id>.mdtelemetry block. If the rebase hit conflicts, also recordserialisation.contention_s(seconds spent resolving them). -
Re-verify the integrated result (spec §8.4). If the rebase in step 6 pulled in other units' commits (i.e.
origin/masteradvanced since the worktree branched), re-run the Gate 1 test command against the integrated tip before cleanup — passing in isolation does not prove the merged result passes. If the rebase was a clean fast-forward with no new upstream commits, this is a no-op. -
Cleanup. On successful push only:
cd "$(git rev-parse --show-toplevel)/.." git worktree remove "${WORKTREE_DIR}" --force git branch -D "${BRANCH}" rm -f .tmp/active-worktree -
Report. Summarise to the user: gate results, commit hash on master, worktree cleaned up.
If the user provided additional instructions (e.g. "skip user approval", "skip tests because we already ran them"): $ARGUMENTS — only honour explicit skip flags, never silently drop a gate.
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.
- 1mo ago First seen · 49 lines · 22 tokens per session scan A 59ca979ebdba
worktree-merge is a command published in the GitHub repository mock-server/mockserver-monorepo (4,999 stars, last pushed today), licensed Apache-2.0. It adds 22 tokens to every session and 1,055 once invoked, about $0.0001 per session on Opus 5.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.
Other commands, from other repositories
merge-conflict-analysis
You are analyzing merge conflicts for PR #${{ pr-number }}.
release-notes
Generate consistent, well-structured release notes from git history. Triggered on release tags following semver patterns (v..) to produce categorized changelog with breaking changes, features, fixes, and contributor attribution.
repo-audit
Audit a codebase (local or remote GitHub/GitLab) against architecture principles and requirements, surfacing drift, risk, and missing decisions.
pr
Handle the full workflow from current branch state to an open, CI-monitored pull request.
release-plan
A release-planning command for a software change. It documents the release scope, rollback plan, gradual or full rollout, and monitoring before waiting for human approval.
codex-review
Use when asked to check, turn on, turn off, or switch this repo's Codex review mode (local, github, or off), or to report the effective mode and Codex sandbox status.