agentleFS
gwendallgwendall/skills/skills/engineering/multi-agent-repo/SKILL.md

multi-agent-repo

Skill0 starsChanged 17 days agoMITView on GitHub

Audit and bootstrap a repository for many concurrent coding agents without merge races, repeated qualification, or runaway CI. Use when agents share a repository through worktrees, when parallel PRs keep invalidating each other, when setting up a new project for agent teams, or when designing immutable qualification and a serialized merge lane. Not for ordinary single-agent feature work or CI cost diagnosis alone.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. Tamircohen28/tamirs-superpowers★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository9 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. About 0 are common, 21 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈21

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Bootstrap: add the smallest useful control plane through an isolated worktree and pull request.

    line 34
  2. Distinctive:

    Operate: create a task worktree or explain the normal agent lifecycle.

    line 36
  3. Distinctive:

    If the request is only to find an Actions cost regression, keep the scope to cost diagnosis rather than bootstrapping this entire system.

    line 40
  4. Distinctive:

    Read references/control-model.md when choosing the coordination model.

    line 56
  5. Distinctive:

    Create a dedicated setup worktree.

    line 64
  6. Distinctive:

    Add a short root AGENTS.md with only repository-specific rules.

    line 66
  7. Distinctive:

    Add deterministic impact and policy tests before optimizing the workflows.

    line 67
  8. Distinctive:

    Add a semantic-overlap check for movement of the default branch.

    line 72
  9. Distinctive:

    Only then enable required checks and branch restrictions.

    line 75
  10. Distinctive:

    Do not switch on branch protection against check names that have never reported success.

    line 77
  11. Distinctive:

    Never reset, clean, reuse, or delete another agent's worktree or branch.

    line 86
  12. Distinctive:

    When authorized to start a task, the included helper creates a worktree without deleting or overwriting anything:

    line 90
  13. Very specific:

    Run bash scripts/agent-preflight.sh [repo-path] at the start of agent work.

    line 97
  14. Distinctive:

    If the orchestrator cannot set the initial working directory, wrap its launch command or reject the launch.

    line 109
  15. Distinctive:

    Run the read-only context helper from this skill directory and record all three values:

    line 114
  16. Distinctive:

    Run long or premium tests only after deterministic checks pass.

    line 126
  17. Distinctive:

    If multiple products are independent, use domain lanes: unrelated lanes may keep moving while a candidate requalifies, but a later …

    line 149
  18. Distinctive:

    When agents share one GitHub user or token, documentation cannot distinguish a developer from the integrator.

    line 153
  19. Distinctive:

    Keep each artifact independently useful.

    line 171
  20. Distinctive:

    Do not change billing, credentials, branch protection, environments, repository permissions, or merge state unless the user requested that …

    line 178
  21. Distinctive:

    Stop after one infrastructure retry on the same SHA unless the user explicitly asks for monitoring.

    line 182
  22. Distinctive:

    Never bypass missing qualification with an admin merge merely to finish the setup.

    line 184

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Multi-agent repository operations

Build a control plane in which agents work in parallel but integration is serialized. Do not solve coordination by repeatedly merging the moving default branch into every task branch.

The durable system has four layers:

  1. A launcher creates a unique branch and linked worktree before an agent starts.
  2. Repository-local AGENTS.md files state the project-specific contract.
  3. Impact planning, stable gates, and exact-SHA evidence enforce the contract.
  4. One identity owns the final merge lane.

Instructions alone are not enforcement. Prefer executable checks and server-side permissions for every invariant whose violation can corrupt the default branch or restart expensive qualification.

Requirements

Local helpers require Git, Bash, and standard POSIX command-line utilities. GitHub inspection and rollout require an authenticated gh CLI. Non-GitHub repositories can still use the local worktree, contract, and qualification model. Audit mode is read-only.

Select the mode

  • Audit: inspect an existing repository and report gaps without writing.
  • Bootstrap: add the smallest useful control plane through an isolated worktree and pull request.
  • Operate: create a task worktree or explain the normal agent lifecycle.
  • Integrate: qualify and merge a frozen candidate. Treat remote settings, labels, checks, and merges as external mutations requiring user authorization.

If the request is only to find an Actions cost regression, keep the scope to cost diagnosis rather than bootstrapping this entire system.

Start with evidence

For an existing repository, run the read-only audit from this skill directory:

bash scripts/audit-repo.sh /absolute/path/to/repository [owner/repository]

Inspect existing AGENTS.md, contributor docs, worktree state, workflows, branch protection, repository plan, and dirty changes before proposing edits. Preserve unrelated work and existing policy. A simple repository with two agents and fast tests does not need a custom merge service.

