orchestration
Coordinate large work as a pure orchestrator: decompose into sub-issues and delegate implementation to sub-agents behind a hard verification gate. Use when the work spans more than one session, needs more than one sub-issue, touches multiple dependent files or concerns, or the user says "orchestrate this", "split this into sub-issues", "delegate this" or "coordinate the work". Do not use for a single focused change — delegation costs more than the change.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- orchestration
- license
- MIT
- description
- Coordinate large work as a pure orchestrator: decompose into sub-issues and delegate implementation to sub-agents behind a hard verification gate. Use when the work spans more than one session, needs more than one sub-issue, touches multiple dependent files or concerns, or the user says "orchestrate this", "split this into sub-issues", "delegate this" or "coordinate the work". Do not use for a single focused change — delegation costs more than the change.
02 资源文件 2
- 参考文档delegation-brief.md1.3 KB
- 参考文档work-order.md2.3 KB
03 SKILL.md 正文
Orchestration
Large work — more than one agent session can hold, or several sub-issues with dependencies — is coordinated, not implemented inline. The main agent plans, decomposes, delegates, and verifies; its context stays on the plan rather than on diffs and debugging.
Measured payoff
polished-recognition epic #158 (2026-11-13/14): 4 sub-issues, an
independent code review and a docs wave — 7 commits, 10 sub-agents,
601→618 tests green, five issues closed — and the orchestrator ended at
~12 % of its context window. Per unit: one report in, one filtered
verification command out.
When to coordinate vs. act directly
- Coordinate (this skill): the work spans more than one session, needs more than one sub-issue, touches multiple files/concerns, or has dependencies between parts.
- Act directly: a single focused change (one file, one concern). Delegation
would cost more context than the change itself.
Exception: even single-focus work is worth delegating when the unit
itself is context-heavy (large reads, verbose verification) — see
"Context Economy (Subagent Delegation)" in
AGENTS.global.md.
Non-default behaviors
- Keep the coordinator's context clean. For coordinated work the main agent does not author code: it reads, plans, decomposes, delegates, and verifies. Implementing inline pollutes the context that has to hold the whole plan.
- Hard verification gate. No sub-issue is done until its full test suite passes. If a sub-agent reports failing or missing tests, reject the work and re-delegate with the failure details. Never start a dependent sub-issue on a red gate.
Delegation
One sub-issue per sub-agent. Run sub-agents sequentially unless their sub-issues touch disjoint file sets. Delegation is a three-phase routine: pre-flight → brief → post-flight.
Work-order medium. A unit larger than one file gets a spec file at
/tmp/opencode/specs/<issue>-<wave>.md, one per unit and wave, written by
the orchestrator and referenced from the prompt. The spec
(work-order.md) carries the facts the orchestrator
already holds, so the sub-agent does not re-derive them and the prompt stays
a pointer. A small unit still fits in a single prompt
(delegation-brief.md).
Pre-flight (orchestrator, immediately before dispatch):
git pull --ff-only(SVN:up) in every target repo; resolve divergence before delegating, never through the sub-agent.- Re-run the discovery scan at dispatch time (search pattern + expected file count). Never reuse an older scan — repos can move during the session (concurrent commits added quiz files nobody had on the list).
Mandatory brief components (every delegation prompt):
- Step 0:
git pull --ff-onlyin the target repo; on divergence or failure abort and report — do not commit. - Self-discovery over a fixed file list: search pattern + expected count; a list in the brief is a cross-check, not the truth.
- Atomic finish: commit and push — or an explicit blocker; never leave work committed-but-not-pushed.
- Kill any server/process the agent started; nothing keeps running.
- Report: files changed, exact commands, pushed SHAs, pass/fail per
verification — or the blocker. Plus only what the sub-agent cannot look up
itself: the sub-issue number (commit reference), the neighbouring pattern
to follow, the relevant
docs/ai/conventions and pitfalls, and the exact verification/test command.
Post-flight sweep (after the wave, regardless of task status):
- In every touched repo:
git status -sb+git log origin/main..HEAD. "Task cancelled" does not mean "nothing happened" — a cancelled agent may already have committed (only not pushed). Check state, don't trust status. - Find and kill stray processes (
ps) — sub-agent verification servers. - Run an independent aggregate verification against the pushed state —
a green verification against a stale tree is worthless. Read its output
filtered (
./gradlew test --console=plain | grep -E 'FAILED|BUILD|tests completed') and force execution first: aBUILD SUCCESSFUL in 2sover anUP-TO-DATEtask verified nothing (epic #158). - Spot-check one claim from each report against the tree before acting on it — that is what caught the cache hit.
Pointers
issue-workflowowns the issue lifecycle: creating issues, sub-issue linking, commits and their issue references, and closing. Do not duplicate its API commands here.knowledge-persistenceowns thedocs/ai/bootstrap order and the knowledge files. Read that order once at session start; do not restate it here.code-reviewreviews the aggregate diff before the parent issue is closed.
Constraints
- Trunk-based: commit directly to the tracked trunk line; no long-lived
branches. See
issue-workflowfor the per-VCS variants (Gitpull, SVNup, and the SVN case with no issue system). - Sub-agent commits follow the
issue-workflowproactive commit/push policy (issue-linked, green commits only) — delegation prompts must include this requirement. - Never fabricate issue numbers.
- Never create empty commits.
- Escalate to the user when a blocker is fundamental (a design decision is needed, or a dependency is missing).
Done when
- [ ] The work is decomposed into sub-issues, each with a real issue number.
- [ ] Every target repo was pulled (
git pull --ff-only/svn up) and the discovery scan re-ran at dispatch time. - [ ] Every delegation brief carried the mandatory components (Step 0 pull, self-discovery, atomic finish, process cleanup, report shape).
- [ ] No sub-issue counted as done without its full test suite green; red reports were re-delegated with the failure details.
- [ ] The post-flight sweep ran in every touched repo (
git status -sb,git log origin/main..HEAD) and stray processes were killed. - [ ] An independent aggregate verification passed against the pushed state.
- [ ] The parent issue was closed only after the diff review and with no open sub-issues.
04 同仓库更多 Skills
codebase-audit
One-shot, interactive assessment of a whole codebase (a Git repository) across four axes: security (in depth), structure and clean layers, coupling and entanglement (Wartbarkeit), and architecture (deep modules). Fans out parallel sub-agents, lets the user steer scope and importance, then files one epic with formally linked sub-issues. Use when the user asks for a full repo audit, workflow health check, whole-project security review, maintainability assessment, or says "audit the codebase", "codebase audit", "assess this repo".
teach
Teach the user a new skill or concept, within this workspace.
sync-upstream-skills
Re-transplant owned skills from their mattpocock upstream after a git pull, applying upstream content changes while preserving opencode-native frontmatter. Also checks for duplicate skill names and dangling cross-skill references. Use when the user says "sync skills", "refresh from upstream", "pull matt's skills", "sync upstream", "update the transplanted skills", or wants to bring the owned transplanted skills up to date. Do not use to add or rename a transplanted skill — that stays manual.
repograde
Grade student repositories with optional date filtering in single-repo or bulk mode. Use when the user says "repograde", "grade the repos", "grade this repo since <date>", "bewerte die Abgaben", "korrigiere die Repos", or asks for a repo grading run over a class folder or a single student repository. Do not use for project grading with issues and PRs (use projectgrade) or for knowledge-check exams (use knowledge-assessment).
projectgrade
Grade student project repositories based on Git commits, GitHub Issues, and Pull Requests. Use when the user says "projectgrade", "grade the project", "bewerte das Projekt", "Projektarbeit benoten", or asks for a holistic grading of a collaborative repository from inside it, based on commits, issues, reviews and PRs. Do not use for per-lesson assignments (use repograde) or for knowledge-check exams (use knowledge-assessment).
lehrplan
Richtet österreichische HTL-Unterrichts-Repositorien ein und pflegt sie — drei Kernaufgaben: das gesetzliche Lehrplan-Material eines Ausbildungszweigs (z. B. WII, WIT, KIF) aus dem RIS beschaffen inklusive jährlichem Novellen-Check, den Lehrplan eines konkreten Gegenstands aus dem Gesetz extrahieren (mit Erläuterung pro Lernziel: was der Inhalt tatsächlich IST, plus praktische Anwendungen), und Semesterpläne interaktiv entwerfen. Use when der Nutzer 'Lehrplan', 'Unterrichtsvorbereitung prüfen', 'Lehrplan auf Novellen prüfen', 'RIS sync', 'Gesetzesmaterial holen', 'Lehrplan extrahieren', 'Jahrespläne neu ziehen', 'Erläuterungen ergänzen', 'Semesterplan erstellen/überarbeiten' oder 'Einheiten erstellen' sagt, oder wenn in einem Repo gearbeitet wird, das der lehrplan/-Konvention folgt. Do not use for Prepared Lessons (create-lesson), Aufgaben im Kohortenordner (homework) oder Wissensüberprüfungen (knowledge-exam).