mergetrain
AGENTS.md4 starsChanged 3 months agoMITView on GitHub
This repository contains mergetrain, a local deploy train for coding-agent worktrees. 1. Work on a task-specific branch and worktree. 2. Commit all changes before enqueueing. 3. Do not push deploy refs directly. For ordinary handoff, enqueue every named finished branch in the requested order with mergetrain enqueue --task <task> --branch <branch> and let mergetrain capture the exact SHAs. Stop after the last enqueue; asking to queue for validation does not authorize running validation. 4. Read mergetrain status --json first and…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,691 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- mergetrainSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
14 rules. About 1 is common, 3 are distinctive, and 10 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 9
Commit all changes before enqueueing.
- Very specific: line 10
Do not push deploy refs directly.
- Very specific: line 15
Read mergetrain status --json first and follow its structured next_action.
- Very specific: line 18
Use --auto only after explicit unattended-deploy approval.
- Very specific: line 30
Do not delete or rewrite remote refs/mergetrain/deploys/*.
- Distinctive: line 32
Treat public product surface as an owner-evidence budget.
- Very specific: line 38
Do not bump the version in feature or fix changes.
- Very specific: line 69
When changing production imports, keep the one-way boundaries documented in docs/design.md.
- Very specific: line 73
When changing public product surface, update the baseline and classification in docs/product-scope.md in the same change.
- Very specific: line 83
Before asking the user to run gh auth login, retry authentication outside the sandbox and verify both credential access and the API, for …
- Distinctive: line 87
If those external checks succeed, reuse the existing login.
- Very specific: line 90
Prefer the connector for supported GitHub reads/writes.
- Common: line 95
Never add provider-specific credentials to examples or tests.
- Very specific: line 96
Keep core provider-neutral.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.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
AGENTS.md
This repository contains mergetrain, a local deploy train for coding-agent
worktrees.
Agent operating rules
- Work on a task-specific branch and worktree.
- Commit all changes before enqueueing.
- Do not push deploy refs directly. For ordinary handoff, enqueue every named
finished branch in the requested order with
mergetrain enqueue --task <task> --branch <branch>and let mergetrain capture the exact SHAs. Stop after the last enqueue; asking to queue for validation does not authorize running validation. - Read
mergetrain status --jsonfirst and follow its structurednext_action. Usestatus --diagnoseonly for configuration, Git, runtime, or lock detail, andinspect <job-id>only for job evidence. - Use
--autoonly after explicit unattended-deploy approval. A bounded instruction to QA, deploy, verify, and finish end-to-end grants that approval for the named task and destination; do not ask for each opaque train ID. Auto jobs are bound to that Git destination and the approved gate, reuse, and verify policy; they must block if either identity changes. - Let one runner or daemon own merge and test. The default daemon may push and
verify only
--autojobs;daemon --validate-onlyhandles manual jobs but stops at a validated train and never deploys. - Fix blocked or failed work in the owning branch, commit a clean result, then
run
mergetrain retry <job-id>to replace that outcome with a freshly pinned job. Do not enqueue the same active branch again. Retry is for blocked/failed jobs only and does not itself authorize validation or deployment. - Do not delete or rewrite remote
refs/mergetrain/deploys/*; they are permanent recovery evidence. - Treat public product surface as an owner-evidence budget. Before
adding a CLI command or flag, config field, UI or network listener,
daemon/Hub behavior, MCP tool, recovery action, notification path, or reuse
control,
apply the admission test in
docs/product-scope.md, prefer consolidation, and record the measured cost, repeated workflow, or incorrect state. - 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; if the pending changes do not meet them, recommend waiting. When your change meets that section's patch-release criteria, say so at handoff and recommend a prompt patch release. - For requested upgrades or mixed-version failures, read
docs/upgrading.md. Keep the target release, check the live daemon as well as CLI/MCP, and adapt affected consumers using the release migration. Do not silently downgrade to satisfy an old contract assertion or stale process; preserve queued work and the existing approval scope.
Useful commands
python -m pytest -q -n auto --cov=mergetrain --cov-report=term-missing --cov-report=json:.coverage.json
python scripts/check_critical_coverage.py .coverage.json
PYTHONPATH=src python -m unittest discover -s tests
PYTHONPATH=src python -m mergetrain status --diagnose --json
PYTHONPATH=src python -m mergetrain init --project demo
python scripts/check_architecture.pyPytest is configured to import the current src/ checkout without an external
PYTHONPATH. If the full suite hits sandbox-only PermissionError failures for
localhost sockets or process inspection, do not repeat it in the same sandbox:
rerun it once outside the sandbox. Invoke mergetrain with the intended
virtualenv's Python; gate commands automatically prioritize sibling tools from
that environment.
When changing production imports, keep the one-way boundaries documented in
docs/design.md; scripts/check_architecture.py is a blocking CI check. Do not
silence it with broad exceptions—document and encode any legitimate new edge.
When changing public product surface, update the baseline and classification in
docs/product-scope.md in the same change. Prefer consolidating an existing
surface; do not turn an implementation possibility into a feature without a
measured cost, concrete incorrect state, or repeated workflow need.
GitHub CLI authentication
- The Codex sandbox may be unable to read
ghcredentials from the macOS Keychain. A sandboxedgh auth statusorgh auth tokenfailure is not proof that the stored token is invalid. - Before asking the user to run
gh auth login, retry authentication outside the sandbox and verify both credential access and the API, for example withgh auth token -h github.com >/dev/nullandgh api user --jq .login. Never print or log the token. - If those external checks succeed, reuse the existing login. Request a new login only when the same checks genuinely fail outside the sandbox.
- The Codex GitHub connector and the local
ghCLI use separate credentials. Prefer the connector for supported GitHub reads/writes; use externally runghas the fallback when the connector lacks repository permission.
Boundaries
- Never add provider-specific credentials to examples or tests.
- Keep core provider-neutral; adapters belong under
integrations/or in a separate service repository. - Gate and verify commands run through
/bin/sh; document new shell execution behavior clearly.
Imported Claude Cowork project instructions
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.

