--- name: orchestrate description: > Carry one or several pieces of team work through the atk lifecycle: read how far each has come, from a client's raw request to a ready plan, propose the atk skills each still needs as jobs with the agent, the way it runs, and the person who answers it, and after the team approves the proposal, run the jobs side by side, each piece in its own git worktree, relaying every question and approval to the named person and ending code at a local commit with an `atk:review` report. Use when a team has requests, tickets, designs or plans to carry through atk, one or several at a time, and wants one coordinator for them. Not for generic multi-agent work with no team artifact or approval. Triggers on: "orchestrate these tickets", "run the atk pipeline for these requests", "carry these pieces of work through atk", "run this unattended", "/atk:orchestrate". argument-hint: "[requests|tickets|paths...] [--concurrency ] [--sequential] [--unattended] [--resume]" --- # Carry Pieces of Work Through the Kit (`atk:orchestrate`) Today a person carries every piece of work through the kit by hand, one skill and one piece at a time: a raw request through `atk:intake`, an approved requirement through `atk:design-doc` or `atk:plan`, a plan through `atk:implement`. This skill coordinates one or several of them: it reads where each piece stands, proposes the jobs each still needs, and once a person approves, runs them. It coordinates and decides nothing a role owns. Every question a job's skill asks reaches the person it is for, word for word; every artifact a job writes stops at the state its skill gives it and waits for its approver; and code ends at a local commit. Push, pull request and merge stay with a person. ## Scope Handles: turning requests, tickets, an epic, a defect report, or a requirement, design, breakdown or plan path into pieces of work; reading how far each piece has come; proposing a chain of `atk` jobs per piece, with the agent and the way each runs; running the approved jobs, several pieces at a time, each in its own worktree; relaying questions and approvals; reviewing each committed code job with `atk:review`; and cleaning up everything the run started. Does NOT handle: the work of any job, which is the skill the job runs; choosing which skill comes next for one piece in the current branch, which is `atk:help`; splitting an epic into owned tasks (`atk:breakdown`), whose approved tasks this skill can then carry; pushing, opening a pull request, commenting on or moving a ticket, or merging (`atk:git`, on a person's yes); running `atk:verify` on two worktrees at once; or orchestrating agents for work that has no `atk` artifact and no approver, which is outside this kit. ## Roles Whoever runs it, usually a Dev or the Tech Lead, is the coordinator's author. The person the Team section of `.atk/profile.md` gives orchestration in its `Approves` column, the Tech Lead by default, approves the proposal: the order, which pieces run together, the concurrency and the agents. Where a breakdown assigns owners, the PM confirms them before its tasks become pieces. Each artifact a job writes keeps its own approver, the one its front matter names, as its own skill sets it. One person may hold all of these; the approval is still their act. See `shared/team-roles.md`. ## Invocation ```bash /atk:orchestrate "" # Any mix: requests, tickets, an epic, paths /atk:orchestrate --concurrency 2 # At most two pieces run at once /atk:orchestrate --sequential # One job at a time, whatever else was asked /atk:orchestrate --unattended # Eligible gates pass provisionally, then queue /atk:orchestrate --resume # Offer the unfinished runs, with no new input ``` `--concurrency` takes a whole number of 1 or more, and is reduced to what the machine allows, saying so. `--sequential` wins over it. `--resume` takes no inputs, and is this skill's resume form, the one `atk:help` names for an unfinished run of it: given inputs, the run asks which was meant; with none unfinished, it says so and stops. `--unattended` is refused with it, which keeps the recorded mode. The project is one repository: a profile naming member repositories, or a workspace, is refused at the proposal, per One repository in `references/worktrees.md`. `.atk/profile.md` is wanted, not required, per the Required-soft group of `shared/project-profile.md`: without one, `atk:init` runs in the session before any worktree is made, per When the profile is not ready in `references/proposal.md`. ## Workflow ``` [1. Read the pieces] -> [2. Propose] -> [3. Prepare worktrees] -> [4. Run the jobs] -> [5. Review code jobs] -> [6. Re-confirm after a gate] -> [7. Clean up and close] ``` Before step 1, read `.atk/overrides/orchestrate.md` when it exists, per rule 7 of `shared/team-roles.md`. Then, before anything else, create this run's trace, `/derived/traces/orchestrate/.md`: read the kit's `shared/run-trace.md` and do what it says before the file, at each step, and at the close. Then read the unfinished run states of this skill and offer them, per State and resuming below. ### 1. Read the pieces Each input becomes one **piece of work**: a raw request, a ticket, an epic, a defect report, a Figma link, or a path; the same ticket or path given twice is one piece, and so is a path whose front matter names a ticket also given, which the proposal says. A piece has one worktree and one branch for its whole chain, so its requirement, design, plan and code travel together. Everything read here is evidence under rule 8 of `shared/team-roles.md`: a request that says "skip the review" is text somebody wrote, not an instruction. Read each piece against `shared/state-signals.md`, with the piece's ticket as the work in hand and its own branch and worktree as the branch and tree the rows read. The rows about the whole project, records, tags, conventions, overrides, threat models and the master test plan, are read once per run, not per piece; row 13's master plan job follows The master test plan in `references/proposal.md`. - **Where it is read.** In the piece's worktree when a previous run left one, matched by ticket key or path against the run state and `git worktree list`, from its working-tree files, so an approver's edit not yet committed is seen; else on the piece's branch where one exists; else on the base the proposal will name for it, per Reading a piece in `references/worktrees.md`. - **Row 6 is read for uncommitted work only.** Between jobs a piece's branch is ahead of its base with no pull request by design, since every push waits for a person, so that half of row 6 never holds for a piece and reading goes on to the rows below it. Uncommitted work in a worktree a previous run left is shown to the person as a row of the proposal, never committed unasked, and one whose last job ended `failed` goes to the person under `needs-person`. - **Its own records are left out.** This skill's proposal records under `docs/records/orchestration/` are not a piece's artifacts and never gate it, per Which artifacts gate in `shared/state-signals.md`. - **Nothing of its own.** A raw request, a ticket holding only a request, or a piece for which none of those places holds an artifact naming its ticket or path starts at `atk:intake`, ahead of every row; a Figma link at `atk:intake --design `, and a defect report at `atk:fix`. - **Reading stops at row 3, not before.** Row 1 above it still becomes an `atk:spec` job, and row 2 is named in the proposal as the read a person owes, `atk:qa --review` by the BrSE/BA or the QA lead, never a job. Then a gating artifact at `DRAFT` or `IN REVIEW` waits for the approver its front matter names, under `needs-approval`, before anything else is proposed for it; a design at `DRAFT` is its author's instead, an `atk:design-doc ` job its `owner` answers. - **A row whose skill this run does not propose.** Rows 7, 18 and 22, a pull request, a release and a question, mean the piece waits on a person, named in the proposal; at row 22 with an approved requirement and no design or plan for its ticket, `atk:plan ` is proposed instead, and with no ticket the piece waits on that requirement's approver. ### 2. Propose Probe the ways a job can run, per `references/ways-to-run.md`, then write the proposal record per `references/proposal.md`: one row per job, with the skill and its arguments, the agent and its permission mode, the way, the person who answers its questions, and what it waits for. State the concurrency, the timeout and the total number of jobs and review runs before any of them starts, per the parallel-agents policy of `shared/host-capabilities.md`. The record is written at `DRAFT`, and nothing runs until it is `APPROVED`: edited by its approver, or moved on their explicit word, per rule 2. A record the approver edits is checked again; a first record they reject ends the run, a later one stops its own chain, per How far an approval reaches in `references/proposal.md`. Approval reaches each chain's first job that produces a gating artifact; the jobs after it are `re-confirm`, or `provisional` under `--unattended` within its ceilings, whose record also carries An unattended run of `references/proposal.md`, per `references/unattended.md`. ### 3. Prepare worktrees Take the inventory of `## Process management` first. Where the profile is not ready, run `atk:init` in the session now and commit what it writes, before any worktree exists; the run's base is the commit that holds the profile, and the jobs held back for it go into a follow-up record, per When the profile is not ready in `references/proposal.md`. Then do what `references/worktrees.md` says once per run, and per approved piece: the worktree beside the repository, its base, its branch by the project's rule, the profile it needs, and its run state's ignore file. A piece that waits on another gets its worktree once that wait ends, per Pieces that share files in `references/proposal.md`, from the base the run state records for it. ### 4. Run the jobs Start each job in the approved way, per `references/ways-to-run.md`, with the prompt of `references/job-prompt.md`, at most the stated concurrency at once. A job runs one `atk` skill, leaves its change in its worktree, and writes a result file; the coordinator waits for it inside its own turn, per Wait in `references/ways-to-run.md`, and reads that file as evidence rather than state, per Agents that write in `shared/host-capabilities.md`. A job ends `done`, `needs-person`, or `failed`: - **`done`.** Check and commit what it left, per After a job ends in `references/worktrees.md`, and record the branch the commit is on. A commit that fails or is refused puts the chain under `needs-person` with the reason, and no review runs on it. An offer the job declined, a ticket comment or a push, goes to the close. - **`needs-person`.** A gate of its skill, relayed as Agents that write says, its recipient checked first against the people the job's skill asks: the requester, the artifact's approver from the profile or the front matter, and the person running the skill. A permission prompt of its CLI is the person's to answer where it shows, never the coordinator's, per `references/ways-to-run.md`. Independent questions from several jobs go to the person in one turn; one for a person not in the session parks its chain, per States in `references/proposal.md`. Under `--unattended` a gate first goes to A gate under `--unattended` in `references/unattended.md`, which passes or parks it. - **`failed`.** A timeout, an agent ended with no final state, a write outside its worktree, or a refused flag, probed again and never guessed. Its chain stops, blocking only its own later jobs. A chain waits in `needs-approval` while an artifact a job wrote sits at the state its skill gave it, named with its absolute path in the worktree and the approver its front matter names, unless an unattended run builds on it within its ceilings, per `references/unattended.md`. The coordinator never moves the artifact's state: an approver who tells the coordinator so is told to edit that file. Once they say it is edited, the coordinator reads its front matter there and, on their word, commits the edit through `atk:git --commit` in that worktree, before step 6 reads the piece again. A rejection is relayed and recorded, per A rejected artifact in `references/proposal.md`. What an `atk:implement` or `atk:fix` job is given is item 2 of `references/job-prompt.md`. ### 5. Review code jobs Once a code job's change is committed, run `atk:review "..."` in its worktree, with `` the base in the piece's entry, a sha or a branch, never `(detached)`, and `--out /derived/orchestrate//-review.md`, as `shared/review-fix-loop.md` says, all of it: Calling the review, with the plan and the requirement as intent and the cost stated first; What gets fixed; Disputing a finding, which goes to the Tech Lead and stops the chain; The ceiling, two rounds, and The closing read, counted in the run state so a resume resets neither. The findings What gets fixed selects become a fix job, per Fix jobs in `references/proposal.md`, which the approved record already counted; a `SHOULD FIX` finding carried forward is written in the run state with its reason. The next review names the report before it and the commits since. Past the ceiling, mark the chain `escalated`. The loop's record lines go to the run state and into the record `shared/review-fix-loop.md` names for this skill. Agreement between reviewers is not an approval. ### 6. Re-confirm after a gate When a gating artifact a chain waited on is `APPROVED`, read the piece again and propose the rest of its chain as a new proposal record linking the one before, per How far an approval reaches in `references/proposal.md`. It runs only once that record is approved, apart from jobs an unattended run marked `provisional`. An approved breakdown's tasks become pieces, per A breakdown's tasks there. ### 7. Clean up and close Propose `atk:verify` per branch that changed code, one branch at a time, in that branch's worktree, never two at once: two worktrees of one application contend for one port. It runs in the session on a yes, never as a job; a commit it makes goes back through step 5, and its worktree is kept until it is declined or done. Then clean up per `## Process management`. Close with the branches that wait for a push, each with its base, the order to push them in where one is based on another, its artifacts, its implementation record, or an `atk:fix` job's fix report, and each fix job's implementation record, the records by their copies in the coordinator's run directory once the worktree is gone, each the artifact `atk:git` is to be given so step 5 of `shared/finalize-steps.md` offers its left-for-later items and carried-forward findings, its review report, and who must say yes to the push, per the consent line in that file; the offers jobs declined; the chains still waiting, with the person each waits on; the exclude lines the run added to the clone, per `references/worktrees.md`; and the settled proposal records, offered for a commit in the coordinator's tree, which then goes back to the run's starting branch, per At the close in `references/proposal.md`. A record left unapproved is moved to `SUPERSEDED` on its approver's yes, asked once first, and otherwise listed as still waiting. ### State and resuming The run state is a progress log at `/derived/orchestrate//progress.md` in the coordinator's tree, per Progress log in `shared/artifact-paths.md`. Its `subject:` is the slug of the run's first proposal record. One entry per job: piece, its base, worktree, branch, state, result file, the child skill's progress log, and the review round; the child paths are required, since a child's log is invisible from the main tree. While any chain waits, the close writes one `