You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[repo-study-fable-advisor-orchestration-profiles] Add an orchestrated CoS execution mode with per-role provider/model and per-step reasoning effort #5992
A CoS task resolves one provider and one model for its entire run, so a user who wants strong reasoning for the planning pays that model's rate for the mechanical editing too. This phase adds an opt-in orchestration profile — architect / implementer / reviewer roles, each with its own provider+model — and the per-step spec contract that makes delegating to a context-free lane safe.
What exists today (the gap is real)
selectModelForTask (server/services/agentModelSelection.js) picks ONE model tier at spawn from task.metadata.model / metadata.provider, complexity heuristics and taskLearning's suggestModelTier. There is no role dimension.
agentProviderResolution.js resolves one provider per run.
agentPromptBuilder.js builds one prompt for one agent.
Fix
server/lib/validation.js — add an orchestrationProfile schema: { architect: {provider, model, effort}, implementer: {provider, model, defaultEffort}, reviewer: {provider, model, effort} }, plus executionMode: 'direct' | 'orchestrated' on the CoS task input schema. Keep direct the default so existing tasks are untouched.
server/services/agentModelSelection.js — add selectModelForRole(task, role, provider, agent) alongside selectModelForTask; the existing entry point becomes the direct-mode / architect-role caller so current behavior is byte-identical when no profile is set.
server/services/thinkingLevels.js — let a resolved effort be carried per delegated step rather than only per run; the architect names REASONING: <rung> in each spec and the lane passes it through unchanged (never rounds it — an unsupported rung is an error, not a downgrade).
server/services/agentPromptBuilder.js — when executionMode === 'orchestrated', splice in the architect doctrine: emit specs not code, delegate exploration, and carry all six spec parts (objective, files, interfaces, constraints, verification command, reasoning effort) into every delegated unit, since the lane shares none of the architect's context.
server/services/cosTaskStore.js + the CoS task DB schema — persist executionMode and the profile; keep schema parity per server/AGENTS.md and add a migration under scripts/migrations/ with the seed in data.reference/.
Client: a profile picker on the CoS task form and in /ai, with the storage-classification checklist in docs/STORAGE.md applied to the profile record.
Notes
Profiles are per-install config, not a federated record — keep them machine-local.
No cold-bootstrap calls: the profile only takes effect when a task actually runs.
Scope: medium-large — schema + migration + two service entry points + prompt assembly + one settings surface.
Phase 1 of #5991.
Provenance: studied
DannyMac180/fable-advisor(MIT, © 2026 Dan McAteer) on 2026-09-03. Clean-room — the technique is reimplemented against PortOS modules, nothing is copied.Rationale
A CoS task resolves one provider and one model for its entire run, so a user who wants strong reasoning for the planning pays that model's rate for the mechanical editing too. This phase adds an opt-in orchestration profile — architect / implementer / reviewer roles, each with its own provider+model — and the per-step spec contract that makes delegating to a context-free lane safe.
What exists today (the gap is real)
selectModelForTask(server/services/agentModelSelection.js) picks ONE model tier at spawn fromtask.metadata.model/metadata.provider, complexity heuristics andtaskLearning'ssuggestModelTier. There is no role dimension.resolveThinkingLevel/getModelForLevel(server/services/thinkingLevels.js) resolve a single effort for the whole run fromtask.metadata.thinkingLevel(task → agent → provider precedence). Per-step effort does not exist; Pipeline stage LLM calls can't set a reasoning effort — thread it as a soft run-level default #3641 shipped only a soft run-level default for pipeline stages.agentProviderResolution.jsresolves one provider per run.agentPromptBuilder.jsbuilds one prompt for one agent.Fix
server/lib/validation.js— add anorchestrationProfileschema:{ architect: {provider, model, effort}, implementer: {provider, model, defaultEffort}, reviewer: {provider, model, effort} }, plusexecutionMode: 'direct' | 'orchestrated'on the CoS task input schema. Keepdirectthe default so existing tasks are untouched.server/services/agentModelSelection.js— addselectModelForRole(task, role, provider, agent)alongsideselectModelForTask; the existing entry point becomes thedirect-mode / architect-role caller so current behavior is byte-identical when no profile is set.server/services/thinkingLevels.js— let a resolved effort be carried per delegated step rather than only per run; the architect namesREASONING: <rung>in each spec and the lane passes it through unchanged (never rounds it — an unsupported rung is an error, not a downgrade).server/services/agentPromptBuilder.js— whenexecutionMode === 'orchestrated', splice in the architect doctrine: emit specs not code, delegate exploration, and carry all six spec parts (objective, files, interfaces, constraints, verification command, reasoning effort) into every delegated unit, since the lane shares none of the architect's context.server/services/cosTaskStore.js+ the CoS task DB schema — persistexecutionModeand the profile; keep schema parity perserver/AGENTS.mdand add a migration underscripts/migrations/with the seed indata.reference/./ai, with the storage-classification checklist indocs/STORAGE.mdapplied to the profile record.Notes
Scope: medium-large — schema + migration + two service entry points + prompt assembly + one settings surface.