Use when a prepared specification (or subtree) should be planned, implemented, reviewed and committed leaf by leaf.
Drive a specification subtree from prepared to completed: plan, implement and review its leaves one at a time in dependency order, complete the intermediate specifications as their subtrees finish, and finally complete the root, running the project's git workflow and code review at the hooks named below.
$1: the root specification's id or (partial) title. Other skills invoke this skill with the id only, also under their --auto-apply.## Sub-projects table of settings/SETTINGS.md, kept only where git -C <path> rev-parse --show-toplevel succeeds and deduplicated by that toplevel (a sub-project that is a plain package resolves to its enclosing repository).gitflow.md of the sub-project whose repository path is the longest path/ prefix of (or equal to) its path, else the root settings/gitflow.md. Every gitflow step runs independently in each repository; a repository whose git operations were stopped or aborted is skipped by every later gitflow step.git -C <repo> status --porcelain in every repository, taken before the leaf is implemented and kept in the run's context only. A leaf's files are the paths that git -C <repo> status --porcelain reports as changed or new compared with that baseline, made relative to the project root, plus the files outside every repository that atn:spec-implementer reports. Recompute the set after every atn:spec-implementer return (the first run and every retry or resume for review fixes), keeping the paths found earlier, since a commit takes them out of the status; a path already dirty at the baseline is not the leaf's. Each file belongs to the repository with the longest matching toplevel; files outside every repository are never staged. Whenever atn:spec-implementation-reviewer is spawned or resumed, pass it each reviewed leaf's files, since the working tree may already be committed by then.git -C <repo> status --porcelain -- <its files there> reports one of them as changed. The repositories a leaf's plan predicts it will touch are those its Affected sub-projects section (specs_get_plan with the leaf id) maps to through the sub-project table.{id, title} of every leaf implemented without a TEST FAILURE in this run; the code-review.md Rules subsections review it.completed or skipped, or the run was stopped.The run is unattended except at its ask points: a loaded Rules subsection says to ask, the planner is blocked (step 5.2), an implementer reports a TEST FAILURE (step 5.4), there are external blockers (step 3.7), or out-of-scope items are left to turn into ToDo cards (step 8); the last two are asked even when another skill started this one under --auto-apply. Everywhere else decide with your own best judgment, and stop with a clear report on ambiguity that can't be resolved safely. Only this skill runs state-changing git commands, and only where a gitflow.md Rules subsection says so; if one fails and the subsection doesn't say what to do, stop git operations in that repository for the rest of the run, report why and continue without git there. No ToDo card is created before step 8, and only this skill creates one; subagents only return out-of-scope items. Tell every subagent that no user is available and that it never creates a ToDo card, passing answers the user gave at an ask point as ground truth.
gitflow.md (### Apply start, ### Leaf done, ### Review approved, ### Apply end) and the root settings/code-review.md (### Leaf done, ### Apply end, ### Findings), which drives the review loop for the whole run. A missing file or subsection skips the step it drives.$1 to the root id:$1 is missing, report that an explicit id or title is required and stop.specs_search with query $1. With no hit, report that nothing matched and stop; with one, use its id; with several, report the candidates (id and title) and stop, asking for an explicit id.processing, so a stop here leaves it unchanged:specs_get.specs_tree with id = the root id and executionOrder true, once, also for a root without children (the only source of the root's own blockers). Keep its tree and plan.plan.cycle is set, report its specifications (title and id, in order) and stop, changing no status.plan.order is empty, report that nothing under the root is prepared or processing (for a root without children, that it isn't prepared) and stop.internalBlockers entry that is in plan.order doesn't come earlier in it, or one that isn't in plan.order is missing from plan.unpreparedInternalBlockers, report the inconsistency (a backend bug) and stop.plan.unpreparedInternalBlockers entry, add its blockedLeafIds to the skipped set, with the reason "plan.externalBlockers is not empty, ask, listing per blocker its title, id, status, path titles joined with " / " and the titles of its blockedLeafIds:blockedLeafIds to the skipped set with the same reason. A blocker on the root or on an ancestor inside the branch blocks every leaf; then say plainly that nothing runs.plan.order is skipped, report that with the reasons and stop.processing with specs_set_status. The run list is plan.order minus the skipped set, in plan order; leaves already processing from an interrupted run go through the same flow and are re-planned.tree (every node's id, status, parent and children) and keep it current for the rest of the run.### Apply start in every repository.atn:spec-implementation-planner in the foreground with the leaf's id. If it returns its Blocked report, ask, showing the blockers:SendMessage with it as ground truth, and handle its report the same way.### Apply start says to do before a leaf is implemented, take the leaf's baseline, then spawn atn:spec-implementer with the leaf's id and title.TEST FAILURE block, record the failure (leaf, failing tests, command, a summary of the last output). The leaf stays processing, stays off the implemented-leaves list and out of review, and its files are never staged. Ask:atn:spec-implementer again with the failure as context and handle its report the same way; on success drop the recorded failure and continue with step 5.5.### Leaf done in every repository, then code-review.md ### Leaf done for the leaf.### Leaf done says to wait. After the last leaf, wait until every review in flight has settled.### Apply end. Then set every implemented leaf that no code-review.md Rules subsection reviewed or completed during the run to completed with specs_set_status, and handle it as under leaf completion.plan.order is completed, the skipped set is empty and every descendant in the status map is completed, set the root completed with specs_set_status.processing and record why.
Then follow gitflow.md ### Apply end in every repository, also after an early stop in step 5 (never after a stop in step 2 or 3).todos_list without status, which returns the project's cards that are not closed, and drop every item an existing card already covers, recording it as a duplicate of that card (with the card's title).follow-up, tech-debt, bug or idea) and a priority (low, medium or high): the subagent's proposal when it made one, otherwise your own judgment.todos_create with title (at most 200 characters), description, type, priority and originSpecificationId = the specification id recorded with the item. Decide yourself, without asking for approval, whether the card needs open questions, and pass them as questions (at most 3) only under this rule: a question is allowed only when the card cannot be carried out without a decision that only the user can make (a product choice, mutually exclusive approaches with a real trade-off, or an irreversible or destructive action); never ask what the code, the conventions or the settings answer, and never ask "just in case"; most cards have none. Give a question its answer options, in the project's question format (recommended option first and marked), when they can be enumerated. Record the items not chosen as declined.todos_list is unavailable or its call is refused, skip the question and record every item as not created with the reason. If todos_create is unavailable or a call is refused (the subscription plan's card limit, a missing permission or any other error), record that item as not created with the reason and carry on. A failure in this step never changes the root's status, a leaf's status or the run's outcome.Throughout the run:
completed (by the reviewer, a code-review.md Rules subsection or an accepted escalation), follow gitflow.md ### Review approved for it in every repository it touched, then complete its intermediate nodes. Handle leaves in plan order: never for a leaf while an earlier leaf's review has not settled. If a leaf is set back to processing, follow ### Review approved for it again once it is completed again.completed, walk its ancestors bottom-up, stopping below the root: set each one that isn't completed and whose descendants in tree are all completed (a draft leaf keeps its parent open) to completed with specs_set_status, and record it. If a leaf is set back to processing, set every ancestor this run completed back to processing, and recompute once the leaf's review has settled again.completed once its review has settled), add to the skipped set every later leaf in the run list that has it among its internalBlockers, directly or transitively, with the reason "completed, unless a code-review.md Rules subsection says otherwise.OUT OF SCOPE, add its entries to the run's out-of-scope list, each with the id of the leaf being worked on (the root's id for a review covering several leaves or an item tied to no single leaf); a report without the block adds nothing. Keep an item that a resumed or respawned subagent returns again only once. An item qualifies only if it lies outside the scope of the specifications being applied and cannot be done within this run: drop one that is in fact a failure of a leaf of this run (a blocked or skipped leaf, a TEST FAILURE, an open review finding), since that leaf stays processing and is reported as such.completed or left processing (and why).