feat: agent-driven coordinator with skill-based dispatch#421
Merged
Conversation
added 2 commits
May 11, 2026 10:42
Adds the autoship-coordinator skill and coordinator.sh that uses OpenCode's task tool to spawn general subagents per queued workspace. Supports task_id tracking, resume via existing task_ids, and configurable concurrency. Enable by calling coordinator.sh directly or via runner.sh with AUTOSHIP_COORDINATOR_MODE=true.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an AutoShip “coordinator” skill plus a shell entrypoint intended to scan .autoship/workspaces, dispatch queued work, and report outcomes—moving orchestration logic out of inline shell prompt templates and into a SKILL.md-driven agent.
Changes:
- Introduce
skills/autoship-coordinator/SKILL.mddefining a coordinator workflow for scanning/dispatching queued workspaces. - Add
hooks/opencode/coordinator.shas a CLI entrypoint to run the coordinator skill viaopencode run, with basic logging and a--onceflag.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| skills/autoship-coordinator/SKILL.md | New coordinator skill prompt/spec for scanning queued workspaces and dispatching subagents. |
| hooks/opencode/coordinator.sh | New bash entrypoint to invoke the coordinator skill and append output to a coordinator log. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+6
| # AutoShip Coordinator | ||
|
|
||
| You are the AutoShip Coordinator for this repository. You manage queued AutoShip issues by spawning implementer subagents. | ||
|
|
||
| ## Mission | ||
|
|
Comment on lines
+27
to
+28
| Read `.autoship/config.json` for `max_workers` or `max_concurrent` field. Default: 5. | ||
| Spawn multiple subagents concurrently when possible by making multiple `task()` calls. |
Comment on lines
+18
to
+22
| c. Write "RUNNING" to `<workspace>/status` | ||
| d. Write current UTC timestamp to `<workspace>/started_at` | ||
| e. Call `task(subagent_type="general", prompt=<AUTOSHIP_PROMPT.md content>)` | ||
| f. On task return, write the task_id to `<workspace>/task_id` | ||
| g. Read final `<workspace>/status` — expect COMPLETE, BLOCKED, or STUCK |
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| AUTOSHIP_DIR="${AUTOSHIP_DIR:-.autoship}" | ||
| REPO_ROOT="${AUTOSHIP_REPO_ROOT:-$(cd "$SCRIPT_DIR/../../.." && pwd)}" |
Comment on lines
+14
to
+23
| AUTOSHIP_DIR="${AUTOSHIP_DIR:-.autoship}" | ||
| REPO_ROOT="${AUTOSHIP_REPO_ROOT:-$(cd "$SCRIPT_DIR/../../.." && pwd)}" | ||
| LOG_FILE="$REPO_ROOT/$AUTOSHIP_DIR/coordinator.log" | ||
| SKILL_FILE="$SCRIPT_DIR/../../skills/autoship-coordinator/SKILL.md" | ||
| COORDINATOR_MODEL="${AUTOSHIP_COORDINATOR_MODEL:-kimi-for-coding/k2p6}" | ||
|
|
||
| ONCE=false | ||
| [[ "${1:-}" == "--once" ]] && ONCE=true | ||
|
|
||
| log() { echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') $1" | tee -a "$LOG_FILE"; } |
Comment on lines
+27
to
+29
| opencode run --model "$COORDINATOR_MODEL" "$SKILL_FILE" 2>&1 | tee -a "$LOG_FILE" | ||
|
|
||
| coordinator_exit=$? |
Comment on lines
+20
to
+33
| ONCE=false | ||
| [[ "${1:-}" == "--once" ]] && ONCE=true | ||
|
|
||
| log() { echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') $1" | tee -a "$LOG_FILE"; } | ||
|
|
||
| log "Coordinator starting (model=$COORDINATOR_MODEL)" | ||
| cd "$REPO_ROOT" | ||
| opencode run --model "$COORDINATOR_MODEL" "$SKILL_FILE" 2>&1 | tee -a "$LOG_FILE" | ||
|
|
||
| coordinator_exit=$? | ||
| log "Coordinator exited with code $coordinator_exit" | ||
|
|
||
| [[ "$ONCE" == "false" ]] && { log "Re-scanning..."; exec bash "$0" --once; } | ||
| exit $coordinator_exit |
|
🎉 This PR is included in version 2.21.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
Changes