[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6K3CJRGGB66GSP8F0E54Z9D":3,"skill-same:01M6K3CJRGGB66GSP8F0E54Z9D":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":66},"01M6K3CJRGGB66GSP8F0E54Z9D","pipeline",null,"Use when executing an implementation plan with multiple tasks. Factory orchestration with ready-frontier parallelism, quality gates, rework budgets, and audit trails.","jstoup111\u002Fai-conductor","jstoup111","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1585332?v=4","01M6K374Y0VEFPVCT2KPBAN4HC","James Stoup","01M6K3751X0GFKNBD0198F50XN",7,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fpipeline\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"use","frontier","when","implementation plan","implementation","quality","build","quality gates","with","trails","gates","plans","true","audit","plan","tasks","orchestration","false","structural","ready","2026-11-10 10:12:30",false,"---\nname: pipeline\ndisable-model-invocation: true\ndescription: \"Use when executing an implementation plan with multiple tasks. Factory orchestration with ready-frontier parallelism, quality gates, rework budgets, and audit trails.\"\nenforcement: structural\nphase: build\nstandalone: false\nrequires: [\".docs\u002Fplans\u002F with implementation plan\"]\n---\n\n## Purpose\n\nOrchestrates execution of an implementation plan. The host agent dispatches each task to a TDD\nimplementer through its available subagent facility; subagent context is discarded after each task.\n\n## Execution Model\n\n**Key constraint:** The selected host agent MUST dispatch implementers through its available\nsubagent facility. It must NOT implement directly in the orchestration session. This keeps the orchestrator's\ncontext bounded to ~2-3 summary lines per task regardless of feature size.\n\n**Host mechanics:** Claude Code uses its Agent tool and Claude model labels for this delegation.\nPi has no native facility; with `llm_providers.pi.subagents: true` the engine loads the\n`pi-subagents` extension, and the orchestrator delegates each task with one\n`subagent({ agent: \"delegate\", task: \u003Cdispatch prompt>, async: false })` call. Never shell out to\n`pi` to delegate: a nested process runs outside the engine's model, sandbox, and accounting.\nOther supported hosts use their native equivalent. These mechanics may differ, but they MUST\npreserve the shared task scope, TDD cycle, task attribution, verification, review, and gate\ncontracts below.\n\n## Practices\n\n### Per-Task Execution\n\nLine 1 of every subagent dispatch prompt MUST be `Task: \u003Cid>` (the bare plan header id, e.g.\n`Task: 9`, never `task-9`), or `Task: none` for work that is not a plan task.\nIn Claude Code a PreToolUse session hook reads that line to stamp the task; if it blocks the\ndispatch (exit 2), fix line 1 as its stderr says and redispatch. Other hosts use their native\nattribution mechanism.\n\n**Hosts without a session hook (Codex and Pi today) stamp through the CLI.** Neither has a PreToolUse\nhook, so nothing writes `.pipeline\u002Fcurrent-task` or flips the row to `in_progress` when a task is\ndispatched. On such a host the orchestrator MUST run `conduct task start \u003Cid>` immediately before\neach dispatch; that writes the stamp and marks the row `in_progress` as the hook would have done.\nIf a close is stampless, `conduct task done \u003Cid>` still applies the Done when close contract: it\nrecords evidence for every declared check, or refuses and names a missing check. A completed or\nskipped row may be re-closed without evidence and remains unchanged. After every `conduct task\ndone`, read `.pipeline\u002Ftask-status.json` and confirm the row reads `completed` before reporting\nthe task done. Never report a task as \"marked completed\" on the strength of an exit code alone.\n\nThe selected host agent orchestrates\nthe task through these steps:\n\n```\nPLAN VALIDATION (at pipeline start):\n  - Verify all task IDs from the plan exist in task-status.json\n  - Flag missing tasks as errors before dispatching any work\n  - Parse the Task Dependency Graph from `.docs\u002Fplans\u002F` and build topological order\n\nDEPENDENCY ORDER — Dispatch tasks in topological order respecting declared dependencies.\n  Never skip a task unless its acceptance criteria are already satisfied (verified by test run).\n\n0. DISPATCH MARKER — Line 1 of the implementer prompt is `Task: \u003Cid>` (see above). On a host\n                   without the session hook, run `conduct task start \u003Cid>` first.\n1. DECOMPOSE    — Read task, identify files to touch, check dependencies met\n2. DISPATCH     — Send task to a TDD implementer through the selected host's available subagent facility\n                  with scoped context only. In Claude Code, dispatch through the Agent tool with\n                  Claude Code model=\"sonnet\"; other supported hosts use their native model-selection mechanism.\n                  Dispatch template's line 1 MUST be exactly `Task: \u003Cid>`. Implementer runs the full\n                  TDD cycle: RED → DOMAIN → GREEN → DOMAIN → COMMIT.\n                  Removal-shaped task (the task deletes a file, seam, flag, symbol, or code path)? The\n                  implementer runs `\u002Fcode-removal` for that task instead of opening a RED cycle — a\n                  deletion has no failing test to write, and an absence assertion is never the subject.\n                  `\u002Fcode-removal` carries the survivor method, test triage, and completeness sweep; the\n                  evidence is the deletion diff plus scoped survivor-test evidence;\n                  `test_suite` owns configured suite verification.\n3. VERIFY       — Inspect the implementer's scoped test evidence (see Scoped VERIFY below); run only a minimal targeted check if the evidence is missing or a concrete defect needs reproduction\n4. FIX          — If tests fail, VERIFY failure first (see below), then dispatch implementer with error context\n5. COMMIT       — The implementer commits. `Task:` trailers are telemetry (see Attribution\n                  telemetry); a malformed trailer is never a reason to FAIL a task.\n6. DONE         — Before reporting PASS, use the normal BUILD task-close path. For a task with a\n                  declared `Done when:` block, close it with `conduct task done \u003Cid> --done-when \u003Cn>=\u003Cevidence>`\n                  once for every declared check; the engine records the evidence through\n                  `completeTaskDoneWhen` before it clears `.pipeline\u002Fcurrent-task`. If a declared\n                  `[test]` check is closed, use `--done-when \u003Cn>=test:\u003Cpath>::\u003Ctitle>` for a committed\n                  covering test, or `--unverified \u003Cn>=\u003Creason>` when it cannot be verified. A missing\n                  test for a tagged check is never `--plan-gap`. A check that needs a file the task's\n                  `**Files:**` omits (a call site, union member, registry, or test) is not a plan gap:\n                  change it and add `Scope: \u003Crepo-relative path> — \u003Cwhy>` beside the `Task:` trailer.\n                  In a parallel batch, if another running task lists that file, return FAIL so the\n                  orchestrator runs the two in sequence. Use\n                  `conduct task done \u003Cid> --plan-gap \u003Cn> --reason \u003Ctext>` and report the HALT only when no code\n                  change can meet an untagged check or meeting it would contradict a story, the plan, or an ADR.\n                  A `[test]` citation whose title cannot be provenance-verified as added since the\n                  task began closes as `pending-judgement`; the conductor judges it when the BUILD session ends.\n                  A refused citation returns as a retry hint naming the check and the judge's reason. Repair it by\n                  writing or citing a test that asserts the check, or close that check with\n                  `--unverified \u003Cn>=\u003Creason>` when it cannot be verified.\n                  For a legacy task with no `Done when:` block, close with `conduct task done \u003Cid>`.\n                  Then read `.pipeline\u002Ftask-status.json` and confirm the row reads `completed`.\n7. REPORT       — Return PASS or FAIL with reason to the conductor\n```\n\n### Declared Replication Copy Task\n\nWhen the plan has a resolved `**Pattern-source:**` \u002F `**Rename-map:**` declaration, it MUST\ncontain exactly one declared copy task. That task is mechanical: it establishes the declared\nsource as the target's baseline and identifies the target's remaining delta; it does not decide\nthat a later task is complete or take ownership of that later task's acceptance criteria.\n\nBefore writing anything, derive every source-to-target pair from the resolved declaration and\nvalidate the copy task's `**Files:**` declaration. It MUST list every target path the rename map\nimplies, and the copy task MUST write only those declared targets. An implied but undeclared path\nis a failure: halt the task naming the undeclared path rather than writing outside its scope. A\ncopy task on a plan with no declaration likewise fails closed, naming the absent declaration.\n\nRead every source and prepare every renamed target before modifying the worktree. If any source is\nunreadable or any preparation fails, fail closed naming that file and leave no partial copied target\nset behind. Only after that preflight may the task atomically write each declared target with the\nsource content transformed by the rename map. It consumes zero LLM turns or dispatches for the\ncopy itself.\n\nThe copy task remains an ordinary declared plan task: it retains its `Task: \u003Cid>` attribution and\ncommit ownership, and existing scoped verification, build review, and all lifecycle gates remain\nenabled. The copy establishes a baseline only; each subsequent task retains its complete scope and\nownership unless its whole task is independently proven satisfied by the existing completion rules.\n\n### Delta-only Execution and Whole-Task Satisfaction\n\nAfter the declared copy commits, evaluate each later task against **every acceptance criterion** as\none task. When the copied commit satisfies the whole task, including its scoped verification, close\nit with the existing empty-commit form `Evidence: satisfied-by \u003Ccopy-sha>` plus `Task: \u003Cid>`;\n`prd_audit` still judges that task's completion against the plan.\n\nThis is not a new evidence form or a shortcut around evidence derivation. The cited SHA must\nresolve to an existing commit and be an ancestor of `HEAD`. A nonexistent or unresolvable SHA, or\na SHA that is not an ancestor of `HEAD`, fails derivation: the task remains incomplete and cannot\nclose through `Evidence: satisfied-by`.\n\nIf the copy satisfies only part of a task, or whether it satisfies a criterion is ambiguous, the\nwhole task is a delta task. Do not split its satisfied and unsatisfied criteria into separate\nbuild-time tasks, and do not close any portion with `Evidence: satisfied-by`; run the complete,\nunmodified TDD cycle — RED → DOMAIN → GREEN → DOMAIN → COMMIT — for that task. Ambiguity always\nresolves toward the full cycle.\n\n**Pre-completion scan (first BUILD entry only, never on a retry):** Before dispatching any tasks, check each task's\nacceptance criteria against existing code and test coverage (git log, test files). Batch-verify in\none pass. A task already satisfied — including as a side effect of an earlier task, verified by\npassing tests — closes with the `Evidence: satisfied-by \u003Csha>` empty commit (see `\u002Ftdd`), not a\ndispatch.\n\n**Dependency checking (step 1):** Before dispatching the subagent, verify that all tasks\nlisted in the task's `**Dependencies:**` field are marked as completed in\n`.pipeline\u002Ftask-status.json`. If a dependency is not met, report BLOCKED to the conductor.\n\n**Design-conformance check (step 1):** Before dispatching the subagent, confirm the task builds\ntoward — not against — the governing APPROVED design (the relevant ADR in `.docs\u002Fdecisions\u002F`\nand the FR in the approved PRD). If a task would implement or harden a code path that a current\nAPPROVED ADR\u002FPRD supersedes or forbids, do NOT dispatch it — report BLOCKED and escalate as a\nconformance finding.\n\n**Failure verification (step 4):** Before re-dispatching a failed task, run the **task's scoped\nset** from step 3 VERIFY to confirm the failure is real. On a suite-failure kickback, include\nthe affected tests identified by the engine's failure evidence; never run the full suite.\nIf no scoped set can be identified, record that limitation rather than claiming verification\npassed. If the scoped tests pass, required task evidence exists, and commits exist for the\ntask, mark it completed; aggregate proof remains pending at `test_suite`. Do not trust JSON\nstate alone: it can become stale after connection interruptions or subagent context loss.\n\n**Superseded-symbol check (step 5 — replacement tasks):** Before marking a task `completed`\nwhose plan says it **replaces or supersedes** an existing symbol\u002Fbehavior (\"replace X\",\n\"supersede Y\", \"swap the old path for the new\"), grep that the superseded symbol has **zero\nnon-test callers** in production source:\n\n```bash\ngrep -rn 'oldSymbol' src\u002F | grep -vE '\\.test\\.|\u002Ftest\u002F|\u002F__tests__\u002F'\n```\n\nIf any production caller remains, the new code shipped **orphaned**: report the task FAIL with the\nsurviving call sites; do NOT mark it complete. Pair it with the real-entry-point test required by\n`\u002Fwriting-system-tests` (§3b).\n\n### Attribution telemetry\n\nTask stamping and `Task:` commit trailers are telemetry only. They help the engine\ndisplay progress and diagnose unattributed dispatches, but they never authorize a\nmutation, reject a commit, decide task completion, halt a build, or park work. The\nfresh `build_review` plan-versus-diff judgment is the BUILD completion authority.\n\nBefore every BUILD dispatch, the engine best-effort seeds `.pipeline\u002Ftask-status.json` from the\nselected plan.\n\n**Task status tracking:** `.pipeline\u002Ftask-status.json` is owned by the engine, its session hooks,\nand `conduct task` — never hand-edit it. At ordinary BUILD closure, use\n`conduct task done \u003Cid> --done-when \u003Cn>=\u003Cevidence>` for every declared check so the engine-owned\n`completeTaskDoneWhen` writer records the task-level proof; use `conduct task done \u003Cid> --plan-gap \u003Cn> --reason \u003Ctext>`\nwhen step 6 requires it. Report each subagent's result (PASS\u002FFAIL) to the conductor.\n\n**SHIP validator verdict artifacts are read-only during BUILD.** `.pipeline\u002Fprd-audit.json` is the\ntyped PRD verdict authority (ADR D2.2), and `.pipeline\u002Fprd-audit.md` is its derived human report.\n`.pipeline\u002Farchitecture-review-as-built.md`, `.pipeline\u002Farchitecture-review-as-built.json`,\n`.pipeline\u002Fprd-audit-code-stamp.json`, and\n`.pipeline\u002Farchitecture-review-as-built-code-stamp.json` are owned by their SHIP validators and\nthe engine. BUILD sessions, including remediation retries that cite them, must never write, delete,\nrename, or recreate them. Reading `.pipeline\u002Fremediation.json` and the cited verdict artifact remains allowed.\nOnly the validator's own next dispatch produces a new verdict. A BUILD session that fixes a finding\nrecords its task-level proof through `conduct task done \u003Cid> --done-when \u003Cn>=\u003Cevidence>` instead of\nediting a verdict artifact.\n\n**Subagent context scoping:** The implementer receives ONLY:\n- The task description, its `Done when:` checks, and the verbatim text of every story criterion\n  and ADR decision mapped to it (SHIP grades that text, not the plan's paraphrase)\n- File paths to modify (from the plan's \"Files likely touched\")\n- The TDD skill instructions\n- Every implementer dispatch prompt MUST carry this SHIP verdict read-only rule.\n- A focused **current-HEAD pattern basis** when the task affects an established local pattern:\n  current-checkout paths for the relevant target and exemplar, stable symbol or role hints that\n  locate the behavior despite code movement, and the semantic traits the task must preserve or\n  change. This basis covers only the affected task; it does not include the full plan, unrelated\n  stories, or prior-task history. The implementer reads the named files at the current HEAD before\n  acting.\n\nThe implementer does NOT receive the full plan, all stories, or prior task history.\nThe implementer handles the commit as part of the TDD COMMIT phase.\n\n**Pattern-basis staleness:** A path, symbol, or exemplar named by the handoff is a locating aid,\nnot frozen source text. If the exemplar has moved, find and verify the semantic equivalent in the\ncurrent checkout. If no equivalent can be verified and that uncertainty would change the approach,\nreturn `NEEDS_CONTEXT` to the orchestrator. Do not guess, copy obsolete code, or widen the task's\nscope. This rule governs ordinary semantic pattern reuse only; it does not alter the declared\nreplication copy task's resolved source, rename-map, preflight, or exact-copy requirements.\n\n**No branch hygiene by the implementer — stay on the branch as-is.** Every dispatch prompt MUST\ninstruct the implementer to NOT run `git fetch`, `git pull`, `git rebase`, or switch\nbranches. It commits only to the current feature branch. The only sanctioned rebase is the\ndaemon's finish-time rebase, outside the per-task loop.\n\n**Context efficiency:** Do not inline file contents in subagent prompts. Provide current-checkout\npaths, stable symbol or role hints, and the relevant semantic traits; never use line ranges as a\nhandoff contract. The subagent reads the current HEAD files as needed. For sequential tasks on the\nsame files, reuse the existing host-native implementer session instead of spawning a new agent —\nthis preserves file cache and avoids redundant reads.\n\n**Scope discipline:** Implementers MUST only modify lines directly related to their assigned task.\nChanges to unrelated code in the same file (e.g., changing a CI command while fixing a service\ndefinition, or \"improving\" a method signature while adding a validation) are scope violations.\n`prd_audit` grades them OVER_SCOPE. A file the task needs but its Files list omits is not a\nviolation; record it with a `Scope:` trailer.\n\n**Scoped VERIFY (step 3):** Inspect the implementer's scoped evidence without routine reruns.\nMissing evidence or a concrete suspected defect may require a minimal targeted check, never a suite.\nScoping logic:\n1. Collect the task's diff (`git diff \u003Cpre-task-commit>..HEAD`) to identify new\u002Fmodified production files.\n2. Build the scoped test set: (a) all new\u002Fmodified test files in the diff, plus (b) existing test\n   files covering the modified production modules. Discover these by naming convention (e.g.,\n   `src\u002Ffoo\u002Fbar.ts` → `test\u002Ffoo\u002Fbar.test.ts`) and by grepping test files for imports of or\n   references to modified modules.\n3. Match the supplied results to the changed behavior. If a targeted check is needed, derive\n   minimal selectors from that set and use `ai-conductor scoped-run \u003Cselectors...>`.\n4. Retain the named affected-test set for the batch-boundary union described below.\n\n**Broad fallback:**\n- A shared\u002Fcore module has 3+ production importers.\n- The diff touches config, migrations, dependency manifests, or test infrastructure.\n- The scoped\u002Faffected set is empty.\n- Module-to-test mapping is low-confidence and cannot be made confidently.\n\nFor per-task VERIFY, uncertainty defers aggregate proof; it does not waive known scoped\nfailures or the task's required RED\u002FGREEN evidence.\n\nWhen a trigger fires, state `Aggregate fallback: \u003Cexact trigger and reason>` in the task REPORT\nand DEFER aggregate verification to the engine's dedicated aggregate gate (the `test_suite`\nstep), which owns whole-suite execution and its evidence. Never run the full suite — and never\ninvoke the aggregate verifier — inside the build session; the dedicated step will surface any\ncross-cutting regression and route it back.\n\n**Suite-failure kickback:** Read the engine's retry diagnostics and referenced\n`.pipeline\u002Ftest-suite-evidence.json`. Pass the relevant failure evidence and affected-test\nselectors to repair subagents. Fix the failure, verify the scoped affected-test union\nthrough `ai-conductor scoped-run \u003Cselectors...>`, then commit and leave the aggregate rerun to\n`test_suite`. A scoped PASS does not establish an aggregate PASS.\n\n**Build-review work order:** A retry carrying a `Build-review remediation work order` is the job\neven when every task already reads completed. Each listed repair ends in a commit under its admitted\ntask id, or, if you judge it done or wrong, in `Need user decision: case \u003CcaseId> — \u003Cevidence>`\nwritten to `.pipeline\u002Fhalt-user-input-required`.\n\n**Batch affected-test union:** At each batch boundary, compute one named\n`BATCH_AFFECTED_TESTS` union by deduplicating every task's scoped affected-test set and retain\nthe supplied results. Do not rerun the union routinely. A concrete task-interaction risk or\nchanged behavior may justify a minimal targeted check through `ai-conductor scoped-run \u003Cselectors...>`.\nWhen `BATCH_AFFECTED_TESTS` cannot be determined with confidence, record that in the REPORT and defer aggregate proof to the engine's dedicated aggregate gate — the build session never runs the full test suite.\n\n**REPORT requirement (step 6):** The task's step 6 REPORT must list the files included in the\nscoped test set (or, if a fallback trigger fired, state the trigger, the tests actually run, and the deferred aggregate proof).\nThis provides audit-trail visibility into the scoping decision.\n\n### Halt-and-Escalate (Explicit User-Input Required)\n\nWhen pipeline detects a state that NO automated retry could resolve — a scope\nmismatch between the complexity tier and the task list, an ambiguous requirement\nthat needs user judgement, a decision between two approaches where the plan\ndoesn't specify, etc. — do NOT output a rhetorical question like \"here are\nthree options, what would you prefer?\" as a wrap-up. Autonomous retries will\nre-dispatch the host agent against the same unresolved question and burn the retry\nbudget without producing new task completions.\n\nIf you're tempted to ask \"resolve now or exit to the harness?\", you must\ninstead write the halt marker — the user picking \"exit\" is a halt, not a\nsuccessful exit. See \"User-requested exit during a run\" below.\n\nInstead, write a marker file and exit:\n\n```bash\nmkdir -p .pipeline\necho \"Need user decision: \u003Cone-line summary of the blocker>\" > \\\n  .pipeline\u002Fhalt-user-input-required\n```\n\nIn interactive runs the conductor then opens a session so the user can resolve the blocker. In\ndaemon runs it routes the question once to `\u002Fremediate`, which either answers it (the build resumes\nwith the answer) or escalates it to a human with your question verbatim — so make the one-line\nquestion self-contained.\n\n### User-requested exit during a run\n\nIf the user explicitly asks to \"exit to the harness\", \"stop and continue\nlater\", \"pause\", or anything equivalent at any point in the run, treat it\nas a halt — **not** as a successful exit. Before exiting, you MUST:\n\n1. Write `.pipeline\u002Fhalt-user-input-required` with a one-line summary of the\n   next action (e.g. `\"user requested exit; 1 regression in test_X pending fix\"`).\n2. Do NOT mark unfinished tasks as `completed` or `skipped`.\n\nWithout the marker the conductor can read the build as done and cascade into SHIP.\n\n### Retry Pre-Check (Connection Interruption Recovery)\n\nAfter a connection interruption or session resume, inspect recent commits\n(`git log --oneline -3`) and verify existing work before redoing it. The engine refuses to complete\nBUILD with a dirty tree.\n\n### Rework Budget\n\nEach task gets **3 rework cycles** per quality gate. If it still fails after the third, write the\nhalt marker (see Halt-and-Escalate) naming what the evaluator found, what was tried, and what still\nfails.\n\n### Parallel Execution\n\nEvery plan MUST schedule work by **ready frontier**, not by walking the plan one task at a time. At\npipeline start and after every join, build the ready frontier from pending tasks whose declared\ndependencies are completed, then exclude any pair with overlapping likely-touched files. Dependent\nor overlapping-file tasks stay sequential and move to the next frontier after the earlier task\ncompletes.\n\n**The parallel cap X.** Dispatch at most 3 independent tasks concurrently, and never more than the\nhost can run at once. Before each fan-out, set X = min(3, free sub-agent slots on this host):\n\n- **Codex** states its capacity in its multi-agent instructions (\"There are N available\n  concurrency slots… including you\"). Free slots are N − 1 (this session) minus any sub-agents\n  already active. The operator raises N with `[agents] max_threads` in `~\u002F.codex\u002Fconfig.toml`.\n- **Claude Code** allows `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` concurrent Agent-tool sub-agents\n  per session (default 20). Free slots are that limit minus sub-agents already running, so X is\n  normally 3.\n- A host with no native concurrent-dispatch facility has 0 free slots.\n\nWhen X = 1 (one free slot, none, or a frontier of one task), run the frontier sequentially, one at a\ntime, in this session. That is a normal schedule, not a failure: never halt or ask the operator to choose\na mode because fewer slots are free. Record X for each frontier in the batch-boundary report so the\nreduced parallelism is visible.\n\nDaemon concurrency does not change X. Each daemon dispatch is its own host session with its own\nslots.\n\nWhen X ≥ 2 and the ready frontier holds two or more independent tasks,\nuse one host-native fan-out operation to dispatch up to X of them concurrently. Do not emit one\ndispatch, wait for it, and then emit the next. The provider-specific seams are explicit:\n\n- Claude Code performs one response containing multiple Agent tool dispatches, one per selected\n  task, then waits for all dispatched agents to return.\n- Codex performs one response containing multiple `collaboration.spawn_agent` calls, one per\n  selected task, then waits for all dispatched agents to return with `collaboration.wait_agent`.\n\nParallel agents share the same directory, so their file sets must not overlap.\n\n### Batch Boundaries\n\nAt natural batch boundaries (after completing a group of related tasks):\n\n**Pre-batch verification (before starting next batch):**\n- Inspect the supplied results for `BATCH_AFFECTED_TESTS`; do not rerun the union as a ritual.\n  If ANY test fails that is NOT an expected RED test, stop and fix before proceeding.\n- Verify the current branch is merge-ready: no WIP commits, no TODO-fixme code added this batch,\n  all new code has tests. The branch should be shippable at any batch boundary, even if the\n  feature is incomplete.\n\n**Post-batch checks:**\n- Run the linter (if tech-context specifies one)\n- Run the `simplify` workflow to check for accumulated duplication (dry business logic, not dry\n  code; Claude `\u002Fsimplify`; Codex `$simplify`).\n  If dispatched through the selected host's available subagent facility, the `\u002Fsimplify` dispatch prompt's first line MUST be\n  `Task: none` (session-hook marker contract, see Per-Task Execution).\n- Verify architecture diagrams are current (if structural files changed in this batch, run the\n  `architecture-diagram` workflow in verification mode; Claude `\u002Farchitecture-diagram`; Codex\n  `$architecture-diagram`)\n- Append to `.pipeline\u002Fprogress.log` — a chronological narrative of what was done, what was\n  tried, what worked, and what's next (see Progress Log below)\n- Report batch status as a single line: `Batch N: \u003Cpassed>\u002F\u003Ctotal> PASS, \u003Crework> rework, cap X`\n- Continue unless the user intervenes\n\n### Memory Checkpoint (Per-Batch)\n\n**GATE: Every batch must persist at least one `.memory\u002F` entry before proceeding.**\n\nPersist decisions, patterns, gotchas, or context learned during the batch. Update `.memory\u002Findex.md` after each write. If dispatched through the selected host's available subagent facility, the memory-checkpoint dispatch prompt's first line MUST be `Task: none` (session-hook marker contract, see Per-Task Execution).\n\n### Progress Log\n\nAppend to `.pipeline\u002Fprogress.log` at every batch boundary — a chronological narrative for cross-session continuity.\n\n### Git Revert Recovery\n\nWhen the rework budget is exhausted, consider reverting to the last clean batch boundary commit (`git revert --no-commit HEAD~N..HEAD`) and re-approaching rather than continuing to patch. Each batch boundary is a merge-ready state, so reverting never loses unrelated work.\n\n### Pipeline Summary\n\n**At final-task completion, write `.pipeline\u002Fsummary.json` before marking the pipeline done:**\n`{\"plan_ref\": \"\u003Cplan path>\", \"tasks_total\": N, \"tasks_completed\": N, \"tasks_skipped\": N}`, counted\nfrom `.pipeline\u002Ftask-status.json`. The engine reads `tasks_completed` as completion evidence.\n\n## Verification\n\n- [ ] Parallel cap X computed from free host slots before each fan-out\n- [ ] Each task followed the TDD cycle (or `\u002Fcode-removal` for a removal task)\n- [ ] Every subagent dispatch's line 1 is exactly `Task: \u003Cid>` or `Task: none`\n- [ ] No `completed` status was hand-written\n- [ ] Rework budget tracked (halt marker at 3 cycles)\n- [ ] `.pipeline\u002Fsummary.json` written at final-task completion\n","## Purpose\n\nOrchestrates execution of an implementation plan. The host agent dispatches each task to a TDD\nimplementer through its available subagent facility; subagent context is discarded after each task.\n\n## Execution Model\n\n**Key constraint:** The selected host agent MUST dispatch implementers through its available\nsubagent facility. It must NOT implement directly in the orchestration session. This keeps the orchestrator's\ncontext bounded to ~2-3 summary lines per task regardless of feature size.\n\n**Host mechanics:** Claude Code uses its Agent tool and Claude model labels for this delegation.\nPi has no native facility; with `llm_providers.pi.subagents: true` the engine loads the\n`pi-subagents` extension, and the orchestrator delegates each task with one\n`subagent({ agent: \"delegate\", task: \u003Cdispatch prompt>, async: false })` call. Never shell out to\n`pi` to delegate: a nested process runs outside the engine's model, sandbox, and accounting.\nOther supported hosts use their native equivalent. These mechanics may differ, but they MUST\npreserve the shared task scope, TDD cycle, task attribution, verification, review, and gate\ncontracts below.\n\n## Practices\n\n### Per-Task Execution\n\nLine 1 of every subagent dispatch prompt MUST be `Task: \u003Cid>` (the bare plan header id, e.g.\n`Task: 9`, never `task-9`), or `Task: none` for work that is not a plan task.\nIn Claude Code a PreToolUse session hook reads that line to stamp the task; if it blocks the\ndispatch (exit 2), fix line 1 as its stderr says and redispatch. Other hosts use their native\nattribution mechanism.\n\n**Hosts without a session hook (Codex and Pi today) stamp through the CLI.** Neither has a PreToolUse\nhook, so nothing writes `.pipeline\u002Fcurrent-task` or flips the row to `in_progress` when a task is\ndispatched. On such a host the orchestrator MUST run `conduct task start \u003Cid>` immediately before\neach dispatch; that writes the stamp and marks the row `in_progress` as the hook would have done.\nIf a close is stampless, `conduct task done \u003Cid>` still applies the Done when close contract: it\nrecords evidence for every declared check, or refuses and names a missing check. A completed or\nskipped row may be re-closed without evidence and remains unchanged. After every `conduct task\ndone`, read `.pipeline\u002Ftask-status.json` and confirm the row reads `completed` before reporting\nthe task done. Never report a task as \"marked completed\" on the strength of an exit code alone.\n\nThe selected host agent orchestrates\nthe task through these steps:\n\n```\nPLAN VALIDATION (at pipeline start):\n  - Verify all task IDs from the plan exist in task-status.json\n  - Flag missing tasks as errors before dispatching any work\n  - Parse the Task Dependency Graph from `.docs\u002Fplans\u002F` and build topological order\n\nDEPENDENCY ORDER — Dispatch tasks in topological order respecting declared dependencies.\n  Never skip a task unless its acceptance criteria are already satisfied (verified by test run).\n\n0. DISPATCH MARKER — Line 1 of the implementer prompt is `Task: \u003Cid>` (see above). On a host\n                   without the session hook, run `conduct task start \u003Cid>` first.\n1. DECOMPOSE    — Read task, identify files to touch, check dependencies met\n2. DISPATCH     — Send task to a TDD implementer through the selected host's available subagent facility\n                  with scoped context only. In Claude Code, dispatch through the Agent tool with\n                  Claude Code model=\"sonnet\"; other supported hosts use their native model-selection mechanism.\n                  Dispatch template's line 1 MUST be exactly `Task: \u003Cid>`. Implementer runs the full\n                  TDD cycle: RED → DOMAIN → GREEN → DOMAIN → COMMIT.\n                  Removal-shaped task (the task deletes a file, seam, flag, symbol, or code path)? The\n                  implementer runs `\u002Fcode-removal` for that task instead of opening a RED cycle — a\n                  deletion has no failing test to write, and an absence assertion is never the subject.\n                  `\u002Fcode-removal` carries the survivor method, test triage, and completeness sweep; the\n                  evidence is the deletion diff plus scoped survivor-test evidence;\n                  `test_suite` owns configured suite verification.\n3. VERIFY       — Inspect the implementer's scoped test evidence (see Scoped VERIFY below); run only a minimal targeted check if the evidence is missing or a concrete defect needs reproduction\n4. FIX          — If tests fail, VERIFY failure first (see below), then dispatch implementer with error context\n5. COMMIT       — The implementer commits. `Task:` trailers are telemetry (see Attribution\n                  telemetry); a malformed trailer is never a reason to FAIL a task.\n6. DONE         — Before reporting PASS, use the normal BUILD task-close path. For a task with a\n                  declared `Done when:` block, close it with `conduct task done \u003Cid> --done-when \u003Cn>=\u003Cevidence>`\n                  once for every declared check; the engine records the evidence through\n                  `completeTaskDoneWhen` before it clears `.pipeline\u002Fcurrent-task`. If a declared\n                  `[test]` check is closed, use `--done-when \u003Cn>=test:\u003Cpath>::\u003Ctitle>` for a committed\n                  covering test, or `--unverified \u003Cn>=\u003Creason>` when it cannot be verified. A missing\n                  test for a tagged check is never `--plan-gap`. A check that needs a file the task's\n                  `**Files:**` omits (a call site, union member, registry, or test) is not a plan gap:\n                  change it and add `Scope: \u003Crepo-relative path> — \u003Cwhy>` beside the `Task:` trailer.\n                  In a parallel batch, if another running task lists that file, return FAIL so the\n                  orchestrator runs the two in sequence. Use\n                  `conduct task done \u003Cid> --plan-gap \u003Cn> --reason \u003Ctext>` and report the HALT only when no code\n                  change can meet an untagged check or meeting it would contradict a story, the plan, or an ADR.\n                  A `[test]` citation whose title cannot be provenance-verified as added since the\n                  task began closes as `pending-judgement`; the conductor judges it when the BUILD session ends.\n                  A refused citation returns as a retry hint naming the check and the judge's reason. Repair it by\n                  writing or citing a test that asserts the check, or close that check with\n                  `--unverified \u003Cn>=\u003Creason>` when it cannot be verified.\n                  For a legacy task with no `Done when:` block, close with `conduct task done \u003Cid>`.\n                  Then read `.pipeline\u002Ftask-status.json` and confirm the row reads `completed`.\n7. REPORT       — Return PASS or FAIL with reason to the conductor\n```\n\n### Declared Replication Copy Task\n\nWhen the plan has a resolved `**Pattern-source:**` \u002F `**Rename-map:**` declaration, it MUST\ncontain exactly one declared copy task. That task is mechanical: it establishes the declared\nsource as the target's baseline and identifies the target's remaining delta; it does not decide\nthat a later task is complete or take ownership of that later task's acceptance criteria.\n\nBefore writing anything, derive every source-to-target pair from the resolved declaration and\nvalidate the copy task's `**Files:**` declaration. It MUST list every target path the rename map\nimplies, and the copy task MUST write only those declared targets. An implied but undeclared path\nis a failure: halt the task naming the undeclared path rather than writing outside its scope. A\ncopy task on a plan with no declaration likewise fails closed, naming the absent declaration.\n\nRead every source and prepare every renamed target before modifying the worktree. If any source is\nunreadable or any preparation fails, fail closed naming that file and leave no partial copied target\nset behind. Only after that preflight may the task atomically write each declared target with the\nsource content transformed by the rename map. It consumes zero LLM turns or dispatches for the\ncopy itself.\n\nThe copy task remains an ordinary declared plan task: it retains its `Task: \u003Cid>` attribution and\ncommit ownership, and existing scoped verification, build review, and all lifecycle gates remain\nenabled. The copy establishes a baseline only; each subsequent task retains its complete scope and\nownership unless its whole task is independently proven satisfied by the existing completion rules.\n\n### Delta-only Execution and Whole-Task Satisfaction\n\nAfter the declared copy commits, evaluate each later task against **every acceptance criterion** as\none task. When the copied commit satisfies the whole task, including its scoped verification, close\nit with the existing empty-commit form `Evidence: satisfied-by \u003Ccopy-sha>` plus `Task: \u003Cid>`;\n`prd_audit` still judges that task's completion against the plan.\n\nThis is not a new evidence form or a shortcut around evidence derivation. The cited SHA must\nresolve to an existing commit and be an ancestor of `HEAD`. A nonexistent or unresolvable SHA, or\na SHA that is not an ancestor of `HEAD`, fails derivation: the task remains incomplete and cannot\nclose through `Evidence: satisfied-by`.\n\nIf the copy satisfies only part of a task, or whether it satisfies a criterion is ambiguous, the\nwhole task is a delta task. Do not split its satisfied and unsatisfied criteria into separate\nbuild-time tasks, and do not close any portion with `Evidence: satisfied-by`; run the complete,\nunmodified TDD cycle — RED → DOMAIN → GREEN → DOMAIN → COMMIT — for that task. Ambiguity always\nresolves toward the full cycle.\n\n**Pre-completion scan (first BUILD entry only, never on a retry):** Before dispatching any tasks, check each task's\nacceptance criteria against existing code and test coverage (git log, test files). Batch-verify in\none pass. A task already satisfied — including as a side effect of an earlier task, verified by\npassing tests — closes with the `Evidence: satisfied-by \u003Csha>` empty commit (see `\u002Ftdd`), not a\ndispatch.\n\n**Dependency checking (step 1):** Before dispatching the subagent, verify that all tasks\nlisted in the task's `**Dependencies:**` field are marked as completed in\n`.pipeline\u002Ftask-status.json`. If a dependency is not met, report BLOCKED to the conductor.\n\n**Design-conformance check (step 1):** Before dispatching the subagent, confirm the task builds\ntoward — not against — the governing APPROVED design (the relevant ADR in `.docs\u002Fdecisions\u002F`\nand the FR in the approved PRD). If a task would implement or harden a code path that a current\nAPPROVED ADR\u002FPRD supersedes or forbids, do NOT dispatch it — report BLOCKED and escalate as a\nconformance finding.\n\n**Failure verification (step 4):** Before re-dispatching a failed task, run the **task's scoped\nset** from step 3 VERIFY to confirm the failure is real. On a suite-failure kickback, include\nthe affected tests identified by the engine's failure evidence; never run the full suite.\nIf no scoped set can be identified, record that limitation rather than claiming verification\npassed. If the scoped tests pass, required task evidence exists, and commits exist for the\ntask, mark it completed; aggregate proof remains pending at `test_suite`. Do not trust JSON\nstate alone: it can become stale after connection interruptions or subagent context loss.\n\n**Superseded-symbol check (step 5 — replacement tasks):** Before marking a task `completed`\nwhose plan says it **replaces or supersedes** an existing symbol\u002Fbehavior (\"replace X\",\n\"supersede Y\", \"swap the old path for the new\"), grep that the superseded symbol has **zero\nnon-test callers** in production source:\n\n```bash\ngrep -rn 'oldSymbol' src\u002F | grep -vE '\\.test\\.|\u002Ftest\u002F|\u002F__tests__\u002F'\n```\n\nIf any production caller remains, the new code shipped **orphaned**: report the task FAIL with the\nsurviving call sites; do NOT mark it complete. Pair it with the real-entry-point test required by\n`\u002Fwriting-system-tests` (§3b).\n\n### Attribution telemetry\n\nTask stamping and `Task:` commit trailers are telemetry only. They help the engine\ndisplay progress and diagnose unattributed dispatches, but they never authorize a\nmutation, reject a commit, decide task completion, halt a build, or park work. The\nfresh `build_review` plan-versus-diff judgment is the BUILD completion authority.\n\nBefore every BUILD dispatch, the engine best-effort seeds `.pipeline\u002Ftask-status.json` from the\nselected plan.\n\n**Task status tracking:** `.pipeline\u002Ftask-status.json` is owned by the engine, its session hooks,\nand `conduct task` — never hand-edit it. At ordinary BUILD closure, use\n`conduct task done \u003Cid> --done-when \u003Cn>=\u003Cevidence>` for every declared check so the engine-owned\n`completeTaskDoneWhen` writer records the task-level proof; use `conduct task done \u003Cid> --plan-gap \u003Cn> --reason \u003Ctext>`\nwhen step 6 requires it. Report each subagent's result (PASS\u002FFAIL) to the conductor.\n\n**SHIP validator verdict artifacts are read-only during BUILD.** `.pipeline\u002Fprd-audit.json` is the\ntyped PRD verdict authority (ADR D2.2), and `.pipeline\u002Fprd-audit.md` is its derived human report.\n`.pipeline\u002Farchitecture-review-as-built.md`, `.pipeline\u002Farchitecture-review-as-built.json`,\n`.pipeline\u002Fprd-audit-code-stamp.json`, and\n`.pipeline\u002Farchitecture-review-as-built-code-stamp.json` are owned by their SHIP validators and\nthe engine. BUILD sessions, including remediation retries that cite them, must never write, delete,\nrename, or recreate them. Reading `.pipeline\u002Fremediation.json` and the cited verdict artifact remains allowed.\nOnly the validator's own next dispatch produces a new verdict. A BUILD session that fixes a finding\nrecords its task-level proof through `conduct task done \u003Cid> --done-when \u003Cn>=\u003Cevidence>` instead of\nediting a verdict artifact.\n\n**Subagent context scoping:** The implementer receives ONLY:\n- The task description, its `Done when:` checks, and the verbatim text of every story criterion\n  and ADR decision mapped to it (SHIP grades that text, not the plan's paraphrase)\n- File paths to modify (from the plan's \"Files likely touched\")\n- The TDD skill instructions\n- Every implementer dispatch prompt MUST carry this SHIP verdict read-only rule.\n- A focused **current-HEAD pattern basis** when the task affects an established local pattern:\n  current-checkout paths for the relevant target and exemplar, stable symbol or role hints that\n  locate the behavior despite code movement, and the semantic traits the task must preserve or\n  change. This basis covers only the affected task; it does not include the full plan, unrelated\n  stories, or prior-task history. The implementer reads the named files at the current HEAD before\n  acting.\n\nThe implementer does NOT receive the full plan, all stories, or prior task history.\nThe implementer handles the commit as part of the TDD COMMIT phase.\n\n**Pattern-basis staleness:** A path, symbol, or exemplar named by the handoff is a locating aid,\nnot frozen source text. If the exemplar has moved, find and verify the semantic equivalent in the\ncurrent checkout. If no equivalent can be verified and that uncertainty would change the approach,\nreturn `NEEDS_CONTEXT` to the orchestrator. Do not guess, copy obsolete code, or widen the task's\nscope. This rule governs ordinary semantic pattern reuse only; it does not alter the declared\nreplication copy task's resolved source, rename-map, preflight, or exact-copy requirements.\n\n**No branch hygiene by the implementer — stay on the branch as-is.** Every dispatch prompt MUST\ninstruct the implementer to NOT run `git fetch`, `git pull`, `git rebase`, or switch\nbranches. It commits only to the current feature branch. The only sanctioned rebase is the\ndaemon's finish-time rebase, outside the per-task loop.\n\n**Context efficiency:** Do not inline file contents in subagent prompts. Provide current-checkout\npaths, stable symbol or role hints, and the relevant semantic traits; never use line ranges as a\nhandoff contract. The subagent reads the current HEAD files as needed. For sequential tasks on the\nsame files, reuse the existing host-native implementer session instead of spawning a new agent —\nthis preserves file cache and avoids redundant reads.\n\n**Scope discipline:** Implementers MUST only modify lines directly related to their assigned task.\nChanges to unrelated code in the same file (e.g., changing a CI command while fixing a service\ndefinition, or \"improving\" a method signature while adding a validation) are scope violations.\n`prd_audit` grades them OVER_SCOPE. A file the task needs but its Files list omits is not a\nviolation; record it with a `Scope:` trailer.\n\n**Scoped VERIFY (step 3):** Inspect the implementer's scoped evidence without routine reruns.\nMissing evidence or a concrete suspected defect may require a minimal targeted check, never a suite.\nScoping logic:\n1. Collect the task's diff (`git diff \u003Cpre-task-commit>..HEAD`) to identify new\u002Fmodified production files.\n2. Build the scoped test set: (a) all new\u002Fmodified test files in the diff, plus (b) existing test\n   files covering the modified production modules. Discover these by naming convention (e.g.,\n   `src\u002Ffoo\u002Fbar.ts` → `test\u002Ffoo\u002Fbar.test.ts`) and by grepping test files for imports of or\n   references to modified modules.\n3. Match the supplied results to the changed behavior. If a targeted check is needed, derive\n   minimal selectors from that set and use `ai-conductor scoped-run \u003Cselectors...>`.\n4. Retain the named affected-test set for the batch-boundary union described below.\n\n**Broad fallback:**\n- A shared\u002Fcore module has 3+ production importers.\n- The diff touches config, migrations, dependency manifests, or test infrastructure.\n- The scoped\u002Faffected set is empty.\n- Module-to-test mapping is low-confidence and cannot be made confidently.\n\nFor per-task VERIFY, uncertainty defers aggregate proof; it does not waive known scoped\nfailures or the task's required RED\u002FGREEN evidence.\n\nWhen a trigger fires, state `Aggregate fallback: \u003Cexact trigger and reason>` in the task REPORT\nand DEFER aggregate verification to the engine's dedicated aggregate gate (the `test_suite`\nstep), which owns whole-suite execution and its evidence. Never run the full suite — and never\ninvoke the aggregate verifier — inside the build session; the dedicated step will surface any\ncross-cutting regression and route it back.\n\n**Suite-failure kickback:** Read the engine's retry diagnostics and referenced\n`.pipeline\u002Ftest-suite-evidence.json`. Pass the relevant failure evidence and affected-test\nselectors to repair subagents. Fix the failure, verify the scoped affected-test union\nthrough `ai-conductor scoped-run \u003Cselectors...>`, then commit and leave the aggregate rerun to\n`test_suite`. A scoped PASS does not establish an aggregate PASS.\n\n**Build-review work order:** A retry carrying a `Build-review remediation work order` is the job\neven when every task already reads completed. Each listed repair ends in a commit under its admitted\ntask id, or, if you judge it done or wrong, in `Need user decision: case \u003CcaseId> — \u003Cevidence>`\nwritten to `.pipeline\u002Fhalt-user-input-required`.\n\n**Batch affected-test union:** At each batch boundary, compute one named\n`BATCH_AFFECTED_TESTS` union by deduplicating every task's scoped affected-test set and retain\nthe supplied results. Do not rerun the union routinely. A concrete task-interaction risk or\nchanged behavior may justify a minimal targeted check through `ai-conductor scoped-run \u003Cselectors...>`.\nWhen `BATCH_AFFECTED_TESTS` cannot be determined with confidence, record that in the REPORT and defer aggregate proof to the engine's dedicated aggregate gate — the build session never runs the full test suite.\n\n**REPORT requirement (step 6):** The task's step 6 REPORT must list the files included in the\nscoped test set (or, if a fallback trigger fired, state the trigger, the tests actually run, and the deferred aggregate proof).\nThis provides audit-trail visibility into the scoping decision.\n\n### Halt-and-Escalate (Explicit User-Input Required)\n\nWhen pipeline detects a state that NO automated retry could resolve — a scope\nmismatch between the complexity tier and the task list, an ambiguous requirement\nthat needs user judgement, a decision between two approaches where the plan\ndoesn't specify, etc. — do NOT output a rhetorical question like \"here are\nthree options, what would you prefer?\" as a wrap-up. Autonomous retries will\nre-dispatch the host agent against the same unresolved question and burn the retry\nbudget without producing new task completions.\n\nIf you're tempted to ask \"resolve now or exit to the harness?\", you must\ninstead write the halt marker — the user picking \"exit\" is a halt, not a\nsuccessful exit. See \"User-requested exit during a run\" below.\n\nInstead, write a marker file and exit:\n\n```bash\nmkdir -p .pipeline\necho \"Need user decision: \u003Cone-line summary of the blocker>\" > \\\n  .pipeline\u002Fhalt-user-input-required\n```\n\nIn interactive runs the conductor then opens a session so the user can resolve the blocker. In\ndaemon runs it routes the question once to `\u002Fremediate`, which either answers it (the build resumes\nwith the answer) or escalates it to a human with your question verbatim — so make the one-line\nquestion self-contained.\n\n### User-requested exit during a run\n\nIf the user explicitly asks to \"exit to the harness\", \"stop and continue\nlater\", \"pause\", or anything equivalent at any point in the run, treat it\nas a halt — **not** as a successful exit. Before exiting, you MUST:\n\n1. Write `.pipeline\u002Fhalt-user-input-required` with a one-line summary of the\n   next action (e.g. `\"user requested exit; 1 regression in test_X pending fix\"`).\n2. Do NOT mark unfinished tasks as `completed` or `skipped`.\n\nWithout the marker the conductor can read the build as done and cascade into SHIP.\n\n### Retry Pre-Check (Connection Interruption Recovery)\n\nAfter a connection interruption or session resume, inspect recent commits\n(`git log --oneline -3`) and verify existing work before redoing it. The engine refuses to complete\nBUILD with a dirty tree.\n\n### Rework Budget\n\nEach task gets **3 rework cycles** per quality gate. If it still fails after the third, write the\nhalt marker (see Halt-and-Escalate) naming what the evaluator found, what was tried, and what still\nfails.\n\n### Parallel Execution\n\nEvery plan MUST schedule work by **ready frontier**, not by walking the plan one task at a time. At\npipeline start and after every join, build the ready frontier from pending tasks whose declared\ndependencies are completed, then exclude any pair with overlapping likely-touched files. Dependent\nor overlapping-file tasks stay sequential and move to the next frontier after the earlier task\ncompletes.\n\n**The parallel cap X.** Dispatch at most 3 independent tasks concurrently, and never more than the\nhost can run at once. Before each fan-out, set X = min(3, free sub-agent slots on this host):\n\n- **Codex** states its capacity in its multi-agent instructions (\"There are N available\n  concurrency slots… including you\"). Free slots are N − 1 (this session) minus any sub-agents\n  already active. The operator raises N with `[agents] max_threads` in `~\u002F.codex\u002Fconfig.toml`.\n- **Claude Code** allows `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` concurrent Agent-tool sub-agents\n  per session (default 20). Free slots are that limit minus sub-agents already running, so X is\n  normally 3.\n- A host with no native concurrent-dispatch facility has 0 free slots.\n\nWhen X = 1 (one free slot, none, or a frontier of one task), run the frontier sequentially, one at a\ntime, in this session. That is a normal schedule, not a failure: never halt or ask the operator to choose\na mode because fewer slots are free. Record X for each frontier in the batch-boundary report so the\nreduced parallelism is visible.\n\nDaemon concurrency does not change X. Each daemon dispatch is its own host session with its own\nslots.\n\nWhen X ≥ 2 and the ready frontier holds two or more independent tasks,\nuse one host-native fan-out operation to dispatch up to X of them concurrently. Do not emit one\ndispatch, wait for it, and then emit the next. The provider-specific seams are explicit:\n\n- Claude Code performs one response containing multiple Agent tool dispatches, one per selected\n  task, then waits for all dispatched agents to return.\n- Codex performs one response containing multiple `collaboration.spawn_agent` calls, one per\n  selected task, then waits for all dispatched agents to return with `collaboration.wait_agent`.\n\nParallel agents share the same directory, so their file sets must not overlap.\n\n### Batch Boundaries\n\nAt natural batch boundaries (after completing a group of related tasks):\n\n**Pre-batch verification (before starting next batch):**\n- Inspect the supplied results for `BATCH_AFFECTED_TESTS`; do not rerun the union as a ritual.\n  If ANY test fails that is NOT an expected RED test, stop and fix before proceeding.\n- Verify the current branch is merge-ready: no WIP commits, no TODO-fixme code added this batch,\n  all new code has tests. The branch should be shippable at any batch boundary, even if the\n  feature is incomplete.\n\n**Post-batch checks:**\n- Run the linter (if tech-context specifies one)\n- Run the `simplify` workflow to check for accumulated duplication (dry business logic, not dry\n  code; Claude `\u002Fsimplify`; Codex `$simplify`).\n  If dispatched through the selected host's available subagent facility, the `\u002Fsimplify` dispatch prompt's first line MUST be\n  `Task: none` (session-hook marker contract, see Per-Task Execution).\n- Verify architecture diagrams are current (if structural files changed in this batch, run the\n  `architecture-diagram` workflow in verification mode; Claude `\u002Farchitecture-diagram`; Codex\n  `$architecture-diagram`)\n- Append to `.pipeline\u002Fprogress.log` — a chronological narrative of what was done, what was\n  tried, what worked, and what's next (see Progress Log below)\n- Report batch status as a single line: `Batch N: \u003Cpassed>\u002F\u003Ctotal> PASS, \u003Crework> rework, cap X`\n- Continue unless the user intervenes\n\n### Memory Checkpoint (Per-Batch)\n\n**GATE: Every batch must persist at least one `.memory\u002F` entry before proceeding.**\n\nPersist decisions, patterns, gotchas, or context learned during the batch. Update `.memory\u002Findex.md` after each write. If dispatched through the selected host's available subagent facility, the memory-checkpoint dispatch prompt's first line MUST be `Task: none` (session-hook marker contract, see Per-Task Execution).\n\n### Progress Log\n\nAppend to `.pipeline\u002Fprogress.log` at every batch boundary — a chronological narrative for cross-session continuity.\n\n### Git Revert Recovery\n\nWhen the rework budget is exhausted, consider reverting to the last clean batch boundary commit (`git revert --no-commit HEAD~N..HEAD`) and re-approaching rather than continuing to patch. Each batch boundary is a merge-ready state, so reverting never loses unrelated work.\n\n### Pipeline Summary\n\n**At final-task completion, write `.pipeline\u002Fsummary.json` before marking the pipeline done:**\n`{\"plan_ref\": \"\u003Cplan path>\", \"tasks_total\": N, \"tasks_completed\": N, \"tasks_skipped\": N}`, counted\nfrom `.pipeline\u002Ftask-status.json`. The engine reads `tasks_completed` as completion evidence.\n\n## Verification\n\n- [ ] Parallel cap X computed from free host slots before each fan-out\n- [ ] Each task followed the TDD cycle (or `\u002Fcode-removal` for a removal task)\n- [ ] Every subagent dispatch's line 1 is exactly `Task: \u003Cid>` or `Task: none`\n- [ ] No `completed` status was hand-written\n- [ ] Rework budget tracked (halt marker at 3 cycles)\n- [ ] `.pipeline\u002Fsummary.json` written at final-task completion\n",{"name":5,"phase":25,"requires":44,"standalone":40,"description":7,"enforcement":37,"disable-model-invocation":46},[45],".docs\u002Fplans\u002F with implementation plan",true,"main","60310a111655e2d63b87223befba464932465487","skills\u002Fpipeline",2,"https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor","https:\u002F\u002Fgithub.com\u002Fjstoup111","2026-11-14 14:59:43",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":46},[56,59,62],{"tool":57,"command":58},"npx","npx skills add jstoup111\u002Fai-conductor --skill pipeline",{"tool":60,"command":61},"bunx","bunx skills add jstoup111\u002Fai-conductor --skill pipeline",{"tool":63,"command":64},"pnpm","pnpm dlx skills add jstoup111\u002Fai-conductor --skill pipeline","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fpipeline\u002FSKILL.md",[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"agents\u002Fopenai.yaml","REFERENCE","参考文档",43,"https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fpipeline\u002Fagents\u002Fopenai.yaml",[74,92,118,142,159,175],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":39},"01M70YKSA2H7Q9WSRD1ECEGY20","build-review-dependency-hygiene","Judge whether a feature diff adds unnecessary, insufficiently pinned, or license-incompatible dependencies.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fbuild-review-dependency-hygiene\u002FSKILL.md",[],[25,81,82,83,84,85,86,87,88,89,31,90,91],"dependency hygiene","dependency","hygiene","build review dependency hygiene","review","feature","diff","dependencies","license","judge","gating",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":39},"01M6K3EQQ6ADH3G2RMYK6XE26E","writing-system-tests","Use BEFORE implementing any feature that has stories in .docs\u002Fstories\u002F — generates failing acceptance specs from acceptance criteria as the RED phase of TDD. Generates HTTP\u002Frequest-level acceptance tests for headless\u002FAPI projects, end-to-end UI tests for projects with a frontend, using the project's own test framework and directory conventions.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-system-tests\u002FSKILL.md",[],[99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,91,116,117],"writing","system","tests","writing system tests","projects","headless","project","end","implementing","frontend","acceptance","api","claims","directory","ui","framework","failing","phase","request",{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":39},"01M6K3EHR0QQ1QY1S9RC6D1WTD","verify-claims","Use only when an active workflow is about to rely on a nontrivial factual claim or assumption for a spec, plan, ADR, finding, or code decision. Do not invoke for casual questions, status reports, restatements, or trivially verifiable mechanics.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fverify-claims\u002FSKILL.md",[],[125,111,126,127,128,129,130,131,31,132,133,19,134,135,136,33,137,138,139,140,141,91,21],"verify claims","verify","do","adr","for","decision","claim","mechanics","only","workflow","code","reports","active","questions","about","spec","invoke",{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":148,"publishedAt":39},"01M6K3ED4NF5DJA2Y35MH2JCRC","tdd","Use when implementing any feature or bugfix. Five-step cycle: RED → DOMAIN → GREEN → DOMAIN → COMMIT. Enforces test-first development with domain integrity review at every phase boundary.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Ftdd\u002FSKILL.md",[],[144,149,150,37,107,151,85,152,153,154,155,86,156,31,19,27,157,158,21,116],"green","cycle","commit","at","bugfix","integrity","domain","development","test","test-first",{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"publishedAt":39},"01M6K3E6PEXBXYY2K8TSRTN1JT","stories","Use only within active engineer\u002Fconduct DECIDE after architecture approval, when a committed `.docs\u002Fstories` acceptance artifact is required. Do not invoke for general user-story examples, requirements discussion, or direct implementation requests.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fstories\u002FSKILL.md",[],[161,166,127,129,167,168,169,31,133,19,109,170,171,172,111,173,126,174,137,23,141,91,21],"conduct","decide","engineer","general","requirements","architecture","examples","artifact","requests",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":181,"publishedAt":39},"01M6K3E1HE7267YKFJQ3YFCGW5","stack-land","Use when an operator needs to land reviewed manual changes on the correct closed child of a stacked feature. Operator-invoked only: inspect ownership, propose the safe child with evidence, and require confirmation before opening the landing.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fstack-land\u002FSKILL.md",[],[182,183,184,27,111,185,186,187,126,86,188,189,190,191,192,31,193,133,19,194,21,195],"stack","land","stack land","evidence","child","changes","inspect","manual","correct","landing","safe","operator","confirmation","advisory"]