[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73RT1W12C6P35J81B02DR5V":3,"skill-same:01M73RT1W12C6P35J81B02DR5V":55},{"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},"01M73RT1W12C6P35J81B02DR5V","team-compose",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\u002Fteam-compose\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: guild-team-compose\ndescription: Match spec domains against the consuming repo's project specialists (`.guild\u002Fagents\u002F*.md`, reused never re-created) AND Guild's shipped specialist TYPE templates (minted into `.guild\u002Fagents\u002F` via roster-resolve mint); present existing + gaps with A\u002FB\u002FC\u002FD options, propose the FULL justified logical team — task-derived, UNCAPPED, with necessity rationale + excluded roles (`guild.team_proposal.v2`) — then WAIT at the `guild.team_decision.v1` user gate (approve \u002F restructure: add, remove, substitute, edit dependencies) before any dispatch, assign each specialist a `default_tier` from its frontmatter, derive `capability_scope:` (runtime-materialized for canonical roles), and write the per-phase `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml`. TRIGGER on \"propose a team\", \"who should work on this\", \"compose specialists for the spec\", \"compose this phase's team\". DO NOT TRIGGER for: writing the code (execute-plan), creating a new specialist TYPE for Guild itself (guild:create-specialist), reviewing completed work (guild:review).\nwhen_to_use: Second step of the `\u002Fguild` lifecycle, after `guild:brainstorm` has produced `.guild\u002Fspec\u002F\u003Cslug>.md`. Also fires when the user asks to reshape an existing team (e.g. \"rework the team for this task\", \"swap the qa slot for security\").\ntype: meta\nindexed: true\n---\n\n# guild:team-compose\n\nImplements team composition **and the phase-aware composition loop** (G-PHASE-COMPOSE) from the canonical-specialist-roster ADR's sibling `dynamic-team-composition.md`. Composition is **re-evaluated at each phase boundary**, not once per slug: each phase writes its own `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml`. Output is a resolved per-phase team file downstream planning and execution consume verbatim (resolved via `resolveTeamFile`).\n\n## Phase-aware composition (per phase)\n\n`team-compose` runs a **phase-composition pass** at each phase boundary (`init → ideate → plan → build → qa → ops`). It is no longer a one-shot artifact — the team for `ideate` ≠ the team for `build` ≠ the team for `ops`.\n\n**The loop** (ADR §1, made operational):\n\n```\nphase_P   := readActivePhase(cwd)              # T1: scripts\u002Flib\u002Fteam-file.ts — run-state authority, NEVER inferred from chat\ntopic_P   := the phase's working topic         # spec domains for ideate\u002Fplan; plan lanes for build;\n                                               #   CodebaseMap+plan signals for qa; runbook class for ops\nneeded_P  := analyse(topic_P)                   # { required_agent_roles, required_skills }\nhave_P    := roster-resolve(cwd)                 # CODE-BACKED enumeration (ADR §4 \u002F D4): run\n                                                 #   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Froster-resolve.js --cwd .\n                                                 # and consume its guild.roster.v1 JSON — project instances\n                                                 # (.guild\u002Fagents\u002F*.md + project .guild\u002Fskills\u002F*) PLUS `templates`\n                                                 # (the shipped type library, templates\u002Fspecialists\u002F*.md),\n                                                 # NEVER a hand-maintained list, NEVER a model-side directory walk\nmintable_P := needed_P ∩ templates − instances   # template covers the domain, no instance yet\nfor each mintable: MINT deterministically — node ...\u002Fruntime\u002Fscripts\u002Froster-resolve.js mint \u003Crole> --class \u003Crun class> --cwd .\ngaps_P    := needed_P − have_P − mintable_P      # covered by NEITHER an instance NOR a template\nfor each gap: recommend A create (→ create-specialist | create-skill, HUMAN-AUTHORIZED + PROSPECTIVELY GATED) \u002F B skip \u002F C substitute \u002F D compose-from-scratch\nproposal_P := propose(needed_P ∩ have_P, approved creations)   # FULL justified logical team — UNCAPPED,\n                                                 #   every participant with necessity_rationale,\n                                                 #   considered-but-excluded roles recorded (guild.team_proposal.v2)\ndecision_P := user gate on proposal_P            # guild.team_decision.v1 — approve | restructure; BLOCKS until decided\nwrite teamFilePath(guildRoot, slug, phase_P)     # .guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml  (T1) — the APPROVED team only\nwriteCurrentPhasePointer(guildRoot, slug, phase_P)  # .guild\u002Fteam\u002F\u003Cslug>.current     (T1)\n```\n\n**NULL-PHASE GUARD (load-bearing).** If `readActivePhase(cwd)` returns `null`, **BLOCK** — surface a clear operator error: *\"active phase not recorded for this run; phase-entry wiring must record it before a phase team can be composed\"* — and write **nothing**. NEVER fabricate `team.null.yaml`, and never silently default to a phase: with phase-entry wiring in place, `null` at compose time signals a genuine defect (phase not recorded \u002F corrupt run-state), so surfacing beats guessing the wrong phase's team.\n\n**Guard-before-write ordering is mandatory.** Both `teamFilePath(...)` and `writeCurrentPhasePointer(...)` (T1) **THROW** on a null\u002Fnon-canonical phase — by design, so a bad token can never become a filename (`readActivePhase` and `resolveTeamFile`, by contrast, *swallow* non-canonical → null). Therefore the write step (step 4) MUST call them **only after this guard has confirmed a canonical phase**. `readActivePhase` returns canonical-or-`null`, and this guard rejects `null`, so the writers only ever see a canonical token — do not remove or reorder the guard, or the write path will throw.\n\n**Re-affirm is explicit, never silent.** A phase that needs the prior phase's team re-affirms it as a **surfaced no-op diff** to the operator — never silently reuses it.\n\n**Per-phase team files.** `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` replaces the single `.guild\u002Fteam\u002F\u003Cslug>.yaml`. Each carries its own roster, tiers, scopes, dependencies, a `phase:` field, and a backend mirror. The legacy single-file `team.yaml` is honored **read-only** by `resolveTeamFile` (treated as the active phase's team) — this writer **never** overwrites, splits, or moves it.\n\n## Input\n\n- `.guild\u002Fspec\u002F\u003Cslug>.md` — the approved spec. Its Goal, Success criteria, Constraints, and Non-goals sections are the authoritative source for domain matching for the `ideate`\u002F`plan` phases. Do not infer domains from chat history outside the spec.\n- **`phase`** — the active phase, read via `readActivePhase(cwd)` (T1, `scripts\u002Flib\u002Fteam-file.ts`) from run-state — the authority, never inferred. A `null` return triggers the NULL-PHASE GUARD above.\n- **`topic_P`** — the phase's working topic (per the loop above): spec domains for `ideate`\u002F`plan`; plan lanes for `build`; CodebaseMap + plan signals for `qa`; runbook class for `ops`.\n\n## Workflow\n\nSeven ordered steps (0–5, with the 3b proposal\u002Fdecision gate between gap handling and the write), run **per phase** against `topic_P` (see `## Phase-aware composition`). The gap-handling options and approval shapes are detailed in `gap-handling.md`:\n\n0. **Self-build check (first).** If the target repo IS the Guild plugin itself (editing `plugin\u002F**` — skills, commands, hooks, scripts, agents, docs, manifests, tests), compose the team from the **dev-team agents enumerated from `.guild\u002Fagents\u002F*.md`** — the filesystem IS the dev-team roster; the composer reads that live directory, **never a hand-maintained list** (same net rule as `§1` for the shipped roster). Every selected specialist carries the exact committed `definition_ref` returned by `definition-ref-for-dispatch.ts`; a missing or uncommitted ref blocks composition. Route by changed path (see `CLAUDE.md §\"Dev team\"` for the path→agent table). Do **not** match against the `guild:` product specialists — those build *user* products. Skip steps 1–3's product-roster matching and go to **step 3b** with the dev-team lanes — the proposal\u002Fdecision gate is NEVER skipped: the dev-team roster is proposed as a full `guild.team_proposal.v2` and held for the user's `guild.team_decision.v1` before step 4 writes. (Uncapped composition and backend choice also still apply.)\n\n1. **Match.** (Non-self-build.) Build the **available-specialist set** by running the roster resolver — `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Froster-resolve.js --cwd .` — and consuming its `guild.roster.v1` JSON (`roster` = shipped ∪ project merged union; `templates` = the shipped specialist TYPE library; per-entry `name`, `definition`, `source`, `default_tier`, `skills`, `description`, `augmenting`). This is the code-backed D4 enumeration; never re-derive the set by walking directories yourself. **Filter out entries with `augmenting: true`** (`advisor`\u002F`developer` — the machinery agents: they augment lanes and stay dispatchable, but are never product-roster candidates; after the machinery-vs-template-library ADR they are the ONLY shipped agents, so every domain candidate comes from (b) or (c)). Domain candidates are **(b)** the consuming repo's project specialists already minted under `.guild\u002Fagents\u002F*.md` (the live tree only — the `.guild\u002Fagents\u002Fproposed\u002F*` incubation tree is **never** a candidate, per `guild:create-specialist`'s incubation contract), and **(c)** the shipped **type templates** from the resolver's `templates` array (`templates\u002Fspecialists\u002F*.md` — architect, researcher, backend, frontend, devops, qa, mobile, security, copywriter, doc-writer, technical-writer, social-media, seo, marketing, sales — a derived snapshot; the files are the authority). An instance is a direct match; a template is a **mint candidate**. A project specialist minted on a previous task is **reused here, never re-created**.\n\n2. **Classify** every matched domain three ways: *existing* — an already-minted `.guild\u002Fagents\u002F*.md` instance (joins the team with **no creation step**); *mintable* — a shipped template covers the domain but no instance exists yet (**mint deterministically**: `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Froster-resolve.js mint \u003Crole> --class \u003Crun class> --cwd .` — a byte-preserving instantiation stamped `derived_from_template`; only a `product` or `init` run mints, any other class is refused (R67), NO create-specialist gates: templates are pre-blessed feedstock, and the CLI refuses if the instance already exists; append `--host-native` ONLY if the operator asked for host-native routing — it additionally projects the instance into the host-native agent directory as `\u003Crole>.md` (marker-stamped, never clobbers hand-authored files)); or *gap* — covered by **neither** an instance nor a template (gets a proposed role name + one-line description so the user sees exactly what option A would create).\n\n3. **Present to user.** Show the matched existing specialists and the roles minted from templates this compose (each with one-line reasoning), and — for every genuine gap (agent **or** skill) — the four options **A · create \u002F B · skip gap \u002F C · substitute \u002F D · compose from scratch** (full semantics, including the v2 DH-3 mint boundary, in `gap-handling.md`). **Per-phase gap analysis is the SOLE mid-lifecycle trigger into the GATED create path** (ADR §1): option A routes a *role* gap to `guild:create-specialist` or a *capability\u002Fskill* gap to `guild:create-skill`. For a role gap, selecting A is explicit human creation authority. A human-requested new role does not require historical extraction evidence, but it **must clear the prospective mint gates** (interview, boundary scan, applicable boundary evals, and new-role paired evals) before the phase team finalizes. Replay applicable historical traces when they exist; no applicable corpus is not itself a blocker. Capability gaps retain `guild:create-skill`'s own mint contract. On gate failure the phase falls back to B\u002FC\u002FD. There is no ungated mid-phase creation of a NOVEL type; template instantiation is not a novel type (the trigger boundaries were blessed when the template shipped).\n\n3b. **Propose the full team and WAIT at the decision gate.** Assemble the **complete justified logical team** as an immutable `guild.team_proposal.v2` — every dispatchable participant of the phase (workers, advisors, challengers, local and cross-host reviewer slots alike; `participation_kind` distinguishes them, an advisory label never bypasses the gate), each with a non-empty `necessity_rationale` and `owned_obligations`, plus `excluded_roles` (`{role_ref, why_unnecessary}`) for every role considered but not proposed, and an obligation-coverage map (every obligation from success criteria, plan items, ownership boundaries, risks, implied rules, and review gates owns ≥1 participant OR an explicit user-accepted exclusion — an unowned obligation invalidates the proposal). Persist it under `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F` and **BLOCK until the user records a `guild.team_decision.v1`** — see `## Team decision gate (before any dispatch)`. Guild never auto-approves.\n4. **Write** the resolved per-phase team — only after a current `approve` decision (`## Team decision gate`) and the applicable approval shape (see `gap-handling.md`) have cleared — to `teamFilePath(guildRoot, slug, phase)` = `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` (T1, `scripts\u002Flib\u002Fteam-file.ts`), then update the convenience pointer via `writeCurrentPhasePointer(guildRoot, slug, phase)` = `.guild\u002Fteam\u002F\u003Cslug>.current`. Each entry carries per-specialist scope and cross-specialist dependencies, plus a **mirror** of the snapshot-resolved execution backend (resolved at intake by `runStartPreflight`, not chosen here — see `## Execution backend`). **Honor the NULL-PHASE GUARD** (`## Phase-aware composition`): a `null` phase BLOCKS the write. **Never** overwrite, split, or move a legacy `.guild\u002Fteam\u002F\u003Cslug>.yaml` — it is read-only back-compat. Every specialist entry carries `definition:` + `definition_source:` copied from the roster-resolve JSON. Every project specialist also carries the exact compact JSON `definition_ref:` returned by `scripts\u002Fdefinition-ref-for-dispatch.ts`; a missing\u002Funcommitted\u002Fmismatched ref blocks the team write. A specialist minted in step 3 (option A) needs no explicit registry refresh: discovery reads the definition files directly.\n\n5. **Emit the companion `guild.team_plan.v1` (ADDITIVE, FAIL-SOFT — G6b-2b).** After the step-4 yaml write, ALSO emit a typed `team_plan` as a **companion** artifact. Steps 0–4 and every guard above (incl. the NULL-PHASE GUARD) are **UNCHANGED** — this step only ADDS the emit. The `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` stays the **AUTHORITATIVE** dispatch input; the team_plan is the machine-typed mirror (roster + the `advisory_panel` challenger trail + `fired_rules`) that downstream gates (quality\u002Fops) and the benchmark can consume.\n   - **Derive a `guild.station_signals.v1` signals block** from the phase's domain signals — the SIX signal keys `team-compose` already reasons about for implied specialists (`## Hard rules` + `team-composition.md §Implied Specialist Rules`): `multi_component`, `auth_touched`, `backend_present`, `user_facing_ui`, `public_docs`, `search_discoverability` (each a boolean; absent ⇒ false). **Do not invent new signals** beyond these six. Set `source_ref` to the spec\u002Fplan path the signals were read from. Serialise `{ \"schema_version\": \"guild.station_signals.v1\", \"signals\": {…}, \"source_ref\": \"\u003Cspec\u002Fplan path>\" }` (to a temp file or stdin).\n   - **Station = the canonical phase token.** The composer's `STATIONS` cover the six lifecycle phases 1:1 (`init ideate plan build qa ops`, plus `research`\u002F`definition`\u002F`learn`), so the active phase **is** its station. If a phase has NO matching station (`isStation(\u003Cphase>)` is false), **SKIP the emit with a logged degradation note** — never fail. Otherwise invoke the CLI:\n     ```\n     node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fstation-compose.js \u003Cphase> --signals \u003Csignals.json|-> --cwd . --run-id \u003Crun-id> --emit\n     ```\n     It writes the typed `guild.team_plan.v1` (roster + `advisory_panel` + `fired_rules` + `fired_challenger_rules`) to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>.json` (`scripts\u002Fstation-compose.ts` → `station-signals.ts writeTeamPlan`).\n   - **MIRROR, never a recompose.** The emitted team_plan (roster + `advisory_panel`) is a machine-typed **mirror of the approved proposal** — its participant set MUST equal the approved `guild.team_proposal.v2`'s. If the station CLI's output diverges (an extra\u002Fmissing role vs. the approved set), do NOT dispatch the divergent entries: record the divergence as a degradation note and surface it to the user — adding a participant is a §4 invalidating change requiring a new proposal+decision cycle. *(Historical, CLOSED — do not act on it: through the v2.3 era the station CLI enforced a legacy `TEAM_CAP = 6` \u002F `config.cap`, so an approved roster >6 diverged here by construction. Lane T2b RETIRED that runtime cap; the composer now rejects `cap`\u002F`capped`\u002F`dropped_roles`\u002F`max_team_size`\u002F`team_size` outright. A >6 roster no longer diverges for size reasons, so a divergence here is a REAL defect to surface — never expected, never rubber-stamped.)*\n   - **FAIL-SOFT.** On ANY CLI error (non-zero exit, unknown station, malformed signals), write a one-line degradation-receipt note and **CONTINUE** — the yaml is authoritative, so a missing team_plan never breaks the run.\n   - **Record the emitted `team_plan` path** (or the skip note) in the handoff receipt (`## Handoff`).\n\n**Reuse, never re-create** is load-bearing: an existing `.guild\u002Fagents\u002F*.md` instance joins with no creation step and no *creation* approval (the step-3b team decision gate still covers it like every participant); a template-covered domain mints its instance ONCE (the mint CLI exits `3` on an existing instance — that exit is your reuse signal, not an error). Only a gap covered by neither an instance nor a template can become a newly-created specialist (option A → `guild:create-specialist`) or skill (option A → `guild:create-skill`), and only with explicit per-role\u002Fper-skill approval that clears the mint gate.\n\n## Hard rules\n\nNon-negotiable; if a user request conflicts, raise it before writing `team.yaml`:\n\n- **The logical team is task-derived and UNCAPPED** (dynamic-host-model-routing ADR; frozen `guild.team_proposal.v2` §2). There is NO hard specialist-count cap, NO default size target, and NO truncation\u002Ftail-drop path — propose EVERY specialist you can justify from the goal, phase work, dependencies, risk, ownership boundaries, and required review. A large task honestly yields a large team. *(Historical note: the v2.3-era composer enforced a cap of 6 with a 3–4 default — do not reintroduce it under any name.)* **Migration fence — CLOSED (past state, kept only so the history reads straight):** this rule once carried a temporary fence stating that the station-composer runtime still enforced the legacy `TEAM_CAP = 6` \u002F `config.cap`, so an approved roster larger than 6 would produce a divergent step-5 runtime mirror. **Lane T2b landed and retired that cap** — `TEAM_CAP` no longer exists anywhere in `src\u002F` or `scripts\u002F`, and `station-composer.ts` now REJECTS the retired keys `cap` \u002F `capped` \u002F `dropped_roles` \u002F `max_team_size` \u002F `team_size`. Do NOT expect, tolerate, or pre-emptively refuse a size-driven divergence: there is none. The step-5 mirror-divergence guard remains in force for genuine participant-set divergence (an extra or missing role), which is a real defect and a §4 invalidating change.\n- **Every inclusion is justified, every exclusion is recorded.** Each proposed participant carries a non-empty `necessity_rationale` + `owned_obligations`; each role considered but not proposed lands in `excluded_roles` with `why_unnecessary`. Coverage is validated: an obligation with no owner and no user-accepted exclusion invalidates the proposal.\n- **Backend\u002Fhost capacity is a SCHEDULING concern, never a roster limit** (`guild.team_schedule.v1`). If the backend cannot run the approved team concurrently, propose dependency-valid execution waves (or another backend) and ask the user — never drop, filter, or reorder specialists to fit capacity. Legacy `--team-size N` \u002F `defaults.team.size` are read only as a concurrency *hint* during the migration window (clamped to verified backend capacity, per the frozen §6 precedence); `allow_larger` is a warned no-op. None of these can cap the logical roster.\n- **Architect is implied** on any multi-component build (frontend + backend, service + infra, …).\n- **Security is implied** on anything touching auth, secrets management, or external integrations (third-party APIs, webhooks, OAuth, payment providers).\n- **QA is implied whenever backend is present** in the team. Server-side changes ship with a qa slot by default.\n- **Orchestrator is implicit** — the top-level `\u002Fguild` session coordinates; it occupies no specialist slot and is not a proposal participant.\n- **New specialists must pass their applicable mint gates** before joining. Human-requested roles require prospective boundary\u002Frouting evals but not historical extraction evidence; evolution-proposed roles additionally require all extraction signals and historical shadow replay. A failing create-specialist proposal falls back to options B \u002F C \u002F D.\n\n## Team decision gate (before any dispatch)\n\nImplements the frozen `guild.team_proposal.v2` \u002F `guild.team_decision.v1` \u002F `guild.team_schedule.v1` contracts (dynamic-host-model-routing run, `contracts\u002Fteam-contracts.md` — bound by pointer, never re-spelled; schema fields are normative there). **Every phase that can dispatch composes a proposal and holds at this gate** — all six lifecycle phases (`init · ideate · plan · build · qa · ops`) alike, including advisory panels, cross-host reviewer slots (G-init\u002FG-spec reviewers included), and learn-pipeline agents: if a phase dispatches ANY participant, that participant is in a user-approved proposal first. **Early-phase proposals (`init`\u002F`ideate`):** these phases run before an approved spec exists, so their (typically minimal) proposals are composed by the phase skill itself (`guild:init` \u002F `guild:brainstorm`) *before its first dispatch*, with `spec_ref` pointing at the intake artifact that exists at that moment (init brief \u002F draft spec bytes), and — since the frozen schema requires BOTH refs and no plan exists yet — `plan_ref` set to that SAME intake artifact ref (a deliberate, documented duplication; never omit the field, never invent a placeholder path). The gate requires a justified dispatchable-participant list, not an approved spec. Work the orchestrator session performs itself dispatches no participant and needs no proposal.\n\n- **The proposal is immutable.** `guild.team_proposal.v2` is persisted with a self-referential `proposal_hash` (canonical-YAML SHA-256, hash field omitted from the hashed value). A change is a NEW proposal (`proposal_version`+1, `parent_proposal_hash` set), never an edit. All versions persist under `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F` — proposals AND their decisions alike, one decision artifact per proposal version (`\u003Cphase>-proposal-v\u003Cn>.yaml` \u002F `\u003Cphase>-decision-v\u003Cn>.yaml`), never overwritten — so the audit trail shows the exact bytes proposed, restructured, decided, and approved.\n- **Exactly one user decision per proposal hash.** `guild.team_decision.v1` records `approve` or `restructure`, `decided_by` a **user identity\u002Fchannel — never an agent**. Guild NEVER auto-approves (autonomy policy: requires confirmation). Present the full proposal — participants with necessity rationale, excluded roles, obligation coverage, and the non-binding wave preview — and WAIT.\n- **Restructure loops preserve the original proposal.** `restructure` edits (`add` \u002F `remove` \u002F `substitute` \u002F `edit_dependencies`) yield a NEW proposal version plus a new PENDING decision; the parent chain keeps every prior version. Coverage is revalidated on each edit — lost obligations are surfaced before acceptance. Restructure is idempotent and can loop any number of times without losing the v1 proposal.\n- **Invalidation.** Any change to a participant, obligation, dependency, tier\u002Fpurpose, capability scope, backend, wave structure, concurrency, cost posture, or review independence invalidates the prior decision and requires renewed user approval.\n- **Dispatch gate (consumed by `guild:execute-plan`).** Dispatch accepts only a current `approve` decision whose `proposal_hash` equals the hash RECOMPUTED from the proposal artifact. Stale or hash-mismatched decisions fail closed.\n- **Scheduling, not truncation.** After approval, backend capacity maps the approved participant set onto dependency-valid `guild.team_schedule.v1` waves — approved id set = base-wave union = dispatch receipts = terminal outcomes (set equality; removal only via a new proposal+decision cycle citing the new decision hash). Retries reuse the same `participant_id`; a failed wave preserves not-yet-terminal ids for resume; resource exhaustion produces an explicit scheduling failure or a user-approved backend\u002Fconcurrency change, never a roster change.\n\n## Execution backend\n\n**`team-compose` does NOT resolve the backend.** The backend is resolved **once at command intake** by `runStartPreflight` (`scripts\u002Flib\u002Frunstart-preflight.ts`) — before run-trace start, before `team-compose` is invoked — applying the **`agent_mode` dispatch ladder** (`CLAUDE.md §\"Backend default — the agent_mode dispatch ladder\"`; ADR D5 of the command-surface dispatch and internalization ADR) and frozen in the run's resolved-settings snapshot (U6). `team-compose` **consumes** `snapshot.effective.agent_mode` (read via `readResolvedSettingsSnapshot`) and **records a mirror** of it in `team.yaml`'s `backend` field for audit\u002Freadability — it neither re-reads `.guild\u002Fsettings.json`, re-runs `scripts\u002Fagent-team-launcher.ts`, nor owns the OD-3 operator ask.\n\nFor reference, the intake-time ladder `runStartPreflight` applies (you do not re-run it here):\n\n- **`auto` (default):** inside tmux (`$TMUX` set) → **agent-team in-session** (a new window in the current session, **one visible pane per specialist**); tmux installed but not currently inside one → **agent-team new-session** (detached session, then attach); host supports independent agents (no tmux) → **agent**; else → **subagent**.\n- **Explicit pin** (`team | agent | subagent`) is honored subject to availability — pinning `team` on a tmux-less host warns and falls back to subagent.\n\n**Team\u002Fagent is PRIMARY whenever tmux is available; subagent is the documented last resort** (CI, fresh installs, no tmux) — never the default on a developer machine.\n\nThe tmux prompt is **evaluated every run**, not once-and-never-again. Ground truth (`runStartPreflight`): `needsTmuxPrompt = tmuxAvailable && effective agent_mode !== \"team\"`. So while `agent_mode` is anything other than `team` (including `auto`), and tmux is available, **each run** surfaces the question. On **yes**, `agent_mode: \"team\"` is persisted via `config-cmd set agent_mode team --scope workspace` (U2 HARD-SET path) — so subsequent runs resolve `team` and the prompt no longer fires. On **no**, nothing is persisted, so the next run prompts again. In this workspace the root is already `team`, so the predicate is false and the prompt stays silent.\n\n`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` must be set for any team spawn; if it is absent when the resolved backend is `team`, the launcher **refuses and surfaces the blocker** (it never silently swaps to subagent — that would change execution semantics out from under the plan). `team.yaml`'s top-level `backend` is a **mirror** of the snapshot-resolved value for readability\u002Faudit — it is **not** the backend authority. The authoritative backend for `guild:plan` and `guild:execute-plan` is the run's resolved-settings snapshot (`snapshot.effective.agent_mode`, written by U6); `team.yaml` remains authoritative for team **composition** (roster, scope, dependencies, tiers, agent-definition paths), not the backend selection.\n\n## Output contract\n\nWrite `teamFilePath(guildRoot, slug, phase)` = **`.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml`** (T1; never the legacy single-file `\u003Cslug>.yaml`), and update `.guild\u002Fteam\u002F\u003Cslug>.current` via `writeCurrentPhasePointer`. Full annotated schema + per-field semantics in `gap-handling.md`; the shape is:\n\n```yaml\nspec: .guild\u002Fspec\u002F\u003Cslug>.md\nphase: build               # the phase this team was composed for (self-description\u002Faudit); matches the \u003Cphase> in the filename\nbackend: agent-team        # MIRROR of the snapshot-resolved backend (snapshot.effective.agent_mode) for audit; NOT the authority — execute-plan reads the snapshot. Per-phase files all mirror the SAME intake-resolved value (never re-resolved per phase — ADR A4).\nproposal_ref: .guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>-proposal-v\u003Cn>.yaml   # the approved guild.team_proposal.v2 this file realizes\ndecision_ref: .guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>-decision-v\u003Cn>.yaml  # the approve decision for THAT proposal version (one decision file per proposal version; prior decisions never overwritten)\nspecialists:\n  - name: architect        # exact roster slug\n    participant_id: architect-build-1        # the STABLE id from the approved proposal (constant across retries; the set-equality key)\n    participation_kind: worker               # worker | advisor | challenger | reviewer_local | reviewer_cross_host (from the proposal)\n    purpose: general                         # the model_policy §2 purpose enum from the participant's authoritative role metadata\n    scope: \"One-sentence bounded responsibility for THIS task.\"\n    necessity_rationale: \"Why this phase cannot meet its obligations without this role.\"  # required, non-empty (mirrors the proposal)\n    owned_obligations: [ob-arch-boundaries]  # obligation ids this participant owns (from the proposal coverage map)\n    depends-on: []          # specialist slugs whose handoff this waits on\n    definition: .guild\u002Fagents\u002Farchitect.md   # agent-definition path from roster-resolve (`definition` field).\n                            #   Domain specialists are always PROJECT instances (`.guild\u002Fagents\u002F\u003Crole>.md`,\n                            #   minted from the shipped template) — LOAD-BEARING: dispatch embeds the\n                            #   definition-adoption instruction and the in-process backend swaps\n                            #   subagent_type to the host-generic type. `shipped` appears only on the\n                            #   machinery agents (advisor\u002Fdeveloper), plugin-relative and informational.\n    definition_source: project        # shipped | project — from roster-resolve (`source` field)\n    definition_ref: {\"schema_version\":\"guild.project_definition_ref.v1\",\"project_id\":\"\u003Cproject>\",\"layer\":\"project-guild\",\"kind\":\"agent\",\"id\":\"architect\",\"relative_path\":\".guild\u002Fagents\u002Farchitect.md\",\"content_hash\":\"sha256:\u003C64hex>\",\"source_commit\":\"\u003Ccommit-or-null>\",\"specialist_profile_hash\":\"\u003C64hex>\",\"specialist_type_hash\":\"\u003C64hex>\",\"skills\":[]} # exact one-line `result.ref` from definition-ref-for-dispatch; never hand-built\n    default_tier: powerful  # cheap|mid|powerful — roster-resolve derives it from the agent's `default_tier:`\u002F`model:` frontmatter per the canonical roster ADR (a default, NOT a pin)\n    implied-by: \"multi-component\"   # or omit if user-requested\n    capability_scope:       # explicit override; canonical defaults are runtime-materialized when absent\n      - \"Read\"\n      - \"Write\"\n      - \"Edit\"\n      - \"Glob\"\n      - \"Grep\"\nexcluded_roles:\n  - role_ref: data-scientist\n    why_unnecessary: \"No ML surface in this phase's obligations.\"\ngaps_resolved:\n  - proposed_role: data-scientist\n    resolution: \"B\"         # A \u002F B \u002F C \u002F D\n    notes: \"User accepted missing coverage; flagged in final report.\"\ncoverage_flags:\n  - \"No specialist covers ML modelling (B on data-scientist gap).\"\n```\n\n`implied-by` records which hard rule triggered an inclusion (`multi-component`, `auth-touched`, `backend-present`) for audit. The roster is **uncapped** — it lists every participant of the approved proposal, exactly; no entry may be dropped to fit a size target or backend capacity (`## Hard rules`).\n\n## Default tier per specialist\n\nEach composed specialist carries a **default model tier** (`cheap | mid | powerful`). **Do not maintain a tier table here — enumerate it from source.** Canonical ADR: the specialist-roster-groups-and-tiers ADR (D4 enumeration rule, D2 default-tier table, D3 default-vs-dispatch split). The root cause of the prior drift (R-003) was three sources extrapolating disagreeing tier tables from a cost-aware ADR §7 that only tabulated 5 augmenting types — so this skill no longer keeps its own.\n\n- **Default tier = the specialist's frontmatter**, surfaced as `default_tier` in the roster-resolve JSON: an explicit `default_tier:` frontmatter key wins; otherwise the `model:` line is mapped through the cost-aware-tiering §1 ladder (`opus`=powerful, `sonnet`=mid, `haiku`=cheap; unknown models default `mid`). Consume it from the resolver output **at compose time** — never a hand-maintained list. This structurally prevents the tier drift from recurring, and it applies identically to project-local specialists (killing the old \"project mint runs at `mid`\" degradation).\n- The tier→model host map is the closed-key `models.tiers` block (cost-aware ADR §10 — bound by pointer, never re-spelled here).\n\nCanonical default tiers for the 15 domain type templates (the ADR D2 table — a **derived view** of the `templates\u002Fspecialists\u002F*.md` frontmatter, inherited verbatim by minted instances; if it ever disagrees with the files, the files win):\n\n| Default tier | Specialists |\n|---|---|\n| `powerful` | architect, security |\n| `mid` | researcher, backend, frontend, mobile, devops, qa, copywriter, doc-writer, technical-writer, social-media, seo, marketing, sales |\n\n(Machinery agents, per cost-aware ADR §7: `advisor`=powerful, `developer`=mid — they augment, never count toward the domain roster.)\n\n**Research-purpose floor (authoritative, transitive, non-downgradable).** Each participant carries a `purpose` (the `guild.model_policy.v2` §2 enum) sourced from its **authoritative role definition** (`work_class`\u002Fpurpose frontmatter on the agent\u002Ftemplate — T1b metadata), never guessed from the lane label. A `purpose: research` participant resolves `effective_complexity: hard` \u002F `tier: powerful` (`research_always_hard`), and the floor is **transitive through every handoff**: descendants, advisor consults, retries, resumes, and generic sub-dispatches inherit it and can NEVER downgrade it — no auto-score, `--model-tier` pin, or cheap-lane default lowers a research lane. Record `forced_floor_reason: research_always_hard` wherever the floor fires.\n\n**Default tier ≠ per-lane dispatch tier (ADR D3).** The default above is the single tier the specialist runs at when dispatched as that type — not a pin. The actual dispatch tier is the cost-aware §2 auto-score computed **per lane**: it may lower a simple lane below its default (a mechanical `doc-writer` edit, template-guided content\u002Fcommercial generation → `cheap` — but NEVER a `purpose: research` lane, whose floor is absolute per the paragraph above) or escalate a hard one (a security-critical lane → `powerful` via the §3 advisor). `--model-tier` \u002F per-lane plan override \u002F the §2 score decide the final dispatch tier (ADR §10 precedence). The old `cheap→mid` \"default\" notation is **retired** — a cheap floor for mechanical lanes is a property of the §2 scorer, not a dual-valued default. Self-build dev-team lanes inherit by the same frontmatter read (`plugin-architect`→powerful; code\u002Fskill\u002Fhook\u002Ftooling lanes→mid; `docs-writer`→mid, with the §2 cheap floor for mechanical edits).\n\n## Capability scope defaults\n\nImplements the capability-scoping contract from the v2 security ADR (bound by pointer). The `capability_scope:` field is additive for unknown\u002Fproject-defined roles. For the 15 canonical domain roles, an omitted field is materialized from the source-owned defaults below before dispatch; it never means \"inherit every host tool\". An explicit scope wins because it is hash-bound by the approved team decision. The resolved value is serialised as `GUILD_CAPABILITY_SCOPE` (JSON string array) by `guild:execute-plan` at dispatch so the PreToolUse hook can enforce it.\n\nDerive `capability_scope` from the role→scope defaults below. Override when a task's narrower scope warrants it (e.g. a security audit lane may restrict even further); widen only when explicitly justified. `researcher` is the only role with network-capable tools by default. A different role may receive `WebSearch` or `WebFetch` only after the operator explicitly approves that exception for the task; record the approval in the team decision before dispatch.\n\nRule syntax follows Claude Code's own permission-rule grammar (bound by convention — see `hooks\u002Flib\u002Fsecurity\u002Fenforce.ts`):\n- `\"ToolName\"` — matches any call to that tool.\n- `\"ToolName(glob)\"` — matches only when the argument string matches the glob.\n\n| Role group | Default `capability_scope` | Rationale |\n|---|---|---|\n| `architect` | `[\"Read\",\"Write\",\"Edit\",\"Glob\",\"Grep\"]` | Reads codebase, writes ADRs\u002Fdocs; no Bash or external requests needed. |\n| `researcher` | `[\"Read\",\"Glob\",\"Grep\",\"WebSearch\",\"WebFetch\"]` | Read + search only; no file writes, no shell. |\n| `backend`, `frontend`, `mobile`, `devops` (build lanes) | `[\"Read\",\"Write\",\"Edit\",\"Bash\",\"Glob\",\"Grep\"]` | Needs full read\u002Fwrite\u002Fbash to implement a lane. |\n| `qa` | `[\"Read\",\"Write\",\"Edit\",\"Bash\",\"Glob\",\"Grep\"]` | Runs tests and writes fixtures; same profile as build lanes. |\n| `security` | `[\"Read\",\"Glob\",\"Grep\"]` | Audit-only by default: local read + search; no writes, external requests, or unguarded bash. |\n| `doc-writer`, `copywriter`, `technical-writer` | `[\"Read\",\"Write\",\"Edit\",\"Glob\",\"Grep\"]` | Reads source, writes doc files; no shell or external requests. |\n| `seo`, `social-media`, `marketing`, `sales` | `[\"Read\",\"Write\",\"Edit\",\"Glob\",\"Grep\"]` | Reads project-provided evidence and writes copy\u002Fconfig files. If the task requires fresh external evidence, request a task-scoped operator-approved web-tool exception and record it in the team decision. |\n\nSelf-build dev-team lanes inherit by analogy: `plugin-architect`→`architect` scope; skill\u002Fhook\u002Fcommand\u002Ftooling lanes→build-lane scope; `docs-writer`→doc-writer scope; `eval-engineer`→build-lane scope.\n\n## Handoff\n\nHand off to `guild:plan` with the **resolved per-phase team-file path** as its argument (the `teamFilePath(...)` result just written, e.g. `.guild\u002Fteam\u002F\u003Cslug>.build.yaml` — not a reconstructed `\u003Cslug>.yaml`). Do not proceed into planning yourself — `guild:plan` is a separate skill. Handoff receipt lists: `team_path` (the per-phase path), `phase`, `proposal_ref` + `proposal_hash` + `decision_ref` (the approved `guild.team_proposal.v2` chain — including any restructure versions — and its `guild.team_decision.v1`), `specialist_count` (audit fact of the approved set, never a target), `backend`, `gaps_resolved` count (incl. any A→`create-specialist`\u002F`create-skill` mints and their gate outcome), whether any `implied-by` rule fired, the per-specialist `default_tier` assignments (so `guild:plan` can carry them onto each lane's `complexity_score` + chosen tier), and `team_plan_path` — the companion `guild.team_plan.v1` emitted at step 5 (`.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>.json`), or the fail-soft skip note if emission was skipped\u002Ffailed (so `guild:execute-plan` can wire its `team_result` `team_plan_ref` to it).\n","# guild:team-compose\n\nImplements team composition **and the phase-aware composition loop** (G-PHASE-COMPOSE) from the canonical-specialist-roster ADR's sibling `dynamic-team-composition.md`. Composition is **re-evaluated at each phase boundary**, not once per slug: each phase writes its own `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml`. Output is a resolved per-phase team file downstream planning and execution consume verbatim (resolved via `resolveTeamFile`).\n\n## Phase-aware composition (per phase)\n\n`team-compose` runs a **phase-composition pass** at each phase boundary (`init → ideate → plan → build → qa → ops`). It is no longer a one-shot artifact — the team for `ideate` ≠ the team for `build` ≠ the team for `ops`.\n\n**The loop** (ADR §1, made operational):\n\n```\nphase_P   := readActivePhase(cwd)              # T1: scripts\u002Flib\u002Fteam-file.ts — run-state authority, NEVER inferred from chat\ntopic_P   := the phase's working topic         # spec domains for ideate\u002Fplan; plan lanes for build;\n                                               #   CodebaseMap+plan signals for qa; runbook class for ops\nneeded_P  := analyse(topic_P)                   # { required_agent_roles, required_skills }\nhave_P    := roster-resolve(cwd)                 # CODE-BACKED enumeration (ADR §4 \u002F D4): run\n                                                 #   node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Froster-resolve.js --cwd .\n                                                 # and consume its guild.roster.v1 JSON — project instances\n                                                 # (.guild\u002Fagents\u002F*.md + project .guild\u002Fskills\u002F*) PLUS `templates`\n                                                 # (the shipped type library, templates\u002Fspecialists\u002F*.md),\n                                                 # NEVER a hand-maintained list, NEVER a model-side directory walk\nmintable_P := needed_P ∩ templates − instances   # template covers the domain, no instance yet\nfor each mintable: MINT deterministically — node ...\u002Fruntime\u002Fscripts\u002Froster-resolve.js mint \u003Crole> --class \u003Crun class> --cwd .\ngaps_P    := needed_P − have_P − mintable_P      # covered by NEITHER an instance NOR a template\nfor each gap: recommend A create (→ create-specialist | create-skill, HUMAN-AUTHORIZED + PROSPECTIVELY GATED) \u002F B skip \u002F C substitute \u002F D compose-from-scratch\nproposal_P := propose(needed_P ∩ have_P, approved creations)   # FULL justified logical team — UNCAPPED,\n                                                 #   every participant with necessity_rationale,\n                                                 #   considered-but-excluded roles recorded (guild.team_proposal.v2)\ndecision_P := user gate on proposal_P            # guild.team_decision.v1 — approve | restructure; BLOCKS until decided\nwrite teamFilePath(guildRoot, slug, phase_P)     # .guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml  (T1) — the APPROVED team only\nwriteCurrentPhasePointer(guildRoot, slug, phase_P)  # .guild\u002Fteam\u002F\u003Cslug>.current     (T1)\n```\n\n**NULL-PHASE GUARD (load-bearing).** If `readActivePhase(cwd)` returns `null`, **BLOCK** — surface a clear operator error: *\"active phase not recorded for this run; phase-entry wiring must record it before a phase team can be composed\"* — and write **nothing**. NEVER fabricate `team.null.yaml`, and never silently default to a phase: with phase-entry wiring in place, `null` at compose time signals a genuine defect (phase not recorded \u002F corrupt run-state), so surfacing beats guessing the wrong phase's team.\n\n**Guard-before-write ordering is mandatory.** Both `teamFilePath(...)` and `writeCurrentPhasePointer(...)` (T1) **THROW** on a null\u002Fnon-canonical phase — by design, so a bad token can never become a filename (`readActivePhase` and `resolveTeamFile`, by contrast, *swallow* non-canonical → null). Therefore the write step (step 4) MUST call them **only after this guard has confirmed a canonical phase**. `readActivePhase` returns canonical-or-`null`, and this guard rejects `null`, so the writers only ever see a canonical token — do not remove or reorder the guard, or the write path will throw.\n\n**Re-affirm is explicit, never silent.** A phase that needs the prior phase's team re-affirms it as a **surfaced no-op diff** to the operator — never silently reuses it.\n\n**Per-phase team files.** `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` replaces the single `.guild\u002Fteam\u002F\u003Cslug>.yaml`. Each carries its own roster, tiers, scopes, dependencies, a `phase:` field, and a backend mirror. The legacy single-file `team.yaml` is honored **read-only** by `resolveTeamFile` (treated as the active phase's team) — this writer **never** overwrites, splits, or moves it.\n\n## Input\n\n- `.guild\u002Fspec\u002F\u003Cslug>.md` — the approved spec. Its Goal, Success criteria, Constraints, and Non-goals sections are the authoritative source for domain matching for the `ideate`\u002F`plan` phases. Do not infer domains from chat history outside the spec.\n- **`phase`** — the active phase, read via `readActivePhase(cwd)` (T1, `scripts\u002Flib\u002Fteam-file.ts`) from run-state — the authority, never inferred. A `null` return triggers the NULL-PHASE GUARD above.\n- **`topic_P`** — the phase's working topic (per the loop above): spec domains for `ideate`\u002F`plan`; plan lanes for `build`; CodebaseMap + plan signals for `qa`; runbook class for `ops`.\n\n## Workflow\n\nSeven ordered steps (0–5, with the 3b proposal\u002Fdecision gate between gap handling and the write), run **per phase** against `topic_P` (see `## Phase-aware composition`). The gap-handling options and approval shapes are detailed in `gap-handling.md`:\n\n0. **Self-build check (first).** If the target repo IS the Guild plugin itself (editing `plugin\u002F**` — skills, commands, hooks, scripts, agents, docs, manifests, tests), compose the team from the **dev-team agents enumerated from `.guild\u002Fagents\u002F*.md`** — the filesystem IS the dev-team roster; the composer reads that live directory, **never a hand-maintained list** (same net rule as `§1` for the shipped roster). Every selected specialist carries the exact committed `definition_ref` returned by `definition-ref-for-dispatch.ts`; a missing or uncommitted ref blocks composition. Route by changed path (see `CLAUDE.md §\"Dev team\"` for the path→agent table). Do **not** match against the `guild:` product specialists — those build *user* products. Skip steps 1–3's product-roster matching and go to **step 3b** with the dev-team lanes — the proposal\u002Fdecision gate is NEVER skipped: the dev-team roster is proposed as a full `guild.team_proposal.v2` and held for the user's `guild.team_decision.v1` before step 4 writes. (Uncapped composition and backend choice also still apply.)\n\n1. **Match.** (Non-self-build.) Build the **available-specialist set** by running the roster resolver — `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Froster-resolve.js --cwd .` — and consuming its `guild.roster.v1` JSON (`roster` = shipped ∪ project merged union; `templates` = the shipped specialist TYPE library; per-entry `name`, `definition`, `source`, `default_tier`, `skills`, `description`, `augmenting`). This is the code-backed D4 enumeration; never re-derive the set by walking directories yourself. **Filter out entries with `augmenting: true`** (`advisor`\u002F`developer` — the machinery agents: they augment lanes and stay dispatchable, but are never product-roster candidates; after the machinery-vs-template-library ADR they are the ONLY shipped agents, so every domain candidate comes from (b) or (c)). Domain candidates are **(b)** the consuming repo's project specialists already minted under `.guild\u002Fagents\u002F*.md` (the live tree only — the `.guild\u002Fagents\u002Fproposed\u002F*` incubation tree is **never** a candidate, per `guild:create-specialist`'s incubation contract), and **(c)** the shipped **type templates** from the resolver's `templates` array (`templates\u002Fspecialists\u002F*.md` — architect, researcher, backend, frontend, devops, qa, mobile, security, copywriter, doc-writer, technical-writer, social-media, seo, marketing, sales — a derived snapshot; the files are the authority). An instance is a direct match; a template is a **mint candidate**. A project specialist minted on a previous task is **reused here, never re-created**.\n\n2. **Classify** every matched domain three ways: *existing* — an already-minted `.guild\u002Fagents\u002F*.md` instance (joins the team with **no creation step**); *mintable* — a shipped template covers the domain but no instance exists yet (**mint deterministically**: `node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Froster-resolve.js mint \u003Crole> --class \u003Crun class> --cwd .` — a byte-preserving instantiation stamped `derived_from_template`; only a `product` or `init` run mints, any other class is refused (R67), NO create-specialist gates: templates are pre-blessed feedstock, and the CLI refuses if the instance already exists; append `--host-native` ONLY if the operator asked for host-native routing — it additionally projects the instance into the host-native agent directory as `\u003Crole>.md` (marker-stamped, never clobbers hand-authored files)); or *gap* — covered by **neither** an instance nor a template (gets a proposed role name + one-line description so the user sees exactly what option A would create).\n\n3. **Present to user.** Show the matched existing specialists and the roles minted from templates this compose (each with one-line reasoning), and — for every genuine gap (agent **or** skill) — the four options **A · create \u002F B · skip gap \u002F C · substitute \u002F D · compose from scratch** (full semantics, including the v2 DH-3 mint boundary, in `gap-handling.md`). **Per-phase gap analysis is the SOLE mid-lifecycle trigger into the GATED create path** (ADR §1): option A routes a *role* gap to `guild:create-specialist` or a *capability\u002Fskill* gap to `guild:create-skill`. For a role gap, selecting A is explicit human creation authority. A human-requested new role does not require historical extraction evidence, but it **must clear the prospective mint gates** (interview, boundary scan, applicable boundary evals, and new-role paired evals) before the phase team finalizes. Replay applicable historical traces when they exist; no applicable corpus is not itself a blocker. Capability gaps retain `guild:create-skill`'s own mint contract. On gate failure the phase falls back to B\u002FC\u002FD. There is no ungated mid-phase creation of a NOVEL type; template instantiation is not a novel type (the trigger boundaries were blessed when the template shipped).\n\n3b. **Propose the full team and WAIT at the decision gate.** Assemble the **complete justified logical team** as an immutable `guild.team_proposal.v2` — every dispatchable participant of the phase (workers, advisors, challengers, local and cross-host reviewer slots alike; `participation_kind` distinguishes them, an advisory label never bypasses the gate), each with a non-empty `necessity_rationale` and `owned_obligations`, plus `excluded_roles` (`{role_ref, why_unnecessary}`) for every role considered but not proposed, and an obligation-coverage map (every obligation from success criteria, plan items, ownership boundaries, risks, implied rules, and review gates owns ≥1 participant OR an explicit user-accepted exclusion — an unowned obligation invalidates the proposal). Persist it under `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F` and **BLOCK until the user records a `guild.team_decision.v1`** — see `## Team decision gate (before any dispatch)`. Guild never auto-approves.\n4. **Write** the resolved per-phase team — only after a current `approve` decision (`## Team decision gate`) and the applicable approval shape (see `gap-handling.md`) have cleared — to `teamFilePath(guildRoot, slug, phase)` = `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` (T1, `scripts\u002Flib\u002Fteam-file.ts`), then update the convenience pointer via `writeCurrentPhasePointer(guildRoot, slug, phase)` = `.guild\u002Fteam\u002F\u003Cslug>.current`. Each entry carries per-specialist scope and cross-specialist dependencies, plus a **mirror** of the snapshot-resolved execution backend (resolved at intake by `runStartPreflight`, not chosen here — see `## Execution backend`). **Honor the NULL-PHASE GUARD** (`## Phase-aware composition`): a `null` phase BLOCKS the write. **Never** overwrite, split, or move a legacy `.guild\u002Fteam\u002F\u003Cslug>.yaml` — it is read-only back-compat. Every specialist entry carries `definition:` + `definition_source:` copied from the roster-resolve JSON. Every project specialist also carries the exact compact JSON `definition_ref:` returned by `scripts\u002Fdefinition-ref-for-dispatch.ts`; a missing\u002Funcommitted\u002Fmismatched ref blocks the team write. A specialist minted in step 3 (option A) needs no explicit registry refresh: discovery reads the definition files directly.\n\n5. **Emit the companion `guild.team_plan.v1` (ADDITIVE, FAIL-SOFT — G6b-2b).** After the step-4 yaml write, ALSO emit a typed `team_plan` as a **companion** artifact. Steps 0–4 and every guard above (incl. the NULL-PHASE GUARD) are **UNCHANGED** — this step only ADDS the emit. The `.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml` stays the **AUTHORITATIVE** dispatch input; the team_plan is the machine-typed mirror (roster + the `advisory_panel` challenger trail + `fired_rules`) that downstream gates (quality\u002Fops) and the benchmark can consume.\n   - **Derive a `guild.station_signals.v1` signals block** from the phase's domain signals — the SIX signal keys `team-compose` already reasons about for implied specialists (`## Hard rules` + `team-composition.md §Implied Specialist Rules`): `multi_component`, `auth_touched`, `backend_present`, `user_facing_ui`, `public_docs`, `search_discoverability` (each a boolean; absent ⇒ false). **Do not invent new signals** beyond these six. Set `source_ref` to the spec\u002Fplan path the signals were read from. Serialise `{ \"schema_version\": \"guild.station_signals.v1\", \"signals\": {…}, \"source_ref\": \"\u003Cspec\u002Fplan path>\" }` (to a temp file or stdin).\n   - **Station = the canonical phase token.** The composer's `STATIONS` cover the six lifecycle phases 1:1 (`init ideate plan build qa ops`, plus `research`\u002F`definition`\u002F`learn`), so the active phase **is** its station. If a phase has NO matching station (`isStation(\u003Cphase>)` is false), **SKIP the emit with a logged degradation note** — never fail. Otherwise invoke the CLI:\n     ```\n     node ${GUILD_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME\u002F.local\u002Fshare\u002Fguild\u002Fdist\u002Fclaude-code}}\u002Fruntime\u002Fscripts\u002Fstation-compose.js \u003Cphase> --signals \u003Csignals.json|-> --cwd . --run-id \u003Crun-id> --emit\n     ```\n     It writes the typed `guild.team_plan.v1` (roster + `advisory_panel` + `fired_rules` + `fired_challenger_rules`) to `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>.json` (`scripts\u002Fstation-compose.ts` → `station-signals.ts writeTeamPlan`).\n   - **MIRROR, never a recompose.** The emitted team_plan (roster + `advisory_panel`) is a machine-typed **mirror of the approved proposal** — its participant set MUST equal the approved `guild.team_proposal.v2`'s. If the station CLI's output diverges (an extra\u002Fmissing role vs. the approved set), do NOT dispatch the divergent entries: record the divergence as a degradation note and surface it to the user — adding a participant is a §4 invalidating change requiring a new proposal+decision cycle. *(Historical, CLOSED — do not act on it: through the v2.3 era the station CLI enforced a legacy `TEAM_CAP = 6` \u002F `config.cap`, so an approved roster >6 diverged here by construction. Lane T2b RETIRED that runtime cap; the composer now rejects `cap`\u002F`capped`\u002F`dropped_roles`\u002F`max_team_size`\u002F`team_size` outright. A >6 roster no longer diverges for size reasons, so a divergence here is a REAL defect to surface — never expected, never rubber-stamped.)*\n   - **FAIL-SOFT.** On ANY CLI error (non-zero exit, unknown station, malformed signals), write a one-line degradation-receipt note and **CONTINUE** — the yaml is authoritative, so a missing team_plan never breaks the run.\n   - **Record the emitted `team_plan` path** (or the skip note) in the handoff receipt (`## Handoff`).\n\n**Reuse, never re-create** is load-bearing: an existing `.guild\u002Fagents\u002F*.md` instance joins with no creation step and no *creation* approval (the step-3b team decision gate still covers it like every participant); a template-covered domain mints its instance ONCE (the mint CLI exits `3` on an existing instance — that exit is your reuse signal, not an error). Only a gap covered by neither an instance nor a template can become a newly-created specialist (option A → `guild:create-specialist`) or skill (option A → `guild:create-skill`), and only with explicit per-role\u002Fper-skill approval that clears the mint gate.\n\n## Hard rules\n\nNon-negotiable; if a user request conflicts, raise it before writing `team.yaml`:\n\n- **The logical team is task-derived and UNCAPPED** (dynamic-host-model-routing ADR; frozen `guild.team_proposal.v2` §2). There is NO hard specialist-count cap, NO default size target, and NO truncation\u002Ftail-drop path — propose EVERY specialist you can justify from the goal, phase work, dependencies, risk, ownership boundaries, and required review. A large task honestly yields a large team. *(Historical note: the v2.3-era composer enforced a cap of 6 with a 3–4 default — do not reintroduce it under any name.)* **Migration fence — CLOSED (past state, kept only so the history reads straight):** this rule once carried a temporary fence stating that the station-composer runtime still enforced the legacy `TEAM_CAP = 6` \u002F `config.cap`, so an approved roster larger than 6 would produce a divergent step-5 runtime mirror. **Lane T2b landed and retired that cap** — `TEAM_CAP` no longer exists anywhere in `src\u002F` or `scripts\u002F`, and `station-composer.ts` now REJECTS the retired keys `cap` \u002F `capped` \u002F `dropped_roles` \u002F `max_team_size` \u002F `team_size`. Do NOT expect, tolerate, or pre-emptively refuse a size-driven divergence: there is none. The step-5 mirror-divergence guard remains in force for genuine participant-set divergence (an extra or missing role), which is a real defect and a §4 invalidating change.\n- **Every inclusion is justified, every exclusion is recorded.** Each proposed participant carries a non-empty `necessity_rationale` + `owned_obligations`; each role considered but not proposed lands in `excluded_roles` with `why_unnecessary`. Coverage is validated: an obligation with no owner and no user-accepted exclusion invalidates the proposal.\n- **Backend\u002Fhost capacity is a SCHEDULING concern, never a roster limit** (`guild.team_schedule.v1`). If the backend cannot run the approved team concurrently, propose dependency-valid execution waves (or another backend) and ask the user — never drop, filter, or reorder specialists to fit capacity. Legacy `--team-size N` \u002F `defaults.team.size` are read only as a concurrency *hint* during the migration window (clamped to verified backend capacity, per the frozen §6 precedence); `allow_larger` is a warned no-op. None of these can cap the logical roster.\n- **Architect is implied** on any multi-component build (frontend + backend, service + infra, …).\n- **Security is implied** on anything touching auth, secrets management, or external integrations (third-party APIs, webhooks, OAuth, payment providers).\n- **QA is implied whenever backend is present** in the team. Server-side changes ship with a qa slot by default.\n- **Orchestrator is implicit** — the top-level `\u002Fguild` session coordinates; it occupies no specialist slot and is not a proposal participant.\n- **New specialists must pass their applicable mint gates** before joining. Human-requested roles require prospective boundary\u002Frouting evals but not historical extraction evidence; evolution-proposed roles additionally require all extraction signals and historical shadow replay. A failing create-specialist proposal falls back to options B \u002F C \u002F D.\n\n## Team decision gate (before any dispatch)\n\nImplements the frozen `guild.team_proposal.v2` \u002F `guild.team_decision.v1` \u002F `guild.team_schedule.v1` contracts (dynamic-host-model-routing run, `contracts\u002Fteam-contracts.md` — bound by pointer, never re-spelled; schema fields are normative there). **Every phase that can dispatch composes a proposal and holds at this gate** — all six lifecycle phases (`init · ideate · plan · build · qa · ops`) alike, including advisory panels, cross-host reviewer slots (G-init\u002FG-spec reviewers included), and learn-pipeline agents: if a phase dispatches ANY participant, that participant is in a user-approved proposal first. **Early-phase proposals (`init`\u002F`ideate`):** these phases run before an approved spec exists, so their (typically minimal) proposals are composed by the phase skill itself (`guild:init` \u002F `guild:brainstorm`) *before its first dispatch*, with `spec_ref` pointing at the intake artifact that exists at that moment (init brief \u002F draft spec bytes), and — since the frozen schema requires BOTH refs and no plan exists yet — `plan_ref` set to that SAME intake artifact ref (a deliberate, documented duplication; never omit the field, never invent a placeholder path). The gate requires a justified dispatchable-participant list, not an approved spec. Work the orchestrator session performs itself dispatches no participant and needs no proposal.\n\n- **The proposal is immutable.** `guild.team_proposal.v2` is persisted with a self-referential `proposal_hash` (canonical-YAML SHA-256, hash field omitted from the hashed value). A change is a NEW proposal (`proposal_version`+1, `parent_proposal_hash` set), never an edit. All versions persist under `.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F` — proposals AND their decisions alike, one decision artifact per proposal version (`\u003Cphase>-proposal-v\u003Cn>.yaml` \u002F `\u003Cphase>-decision-v\u003Cn>.yaml`), never overwritten — so the audit trail shows the exact bytes proposed, restructured, decided, and approved.\n- **Exactly one user decision per proposal hash.** `guild.team_decision.v1` records `approve` or `restructure`, `decided_by` a **user identity\u002Fchannel — never an agent**. Guild NEVER auto-approves (autonomy policy: requires confirmation). Present the full proposal — participants with necessity rationale, excluded roles, obligation coverage, and the non-binding wave preview — and WAIT.\n- **Restructure loops preserve the original proposal.** `restructure` edits (`add` \u002F `remove` \u002F `substitute` \u002F `edit_dependencies`) yield a NEW proposal version plus a new PENDING decision; the parent chain keeps every prior version. Coverage is revalidated on each edit — lost obligations are surfaced before acceptance. Restructure is idempotent and can loop any number of times without losing the v1 proposal.\n- **Invalidation.** Any change to a participant, obligation, dependency, tier\u002Fpurpose, capability scope, backend, wave structure, concurrency, cost posture, or review independence invalidates the prior decision and requires renewed user approval.\n- **Dispatch gate (consumed by `guild:execute-plan`).** Dispatch accepts only a current `approve` decision whose `proposal_hash` equals the hash RECOMPUTED from the proposal artifact. Stale or hash-mismatched decisions fail closed.\n- **Scheduling, not truncation.** After approval, backend capacity maps the approved participant set onto dependency-valid `guild.team_schedule.v1` waves — approved id set = base-wave union = dispatch receipts = terminal outcomes (set equality; removal only via a new proposal+decision cycle citing the new decision hash). Retries reuse the same `participant_id`; a failed wave preserves not-yet-terminal ids for resume; resource exhaustion produces an explicit scheduling failure or a user-approved backend\u002Fconcurrency change, never a roster change.\n\n## Execution backend\n\n**`team-compose` does NOT resolve the backend.** The backend is resolved **once at command intake** by `runStartPreflight` (`scripts\u002Flib\u002Frunstart-preflight.ts`) — before run-trace start, before `team-compose` is invoked — applying the **`agent_mode` dispatch ladder** (`CLAUDE.md §\"Backend default — the agent_mode dispatch ladder\"`; ADR D5 of the command-surface dispatch and internalization ADR) and frozen in the run's resolved-settings snapshot (U6). `team-compose` **consumes** `snapshot.effective.agent_mode` (read via `readResolvedSettingsSnapshot`) and **records a mirror** of it in `team.yaml`'s `backend` field for audit\u002Freadability — it neither re-reads `.guild\u002Fsettings.json`, re-runs `scripts\u002Fagent-team-launcher.ts`, nor owns the OD-3 operator ask.\n\nFor reference, the intake-time ladder `runStartPreflight` applies (you do not re-run it here):\n\n- **`auto` (default):** inside tmux (`$TMUX` set) → **agent-team in-session** (a new window in the current session, **one visible pane per specialist**); tmux installed but not currently inside one → **agent-team new-session** (detached session, then attach); host supports independent agents (no tmux) → **agent**; else → **subagent**.\n- **Explicit pin** (`team | agent | subagent`) is honored subject to availability — pinning `team` on a tmux-less host warns and falls back to subagent.\n\n**Team\u002Fagent is PRIMARY whenever tmux is available; subagent is the documented last resort** (CI, fresh installs, no tmux) — never the default on a developer machine.\n\nThe tmux prompt is **evaluated every run**, not once-and-never-again. Ground truth (`runStartPreflight`): `needsTmuxPrompt = tmuxAvailable && effective agent_mode !== \"team\"`. So while `agent_mode` is anything other than `team` (including `auto`), and tmux is available, **each run** surfaces the question. On **yes**, `agent_mode: \"team\"` is persisted via `config-cmd set agent_mode team --scope workspace` (U2 HARD-SET path) — so subsequent runs resolve `team` and the prompt no longer fires. On **no**, nothing is persisted, so the next run prompts again. In this workspace the root is already `team`, so the predicate is false and the prompt stays silent.\n\n`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` must be set for any team spawn; if it is absent when the resolved backend is `team`, the launcher **refuses and surfaces the blocker** (it never silently swaps to subagent — that would change execution semantics out from under the plan). `team.yaml`'s top-level `backend` is a **mirror** of the snapshot-resolved value for readability\u002Faudit — it is **not** the backend authority. The authoritative backend for `guild:plan` and `guild:execute-plan` is the run's resolved-settings snapshot (`snapshot.effective.agent_mode`, written by U6); `team.yaml` remains authoritative for team **composition** (roster, scope, dependencies, tiers, agent-definition paths), not the backend selection.\n\n## Output contract\n\nWrite `teamFilePath(guildRoot, slug, phase)` = **`.guild\u002Fteam\u002F\u003Cslug>.\u003Cphase>.yaml`** (T1; never the legacy single-file `\u003Cslug>.yaml`), and update `.guild\u002Fteam\u002F\u003Cslug>.current` via `writeCurrentPhasePointer`. Full annotated schema + per-field semantics in `gap-handling.md`; the shape is:\n\n```yaml\nspec: .guild\u002Fspec\u002F\u003Cslug>.md\nphase: build               # the phase this team was composed for (self-description\u002Faudit); matches the \u003Cphase> in the filename\nbackend: agent-team        # MIRROR of the snapshot-resolved backend (snapshot.effective.agent_mode) for audit; NOT the authority — execute-plan reads the snapshot. Per-phase files all mirror the SAME intake-resolved value (never re-resolved per phase — ADR A4).\nproposal_ref: .guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>-proposal-v\u003Cn>.yaml   # the approved guild.team_proposal.v2 this file realizes\ndecision_ref: .guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>-decision-v\u003Cn>.yaml  # the approve decision for THAT proposal version (one decision file per proposal version; prior decisions never overwritten)\nspecialists:\n  - name: architect        # exact roster slug\n    participant_id: architect-build-1        # the STABLE id from the approved proposal (constant across retries; the set-equality key)\n    participation_kind: worker               # worker | advisor | challenger | reviewer_local | reviewer_cross_host (from the proposal)\n    purpose: general                         # the model_policy §2 purpose enum from the participant's authoritative role metadata\n    scope: \"One-sentence bounded responsibility for THIS task.\"\n    necessity_rationale: \"Why this phase cannot meet its obligations without this role.\"  # required, non-empty (mirrors the proposal)\n    owned_obligations: [ob-arch-boundaries]  # obligation ids this participant owns (from the proposal coverage map)\n    depends-on: []          # specialist slugs whose handoff this waits on\n    definition: .guild\u002Fagents\u002Farchitect.md   # agent-definition path from roster-resolve (`definition` field).\n                            #   Domain specialists are always PROJECT instances (`.guild\u002Fagents\u002F\u003Crole>.md`,\n                            #   minted from the shipped template) — LOAD-BEARING: dispatch embeds the\n                            #   definition-adoption instruction and the in-process backend swaps\n                            #   subagent_type to the host-generic type. `shipped` appears only on the\n                            #   machinery agents (advisor\u002Fdeveloper), plugin-relative and informational.\n    definition_source: project        # shipped | project — from roster-resolve (`source` field)\n    definition_ref: {\"schema_version\":\"guild.project_definition_ref.v1\",\"project_id\":\"\u003Cproject>\",\"layer\":\"project-guild\",\"kind\":\"agent\",\"id\":\"architect\",\"relative_path\":\".guild\u002Fagents\u002Farchitect.md\",\"content_hash\":\"sha256:\u003C64hex>\",\"source_commit\":\"\u003Ccommit-or-null>\",\"specialist_profile_hash\":\"\u003C64hex>\",\"specialist_type_hash\":\"\u003C64hex>\",\"skills\":[]} # exact one-line `result.ref` from definition-ref-for-dispatch; never hand-built\n    default_tier: powerful  # cheap|mid|powerful — roster-resolve derives it from the agent's `default_tier:`\u002F`model:` frontmatter per the canonical roster ADR (a default, NOT a pin)\n    implied-by: \"multi-component\"   # or omit if user-requested\n    capability_scope:       # explicit override; canonical defaults are runtime-materialized when absent\n      - \"Read\"\n      - \"Write\"\n      - \"Edit\"\n      - \"Glob\"\n      - \"Grep\"\nexcluded_roles:\n  - role_ref: data-scientist\n    why_unnecessary: \"No ML surface in this phase's obligations.\"\ngaps_resolved:\n  - proposed_role: data-scientist\n    resolution: \"B\"         # A \u002F B \u002F C \u002F D\n    notes: \"User accepted missing coverage; flagged in final report.\"\ncoverage_flags:\n  - \"No specialist covers ML modelling (B on data-scientist gap).\"\n```\n\n`implied-by` records which hard rule triggered an inclusion (`multi-component`, `auth-touched`, `backend-present`) for audit. The roster is **uncapped** — it lists every participant of the approved proposal, exactly; no entry may be dropped to fit a size target or backend capacity (`## Hard rules`).\n\n## Default tier per specialist\n\nEach composed specialist carries a **default model tier** (`cheap | mid | powerful`). **Do not maintain a tier table here — enumerate it from source.** Canonical ADR: the specialist-roster-groups-and-tiers ADR (D4 enumeration rule, D2 default-tier table, D3 default-vs-dispatch split). The root cause of the prior drift (R-003) was three sources extrapolating disagreeing tier tables from a cost-aware ADR §7 that only tabulated 5 augmenting types — so this skill no longer keeps its own.\n\n- **Default tier = the specialist's frontmatter**, surfaced as `default_tier` in the roster-resolve JSON: an explicit `default_tier:` frontmatter key wins; otherwise the `model:` line is mapped through the cost-aware-tiering §1 ladder (`opus`=powerful, `sonnet`=mid, `haiku`=cheap; unknown models default `mid`). Consume it from the resolver output **at compose time** — never a hand-maintained list. This structurally prevents the tier drift from recurring, and it applies identically to project-local specialists (killing the old \"project mint runs at `mid`\" degradation).\n- The tier→model host map is the closed-key `models.tiers` block (cost-aware ADR §10 — bound by pointer, never re-spelled here).\n\nCanonical default tiers for the 15 domain type templates (the ADR D2 table — a **derived view** of the `templates\u002Fspecialists\u002F*.md` frontmatter, inherited verbatim by minted instances; if it ever disagrees with the files, the files win):\n\n| Default tier | Specialists |\n|---|---|\n| `powerful` | architect, security |\n| `mid` | researcher, backend, frontend, mobile, devops, qa, copywriter, doc-writer, technical-writer, social-media, seo, marketing, sales |\n\n(Machinery agents, per cost-aware ADR §7: `advisor`=powerful, `developer`=mid — they augment, never count toward the domain roster.)\n\n**Research-purpose floor (authoritative, transitive, non-downgradable).** Each participant carries a `purpose` (the `guild.model_policy.v2` §2 enum) sourced from its **authoritative role definition** (`work_class`\u002Fpurpose frontmatter on the agent\u002Ftemplate — T1b metadata), never guessed from the lane label. A `purpose: research` participant resolves `effective_complexity: hard` \u002F `tier: powerful` (`research_always_hard`), and the floor is **transitive through every handoff**: descendants, advisor consults, retries, resumes, and generic sub-dispatches inherit it and can NEVER downgrade it — no auto-score, `--model-tier` pin, or cheap-lane default lowers a research lane. Record `forced_floor_reason: research_always_hard` wherever the floor fires.\n\n**Default tier ≠ per-lane dispatch tier (ADR D3).** The default above is the single tier the specialist runs at when dispatched as that type — not a pin. The actual dispatch tier is the cost-aware §2 auto-score computed **per lane**: it may lower a simple lane below its default (a mechanical `doc-writer` edit, template-guided content\u002Fcommercial generation → `cheap` — but NEVER a `purpose: research` lane, whose floor is absolute per the paragraph above) or escalate a hard one (a security-critical lane → `powerful` via the §3 advisor). `--model-tier` \u002F per-lane plan override \u002F the §2 score decide the final dispatch tier (ADR §10 precedence). The old `cheap→mid` \"default\" notation is **retired** — a cheap floor for mechanical lanes is a property of the §2 scorer, not a dual-valued default. Self-build dev-team lanes inherit by the same frontmatter read (`plugin-architect`→powerful; code\u002Fskill\u002Fhook\u002Ftooling lanes→mid; `docs-writer`→mid, with the §2 cheap floor for mechanical edits).\n\n## Capability scope defaults\n\nImplements the capability-scoping contract from the v2 security ADR (bound by pointer). The `capability_scope:` field is additive for unknown\u002Fproject-defined roles. For the 15 canonical domain roles, an omitted field is materialized from the source-owned defaults below before dispatch; it never means \"inherit every host tool\". An explicit scope wins because it is hash-bound by the approved team decision. The resolved value is serialised as `GUILD_CAPABILITY_SCOPE` (JSON string array) by `guild:execute-plan` at dispatch so the PreToolUse hook can enforce it.\n\nDerive `capability_scope` from the role→scope defaults below. Override when a task's narrower scope warrants it (e.g. a security audit lane may restrict even further); widen only when explicitly justified. `researcher` is the only role with network-capable tools by default. A different role may receive `WebSearch` or `WebFetch` only after the operator explicitly approves that exception for the task; record the approval in the team decision before dispatch.\n\nRule syntax follows Claude Code's own permission-rule grammar (bound by convention — see `hooks\u002Flib\u002Fsecurity\u002Fenforce.ts`):\n- `\"ToolName\"` — matches any call to that tool.\n- `\"ToolName(glob)\"` — matches only when the argument string matches the glob.\n\n| Role group | Default `capability_scope` | Rationale |\n|---|---|---|\n| `architect` | `[\"Read\",\"Write\",\"Edit\",\"Glob\",\"Grep\"]` | Reads codebase, writes ADRs\u002Fdocs; no Bash or external requests needed. |\n| `researcher` | `[\"Read\",\"Glob\",\"Grep\",\"WebSearch\",\"WebFetch\"]` | Read + search only; no file writes, no shell. |\n| `backend`, `frontend`, `mobile`, `devops` (build lanes) | `[\"Read\",\"Write\",\"Edit\",\"Bash\",\"Glob\",\"Grep\"]` | Needs full read\u002Fwrite\u002Fbash to implement a lane. |\n| `qa` | `[\"Read\",\"Write\",\"Edit\",\"Bash\",\"Glob\",\"Grep\"]` | Runs tests and writes fixtures; same profile as build lanes. |\n| `security` | `[\"Read\",\"Glob\",\"Grep\"]` | Audit-only by default: local read + search; no writes, external requests, or unguarded bash. |\n| `doc-writer`, `copywriter`, `technical-writer` | `[\"Read\",\"Write\",\"Edit\",\"Glob\",\"Grep\"]` | Reads source, writes doc files; no shell or external requests. |\n| `seo`, `social-media`, `marketing`, `sales` | `[\"Read\",\"Write\",\"Edit\",\"Glob\",\"Grep\"]` | Reads project-provided evidence and writes copy\u002Fconfig files. If the task requires fresh external evidence, request a task-scoped operator-approved web-tool exception and record it in the team decision. |\n\nSelf-build dev-team lanes inherit by analogy: `plugin-architect`→`architect` scope; skill\u002Fhook\u002Fcommand\u002Ftooling lanes→build-lane scope; `docs-writer`→doc-writer scope; `eval-engineer`→build-lane scope.\n\n## Handoff\n\nHand off to `guild:plan` with the **resolved per-phase team-file path** as its argument (the `teamFilePath(...)` result just written, e.g. `.guild\u002Fteam\u002F\u003Cslug>.build.yaml` — not a reconstructed `\u003Cslug>.yaml`). Do not proceed into planning yourself — `guild:plan` is a separate skill. Handoff receipt lists: `team_path` (the per-phase path), `phase`, `proposal_ref` + `proposal_hash` + `decision_ref` (the approved `guild.team_proposal.v2` chain — including any restructure versions — and its `guild.team_decision.v1`), `specialist_count` (audit fact of the approved set, never a target), `backend`, `gaps_resolved` count (incl. any A→`create-specialist`\u002F`create-skill` mints and their gate outcome), whether any `implied-by` rule fired, the per-specialist `default_tier` assignments (so `guild:plan` can carry them onto each lane's `complexity_score` + chosen tier), and `team_plan_path` — the companion `guild.team_plan.v1` emitted at step 5 (`.guild\u002Fruns\u002F\u003Crun-id>\u002Fteam-plan\u002F\u003Cphase>.json`), or the fail-soft skip note if emission was skipped\u002Ffailed (so `guild:execute-plan` can wire its `team_result` `team_plan_ref` to it).\n",{},"main","2e58b0360ca51ca3c96ca8e015ef5aba5738803d","skills\u002Fmeta\u002Fteam-compose",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 team-compose",{"tool":37,"command":38},"bunx","bunx skills add lookatitude\u002Fguild --skill team-compose",{"tool":40,"command":41},"pnpm","pnpm dlx skills add lookatitude\u002Fguild --skill team-compose","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fteam-compose\u002FSKILL.md",true,[45,51],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"evals.json","REFERENCE","参考文档",726,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fteam-compose\u002Fevals.json",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"gap-handling.md",7953,"https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fteam-compose\u002Fgap-handling.md",[56,62,68,74,80,86],{"skillNo":57,"name":58,"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":59,"categories":60,"keywords":61,"publishedAt":18},"01M73RXDTR96SBKTEEE35JMWS7","technical-writer-tutorial","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Ftechnical-writer-tutorial\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"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":65,"categories":66,"keywords":67,"publishedAt":18},"01M73RX9FY2GNEZT1S2SJZH307","social-media-thread","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fsocial-media-thread\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"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":71,"categories":72,"keywords":73,"publishedAt":18},"01M73RWY3CNA6HP52QC65XTZ5A","security-dependency-audit","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fsecurity-dependency-audit\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"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":77,"categories":78,"keywords":79,"publishedAt":18},"01M73RWBSKQXZ13SVRGS5K1K72","marketing-launch-plan","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fmarketing-launch-plan\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"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":83,"categories":84,"keywords":85,"publishedAt":18},"01M73RW8DJAG381R94DN6KSTEG","marketing-ab-copy-variants","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Fmarketing-ab-copy-variants\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"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":89,"categories":90,"keywords":91,"publishedAt":18},"01M73RW44HRQJTJ33V12SVS612","frontend-bundler-config","https:\u002F\u002Fgithub.com\u002Flookatitude\u002Fguild\u002Fblob\u002Fmain\u002Fskills\u002Fspecialists\u002Ffrontend-bundler-config\u002FSKILL.md",[],[]]