The Team Loop
Use this skill when two cooperating teams or agents work in one repository. Replace Team A and Team B with the configured names. The Owner is a human and is the authority for priority, merge, deploy, freeze, and policy decisions.
Onboarding: five-minute setup
- Copy this skill into the target repository and install the adapter for the active agent tool.
- Copy
templates/team-loop.ymlto.team-loop.yml; set team names andgate_command. - Run
scripts/setup-labels.sh --repo OWNER/REPO. - Have the Owner create a pinned coordination issue and one issue labelled
ready. - Each team reads this file, claims at most one item, and uses the configured status header.
Roles
- Owner: creates or promotes ready work; posts direct
Owner:decisions in their own words; authorizes merges and deploys, except inside a written mandate with scope and UTC end time. - Team A / Team B: build, test, review, claim, hand off, and report. Use separate GitHub identities when available.
- Reviewer (optional): performs a fresh-context review. Require it for configured risk paths or categories.
Loop states
backlog -> ready -> in-progress -> blocked or needs-owner -> implementation PR -> ready-for-owner -> merged -> deployed.
backlogis not claimable. Batch low-severity backlog work weekly for owner promotion.readyauthorizes implementation, tests, and opening a PR. It never authorizes merge or deploy.- On closing an issue, remove stale state labels such as
in-progress,ready,blocked, andneeds-owner.
Claim protocol
- Re-read labels immediately before acting. Do not claim
in-progress,blocked, or non-readywork. - Run
scripts/claim.sh --repo OWNER/REPO --issue N --team "Team A" --plan "short plan". - The script adds
in-progressand a team label, posts the claim, then rechecks state. If it loses a race, it backs off. - Keep work in progress at or below
wip_limitper team. Finish, hand off, or explicitly block an item before claiming another. - For
team:any, the earliest valid claim comment wins; the other team backs off. Do not resolve a tie by duplicate implementation.
Comments and communication
Every team comment begins on its first line with:
Status: <state> | Team: <configured team> | <short context>
Post only a claim with plan, review verdict, gate result, hand-off, question, owner-facing escalation, agreement, or release report. Do not post started, queued, still waiting, re-armed, or other ceremony comments. Keep ordinary comments to five short lines; place evidence in the PR description or collapsed details.
Only the Owner writes Owner: decisions. Teams must link or ask for a direct owner comment, never relay one as authority.
Labels and routing
Use the labels in reference/labels.md. An unassigned ready issue defaults to Team A unless configuration says otherwise. team:any enables either team to claim. While idle, help the other team in this order: requested reviews, train preparation or rebasing, then weekly backlog batches. Do not conduct an open-ended bug sweep without an Owner request.
Review, train, gate, certificate
-
Each PR runs light, focused checks and receives the review tier required by its risk.
-
A reviewer labels complete PRs
ready-for-owner. -
The train runner gathers reviewed PRs available at that moment. It runs:
scripts/train.sh --repo OWNER/REPO --name train-YYYYMMDD-N PR_NUMBER... -
train.shaddstrain-runningto every included PR, records the base and heads, performs a clash screen, constructs a temporary merge result, and invokesgate.shonce. -
gate.shkeys the certificate togit rev-parse HEAD^{tree}. A matching existing certificate is successful evidence unless--forceis used. -
If the base or a PR head changes, or the screen/gate fails, the train is invalid. Remove or split the offending PRs, then rebuild the train. Do not merge unrelated work while
train-runningholds the train. -
After direct owner approval or an active mandate, run
train.shagain with--merge --owner-authorization "Owner: ..."to merge the recorded PR heads in order. It refuses if the base or a head changed, and verifies the protected branch's tree after every merge.
Deploy, freeze, hold, and pause
- Deploy only the configured protected branch and only with a matching tree certificate, unless the Owner supplies a recorded exception.
- Produce one deployment report for the release. Label shipped PRs and issues
deployed; link them to the one report rather than duplicating it. freezestops new merges and deploys. Treat failed label reads as frozen for irreversible actions.- A train hold blocks merges outside that train until the train exits.
- On pause, stop claims, trains, merges, and deploys. The Owner posts a restart list that names the items allowed to resume. Re-check labels, PR heads, base, and certificates before restart.
Escalation and mandates
Use needs-owner when a product, security, legal, release, or ambiguous ownership decision blocks work. State the observed behavior, options, recommendation, and deadline if one exists. Continue independent work.
A mandate must state its exact scope and UTC expiration, for example:
Owner: Team A may merge and deploy reviewed documentation PRs 41 and 42 until 2026-05-01T18:00:00Z.
Anything outside that scope or after expiry requires a fresh direct decision.
Retrospective
At least weekly, run scripts/scorecard.sh and discuss the definitions in reference/metrics.md. Improve one measurable bottleneck at a time. Review gate runs per merged PR, claim latency, cycle time, queue net change, mean batch size, certified share, and change-failure rate.
Read reference/rules.md for the normative numbered rules and reference/comment-templates.md before posting status.