[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73RS7NSSE2Y94F2PZT4QY25":3,"skill-same:01M73RS7NSSE2Y94F2PZT4QY25":135},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M73RS7NSSE2Y94F2PZT4QY25","execute-plan",null,"lookatitude\u002Fguild","lookatitude","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F524917?v=4","01M71GJ2KGXFSJZKAZC5P1ZXXM","Miguel Pinto","01M71GJ2MH4SH9WJKP8M7XZZ0P",8,"MIT","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: guild-execute-plan\ndescription: For each specialist lane in the plan: invoke `guild:context-assemble` to build the bundle, auto-score the lane to its lowest viable model tier (dispatched via the Agent `model` param; honors `--model-tier` and per-lane pins), then dispatch each lane via the agent_mode-resolved backend (team \u002F tmux primary; in-process Agent() dispatch for no-tmux hosts; subagent last resort) as an ephemeral one-agent-per-task §task§agent (spawn → work → extract learnings → dismiss). Runs the advisor escalation protocol when a low-tier agent emits `escalate`. Parallelize lanes when `depends-on:` allows. Collect per-lane handoff receipts at `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md`. TRIGGER: \"execute the plan\", \"run the lanes\", \"start specialist work\", \"dispatch the team\", \"dispatch each lane at its tier\", \"escalate this to the advisor\". DO NOT TRIGGER for: explaining the plan (guild:plan owns that), reviewing results (guild:review), writing more tests.\nwhen_to_use: Fifth step of Guild lifecycle, after plan approved and per-specialist context bundles staged.\ntype: meta\nindexed: true\n---\n\n# guild:execute-plan\n\nImplements the task lifecycle execute step. Runs after `guild:plan` has produced an approved `.guild\u002Fplan\u002F\u003Cslug>.md` and before `guild:review`. Dispatches every specialist lane per the DAG encoded by the lanes' `depends-on:` edges, and gathers one handoff receipt per lane into a single run directory `guild:review` consumes verbatim.\n\n## Input\n\nFive things, all required:\n\n1. `.guild\u002Fplan\u002F\u003Cslug>.md` — the approved per-specialist lane plan. Must have frontmatter `approved: true`; if approval is missing, refuse to dispatch and loop back to `guild:plan`'s approval gate.\n1b. **The phase's team decision (`guild.team_decision.v1`) — the dispatch gate.** Dispatch accepts only a **current `approve` decision whose `proposal_hash` equals the hash recomputed from the persisted `guild.team_proposal.v2` artifact** (canonical-YAML SHA-256, hash field omitted — the frozen team-contracts rule). Stale, missing, or hash-mismatched decisions **fail closed**: refuse to dispatch and loop back to `guild:team-compose`'s decision gate (`guild:team-compose §\"Team decision gate\"`). This applies to EVERY dispatchable participant — workers, advisors, challengers, and reviewer slots alike — in every phase; an advisory label never bypasses the gate. Guild never auto-approves. Any post-approval change to a participant, obligation, dependency, tier\u002Fpurpose, capability scope, backend, wave structure, concurrency, cost posture, or review independence invalidates the decision and requires renewed user approval.\n2. The resolved per-phase team file from `guild:team-compose` — **resolved via `resolveTeamFile(guildRoot, slug, readActivePhase(cwd))`** (`scripts\u002Flib\u002Fteam-file.ts`) → `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` (current) or the legacy `.guild\u002Fteam\u002F\u003Cslug>.yaml` (read-only back-compat). **Pass the resolved per-phase path onward to the launcher** (`## Backend + routing`); a `null` return → request a phase-composition pass (loop back to `guild:team-compose`), never fabricate a path; a legacy hit → emit the one-line deprecation notice once per run (*\"single-file team.yaml is legacy; re-compose to adopt per-phase teams\"*). Authoritative for **team composition**: the specialist roster, per-specialist scope\u002Fdependencies\u002Ftiers, and agent-definition paths. **Not** the backend authority — the execution backend is resolved at command intake (`runStartPreflight`) and read from the run's resolved-settings snapshot (`snapshot.effective.agent_mode`, see `## Backend + routing (summary)`).\n3. The run's **resolved-settings snapshot** — `.guild\u002Fruns\u002F\u003Crun-id>\u002Fresolved-settings.json`, read via `readResolvedSettingsSnapshot` (`scripts\u002Flib\u002Frun-lifecycle.ts`). Authoritative for the execution backend (`snapshot.effective.agent_mode`) and the detected\u002Frecommended\u002Fselected review providers (`snapshot.providers`).\n4. `.guild\u002Fruns\u002F\u003Crun-id>\u002F` — the run directory already created by the lifecycle start. Consume the lifecycle-owned canonical `run-\u003Cyyyymmdd-hhmmss>-\u003Cslug>` identity from the start result \u002F `.guild\u002Fruns\u002Fcurrent-run-id` sentinel and pass it unchanged as `--run-id` to the launcher. This skill and the launcher never mint, reshape, or replace a run id; every context bundle, handoff receipt, and assumption log roots under the inherited directory. A missing, unbound, or non-canonical identity blocks dispatch and must be repaired by starting the lifecycle, not by inventing a fallback.\n\nDo not re-derive lanes from chat or from the spec. The plan is the single source of truth for what gets dispatched.\n\n## Per-lane flow\n\nFour strict phases per lane. A lane does not advance until the previous phase has produced its artifact:\n\n1. **Context bundle.** Invoke `guild:context-assemble` for the lane; it writes `.guild\u002Fcontext\u002F\u003Crun-id>\u002F\u003Cspecialist>-\u003Ctask-id>.md` per §9.3. Read back the bundle's handoff receipt to confirm `bundle_path`, `token_estimate`, `layers_included`, and the linter-returned `definition_ref`. Join the lane owner to the team specialist and require the bundle ref to equal the team's committed ref exactly. A missing\u002Fmalformed\u002Fmismatched ref or bundle blocks dispatch — never fall back to an absolute definition path or chat context.\n2. **Tier resolution.** Auto-score the lane and resolve its tier per `## Tier resolution` — print the score + chosen tier (never silent). The resolved tier becomes the Agent `model` param at dispatch.\n3. **Dispatch.** **First write the lane's `guild.task_run.v1` descriptor** (TE-01 — see `## Task-run descriptor + routing persistence`); then spawn an **ephemeral one-agent-per-task** agent (see `## §task§agent lifecycle`) at the resolved tier, using the snapshot-resolved backend (`snapshot.effective.agent_mode`), passing the bundle path as the primary task brief. Before spawning, inject three things: the **producer marker** — prompt line 1 plus its env twin (`## Capability-scope env injection` steps (2b)\u002F(2c); contract in `dispatch.md §\"Producer marker (line-1 + env)\"`); the **capability-scope env vars** (`## Capability-scope env injection`); and **the canonical handoff protocol block** verbatim into the agent's prompt (`dispatch.md §\"Handoff protocol\"`) — substituting `\u003CRECEIPT_PATH>` and `\u003CTASK_ID>` for this lane before sending. The agent escalates via `## Advisor escalation` if it hits something above its tier. Routing rules, backend mechanics, env injection, and handoff protocol injection: `dispatch.md`.\n4. **Receipt.** Confirm the agent wrote its handoff receipt to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` per §8.2, **populate the receipt `host` block (`selected` \u002F `degraded` \u002F `independence`) from the lane's routing decision** (TE-03 — see `## Task-run descriptor + routing persistence`), then **extract its `learnings[]` and dismiss the agent** (lifecycle below). Gate the receipt with `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fcheck-handoff-receipts.js --cwd \u003Crepo-root> --receipt .guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` (this lane's receipt only) — a non-zero exit (a missing §8.2 `## changed_files` \u002F `## opens_for` \u002F `## assumptions` \u002F `## evidence` \u002F `## followups` section, or not exactly one valid ```` ```guild.handoff.v2 ```` fence) means the receipt is malformed → treat the lane as **FAILED**: record the failure in the run log and route it into `## Lane retry + dead-lettering` (retry up to `defaults.retry.max_attempts`, then checkpoint as dead) rather than immediately halting the run.\n\nA specialist dispatched without a bundle violates the context contract (§9); one that completes without a receipt violates the handoff contract (§8.2). Either condition blocks `guild:review`.\n\n## Task-run descriptor + routing persistence (TE-01 \u002F TE-03)\n\nThe snapshot-resolved backend selects **how** a lane is dispatched, but the\n**subagent \u002F in-process (non-tmux) path runs through this skill** — the\ntmux\u002Fteam launcher (`scripts\u002Fagent-team-launcher.ts`) covers only the team\nbackend. So on the model-driven path the task-run write and routing persistence\nare done **here**, per lane.\n\n> **Ownership guard — do these ONLY when `snapshot.effective.agent_mode ∈\n> {`subagent`, `agent`}`** (the model-driven path; `agent` is the D5 **in-process**\n> rung — use the enum value, not the concept name). The resolved\n> `snapshot.effective.agent_mode` enum is `team | agent | subagent | auto`\n> (`scripts\u002Flib\u002Fsettings-resolver.ts`) — there is **no** `in-process` value; the\n> in-process backend's value is **`agent`**. When `agent_mode` resolves to `team`\n> (tmux\u002Fagent-team) **or** a remote backend, the **launcher owns the TE-01\n> task_run write + the routing-decision persistence**\n> (`scripts\u002Fagent-team-launcher.ts`, EDIT-2\u002F3) — this skill **MUST NOT** also\n> write them, or the lane double-writes its `task_run.yaml` \u002F receipt `host`\n> block. The two backends partition the work cleanly: launcher = team + remote;\n> this skill = `subagent` + `agent` (in-process). Test the snapshot's\n> `agent_mode` value against `{subagent, agent}` before the writer call below;\n> skip it on `team`\u002Fremote. (`auto` is resolved to a concrete value at intake, so\n> the snapshot never carries `auto` here.)\n\n**TE-01 — write the `guild.task_run.v1` descriptor BEFORE each dispatch attempt\n(model-driven path only — see the ownership guard above).** After tier\nresolution and before spawning, invoke the writer CLI (one file per attempt; a\nre-dispatch overwrites — the writer handles it):\n\n```bash\nnode ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fwrite-task-run.js \\\n  --cwd \u003Crepo-root> --run-id \u003Crun-id> --task-id \u003Ctask-id> \\\n  --specialist \u003Cowner-role> \\\n  --context-bundle .guild\u002Fcontext\u002F\u003Crun-id>\u002F\u003Cspecialist>-\u003Ctask-id>.md \\\n  --depends-on \u003Cid,id,...> \\\n  --max-tokens \u003Cscored-budget> --max-turns \u003Cscored-turns> \\\n  [--needs-pr] [--needs-parallel] [--needs-network] \\\n  [--phase \u003Cphase>] \\\n  --isolation \u003Cworktree|none> --host-requested \u003Ckind>\n```\n\nIt writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Ftask-runs\u002F\u003Ctask-id>.yaml` (top-level\n`task_run:` wrapper, `context_bundle`, `host.capability_requirements`). Derive\n`--max-tokens`\u002F`--max-turns` from the lane's **scored tier** (step 2 — not a flat\ndefault) and the `--needs-*`\u002F`--isolation`\u002F`--host-requested` flags from the\nlane's `team.yaml` `host:` block + scope. `--phase \u003Cphase>` (default `execute`)\nsets the lifecycle phase stamped into the `guild.trace.dispatch.v1` event — it is\na real, caller-supplied phase, not derived from `--initiative-id`. Lanes running\nmid-`\u002Fguild:build` should pass `--phase execute` explicitly (or the phase they\nare actually in, e.g. `review` for a review-loop lane) rather than relying on\nthe default. The written\n`host.capability_requirements` is the **same object** the router reads as\n`LaneRequest.capabilityRequirements` in `route()` — writer→router round-trip\nidentity.\n\n**TE-03 — persist the routing decision into the receipt `host` block** (model-driven\npath only — same ownership guard; on team\u002Fremote the launcher persists it). When the\nlane's handoff receipt is written, populate its `host` block from the\n`RoutingDecision` (`route()` return \u002F launcher-surfaced) — `selected`\n(`RoutingDecision.host`), `degraded` (`RoutingDecision.degraded`), and\n`independence` (`\"strong\" | \"weak\"`), with values **equal to** the decision (and\nmirrored into run-state `LaneState.host` by the dispatch path).\n\n**Single-host independence rule (state it, never leave implicit).** On the\nsingle-host subagent path with no cross-host routing, set\n`selected: \u003Clocal host>`, `degraded: false`, and **`independence: \"weak\"` whenever\nthe reviewer shares the producer's host family** (the common no-cross-host case —\na same-host review is weak independence, exactly as the review broker stamps it).\n`independence: \"strong\"` requires a genuinely different reviewer host family. A\nsingle-host run is therefore `weak`, recorded — never silently `strong`.\n\n## Tier resolution\n\nImplements the cost-aware-tiering ADR (§2). Each lane is dispatched at the **lowest viable tier** — the default biases cheap; a `powerful` invocation must be justified by the score, an explicit override, or an advisor request.\n\n1. **Auto-score (deterministic, via `scripts\u002Fscore-tier.ts`).** Invoke the pure, LLM-free scorer — `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fscore-tier.js --signals '\u003Cjson>' --cwd \u003Crepo-root> [--model-tier \u003Cpin>]` → `{score, tier, model}` — passing the lane's signals (work-type verb read\u002Fsummarize=0, draft\u002Fextract=+1, architect\u002Freview\u002Fschema=+2; blast-radius \u002F file count; presence of an upstream `depends-on:` contract; security\u002Fcorrectness sensitivity; prior-attempt escalation on this lane +1, sticky for the run). The scorer is deterministic and costs **zero tokens** (a script call, not an LLM judgment) — so the dispatch trace is reproducible (SC-5). It applies steps 2–4 below internally and returns `score`+`tier`+`model` in one call. The plan's `complexity_score`\u002F`tier` are the authoring estimate; the scorer confirms or supersedes them.\n2. **Map score → tier** via the band cutoffs `models.thresholds` (default `{mid:1, powerful:3}`): `0 → cheap`, `1–2 → mid`, `≥3 → powerful`.\n3. **Apply the precedence ladder (normative):** `--model-tier=` CLI escape hatch > per-lane plan `tier:` pin > `settings.json` `models.tiers`\u002F`models.thresholds` > built-in default. A `--model-tier` value pins **every** lane in the run; a per-lane plan `tier:` pin overrides the auto-score for that one lane.\n3b. **Research floor (above the ladder, non-downgradable).** A lane whose participant carries `purpose: research` (authoritative `work_class` metadata from its role definition — never inferred from the lane label) resolves `effective_complexity: hard` \u002F `tier: powerful` (`research_always_hard`), regardless of the auto-score, any `--model-tier` value, or a per-lane pin — the ladder chooses *among tiers at or above the floor*, never below it. The floor is **transitive through every handoff**: advisor consults, retries, resumes, nested delegation, and generic sub-dispatches spawned from a research lane inherit it and cannot downgrade it. Record `forced_floor_reason: research_always_hard` in the dispatch trace and the lane's receipt whenever it fires.\n4. **Resolve tier → model** through the host-agnostic `models.tiers` map (ADR §1\u002F§10 — bound by pointer; within Claude `cheap=haiku`, `mid=sonnet`, `powerful=opus`). Within Claude this binds directly to the Agent tool `model:` param at dispatch.\n5. **Print + record.** Surface the dispatch line (`lane \u003Ctask-id> · score N · tier \u003Ctier> · model \u003Cmodel>`) and write the score + resolved tier into the run record under `.guild\u002Fruns\u002F\u003Crun-id>\u002F` (never silent — spec Risk). **Approved-tier consistency:** the approved `guild.team_proposal.v2` records each participant's tier — the re-score CONFIRMS it; if they differ, that is a §4 invalidating change (tier\u002Fpurpose): do not silently dispatch at either value — surface a restructure (new proposal version) for renewed user approval. When `models.enabled: false`, skip scoring and dispatch at the backend default — EXCEPT `purpose: research` lanes, which dispatch `powerful` regardless (the step-3b floor holds with scoring disabled).\n6. **Persist the re-scored tier into `team.yaml` (ARCH-6 Part 2 \u002F W2-A3).** After auto-scoring a lane, write the scored tier back into the resolved per-phase `team.yaml`'s matching specialist entry via the **concurrent-safe writeback helper** — so the team-backend launcher's `tier ?? default_tier` (tooling's ARCH-6 Part 1) consumes the **re-scored** tier and tmux panes route at the per-lane score, not just the roster `default_tier`:\n\n   ```ts\n   import { writeBackScoredTier } from \"..\u002Fscripts\u002Flib\u002Fwrite-back-scored-tier\";\n   const result = writeBackScoredTier(resolvedTeamYamlPath, lane.owner, scoredTier);\n   if (!result.ok) console.warn(result.message);  \u002F\u002F non-fatal — degrades to default_tier, observably\n   ```\n\n   The helper is **lock-based** (`O_EXCL` lock on `\u003Cteam.yaml>.scoring.lock`, atomic temp+rename, idempotent, **never throws**, releases the lock even on error), so parallel lanes completing at the same instant cannot clobber the generated team-shape artifact — this is why a raw inline hand-edit was wrong and this helper is right. `result.ok` is the success check; on `false`, surface `result.message` as a warning — a writeback failure is **non-fatal**: the lane still dispatches and the team backend simply routes that specialist at `default_tier` (observable degradation, never silent, never a hard stop) — EXCEPT a `purpose: research` lane, which must still route `powerful`: on writeback failure for a research lane, reassert the floor at dispatch (Agent `model` param \u002F pane routing) rather than accept a `default_tier` downgrade (`research_always_hard` survives scoring-off, writeback failure, retries, and resume alike).\n\n   The two backend paths now both honor the score: the **model-driven path** (subagent \u002F `agent` in-process) applies the re-scored tier directly via the Agent `model:` param at dispatch; the **team-backend path** (tmux panes) reads the just-written `tier:` from `team.yaml`. `resolvedTeamYamlPath` is the path resolved via `resolveTeamFile` (the per-phase file). Skip the writeback when `models.enabled: false` (no scoring ran).\n\nConfig keys (`models.enabled`, `models.tiers`, `models.scoreWeights`, `models.thresholds`, …) are the closed-key `settings.json` `models:` block (ADR §10 — bound by pointer, never re-spelled).\n\n## Advisor escalation\n\nImplements ADR §3. When a low-tier agent hits something above its tier it gets **one powerful sub-answer for that sub-question only**, then continues — it is **not** re-run wholesale on the expensive model.\n\n1. **Trigger.** Any of three conditions independently triggers an advisor escalation:\n   - **`status: \"escalate\"`** — the agent emits `status: \"escalate\"` + an `escalate_reason` in its `guild.handoff.v2` envelope (in-flight dispatch envelope — canonical body at cost-aware-tiering ADR §5, bound by pointer; distinct from and never superseding the frozen `guild.handoff_receipt.v1`).\n   - **Uncertainty markers** — the agent's output contains a phrase from `models.escalationMarkers` (e.g. \"I'm not sure\", \"unclear\", \"cannot determine\").\n   - **Anomalously short output** (O-3; enabled by D-OBS-3 — the lane's output-token count falls below `models.shortOutputThreshold[task_type][tier]` in `settings.json`. **This trigger activates only when the threshold key exists** for the `(task_type, tier)` bucket; when absent, the trigger is silent and only the two deterministic triggers above govern. The benchmark analyzer derives and writes the threshold after ≥30 samples per bucket; the coordinator **reads `settings.json` only — no JSONL scanning at dispatch**.\n2. **Advisor answers the sub-question only.** Spawn a `powerful` **advisor** agent that sees the **draft + the question + a compact critique instruction (~50 tokens)** and **never the raw file context** — this is what keeps the expensive call cheap. **Route the advisor to the resolved advisory substrate (universal-host C1).** Read the per-run advisory role from the snapshot — `snapshot.roles.advisory.substrate` (`RoleResolutionSet`, recorded by `runStartPreflight`) — and dispatch the advisor on that host. The DEFAULT Claude+Codex box resolves `advisory = claude` (the local advisor), so this is **byte-identical to today** on a default box; a box whose advisory role resolved to a different substrate routes the consult there. Never re-resolve the substrate here or guess from the host name — consume the snapshot's `roles.advisory` (capability-matrix-driven at preflight).\n3. **Fold + continue.** The advisor returns via the same `guild.handoff.v2` envelope; the original cheap agent continues with the advisor's answer folded in. No wholesale re-run.\n4. **Round cap.** `models.advisorRounds` (default `2`) caps advisor consults per lane — mirrors the `codex_cap`\u002F`loop_cap` discipline. On exhaustion, record the lane `inconclusive: advisor budget exhausted` rather than silently escalating cost.\n5. **Trail.** Record the escalation trail (trigger, sub-question, advisor tier, result ref, round count) in the run record under `.guild\u002Fruns\u002F\u003Crun-id>\u002F` alongside the dispatch trace, so SC-6 is verifiable. **When the escalation is persisted as a durable `guild.advisory.v1` AdvisoryRecord** (`scripts\u002Flib\u002Fadvisory-record.ts` `makeAdvisoryRecord`), **stamp the C1 `substrate` field from the resolved advisory role** — pass `advisorySubstrateFromRoles(snapshot.roles)` (`scripts\u002Flib\u002Frole-resolver.ts`) as the `substrate:` input so the record carries `substrate == roles.advisory`:\n\n   ```ts\n   import { advisorySubstrateFromRoles } from \"..\u002Fscripts\u002Flib\u002Frole-resolver\";\n   const rec = makeAdvisoryRecord({\n     \u002F* …id, recorded_at, phase, backend, question, advisors, … *\u002F\n     substrate: advisorySubstrateFromRoles(snapshot.roles),  \u002F\u002F C1: routed advisory host\n   });\n   ```\n\n   `advisorySubstrateFromRoles` returns `undefined` when the role's substrate is absent\u002Funknown — and an **absent `substrate` means the default local advisor (`\"claude\"`)** per advisory-record back-compat, so a default Claude box records `substrate: \"claude\"` (equivalently absent). This is the C1 routing change L8 deferred to this call-site (SC-5): advisory advice now ROUTES to and is RECORDED with the resolved substrate, not just resolved in preflight.\n\nReview\u002Fcritic work folds into this advisor pass + the existing `guild:review`\u002F`qa` lanes — there is **no standalone reviewer agent type** (ADR O-1 resolution).\n\n## Capability-scope env injection\n\nImplements the dispatch-side of the v2 security ADR (bound by pointer). This is a **real orchestrator step, not aspirational scoping**: the scope IS published for the lane, the PreToolUse hook (`hooks\u002Flib\u002Fsecurity\u002Fenforce.ts`) reads it, and an out-of-scope tool call is **blocked**.\n\n**Environment-only delivery on code-backed transports.** Cmux, tmux, and remote backends inject the resolved scope into the real spawned process environment. They do not publish a pathname fallback: the shared writer documents a same-user ancestor-swap race, and raw writes can follow a planted scope symlink. The direct `Agent()` rungs are **unavailable for every scoped lane** until the host capability contract ships and verifies child-env carriage. The launcher enforces that refusal in code before emitting a production agent\u002Fsubagent signal.\n\nFirst, the **env vars**, injected **on the spawned lane agent only** (never the orchestrator process):\n\n- **`GUILD_CAPABILITY_SCOPE`** = the resolver's `JSON.stringify(capability_scope)`. An explicit team value wins; when a canonical role omits the field, the source-owned role default is materialized. Only an unknown\u002Fproject role with no explicit scope retains the legacy unscoped behavior.\n- **`GUILD_AUTONOMY_CONTRACT`** = a JSON string array of tool-permission rules derived from the plan lane's `autonomy-policy` `may act without asking` entries, in Claude Code permission-rule grammar (e.g. `\"Bash\"`, `\"Write\"`, `\"Read(*)\"` — syntax per `hooks\u002Flib\u002Fsecurity\u002Fenforce.ts`). **Omit when no machine-readable rules can be derived** (absent ⇒ no additional AND-masking).\n\n**Per-backend injection (concrete, code-backed):**\n\n- **Subagent \u002F in-process (`agent`) — model-driven path:** the launcher refuses this rung when any lane has a resolved scope. The resolver contract below is retained for the future verified child-env capability and for the legacy unscoped unknown\u002Fproject-role path; it does not authorize a scoped production `Agent()` call. Every `--dry-run`—scoped or unscoped—emits a non-dispatchable, write-free preview (`dispatchAllowed:false`, `previewOnly:true`) for inspection only; it consumes no approval override and writes no run-tree state:\n\n  ```ts\n  \u002F\u002F (-1) CONSUME THE LAUNCHER'S FAIL-CLOSED DECISION BEFORE ANY LANE WORK.\n  \u002F\u002F      This applies whether the backend came from an explicit ladder choice\n  \u002F\u002F      or the run's frozen snapshot. Missing fields are not legacy permission:\n  \u002F\u002F      only the exact production tuple true\u002Ffalse authorizes Agent(). A scoped\n  \u002F\u002F      dry-run is inspection data and MUST terminate before task-run writes,\n  \u002F\u002F      scope resolution, descriptor consumption, or Agent().\n  if (signal.dispatchAllowed !== true || signal.previewOnly !== false) {\n    throw new Error(\n      `direct dispatch refused: launcher did not authorize Agent() ` +\n        `(dispatchAllowed=${String(signal.dispatchAllowed)}, ` +\n        `previewOnly=${String(signal.previewOnly)})`,\n    );\n  }\n\n  \u002F\u002F (0) RESOLVE THE LANE'S SPECIALIST — do this FIRST; everything below reads it.\n  \u002F\u002F     The plan lane carries `owner` (+ task-id, depends-on, scope). `definition`\n  \u002F\u002F     and `definition_source` live on the TEAM file's `specialists[]`, keyed by\n  \u002F\u002F     `name` — they are NOT lane fields. Join them explicitly and FAIL CLOSED.\n  \u002F\u002F     Mirror `composeInProcessDispatch` EXACTLY (scripts\u002Flib\u002Fhost\u002Finprocess-backend.ts):\n  \u002F\u002F     for a project specialist the definition must be the role-matched path\n  \u002F\u002F     `.guild\u002Fagents\u002F\u003Cname>.md` — a missing, whitespace, arbitrary, or\n  \u002F\u002F     role-MISMATCHED path is not a valid GUILD_AGENT_DEFINITION, and the\n  \u002F\u002F     composer THROWS rather than emit a persona-stripped descriptor (#58).\n  \u002F\u002F     On this rung the skill is the producer, so the skill owns that check.\n  const spec = team.specialists.find((s) => s.name === lane.owner);\n  if (!spec) throw new Error(`lane ${lane.taskId}: no specialist named ${lane.owner} in the team file`);\n  const isProject = spec.definition_source === \"project\";\n  if (isProject && (!spec.definition_ref || spec.definition_ref.schema_version !== \"guild.project_definition_ref.v1\"))\n    throw new Error(`lane ${lane.taskId}: project specialist ${spec.name} has no validated definition_ref`);\n  const bundleLint = JSON.parse(runContextBundleLint(bundlePath));\n  \u002F\u002F Shipped lanes have no team ref: expect the producer's synthesized plugin-shipped ref (#221).\n  const expectedRef = isProject ? spec.definition_ref\n    : JSON.parse(runDefinitionRefForDispatch([\"--name\", spec.name, \"--definition\", spec.definition, \"--source\", \"shipped\",\n        ...(spec.tier ? [\"--tier\", spec.tier] : []), ...(spec.default_tier ? [\"--default-tier\", spec.default_tier] : []),\n        ...(spec.capability_scope ? [\"--capability-scope\", spec.capability_scope.join(\",\")] : [])])).ref;\n  if (!bundleLint.pass || JSON.stringify(bundleLint.definition_ref) !== JSON.stringify(expectedRef))\n    throw new Error(`lane ${lane.taskId}: context bundle definition_ref does not match the team`);\n  \u002F\u002F   NORMALIZE ONCE, then use `definitionPath` for BOTH carriers. The composer\n  \u002F\u002F   compares TRIMMED, so a padded-but-canonical `\"  .guild\u002Fagents\u002Fx.md  \"`\n  \u002F\u002F   passes validation — and emitting the RAW field would then produce the\n  \u002F\u002F   malformed line-1 marker `GUILD_AGENT_DEFINITION=  .guild\u002Fagents\u002Fx.md  `,\n  \u002F\u002F   which the whole-line parser rejects outright. Normalizing here makes the\n  \u002F\u002F   two carriers agree by construction.\n  const definitionPath = isProject\n    ? (typeof spec.definition === \"string\" ? spec.definition.trim() : \"\")\n    : undefined;\n  if (isProject) {\n    const expected = `.guild\u002Fagents\u002F${spec.name}.md`;   \u002F\u002F role-matched — that is WHY every\n    if (definitionPath !== expected)                    \u002F\u002F carrier can derive from spec.name\n      throw new Error(\n        `lane ${lane.taskId}: project specialist \"${spec.name}\" has an invalid definition ` +\n          `path ${JSON.stringify(spec.definition)} — expected \"${expected}\"`,\n      );\n  }\n  \u002F\u002F (1) APPROVAL-BOUND SCOPE RESOLUTION — run the shipped resolver before the\n  \u002F\u002F     spawn. It requires the exact team path + SHA-256 emitted by the\n  \u002F\u002F     approve-before-dispatch launcher signal, refuses changed\u002Fsubstituted\n  \u002F\u002F     bytes, preserves an explicit approval-bound scope, and returns the exact\n  \u002F\u002F     env payload without a race-prone pathname backstop.\n  \u002F\u002F     Do not retype the defaults or read lane.capability_scope yourself.\n  const scopeArgs = [\n    path.join(pluginRoot, \"runtime\", \"scripts\", \"resolve-specialist-capability-scope.js\"),\n    \"--team\", signal.teamPath, \"--team-sha256\", signal.teamSha256,\n    \"--cwd\", repoRoot, \"--run-id\", runId,\n    \"--task-id\", lane.taskId, \"--role\", lane.owner,\n  ];\n  if (autonomyRules?.length) {\n    scopeArgs.push(\"--autonomy-contract\", JSON.stringify(autonomyRules));\n  }\n  const scopeResolution = JSON.parse(\n    execFileSync(\"node\", scopeArgs, { encoding: \"utf8\" }),\n  );\n  \u002F\u002F (2) ENV — resolver env includes GUILD_RUN_ID + GUILD_TASK_ID and\n  \u002F\u002F     GUILD_CAPABILITY_SCOPE when resolved.\n  \u002F\u002F     `descriptor` is the lane's entry in `signal.dispatchPlan` on the in-process rung, and\n  \u002F\u002F     `undefined` on the bare `subagent` rung (the launcher returned no plan) — that is the\n  \u002F\u002F     value the FORK below branches on.\n  const descriptor = signal.dispatchPlan?.find((d) => d.name === lane.owner);\n  const env = { ...(descriptor?.env ?? {}), ...scopeResolution.env };\n  \u002F\u002F ── FORK — TWO BRANCHES. Take exactly one; they do not share step (3). ─────\n  if (descriptor) {\n    \u002F\u002F ── BRANCH A — IN-PROCESS (`agent`): a descriptor exists. ────────────────\n    \u002F\u002F   `composeInProcessDispatch` + `buildPrompt` already built the WHOLE\n    \u002F\u002F   dispatch: both producer-marker halves AND the teammate identity, lane\n    \u002F\u002F   scope, context-bundle pointer, assignment read-ack gate and wait\n    \u002F\u002F   instruction. Issue it AS-IS (`dispatch.md §\"In-process dispatchPlan\n    \u002F\u002F   consumption\"`). The ONLY permitted layering is the resolved `model` and\n    \u002F\u002F   the scope\u002Frun env keys built in steps (1)\u002F(2). Do NOT rebuild the\n    \u002F\u002F   prompt and do NOT recompute `subagentType` — a rebuild silently DROPS\n    \u002F\u002F   everything in that list. Nothing below this branch applies.\n    Agent({\n      subagent_type: descriptor.subagentType,   \u002F\u002F as-is — never recomputed here\n      model: resolvedModel,                     \u002F\u002F tiering is orthogonal (backend sends model:null)\n      prompt: descriptor.prompt,                \u002F\u002F as-is — never rebuilt here\n      env,                                      \u002F\u002F descriptor.env + steps (1)\u002F(2)\n    });\n  } else {\n    \u002F\u002F ── BRANCH B — BARE `subagent` rung: NO descriptor. ──────────────────────\n    \u002F\u002F   `agent-team-launcher.ts` returned a bare {backend, reason, slug} signal\n    \u002F\u002F   for `resolvedMode !== \"team\"`, handing the whole `Agent()` construction\n    \u002F\u002F   back to this skill. HERE the skill IS the producer, so it stamps what\n    \u002F\u002F   composeInProcessDispatch\u002FbuildPrompt stamp on every other class.\n    \u002F\u002F\n    \u002F\u002F (2b) PRODUCER MARKER, ENV HALF — an env map is composed by whoever issues\n    \u002F\u002F     the dispatch, so it is structurally out of reach of quoted prose.\n    env.GUILD_DISPATCH_PRODUCER = \"guild.dispatch.v1\";   \u002F\u002F emit v1; parsers accept guild.dispatch.v\u003CN>\n    env.GUILD_SPECIALIST = spec.name;                    \u002F\u002F identity carrier the guards match on\n    if (resolvedTier) env.GUILD_TIER = resolvedTier;     \u002F\u002F scored tier ?? default_tier — NEVER fabricate one\n    if (Number.isFinite(laneScore)) env.GUILD_TIER_SCORE = String(laneScore); \u002F\u002F audit-only; 0 IS a real score\n    if (isProject) env.GUILD_AGENT_DEFINITION = definitionPath;  \u002F\u002F #58 — unconditional for a project\n                                                                 \u002F\u002F specialist; the NORMALIZED team path\n    \u002F\u002F (2c) PRODUCER MARKER, PROMPT HALF — the line-1 twin of the env carrier, on\n    \u002F\u002F     a producer-owned position the lane's appended scope text can neither\n    \u002F\u002F     forge nor contradict. Emit exactly ONE line-1 marker, chosen by\n    \u002F\u002F     definition source — never both, never neither:\n    \u002F\u002F       project specialist → `GUILD_AGENT_DEFINITION=\u003CdefinitionPath>`\n    \u002F\u002F         (#58 — carries the role via its path AND is the machine adoption proof)\n    \u002F\u002F       everything else    → `GUILD_DISPATCH_PRODUCER=guild.dispatch.v1 role=\u003Cname>`\n    \u002F\u002F     The marker is the prompt's FIRST LINE, `\\n`-terminated, with nothing\n    \u002F\u002F     before it (no blank line, no leading whitespace, no preamble). Use the\n    \u002F\u002F     NORMALIZED `definitionPath`, never the raw field: a padded value would\n    \u002F\u002F     emit `GUILD_AGENT_DEFINITION=  .guild\u002Fagents\u002Fx.md  `, which the line-1\n    \u002F\u002F     parser rejects. Every role-bearing carrier derives from `spec.name`.\n    const line1Marker = isProject\n      ? `GUILD_AGENT_DEFINITION=${definitionPath}\\n`\n      : `GUILD_DISPATCH_PRODUCER=guild.dispatch.v1 role=${spec.name}\\n`;\n    \u002F\u002F (2d) ADOPTION INSTRUCTION — the marker is MACHINE proof for the guard; it\n    \u002F\u002F     is NOT what makes the agent adopt the persona. A project specialist\n    \u002F\u002F     dispatches as the host-generic type, so without this human-readable\n    \u002F\u002F     instruction the lane runs as a generic agent that merely LOOKS\n    \u002F\u002F     compliant — syntactically complete, functionally persona-stripped.\n    \u002F\u002F     Emit the SAME instruction `buildPrompt` emits\n    \u002F\u002F     (`src\u002Fdomains\u002Fconfig\u002Fteam-prompt.ts` — keep them in step):\n    const adoption = isProject\n      ? `Your role definition is at \\`${definitionPath}\\` — read it FIRST and adopt it ` +\n        `fully (persona, boundaries, TRIGGER \u002F DO NOT TRIGGER limits). For each skill listed ` +\n        `in its frontmatter \\`skills:\\`, load the project-local instance at ` +\n        `\\`.guild\u002Fskills\u002F\u003Cskill>\u002FSKILL.md\\` when it exists before starting your lane. `\n      : \"\";\n    \u002F\u002F The BRIEF — on this rung nothing built it for you, so build it here. It\n    \u002F\u002F must carry what `buildPrompt` gives every other class; the marker and\n    \u002F\u002F adoption text ADD to it and never replace it. NOTE what is deliberately\n    \u002F\u002F ABSENT: the `$GUILD_TASK_ASSIGNMENT` read-ack gate is PANE-ONLY — only\n    \u002F\u002F `tmux-backend.ts` \u002F `pane-adapter.ts` export that variable, so instructing\n    \u002F\u002F a subagent to read it would point the lane at an unset env var.\n    const handoffBlock = readHandoffProtocolBlock()               \u002F\u002F the canonical block, verbatim\n      .replace(\"\u003CRECEIPT_PATH>\", `.guild\u002Fruns\u002F${runId}\u002Fhandoffs\u002F${spec.name}-${lane.taskId}.md`)\n      .replace(\"\u003CTASK_ID>\", lane.taskId);                         \u002F\u002F dispatch.md §\"Handoff protocol\"\n    const brief =\n      `You are the \\`${spec.name}\\` teammate for run-id \\`${runId}\\`. ` +\n      `Your lane scope: \\`${lane.scope}\\`. ` +\n      `Your context bundle is at \\`.guild\u002Fcontext\u002F${runId}\u002F${spec.name}-${lane.taskId}.md\\` — read it first. ` +\n      handoffBlock;\n    const prompt = line1Marker + adoption + brief;\n    \u002F\u002F (3) SPAWN — subagent_type is DEFINITION-SOURCE-RESOLVED (dispatch.md hard\n    \u002F\u002F     constraint). A project specialist has no host-registered agent under\n    \u002F\u002F     its name, so it dispatches as the host-generic type carrying\n    \u002F\u002F     GUILD_AGENT_DEFINITION + the adoption instruction above; a PreToolUse\n    \u002F\u002F     guard DENIES a general-purpose dispatch that claims a persona without\n    \u002F\u002F     them (#58). Only a SHIPPED machinery\u002Fdev-team agent goes by bare name.\n    const subagentType = isProject ? GENERIC_SUBAGENT_TYPE : spec.name;\n    Agent({ subagent_type: subagentType, model: resolvedModel, prompt, env });\n  }\n  ```\n\n  **The `dispatchAllowed:true` \u002F `previewOnly:false` check is unconditional before either direct branch.** A missing field, a scoped preview, or a frozen direct signal that was not evaluated by the current launcher is a refusal; no task-run write, resolver call, descriptor consumption, or `Agent()` may follow it. **The line-1 producer marker is UNCONDITIONAL on the BARE `subagent` rung — it is what makes a direct `Agent()` dispatch attributable at all.** Every OTHER dispatch class (team\u002Ftmux panes, cmux surfaces, in-process descriptors, remote) gets its marker from `composeInProcessDispatch` \u002F `buildPrompt` \u002F `paneCommand` in code. The D5 `subagent` rung is the ONE class with no launcher descriptor — the launcher hands the whole `Agent()` construction back to this skill — so an unmarked lane here is a lane the PreToolUse guards and the run trace cannot tell apart from an arbitrary non-Guild `Agent` call. **On the in-process (`agent`) rung, do NOT construct any of this**: the descriptor already carries both marker halves and the full brief — issue `descriptor.prompt` \u002F `descriptor.subagentType` verbatim (`dispatch.md §\"In-process dispatchPlan consumption\"`), because rebuilding the prompt drops the teammate identity, scope, context pointer, read-ack gate, and wait instruction `buildPrompt` put there. Stamp both halves (env + prompt line 1) on every lane you construct yourself, at the first attempt and at every retry, resumed-dead re-dispatch, and nudge-replacement spawn. Never invent a value to fill a slot: omit `GUILD_TIER` when no tier resolved and `GUILD_TIER_SCORE` when no real score exists — a fabricated tier is worse than an absent one, because the guard would verify the model against a fiction. Full marker contract, the parse rules the guards apply, and the per-class table: `dispatch.md §\"Producer marker (line-1 + env)\"`.\n\n  **Absent `capability_scope` is resolved, not interpreted by the model.** Canonical roles receive a source-owned default and therefore make direct Agent dispatch refuse until verified child-env carriage ships. An unknown\u002Fproject role with no explicit scope retains the legacy clean fall-through. Omit `GUILD_AUTONOMY_CONTRACT` when its source is absent — never set an empty\u002F`\"undefined\"` value.\n- **Cmux, team\u002Ftmux, and remote:** the **launcher\u002Fbackend** injects `GUILD_CAPABILITY_SCOPE` directly into the spawned process environment. It writes no scope file.\n\nEnforcement engages from the environment. Absence is a clean fall-through only for the orchestrator, non-Guild sessions, and unknown\u002Fproject roles with no approved scope; a canonical\u002Fscoped direct Agent lane is refused before dispatch. Full backend-specific wiring: `dispatch.md §\"Capability-scope env injection\"` and `dispatch.md §\"In-process dispatchPlan consumption\"`.\n\n## §task§agent lifecycle\n\nImplements ADR §6 (D3). The **default execution unit is an ephemeral per-task agent** — one agent per task, never shared across tasks, never left idle. This is **orthogonal to** (composes with, never replaces) the D5 `agent_mode` backend ladder: D5 picks the *backend* (team \u002F agent \u002F subagent), this fixes the *lifecycle* (ephemeral, per-task) on whichever backend D5 selected. The backend itself is settings-resolved at run-start intake (`runStartPreflight` → the resolved-settings snapshot) per the D5 ladder — team\u002Ftmux is **primary whenever tmux is available**, not opt-in; subagent is the fallback for CI \u002F no-tmux hosts.\n\n**Single-channel handoff protocol.** Every agent in this lifecycle writes its receipt file as its final action — a `guild.handoff_receipt.v1` wrapper embedding exactly one `guild.handoff.v2` block — never to chat. The canonical protocol block is injected verbatim into every brief at dispatch (step 3 of `## Per-lane flow`); full rules, the frozen field set (schema by pointer), and the injection block: `dispatch.md §\"Handoff protocol\"`.\n\nSequence **spawn → work → extract → dismiss**:\n\n1. **Spawn.** Dispatch creates a **new** agent for the task at its resolved tier (`## Tier resolution`) with its pulled task-scoped context (`guild:context-assemble`). Two concurrent tasks get two **distinct** agents — never shared (SC-8).\n2. **Work.** The agent executes, escalating via `## Advisor escalation` if it hits something above its tier.\n3. **Extract.** On completion the agent extracts **learnings** into its `guild.handoff.v2` envelope (`learnings[]`); the coordinator lands them in the run record (`.guild\u002Fruns\u002F\u003Crun-id>\u002F`) and, where the gated reflection policy applies, into gated reflections (`.guild\u002Freflections\u002F` via `guild:reflect`). Learnings are **candidates only** — no auto-promotion (promotion stays with `guild:wiki-ingest`\u002F`guild:decisions`).\n4. **Dismiss.** The agent **terminates**. No idle agents persist; the next task is a **new** agent. This is why the default is an ephemeral per-task agent and not a long-lived worker pool.\n\nThe lead learns a lane finished only from its receipt, through `lane-receipt-wait` (`dispatch.md §\"§task§agent lifecycle at dispatch\"`). A host idle notification is never a result.\n\n## Backend + routing (summary)\n\nThe backend is **not** chosen here, and it is **not** chosen at `guild:team-compose` either. It is resolved **once at command intake** by `runStartPreflight` (U3) per the D5 `agent_mode` ladder — **including the first-class cmux rung: cmux > tmux when the intake probe records `CMUX_WORKSPACE_ID`** — and frozen in the run's resolved-settings snapshot (U6 writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Fresolved-settings.json`). The snapshot carries the decision as **`snapshot.dispatch` = `{backend: cmux|tmux|agent|subagent, reason, facts}`** (W4, initiative `run-identity-and-dispatch`). **`execute-plan` reads that snapshot via `readResolvedSettingsSnapshot` (`scripts\u002Flib\u002Frun-lifecycle.ts`) and acts on `snapshot.dispatch.backend` (falling back to `snapshot.effective.agent_mode` + `snapshot.providers` only for a legacy snapshot that predates the field)** — it does NOT re-resolve settings, re-run the preflight, or re-read the ambient environment. The launcher enforces the same authority: `agent-team-launcher.ts` consumes the frozen `snapshot.dispatch` and performs **no dispatch-time ambient CMUX\u002Ftmux re-probe** when the block is present, so a mid-run environment change (a cmux workspace appearing or vanishing, tmux installed mid-run) **cannot** select a different backend than the run-start decision. `team.yaml` is authoritative for the **team composition** (which specialists, their scope, dependencies, tiers, agent-definition paths), **not** for the backend selection — the backend authority is the resolved snapshot. Mid-run config edits do not silently change execution behavior because the snapshot is fixed at intake. Three invariants you enforce at dispatch — full detail (backend table, launcher invocation, self-build routing table, parallelism rules) in `dispatch.md`:\n\n- **cmux-first dispatch — the frozen `snapshot.dispatch.backend === \"cmux\"` rung, checked before tmux at the top of `team` (W4 landed: snapshot-frozen, first-class).** When the run's frozen snapshot records **`snapshot.dispatch.backend: \"cmux\"`** — resolved ONCE at run-start intake from the `CMUX_WORKSPACE_ID` fact and never re-read from the ambient environment at dispatch time (a legacy snapshot that predates the `dispatch` block falls back to one ambient `CMUX_WORKSPACE_ID` check at dispatch setup, then held constant for the whole run) — dispatch each lane as a **visible cmux terminal surface in the caller's workspace** instead of a tmux pane: one surface per lane via `cmux new-pane` \u002F `cmux new-surface --focus false` (or the host-current equivalent) — **never** a focus-stealing verb; set each lane's own sidebar status\u002Fprogress (`set-status` \u002F `set-progress`) as it advances, a per-lane signal, never shared\u002Faggregate. Lanes still write their handoff to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` per the single-channel protocol (`## §task§agent lifecycle` below) — the surface is a dispatch\u002Fvisibility mechanism, never a second handoff channel. The lead arms a **per-lane completion watcher** on each lane's own handoff file — never one watcher shared across lanes, since a finished lane must be actionable immediately, not sit behind whatever lane a shared watcher happens to be polling next. Once a lane's receipt is accepted, **reap its surface** — do not let finished surfaces linger. **The lead does all commits — lanes dispatched via cmux never commit their own work**, the same invariant as every other backend. **Launcher-owned obligations transfer to the lead.** Dispatching via cmux surfaces bypasses the tmux agent-team launcher, so the lead explicitly assumes what the launcher otherwise owns: (a) the team-mode task-run persistence under `.guild\u002Fruns\u002F\u003Crun-id>\u002F` — **auto-emit the dispatch receipts the launcher would have** by running the **cmux dispatch-receipt CLI** (`scripts\u002Flib\u002Fhost\u002Fpane-dispatch-trace.ts` — the cmux rung's launcher-bypass entry point, the executable form of \"the dispatch records the launcher would have\"), never by hand-writing those records. Invoke it ONCE per settled dispatch batch, after the surfaces are created and their pane ids collected — one `guild.trace.dispatch.v1` receipt per lane into the ORCHESTRATING run's `logs\u002Fv1.4-events.jsonl` (so `guild:reflect` sees the specialists, not a solo run):\n\n    ```bash\n    node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fpane-dispatch-trace.js \\\n      --run-id \u003Corchestrating-run-id> --cwd \u003Crepo-root> --backend cmux --target \"$CMUX_WORKSPACE_ID\" \\\n      --lane \u003Cspecialist>:\u003Ctask-id>:\u003Cpane-id> [--lane \u003Cspecialist>:\u003Ctask-id>:\u003Cpane-id> ...]\n    ```\n\n    Emit per lane in the **committed** batch, NOT per attempt — a surface that was reaped or rolled back must leave no receipt (over-reporting the run's specialists). A non-zero exit means a partial write (a real degradation of the run record, per obligation (b)), never a launch failure. When a lane's surface is reaped (`## Backend + routing`), its receipt is already recorded; do not re-emit; (b) capability-scope enforcement — the raw surface command MUST carry the resolver-produced `GUILD_CAPABILITY_SCOPE` in the spawned process environment; if the backend cannot prove that carriage, refuse or fall back to tmux rather than degrading or writing a pathname backstop; (c) the agent-bus lifecycle events (orchestrator-emitted, as on the model-driven backends — see `## Receipt collection`). A lead that cannot honor these obligations MUST fall back to the tmux launcher rung rather than dispatch unaccountable surfaces. When `snapshot.dispatch.backend` is not `\"cmux\"` (or, on a legacy snapshot with no `dispatch` block, when `CMUX_WORKSPACE_ID` is absent), this rung does not apply; fall through to tmux visible panes (the existing rung below is unchanged). *Evidence: umbrella `.guild\u002Fwiki\u002Fdecisions\u002Fcmux-first-dispatch.md` (merged ADR); initiative `run-identity-and-dispatch` work-item W4 — landed: `selectExecutionSubstrate`'s cmux rung + the frozen `snapshot.dispatch` block are the code half of that ADR, this bullet is its behavioral half.*\n- **Dispatch-verification — confirm pickup, never assume it (task-store rung only).** This clause governs the `agent-team` task-store signal path (`TaskCreate` + owner-assignment into tmux panes); the cmux rung above never uses `TaskCreate` — it dispatches by `cmux send` + read-screen monitoring per the ADR, so pickup there is direct by construction. After `TaskCreate` + owner-assignment, the lead **MUST verify pickup within a bounded timeout** (default **60s**; honor a project-configured dispatch-pickup timeout when the config surface provides one — never the 10-minute `heartbeat_timeout_ms`, which governs mid-run liveness, not dispatch). **Pickup means the teammate CLAIMED the task**: the task status set by the owning teammate, or pane read-screen evidence it echoed\u002Facted on the task-id — a status change from any other writer does not count. **On no-pickup, fall back to direct injection** (`runtime\u002Fscripts\u002Fpane-send.js --target \u003Cpane> --message \u003Cnudge>` into the teammate's own pane, where the brief is in a file and the nudge is one short line naming it: it refuses a pane that is not running a known agent CLI (`not_agent_pane`), waits until the agent is input-ready and not busy, and confirms the agent picked the nudge up; exit 1 means the message was refused, held, or not picked up, so re-send after the turn, never a raw `tmux send-keys`) carrying the same brief **including the task-id and a claim-first instruction** — the teammate claims the task before working, so a late-arriving task-store delivery of an already-claimed task is an idempotent no-op (no double-work). **Record the fallback** in the run's dispatch trace (which lane, pickup-verification failure, direct injection used). Never assume a `TaskCreate` reaching the task store means it reached the pane. *(Codification note: the 2026-06-14 run applied this fallback ad hoc; this clause makes it mandatory, bounded, and verified. In paired evals the OLD body is sample-ambiguous on this case — one A sample chose the fallback, another kept waiting — which is exactly why the clause pins it.)* *Evidence: reflection `run-2026-06-14T21-06-12-400Z` — `TaskCreate` reached only 2 of 4 teammates and `SendMessage`-by-name failed for the other 2, with no verification step to catch it before the run stalled (that run predates the runs-directory canonicalization — its run-id shape predates the current `run-\u003Cyyyymmdd-hhmmss>-\u003Cslug>` convention).*\n- **Honor the snapshot-resolved backend; team is primary under tmux (cmux surfaces are checked first, when present — see the cmux-first bullet above).** The backend comes from `snapshot.effective.agent_mode` (resolved at intake via the D5 ladder, ADR D5) — under `team`, when cmux is absent, that is `agent-team` (one **visible pane per specialist**); for no-tmux\u002Fno-cmux hosts supporting independent agents, `in-process` dispatch (launcher returns `dispatchPlan: GuildDispatchDescriptor[]`; execute-plan issues one `Agent()` per descriptor — full flow in `dispatch.md §\"In-process dispatchPlan consumption\"`); `subagent` is the last resort. Whatever the backend, dispatch each lane AS its **named specialist role**, resolved against the team specialist's definition identity. A **shipped** specialist dispatches by name. A **project-local** specialist must carry the same committed `definition_ref` through team, bundle, descriptor, and declaring transport; a non-declaring transport refuses before launch. The host-generic type is only used on the verified in-process carrier. Prompt prose or a bare absolute path is not definition injection, and must not be reported as such. The **§task§agent lifecycle and tiering are orthogonal to the backend choice**.\n- **Self-build uses the dev-team, not the product specialists.** When the target repo IS the Guild plugin itself, `team.yaml` is composed from the hash-bound dev-team definitions under `.guild\u002Fagents\u002F`, routed by changed path (full roster + path table in `dispatch.md`; see also `CLAUDE.md §\"Dev team\"`). Each lane carries the exact committed `definition_ref`; no bare host-native name is substituted. The 15 domain specialist roles build *user* products; they are NOT the self-build team.\n- **`agent-team` needs `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` — there is no separate dispatch-time approval gate.** The backend is simply the resolved snapshot value (`snapshot.effective.agent_mode`); the only operator prompt is the **per-run tmux-enablement preflight prompt** at intake (`runStartPreflight` → `needsTmuxPrompt`, which persists `agent_mode: team` on yes), not a blocker raised here at dispatch. At dispatch, the one hard gate is the env var: if the snapshot resolves `agent-team` and `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is absent, refuse and surface the blocker — never silently fall back to subagents (that would change execution semantics out from under the plan).\n\nParallelism follows the DAG, not authoring order; scheduling rules and worktree isolation live in `dispatch.md` — except the spine-lane verify checkpoint below, which this skill owns directly.\n\n**Backend capacity schedules waves — it never shrinks the team (`guild.team_schedule.v1`).** When the backend cannot run every approved participant concurrently, partition the approved set into dependency-valid execution **waves** (each approved `participant_id` in exactly one wave) and record the schedule bound to the `proposal_hash`\u002F`decision_hash`. The approved proposal's `proposed_schedule` is a non-binding preview (frozen §3), but a binding schedule whose **wave structure or concurrency departs from what the user approved is a §4 invalidating change** — surface it for renewed approval, never dispatch on the changed shape silently. Invariants are **set equality, not counts**: approved participant-id set = base-wave union = dispatch-receipt id set = terminal-outcome id set (removal only via a NEW proposal+decision cycle, cited by decision hash). Retries attach to the same `participant_id` as new attempts — never new participants; a failed or interrupted wave preserves all not-yet-terminal ids for resume — omission is NEVER removal. Resource exhaustion produces an explicit scheduling failure or a request for a user-approved backend\u002Fconcurrency change; it can never truncate, filter, or reorder the approved roster. Legacy `--team-size N` \u002F `defaults.team.size` are migration-window concurrency *hints* only (clamped to verified backend capacity, with a clamp diagnostic; `allow_larger` is a warned no-op) — none of them can touch the roster.\n\n## Spine-lane verify checkpoint (mandatory, overrides the inline-shortcut fast path)\n\nA **spine lane** is any lane that one or more *other* lanes list in their `depends-on:` — `architect` is the common case (`dispatch.md §\"Architect first when present\"`), but any lane with downstream dependents qualifies. When the plan declares a spine lane, insert a **mandatory verify checkpoint after the spine lane's receipt lands and BEFORE any dependent lane fans out** — even under `--auto-approve=all` \u002F `--rigor=deep --auto-approve=all`. `## Inline shortcut under high autonomy` above does **not** exempt a spine lane from this checkpoint: that section's own condition #3 (\"no cross-lane contract handoff\") already excludes it — a spine lane's dependents are, by definition, pulling a contract from its receipt.\n\nThis checkpoint is **NOT** a repeat of receipt-shape validation (which already runs for every lane) and **NOT** a substitute for G-lane review (which also runs). Its differential content is **dependent-contract verification** — the verify-the-claim discipline applied at the fan-out boundary:\n\n1. **Enumerate the consumed contract.** From the plan, collect what each dependent lane's brief actually pulls from the spine (files, interfaces, schema names, decisions its `scope` references).\n2. **Independently verify each consumed item** against the spine's receipt claims: the artifact exists on disk, and a spot-read confirms it matches what the receipt says it is (never trust the receipt's `evidence:` text alone — open the artifact). Field-presence checking is the ordinary receipt gate, not this one.\n3. **Ordering is fixed:** receipt-shape validation → `## Lane retry + dead-lettering` (if malformed\u002Fmissing) → G-lane review (per policy; always-on for self-build) → **this spine checkpoint** → fan-out. A **replacement receipt** produced by a retry or a G-lane rework **re-enters this checkpoint** before any dependent dispatches — a passed checkpoint never survives a receipt swap.\n4. On a failed verification, hold every dependent, route the spine lane back per step 3's chain, and record the failure. Record the checkpoint's pass\u002Ffail in the dispatch trace alongside the spine lane's tier\u002Fscore line.\n\nA corrupted spine poisons every downstream lane's provenance — the cost of this checkpoint is one lane's worth of verification against the alternative of re-running an entire fan-out.\n\n*Evidence: reflection `run-learn-knowledge-convergence-20260529-094021` — the same run this checkpoint and `## Hard-set gate deferral under high autonomy` both trace to.*\n\n## Adversarial review per lane — G-lane (broker, when policy fires)\n\nG-lane is the **only command-visible gate** (adversarial-review spec §Gate ownership): it fires per-lane here during `build`, so `build`'s skill set owns the review step. Wire the **review broker** at the lane-receipt boundary, **not** `guild:codex-review` directly: the broker is the host-agnostic front door, and `guild:codex-review` survives only as the internal Codex adapter the broker dispatches to (adversarial-review spec §The review broker).\n\nAfter each lane's receipt is confirmed and before the next lane dispatches (or before `guild:review` for the final lane), invoke `guild:review-broker`:\n\n```\nSkill: guild-review-broker\nargs: gate=G-lane:\u003Ctask-id> artifact_path=.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md run_id=\u003Crun-id> author_host=\u003Crun author host>\n```\n\nBecause the gate id is **per-lane** (`G-lane:\u003Ctask-id>`, matching the frozen `G-lane:${string}` union), the broker's AC-9 review trail for the lane lands in a **per-lane subdirectory** — `.guild\u002Fruns\u002F\u003Crun-id>\u002Freview\u002FG-lane:\u003Ctask-id>\u002F` (packet \u002F result \u002F trail). This is the declared trail path; `build.md`'s AC-9 root declaration MUST read identically (`review\u002FG-lane:\u003Ctask-id>\u002F`, not the lane-collapsed `review\u002FG-lane\u002F`) so the declared path equals the actual write path.\n\nSubstitute `\u003Ctask-id>` with the lane's task-id (e.g. `T2-backend`); run per-lane in series after the receipt is confirmed. The broker is **policy-gated** (adversarial-review spec §The review broker): it fires only when `risk ≥ high`, `review: cross` \u002F `--review=cross` is set, or project config requires it — otherwise it resolves `status: \"skipped\"` and the lane advances with no reviewer. Self-build runs treat cross-host review as always-on. `author_host` is the host that produced the receipt (resolved from the run-start preflight snapshot; `claude` on a Claude-hosted run). On `status: \"rework\"`, the lane re-executes — clear its receipt and re-dispatch the specialist with the findings as added context; the re-run counts against `counters.json` key `restart:\u003Clane>` (shared with the L3\u002FL4 cap). On `\"satisfied\"`, `\"skipped\"`, or `\"force_passed\"`, advance normally.\n\n## Receipt collection\n\nThis skill does not author receipts — it confirms each exists at `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md`, is readable, and carries the five §8.2 `## \u003Cname>` sections (`changed_files`, `opens_for`, `assumptions`, `evidence`, `followups`) plus exactly one fenced ```` ```guild.handoff.v2 ```` block — checked by the `check-handoff-receipts.js` gate, never by eye. Every dispatch path (launcher pane, in-process descriptor, or a direct `Agent()` fallback) carries the canonical handoff block from `dispatch.md §\"Handoff protocol\"` verbatim; a lane briefed without it writes a drifted receipt that this gate refuses. `guild:review` and `guild:verify-done` read these receipts instead of rehydrating full conversations (§8.2), so receipt integrity is load-bearing.\n\n**Single-channel invariant.** The receipt file is the **authoritative handoff source across all backends** (team \u002F in-process \u002F subagent). The lead never reads handoff content from chat text or SendMessage body — it reads the file. A missing or malformed receipt is an errored lane regardless of what the agent said in chat. Full protocol: `dispatch.md §\"Handoff protocol\"`.\n\n**Agent-bus event log (SK-5 — concept #4, the single-channel coordination substrate).** Beyond the per-lane receipt, the dispatch path emits **inter-lane lifecycle events** (lane dispatched, lane completed, lane errored\u002Fretried) to the canonical agent-bus event log `.guild\u002Fruns\u002F\u003Crun-id>\u002Fagent-bus\u002Fevents.ndjson` (the host-neutral channel for events \u002F approvals \u002F questions \u002F heartbeats; FDC-4, **critical**). This is a **PCR-Development must-exist artifact** (`build.md` output floor), so the dispatch path MUST produce it:\n\n- **Team backend:** the agent-team lifecycle hooks (`TaskCreated` \u002F `TaskCompleted` \u002F `TeammateIdle`, hook-engineer-owned) emit the bus events.\n- **Model-driven (subagent \u002F in-process `agent`):** there are no agent-team hooks, so **the orchestrator emits the bus event itself** at each lane boundary — append one event per lane-dispatched \u002F lane-completed transition. Use the tooling bus-emit helper (atomic temp-write + rename + the `.guild\u002F.lock` single-writer lock — concurrent lanes must not tear the log); never hand-append without the atomic-rename discipline.\n\nThe receipt remains the **truth** (single-channel handoff); the bus event log is the **event stream** a `resume`\u002Freplay reads to reconstruct lane timing without host memory — they compose, the bus never substitutes for the receipt. *(The bus-emit helper + the team-backend hook emission are tooling\u002Fhook-owned; this skill states the seam + the model-driven orchestrator's emit obligation so the must-exist artifact is actually produced.)*\n\n**Lean-lead intake (ADR §4\u002F§5).** The coordinator dispatches **by pointer** and **never absorbs full specialist transcripts** — it consumes only the compact `guild.handoff.v2` block each agent emits (canonical body at ADR §5, bound by pointer). The agent's terminal receipt is a durable `guild.handoff_receipt.v1` wrapper that **embeds** exactly one `guild.handoff.v2` block for review\u002Fverify — the v1 frontmatter is human-review context and the single embedded v2 block is the machine truth; the two compose (wrapper includes block), they do not compete. Schema detail is bound by pointer to `dispatch.md §\"Handoff protocol\"`, never re-spelled here. When `models.structuredOutputRequired` is `true`, a return that is not a valid `guild.handoff.v2` envelope (or over-runs the `summary` cap) is a dispatch defect: treat the lane as errored. Full transcripts remain in `.guild\u002Fruns\u002F` for audit; they never enter lead context. The lead holds last-N envelopes in full + a rolling summary of older work (`guild:context-assemble §\"Lead context\"` — bound by pointer).\n\n**Assumption aggregation.** Before the stop condition, aggregate every receipt's `assumptions:` list into `.guild\u002Fruns\u002F\u003Crun-id>\u002Fassumptions.md` (one section per specialist, verbatim). If no lane reported assumptions, still create the file empty (header only) so `guild:verify-done` can tell \"no assumptions\" from \"aggregation skipped\" — it is the single handoff verify-done reads for its check #5.\n\n## Reconcile the launcher-authored `guild.team_result.v1` (G6b-2b \u002F TaskCell AT12)\n\nThe production launcher writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-result\u002F\u003Cstation>.json`\nimmediately after a dispatch batch is committed. That launcher-authored\n`guild.team_result.v1` is the **single writer of runtime identity**: its lane\n`instance_id` values are copied from the exact TaskCell instances handed to the\nselected backend. After handoff collection, this skill enriches that persisted\nartifact; it does not create a second result.\n\n1. Read the persisted result with `readTeamResult` and fail closed if it is\n   missing or invalid. The launcher already knew the companion `team_plan_ref`;\n   do not reconstruct it from chat or a filename convention here.\n2. Join each result lane to the canonical\n   `.guild\u002Fruns\u002F\u003Crun-id>\u002Ftask-cells\u002F**\u002Fassignment.json` by `instance_id`. Require\n   **identity SET equality** between result lanes and valid assignments, and\n   require each lane `role` to equal the assignment's `worker_role`. A missing,\n   extra, duplicated, or role-mismatched identity is a dispatch-record defect and\n   blocks review.\n3. For each joined lane, update only `handoff_ref` and `acceptance_ref` with the\n   assignment's canonical TaskCell paths when those durable files exist. This\n   skill **MUST NOT mint, derive, replace, reorder, or drop `instance_id`**. It\n   also must not add `participant_id`: `guild.team_result.v1` is a closed schema;\n   participant set equality remains the separate authoritative schedule\u002Freceipt\n   close gate.\n4. Run the deterministic reconciler after handoff collection (and again after\n   acceptance so both pointer classes converge):\n\n   ```bash\n   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Ftask-cell-team-result.js \\\n     --cwd \u003Crepo-root> --run-id \u003Crun-id> --station \u003Cstation>\n   ```\n\n   A non-zero exit is a hard review blocker; do not hand-edit the result.\n5. The reconciler persists the enriched result through `writeTeamResult`, which re-validates it\n   fail closed. A write error is no longer described as harmless once the\n   launcher emitted TaskCells: stale or conflicting typed identity evidence is a\n   hard review blocker. Receipts remain the authoritative handoff content; the\n   typed result is the mandatory identity join.\n\nContract: `guild.team_result.v1` in\n`src\u002Fdomains\u002Fteams\u002Fstation-composer.ts`; read\u002Fwrite path in\n`station-signals.ts`; TaskCell canonical paths in\n`scripts\u002Flib\u002Fcore\u002Fcontracts\u002Ftask-cell-backend.ts`.\n\n## Inline shortcut under high autonomy (`--rigor=deep --auto-approve=all`)\n\nWhen the run posture is `--rigor=deep --auto-approve=all` AND the operator is\n**not** engaged for per-gate confirmation, the orchestrator MAY inline the\nper-lane chain (`guild:context-assemble → dispatch → guild:review`) instead\nof invoking each sub-skill formally. This shortcut emerged organically across\nthree self-build runs (`docs-clean-up`, `share-dot-guild`,\n`cross-platform-compatibility`) and is now codified — it is **not** a defect.\n\n### When inline IS valid\n\nAll three conditions must hold:\n\n1. **Posture allows it.** `--auto-approve=all` set on the run, OR\n   `defaults.auto_approve: all` in `.guild\u002Fsettings.json`. The autonomy\n   contract is genuinely high — no per-gate confirmation expected.\n2. **Lane corpus is small.** The lane's input fits the orchestrator's\n   working set without a structured bundle — see\n   `guild:context-assemble §\"Mandatory-invocation threshold\"` for the cap.\n   When the cap is crossed, formal `guild:context-assemble` is **mandatory**\n   regardless of posture.\n3. **No cross-lane contract handoff.** The lane has no upstream\n   `depends-on:` requiring a verbatim contract pull from a sibling lane's\n   handoff receipt. Cross-lane contracts demand a bundle for reproducibility.\n\n### When inline is FORBIDDEN\n\nAny of these conditions forces the formal sub-skill chain:\n\n- Operator is **engaged for per-gate confirmation** (`--auto-approve` unset\n  or value `risky-only`\u002F`destructive-only`). Each gate must surface for\n  approval — inlining bypasses the approval surface.\n- **Lane corpus exceeds the threshold** in\n  `guild:context-assemble §\"Mandatory-invocation threshold\"`.\n- **Upstream `depends-on:` contract** must be threaded into the lane\n  (`guild:context-assemble §\"Role mapping\" \u002F §\"Task-dependent layer\"`).\n- A **regression-prone area** — the lane touches an L1\u002FL2 loop, the\n  promotion gate, or another single-point-of-failure surface where the\n  bundle's `source_paths` are part of the audit trail.\n\n### Audit trail when inlining\n\nEven under the inline shortcut, the run record MUST capture equivalent\nevidence:\n\n- `.guild\u002Fruns\u002F\u003Crun-id>\u002Fdispatch-trace.md` — what lanes were dispatched,\n  at which tier, against which bundle equivalent (the orchestrator's\n  inlined working set, file-listed).\n- `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` — receipt\n  required as usual.\n- Reflection notes that inlining was used and **why** (which conditions\n  qualified). This is exactly how `run-b6337cbc` recorded the inlining;\n  the pattern is now the contract.\n\n### Why this clarification exists\n\nThree consecutive reflections named `guild:execute-plan` in\n`proposals.skill_improvement` (`run-2b531201`, `run-0c8ae3ca`,\n`run-b6337cbc-cross-platform`). Each one observed the orchestrator\nsatisfying the per-lane chain by inline action under\n`--auto-approve=all` rather than formal sub-skill dispatch. The pattern\nworked every time; the §11.1 ≥3-reflection trigger fired on what was\nactually an **under-specification** of valid orchestrator behavior, not a\ndefect.\n\n### Expiry (issue #57 — the shortcut is a budget, not a standing posture)\n\nThe forensic finding behind issue #57: a 39-hour self-build session used\nthis shortcut to justify doing **909 Bash \u002F 136 Edit \u002F 52 Write operations\nitself** across 8 un-re-anchored compactions, instead of dispatching lane\nwork by pointer — the orchestrator\u002Fteam-lead\u002Fexecutor separation\ncollapsed into one session. `## Mid-run scope expansion` below inherits\nthe same budget (absorbing an operator mandate inline does not reset it).\n\nThe inline shortcut is valid only up to a hard, codified budget. It\n**expires** — and the orchestrator MUST re-enter the formal sub-skill\nchain (`guild:context-assemble → dispatch → guild:review`, or\n`guild:resume` if picking a run back up) — on whichever of these happens\nfirst:\n\n1. **N direct lead Edit\u002FWrite operations.** `N` =\n   `.guild\u002Fsettings.json` `defaults.lean_lead.hands_on_edit_threshold`\n   (default **8**; `defaults.lean_lead.enabled: false` disables the guard\n   entirely), read tolerantly straight off `settings.json` the same way\n   `defaults.resume.enabled` is (`hooks\u002Flib\u002Frun-state.ts readResumeEnabled`).\n   **Known gap:** this key is not yet wired through `guild:config`'s\n   validate\u002Fset\u002Fresolve surfaces (`scripts\u002Flib\u002Fcore\u002Fconfig-cli.ts`,\n   `scripts\u002Fconfig-cmd.ts`, `src\u002Fdomains\u002Fconfig\u002Fsettings-reader.ts`)\n   — those files are outside this lane's scope — so `guild:config set` and\n   `guild:config validate` do not yet recognize it; only a direct hand-edit\n   of `settings.json` takes effect. Follow-up: register it as a proper\n   config-schema surface. Counted from the tool-call trace, not\n   self-reported — see enforcement below.\n2. **Any compaction boundary.** This is a DISJUNCTION with #1, not a\n   fresh N-edit allowance — `hooks\u002Fsession-reanchor.ts` (gap G1, oir-wi-00)\n   already re-injects the lean-lead contract (dispatch by pointer, don't\n   absorb lane work) into the fresh post-compaction context, so continuing\n   to edit inline past that point is ALREADY a fresh violation on its own,\n   independent of N. The first direct lead Edit\u002FWrite after a compaction\n   is the trigger, not the Nth.\n\n**Enforcement lives in code, not prose.** `hooks\u002Flean-lead-guard.ts` (a\nStop hook — it observes every turn end) is registered globally, so it ALSO\nfires inside every dispatched specialist's own pane\u002Fsubagent session, not\njust the lead's. It first checks THIS INVOCATION's own environment — a\n`GUILD_TASK_ID` or `GUILD_LANE_ID` set means the calling process IS a\ndispatched lane worker, not the lead, and the guard stays silent and never\ntouches the shared per-run fire-once state (a lane worker's own Stop hook\nmust never consume or perturb the ONE advisory meant for the lead). Once\nconfirmed to be the lead's own session, it counts direct lead Edit\u002FWrite\n`tool_call` trace events since the most recent `PreCompact` trace event\n(identified by the ABSENCE of `lane_id` — real production dispatch\nbackends thread `GUILD_TASK_ID` into a lane worker's own environment,\nwhich `post-tool-use.ts` stamps onto `lane_id`, so a lane worker's own\ntool calls always carry one), and cross-references the count against\n`run-state.json`'s open (`pending`\u002F`in_progress`) lanes. Crossing the\nthreshold — or, post-compaction, the FIRST such edit at all — while lanes\nare open surfaces a loud advisory (`hookSpecificOutput.additionalContext`)\nnaming the count, the threshold, and the open-lane count, and pointing\nback at `guild:execute-plan` \u002F `guild:resume`. It never denies a tool call\nand never forces a specific corrective action — a solo one-off task or a\nrun with no dispatched lanes has nothing this guard needs to protect —\nsee `hooks\u002Flib\u002Flean-lead-guard.ts` header for the full zero-noise gating\n(disabled, overridden, no open lanes, under threshold, already fired this\ncycle) and for the honest caveat that Stop's `additionalContext` does\nstill cost the lead one more turn to read it, unlike a bare stderr log.\nAn operator who wants this specific\ncrossing dismissed sets `GUILD_LEAN_LEAD_OVERRIDE=1` for the session.\n\n## Hard-set gate deferral under high autonomy (sibling to the inline shortcut above)\n\nSibling clause to `## Inline shortcut under high autonomy` above — that section governs when the *sub-skill chain* can be inlined; this one governs what happens when a lane, inlined or not, **hits an always-ask \u002F hard-set gate** while running under high autonomy (`--auto-approve=all` \u002F `defaults.auto_approve: all`).\n\n**Do not stop the whole lane on a hard-set gate.** An always-ask gate (a destructive action, a credential, a policy the operator must personally confirm — anything the autonomy contract marks as never-auto-approved) still cannot be silently skipped, but the lane around it does not have to halt either:\n\n1. **Split the work.** Partition the lane's remaining scope into the part that is safely completable without the gated action, and the part that requires it.\n2. **Apply the safe part.** Execute (and, on completion, let the lead commit per the usual commit discipline) everything that does not depend on the gated action.\n3. **Emit a complete contract artifact for the gated part** at the deterministic run-local path `.guild\u002Fruns\u002F\u003Crun-id>\u002Fdeferrals\u002F\u003Ctask-id>-\u003Cgate-slug>.md` (`guild.deferral_contract.v1`): for a **file gate**, the exact file and the literal proposed content\u002Fdiff (not a description); for a **non-file gate** (credential, network egress, spend, destructive op), the exact action and parameters the operator would execute; plus **why it's gated** (which autonomy-policy rule fired). Complete enough to apply in **one pass**.\n4. **Record the deferral with an explicit disposition.** In the lane's receipt `followups:`, the deferral entry is marked **`blocking: true` whenever the gated half is spec- or plan-required** — `guild:review` and `guild:verify-done` MUST then treat it as a blocker (never \"merely deferred\"); only genuinely optional work may carry a non-blocking disposition. A lane receipt is not \"complete\" by omitting required work into a deferral — the deferral defers *approval*, not *accountability*.\n5. **The artifact is a proposal, never an authorization.** Neither the lane, the lead, nor any later consumer applies the deferred action without a **fresh operator confirmation** — auto-applying a deferral artifact is a hard-gate bypass, exactly what this clause exists to prevent.\n\nThis keeps a high-autonomy run moving on everything it's actually allowed to do, instead of stalling the entire lane — and everything downstream of it — on one gated sub-task.\n\n*Evidence: reflection `run-learn-knowledge-convergence-20260529-094021` — three-run provenance: the run itself plus its `A2` and `F1` lanes, all landing this split-and-defer pattern with zero rework once the operator applied the deferred artifact.*\n\n## Mid-run scope expansion (operator-mandate absorption)\n\nTwo consecutive self-build initiatives (`docs-clean-up`, `share-dot-guild`)\nlanded a new operator mandate **mid-run** — at a soft gate (CQ answer\nbroader than the option set), at the SC-7 risk gate (Decision M added\nafter audit), or even **post-commit** (the \"one `.guild\u002F` per repo root\"\npolicy that emerged after SC-10). In both cases the run absorbed the\nexpansion cleanly without restarting the lifecycle. This section codifies\nthe absorption pattern so future orchestrators recognize and execute it\ndeterministically.\n\nAbsorbing an expansion **inline** (step 3 below) still draws against the\nsame inline-shortcut budget as `## Inline shortcut under high autonomy →\n### Expiry` — a broadened mandate is not a reset. If the budget has\nalready expired (or expires mid-absorption), formalize the remaining\nabsorption work as dispatched lanes rather than continuing to patch it in\ndirectly.\n\n### Detection signals\n\nA mid-run scope expansion is in play when **all** of these hold:\n\n- The mandate arrives in operator chat *between* gates (not in the\n  original spec\u002Fplan).\n- It is broader than the surfaced option set for the active gate (e.g.\n  operator answers a 2-option question with a 3rd option that's a policy\n  extension).\n- It does not invalidate the work already completed — it extends or\n  re-scopes ongoing\u002Fupcoming lanes.\n\nIf the mandate **invalidates** completed work (e.g. \"redo the previous\nlane with X\"), this is **not** scope expansion — it's a re-dispatch\nrequest; halt and surface to the operator before proceeding.\n\n### Absorption protocol (5 steps, in order)\n\n1. **Lock the new decision.** Append a new decision row to the active\n   initiative's `decisions.md` with a freshly-allocated ID\n   (e.g. `D-SHR-5` after `D-SHR-1..4`) and verbatim quote the operator's\n   mandate. Cite the gate \u002F chat point where it landed. Decisions are\n   immutable once locked — do not edit prior ones, only add.\n\n2. **Update the controlling ADR.** Author a new `## Decision \u003CLetter>`\n   section in the relevant ADR with the policy in full (rationale +\n   enforcement mechanism + scope). Maintain the cross-reference between\n   the initiative-scoped decision ID (D-SHR-5) and the ADR-scoped letter\n   (Decision M).\n\n3. **Apply inline to in-flight work.** Identify which lanes are\n   affected; for each, decide:\n   - **Already-complete lane** → audit its output against the new rule;\n     if it conforms, no rework; if not, apply a surgical patch (do not\n     re-dispatch the lane unless the operator requests).\n   - **In-flight lane** → inject the new rule into the lane's autonomy\n     policy (the next handoff receipt must show compliance).\n   - **Not-yet-dispatched lane** → update the lane's scope in the plan\n     before its Wave dispatches.\n   - **Team-decision invalidation check (frozen §4).** If an absorption edit\n     changes a participant's scope-defining obligations, dependencies,\n     tier\u002Fpurpose, capability scope, backend, wave structure, concurrency, cost\n     posture, or review independence, the prior `guild.team_decision.v1` is\n     invalidated for the affected participants: hold their not-yet-dispatched\n     lanes, surface a restructured proposal (new version), and obtain a fresh\n     approve before those lanes dispatch. Purely additive guidance that changes\n     none of the above absorbs without re-approval.\n\n4. **Log to activity.jsonl.** Append a `policy_clarification` event\n   (mirror the existing event types in `share-dot-guild`'s log):\n   ```json\n   {\"ts\":\"…\",\"event\":\"policy_clarification\",\"id\":\"\u003Cinitiative>\",\n    \"trigger\":\"operator\",\"clarification\":\"\u003Cverbatim>\",\n    \"absorption\":[...what was patched...],\"verified\":\"\u003Chow>\"}\n   ```\n   This makes the expansion auditable in `\u002Fguild:stats` and surfaces\n   in the reflection.\n\n5. **Carry forward in verify.md.** The verify-done writeup\n   (`.guild\u002Fruns\u002F\u003Crun-id>\u002Fverify.md`) must include the mid-run mandate\n   in its \"Assumptions reviewed\" or a dedicated \"Mid-run policy\n   expansions\" section, so the closeout reflects the actual rule set\n   the run shipped — not just the original plan.\n\n### What absorption is NOT\n\n- **Not** a re-spec. The original spec stays as-is; the new decision\n  *extends* it, doesn't supersede it.\n- **Not** silent. Every step above leaves an artifact (decision row,\n  ADR section, activity entry, verify.md note). An orchestrator that\n  \"just applied the patch\" without these is producing un-auditable runs.\n- **Not** an excuse to skip gates. If the new mandate changes what\n  the *next* gate should ask, update the gate questions; never proceed\n  past a gate that hasn't yet seen the new rule.\n\n### Why this is in `execute-plan` and not `guild:plan`\n\n`guild:plan` writes the original lane plan at planning time, before\noperator-mandate-at-gate is possible. `execute-plan` is the orchestrator\nthat actually sees the mandate land mid-run; the absorption protocol\nmust live where the orchestrator can reach it. If a mandate lands\n*before* the first lane dispatches, prefer re-running `guild:plan` with\nthe new constraint — absorption is for after Wave 1 has begun.\n\n## Lane liveness sweep (backend-agnostic watchdog)\n\nWhile lanes are in flight — parallel waves, or any wait on a lane's receipt — sweep liveness **each poll cycle** with the deterministic report tool; never eyeball heartbeat files or infer a stall from chat silence:\n\n```bash\nnode ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fcheck-lane-liveness.js --run-dir \u003Cabs path to .guild\u002Fruns\u002F\u003Crun-id>>\n```\n\nIt reads `run-state.json` (lenient — receipts-only when absent), the structured `in-progress\u002F*.json` heartbeats, and `handoffs\u002F*.md` receipts, and prints a per-lane report `{ lane, status, receipt_present, heartbeat_age_ms, stalled }` (stall threshold `GUILD_HEARTBEAT_TIMEOUT_MS`, default 600000; exit 0 always — it is a report, not a gate). This is the Rung-2\u002F3 (subagent \u002F in-process `agent`) watchdog complement to the team backend's pane-alive + `TeammateIdle` checks — same heartbeat records, one sweep across backends. On `stalled: true` for a lane:\n\n1. **Nudge once.** Re-prompt the lane's agent (or its pane) referencing its last heartbeat `step`, and record the nudge in the dispatch trace.\n2. **Still stalled on the next sweep** → treat the lane as FAILED and route it into `## Lane retry + dead-lettering` (retry up to `defaults.retry.max_attempts`, then the `mark-lane-dead.ts` funnel). Never leave a stalled lane spinning silently past two consecutive stalled sweeps.\n\n## Lane retry + dead-lettering (R-016)\n\nImplements the per-lane resilience contract (v2 runtime and execution model ADR §retry\u002F§resume). Read the policy from the run's **resolved settings** (`readResolvedSettingsSnapshot` \u002F `read-guild-config.ts` — never hard-code): `defaults.retry.max_attempts` (int ≥ 1, default **1** = no retry), `defaults.retry.backoff` (`immediate | linear | exponential`, default `exponential`), `defaults.resume.enabled` (bool, default **true**).\n\nA lane is **FAILED** when its receipt is missing\u002Fmalformed (step 4) or the agent returns an error status. On failure:\n\n1. **Retry up to `max_attempts`.** Re-issue the lane's `Agent()` — a **fresh** ephemeral agent, same bundle + resolved tier — up to `defaults.retry.max_attempts` **total** attempts (attempt 1 + retries). Between attempts, pace per `defaults.retry.backoff` and fold **backoff guidance** into the retry brief (e.g. `prior attempt \u003Cn> failed: \u003Clast-error>; address it before proceeding`). With the default `max_attempts: 1` this is a **no-op** — one attempt, no retry — so default behavior is unchanged (transparent).\n2. **A passing receipt before exhaustion** → the lane is clean; continue normally and record the retry count in the dispatch trace.\n3. **On exhaustion** (all `max_attempts` attempts FAILED), mark the lane **dead via the bridge CLI** so the in-process \u002F subagent path writes the **same checkpoint the SSH path does** — the single writer is hooks' `markLaneDead`:\n\n   ```\n   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fmark-lane-dead.js \u003CrunDir> \u003ClaneId> \\\n     --attempts N [--last-error \"...\"] [--run-id \u003Crun-id>] \\\n     [--plan-slug \u003Cslug>] [--wave-index \u003Cn>] [--cwd \u003Crepo-root>]\n   ```\n\n   `\u003CrunDir>` = `.guild\u002Fruns\u002F\u003Crun-id>\u002F`; `\u003ClaneId>` = the lane's `task-id`; `--attempts N` = total attempts made; `${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}` = the plugin install root (the dir containing `scripts\u002F`). This funnels to `markLaneDead` (`hooks\u002Flib\u002Frun-state.ts`) → run-state `dead` + `resume.json` (the CLI writes the resume checkpoint **only when `defaults.resume.enabled` is true** — it reads that key tolerantly itself), so a later `\u002Fguild:resume` re-enters the dead lane from its checkpoint. **Do not write run-state directly** — the CLI is the only sanctioned funnel (parity with the SSH `runWithRetry` `onExhausted` path; both converge on `markLaneDead` for identical run-state + resume semantics).\n\nA dead lane is **not** a clean receipt — see `## Stop condition`.\n\n## Resuming dead lanes (R-016)\n\nThe READ\u002Fre-enter half of dead-lettering (the WRITE half is `## Lane retry + dead-lettering`). When `\u002Fguild:resume` continues a run, **before** it locates the next pending gate it re-enters any checkpointed dead lane so a transient failure doesn't strand the run. (`\u002Fguild:resume`'s command `## Dispatch` invokes this section before gate location.)\n\n1. **List resumable dead lanes** via the read-side bridge CLI (the mirror of `mark-lane-dead.ts`) — the `--json` flag is **required** for parseable output (without it the CLI prints a human table):\n   ```\n   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fresume-lanes.js \u003CrunDir> --json\n   ```\n   It scans `\u003CrunDir>\u002Flanes\u002F*\u002Fresume.json`, applies the **`guild.lane_resume.v1`** schema-version guard (skips foreign\u002Folder versions), honors `defaults.resume.enabled`, joins each lane's `tier` from run-state, sorts by `lane_id`, and writes a **bare JSON array** (one object per resumable dead lane) to stdout:\n   ```json\n   [{ \"lane_id\": \"...\", \"run_id\": \"...\", \"attempts\": N, \"last_attempt_at\": \"...\", \"last_error\": \"...\", \"resumable_at\": \"...\", \"tier\": \"mid\" }, …]\n   ```\n   **Consume the array directly — it is NOT wrapped in an object.** It is already version-guarded + `resume.enabled`-filtered + `lane_id`-sorted CLI-side. `tier` is present when run-state carried it (absent otherwise — default skill-side); `bundle_path` is **not** in the output — recover it skill-side (step 2). **An empty array `[]` ⇒ no resumable lanes ⇒ exactly today's resume behavior** (proceed straight to the next gate). `\u003CrunDir>` = `.guild\u002Fruns\u002F\u003Crun-id>\u002F`; an optional `--cwd \u003Crepo-root>` overrides the repo root for the `resume.enabled` read; `${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}` = the plugin install root.\n2. **Re-enter each resumable dead lane** through the normal dispatch path: spawn a **fresh** ephemeral `Agent()` against the lane's bundle, folding `last_error` in as backoff guidance. Use the entry's `tier` when present (else recover from run-state `lanes[\u003Clane_id>].tier`, `hooks\u002Flib\u002Frun-state.ts`); **recover\u002Frebuild `bundle_path`** skill-side (the lane's `.guild\u002Fcontext\u002F\u003Crun-id>\u002F\u003Cspecialist>-\u003Ctask-id>.md`, or rebuild via `guild:context-assemble` if the bundle file is gone). This **resets the lane from `dead` back into `## Lane retry + dead-lettering`** — operator-initiated resume grants a **fresh retry budget** (`defaults.retry.max_attempts` again); the prior `attempts` count is preserved in the checkpoint for audit but does **not** subtract from the resumed budget (otherwise a lane already at `max_attempts` would re-dead immediately). Re-entry follows the same `## Per-lane flow` (bundle → tier → dispatch → receipt) as a first dispatch; a lane that re-fails past `max_attempts` on the resumed run is re-marked dead via the same `mark-lane-dead.ts` funnel.\n3. **Then continue** to the next pending gate as today.\n\nGated + graceful: the whole step is a no-op when `resume-lanes.ts` emits an empty list (no checkpoints written, or `defaults.resume.enabled: false`). This closes the R-016 write↔read symmetry — `## Lane retry + dead-lettering` WRITES dead-lane checkpoints; this section READS + re-enters them.\n\n### Close requires review + verify-done (issue #59 — resuming is not a shortcut past the gates)\n\nThe forensic finding behind issue #59: a 39-hour session entered the\nlifecycle (initiative → team-compose → build → execute-plan) and abandoned\nit **38 seconds after its first compaction**. 91.9% of the session's Bash,\n77% of its Edit\u002FWrite and 94% of its Agent dispatches happened AFTER the\nlast lifecycle skill fired, and `guild:review`, `guild:verify-done`,\n`guild:qa`, `guild:reflect` and `guild:resume` were never invoked at all\nacross 8 compactions — a production-infra build closed with no review gate\nand no verify gate.\n\nSo: **a build run MUST pass `guild:review` and then `guild:verify-done`\nbefore it may close** — whether it ran straight through or was picked back\nup here. Resuming re-enters dead lanes (steps 1–3 above) and then continues\nto *the next pending gate*, which for a `build`-phase run is `review`, then\n`verify-done`; it does not skip whatever the interrupted run had not yet\npassed. **Receipts are not close.** `## Stop condition` below is the handoff\nINTO `guild:review`, never a substitute for it, and `guild:verify-done` is\nthe only thing that writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Fverify.md`. A run whose\nrecords show build activity (dispatched lanes, collected receipts) but no\n`review.md` \u002F `verify.md` has not closed — it has been abandoned.\n\n**Enforcement lives in code, not prose.** Two surfaces, both in\n`hooks\u002Flib\u002Flifecycle-gate.ts`, reading the real v1.4 trace + run state\nrather than any self-report:\n\n1. **The active UserPromptSubmit gate** (`hooks\u002Flifecycle-gate.ts`, invoked\n   from `hooks\u002Fcheck-skill-coverage.sh` — the advisory nudge this issue\n   upgraded). While the run is genuinely ACTIVE — the `reanchor.ts\n   isRunActive` activity window, NOT `status: open`, because the Stop hook\n   closes the run at the end of every assistant turn — and past build-start\n   (persisted phase, or a lane recorded in `run-state.json`), it counts the\n   LEAD's own `Bash`\u002F`Edit`\u002F`Write` `tool_call` events since the last time\n   anything was routed through the lifecycle. A \"lifecycle touch\" is a\n   lead-own, non-errored `Skill` call whose **parsed** skill name is a\n   lifecycle skill — parsed out of the tool input, never string-matched, so a\n   passing mention of `guild:review` in some other call's arguments cannot\n   forge one. Lane-attributed events are the worker's, not the lead's.\n   Crossing `.guild\u002Fsettings.json`\n   `defaults.lifecycle_gate.adhoc_activity_threshold` (default **20**)\n   **blocks the prompt**, and the same body is delivered to the model as\n   `additionalContext` on the next accepted prompt — a block is shown to the\n   *operator*, so without that hand-off the drifting model would never see\n   the correction. Two tiers, because Bash mutates too (`sed -i`, `git\n   apply`, `>` redirects, deploys): the threshold applies when at least one\n   Edit\u002FWrite happened, and **3×** the threshold when the stretch is\n   shell-only, so read-only exploration stays silent while shell-driven\n   mutation is not a free pass. The drift must also be CURRENT (default 30\n   min) — an abandoned run's historical count never blocks a fresh prompt.\n2. **The close-time Stop backstop.** When the run has actually reached\n   `## Stop condition` — **every** lane `done` (a `failed`\u002F`dead`\u002F`skipped`\n   lane means dead-lettering, not review, so the gate stays silent there), each\n   lane bound to its own distinct, non-empty `handoffs\u002F*.md` receipt through\n   the checkpoint's `receipt_ref` — but `review.md` and\u002For `verify.md` is\n   missing, empty, or not a real file, it emits a Stop `block` naming exactly\n   which artifact is absent, giving the lead a turn to run the gate that\n   produces it. It re-arms only when the missing SET changes (review.md\n   landed, verify.md still absent — including on the hook-continued turn, which\n   is exactly when the lead runs that gate), clears its latch once nothing is\n   missing so a later regression is still caught, and is hard-capped at a few\n   fires per run so it can never become a Stop loop.\n   **What it detects is a missing or blank artifact — not a failing one.** It\n   never parses a verdict, so a `verify.md` recording `fail` satisfies it just\n   as a passing one would; reading verdicts is `guild:verify-done`'s own job.\n   The rule above is the CONTRACT; this hook is a backstop against the case\n   that actually happened — the gates never running at all.\n\nBoth are edge-triggered on CHANGE, not level — the prompt gate once per\nthreshold crossing, the close gate once per missing-artifact set (under a hard\nper-run fire cap) — so neither can dead-end a session: re-sending the prompt\nproceeds, and the close gate deliberately evaluates on hook-continued turns\nrather than short-circuiting on `stop_hook_active`, because that is precisely\nthe turn in which the lead runs the gate it was told about. An operator who wants one\ncrossing dismissed adds `[guild:gate-override]` to the prompt — which\n**consumes** that crossing (so the next prompt is not blocked on the identical\nunchanged one) and drops any undelivered correction rather than letting it\nresurface later out of context. `GUILD_LIFECYCLE_GATE_OVERRIDE=1` dismisses for\nthe session, and `defaults.lifecycle_gate.enabled: false` disables the gate\noutright.\n\nBoth gates treat the trace, `run-state.json` and their own sentinels as\nUNTRUSTED workspace state: the trace is read through the canonical v1.4\n`validateEvent` schema validator, `run-state.json` is structurally validated,\ncounting order never depends on a workspace-supplied timestamp, and no free\ntext is ever persisted and replayed into model-visible context.\n\n**Known gaps, stated honestly.** (a) Same as `defaults.lean_lead.*`, these\nkeys are not yet wired through `guild:config`'s validate\u002Fset\u002Fresolve\nsurfaces, so only a direct hand-edit of `settings.json` takes effect today.\n(b) UserPromptSubmit fires between turns, so a single agentic turn can run\nhundreds of ad-hoc calls before the gate next evaluates; the gate bounds\ndrift at turn boundaries and the Stop backstop covers close, but per-tool\ninterception belongs on `PreToolUse` and is tracked separately.\n\n## Stop condition\n\nExecution is complete when every lane has a non-error receipt under `handoffs\u002F`:\n\n- **participant-id SET EQUALITY, not a count**: the approved proposal's participant-id set = the dispatch-receipt id set = the terminal-outcome id set (`guild.team_schedule.v1` invariant; the only omission allowed is `explicitly_removed_by_new_decision`, citing the new decision hash) — a matching count with a swapped or missing id is NOT complete;\n- every receipt has a populated `evidence:` field (§8.2 — never \"looks good\");\n- no receipt is blocked\u002Ferrored without a matching error record in the run log.\n\nIf a lane FAILED, it first goes through `## Lane retry + dead-lettering`; a lane still failing after `defaults.retry.max_attempts` is marked **dead** (checkpointed for `\u002Fguild:resume`). Halt and surface any dead lane(s) to the user — name each dead lane, its attempt count, and that `\u002Fguild:resume` will re-enter it from its checkpoint — rather than forwarding to `guild:review` (review cannot compensate for a missing receipt). If every lane is clean, hand off to `guild:review`.\n\n## Handoff\n\nOnce the stop condition is met, hand off to `guild:review` with:\n\n- `run_id` — the run directory name.\n- `handoffs_dir` — absolute path to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F`.\n- `plan_path` — the approved plan (`.guild\u002Fplan\u002F\u003Cslug>.md`).\n- `lane_count` — number of receipts collected.\n- `backend` — the backend used (`subagent` or `agent-team`), read from the run's resolved-settings snapshot (`snapshot.effective.agent_mode`), not from `team.yaml`.\n- `tier_trace` — per-lane `{task-id, complexity_score, tier, model}` as dispatched (the surfaced scores).\n- `escalations` — count of advisor consults across the run + any `inconclusive: advisor budget exhausted` lanes.\n- `team_result_path` — the companion `guild.team_result.v1` emitted at `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-result\u002F\u003Cstation>.json` (or the fail-soft skip note), the typed mirror of the dispatched instances against the composed team_plan.\n\n`guild:review` runs its 2-stage per-task review (spec-conformance then quality) against the receipts in `handoffs_dir`. Do not run review yourself — it is a separate skill with its own responsibilities.\n\n## Chapters\n\nThree-stage disclosure (KTD25): this file is the assembler. Each row below is an\nL3 chapter that stays on disk until a request matches it. Compose by pointer —\nread the one chapter you were routed to, and never inline a chapter here.\n\n| Chapter | Covers |\n|---|---|\n| `references\u002Fcontext-assemble.md` | Assembles per-specialist 3-layer context bundle: Universal (~400 tokens — guild:principles + project-overview + goals) + Role-dependent (~800–1500 — standards + 2–4 entity pages matching role) + Task-dependent (~800–1500 — lane from plan + named refs + upstream contracts + active decisions) |\n| `references\u002Fcounters-and-concurrency.md` | reference material for this assembler |\n| `references\u002Fdispatching-parallel-agents.md` | The discipline for dispatching independent specialist lanes in parallel — respect depends-on edges, isolate context, collect handoff receipts, and never parallelize work with ordering or shared-state hazards |\n| `references\u002Ffinish-branch.md` | Guild's branch-completion discipline — once work is done and tests pass, present clear integration options (merge, PR, keep, discard) and execute the chosen one safely, then clean up the worktree |\n| `references\u002Fio-contract.md` | reference material for this assembler |\n| `references\u002Floop-implement.md` | F-3 implementation-phase adversarial-loop dispatcher — wraps `guild:execute-plan` per lane |\n| `references\u002Floops-applicable-enum.md` | reference material for this assembler |\n| `references\u002Fsecurity-review-restart.md` | reference material for this assembler |\n| `references\u002Ftdd.md` | Guild's first-class test-first discipline — write the failing test, watch it fail, then write the minimal code that passes |\n| `references\u002Ftesting-anti-patterns.md` | reference material for this assembler |\n| `references\u002Fworkflow-and-events.md` | reference material for this assembler |\n| `references\u002Fworktrees.md` | Guild's git-worktree isolation discipline — create an isolated worktree with deterministic directory selection and safety verification so a lane runs on a clean tree without disturbing the user's current checkout |\n\n## Chapter pointers (resolve before you dispatch)\n\nThese names appear in the body as if they were skills. They are NOT — the\nT03 fold (KTD25\u002FKTD59) made each one an L3 chapter. Read `guild:\u003Cname>` below\nas \"load this file and run it in place\"; never try to dispatch it as a skill.\n\n| Named in this body | Lives under | Load |\n|---|---|---|\n| `guild:codex-review` | `review` | `..\u002Freview\u002Freferences\u002Fcodex-review.md` |\n| `guild:context-assemble` | this assembler | `references\u002Fcontext-assemble.md` |\n| `guild:decisions` | `wiki` | `..\u002F..\u002Fknowledge\u002Fwiki\u002Freferences\u002Fdecisions.md` |\n| `guild:review-broker` | `review` | `..\u002Freview\u002Freferences\u002Freview-broker.md` |\n| `guild:verify-done` | `quality` | `..\u002F..\u002Fquality\u002Freferences\u002Fverify-done.md` |\n| `guild:wiki-ingest` | `wiki` | `..\u002F..\u002Fknowledge\u002Fwiki\u002Freferences\u002Fwiki-ingest.md` |\n","# guild:execute-plan\n\nImplements the task lifecycle execute step. Runs after `guild:plan` has produced an approved `.guild\u002Fplan\u002F\u003Cslug>.md` and before `guild:review`. Dispatches every specialist lane per the DAG encoded by the lanes' `depends-on:` edges, and gathers one handoff receipt per lane into a single run directory `guild:review` consumes verbatim.\n\n## Input\n\nFive things, all required:\n\n1. `.guild\u002Fplan\u002F\u003Cslug>.md` — the approved per-specialist lane plan. Must have frontmatter `approved: true`; if approval is missing, refuse to dispatch and loop back to `guild:plan`'s approval gate.\n1b. **The phase's team decision (`guild.team_decision.v1`) — the dispatch gate.** Dispatch accepts only a **current `approve` decision whose `proposal_hash` equals the hash recomputed from the persisted `guild.team_proposal.v2` artifact** (canonical-YAML SHA-256, hash field omitted — the frozen team-contracts rule). Stale, missing, or hash-mismatched decisions **fail closed**: refuse to dispatch and loop back to `guild:team-compose`'s decision gate (`guild:team-compose §\"Team decision gate\"`). This applies to EVERY dispatchable participant — workers, advisors, challengers, and reviewer slots alike — in every phase; an advisory label never bypasses the gate. Guild never auto-approves. Any post-approval change to a participant, obligation, dependency, tier\u002Fpurpose, capability scope, backend, wave structure, concurrency, cost posture, or review independence invalidates the decision and requires renewed user approval.\n2. The resolved per-phase team file from `guild:team-compose` — **resolved via `resolveTeamFile(guildRoot, slug, readActivePhase(cwd))`** (`scripts\u002Flib\u002Fteam-file.ts`) → `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` (current) or the legacy `.guild\u002Fteam\u002F\u003Cslug>.yaml` (read-only back-compat). **Pass the resolved per-phase path onward to the launcher** (`## Backend + routing`); a `null` return → request a phase-composition pass (loop back to `guild:team-compose`), never fabricate a path; a legacy hit → emit the one-line deprecation notice once per run (*\"single-file team.yaml is legacy; re-compose to adopt per-phase teams\"*). Authoritative for **team composition**: the specialist roster, per-specialist scope\u002Fdependencies\u002Ftiers, and agent-definition paths. **Not** the backend authority — the execution backend is resolved at command intake (`runStartPreflight`) and read from the run's resolved-settings snapshot (`snapshot.effective.agent_mode`, see `## Backend + routing (summary)`).\n3. The run's **resolved-settings snapshot** — `.guild\u002Fruns\u002F\u003Crun-id>\u002Fresolved-settings.json`, read via `readResolvedSettingsSnapshot` (`scripts\u002Flib\u002Frun-lifecycle.ts`). Authoritative for the execution backend (`snapshot.effective.agent_mode`) and the detected\u002Frecommended\u002Fselected review providers (`snapshot.providers`).\n4. `.guild\u002Fruns\u002F\u003Crun-id>\u002F` — the run directory already created by the lifecycle start. Consume the lifecycle-owned canonical `run-\u003Cyyyymmdd-hhmmss>-\u003Cslug>` identity from the start result \u002F `.guild\u002Fruns\u002Fcurrent-run-id` sentinel and pass it unchanged as `--run-id` to the launcher. This skill and the launcher never mint, reshape, or replace a run id; every context bundle, handoff receipt, and assumption log roots under the inherited directory. A missing, unbound, or non-canonical identity blocks dispatch and must be repaired by starting the lifecycle, not by inventing a fallback.\n\nDo not re-derive lanes from chat or from the spec. The plan is the single source of truth for what gets dispatched.\n\n## Per-lane flow\n\nFour strict phases per lane. A lane does not advance until the previous phase has produced its artifact:\n\n1. **Context bundle.** Invoke `guild:context-assemble` for the lane; it writes `.guild\u002Fcontext\u002F\u003Crun-id>\u002F\u003Cspecialist>-\u003Ctask-id>.md` per §9.3. Read back the bundle's handoff receipt to confirm `bundle_path`, `token_estimate`, `layers_included`, and the linter-returned `definition_ref`. Join the lane owner to the team specialist and require the bundle ref to equal the team's committed ref exactly. A missing\u002Fmalformed\u002Fmismatched ref or bundle blocks dispatch — never fall back to an absolute definition path or chat context.\n2. **Tier resolution.** Auto-score the lane and resolve its tier per `## Tier resolution` — print the score + chosen tier (never silent). The resolved tier becomes the Agent `model` param at dispatch.\n3. **Dispatch.** **First write the lane's `guild.task_run.v1` descriptor** (TE-01 — see `## Task-run descriptor + routing persistence`); then spawn an **ephemeral one-agent-per-task** agent (see `## §task§agent lifecycle`) at the resolved tier, using the snapshot-resolved backend (`snapshot.effective.agent_mode`), passing the bundle path as the primary task brief. Before spawning, inject three things: the **producer marker** — prompt line 1 plus its env twin (`## Capability-scope env injection` steps (2b)\u002F(2c); contract in `dispatch.md §\"Producer marker (line-1 + env)\"`); the **capability-scope env vars** (`## Capability-scope env injection`); and **the canonical handoff protocol block** verbatim into the agent's prompt (`dispatch.md §\"Handoff protocol\"`) — substituting `\u003CRECEIPT_PATH>` and `\u003CTASK_ID>` for this lane before sending. The agent escalates via `## Advisor escalation` if it hits something above its tier. Routing rules, backend mechanics, env injection, and handoff protocol injection: `dispatch.md`.\n4. **Receipt.** Confirm the agent wrote its handoff receipt to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` per §8.2, **populate the receipt `host` block (`selected` \u002F `degraded` \u002F `independence`) from the lane's routing decision** (TE-03 — see `## Task-run descriptor + routing persistence`), then **extract its `learnings[]` and dismiss the agent** (lifecycle below). Gate the receipt with `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fcheck-handoff-receipts.js --cwd \u003Crepo-root> --receipt .guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` (this lane's receipt only) — a non-zero exit (a missing §8.2 `## changed_files` \u002F `## opens_for` \u002F `## assumptions` \u002F `## evidence` \u002F `## followups` section, or not exactly one valid ```` ```guild.handoff.v2 ```` fence) means the receipt is malformed → treat the lane as **FAILED**: record the failure in the run log and route it into `## Lane retry + dead-lettering` (retry up to `defaults.retry.max_attempts`, then checkpoint as dead) rather than immediately halting the run.\n\nA specialist dispatched without a bundle violates the context contract (§9); one that completes without a receipt violates the handoff contract (§8.2). Either condition blocks `guild:review`.\n\n## Task-run descriptor + routing persistence (TE-01 \u002F TE-03)\n\nThe snapshot-resolved backend selects **how** a lane is dispatched, but the\n**subagent \u002F in-process (non-tmux) path runs through this skill** — the\ntmux\u002Fteam launcher (`scripts\u002Fagent-team-launcher.ts`) covers only the team\nbackend. So on the model-driven path the task-run write and routing persistence\nare done **here**, per lane.\n\n> **Ownership guard — do these ONLY when `snapshot.effective.agent_mode ∈\n> {`subagent`, `agent`}`** (the model-driven path; `agent` is the D5 **in-process**\n> rung — use the enum value, not the concept name). The resolved\n> `snapshot.effective.agent_mode` enum is `team | agent | subagent | auto`\n> (`scripts\u002Flib\u002Fsettings-resolver.ts`) — there is **no** `in-process` value; the\n> in-process backend's value is **`agent`**. When `agent_mode` resolves to `team`\n> (tmux\u002Fagent-team) **or** a remote backend, the **launcher owns the TE-01\n> task_run write + the routing-decision persistence**\n> (`scripts\u002Fagent-team-launcher.ts`, EDIT-2\u002F3) — this skill **MUST NOT** also\n> write them, or the lane double-writes its `task_run.yaml` \u002F receipt `host`\n> block. The two backends partition the work cleanly: launcher = team + remote;\n> this skill = `subagent` + `agent` (in-process). Test the snapshot's\n> `agent_mode` value against `{subagent, agent}` before the writer call below;\n> skip it on `team`\u002Fremote. (`auto` is resolved to a concrete value at intake, so\n> the snapshot never carries `auto` here.)\n\n**TE-01 — write the `guild.task_run.v1` descriptor BEFORE each dispatch attempt\n(model-driven path only — see the ownership guard above).** After tier\nresolution and before spawning, invoke the writer CLI (one file per attempt; a\nre-dispatch overwrites — the writer handles it):\n\n```bash\nnode ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fwrite-task-run.js \\\n  --cwd \u003Crepo-root> --run-id \u003Crun-id> --task-id \u003Ctask-id> \\\n  --specialist \u003Cowner-role> \\\n  --context-bundle .guild\u002Fcontext\u002F\u003Crun-id>\u002F\u003Cspecialist>-\u003Ctask-id>.md \\\n  --depends-on \u003Cid,id,...> \\\n  --max-tokens \u003Cscored-budget> --max-turns \u003Cscored-turns> \\\n  [--needs-pr] [--needs-parallel] [--needs-network] \\\n  [--phase \u003Cphase>] \\\n  --isolation \u003Cworktree|none> --host-requested \u003Ckind>\n```\n\nIt writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Ftask-runs\u002F\u003Ctask-id>.yaml` (top-level\n`task_run:` wrapper, `context_bundle`, `host.capability_requirements`). Derive\n`--max-tokens`\u002F`--max-turns` from the lane's **scored tier** (step 2 — not a flat\ndefault) and the `--needs-*`\u002F`--isolation`\u002F`--host-requested` flags from the\nlane's `team.yaml` `host:` block + scope. `--phase \u003Cphase>` (default `execute`)\nsets the lifecycle phase stamped into the `guild.trace.dispatch.v1` event — it is\na real, caller-supplied phase, not derived from `--initiative-id`. Lanes running\nmid-`\u002Fguild:build` should pass `--phase execute` explicitly (or the phase they\nare actually in, e.g. `review` for a review-loop lane) rather than relying on\nthe default. The written\n`host.capability_requirements` is the **same object** the router reads as\n`LaneRequest.capabilityRequirements` in `route()` — writer→router round-trip\nidentity.\n\n**TE-03 — persist the routing decision into the receipt `host` block** (model-driven\npath only — same ownership guard; on team\u002Fremote the launcher persists it). When the\nlane's handoff receipt is written, populate its `host` block from the\n`RoutingDecision` (`route()` return \u002F launcher-surfaced) — `selected`\n(`RoutingDecision.host`), `degraded` (`RoutingDecision.degraded`), and\n`independence` (`\"strong\" | \"weak\"`), with values **equal to** the decision (and\nmirrored into run-state `LaneState.host` by the dispatch path).\n\n**Single-host independence rule (state it, never leave implicit).** On the\nsingle-host subagent path with no cross-host routing, set\n`selected: \u003Clocal host>`, `degraded: false`, and **`independence: \"weak\"` whenever\nthe reviewer shares the producer's host family** (the common no-cross-host case —\na same-host review is weak independence, exactly as the review broker stamps it).\n`independence: \"strong\"` requires a genuinely different reviewer host family. A\nsingle-host run is therefore `weak`, recorded — never silently `strong`.\n\n## Tier resolution\n\nImplements the cost-aware-tiering ADR (§2). Each lane is dispatched at the **lowest viable tier** — the default biases cheap; a `powerful` invocation must be justified by the score, an explicit override, or an advisor request.\n\n1. **Auto-score (deterministic, via `scripts\u002Fscore-tier.ts`).** Invoke the pure, LLM-free scorer — `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fscore-tier.js --signals '\u003Cjson>' --cwd \u003Crepo-root> [--model-tier \u003Cpin>]` → `{score, tier, model}` — passing the lane's signals (work-type verb read\u002Fsummarize=0, draft\u002Fextract=+1, architect\u002Freview\u002Fschema=+2; blast-radius \u002F file count; presence of an upstream `depends-on:` contract; security\u002Fcorrectness sensitivity; prior-attempt escalation on this lane +1, sticky for the run). The scorer is deterministic and costs **zero tokens** (a script call, not an LLM judgment) — so the dispatch trace is reproducible (SC-5). It applies steps 2–4 below internally and returns `score`+`tier`+`model` in one call. The plan's `complexity_score`\u002F`tier` are the authoring estimate; the scorer confirms or supersedes them.\n2. **Map score → tier** via the band cutoffs `models.thresholds` (default `{mid:1, powerful:3}`): `0 → cheap`, `1–2 → mid`, `≥3 → powerful`.\n3. **Apply the precedence ladder (normative):** `--model-tier=` CLI escape hatch > per-lane plan `tier:` pin > `settings.json` `models.tiers`\u002F`models.thresholds` > built-in default. A `--model-tier` value pins **every** lane in the run; a per-lane plan `tier:` pin overrides the auto-score for that one lane.\n3b. **Research floor (above the ladder, non-downgradable).** A lane whose participant carries `purpose: research` (authoritative `work_class` metadata from its role definition — never inferred from the lane label) resolves `effective_complexity: hard` \u002F `tier: powerful` (`research_always_hard`), regardless of the auto-score, any `--model-tier` value, or a per-lane pin — the ladder chooses *among tiers at or above the floor*, never below it. The floor is **transitive through every handoff**: advisor consults, retries, resumes, nested delegation, and generic sub-dispatches spawned from a research lane inherit it and cannot downgrade it. Record `forced_floor_reason: research_always_hard` in the dispatch trace and the lane's receipt whenever it fires.\n4. **Resolve tier → model** through the host-agnostic `models.tiers` map (ADR §1\u002F§10 — bound by pointer; within Claude `cheap=haiku`, `mid=sonnet`, `powerful=opus`). Within Claude this binds directly to the Agent tool `model:` param at dispatch.\n5. **Print + record.** Surface the dispatch line (`lane \u003Ctask-id> · score N · tier \u003Ctier> · model \u003Cmodel>`) and write the score + resolved tier into the run record under `.guild\u002Fruns\u002F\u003Crun-id>\u002F` (never silent — spec Risk). **Approved-tier consistency:** the approved `guild.team_proposal.v2` records each participant's tier — the re-score CONFIRMS it; if they differ, that is a §4 invalidating change (tier\u002Fpurpose): do not silently dispatch at either value — surface a restructure (new proposal version) for renewed user approval. When `models.enabled: false`, skip scoring and dispatch at the backend default — EXCEPT `purpose: research` lanes, which dispatch `powerful` regardless (the step-3b floor holds with scoring disabled).\n6. **Persist the re-scored tier into `team.yaml` (ARCH-6 Part 2 \u002F W2-A3).** After auto-scoring a lane, write the scored tier back into the resolved per-phase `team.yaml`'s matching specialist entry via the **concurrent-safe writeback helper** — so the team-backend launcher's `tier ?? default_tier` (tooling's ARCH-6 Part 1) consumes the **re-scored** tier and tmux panes route at the per-lane score, not just the roster `default_tier`:\n\n   ```ts\n   import { writeBackScoredTier } from \"..\u002Fscripts\u002Flib\u002Fwrite-back-scored-tier\";\n   const result = writeBackScoredTier(resolvedTeamYamlPath, lane.owner, scoredTier);\n   if (!result.ok) console.warn(result.message);  \u002F\u002F non-fatal — degrades to default_tier, observably\n   ```\n\n   The helper is **lock-based** (`O_EXCL` lock on `\u003Cteam.yaml>.scoring.lock`, atomic temp+rename, idempotent, **never throws**, releases the lock even on error), so parallel lanes completing at the same instant cannot clobber the generated team-shape artifact — this is why a raw inline hand-edit was wrong and this helper is right. `result.ok` is the success check; on `false`, surface `result.message` as a warning — a writeback failure is **non-fatal**: the lane still dispatches and the team backend simply routes that specialist at `default_tier` (observable degradation, never silent, never a hard stop) — EXCEPT a `purpose: research` lane, which must still route `powerful`: on writeback failure for a research lane, reassert the floor at dispatch (Agent `model` param \u002F pane routing) rather than accept a `default_tier` downgrade (`research_always_hard` survives scoring-off, writeback failure, retries, and resume alike).\n\n   The two backend paths now both honor the score: the **model-driven path** (subagent \u002F `agent` in-process) applies the re-scored tier directly via the Agent `model:` param at dispatch; the **team-backend path** (tmux panes) reads the just-written `tier:` from `team.yaml`. `resolvedTeamYamlPath` is the path resolved via `resolveTeamFile` (the per-phase file). Skip the writeback when `models.enabled: false` (no scoring ran).\n\nConfig keys (`models.enabled`, `models.tiers`, `models.scoreWeights`, `models.thresholds`, …) are the closed-key `settings.json` `models:` block (ADR §10 — bound by pointer, never re-spelled).\n\n## Advisor escalation\n\nImplements ADR §3. When a low-tier agent hits something above its tier it gets **one powerful sub-answer for that sub-question only**, then continues — it is **not** re-run wholesale on the expensive model.\n\n1. **Trigger.** Any of three conditions independently triggers an advisor escalation:\n   - **`status: \"escalate\"`** — the agent emits `status: \"escalate\"` + an `escalate_reason` in its `guild.handoff.v2` envelope (in-flight dispatch envelope — canonical body at cost-aware-tiering ADR §5, bound by pointer; distinct from and never superseding the frozen `guild.handoff_receipt.v1`).\n   - **Uncertainty markers** — the agent's output contains a phrase from `models.escalationMarkers` (e.g. \"I'm not sure\", \"unclear\", \"cannot determine\").\n   - **Anomalously short output** (O-3; enabled by D-OBS-3 — the lane's output-token count falls below `models.shortOutputThreshold[task_type][tier]` in `settings.json`. **This trigger activates only when the threshold key exists** for the `(task_type, tier)` bucket; when absent, the trigger is silent and only the two deterministic triggers above govern. The benchmark analyzer derives and writes the threshold after ≥30 samples per bucket; the coordinator **reads `settings.json` only — no JSONL scanning at dispatch**.\n2. **Advisor answers the sub-question only.** Spawn a `powerful` **advisor** agent that sees the **draft + the question + a compact critique instruction (~50 tokens)** and **never the raw file context** — this is what keeps the expensive call cheap. **Route the advisor to the resolved advisory substrate (universal-host C1).** Read the per-run advisory role from the snapshot — `snapshot.roles.advisory.substrate` (`RoleResolutionSet`, recorded by `runStartPreflight`) — and dispatch the advisor on that host. The DEFAULT Claude+Codex box resolves `advisory = claude` (the local advisor), so this is **byte-identical to today** on a default box; a box whose advisory role resolved to a different substrate routes the consult there. Never re-resolve the substrate here or guess from the host name — consume the snapshot's `roles.advisory` (capability-matrix-driven at preflight).\n3. **Fold + continue.** The advisor returns via the same `guild.handoff.v2` envelope; the original cheap agent continues with the advisor's answer folded in. No wholesale re-run.\n4. **Round cap.** `models.advisorRounds` (default `2`) caps advisor consults per lane — mirrors the `codex_cap`\u002F`loop_cap` discipline. On exhaustion, record the lane `inconclusive: advisor budget exhausted` rather than silently escalating cost.\n5. **Trail.** Record the escalation trail (trigger, sub-question, advisor tier, result ref, round count) in the run record under `.guild\u002Fruns\u002F\u003Crun-id>\u002F` alongside the dispatch trace, so SC-6 is verifiable. **When the escalation is persisted as a durable `guild.advisory.v1` AdvisoryRecord** (`scripts\u002Flib\u002Fadvisory-record.ts` `makeAdvisoryRecord`), **stamp the C1 `substrate` field from the resolved advisory role** — pass `advisorySubstrateFromRoles(snapshot.roles)` (`scripts\u002Flib\u002Frole-resolver.ts`) as the `substrate:` input so the record carries `substrate == roles.advisory`:\n\n   ```ts\n   import { advisorySubstrateFromRoles } from \"..\u002Fscripts\u002Flib\u002Frole-resolver\";\n   const rec = makeAdvisoryRecord({\n     \u002F* …id, recorded_at, phase, backend, question, advisors, … *\u002F\n     substrate: advisorySubstrateFromRoles(snapshot.roles),  \u002F\u002F C1: routed advisory host\n   });\n   ```\n\n   `advisorySubstrateFromRoles` returns `undefined` when the role's substrate is absent\u002Funknown — and an **absent `substrate` means the default local advisor (`\"claude\"`)** per advisory-record back-compat, so a default Claude box records `substrate: \"claude\"` (equivalently absent). This is the C1 routing change L8 deferred to this call-site (SC-5): advisory advice now ROUTES to and is RECORDED with the resolved substrate, not just resolved in preflight.\n\nReview\u002Fcritic work folds into this advisor pass + the existing `guild:review`\u002F`qa` lanes — there is **no standalone reviewer agent type** (ADR O-1 resolution).\n\n## Capability-scope env injection\n\nImplements the dispatch-side of the v2 security ADR (bound by pointer). This is a **real orchestrator step, not aspirational scoping**: the scope IS published for the lane, the PreToolUse hook (`hooks\u002Flib\u002Fsecurity\u002Fenforce.ts`) reads it, and an out-of-scope tool call is **blocked**.\n\n**Environment-only delivery on code-backed transports.** Cmux, tmux, and remote backends inject the resolved scope into the real spawned process environment. They do not publish a pathname fallback: the shared writer documents a same-user ancestor-swap race, and raw writes can follow a planted scope symlink. The direct `Agent()` rungs are **unavailable for every scoped lane** until the host capability contract ships and verifies child-env carriage. The launcher enforces that refusal in code before emitting a production agent\u002Fsubagent signal.\n\nFirst, the **env vars**, injected **on the spawned lane agent only** (never the orchestrator process):\n\n- **`GUILD_CAPABILITY_SCOPE`** = the resolver's `JSON.stringify(capability_scope)`. An explicit team value wins; when a canonical role omits the field, the source-owned role default is materialized. Only an unknown\u002Fproject role with no explicit scope retains the legacy unscoped behavior.\n- **`GUILD_AUTONOMY_CONTRACT`** = a JSON string array of tool-permission rules derived from the plan lane's `autonomy-policy` `may act without asking` entries, in Claude Code permission-rule grammar (e.g. `\"Bash\"`, `\"Write\"`, `\"Read(*)\"` — syntax per `hooks\u002Flib\u002Fsecurity\u002Fenforce.ts`). **Omit when no machine-readable rules can be derived** (absent ⇒ no additional AND-masking).\n\n**Per-backend injection (concrete, code-backed):**\n\n- **Subagent \u002F in-process (`agent`) — model-driven path:** the launcher refuses this rung when any lane has a resolved scope. The resolver contract below is retained for the future verified child-env capability and for the legacy unscoped unknown\u002Fproject-role path; it does not authorize a scoped production `Agent()` call. Every `--dry-run`—scoped or unscoped—emits a non-dispatchable, write-free preview (`dispatchAllowed:false`, `previewOnly:true`) for inspection only; it consumes no approval override and writes no run-tree state:\n\n  ```ts\n  \u002F\u002F (-1) CONSUME THE LAUNCHER'S FAIL-CLOSED DECISION BEFORE ANY LANE WORK.\n  \u002F\u002F      This applies whether the backend came from an explicit ladder choice\n  \u002F\u002F      or the run's frozen snapshot. Missing fields are not legacy permission:\n  \u002F\u002F      only the exact production tuple true\u002Ffalse authorizes Agent(). A scoped\n  \u002F\u002F      dry-run is inspection data and MUST terminate before task-run writes,\n  \u002F\u002F      scope resolution, descriptor consumption, or Agent().\n  if (signal.dispatchAllowed !== true || signal.previewOnly !== false) {\n    throw new Error(\n      `direct dispatch refused: launcher did not authorize Agent() ` +\n        `(dispatchAllowed=${String(signal.dispatchAllowed)}, ` +\n        `previewOnly=${String(signal.previewOnly)})`,\n    );\n  }\n\n  \u002F\u002F (0) RESOLVE THE LANE'S SPECIALIST — do this FIRST; everything below reads it.\n  \u002F\u002F     The plan lane carries `owner` (+ task-id, depends-on, scope). `definition`\n  \u002F\u002F     and `definition_source` live on the TEAM file's `specialists[]`, keyed by\n  \u002F\u002F     `name` — they are NOT lane fields. Join them explicitly and FAIL CLOSED.\n  \u002F\u002F     Mirror `composeInProcessDispatch` EXACTLY (scripts\u002Flib\u002Fhost\u002Finprocess-backend.ts):\n  \u002F\u002F     for a project specialist the definition must be the role-matched path\n  \u002F\u002F     `.guild\u002Fagents\u002F\u003Cname>.md` — a missing, whitespace, arbitrary, or\n  \u002F\u002F     role-MISMATCHED path is not a valid GUILD_AGENT_DEFINITION, and the\n  \u002F\u002F     composer THROWS rather than emit a persona-stripped descriptor (#58).\n  \u002F\u002F     On this rung the skill is the producer, so the skill owns that check.\n  const spec = team.specialists.find((s) => s.name === lane.owner);\n  if (!spec) throw new Error(`lane ${lane.taskId}: no specialist named ${lane.owner} in the team file`);\n  const isProject = spec.definition_source === \"project\";\n  if (isProject && (!spec.definition_ref || spec.definition_ref.schema_version !== \"guild.project_definition_ref.v1\"))\n    throw new Error(`lane ${lane.taskId}: project specialist ${spec.name} has no validated definition_ref`);\n  const bundleLint = JSON.parse(runContextBundleLint(bundlePath));\n  \u002F\u002F Shipped lanes have no team ref: expect the producer's synthesized plugin-shipped ref (#221).\n  const expectedRef = isProject ? spec.definition_ref\n    : JSON.parse(runDefinitionRefForDispatch([\"--name\", spec.name, \"--definition\", spec.definition, \"--source\", \"shipped\",\n        ...(spec.tier ? [\"--tier\", spec.tier] : []), ...(spec.default_tier ? [\"--default-tier\", spec.default_tier] : []),\n        ...(spec.capability_scope ? [\"--capability-scope\", spec.capability_scope.join(\",\")] : [])])).ref;\n  if (!bundleLint.pass || JSON.stringify(bundleLint.definition_ref) !== JSON.stringify(expectedRef))\n    throw new Error(`lane ${lane.taskId}: context bundle definition_ref does not match the team`);\n  \u002F\u002F   NORMALIZE ONCE, then use `definitionPath` for BOTH carriers. The composer\n  \u002F\u002F   compares TRIMMED, so a padded-but-canonical `\"  .guild\u002Fagents\u002Fx.md  \"`\n  \u002F\u002F   passes validation — and emitting the RAW field would then produce the\n  \u002F\u002F   malformed line-1 marker `GUILD_AGENT_DEFINITION=  .guild\u002Fagents\u002Fx.md  `,\n  \u002F\u002F   which the whole-line parser rejects outright. Normalizing here makes the\n  \u002F\u002F   two carriers agree by construction.\n  const definitionPath = isProject\n    ? (typeof spec.definition === \"string\" ? spec.definition.trim() : \"\")\n    : undefined;\n  if (isProject) {\n    const expected = `.guild\u002Fagents\u002F${spec.name}.md`;   \u002F\u002F role-matched — that is WHY every\n    if (definitionPath !== expected)                    \u002F\u002F carrier can derive from spec.name\n      throw new Error(\n        `lane ${lane.taskId}: project specialist \"${spec.name}\" has an invalid definition ` +\n          `path ${JSON.stringify(spec.definition)} — expected \"${expected}\"`,\n      );\n  }\n  \u002F\u002F (1) APPROVAL-BOUND SCOPE RESOLUTION — run the shipped resolver before the\n  \u002F\u002F     spawn. It requires the exact team path + SHA-256 emitted by the\n  \u002F\u002F     approve-before-dispatch launcher signal, refuses changed\u002Fsubstituted\n  \u002F\u002F     bytes, preserves an explicit approval-bound scope, and returns the exact\n  \u002F\u002F     env payload without a race-prone pathname backstop.\n  \u002F\u002F     Do not retype the defaults or read lane.capability_scope yourself.\n  const scopeArgs = [\n    path.join(pluginRoot, \"runtime\", \"scripts\", \"resolve-specialist-capability-scope.js\"),\n    \"--team\", signal.teamPath, \"--team-sha256\", signal.teamSha256,\n    \"--cwd\", repoRoot, \"--run-id\", runId,\n    \"--task-id\", lane.taskId, \"--role\", lane.owner,\n  ];\n  if (autonomyRules?.length) {\n    scopeArgs.push(\"--autonomy-contract\", JSON.stringify(autonomyRules));\n  }\n  const scopeResolution = JSON.parse(\n    execFileSync(\"node\", scopeArgs, { encoding: \"utf8\" }),\n  );\n  \u002F\u002F (2) ENV — resolver env includes GUILD_RUN_ID + GUILD_TASK_ID and\n  \u002F\u002F     GUILD_CAPABILITY_SCOPE when resolved.\n  \u002F\u002F     `descriptor` is the lane's entry in `signal.dispatchPlan` on the in-process rung, and\n  \u002F\u002F     `undefined` on the bare `subagent` rung (the launcher returned no plan) — that is the\n  \u002F\u002F     value the FORK below branches on.\n  const descriptor = signal.dispatchPlan?.find((d) => d.name === lane.owner);\n  const env = { ...(descriptor?.env ?? {}), ...scopeResolution.env };\n  \u002F\u002F ── FORK — TWO BRANCHES. Take exactly one; they do not share step (3). ─────\n  if (descriptor) {\n    \u002F\u002F ── BRANCH A — IN-PROCESS (`agent`): a descriptor exists. ────────────────\n    \u002F\u002F   `composeInProcessDispatch` + `buildPrompt` already built the WHOLE\n    \u002F\u002F   dispatch: both producer-marker halves AND the teammate identity, lane\n    \u002F\u002F   scope, context-bundle pointer, assignment read-ack gate and wait\n    \u002F\u002F   instruction. Issue it AS-IS (`dispatch.md §\"In-process dispatchPlan\n    \u002F\u002F   consumption\"`). The ONLY permitted layering is the resolved `model` and\n    \u002F\u002F   the scope\u002Frun env keys built in steps (1)\u002F(2). Do NOT rebuild the\n    \u002F\u002F   prompt and do NOT recompute `subagentType` — a rebuild silently DROPS\n    \u002F\u002F   everything in that list. Nothing below this branch applies.\n    Agent({\n      subagent_type: descriptor.subagentType,   \u002F\u002F as-is — never recomputed here\n      model: resolvedModel,                     \u002F\u002F tiering is orthogonal (backend sends model:null)\n      prompt: descriptor.prompt,                \u002F\u002F as-is — never rebuilt here\n      env,                                      \u002F\u002F descriptor.env + steps (1)\u002F(2)\n    });\n  } else {\n    \u002F\u002F ── BRANCH B — BARE `subagent` rung: NO descriptor. ──────────────────────\n    \u002F\u002F   `agent-team-launcher.ts` returned a bare {backend, reason, slug} signal\n    \u002F\u002F   for `resolvedMode !== \"team\"`, handing the whole `Agent()` construction\n    \u002F\u002F   back to this skill. HERE the skill IS the producer, so it stamps what\n    \u002F\u002F   composeInProcessDispatch\u002FbuildPrompt stamp on every other class.\n    \u002F\u002F\n    \u002F\u002F (2b) PRODUCER MARKER, ENV HALF — an env map is composed by whoever issues\n    \u002F\u002F     the dispatch, so it is structurally out of reach of quoted prose.\n    env.GUILD_DISPATCH_PRODUCER = \"guild.dispatch.v1\";   \u002F\u002F emit v1; parsers accept guild.dispatch.v\u003CN>\n    env.GUILD_SPECIALIST = spec.name;                    \u002F\u002F identity carrier the guards match on\n    if (resolvedTier) env.GUILD_TIER = resolvedTier;     \u002F\u002F scored tier ?? default_tier — NEVER fabricate one\n    if (Number.isFinite(laneScore)) env.GUILD_TIER_SCORE = String(laneScore); \u002F\u002F audit-only; 0 IS a real score\n    if (isProject) env.GUILD_AGENT_DEFINITION = definitionPath;  \u002F\u002F #58 — unconditional for a project\n                                                                 \u002F\u002F specialist; the NORMALIZED team path\n    \u002F\u002F (2c) PRODUCER MARKER, PROMPT HALF — the line-1 twin of the env carrier, on\n    \u002F\u002F     a producer-owned position the lane's appended scope text can neither\n    \u002F\u002F     forge nor contradict. Emit exactly ONE line-1 marker, chosen by\n    \u002F\u002F     definition source — never both, never neither:\n    \u002F\u002F       project specialist → `GUILD_AGENT_DEFINITION=\u003CdefinitionPath>`\n    \u002F\u002F         (#58 — carries the role via its path AND is the machine adoption proof)\n    \u002F\u002F       everything else    → `GUILD_DISPATCH_PRODUCER=guild.dispatch.v1 role=\u003Cname>`\n    \u002F\u002F     The marker is the prompt's FIRST LINE, `\\n`-terminated, with nothing\n    \u002F\u002F     before it (no blank line, no leading whitespace, no preamble). Use the\n    \u002F\u002F     NORMALIZED `definitionPath`, never the raw field: a padded value would\n    \u002F\u002F     emit `GUILD_AGENT_DEFINITION=  .guild\u002Fagents\u002Fx.md  `, which the line-1\n    \u002F\u002F     parser rejects. Every role-bearing carrier derives from `spec.name`.\n    const line1Marker = isProject\n      ? `GUILD_AGENT_DEFINITION=${definitionPath}\\n`\n      : `GUILD_DISPATCH_PRODUCER=guild.dispatch.v1 role=${spec.name}\\n`;\n    \u002F\u002F (2d) ADOPTION INSTRUCTION — the marker is MACHINE proof for the guard; it\n    \u002F\u002F     is NOT what makes the agent adopt the persona. A project specialist\n    \u002F\u002F     dispatches as the host-generic type, so without this human-readable\n    \u002F\u002F     instruction the lane runs as a generic agent that merely LOOKS\n    \u002F\u002F     compliant — syntactically complete, functionally persona-stripped.\n    \u002F\u002F     Emit the SAME instruction `buildPrompt` emits\n    \u002F\u002F     (`src\u002Fdomains\u002Fconfig\u002Fteam-prompt.ts` — keep them in step):\n    const adoption = isProject\n      ? `Your role definition is at \\`${definitionPath}\\` — read it FIRST and adopt it ` +\n        `fully (persona, boundaries, TRIGGER \u002F DO NOT TRIGGER limits). For each skill listed ` +\n        `in its frontmatter \\`skills:\\`, load the project-local instance at ` +\n        `\\`.guild\u002Fskills\u002F\u003Cskill>\u002FSKILL.md\\` when it exists before starting your lane. `\n      : \"\";\n    \u002F\u002F The BRIEF — on this rung nothing built it for you, so build it here. It\n    \u002F\u002F must carry what `buildPrompt` gives every other class; the marker and\n    \u002F\u002F adoption text ADD to it and never replace it. NOTE what is deliberately\n    \u002F\u002F ABSENT: the `$GUILD_TASK_ASSIGNMENT` read-ack gate is PANE-ONLY — only\n    \u002F\u002F `tmux-backend.ts` \u002F `pane-adapter.ts` export that variable, so instructing\n    \u002F\u002F a subagent to read it would point the lane at an unset env var.\n    const handoffBlock = readHandoffProtocolBlock()               \u002F\u002F the canonical block, verbatim\n      .replace(\"\u003CRECEIPT_PATH>\", `.guild\u002Fruns\u002F${runId}\u002Fhandoffs\u002F${spec.name}-${lane.taskId}.md`)\n      .replace(\"\u003CTASK_ID>\", lane.taskId);                         \u002F\u002F dispatch.md §\"Handoff protocol\"\n    const brief =\n      `You are the \\`${spec.name}\\` teammate for run-id \\`${runId}\\`. ` +\n      `Your lane scope: \\`${lane.scope}\\`. ` +\n      `Your context bundle is at \\`.guild\u002Fcontext\u002F${runId}\u002F${spec.name}-${lane.taskId}.md\\` — read it first. ` +\n      handoffBlock;\n    const prompt = line1Marker + adoption + brief;\n    \u002F\u002F (3) SPAWN — subagent_type is DEFINITION-SOURCE-RESOLVED (dispatch.md hard\n    \u002F\u002F     constraint). A project specialist has no host-registered agent under\n    \u002F\u002F     its name, so it dispatches as the host-generic type carrying\n    \u002F\u002F     GUILD_AGENT_DEFINITION + the adoption instruction above; a PreToolUse\n    \u002F\u002F     guard DENIES a general-purpose dispatch that claims a persona without\n    \u002F\u002F     them (#58). Only a SHIPPED machinery\u002Fdev-team agent goes by bare name.\n    const subagentType = isProject ? GENERIC_SUBAGENT_TYPE : spec.name;\n    Agent({ subagent_type: subagentType, model: resolvedModel, prompt, env });\n  }\n  ```\n\n  **The `dispatchAllowed:true` \u002F `previewOnly:false` check is unconditional before either direct branch.** A missing field, a scoped preview, or a frozen direct signal that was not evaluated by the current launcher is a refusal; no task-run write, resolver call, descriptor consumption, or `Agent()` may follow it. **The line-1 producer marker is UNCONDITIONAL on the BARE `subagent` rung — it is what makes a direct `Agent()` dispatch attributable at all.** Every OTHER dispatch class (team\u002Ftmux panes, cmux surfaces, in-process descriptors, remote) gets its marker from `composeInProcessDispatch` \u002F `buildPrompt` \u002F `paneCommand` in code. The D5 `subagent` rung is the ONE class with no launcher descriptor — the launcher hands the whole `Agent()` construction back to this skill — so an unmarked lane here is a lane the PreToolUse guards and the run trace cannot tell apart from an arbitrary non-Guild `Agent` call. **On the in-process (`agent`) rung, do NOT construct any of this**: the descriptor already carries both marker halves and the full brief — issue `descriptor.prompt` \u002F `descriptor.subagentType` verbatim (`dispatch.md §\"In-process dispatchPlan consumption\"`), because rebuilding the prompt drops the teammate identity, scope, context pointer, read-ack gate, and wait instruction `buildPrompt` put there. Stamp both halves (env + prompt line 1) on every lane you construct yourself, at the first attempt and at every retry, resumed-dead re-dispatch, and nudge-replacement spawn. Never invent a value to fill a slot: omit `GUILD_TIER` when no tier resolved and `GUILD_TIER_SCORE` when no real score exists — a fabricated tier is worse than an absent one, because the guard would verify the model against a fiction. Full marker contract, the parse rules the guards apply, and the per-class table: `dispatch.md §\"Producer marker (line-1 + env)\"`.\n\n  **Absent `capability_scope` is resolved, not interpreted by the model.** Canonical roles receive a source-owned default and therefore make direct Agent dispatch refuse until verified child-env carriage ships. An unknown\u002Fproject role with no explicit scope retains the legacy clean fall-through. Omit `GUILD_AUTONOMY_CONTRACT` when its source is absent — never set an empty\u002F`\"undefined\"` value.\n- **Cmux, team\u002Ftmux, and remote:** the **launcher\u002Fbackend** injects `GUILD_CAPABILITY_SCOPE` directly into the spawned process environment. It writes no scope file.\n\nEnforcement engages from the environment. Absence is a clean fall-through only for the orchestrator, non-Guild sessions, and unknown\u002Fproject roles with no approved scope; a canonical\u002Fscoped direct Agent lane is refused before dispatch. Full backend-specific wiring: `dispatch.md §\"Capability-scope env injection\"` and `dispatch.md §\"In-process dispatchPlan consumption\"`.\n\n## §task§agent lifecycle\n\nImplements ADR §6 (D3). The **default execution unit is an ephemeral per-task agent** — one agent per task, never shared across tasks, never left idle. This is **orthogonal to** (composes with, never replaces) the D5 `agent_mode` backend ladder: D5 picks the *backend* (team \u002F agent \u002F subagent), this fixes the *lifecycle* (ephemeral, per-task) on whichever backend D5 selected. The backend itself is settings-resolved at run-start intake (`runStartPreflight` → the resolved-settings snapshot) per the D5 ladder — team\u002Ftmux is **primary whenever tmux is available**, not opt-in; subagent is the fallback for CI \u002F no-tmux hosts.\n\n**Single-channel handoff protocol.** Every agent in this lifecycle writes its receipt file as its final action — a `guild.handoff_receipt.v1` wrapper embedding exactly one `guild.handoff.v2` block — never to chat. The canonical protocol block is injected verbatim into every brief at dispatch (step 3 of `## Per-lane flow`); full rules, the frozen field set (schema by pointer), and the injection block: `dispatch.md §\"Handoff protocol\"`.\n\nSequence **spawn → work → extract → dismiss**:\n\n1. **Spawn.** Dispatch creates a **new** agent for the task at its resolved tier (`## Tier resolution`) with its pulled task-scoped context (`guild:context-assemble`). Two concurrent tasks get two **distinct** agents — never shared (SC-8).\n2. **Work.** The agent executes, escalating via `## Advisor escalation` if it hits something above its tier.\n3. **Extract.** On completion the agent extracts **learnings** into its `guild.handoff.v2` envelope (`learnings[]`); the coordinator lands them in the run record (`.guild\u002Fruns\u002F\u003Crun-id>\u002F`) and, where the gated reflection policy applies, into gated reflections (`.guild\u002Freflections\u002F` via `guild:reflect`). Learnings are **candidates only** — no auto-promotion (promotion stays with `guild:wiki-ingest`\u002F`guild:decisions`).\n4. **Dismiss.** The agent **terminates**. No idle agents persist; the next task is a **new** agent. This is why the default is an ephemeral per-task agent and not a long-lived worker pool.\n\nThe lead learns a lane finished only from its receipt, through `lane-receipt-wait` (`dispatch.md §\"§task§agent lifecycle at dispatch\"`). A host idle notification is never a result.\n\n## Backend + routing (summary)\n\nThe backend is **not** chosen here, and it is **not** chosen at `guild:team-compose` either. It is resolved **once at command intake** by `runStartPreflight` (U3) per the D5 `agent_mode` ladder — **including the first-class cmux rung: cmux > tmux when the intake probe records `CMUX_WORKSPACE_ID`** — and frozen in the run's resolved-settings snapshot (U6 writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Fresolved-settings.json`). The snapshot carries the decision as **`snapshot.dispatch` = `{backend: cmux|tmux|agent|subagent, reason, facts}`** (W4, initiative `run-identity-and-dispatch`). **`execute-plan` reads that snapshot via `readResolvedSettingsSnapshot` (`scripts\u002Flib\u002Frun-lifecycle.ts`) and acts on `snapshot.dispatch.backend` (falling back to `snapshot.effective.agent_mode` + `snapshot.providers` only for a legacy snapshot that predates the field)** — it does NOT re-resolve settings, re-run the preflight, or re-read the ambient environment. The launcher enforces the same authority: `agent-team-launcher.ts` consumes the frozen `snapshot.dispatch` and performs **no dispatch-time ambient CMUX\u002Ftmux re-probe** when the block is present, so a mid-run environment change (a cmux workspace appearing or vanishing, tmux installed mid-run) **cannot** select a different backend than the run-start decision. `team.yaml` is authoritative for the **team composition** (which specialists, their scope, dependencies, tiers, agent-definition paths), **not** for the backend selection — the backend authority is the resolved snapshot. Mid-run config edits do not silently change execution behavior because the snapshot is fixed at intake. Three invariants you enforce at dispatch — full detail (backend table, launcher invocation, self-build routing table, parallelism rules) in `dispatch.md`:\n\n- **cmux-first dispatch — the frozen `snapshot.dispatch.backend === \"cmux\"` rung, checked before tmux at the top of `team` (W4 landed: snapshot-frozen, first-class).** When the run's frozen snapshot records **`snapshot.dispatch.backend: \"cmux\"`** — resolved ONCE at run-start intake from the `CMUX_WORKSPACE_ID` fact and never re-read from the ambient environment at dispatch time (a legacy snapshot that predates the `dispatch` block falls back to one ambient `CMUX_WORKSPACE_ID` check at dispatch setup, then held constant for the whole run) — dispatch each lane as a **visible cmux terminal surface in the caller's workspace** instead of a tmux pane: one surface per lane via `cmux new-pane` \u002F `cmux new-surface --focus false` (or the host-current equivalent) — **never** a focus-stealing verb; set each lane's own sidebar status\u002Fprogress (`set-status` \u002F `set-progress`) as it advances, a per-lane signal, never shared\u002Faggregate. Lanes still write their handoff to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` per the single-channel protocol (`## §task§agent lifecycle` below) — the surface is a dispatch\u002Fvisibility mechanism, never a second handoff channel. The lead arms a **per-lane completion watcher** on each lane's own handoff file — never one watcher shared across lanes, since a finished lane must be actionable immediately, not sit behind whatever lane a shared watcher happens to be polling next. Once a lane's receipt is accepted, **reap its surface** — do not let finished surfaces linger. **The lead does all commits — lanes dispatched via cmux never commit their own work**, the same invariant as every other backend. **Launcher-owned obligations transfer to the lead.** Dispatching via cmux surfaces bypasses the tmux agent-team launcher, so the lead explicitly assumes what the launcher otherwise owns: (a) the team-mode task-run persistence under `.guild\u002Fruns\u002F\u003Crun-id>\u002F` — **auto-emit the dispatch receipts the launcher would have** by running the **cmux dispatch-receipt CLI** (`scripts\u002Flib\u002Fhost\u002Fpane-dispatch-trace.ts` — the cmux rung's launcher-bypass entry point, the executable form of \"the dispatch records the launcher would have\"), never by hand-writing those records. Invoke it ONCE per settled dispatch batch, after the surfaces are created and their pane ids collected — one `guild.trace.dispatch.v1` receipt per lane into the ORCHESTRATING run's `logs\u002Fv1.4-events.jsonl` (so `guild:reflect` sees the specialists, not a solo run):\n\n    ```bash\n    node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fpane-dispatch-trace.js \\\n      --run-id \u003Corchestrating-run-id> --cwd \u003Crepo-root> --backend cmux --target \"$CMUX_WORKSPACE_ID\" \\\n      --lane \u003Cspecialist>:\u003Ctask-id>:\u003Cpane-id> [--lane \u003Cspecialist>:\u003Ctask-id>:\u003Cpane-id> ...]\n    ```\n\n    Emit per lane in the **committed** batch, NOT per attempt — a surface that was reaped or rolled back must leave no receipt (over-reporting the run's specialists). A non-zero exit means a partial write (a real degradation of the run record, per obligation (b)), never a launch failure. When a lane's surface is reaped (`## Backend + routing`), its receipt is already recorded; do not re-emit; (b) capability-scope enforcement — the raw surface command MUST carry the resolver-produced `GUILD_CAPABILITY_SCOPE` in the spawned process environment; if the backend cannot prove that carriage, refuse or fall back to tmux rather than degrading or writing a pathname backstop; (c) the agent-bus lifecycle events (orchestrator-emitted, as on the model-driven backends — see `## Receipt collection`). A lead that cannot honor these obligations MUST fall back to the tmux launcher rung rather than dispatch unaccountable surfaces. When `snapshot.dispatch.backend` is not `\"cmux\"` (or, on a legacy snapshot with no `dispatch` block, when `CMUX_WORKSPACE_ID` is absent), this rung does not apply; fall through to tmux visible panes (the existing rung below is unchanged). *Evidence: umbrella `.guild\u002Fwiki\u002Fdecisions\u002Fcmux-first-dispatch.md` (merged ADR); initiative `run-identity-and-dispatch` work-item W4 — landed: `selectExecutionSubstrate`'s cmux rung + the frozen `snapshot.dispatch` block are the code half of that ADR, this bullet is its behavioral half.*\n- **Dispatch-verification — confirm pickup, never assume it (task-store rung only).** This clause governs the `agent-team` task-store signal path (`TaskCreate` + owner-assignment into tmux panes); the cmux rung above never uses `TaskCreate` — it dispatches by `cmux send` + read-screen monitoring per the ADR, so pickup there is direct by construction. After `TaskCreate` + owner-assignment, the lead **MUST verify pickup within a bounded timeout** (default **60s**; honor a project-configured dispatch-pickup timeout when the config surface provides one — never the 10-minute `heartbeat_timeout_ms`, which governs mid-run liveness, not dispatch). **Pickup means the teammate CLAIMED the task**: the task status set by the owning teammate, or pane read-screen evidence it echoed\u002Facted on the task-id — a status change from any other writer does not count. **On no-pickup, fall back to direct injection** (`runtime\u002Fscripts\u002Fpane-send.js --target \u003Cpane> --message \u003Cnudge>` into the teammate's own pane, where the brief is in a file and the nudge is one short line naming it: it refuses a pane that is not running a known agent CLI (`not_agent_pane`), waits until the agent is input-ready and not busy, and confirms the agent picked the nudge up; exit 1 means the message was refused, held, or not picked up, so re-send after the turn, never a raw `tmux send-keys`) carrying the same brief **including the task-id and a claim-first instruction** — the teammate claims the task before working, so a late-arriving task-store delivery of an already-claimed task is an idempotent no-op (no double-work). **Record the fallback** in the run's dispatch trace (which lane, pickup-verification failure, direct injection used). Never assume a `TaskCreate` reaching the task store means it reached the pane. *(Codification note: the 2026-06-14 run applied this fallback ad hoc; this clause makes it mandatory, bounded, and verified. In paired evals the OLD body is sample-ambiguous on this case — one A sample chose the fallback, another kept waiting — which is exactly why the clause pins it.)* *Evidence: reflection `run-2026-06-14T21-06-12-400Z` — `TaskCreate` reached only 2 of 4 teammates and `SendMessage`-by-name failed for the other 2, with no verification step to catch it before the run stalled (that run predates the runs-directory canonicalization — its run-id shape predates the current `run-\u003Cyyyymmdd-hhmmss>-\u003Cslug>` convention).*\n- **Honor the snapshot-resolved backend; team is primary under tmux (cmux surfaces are checked first, when present — see the cmux-first bullet above).** The backend comes from `snapshot.effective.agent_mode` (resolved at intake via the D5 ladder, ADR D5) — under `team`, when cmux is absent, that is `agent-team` (one **visible pane per specialist**); for no-tmux\u002Fno-cmux hosts supporting independent agents, `in-process` dispatch (launcher returns `dispatchPlan: GuildDispatchDescriptor[]`; execute-plan issues one `Agent()` per descriptor — full flow in `dispatch.md §\"In-process dispatchPlan consumption\"`); `subagent` is the last resort. Whatever the backend, dispatch each lane AS its **named specialist role**, resolved against the team specialist's definition identity. A **shipped** specialist dispatches by name. A **project-local** specialist must carry the same committed `definition_ref` through team, bundle, descriptor, and declaring transport; a non-declaring transport refuses before launch. The host-generic type is only used on the verified in-process carrier. Prompt prose or a bare absolute path is not definition injection, and must not be reported as such. The **§task§agent lifecycle and tiering are orthogonal to the backend choice**.\n- **Self-build uses the dev-team, not the product specialists.** When the target repo IS the Guild plugin itself, `team.yaml` is composed from the hash-bound dev-team definitions under `.guild\u002Fagents\u002F`, routed by changed path (full roster + path table in `dispatch.md`; see also `CLAUDE.md §\"Dev team\"`). Each lane carries the exact committed `definition_ref`; no bare host-native name is substituted. The 15 domain specialist roles build *user* products; they are NOT the self-build team.\n- **`agent-team` needs `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` — there is no separate dispatch-time approval gate.** The backend is simply the resolved snapshot value (`snapshot.effective.agent_mode`); the only operator prompt is the **per-run tmux-enablement preflight prompt** at intake (`runStartPreflight` → `needsTmuxPrompt`, which persists `agent_mode: team` on yes), not a blocker raised here at dispatch. At dispatch, the one hard gate is the env var: if the snapshot resolves `agent-team` and `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is absent, refuse and surface the blocker — never silently fall back to subagents (that would change execution semantics out from under the plan).\n\nParallelism follows the DAG, not authoring order; scheduling rules and worktree isolation live in `dispatch.md` — except the spine-lane verify checkpoint below, which this skill owns directly.\n\n**Backend capacity schedules waves — it never shrinks the team (`guild.team_schedule.v1`).** When the backend cannot run every approved participant concurrently, partition the approved set into dependency-valid execution **waves** (each approved `participant_id` in exactly one wave) and record the schedule bound to the `proposal_hash`\u002F`decision_hash`. The approved proposal's `proposed_schedule` is a non-binding preview (frozen §3), but a binding schedule whose **wave structure or concurrency departs from what the user approved is a §4 invalidating change** — surface it for renewed approval, never dispatch on the changed shape silently. Invariants are **set equality, not counts**: approved participant-id set = base-wave union = dispatch-receipt id set = terminal-outcome id set (removal only via a NEW proposal+decision cycle, cited by decision hash). Retries attach to the same `participant_id` as new attempts — never new participants; a failed or interrupted wave preserves all not-yet-terminal ids for resume — omission is NEVER removal. Resource exhaustion produces an explicit scheduling failure or a request for a user-approved backend\u002Fconcurrency change; it can never truncate, filter, or reorder the approved roster. Legacy `--team-size N` \u002F `defaults.team.size` are migration-window concurrency *hints* only (clamped to verified backend capacity, with a clamp diagnostic; `allow_larger` is a warned no-op) — none of them can touch the roster.\n\n## Spine-lane verify checkpoint (mandatory, overrides the inline-shortcut fast path)\n\nA **spine lane** is any lane that one or more *other* lanes list in their `depends-on:` — `architect` is the common case (`dispatch.md §\"Architect first when present\"`), but any lane with downstream dependents qualifies. When the plan declares a spine lane, insert a **mandatory verify checkpoint after the spine lane's receipt lands and BEFORE any dependent lane fans out** — even under `--auto-approve=all` \u002F `--rigor=deep --auto-approve=all`. `## Inline shortcut under high autonomy` above does **not** exempt a spine lane from this checkpoint: that section's own condition #3 (\"no cross-lane contract handoff\") already excludes it — a spine lane's dependents are, by definition, pulling a contract from its receipt.\n\nThis checkpoint is **NOT** a repeat of receipt-shape validation (which already runs for every lane) and **NOT** a substitute for G-lane review (which also runs). Its differential content is **dependent-contract verification** — the verify-the-claim discipline applied at the fan-out boundary:\n\n1. **Enumerate the consumed contract.** From the plan, collect what each dependent lane's brief actually pulls from the spine (files, interfaces, schema names, decisions its `scope` references).\n2. **Independently verify each consumed item** against the spine's receipt claims: the artifact exists on disk, and a spot-read confirms it matches what the receipt says it is (never trust the receipt's `evidence:` text alone — open the artifact). Field-presence checking is the ordinary receipt gate, not this one.\n3. **Ordering is fixed:** receipt-shape validation → `## Lane retry + dead-lettering` (if malformed\u002Fmissing) → G-lane review (per policy; always-on for self-build) → **this spine checkpoint** → fan-out. A **replacement receipt** produced by a retry or a G-lane rework **re-enters this checkpoint** before any dependent dispatches — a passed checkpoint never survives a receipt swap.\n4. On a failed verification, hold every dependent, route the spine lane back per step 3's chain, and record the failure. Record the checkpoint's pass\u002Ffail in the dispatch trace alongside the spine lane's tier\u002Fscore line.\n\nA corrupted spine poisons every downstream lane's provenance — the cost of this checkpoint is one lane's worth of verification against the alternative of re-running an entire fan-out.\n\n*Evidence: reflection `run-learn-knowledge-convergence-20260529-094021` — the same run this checkpoint and `## Hard-set gate deferral under high autonomy` both trace to.*\n\n## Adversarial review per lane — G-lane (broker, when policy fires)\n\nG-lane is the **only command-visible gate** (adversarial-review spec §Gate ownership): it fires per-lane here during `build`, so `build`'s skill set owns the review step. Wire the **review broker** at the lane-receipt boundary, **not** `guild:codex-review` directly: the broker is the host-agnostic front door, and `guild:codex-review` survives only as the internal Codex adapter the broker dispatches to (adversarial-review spec §The review broker).\n\nAfter each lane's receipt is confirmed and before the next lane dispatches (or before `guild:review` for the final lane), invoke `guild:review-broker`:\n\n```\nSkill: guild-review-broker\nargs: gate=G-lane:\u003Ctask-id> artifact_path=.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md run_id=\u003Crun-id> author_host=\u003Crun author host>\n```\n\nBecause the gate id is **per-lane** (`G-lane:\u003Ctask-id>`, matching the frozen `G-lane:${string}` union), the broker's AC-9 review trail for the lane lands in a **per-lane subdirectory** — `.guild\u002Fruns\u002F\u003Crun-id>\u002Freview\u002FG-lane:\u003Ctask-id>\u002F` (packet \u002F result \u002F trail). This is the declared trail path; `build.md`'s AC-9 root declaration MUST read identically (`review\u002FG-lane:\u003Ctask-id>\u002F`, not the lane-collapsed `review\u002FG-lane\u002F`) so the declared path equals the actual write path.\n\nSubstitute `\u003Ctask-id>` with the lane's task-id (e.g. `T2-backend`); run per-lane in series after the receipt is confirmed. The broker is **policy-gated** (adversarial-review spec §The review broker): it fires only when `risk ≥ high`, `review: cross` \u002F `--review=cross` is set, or project config requires it — otherwise it resolves `status: \"skipped\"` and the lane advances with no reviewer. Self-build runs treat cross-host review as always-on. `author_host` is the host that produced the receipt (resolved from the run-start preflight snapshot; `claude` on a Claude-hosted run). On `status: \"rework\"`, the lane re-executes — clear its receipt and re-dispatch the specialist with the findings as added context; the re-run counts against `counters.json` key `restart:\u003Clane>` (shared with the L3\u002FL4 cap). On `\"satisfied\"`, `\"skipped\"`, or `\"force_passed\"`, advance normally.\n\n## Receipt collection\n\nThis skill does not author receipts — it confirms each exists at `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md`, is readable, and carries the five §8.2 `## \u003Cname>` sections (`changed_files`, `opens_for`, `assumptions`, `evidence`, `followups`) plus exactly one fenced ```` ```guild.handoff.v2 ```` block — checked by the `check-handoff-receipts.js` gate, never by eye. Every dispatch path (launcher pane, in-process descriptor, or a direct `Agent()` fallback) carries the canonical handoff block from `dispatch.md §\"Handoff protocol\"` verbatim; a lane briefed without it writes a drifted receipt that this gate refuses. `guild:review` and `guild:verify-done` read these receipts instead of rehydrating full conversations (§8.2), so receipt integrity is load-bearing.\n\n**Single-channel invariant.** The receipt file is the **authoritative handoff source across all backends** (team \u002F in-process \u002F subagent). The lead never reads handoff content from chat text or SendMessage body — it reads the file. A missing or malformed receipt is an errored lane regardless of what the agent said in chat. Full protocol: `dispatch.md §\"Handoff protocol\"`.\n\n**Agent-bus event log (SK-5 — concept #4, the single-channel coordination substrate).** Beyond the per-lane receipt, the dispatch path emits **inter-lane lifecycle events** (lane dispatched, lane completed, lane errored\u002Fretried) to the canonical agent-bus event log `.guild\u002Fruns\u002F\u003Crun-id>\u002Fagent-bus\u002Fevents.ndjson` (the host-neutral channel for events \u002F approvals \u002F questions \u002F heartbeats; FDC-4, **critical**). This is a **PCR-Development must-exist artifact** (`build.md` output floor), so the dispatch path MUST produce it:\n\n- **Team backend:** the agent-team lifecycle hooks (`TaskCreated` \u002F `TaskCompleted` \u002F `TeammateIdle`, hook-engineer-owned) emit the bus events.\n- **Model-driven (subagent \u002F in-process `agent`):** there are no agent-team hooks, so **the orchestrator emits the bus event itself** at each lane boundary — append one event per lane-dispatched \u002F lane-completed transition. Use the tooling bus-emit helper (atomic temp-write + rename + the `.guild\u002F.lock` single-writer lock — concurrent lanes must not tear the log); never hand-append without the atomic-rename discipline.\n\nThe receipt remains the **truth** (single-channel handoff); the bus event log is the **event stream** a `resume`\u002Freplay reads to reconstruct lane timing without host memory — they compose, the bus never substitutes for the receipt. *(The bus-emit helper + the team-backend hook emission are tooling\u002Fhook-owned; this skill states the seam + the model-driven orchestrator's emit obligation so the must-exist artifact is actually produced.)*\n\n**Lean-lead intake (ADR §4\u002F§5).** The coordinator dispatches **by pointer** and **never absorbs full specialist transcripts** — it consumes only the compact `guild.handoff.v2` block each agent emits (canonical body at ADR §5, bound by pointer). The agent's terminal receipt is a durable `guild.handoff_receipt.v1` wrapper that **embeds** exactly one `guild.handoff.v2` block for review\u002Fverify — the v1 frontmatter is human-review context and the single embedded v2 block is the machine truth; the two compose (wrapper includes block), they do not compete. Schema detail is bound by pointer to `dispatch.md §\"Handoff protocol\"`, never re-spelled here. When `models.structuredOutputRequired` is `true`, a return that is not a valid `guild.handoff.v2` envelope (or over-runs the `summary` cap) is a dispatch defect: treat the lane as errored. Full transcripts remain in `.guild\u002Fruns\u002F` for audit; they never enter lead context. The lead holds last-N envelopes in full + a rolling summary of older work (`guild:context-assemble §\"Lead context\"` — bound by pointer).\n\n**Assumption aggregation.** Before the stop condition, aggregate every receipt's `assumptions:` list into `.guild\u002Fruns\u002F\u003Crun-id>\u002Fassumptions.md` (one section per specialist, verbatim). If no lane reported assumptions, still create the file empty (header only) so `guild:verify-done` can tell \"no assumptions\" from \"aggregation skipped\" — it is the single handoff verify-done reads for its check #5.\n\n## Reconcile the launcher-authored `guild.team_result.v1` (G6b-2b \u002F TaskCell AT12)\n\nThe production launcher writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-result\u002F\u003Cstation>.json`\nimmediately after a dispatch batch is committed. That launcher-authored\n`guild.team_result.v1` is the **single writer of runtime identity**: its lane\n`instance_id` values are copied from the exact TaskCell instances handed to the\nselected backend. After handoff collection, this skill enriches that persisted\nartifact; it does not create a second result.\n\n1. Read the persisted result with `readTeamResult` and fail closed if it is\n   missing or invalid. The launcher already knew the companion `team_plan_ref`;\n   do not reconstruct it from chat or a filename convention here.\n2. Join each result lane to the canonical\n   `.guild\u002Fruns\u002F\u003Crun-id>\u002Ftask-cells\u002F**\u002Fassignment.json` by `instance_id`. Require\n   **identity SET equality** between result lanes and valid assignments, and\n   require each lane `role` to equal the assignment's `worker_role`. A missing,\n   extra, duplicated, or role-mismatched identity is a dispatch-record defect and\n   blocks review.\n3. For each joined lane, update only `handoff_ref` and `acceptance_ref` with the\n   assignment's canonical TaskCell paths when those durable files exist. This\n   skill **MUST NOT mint, derive, replace, reorder, or drop `instance_id`**. It\n   also must not add `participant_id`: `guild.team_result.v1` is a closed schema;\n   participant set equality remains the separate authoritative schedule\u002Freceipt\n   close gate.\n4. Run the deterministic reconciler after handoff collection (and again after\n   acceptance so both pointer classes converge):\n\n   ```bash\n   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Ftask-cell-team-result.js \\\n     --cwd \u003Crepo-root> --run-id \u003Crun-id> --station \u003Cstation>\n   ```\n\n   A non-zero exit is a hard review blocker; do not hand-edit the result.\n5. The reconciler persists the enriched result through `writeTeamResult`, which re-validates it\n   fail closed. A write error is no longer described as harmless once the\n   launcher emitted TaskCells: stale or conflicting typed identity evidence is a\n   hard review blocker. Receipts remain the authoritative handoff content; the\n   typed result is the mandatory identity join.\n\nContract: `guild.team_result.v1` in\n`src\u002Fdomains\u002Fteams\u002Fstation-composer.ts`; read\u002Fwrite path in\n`station-signals.ts`; TaskCell canonical paths in\n`scripts\u002Flib\u002Fcore\u002Fcontracts\u002Ftask-cell-backend.ts`.\n\n## Inline shortcut under high autonomy (`--rigor=deep --auto-approve=all`)\n\nWhen the run posture is `--rigor=deep --auto-approve=all` AND the operator is\n**not** engaged for per-gate confirmation, the orchestrator MAY inline the\nper-lane chain (`guild:context-assemble → dispatch → guild:review`) instead\nof invoking each sub-skill formally. This shortcut emerged organically across\nthree self-build runs (`docs-clean-up`, `share-dot-guild`,\n`cross-platform-compatibility`) and is now codified — it is **not** a defect.\n\n### When inline IS valid\n\nAll three conditions must hold:\n\n1. **Posture allows it.** `--auto-approve=all` set on the run, OR\n   `defaults.auto_approve: all` in `.guild\u002Fsettings.json`. The autonomy\n   contract is genuinely high — no per-gate confirmation expected.\n2. **Lane corpus is small.** The lane's input fits the orchestrator's\n   working set without a structured bundle — see\n   `guild:context-assemble §\"Mandatory-invocation threshold\"` for the cap.\n   When the cap is crossed, formal `guild:context-assemble` is **mandatory**\n   regardless of posture.\n3. **No cross-lane contract handoff.** The lane has no upstream\n   `depends-on:` requiring a verbatim contract pull from a sibling lane's\n   handoff receipt. Cross-lane contracts demand a bundle for reproducibility.\n\n### When inline is FORBIDDEN\n\nAny of these conditions forces the formal sub-skill chain:\n\n- Operator is **engaged for per-gate confirmation** (`--auto-approve` unset\n  or value `risky-only`\u002F`destructive-only`). Each gate must surface for\n  approval — inlining bypasses the approval surface.\n- **Lane corpus exceeds the threshold** in\n  `guild:context-assemble §\"Mandatory-invocation threshold\"`.\n- **Upstream `depends-on:` contract** must be threaded into the lane\n  (`guild:context-assemble §\"Role mapping\" \u002F §\"Task-dependent layer\"`).\n- A **regression-prone area** — the lane touches an L1\u002FL2 loop, the\n  promotion gate, or another single-point-of-failure surface where the\n  bundle's `source_paths` are part of the audit trail.\n\n### Audit trail when inlining\n\nEven under the inline shortcut, the run record MUST capture equivalent\nevidence:\n\n- `.guild\u002Fruns\u002F\u003Crun-id>\u002Fdispatch-trace.md` — what lanes were dispatched,\n  at which tier, against which bundle equivalent (the orchestrator's\n  inlined working set, file-listed).\n- `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F\u003Cspecialist>-\u003Ctask-id>.md` — receipt\n  required as usual.\n- Reflection notes that inlining was used and **why** (which conditions\n  qualified). This is exactly how `run-b6337cbc` recorded the inlining;\n  the pattern is now the contract.\n\n### Why this clarification exists\n\nThree consecutive reflections named `guild:execute-plan` in\n`proposals.skill_improvement` (`run-2b531201`, `run-0c8ae3ca`,\n`run-b6337cbc-cross-platform`). Each one observed the orchestrator\nsatisfying the per-lane chain by inline action under\n`--auto-approve=all` rather than formal sub-skill dispatch. The pattern\nworked every time; the §11.1 ≥3-reflection trigger fired on what was\nactually an **under-specification** of valid orchestrator behavior, not a\ndefect.\n\n### Expiry (issue #57 — the shortcut is a budget, not a standing posture)\n\nThe forensic finding behind issue #57: a 39-hour self-build session used\nthis shortcut to justify doing **909 Bash \u002F 136 Edit \u002F 52 Write operations\nitself** across 8 un-re-anchored compactions, instead of dispatching lane\nwork by pointer — the orchestrator\u002Fteam-lead\u002Fexecutor separation\ncollapsed into one session. `## Mid-run scope expansion` below inherits\nthe same budget (absorbing an operator mandate inline does not reset it).\n\nThe inline shortcut is valid only up to a hard, codified budget. It\n**expires** — and the orchestrator MUST re-enter the formal sub-skill\nchain (`guild:context-assemble → dispatch → guild:review`, or\n`guild:resume` if picking a run back up) — on whichever of these happens\nfirst:\n\n1. **N direct lead Edit\u002FWrite operations.** `N` =\n   `.guild\u002Fsettings.json` `defaults.lean_lead.hands_on_edit_threshold`\n   (default **8**; `defaults.lean_lead.enabled: false` disables the guard\n   entirely), read tolerantly straight off `settings.json` the same way\n   `defaults.resume.enabled` is (`hooks\u002Flib\u002Frun-state.ts readResumeEnabled`).\n   **Known gap:** this key is not yet wired through `guild:config`'s\n   validate\u002Fset\u002Fresolve surfaces (`scripts\u002Flib\u002Fcore\u002Fconfig-cli.ts`,\n   `scripts\u002Fconfig-cmd.ts`, `src\u002Fdomains\u002Fconfig\u002Fsettings-reader.ts`)\n   — those files are outside this lane's scope — so `guild:config set` and\n   `guild:config validate` do not yet recognize it; only a direct hand-edit\n   of `settings.json` takes effect. Follow-up: register it as a proper\n   config-schema surface. Counted from the tool-call trace, not\n   self-reported — see enforcement below.\n2. **Any compaction boundary.** This is a DISJUNCTION with #1, not a\n   fresh N-edit allowance — `hooks\u002Fsession-reanchor.ts` (gap G1, oir-wi-00)\n   already re-injects the lean-lead contract (dispatch by pointer, don't\n   absorb lane work) into the fresh post-compaction context, so continuing\n   to edit inline past that point is ALREADY a fresh violation on its own,\n   independent of N. The first direct lead Edit\u002FWrite after a compaction\n   is the trigger, not the Nth.\n\n**Enforcement lives in code, not prose.** `hooks\u002Flean-lead-guard.ts` (a\nStop hook — it observes every turn end) is registered globally, so it ALSO\nfires inside every dispatched specialist's own pane\u002Fsubagent session, not\njust the lead's. It first checks THIS INVOCATION's own environment — a\n`GUILD_TASK_ID` or `GUILD_LANE_ID` set means the calling process IS a\ndispatched lane worker, not the lead, and the guard stays silent and never\ntouches the shared per-run fire-once state (a lane worker's own Stop hook\nmust never consume or perturb the ONE advisory meant for the lead). Once\nconfirmed to be the lead's own session, it counts direct lead Edit\u002FWrite\n`tool_call` trace events since the most recent `PreCompact` trace event\n(identified by the ABSENCE of `lane_id` — real production dispatch\nbackends thread `GUILD_TASK_ID` into a lane worker's own environment,\nwhich `post-tool-use.ts` stamps onto `lane_id`, so a lane worker's own\ntool calls always carry one), and cross-references the count against\n`run-state.json`'s open (`pending`\u002F`in_progress`) lanes. Crossing the\nthreshold — or, post-compaction, the FIRST such edit at all — while lanes\nare open surfaces a loud advisory (`hookSpecificOutput.additionalContext`)\nnaming the count, the threshold, and the open-lane count, and pointing\nback at `guild:execute-plan` \u002F `guild:resume`. It never denies a tool call\nand never forces a specific corrective action — a solo one-off task or a\nrun with no dispatched lanes has nothing this guard needs to protect —\nsee `hooks\u002Flib\u002Flean-lead-guard.ts` header for the full zero-noise gating\n(disabled, overridden, no open lanes, under threshold, already fired this\ncycle) and for the honest caveat that Stop's `additionalContext` does\nstill cost the lead one more turn to read it, unlike a bare stderr log.\nAn operator who wants this specific\ncrossing dismissed sets `GUILD_LEAN_LEAD_OVERRIDE=1` for the session.\n\n## Hard-set gate deferral under high autonomy (sibling to the inline shortcut above)\n\nSibling clause to `## Inline shortcut under high autonomy` above — that section governs when the *sub-skill chain* can be inlined; this one governs what happens when a lane, inlined or not, **hits an always-ask \u002F hard-set gate** while running under high autonomy (`--auto-approve=all` \u002F `defaults.auto_approve: all`).\n\n**Do not stop the whole lane on a hard-set gate.** An always-ask gate (a destructive action, a credential, a policy the operator must personally confirm — anything the autonomy contract marks as never-auto-approved) still cannot be silently skipped, but the lane around it does not have to halt either:\n\n1. **Split the work.** Partition the lane's remaining scope into the part that is safely completable without the gated action, and the part that requires it.\n2. **Apply the safe part.** Execute (and, on completion, let the lead commit per the usual commit discipline) everything that does not depend on the gated action.\n3. **Emit a complete contract artifact for the gated part** at the deterministic run-local path `.guild\u002Fruns\u002F\u003Crun-id>\u002Fdeferrals\u002F\u003Ctask-id>-\u003Cgate-slug>.md` (`guild.deferral_contract.v1`): for a **file gate**, the exact file and the literal proposed content\u002Fdiff (not a description); for a **non-file gate** (credential, network egress, spend, destructive op), the exact action and parameters the operator would execute; plus **why it's gated** (which autonomy-policy rule fired). Complete enough to apply in **one pass**.\n4. **Record the deferral with an explicit disposition.** In the lane's receipt `followups:`, the deferral entry is marked **`blocking: true` whenever the gated half is spec- or plan-required** — `guild:review` and `guild:verify-done` MUST then treat it as a blocker (never \"merely deferred\"); only genuinely optional work may carry a non-blocking disposition. A lane receipt is not \"complete\" by omitting required work into a deferral — the deferral defers *approval*, not *accountability*.\n5. **The artifact is a proposal, never an authorization.** Neither the lane, the lead, nor any later consumer applies the deferred action without a **fresh operator confirmation** — auto-applying a deferral artifact is a hard-gate bypass, exactly what this clause exists to prevent.\n\nThis keeps a high-autonomy run moving on everything it's actually allowed to do, instead of stalling the entire lane — and everything downstream of it — on one gated sub-task.\n\n*Evidence: reflection `run-learn-knowledge-convergence-20260529-094021` — three-run provenance: the run itself plus its `A2` and `F1` lanes, all landing this split-and-defer pattern with zero rework once the operator applied the deferred artifact.*\n\n## Mid-run scope expansion (operator-mandate absorption)\n\nTwo consecutive self-build initiatives (`docs-clean-up`, `share-dot-guild`)\nlanded a new operator mandate **mid-run** — at a soft gate (CQ answer\nbroader than the option set), at the SC-7 risk gate (Decision M added\nafter audit), or even **post-commit** (the \"one `.guild\u002F` per repo root\"\npolicy that emerged after SC-10). In both cases the run absorbed the\nexpansion cleanly without restarting the lifecycle. This section codifies\nthe absorption pattern so future orchestrators recognize and execute it\ndeterministically.\n\nAbsorbing an expansion **inline** (step 3 below) still draws against the\nsame inline-shortcut budget as `## Inline shortcut under high autonomy →\n### Expiry` — a broadened mandate is not a reset. If the budget has\nalready expired (or expires mid-absorption), formalize the remaining\nabsorption work as dispatched lanes rather than continuing to patch it in\ndirectly.\n\n### Detection signals\n\nA mid-run scope expansion is in play when **all** of these hold:\n\n- The mandate arrives in operator chat *between* gates (not in the\n  original spec\u002Fplan).\n- It is broader than the surfaced option set for the active gate (e.g.\n  operator answers a 2-option question with a 3rd option that's a policy\n  extension).\n- It does not invalidate the work already completed — it extends or\n  re-scopes ongoing\u002Fupcoming lanes.\n\nIf the mandate **invalidates** completed work (e.g. \"redo the previous\nlane with X\"), this is **not** scope expansion — it's a re-dispatch\nrequest; halt and surface to the operator before proceeding.\n\n### Absorption protocol (5 steps, in order)\n\n1. **Lock the new decision.** Append a new decision row to the active\n   initiative's `decisions.md` with a freshly-allocated ID\n   (e.g. `D-SHR-5` after `D-SHR-1..4`) and verbatim quote the operator's\n   mandate. Cite the gate \u002F chat point where it landed. Decisions are\n   immutable once locked — do not edit prior ones, only add.\n\n2. **Update the controlling ADR.** Author a new `## Decision \u003CLetter>`\n   section in the relevant ADR with the policy in full (rationale +\n   enforcement mechanism + scope). Maintain the cross-reference between\n   the initiative-scoped decision ID (D-SHR-5) and the ADR-scoped letter\n   (Decision M).\n\n3. **Apply inline to in-flight work.** Identify which lanes are\n   affected; for each, decide:\n   - **Already-complete lane** → audit its output against the new rule;\n     if it conforms, no rework; if not, apply a surgical patch (do not\n     re-dispatch the lane unless the operator requests).\n   - **In-flight lane** → inject the new rule into the lane's autonomy\n     policy (the next handoff receipt must show compliance).\n   - **Not-yet-dispatched lane** → update the lane's scope in the plan\n     before its Wave dispatches.\n   - **Team-decision invalidation check (frozen §4).** If an absorption edit\n     changes a participant's scope-defining obligations, dependencies,\n     tier\u002Fpurpose, capability scope, backend, wave structure, concurrency, cost\n     posture, or review independence, the prior `guild.team_decision.v1` is\n     invalidated for the affected participants: hold their not-yet-dispatched\n     lanes, surface a restructured proposal (new version), and obtain a fresh\n     approve before those lanes dispatch. Purely additive guidance that changes\n     none of the above absorbs without re-approval.\n\n4. **Log to activity.jsonl.** Append a `policy_clarification` event\n   (mirror the existing event types in `share-dot-guild`'s log):\n   ```json\n   {\"ts\":\"…\",\"event\":\"policy_clarification\",\"id\":\"\u003Cinitiative>\",\n    \"trigger\":\"operator\",\"clarification\":\"\u003Cverbatim>\",\n    \"absorption\":[...what was patched...],\"verified\":\"\u003Chow>\"}\n   ```\n   This makes the expansion auditable in `\u002Fguild:stats` and surfaces\n   in the reflection.\n\n5. **Carry forward in verify.md.** The verify-done writeup\n   (`.guild\u002Fruns\u002F\u003Crun-id>\u002Fverify.md`) must include the mid-run mandate\n   in its \"Assumptions reviewed\" or a dedicated \"Mid-run policy\n   expansions\" section, so the closeout reflects the actual rule set\n   the run shipped — not just the original plan.\n\n### What absorption is NOT\n\n- **Not** a re-spec. The original spec stays as-is; the new decision\n  *extends* it, doesn't supersede it.\n- **Not** silent. Every step above leaves an artifact (decision row,\n  ADR section, activity entry, verify.md note). An orchestrator that\n  \"just applied the patch\" without these is producing un-auditable runs.\n- **Not** an excuse to skip gates. If the new mandate changes what\n  the *next* gate should ask, update the gate questions; never proceed\n  past a gate that hasn't yet seen the new rule.\n\n### Why this is in `execute-plan` and not `guild:plan`\n\n`guild:plan` writes the original lane plan at planning time, before\noperator-mandate-at-gate is possible. `execute-plan` is the orchestrator\nthat actually sees the mandate land mid-run; the absorption protocol\nmust live where the orchestrator can reach it. If a mandate lands\n*before* the first lane dispatches, prefer re-running `guild:plan` with\nthe new constraint — absorption is for after Wave 1 has begun.\n\n## Lane liveness sweep (backend-agnostic watchdog)\n\nWhile lanes are in flight — parallel waves, or any wait on a lane's receipt — sweep liveness **each poll cycle** with the deterministic report tool; never eyeball heartbeat files or infer a stall from chat silence:\n\n```bash\nnode ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fcheck-lane-liveness.js --run-dir \u003Cabs path to .guild\u002Fruns\u002F\u003Crun-id>>\n```\n\nIt reads `run-state.json` (lenient — receipts-only when absent), the structured `in-progress\u002F*.json` heartbeats, and `handoffs\u002F*.md` receipts, and prints a per-lane report `{ lane, status, receipt_present, heartbeat_age_ms, stalled }` (stall threshold `GUILD_HEARTBEAT_TIMEOUT_MS`, default 600000; exit 0 always — it is a report, not a gate). This is the Rung-2\u002F3 (subagent \u002F in-process `agent`) watchdog complement to the team backend's pane-alive + `TeammateIdle` checks — same heartbeat records, one sweep across backends. On `stalled: true` for a lane:\n\n1. **Nudge once.** Re-prompt the lane's agent (or its pane) referencing its last heartbeat `step`, and record the nudge in the dispatch trace.\n2. **Still stalled on the next sweep** → treat the lane as FAILED and route it into `## Lane retry + dead-lettering` (retry up to `defaults.retry.max_attempts`, then the `mark-lane-dead.ts` funnel). Never leave a stalled lane spinning silently past two consecutive stalled sweeps.\n\n## Lane retry + dead-lettering (R-016)\n\nImplements the per-lane resilience contract (v2 runtime and execution model ADR §retry\u002F§resume). Read the policy from the run's **resolved settings** (`readResolvedSettingsSnapshot` \u002F `read-guild-config.ts` — never hard-code): `defaults.retry.max_attempts` (int ≥ 1, default **1** = no retry), `defaults.retry.backoff` (`immediate | linear | exponential`, default `exponential`), `defaults.resume.enabled` (bool, default **true**).\n\nA lane is **FAILED** when its receipt is missing\u002Fmalformed (step 4) or the agent returns an error status. On failure:\n\n1. **Retry up to `max_attempts`.** Re-issue the lane's `Agent()` — a **fresh** ephemeral agent, same bundle + resolved tier — up to `defaults.retry.max_attempts` **total** attempts (attempt 1 + retries). Between attempts, pace per `defaults.retry.backoff` and fold **backoff guidance** into the retry brief (e.g. `prior attempt \u003Cn> failed: \u003Clast-error>; address it before proceeding`). With the default `max_attempts: 1` this is a **no-op** — one attempt, no retry — so default behavior is unchanged (transparent).\n2. **A passing receipt before exhaustion** → the lane is clean; continue normally and record the retry count in the dispatch trace.\n3. **On exhaustion** (all `max_attempts` attempts FAILED), mark the lane **dead via the bridge CLI** so the in-process \u002F subagent path writes the **same checkpoint the SSH path does** — the single writer is hooks' `markLaneDead`:\n\n   ```\n   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fmark-lane-dead.js \u003CrunDir> \u003ClaneId> \\\n     --attempts N [--last-error \"...\"] [--run-id \u003Crun-id>] \\\n     [--plan-slug \u003Cslug>] [--wave-index \u003Cn>] [--cwd \u003Crepo-root>]\n   ```\n\n   `\u003CrunDir>` = `.guild\u002Fruns\u002F\u003Crun-id>\u002F`; `\u003ClaneId>` = the lane's `task-id`; `--attempts N` = total attempts made; `${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}` = the plugin install root (the dir containing `scripts\u002F`). This funnels to `markLaneDead` (`hooks\u002Flib\u002Frun-state.ts`) → run-state `dead` + `resume.json` (the CLI writes the resume checkpoint **only when `defaults.resume.enabled` is true** — it reads that key tolerantly itself), so a later `\u002Fguild:resume` re-enters the dead lane from its checkpoint. **Do not write run-state directly** — the CLI is the only sanctioned funnel (parity with the SSH `runWithRetry` `onExhausted` path; both converge on `markLaneDead` for identical run-state + resume semantics).\n\nA dead lane is **not** a clean receipt — see `## Stop condition`.\n\n## Resuming dead lanes (R-016)\n\nThe READ\u002Fre-enter half of dead-lettering (the WRITE half is `## Lane retry + dead-lettering`). When `\u002Fguild:resume` continues a run, **before** it locates the next pending gate it re-enters any checkpointed dead lane so a transient failure doesn't strand the run. (`\u002Fguild:resume`'s command `## Dispatch` invokes this section before gate location.)\n\n1. **List resumable dead lanes** via the read-side bridge CLI (the mirror of `mark-lane-dead.ts`) — the `--json` flag is **required** for parseable output (without it the CLI prints a human table):\n   ```\n   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fresume-lanes.js \u003CrunDir> --json\n   ```\n   It scans `\u003CrunDir>\u002Flanes\u002F*\u002Fresume.json`, applies the **`guild.lane_resume.v1`** schema-version guard (skips foreign\u002Folder versions), honors `defaults.resume.enabled`, joins each lane's `tier` from run-state, sorts by `lane_id`, and writes a **bare JSON array** (one object per resumable dead lane) to stdout:\n   ```json\n   [{ \"lane_id\": \"...\", \"run_id\": \"...\", \"attempts\": N, \"last_attempt_at\": \"...\", \"last_error\": \"...\", \"resumable_at\": \"...\", \"tier\": \"mid\" }, …]\n   ```\n   **Consume the array directly — it is NOT wrapped in an object.** It is already version-guarded + `resume.enabled`-filtered + `lane_id`-sorted CLI-side. `tier` is present when run-state carried it (absent otherwise — default skill-side); `bundle_path` is **not** in the output — recover it skill-side (step 2). **An empty array `[]` ⇒ no resumable lanes ⇒ exactly today's resume behavior** (proceed straight to the next gate). `\u003CrunDir>` = `.guild\u002Fruns\u002F\u003Crun-id>\u002F`; an optional `--cwd \u003Crepo-root>` overrides the repo root for the `resume.enabled` read; `${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}` = the plugin install root.\n2. **Re-enter each resumable dead lane** through the normal dispatch path: spawn a **fresh** ephemeral `Agent()` against the lane's bundle, folding `last_error` in as backoff guidance. Use the entry's `tier` when present (else recover from run-state `lanes[\u003Clane_id>].tier`, `hooks\u002Flib\u002Frun-state.ts`); **recover\u002Frebuild `bundle_path`** skill-side (the lane's `.guild\u002Fcontext\u002F\u003Crun-id>\u002F\u003Cspecialist>-\u003Ctask-id>.md`, or rebuild via `guild:context-assemble` if the bundle file is gone). This **resets the lane from `dead` back into `## Lane retry + dead-lettering`** — operator-initiated resume grants a **fresh retry budget** (`defaults.retry.max_attempts` again); the prior `attempts` count is preserved in the checkpoint for audit but does **not** subtract from the resumed budget (otherwise a lane already at `max_attempts` would re-dead immediately). Re-entry follows the same `## Per-lane flow` (bundle → tier → dispatch → receipt) as a first dispatch; a lane that re-fails past `max_attempts` on the resumed run is re-marked dead via the same `mark-lane-dead.ts` funnel.\n3. **Then continue** to the next pending gate as today.\n\nGated + graceful: the whole step is a no-op when `resume-lanes.ts` emits an empty list (no checkpoints written, or `defaults.resume.enabled: false`). This closes the R-016 write↔read symmetry — `## Lane retry + dead-lettering` WRITES dead-lane checkpoints; this section READS + re-enters them.\n\n### Close requires review + verify-done (issue #59 — resuming is not a shortcut past the gates)\n\nThe forensic finding behind issue #59: a 39-hour session entered the\nlifecycle (initiative → team-compose → build → execute-plan) and abandoned\nit **38 seconds after its first compaction**. 91.9% of the session's Bash,\n77% of its Edit\u002FWrite and 94% of its Agent dispatches happened AFTER the\nlast lifecycle skill fired, and `guild:review`, `guild:verify-done`,\n`guild:qa`, `guild:reflect` and `guild:resume` were never invoked at all\nacross 8 compactions — a production-infra build closed with no review gate\nand no verify gate.\n\nSo: **a build run MUST pass `guild:review` and then `guild:verify-done`\nbefore it may close** — whether it ran straight through or was picked back\nup here. Resuming re-enters dead lanes (steps 1–3 above) and then continues\nto *the next pending gate*, which for a `build`-phase run is `review`, then\n`verify-done`; it does not skip whatever the interrupted run had not yet\npassed. **Receipts are not close.** `## Stop condition` below is the handoff\nINTO `guild:review`, never a substitute for it, and `guild:verify-done` is\nthe only thing that writes `.guild\u002Fruns\u002F\u003Crun-id>\u002Fverify.md`. A run whose\nrecords show build activity (dispatched lanes, collected receipts) but no\n`review.md` \u002F `verify.md` has not closed — it has been abandoned.\n\n**Enforcement lives in code, not prose.** Two surfaces, both in\n`hooks\u002Flib\u002Flifecycle-gate.ts`, reading the real v1.4 trace + run state\nrather than any self-report:\n\n1. **The active UserPromptSubmit gate** (`hooks\u002Flifecycle-gate.ts`, invoked\n   from `hooks\u002Fcheck-skill-coverage.sh` — the advisory nudge this issue\n   upgraded). While the run is genuinely ACTIVE — the `reanchor.ts\n   isRunActive` activity window, NOT `status: open`, because the Stop hook\n   closes the run at the end of every assistant turn — and past build-start\n   (persisted phase, or a lane recorded in `run-state.json`), it counts the\n   LEAD's own `Bash`\u002F`Edit`\u002F`Write` `tool_call` events since the last time\n   anything was routed through the lifecycle. A \"lifecycle touch\" is a\n   lead-own, non-errored `Skill` call whose **parsed** skill name is a\n   lifecycle skill — parsed out of the tool input, never string-matched, so a\n   passing mention of `guild:review` in some other call's arguments cannot\n   forge one. Lane-attributed events are the worker's, not the lead's.\n   Crossing `.guild\u002Fsettings.json`\n   `defaults.lifecycle_gate.adhoc_activity_threshold` (default **20**)\n   **blocks the prompt**, and the same body is delivered to the model as\n   `additionalContext` on the next accepted prompt — a block is shown to the\n   *operator*, so without that hand-off the drifting model would never see\n   the correction. Two tiers, because Bash mutates too (`sed -i`, `git\n   apply`, `>` redirects, deploys): the threshold applies when at least one\n   Edit\u002FWrite happened, and **3×** the threshold when the stretch is\n   shell-only, so read-only exploration stays silent while shell-driven\n   mutation is not a free pass. The drift must also be CURRENT (default 30\n   min) — an abandoned run's historical count never blocks a fresh prompt.\n2. **The close-time Stop backstop.** When the run has actually reached\n   `## Stop condition` — **every** lane `done` (a `failed`\u002F`dead`\u002F`skipped`\n   lane means dead-lettering, not review, so the gate stays silent there), each\n   lane bound to its own distinct, non-empty `handoffs\u002F*.md` receipt through\n   the checkpoint's `receipt_ref` — but `review.md` and\u002For `verify.md` is\n   missing, empty, or not a real file, it emits a Stop `block` naming exactly\n   which artifact is absent, giving the lead a turn to run the gate that\n   produces it. It re-arms only when the missing SET changes (review.md\n   landed, verify.md still absent — including on the hook-continued turn, which\n   is exactly when the lead runs that gate), clears its latch once nothing is\n   missing so a later regression is still caught, and is hard-capped at a few\n   fires per run so it can never become a Stop loop.\n   **What it detects is a missing or blank artifact — not a failing one.** It\n   never parses a verdict, so a `verify.md` recording `fail` satisfies it just\n   as a passing one would; reading verdicts is `guild:verify-done`'s own job.\n   The rule above is the CONTRACT; this hook is a backstop against the case\n   that actually happened — the gates never running at all.\n\nBoth are edge-triggered on CHANGE, not level — the prompt gate once per\nthreshold crossing, the close gate once per missing-artifact set (under a hard\nper-run fire cap) — so neither can dead-end a session: re-sending the prompt\nproceeds, and the close gate deliberately evaluates on hook-continued turns\nrather than short-circuiting on `stop_hook_active`, because that is precisely\nthe turn in which the lead runs the gate it was told about. An operator who wants one\ncrossing dismissed adds `[guild:gate-override]` to the prompt — which\n**consumes** that crossing (so the next prompt is not blocked on the identical\nunchanged one) and drops any undelivered correction rather than letting it\nresurface later out of context. `GUILD_LIFECYCLE_GATE_OVERRIDE=1` dismisses for\nthe session, and `defaults.lifecycle_gate.enabled: false` disables the gate\noutright.\n\nBoth gates treat the trace, `run-state.json` and their own sentinels as\nUNTRUSTED workspace state: the trace is read through the canonical v1.4\n`validateEvent` schema validator, `run-state.json` is structurally validated,\ncounting order never depends on a workspace-supplied timestamp, and no free\ntext is ever persisted and replayed into model-visible context.\n\n**Known gaps, stated honestly.** (a) Same as `defaults.lean_lead.*`, these\nkeys are not yet wired through `guild:config`'s validate\u002Fset\u002Fresolve\nsurfaces, so only a direct hand-edit of `settings.json` takes effect today.\n(b) UserPromptSubmit fires between turns, so a single agentic turn can run\nhundreds of ad-hoc calls before the gate next evaluates; the gate bounds\ndrift at turn boundaries and the Stop backstop covers close, but per-tool\ninterception belongs on `PreToolUse` and is tracked separately.\n\n## Stop condition\n\nExecution is complete when every lane has a non-error receipt under `handoffs\u002F`:\n\n- **participant-id SET EQUALITY, not a count**: the approved proposal's participant-id set = the dispatch-receipt id set = the terminal-outcome id set (`guild.team_schedule.v1` invariant; the only omission allowed is `explicitly_removed_by_new_decision`, citing the new decision hash) — a matching count with a swapped or missing id is NOT complete;\n- every receipt has a populated `evidence:` field (§8.2 — never \"looks good\");\n- no receipt is blocked\u002Ferrored without a matching error record in the run log.\n\nIf a lane FAILED, it first goes through `## Lane retry + dead-lettering`; a lane still failing after `defaults.retry.max_attempts` is marked **dead** (checkpointed for `\u002Fguild:resume`). Halt and surface any dead lane(s) to the user — name each dead lane, its attempt count, and that `\u002Fguild:resume` will re-enter it from its checkpoint — rather than forwarding to `guild:review` (review cannot compensate for a missing receipt). If every lane is clean, hand off to `guild:review`.\n\n## Handoff\n\nOnce the stop condition is met, hand off to `guild:review` with:\n\n- `run_id` — the run directory name.\n- `handoffs_dir` — absolute path to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fhandoffs\u002F`.\n- `plan_path` — the approved plan (`.guild\u002Fplan\u002F\u003Cslug>.md`).\n- `lane_count` — number of receipts collected.\n- `backend` — the backend used (`subagent` or `agent-team`), read from the run's resolved-settings snapshot (`snapshot.effective.agent_mode`), not from `team.yaml`.\n- `tier_trace` — per-lane `{task-id, complexity_score, tier, model}` as dispatched (the surfaced scores).\n- `escalations` — count of advisor consults across the run + any `inconclusive: advisor budget exhausted` lanes.\n- `team_result_path` — the companion `guild.team_result.v1` emitted at `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-result\u002F\u003Cstation>.json` (or the fail-soft skip note), the typed mirror of the dispatched instances against the composed team_plan.\n\n`guild:review` runs its 2-stage per-task review (spec-conformance then quality) against the receipts in `handoffs_dir`. Do not run review yourself — it is a separate skill with its own responsibilities.\n\n## Chapters\n\nThree-stage disclosure (KTD25): this file is the assembler. Each row below is an\nL3 chapter that stays on disk until a request matches it. Compose by pointer —\nread the one chapter you were routed to, and never inline a chapter here.\n\n| Chapter | Covers |\n|---|---|\n| `references\u002Fcontext-assemble.md` | Assembles per-specialist 3-layer context bundle: Universal (~400 tokens — guild:principles + project-overview + goals) + Role-dependent (~800–1500 — standards + 2–4 entity pages matching role) + Task-dependent (~800–1500 — lane from plan + named refs + upstream contracts + active decisions) |\n| `references\u002Fcounters-and-concurrency.md` | reference material for this assembler |\n| `references\u002Fdispatching-parallel-agents.md` | The discipline for dispatching independent specialist lanes in parallel — respect depends-on edges, isolate context, collect handoff receipts, and never parallelize work with ordering or shared-state hazards |\n| `references\u002Ffinish-branch.md` | Guild's branch-completion discipline — once work is done and tests pass, present clear integration options (merge, PR, keep, discard) and execute the chosen one safely, then clean up the worktree |\n| `references\u002Fio-contract.md` | reference material for this assembler |\n| `references\u002Floop-implement.md` | F-3 implementation-phase adversarial-loop dispatcher — wraps `guild:execute-plan` per lane |\n| `references\u002Floops-applicable-enum.md` | reference material for this assembler |\n| `references\u002Fsecurity-review-restart.md` | reference material for this assembler |\n| `references\u002Ftdd.md` | Guild's first-class test-first discipline — write the failing test, watch it fail, then write the minimal code that passes |\n| `references\u002Ftesting-anti-patterns.md` | reference material for this assembler |\n| `references\u002Fworkflow-and-events.md` | reference material for this assembler |\n| `references\u002Fworktrees.md` | Guild's git-worktree isolation discipline — create an isolated worktree with deterministic directory selection and safety verification so a lane runs on a clean tree without disturbing the user's current checkout |\n\n## Chapter pointers (resolve before you dispatch)\n\nThese names appear in the body as if they were skills. They are NOT — the\nT03 fold (KTD25\u002FKTD59) made each one an L3 chapter. Read `guild:\u003Cname>` below\nas \"load this file and run it in place\"; never try to dispatch it as a skill.\n\n| Named in this body | Lives under | Load |\n|---|---|---|\n| `guild:codex-review` | `review` | `..\u002Freview\u002Freferences\u002Fcodex-review.md` |\n| `guild:context-assemble` | this assembler | `references\u002Fcontext-assemble.md` |\n| `guild:decisions` | `wiki` | `..\u002F..\u002Fknowledge\u002Fwiki\u002Freferences\u002Fdecisions.md` |\n| `guild:review-broker` | `review` | `..\u002Freview\u002Freferences\u002Freview-broker.md` |\n| `guild:verify-done` | `quality` | `..\u002F..\u002Fquality\u002Freferences\u002Fverify-done.md` |\n| `guild:wiki-ingest` | `wiki` | `..\u002F..\u002Fknowledge\u002Fwiki\u002Freferences\u002Fwiki-ingest.md` |\n",{},"main","2e58b0360ca51ca3c96ca8e015ef5aba5738803d","skills\u002Fmeta\u002Fexecute-plan",0,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild","https:\u002F\u002Fgithub.com\u002Flookatitude","https:\u002F\u002Flookatitude.com","2026-11-06 03:55:18",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add lookatitude\u002Fguild --skill execute-plan",{"tool":37,"command":38},"bunx","bunx skills add lookatitude\u002Fguild --skill execute-plan",{"tool":40,"command":41},"pnpm","pnpm dlx skills add lookatitude\u002Fguild --skill execute-plan","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002FSKILL.md",true,[45,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"dispatch.md","REFERENCE","参考文档",49924,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Fdispatch.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"evals.json",1004,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Fevals.json",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fcontext-assemble.evals.json",571,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fcontext-assemble.evals.json",{"path":60,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fcontext-assemble.md",32354,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fcontext-assemble.md",{"path":64,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fcounters-and-concurrency.md",2094,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fcounters-and-concurrency.md",{"path":68,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fdispatching-parallel-agents.evals.json",669,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fdispatching-parallel-agents.evals.json",{"path":72,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fdispatching-parallel-agents.md",5263,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fdispatching-parallel-agents.md",{"path":76,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Ffinish-branch.evals.json",564,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Ffinish-branch.evals.json",{"path":80,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Ffinish-branch.md",4305,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Ffinish-branch.md",{"path":84,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002Fio-contract.md",1990,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fio-contract.md",{"path":88,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002Floop-implement.evals.json",596,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Floop-implement.evals.json",{"path":92,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Floop-implement.md",8572,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Floop-implement.md",{"path":96,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":97,"sourceHtmlUrl":98},"references\u002Floops-applicable-enum.md",2820,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Floops-applicable-enum.md",{"path":100,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":101,"sourceHtmlUrl":102},"references\u002Fscenarios.json",6748,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fscenarios.json",{"path":104,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":105,"sourceHtmlUrl":106},"references\u002Fsecurity-review-restart.md",5374,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fsecurity-review-restart.md",{"path":108,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":109,"sourceHtmlUrl":110},"references\u002Ftdd.evals.json",867,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Ftdd.evals.json",{"path":112,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":113,"sourceHtmlUrl":114},"references\u002Ftdd.md",6986,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Ftdd.md",{"path":116,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":117,"sourceHtmlUrl":118},"references\u002Ftesting-anti-patterns.md",4948,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Ftesting-anti-patterns.md",{"path":120,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":121,"sourceHtmlUrl":122},"references\u002Fworkflow-and-events.md",5001,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fworkflow-and-events.md",{"path":124,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":125,"sourceHtmlUrl":126},"references\u002Fworktrees.evals.json",594,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fworktrees.evals.json",{"path":128,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":129,"sourceHtmlUrl":130},"references\u002Fworktrees.md",4536,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Freferences\u002Fworktrees.md",{"path":132,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":133,"sourceHtmlUrl":134},"scenarios.json",8017,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fexecute-plan\u002Fscenarios.json",[136,142,148,154,160,166],{"skillNo":137,"name":138,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":18},"01M73RXDTR96SBKTEEE35JMWS7","technical-writer-tutorial","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Ftechnical-writer-tutorial\u002FSKILL.md",[],[],{"skillNo":143,"name":144,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":18},"01M73RX9FY2GNEZT1S2SJZH307","social-media-thread","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fsocial-media-thread\u002FSKILL.md",[],[],{"skillNo":149,"name":150,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":18},"01M73RWY3CNA6HP52QC65XTZ5A","security-dependency-audit","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fsecurity-dependency-audit\u002FSKILL.md",[],[],{"skillNo":155,"name":156,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":18},"01M73RWBSKQXZ13SVRGS5K1K72","marketing-launch-plan","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fmarketing-launch-plan\u002FSKILL.md",[],[],{"skillNo":161,"name":162,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"publishedAt":18},"01M73RW8DJAG381R94DN6KSTEG","marketing-ab-copy-variants","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fmarketing-ab-copy-variants\u002FSKILL.md",[],[],{"skillNo":167,"name":168,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":18},"01M73RW44HRQJTJ33V12SVS612","frontend-bundler-config","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Ffrontend-bundler-config\u002FSKILL.md",[],[]]