Orchestration worker selection (#2648)

The 2026-11-24 decision for #2642 remains binding: configuration extends models.json.defaults.workerSelection; there is no new delegation config root.

Orchestration worker selection (#2648)

Prompt-first procedure: Describe the outcome you want in your agent conversation. The agent should select and load the appropriate AIWG assets, explain material changes, request any needed approval, and report verification evidence. Exact commands and flags appear only in the CLI reference.

The 2026-11-24 decision for #2642 remains binding: configuration extends `models.json.defaults.workerSelection`; there is no new delegation config root. `ConfigLoader` merges builtin → user → project and rejects a project that widens an inherited automatic ceiling. See the foundation contract.

`src/models/delegation.ts` supplies `resolveDelegation()` for native orchestration launches. It reads current config on each resolution, chooses the task/agent role, applies role guidance and agent minimums, resolves the tier to a provider model, and builds the existing wrapper envelope. Explicit agent/provider pins survive. Recognized premium/flagship identities and aliases cannot hide under a cheap tier label. A placeholder stops the work unit. An exact native CLI pin can be passed when agent frontmatter cannot enforce it; the surface warning is retained. The caller must send the resolved model to the launch seam.

Native workers default to coding/standard; inventory maps to efficiency/economy. An explicit economy tier without a role also selects efficiency. A configured role remains a capability floor. The native default ceiling is standard, premium requires explicit human authorization, and flagship requires `election: user`. An exact pin alone does not elect flagship. A session model is never a worker input. Native bindings provide one model per tier; strategy cannot invent extra candidates. Qualified dispatch retains the shared resolver's existing strategy ranking over eligible model tuples, observed pricing classes and all eligibility, freshness, data-policy, permission, budget and admission checks.

Launch inventory

PathOwner / behavior
Mission skill`agentic/code/addons/aiwg-utils/skills/aiwg-mission/SKILL.md`: assign wrapper and tier during decomposition; resolve before native or external launch.
Mission conductor`src/serve/mission-conductor.ts` → `cycle-delegation.ts`: sends explicit model and routing record to `RunWorker`; logs the record. Recovered effects and plan-only cycles do not launch.
Fleet conductor`src/serve/fleet-mission-conductor.ts`: same selection before each `RunFleetWorker`; an unsupported runtime fails that child.
MC native`src/cli/handlers/mc-run.ts`: resolve eligible queued work before admission/cost warning, pass tier to Ralph, log routing in `mission_started`.
MC managed`mc-worker.ts`: retain `resolveWorkerInvocation()` and project worker authority; project its qualified selection into the same routing record. Explicit tiers must match the resolved tier.
Flow managed`createMcFlowAdapter()` in `mc-worker.ts`: retain shared resolver/admission, pass routing in `context.prepared.routing`. Generic composition adapters execute host-supplied operations; no new transport is added.
Five native flow skillsDelegation reference: explorer for artifact reading, verifier for gate checks, specialist frontmatter as requirements. Resolve with the agent-owned models operation before invocation; record common fields.
Ralph native`tools/ralph-external/lib/ralph-cycle-launch.mjs` → `ralph-delegation.mjs`: resolve before every cycle, pass explicit model to session launcher, persist `routing.json` beside the attempt.
Ralph group`lib/ralph-group-cycle.mjs`: existing invocation resolver and shared admission; persist the qualified selection as `routing.json`.
Team OMP`tools/providers/omp-teams.mjs`: resolve all leaf assignments before creating clients, pin coordinator and child, persist routing in task results. No `@task`/`@slow`/`@smol` fallback.
Team Claude`team.ts` / `team-delegation.ts`: resolve every member before printing explicit native wrapper/model instructions. This CLI prints instructions; it does not invoke Claude's in-session team tool.
Other team providersWarn that this command has no native per-worker control; forward the worker-tier option on the existing MC handoff.

Ralph's parser, orchestrator and state manager no longer supply a model fallback. Explicit the model option elects that operator pin at the CLI boundary; new loop state persists the election. Old saved model defaults do not become user elections when resumed. OMP library callers must supply `election: 'user'` for flagship; public the model option supplies it explicitly. Premium authorization remains separate.

Preview and records

Use AIWG to complete this documented outcome: Preview and records
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

`mc start` creates an empty session; it does not have workers to preview. Use `mc run the dry-run option the json option` on a queued session to inspect `.workers[].tier`. Preview performs resolution but does not launch workers or persist session edits.

Every routing record has the same fields:

{
  "version": 1,
  "orchestrator": "mc",
  "workerId": "bounded-worker",
  "role": "efficiency",
  "requested_tier": "economy",
  "resolved_tier": "economy",
  "resolved_model": "claude-haiku-4-5",
  "wrapper": "aiwg-model-efficiency-worker",
  "strategy": "cost-effective",
  "max_auto_tier": "standard",
  "election": null,
  "warnings": []
}

`requested_tier: null` means role policy supplied the tier. Qualified legacy dispatch preserves omitted strategy as balanced/configured ordering and an omitted ceiling as `max_auto_tier: null`; native defaults are stated above. Warnings preserve catalog and model-surface limitations. These are requested launch facts, not observed backend model attestations or accepted worker claims.

MC cost planning uses a tier coefficient per iteration (economy 0.20, standard 1.60, premium 3.90, flagship 8.00 USD). These are heuristic planning numbers, not measured provider prices. The standard coefficient preserves the previous Sonnet assumption. Declared spend ceilings reduce estimates only for providers whose spend is observable; unobservable ceilings still cannot lower the warning.

Offline boundaries

Synthetic tests prove resolver calls, refusal paths, records, exact launch options and cost variation. They do not prove a live account accepted the model or that a native team tool consumed printed instructions. Those checks need a provider login and an operator-authorized model call; no such calls were made for #2648. CLI subprocess fixtures also require a host that permits process execution; the worker sandbox can reject those with `spawnSync ... EPERM`.

The five named flow skills are updated. The remaining flows are tracked on issue #2648 with the checklist below.

Flow rollout checklist

  • [ ] `flow-architecture-evolution`
  • [ ] `flow-change-control`
  • [ ] `flow-compliance-validation`
  • [ ] `flow-concept-to-inception`
  • [ ] `flow-construction-to-transition`
  • [ ] `flow-cross-team-sync`
  • [x] `flow-delivery-track`
  • [ ] `flow-deploy-to-production`
  • [ ] `flow-discovery-track`
  • [ ] `flow-elaboration-to-construction`
  • [x] `flow-gate-check`
  • [x] `flow-guided-implementation`
  • [ ] `flow-handoff-checklist`
  • [ ] `flow-hypercare-monitoring`
  • [ ] `flow-inception-to-elaboration`
  • [ ] `flow-incident-response`
  • [ ] `flow-iteration-dual-track`
  • [ ] `flow-knowledge-transfer`
  • [ ] `flow-performance-optimization`
  • [ ] `flow-release`
  • [ ] `flow-requirements-evolution`
  • [ ] `flow-retrospective-cycle`
  • [ ] `flow-risk-management-cycle`
  • [x] `flow-security-review-cycle`
  • [ ] `flow-team-onboarding`
  • [x] `flow-test-strategy-execution`

Routing telemetry and offline reports (#2651)

The existing activity log carries additive `aiwg-telemetry: {…}` body lines beneath its unchanged operation headers. Worker records contain a unique attempt ID, session, orchestrator, worker ID, requested/resolved tiers, selected and observed models, input/output tokens, UTF-8 returned-summary bytes, tri-state result use, and observed USD. They contain no prompts, outputs or credentials. The selected model is a resolver fact; actual backend identity remains unknown without an observation. `null` means unknown, including omitted requested tiers. A reported zero stays zero. Estimated usage, reservations and runtime cost units never become measured tokens or USD. Summary size counts the returned summary, not the entire transcript. Use records consumption, independently of acceptance.

Use AIWG to complete this documented outcome: The existing activity log carries additive aiwg-telemetry: {…} body lines beneath its unchanged operation headers. Worker records contain a unique attempt ID, session, orchestrator, worker ID, requested/resolved tiers, selected and observed
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

Both report modes read the activity-log storage backend without provider calls. the activity-log option explicitly selects an offline file. the session option matches the literal session ID (there is no inferred `current` session). Updates to one attempt ID replace that attempt's prior snapshot for reporting; separate retries and loop iterations remain separate attempts. Tier groups separate requested and resolved tier/model combinations. A total with any unmeasured worker is unknown; its separately labeled reported subtotal and unknown count remain available. Legacy logs without telemetry produce empty observations, not free workers or a zero context measurement. Fleet flags cannot mix with the by-tier option. MC handoffs and their Ralph children have different session/attempt identities; use session scoping when comparing layers, rather than summing nested handoffs.

Orchestrator context is the maximum observed live context within a session, including observations before compaction. It is never cumulative worker usage, reserved capacity, or the existing token-counter character heuristic. Hosts pass their project `cwd` to Mission/Fleet conductors for durable telemetry; without a project root no storage target is inferred. Hosts can supply `observeOrchestratorContext` to those conductors; they must return an actual count or null. Sampling brackets each worker and the end of the pass. Resume reads the prior peak and attempt history from the project activity log by session ID. Mission, Flow and Fleet ledgers retain their pinned bytes: telemetry never enters their activityLog arrays or adds ledger fields. Worker return values and errors are unchanged; failed telemetry is advisory. This sampled maximum does not establish that unsampled intervals were observed. Uninstrumented native hosts remain unknown.

Path from #2648Telemetry emission and observation limits
Mission conductor, ordinary/dependency/growth/retry cyclesYes: each actual `RunWorker` attempt; reported adapter usage, summary bytes; best-output selection records use. Plan-only, blocked and recovered-effect cycles do not fabricate workers.
Typed Flow / GraphPlaybook through Mission conductorYes: same attempt wrapper; successful typed bindings record use.
Mission loop bodiesYes: each body iteration has its own ID; verifier consumption records use, including rejected iterations.
Fleet conductor (persistent-agent, daemon, scheduled-collector, one-shot-command)Yes: same wrapper for every admitted child; provider data absent at the fleet seam stays unknown. Selected best output records use.
MC native directYes: routing and unknown measurements at the Ralph handoff; Ralph measures actual child cycles separately. `mc run` skips PTY missions and emits no worker telemetry for them.
MC managed captureYes: routing at handoff, capture completion adds validated claims-summary bytes; unobserved usage/use remain unknown.
Flow managed composition adapterYes: invocation records prepared routing, reported managed-evidence usage and optional returned summary. Typed composition output is host-specific; use stays unknown unless supplied by the host.
Ralph native, including continuation and uncataloged providersYes: attempt routing, per-field stream usage observation flags, terminal summary bytes when present; analyzer consumption appends use=true. Unsupported tier/model identity remains unknown.
Ralph groupYes: qualified routing after admission, completion with available measurements and analyzer consumption. Missing group usage is unknown.
OMP native team leaves, including flattened descendantsYes: one routing record per leaf; returned coordinator-summary bytes; leaf token/spend data is unknown when the native tool does not expose it. Result delivery alone does not prove parent use.
Claude native team instructionsYes: a handoff observation per member, with ID printed in routing; no claim that printed instructions launched a native worker. Host supplies subsequent observations.
Other team providersMC handoff instructions only; actual emissions occur when MC/Ralph runs them. No worker observation is fabricated for printed commands.
Mission skill native dispatchGoverned host emission through the activity-log flags below; provider-native tool calls cannot be observed automatically by this CLI.
Five named native Flow skillsSame host emission contract in each delegation reference: delivery-track, gate-check, guided-implementation, security-review-cycle, test-strategy-execution. Other flows remain outside #2648's rollout.
MCP mission-dispatch / Flow materializationDispatch forwards to MC; execution emits through the owners above. Planning/materialization alone is not a measured worker.

For host-native launches, the existing activity-log CLI accepts observations:

Use AIWG to complete this documented outcome: For host-native launches, the existing activity-log CLI accepts observations
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

Start prints the attempt ID. Update only known measurements; omitted fields stay unchanged. `unknown` explicitly clears a numeric observation. Use accepts `true`, `false`, or `unknown`. These are host observations, not independently verified attestations. The effect ledger continues to own effect identity, reconciliation and completion; telemetry never creates a signed acceptance or changes replay policy. Activity-log opt-out and non-blocking failure behavior remain in force. Storage routing honors external artifact and backend roots. Telemetry appends are serialized per project within a process, including adapters that require read/replace. The filesystem backend supplies atomic append for separate processes. Read/replace backends cannot guarantee concurrent writes from separate processes, independent project aliases sharing one storage root, or other writers outside this queue; use an atomic-append backend for those cases. Parallel-worker tests check complete records and distinct attempt IDs for both filesystem append and a deliberately racy read/replace adapter. Resume requires retaining the session's activity-log observations; rotated or removed history is unavailable to the conductor. No separate telemetry store or ledger is created. Ralph routing.json and resolver records retain their original fields; native team instruction envelopes also print the observation ID for host updates. Correlation is held in memory during an attempt and recovered from activity_log by session ID for consumption and resume.

Offline promotion gate definition

The existing topology-lab runner accepts only a dry run for the #2651 definition:

Use AIWG to complete this documented outcome: The existing topology-lab runner accepts only a dry run for the #2651 definition
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

The plan covers a code-change task set and research synthesis, three tasks per family, three repeats with the same prompts and seeds where supported, and four arms: current advisory/flagship, advisory/premium, experimental default with cost-effective, and experimental default with balanced. That is 72 planned sessions and 180 illustrative model calls. At the fixture's explicitly hypothetical token/price assumptions the planning scenario is USD 19.5642 before unplanned retries. Actual cost is unknown; freeze prompts, independent acceptance contracts, actual prices and retry budgets before execution.

All seven proposed checks retain the issue's thresholds: context reduction at least 30%, accepted-task rate within five percentage points of baseline, primary cost per accepted task lower than flagship and no higher than premium, compare cost-effective with balanced for better value, delegation precision at least 70%, contradictions no higher than baseline, and rework no higher than baseline. The dry run emits raw=null and NOT RUN for each. Thresholds remain unconfirmed; this patch makes no model calls, flips no default, and records no epic promotion decision. A future confirmed study must publish raw per-run observations and threshold verdicts under the configured artifact root's reports directory, link the report on the epic, and retain advisory plus MAST failure-mode follow-ups if the gate fails. A passing study still requires the separate config issue to change scaffold defaults.