mergetrain
CLAUDE.md4 starsChanged 3 months agoMITView on GitHub
This repository ships mergetrain, a local deploy train for coding-agent worktrees. Keep phone-facing results short and actionable. Setup and phrasebook details live in docs/mobile.md. - Every JSON payload carries contract_version; ignore unknown keys and fail closed on unknown safety actions. - Requested upgrades keep the target release: check CLI, live daemon, and MCP versions separately, read the migration, and adapt affected consumers. A contract/version mismatch alone is not grounds for rollback. Preserve queued work and destination/policy bindings; follow the upgrade…
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- mergetrainSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Start with mergetrain status --json.
- Distinctive: line 26
Commit a clean HEAD before handing work off.
- Very specific: line 27
Read mergetrain status --json and follow its next action before changing queue state.
- Distinctive: line 29
Never push configured integration refs directly.
- Very specific: line 34
Only a separately authorized runner uses deploy or a daemon.
- Very specific: line 41
Every JSON payload carries contract_version.
- Distinctive: line 48
Use English for committed code, docs, issues, PRs, comments, release notes, labels, and commit messages.
- Very specific: line 50
Run from the repository root or pass --repo <path>.
- Very specific: line 51
Start with mergetrain status --json.
- Distinctive: line 53
Prefer structured output. Raw logs may contain sensitive command output.
- Distinctive: line 54
Keep the six-verb public grammar and product-scope ceiling intact.
- Very specific: line 55
Do not bump the version in feature or fix changes.
- Distinctive: line 95
Stop for new authority when task scope or destination changes, a product decision is needed, or recovery crosses a destructive/reconcile …
- Very specific: line 100
Do not memorize repair commands.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — operating mergetrain from Dispatch
This repository ships mergetrain, a local deploy train for coding-agent worktrees. Keep phone-facing results short and actionable. Setup and phrasebook details live in docs/mobile.md.
Shared operating protocol
<!-- BEGIN GENERATED: mergetrain-agent-protocol -->Purpose: Serialize committed local task branches through one merge/test/push/verify runner.
Existing queues and explanations
- Existing mergetrain repositories keep status → enqueue → stop even for one branch. Queue counts alone do not establish health, runner ownership, or recovery needs; read
health,state, andnext_actiontogether. - For explanation-only requests, read the skill documentation when permitted and explain the procedure without Git or product commands. Distinguish hypothetical steps from observed state.
Current command reference
- The v3 core commands are
init,status,enqueue,validate,deploy, andinspect. - Start with
mergetrain status --json. Usemergetrain status --diagnose --jsononly for configuration, Git, runtime, or lock detail, andmergetrain inspect JOB_ID --jsonfor job evidence.doctoris removed, not an alias forstatus --diagnose. - Confirm uncertain syntax with the installed
mergetrain --versionand command-specific--helponly when command execution is permitted. Otherwise use this reference and identify missing details; do not invent commands or copy older syntax from unversioned web results. Inspection andnext_actiondo not authorize recovery or deployment.
Rules
- Work on a task-specific branch and worktree.
- Commit a clean HEAD before handing work off.
- Read mergetrain status --json and follow its next action before changing queue state.
- 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.
- 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
deployor 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. - Requested upgrades keep the target release: check CLI, live daemon, and MCP versions separately, read the migration, and adapt affected consumers. A contract/version mismatch alone is not grounds for rollback. Preserve queued work and destination/policy bindings; follow the upgrade procedure.
deploymeans the atomic Git ref update plus configured verification. A downstream provider release is separate.
<!-- END GENERATED: mergetrain-agent-protocol -->Repository-specific rules
- Use English for committed code, docs, issues, PRs, comments, release notes, labels, and commit messages.
- Run from the repository root or pass
--repo <path>. - Start with
mergetrain status --json; usestatus --diagnoseonly for configuration, Git, runtime, or lock detail. - Prefer structured output. Raw logs may contain sensitive command output.
- Keep the six-verb public grammar and product-scope ceiling intact.
- Do not bump the version in feature or fix changes; add the changelog entry
under
## Unreleased. Only a requested release-preparation change bumps the version, after applying the cadence rules indocs/release.md#when-to-cut-a-release; recommend waiting when the pending changes do not meet them. When a change meets that section's patch-release criteria, say so at handoff and recommend a prompt patch release.
GitHub CLI authentication
The sandbox may not read credentials stored in the macOS Keychain. Before
requesting a new login, verify gh auth token -h github.com >/dev/null and
gh api user --jq .login outside the sandbox. Never print a token. The Codex
GitHub connector and local gh use separate credentials.
Normal actions
These do not ship code:
mergetrain status --json
mergetrain inspect <job-id> --json
mergetrain validate
mergetrain enqueue --task "<task>" --branch <branch>
mergetrain gc --jsonA task agent enqueues every named finished branch in the requested order, then stops. Asking to queue for validation does not authorize running validation.
Deploy policy
A deploy ships code. Do not infer permission from an ordinary request to edit, merge, integrate, land, or enqueue.
With explicit bounded authority to QA, deploy, verify, and finish the named
task, enqueue with hidden --auto when unattended execution is appropriate and
let one runner finish without opaque train-ID prompts. Without that authority,
run mergetrain deploy, show its human-readable exact plan, and wait for the
interactive confirmation.
Stop for new authority when task scope or destination changes, a product decision is needed, or recovery crosses a destructive/reconcile boundary.
Exceptional state
Do not memorize repair commands. Read status.next_action and follow its exact
command. Never edit queue SQLite directly or delete/rewrite remote
refs/mergetrain/deploys/*.
Destructive cleanup (gc --apply, branch deletion), cancellation, forced
unlock, and reconciliation require the authority stated by status or the user.
Convenience scripts
scripts/mt-status.shdelegates tomergetrain status.scripts/mt-validate.shdelegates tomergetrain validate.scripts/mt-deploy.shdelegates to the interactivemergetrain deploy.
Reporting style
Lead with state and the next decision. Example:
READY: 3 jobs passed validation. Next:
mergetrain deploy(deployment approval required).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

