Contract
- Use only when explicitly requested. Do not infer this skill from a normal issue, implementation, or multi-agent request.
- Input: one or more HTTPS GitHub issue URLs and one mandatory base branch supplied by the user. There is no default base branch.
- Output: JSON on stdout and
manifest.jsonunder<repo-parent>/<repo-name>-worktrees/. - Dependencies: the current directory must be a GitHub checkout with
git, authenticatedgh, and the localopencodeCLI available. - Side effects: creates issue branches and worktrees and launches detached local agents. It never pushes, opens or merges pull requests, closes issues, or changes the primary checkout's branch.
- Risk: medium. The validation phase must finish before any resource is created; a creation failure rolls back only resources created in this invocation.
- Boundary: this skill prepares and delegates work. It does not implement issues itself and does not perform publication or merge operations.
- Evolution boundary: use
parallel-issue-fleetinstead when the input is aTicketArtifactDAG or the run needs VM slots, bootstrap policies, concurrency limits, checkpoints, timeouts, secret injection, convergence, or owned-resource cleanup. This skill remains the one-shot local backend and compatibility route.
Invocation
Run the script from the primary checkout:
node .agents/skills/routing/worktree-swarm/scripts/prepare-worktrees.mjs \
--base main \
https://github.com/owner/repo/issues/123 \
https://github.com/owner/repo/issues/124
If the base branch or any issue URL is missing, ask for the missing information once and stop. The script itself is non-interactive and returns ok: false rather than guessing a base branch.
The script validates the checkout, origin, URL ownership, issue state and metadata, base ref, duplicate issues, existing branches, and existing worktree paths before creating anything. A closed, external, malformed, pull-request, duplicate, or conflicting issue rejects the complete batch and reports every rejected item.
Agent workflow
For each created worktree, the script launches one detached local opencode run process with the worktree as its working directory. Agents receive only their own worktree and the issue context. They must not switch branches, touch another worktree, push, or modify the primary checkout; they commit their work on the prepared issue branch.
Each delegated issue follows the complete project workflow loop when the corresponding skills are available:
/implement → /review-pr → (/plan-review-fixes → /implement-review-fixes → /review-pr)* → /publish-open-pr → /ship-subissue
The loop must stop rather than bypass an unmet gate. In particular, this skill's no-push/no-PR/no-merge/no-close guardrails remain active: publication and shipping are handoffs requiring the user's separate authorization and the repository's review/CI evidence. The child agent must not execute those prohibited side effects while operating under this skill.
Output
Successful output has this shape:
{
"ok": true,
"manifestPath": "/parent/repo-worktrees/manifest.json",
"created": [{
"number": 123,
"url": "https://github.com/owner/repo/issues/123",
"title": "Example issue",
"body": "...",
"branch": "issue/123-example-issue",
"path": "/parent/repo-worktrees/issue-123",
"base": "origin/main",
"agentId": 12345,
"prompt": "..."
}],
"skipped": []
}
On validation or creation failure, return ok: false, an error, all rejected entries in skipped, and an empty created array. Repeating an execution is safe: existing branches and worktree paths are conflicts, so no duplicate agent or worktree is created.
Completion criteria
- all supplied URLs and the explicit base branch were validated before mutation
- every accepted issue has one branch, one worktree, and one local agent
- all agents were launched without waiting for one to finish before starting another
- the manifest contains URL, number, title, branch, absolute path, agent identifier, and base ref
- creation failures remove only resources created during this invocation
- stdout is valid JSON and no prohibited remote/tracker operation occurred
How This Skill Was Created
Created from the user's structured contract through the skill-creator workflow. The requested two-file runtime shape is preserved: this entrypoint and scripts/prepare-worktrees.mjs; repository projections and the lockfile are generated by bundle tooling.
@include .agents/skills/platform/contract-base.xml