Read references/control-model.md when choosing the coordination model. Read references/agents-contract.md when creating or revising repository instructions. Read references/github-rollout.md before changing GitHub settings or CI.

Bootstrap in this order

  1. Create a dedicated setup worktree. Never edit a shared or dirty checkout.
  2. Record the current default-branch SHA and existing protections.
  3. Add a short root AGENTS.md with only repository-specific rules.
  4. Add deterministic impact and policy tests before optimizing the workflows.
  5. Make required gates stable: every pull request reports a conclusion, while unaffected work exits cheaply inside the workflow.
  6. Separate automatic deterministic checks from long or premium qualification.
  7. Store qualification as evidence for one exact source SHA.
  8. Add a semantic-overlap check for movement of the default branch.
  9. Establish one merge identity and an ordered ready queue.
  10. Observe the new gates green on a real pull request.
  11. Only then enable required checks and branch restrictions.

Do not switch on branch protection against check names that have never reported success. Do not make "branch must be up to date" the coordination mechanism in a busy repository.

Non-negotiable invariants

Isolate work

  • One task, one branch, one linked worktree.
  • Never reset, clean, reuse, or delete another agent's worktree or branch.
  • The launcher should place the agent in its worktree; do not rely on the agent remembering to create one after it starts.

When authorized to start a task, the included helper creates a worktree without deleting or overwriting anything:

bash scripts/create-agent-worktree.sh TASK-ID [base-ref] [destination-parent]

Run bash scripts/agent-preflight.sh [repo-path] at the start of agent work. Add --require-clean when checking a newly created worktree.

Wire isolation into the orchestrator before starting the agent; an instruction to an already-running agent is too late. Use porcelain mode to obtain the directory for the session's cwd:

task_path="$(bash scripts/create-agent-worktree.sh --porcelain TASK-ID BASE-REF WORKTREE-PARENT)"
launch-agent --cwd "$task_path"  # replace with the orchestrator's real command

If the orchestrator cannot set the initial working directory, wrap its launch command or reject the launch. Record that real wrapper command in AGENTS.md.

Qualify immutable revisions

Run the read-only context helper from this skill directory and record all three values:

bash scripts/qualification-context.sh /absolute/path/to/task-worktree

Checks, artifacts, reviews, and merge commands must refer to QUALIFIED_HEAD, not a moving branch name. A later push creates a new candidate. Metadata events on an unchanged pull request must not manufacture or invalidate evidence.

Run long or premium tests only after deterministic checks pass. Trigger them once for the frozen affected candidate. The expensive trigger must not cancel, skip, or replace the ordinary checks.

Treat movement of the default branch semantically

Being behind the default branch is not itself a failure. Before integration, compare changes since QUALIFIED_BASE against the candidate:

  • Same files, textual conflicts, shared infrastructure, owned workspace, transitive dependency, or unresolved graph edge: integrate once and requalify the affected candidate.
  • Proven disjoint: retain the frozen head and its evidence.

The overlap implementation must fail closed for unknown ownership, root build entry points, shared CI, and dependency edges it cannot resolve.

Serialize integration, not development

Agents may develop, test, review, and qualify concurrently. One integrator owns the state transition into the default branch. The merge command must protect the expected head SHA.

If multiple products are independent, use domain lanes: unrelated lanes may keep moving while a candidate requalifies, but a later overlapping candidate may not overtake it.

When agents share one GitHub user or token, documentation cannot distinguish a developer from the integrator. Use a separate GitHub App, machine user, or token, and enforce the distinction on the server.

Deliverables

A complete bootstrap normally produces:

  • a concise root AGENTS.md and narrowly scoped nested files when needed;
  • a machine-readable ownership/integration configuration when the graph is too complex for path conventions alone;
  • worktree launcher and preflight commands;
  • executable policy and impact tests;
  • stable deterministic and qualification gates;
  • a ready-state protocol and one merge actor;
  • a staged GitHub settings plan;
  • a short operational document with measured CI baseline and rollback.

Keep each artifact independently useful. Do not copy generic skill prose into every repository. The skill supplies the method; the repository records only its own commands, domains, risks, and authorities.

Safety boundaries

  • Audit mode is read-only.
  • Do not change billing, credentials, branch protection, environments, repository permissions, or merge state unless the user requested that mutation.
  • Resolve exact targets before remote changes and verify the persisted result.
  • Apply settings in reversible stages, with branch protection last.
  • Stop after one infrastructure retry on the same SHA unless the user explicitly asks for monitoring.
  • Never bypass missing qualification with an admin merge merely to finish the setup.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.