--- name: orch description: "PRIMARY AGENT ONLY. Load to orchestrate a Linear or GitHub work item from preparation through merge." license: MIT user-invocable: true metadata: author: "vanillagreen" source: "kendex" repository: "https://github.com/vanillagreencom/kendex" bugs: "https://github.com/vanillagreencom/kendex/issues" --- ## Project Instructions Problems with a kendex-owned skill go through `kendex report`; check ownership in the file first. Before changing this skill's scripts, runtime or tests, read DEVELOPMENT.md. A change only to lane or overseer settings in kendex.settings.toml, kendex-local.toml or kendex.toml takes [directed-change.md § Who makes it](references/directed-change.md#who-makes-it)'s quick-change route only after Jarvis or the owner says "quick change". Without those words it takes the normal item route. Executable behavior, test commands and permissions keep their required checks. ### Refresh ownership and committed outputs This checkout's refresh record belongs to the lock-record Actions workflow, which lands it on main or through its rolling kendex/lock pull request. The hosted overseer receives committed outputs through sync-base. ### Validation routing - Fix rounds keep their delegated round base. Every kendex change is queue-only, per D027: CI holds the full validation record, and the merge waits on the merge-group run. In kendex a red merge-group run re-arms only a new head, even where the re-queue rule of `references/merge-contracts.md` re-arms the same head on `reach: outside`. Where ci-fix leaves the head unchanged, for a flake or a fault ci-fix § 4 places in another pull request, the lane hands back to the overseer with the failing run. ### Owner messages - The owner's time zone is Pacific (America/Los_Angeles). Use the time format in `skills/communication/references/messages.md` § Times. - The owner's night, for `skills/orch/references/communication-modes.md` § Owner asks, is 11 pm to 8 am Pacific. ### Proposals - A kendex `Proposal:` comment, per `skills/orch/references/skill-rules.md` § Coordination, Tracked issue creation, carries a `Symptom:` line (where, when and what broke) or an `Owner:` line (the owner's note or ask) beside `Reached by:`, at every source and priority. audit-issues § 6 declines one with neither, per the project-management skill's § Intake. ### Consumer refresh review - This organization's consumers route their kendex refresh pull request to the overseer, never to Copilot, since kendex already reviewed its packages. ### Cargo round cleanup At each development round boundary, run the owner-scoped worktree cleanup policy for Cargo output. Use ORCH_ROUND_PRUNE_DISK_PCT as the configured disk threshold. Prune only the owned worktree target directory. If CARGO_TARGET_DIR is elsewhere, report the separate cleanup need and do not delete another owner's output. Between the round-id and delegation-time stamps, write the request `{"op": "prune-round", "field": "dev"}` to a file and run `.agents/skills/orch/scripts/orch-runtime op --item [ISSUE_ID] --request [FILE]`; at or past the mark it exits 1 recording `target-elsewhere` where CARGO_TARGET_DIR is not the worktree's own target directory. ### Pi package publication When a kendex item's diff changes consumer-facing files under `pi-extensions/`, the launch read gives the item two Done-when boxes. The branch box requires its PR to raise `pi-extensions//package.json` by `skills/commit-guards/CHECKS.md` § Release versions and replace its changelog heading `### Unreleased` with `### `. A diff that only touches what `.agents/skills/npm-deploy/SKILL.md` § Skip publish for lists takes neither box. After merge, the item's lane runs `.agents/skills/npm-deploy/SKILL.md` § Publish, tag, refresh, verify steps 1-4 for that package only. Fetch main, use the item's merge commit as `` and the fetched main head as ``, tag `-v` at ``, and push that tag alone. Find and watch the `publish-npm` workflow_dispatch run. Retry the same tag only when the failure needs no new version, following step 4. Keep the item in Verifying until its Post-merge box passes. Run this action in the lane, never on the control VM. The orch verification pass reads the workflow run rather than `npm view`: `tools/publish-npm` exits 0 with `published=` or `served=` only after npm serves the version. Use this exact Post-merge box: - [ ] Post-merge: the publish-npm workflow_dispatch run titled publish-npm (not a dry_run dispatch) concluded success for this item's version or a later version of the same package; Where: gh api REST repos/vanillagreencom/kendex/actions/workflows/publish-npm.yml/runs, read by the orch verification pass; Why after merge: publish-npm publishes from main only, on a tag of the merged commit (D003); Trigger: merge; Deadline: +24h # Orchestration Load `github`, `worktree` and `linear` before their first use. > **MODE SWITCH**: you are the orchestrator. Delegate every implementation, review and QA task to a specialist sub-agent. Never edit code, unless the user explicitly asks or the item runs the [`micro`](workflows/micro.md) tier, whose runner makes the edit itself. ## The Cycle Get the issue → dev implements → publication, review and fixes in the order `orch-runtime pr order` answers → required CI and review gate → merge. - **Bounded loops.** - A fix round addresses blockers only. - The same pass declines or tracks every `fix` suggestion ([review-pr](workflows/review-pr.md) § 4). - A re-review narrows to the fix diff, the domains it touched and the class of every defect it fixed ([reviewer](../reviewer/SKILL.md) § Re-Review Rounds). - Two consecutive rounds with no new blocker end the review. - [Review cap](references/review-cycle.md#review-cap) sets the cap, cap 0 and a fix round's own regression. - **Finding conduct.** Apply reviewer's [decision flow](../reviewer/references/finding-disposition.md#decision-flow), [recurrence rule](../reviewer/references/finding-disposition.md#recurrence) and [filing bar](../reviewer/references/finding-disposition.md#filing-bar). - **Scope cuts.** - A reviewer or the orchestrator can choose a cut round. - A round whose only findings are scope or wording asks ends the review: reply, resolve, push nothing, and merge through the gate. - **Ask gates.** - [communication-modes](references/communication-modes.md) alone decides which questions reach the user. - Use [Presentation](references/communication-modes.md#presentation) for messages to the user. - `ORCH_DECISION_MODE` does not change that ask set. - Merge asks unless `ORCH_MERGE_AUTONOMY=auto`; under `auto`, merge without asking only when every merge gate is green. - In a lane every ask gate is `lane-mail`, never the harness question tool: [skill-rules](references/skill-rules.md) § Coordination. - **Post-PR autonomy.** - After a PR exists, `ORCH_DECISION_MODE=auto-recommended` takes and logs the continuing option while a bounded wait, retry or triage round remains. `ask` presents the listed choice. - Initialize the item's state before the transitions below: - `orch-runtime state head-budget take` spends one automatic retry. `--kind review-wait` restarts its count on a new head; `--kind ci-fix` counts across heads. `head-budget reset` starts the count over. - At a cap, `orch-runtime state post-pr-stop record` persists the named stop with its rendered Markdown comment. The workflow posts that file to the PR and returns the stored stop. - A nested caller uses `post-pr-stop record-if-empty`, so a precise upstream stop stands. - Every continuing action lifts the stop with `post-pr-stop clear`. - `ORCH_MERGE_AUTONOMY` controls merge consent only. - **The overseer reads results.** - It accepts green lane checks and CI without reruns. - It grants no prepare, commit, push or merge, and no shared validation slot. - Green lanes with the user's merge consent arm auto-merge and own its wait per [merge-pr](workflows/merge-pr.md). - A dev test-only validation-ceiling report ends validation. - Lanes tick branch boxes with proving artifacts. Where a lane cannot, the runtime's close ticks them from the PR body's `## Done-when evidence` section. - The overseer ticks a post-merge box only after reading its proving artifacts at their revision and conditions: test output, a screenshot, a measured figure or a deployed screen. A lane summary is no proof. - A container closes as [skill-rules](references/skill-rules.md#containers) § Containers states. - An outcome to read lives in its own child. - When evidence is due or contradicted, the overseer reads it to narrow, replace or stop the failed intervention. A fix item is not the default. - The overseer gives no model or account instructions. - Lanes keep their launch models and launch no lanes. - **Item work stays in lanes.** A fleet is hosted when `orch-runtime host resolve` prints anything but `local`. Its overseers share the control VM for coordination. - Every tracker item's round goes to its branch's lane. No worktree, item branch, dev, review or fix agent, validation, build, install or test runs on the control host. The one exception is an owner-directed small change, `directive-[ID]` ([directed-change.md](references/directed-change.md) § Who makes it). - A control-host subagent (sweep, triage verifier, measurement or research) reads without bulk writes. - It streams archives, or extracts each into its own scratch subdirectory and removes the extraction before the next. - Before an extraction it reads the uncompressed size and the volume's free space. Where less than 3 GB would remain, it stops and reports to the overseer without extracting. - It runs no history-wide content read: no `git log -S` or `-G`, no `--all -p`, no command that reads every blob. It searches through `gh search code`, the GitHub API or a lane. - It runs no busy wait (`/dev/zero`, `/dev/urandom`, spin polls) on the shared host. It waits with one bounded background command and its completion notice, or on watch events. - Its scratch location is an empty subdirectory, `tmp///`. - Only that subagent removes its scratch location, and no background job of the overseer reads it. - Every control-host subagent brief carries these rules. - Refresh follows the [consumer's owner](references/oversee-events.md). There is no `--refresh-only` exception. - **Acceptance is artifact-based.** A round closes on a validated on-disk artifact plus git and tracker state, never on a return message. - **Rules reload after a rebase.** 1. Before a step that can rebase the branch (the `record-push` request, `worktree create --reuse`, a restack), bind `git -C [WT_PATH] rev-parse --verify HEAD` as `[BOUND_HEAD]`. 2. If the step moved it, then at once, before any validation, publication or arm, run `git -C [WT_PATH] diff --no-renames --name-only [BOUND_HEAD] HEAD -- `. 3. Re-read each listed file at `[WT_PATH]/`, under the deleted-path rule of dev's [Round Contract](../dev/SKILL.md#round-contract). - **A lane is quiet.** `ORCH_LANE_OUTPUT` decides what a lane prints and where a filled `` block goes: [skill-rules](references/skill-rules.md) § Lane Output. ## Commands Route ` [args]` to its workflow and follow [Workflow Execution](#workflow-execution). | Command | Arguments | Workflow | Purpose | |---------|-----------|----------|---------| | `start` | `[ISSUE_ID]` \| `github OWNER/REPO#N` | `workflows/start.md` / `workflows/start-worktree.md` | Prepare one work item; from a worktree, run the full session | | `start new` | `linear\|github ...` | `workflows/start-new.md` | Create one issue, then start it | | `micro` | `[ISSUE_ID]` \| `github OWNER/REPO#N` | `workflows/micro.md` | Few-line tier: edit, commit, PR, arm and merge, with no dev agent and no review cycle | | `small` | `[ISSUE_ID]` \| `github OWNER/REPO#N` | `workflows/small.md` | One-subsystem tier: the full session under thin review bounds | | `handoff` | `linear\|github ...` | `workflows/handoff.md` | Launch independent sessions | | `plan-issues` | `PLAN_PATH linear\|github` | `workflows/plan-issues.md` | Convert plan items into issues | | `dev-start` | `[ISSUE_ID]` | `workflows/dev-start.md` | Delegate implementation | | `dev-fix` | `[ISSUE_ID]` | `workflows/dev-fix.md` | Delegate fix items | | `ci-fix` | `[PR_NUMBER]` | `workflows/ci-fix.md` | Analyze and fix a PR's CI failures, a merge-group run's included | | `review` | `[all]` \| `[last N]` \| `[HASH]` | `workflows/review.md` | On-demand review of local changes | | `review-codebase` | `[PATH]` | `workflows/review-codebase.md` | Whole-codebase fan-out, findings only | | `review-pr` | `[PR_NUMBER]` | `workflows/review-pr.md` | Review cycle with fixes and QA | | `review-pr-comments` | `PR_NUMBER` \| `BRANCH` | `workflows/review-pr-comments.md` | Triage PR review comments | | `submit-pr` | `[PR_NUMBER]` | `workflows/submit-pr.md` | Push, create the PR, gates, merge | | `merge-pr` | `PR_NUMBER` \| `all` | `workflows/merge-pr.md` | Verify the conditions and merge | | `post-summary` | `[ISSUE_ID]` | `workflows/post-summary.md` | Post the summary and handoff comments | | `verify` | none | `workflows/verify.md` | Read and complete due verification checks | | `oversee` | none | `workflows/oversee.md` | Fleet mode: one session per unblocked item, every PR shepherded to merge | **`start` routing.** - `github OWNER/REPO#N` sets `TRACKER=github` and `ISSUE_ID=issue-N`, and keeps `OWNER/REPO` for the API. - Any other id is Linear unless it starts with `issue-`. - A working directory whose git common dir differs from `.git` is a worktree: route it to `workflows/start-worktree.md`. - Route any other directory to `workflows/start.md`. ## Scripts ```bash .agents/skills/orch/scripts/