# Add shepherd-task plugin: end-to-end task automation via Copilot coding agent#2329
Draft
edburns wants to merge 6 commits into
Draft
# Add shepherd-task plugin: end-to-end task automation via Copilot coding agent#2329edburns wants to merge 6 commits into
edburns wants to merge 6 commits into
Conversation
…ding agent
## Summary
This PR adds a new **shepherd-task** plugin that provides an end-to-end system for
implementing a specification described as a well-specified list of GitHub issues
using an opinionated choice of the following agents and tools.
1. Copilot Coding Agent (CCA).
2. Copilot Code Review Agent (CCRA).
3. GitHub CLI `gh`.
4. GitHub Copilot CLI `copilot`.
It shepherds tasks from assignment through CI approval, code review resolution, and
merge — all orchestrated via `copilot --yolo` sessions driven by shell scripts.
## Enabling assumptions
1. The work will happen within a single GitHub repository.
1. The repository has GitHub Copilot Coding Agent and Code Review Agent installed and properly configured.
1. User has `gh` CLI installed at version 2.45.0 or later and is signed in.
1. USer has permissions on the repository to:
1. Assign issues to `Copilot`.
1. Push to the repository.
1. User has `copilot` CLI installed at version `1.0.72-0` or later and is signed in.
1. User has a local development environment suitable for using Copilot CLI and `git worktree` to do development work, including running tests.
1. User accepts that all of the work is to be done on a non-`main` base branch in the repository.
1. User accepts this plugin will invoke `copilot --yolo`.
1. The specification for the job to be done is encoded in an ordered set of GitHub issues in the issue tracker of the GitHub repository.
1. User has `jq` installed and accessible to Copilot CLI.
## Motivation
When using the Copilot coding agent to implement tasks from a backlog, there is a
significant amount of repetitive supervisory work: assigning the issue, waiting for
the PR, approving workflow runs, interpreting CI failures, requesting changes,
waiting for fixes, resolving code review comments, and finally merging. This system
automates that entire loop, allowing a developer to hand off a list of issue numbers
and walk away.
A successful run of the system will result in the work being merged to the specified non-`main` base branch, so that a further PR can be made from that branch with greater human oversight.
This plugin was developed and battle-tested in the `github/copilot-sdk` repository,
where it has successfully shepherded dozens of tasks through the full lifecycle. It
is being contributed here so the broader community can adopt, adapt, and improve it.
## Architecture
The system has two layers:
1. **Skills** (Copilot-invocable instructions) — three SKILL.md files that Copilot
reads during `--yolo` sessions to know what to do at each phase:
- `shepherd-task-from-assignment-to-ready`: Assigns an issue to @copilot with a
specific base branch, waits for PR creation, iterates through CI approval and
review-agent feedback (up to 20 iterations).
- `shepherd-task-from-ready-to-merged-to-base`: Marks the PR as ready, waits for
Copilot code review, resolves comments locally in a git worktree, pushes fixes,
and merges.
- `shepherd-task-approve-workflows-and-wait-for-completion`: Reusable sub-skill
that approves pending `action_required` workflow runs and blocks until completion.
2. **Orchestration scripts** (user-facing entry points) — shell scripts that launch
`copilot --yolo` sessions, verify outcomes with `gh` CLI between phases, and
provide idempotent retry semantics. Both Bash and PowerShell variants are included
for cross-platform support.
The plugin manifest (`plugin.json`) ties these together as a single installable unit.
## Sample invocation
Bash
```bash
. ./plugins/shepherd-task/scripts/shepherd-task-given-list.sh 13,4,5,6,7,8,9,10,11 edburns/2-build-out-demo edburns/Build26-BRK206-your-agent-anywhere-multiclient-multidevice-with-github-copilot-sdk
```
PowerShell
```powershell
. .\plugins\shepherd-task\scripts\shepherd-task-given-list.ps1 13,4,5,6,7,8,9,10,11 edburns/2-build-out-demo edburns/Build26-BRK206-your-agent-anywhere-multiclient-multidevice-with-github-copilot-sdk
```
## How it works
```
User runs: shepherd-task-given-list.sh "1841,1842,1843" feature-branch owner/repo
└─ For each issue, calls shepherd-task.sh
├─ Phase 1: echo prompt | copilot --yolo (invokes shepherd-task-from-assignment-to-ready)
│ └─ skill loops: assign → wait for PR → approve workflows → fix CI → repeat
├─ Verify: gh pr checks, no unresolved reviews
├─ Phase 2: echo prompt | copilot --yolo (invokes shepherd-task-from-ready-to-merged-to-base)
│ └─ skill loops: mark ready → resolve review comments locally → push → merge
└─ Verify: PR merged to non-main base branch, issue closed
```
## Key design decisions
- **Scripts verify state independently** — they don't trust Copilot exit codes; they
use `gh` CLI to confirm PR existence, CI status, and merge state between phases.
- **Idempotent** — if a PR already exists for the issue, Phase 1 is skipped. If
already merged, Phase 2 is skipped. Safe to re-run after failures.
- **Local review resolution** — Phase 2 resolves Copilot code review comments in a
local git worktree rather than asking the remote agent to fix itself, giving more
reliable results.
- **Cross-platform** — every script has both `.sh` and `.ps1` variants.
## Per-file manifest
### Plugin
| File | Purpose |
|------|---------|
| `plugins/shepherd-task/.github/plugin/plugin.json` | Plugin manifest grouping the three skills; includes metadata, keywords, and version |
| `plugins/shepherd-task/README.md` | User-facing documentation for the plugin |
### Orchestration scripts
| File | Purpose |
|------|---------|
| `plugins/shepherd-task/scripts/shepherd-task-given-list.sh` | Bash: iterates a comma-separated list of issue numbers, invoking shepherd-task.sh for each |
| `plugins/shepherd-task/scripts/shepherd-task-given-list.ps1` | PowerShell equivalent |
| `plugins/shepherd-task/scripts/shepherd-task.sh` | Bash: orchestrates Phase 1 + Phase 2 for a single task issue with state verification |
| `plugins/shepherd-task/scripts/shepherd-task.ps1` | PowerShell equivalent |
| `plugins/shepherd-task/scripts/shepherd-task-inspect-json.sh` | Bash: debug utility to inspect copilot JSON session logs |
| `plugins/shepherd-task/scripts/shepherd-task-inspect-json.ps1` | PowerShell equivalent |
| `plugins/shepherd-task/scripts/install-task-shepherd.sh` | Bash: copies the full shepherd system into another repository |
| `plugins/shepherd-task/scripts/install-task-shepherd.ps1` | PowerShell equivalent |
### Skills
| File | Purpose |
|------|---------|
| `skills/shepherd-task-from-assignment-to-ready/SKILL.md` | Skill instructions for Phase 1: assign to Copilot → PR created → CI passing → no unresolved reviews |
| `skills/shepherd-task-from-ready-to-merged-to-base/SKILL.md` | Skill instructions for Phase 2: mark ready → resolve code review → merge to base branch |
| `skills/shepherd-task-approve-workflows-and-wait-for-completion/SKILL.md` | Reusable sub-skill: approve `action_required` workflow runs and wait for completion |
## Validation
```
$ npm run skill:validate
✅ shepherd-task-approve-workflows-and-wait-for-completion is valid
✅ shepherd-task-from-assignment-to-ready is valid
✅ shepherd-task-from-ready-to-merged-to-base is valid
$ npm run plugin:validate
✅ shepherd-task is valid
```
## Testing
This system has been used in production on `github/copilot-sdk` to shepherd
implementation tasks for Java SDK development. It handles the common failure modes:
workflow approval gates, CI flakiness, Copilot code review comment iteration, merge
conflicts, and base branch drift.
Contributor
🔒 PR Risk Scan ResultsScanned 18 changed file(s).
|
Contributor
🔍 Vally Lint Results✅ All checks passed
Summary
Full linter output |
Run npm run build to update generated files after adding the shepherd-task plugin and its three skills. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fe511aa9-d7a9-4ce2-9cab-7c1f97374333
Skills are installed via gh skill install; the install script now only copies orchestration scripts to avoid duplication. Updated both Bash and PowerShell variants and the plugin README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fe511aa9-d7a9-4ce2-9cab-7c1f97374333
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fe511aa9-d7a9-4ce2-9cab-7c1f97374333
Removes only the orchestration scripts directory from the target repo. Prints guidance on manually removing skills. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fe511aa9-d7a9-4ce2-9cab-7c1f97374333
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new shepherd-task plugin that provides an end-to-end system for implementing a specification described as a well-specified list of GitHub issues using an opinionated choice of the following agents and tools.
gh.copilot.It shepherds tasks from assignment through CI approval, code review resolution, and merge — all orchestrated via
copilot --yolosessions driven by shell scripts.Enabling assumptions
ghCLI installed at version 2.45.0 or later and is signed in.Copilot.copilotCLI installed at version1.0.72-0or later and is signed in.git worktreeto do development work, including running tests.mainbase branch in the repository.copilot --yolo.jqinstalled and accessible to Copilot CLI.Motivation
When using the Copilot coding agent to implement tasks from a backlog, there is a significant amount of repetitive supervisory work: assigning the issue, waiting for the PR, approving workflow runs, interpreting CI failures, requesting changes, waiting for fixes, resolving code review comments, and finally merging. This system automates that entire loop, allowing a developer to hand off a list of issue numbers and walk away.
A successful run of the system will result in the work being merged to the specified non-
mainbase branch, so that a further PR can be made from that branch with greater human oversight.This plugin was developed and battle-tested in the
github/copilot-sdkrepository, where it has successfully shepherded dozens of tasks through the full lifecycle. It is being contributed here so the broader community can adopt, adapt, and improve it.Architecture
The system has two layers:
Skills (Copilot-invocable instructions) — three SKILL.md files that Copilot reads during
--yolosessions to know what to do at each phase:shepherd-task-from-assignment-to-ready: Assigns an issue to @copilot with a specific base branch, waits for PR creation, iterates through CI approval and review-agent feedback (up to 20 iterations).shepherd-task-from-ready-to-merged-to-base: Marks the PR as ready, waits for Copilot code review, resolves comments locally in a git worktree, pushes fixes, and merges.shepherd-task-approve-workflows-and-wait-for-completion: Reusable sub-skill that approves pendingaction_requiredworkflow runs and blocks until completion.Orchestration scripts (user-facing entry points) — shell scripts that launch
copilot --yolosessions, verify outcomes withghCLI between phases, and provide idempotent retry semantics. Both Bash and PowerShell variants are included for cross-platform support.The plugin manifest (
plugin.json) ties these together as a discoverable unit in the marketplace.Sample invocation
Bash
. ./plugins/shepherd-task/scripts/shepherd-task-given-list.sh 13,4,5,6,7,8,9,10,11 edburns/2-build-out-demo edburns/Build26-BRK206-your-agent-anywhere-multiclient-multidevice-with-github-copilot-sdkPowerShell
Installation
Step 1: Install skills (via
gh skill)Requires GitHub CLI v2.90.0+.
Step 2: Install orchestration scripts
The scripts are not installable via
gh skill. Either:plugins/shepherd-task/scripts/, orThe installer copies only the orchestration scripts — it does not duplicate the skills (those are managed by
gh skill installabove).How it works
Key design decisions
ghCLI to confirm PR existence, CI status, and merge state between phases..shand.ps1variants.Per-file manifest
Plugin
plugins/shepherd-task/.github/plugin/plugin.jsonplugins/shepherd-task/README.mdOrchestration scripts
plugins/shepherd-task/scripts/shepherd-task-given-list.shplugins/shepherd-task/scripts/shepherd-task-given-list.ps1plugins/shepherd-task/scripts/shepherd-task.shplugins/shepherd-task/scripts/shepherd-task.ps1plugins/shepherd-task/scripts/shepherd-task-inspect-json.shplugins/shepherd-task/scripts/shepherd-task-inspect-json.ps1plugins/shepherd-task/scripts/install-task-shepherd.shplugins/shepherd-task/scripts/install-task-shepherd.ps1Skills
skills/shepherd-task-from-assignment-to-ready/SKILL.mdskills/shepherd-task-from-ready-to-merged-to-base/SKILL.mdskills/shepherd-task-approve-workflows-and-wait-for-completion/SKILL.mdaction_requiredworkflow runs and wait for completionGenerated files (updated by
npm run build).github/plugin/marketplace.jsondocs/README.plugins.mddocs/README.skills.mdValidation
Testing
This system has been used in production on
github/copilot-sdkto shepherd implementation tasks for Java SDK development. It handles the common failure modes: workflow approval gates, CI flakiness, Copilot code review comment iteration, merge conflicts, and base branch drift.Pull Request Checklist
npm startand verified thatREADME.mdis up to date.mainbranch for this pull request.Description
Type of Contribution
Additional Notes
By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.