Repository navigation
Description
Blocked by #1227 (Phase 0 arms need a correct resolved model; see the 2026-09-30 comment)
Context
Claude Code's advisor tool (experimental, docs: https://code.claude.com/docs/en/advisor) gives the main model a parameterless advisor() server tool backed by a second model. Each call forwards the full conversation (every tool call and result) to the advisor, which returns guidance. The harness prompt tells the model to call it before substantive work, before declaring done, when stuck, and when changing approach; timing is model-driven and there is no cap/force setting — frequency is steered by prompt text only.
Facts verified 2026-09-24 against the docs, the CLI binary, and the installed SDK:
- Pairing: the advisor must be at least as capable as the main model. Sonnet 5 → Fable / Opus ≥ 4.7 / Sonnet 5; Opus 5.5 → Fable / Opus ≥ 5; Haiku can call but not advise. A refused pairing silently drops the advisor for the rest of the conversation.
- Enablement:
advisorModelsettings key,--advisor <model>(absent from--help),/advisor(headless text form needs CLI ≥ 2.1.260). Kill switchCLAUDE_CODE_DISABLE_ADVISOR_TOOL=1. - Reaches Sequant today with zero code:
src/lib/workflow/drivers/claude-code.tspassessettingSources: ["project"], so a project.claude/settings.jsonadvisorModelapplies to every phase. The SDK bundles CLI 2.1.263 andsdk.d.tsexposesSettings.advisorModel, settable per call viaquery({ settings })— the SDK reference docs do not list it yet, the typings do. - Subagents inherit it and re-check pairing against their own model. Caveat: upstream #76381 (v2.1.206, closed stale 2026-09-15) reported background subagents do not inherit it;
exec/SKILL.md§Parallel Groups spawns implementers in the background. - Cost: advisor tokens bill at the advisor's rates and the advisor's read is never cached — every call re-reads the whole transcript. Toggling it does not bust the main model's cache.
- Requirements: Anthropic API only (no Bedrock / Vertex / Foundry); needs feature-flag fetching (any
DISABLE_TELEMETRY-style var keeps it off; Sequant sets none).
Relation to existing levers. Sequant's two escalation mechanisms — --escalate-effort (#915) and --model-ladder (#971/#995) — are retry-based and off by default; .sequant/metrics.json has recorded 0 escalations to date. The advisor is a different lever: in-turn and proactive. It is not a replacement for either.
Two design facts that shape this issue:
- The advisor cannot be fed context directly. It sees exactly what the main model sees, so "give the advisor the session log" means "put the log in the phase prompt", which the main model then carries all phase and the advisor re-reads uncached on every call. The right inputs are the small structured artifacts Sequant already produces: the previous iteration's structured QA gap findings (feat(qa/loop/ready): structured gap findings — finite taxonomy with required evidence, replacing the lossy prose-scrape gap channel #937), the ladder evidence bundle (SHAs tried, verdicts per iteration), and the spec comment. Not the log.
- It must be an optional dependency. Same pattern as feat(run): per-phase model and effort configuration for the claude-code driver #914 model/effort: absent by default, omitted from
query()options entirely when unset, honored only by the claude-code driver, ignored by Codex/opencode, never mentioned in any skill (keeps the three mirrors clean and Bedrock/Vertex users unaffected).
Fix shape
Phase 0 — measure before building (the whole issue is gated on this). Add "advisorModel": "opus" to the dogfood project's .claude/settings.json (no code change) and replay 3–4 already-solved issues through exec at the current sonnet/medium pin, at least one with a ## Parallel Groups section. Compare against the same issues' recorded baseline on the #916 discriminators — verdict mix, loop iterations, wall time, tokensUsed (correct since #986/#1010) — and confirm from the transcripts (a) how many advisor calls fired per phase and where, (b) whether background parallel-group implementers ever called it. Write the null result first per the measurement discipline: if advisor-on and advisor-off show the same verdict mix and loop count, the report says so and the build ACs are closed as not needed.
Build (only on a GO from Phase 0):
run.phases.<phase>.advisor(andrun.advisordefault) in.sequant/settings.json, plus--advisor <model|phase=model,…>onsequant run/sequant ready, resolved through the sameresolvePhasePoliciesresolver feat(run): per-phase model and effort configuration for the claude-code driver #914 added so both ExecutionConfig producers (buildExecutionConfig,ready-gate.ts:buildPhaseConfig) agree (fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833 drift guard).- Driver: claude-code passes
settings: { advisorModel }only when resolved; Codex/opencode/aider drivers ignore it;sequant doctorwarns when it is set for a backend that cannot honor it or when the phase model / advisor pairing is one the docs list as rejected. - Metrics:
phaseUsagerows recordadvisorModeland the advisor call count (from the transcript'sadvisortool uses) so cost/effect is auditable per run, next to the feat(run): per-phase model and effort configuration for the claude-code driver #914 fields. - Retry rung (design only here; file separately on GO): on the same signal
--escalate-effortkeys on (loop iteration ≥ 2 / no-progress retry), turn the advisor on for the retried phase and inject the previous iteration's structured gap findings into the retry prompt — giving the ladder three rungs, effort → advisor → model.
Acceptance criteria
- AC-1:
docs/investigations/advisor-tool-phase0-2026-09.mdexists, reports advisor-on vs advisor-off for ≥ 3 replayed issues on verdict mix, loop iterations, wall time, andtokensUsed, quotes the per-phase advisor call count from the transcripts, states whether background parallel-group implementers called it, and opens with the null-result criterion that would make the measurement meaningless. - AC-2: The report ends with an explicit
GOorNO-GOfor the build track with the numbers that decide it; onNO-GO, AC-3…AC-7 are closed in the PR body as not needed and the issue closes with the report alone. - AC-3:
run.phases.<phase>.advisor,run.advisor, and--advisorare parsed with CLI > settings > absent precedence through the sharedresolvePhasePoliciesresolver, and an unset value leaves thequery()options object with nosettings.advisorModelkey — Verify: key-presence unit test mirroring the feat(run): per-phase model and effort configuration for the claude-code driver #914 AC-3 test. - AC-4: Only the claude-code driver forwards the advisor; the Codex, opencode, and aider drivers ignore it — Verify: driver-options unit tests per driver.
- AC-5:
sequant doctorwarns when an advisor is configured for a non-claude-code backend or when the phase model / advisor pairing is one the docs table rejects, and stays silent when unset — Verify: doctor unit test. - AC-6:
phaseUsagerows carryadvisorModelandadvisorCallsfor phases that ran with an advisor and omit both keys otherwise — Verify: metrics unit test. - AC-7:
docs/reference/run-command.mdanddocs/reference/model-ladder.mddocument the setting, the pairing rule, the uncached full-transcript cost, the Anthropic-API-only limit, and that no skill references the advisor — Verify:grep -ril advisor .claude/skills templates/skills templates/codex templates/opencodereturns nothing. - AC-8: On
GO, a follow-up issue for the retry rung (effort → advisor → model, with structured gap findings injected on loop re-entry) is filed and linked from the PR body. - AC-9:
npm run lint:skill-sync0 diverged;npm run build && npm testgreen.
Non-goals
- Putting session logs or prior-phase transcripts into phase prompts to "give the advisor context" — see design fact 1.
- Any skill-level mention of the advisor (keeps Codex/opencode mirrors clean).
- Replacing
--escalate-effortor--model-ladder.
Related: #1135 (upstream gap; this is one of its follow-ups), #914, #915, #971, #995, #916, #986.
Activity
admarble commentedon Sep 30, 2026
Pre-Phase-0 findings (2026-09-30)
This issue's Phase 0 is the advisor on/off experiment. Four findings from the code and one probe change what Phase 0 needs.
1. Advisor tokens reach
phaseUsageas their own row (mechanism confirmed). The CLI's cost accumulator walks each response'susage.iterations[]and adds everyadvisor_messageiteration under the advisor's own model ID. So the SDK result'smodelUsagecarries the advisor as a separate key, andnormalizeModelUsage(phase-executor.ts:1858) turns it into aphaseUsagerow with its owncostUSD. A one-shotclaude -p --model opusprobe with an advisor configured returned two keys,claude-opus-5-5andclaude-fable-5-1, and the advisor's input was entirely uncached (cacheReadInputTokens: 0). No code change is needed for cost. Two gaps remain, and both are already AC-6:advisorCallshas to come from the transcript'sadvisortool uses.2. No sequant phase has run with an advisor yet. The claude-code driver passes
settingSources: ["project"], so anadvisorModelset in user settings never reaches a phase. No.sequant/metrics.jsonon the dogfood machine has an advisor-modelphaseUsagerow. Phase 0 must set the project.claude/settings.jsonkey as written above. Interactive-session observations do not stand in for phase data.3. Phase 0 is now blocked by #1227. Since 2026-09-20,
resolvedModelrecords the Haiku helper for every phase: it takes the firstmodelUsagekey, and that key is now Haiku. #1198 carries the bad value into the run log and the top-level metricsmodel. Arms keyed on that field would repeat #916 phase-0 confound 3. #1227's AC-2 also keeps the fix from selecting the advisor key. Until #1227 lands, key Phase 0 arms on the per-modelphaseUsagerows, not onresolvedModel.4. Field observations: one Max account, 2026-09, interactive sessions, not sequant phases.
message.usage.iterations[](type: "advisor_message"), not in the top-levelusage. Transcript-based counters vary: as of 2026-09-29, ccusage 20.0.26 counts it, while entire 0.11.3 and claude-monitor 4.0.0 do not. Sequant's SDK path is unaffected (finding 1). A future transcript-based fallback must readiterations[].## Parallel Groupsimplementers.Considered, not filed: a general "assign setups to runs, join each run to its outcome (merged / CI / reverted within N days)" experiment framework. There's no consumer today. #916 and this Phase 0 both replay in fixture forks with no PR, so there is nothing to join to. In-vivo dogfood volume, around 10 runs a week per repo, is too small for rare outcomes like reverts or re-opens. If it comes back, it needs a key first: a metrics run
iddoes not match its run log'srunId, so a run can't be joined to its PR except by issue number and timestamp.admarble commentedon Sep 30, 2026
Phase 0 results (2026-09-30): NO-GO
Report:
docs/investigations/advisor-tool-phase0-2026-09.md, in #1230.Per AC-2, #1230 closes AC-3…AC-7 as not needed. The retry-rung idea (advisor only on a loop retry) remains a candidate new issue, not part of this one.
docs(#1138): advisor-on-exec Phase 0 report — NO-GO for the build tra…
admarble commentedon Sep 30, 2026
Closed by #1230 (squash
2aec2459): Phase 0 NO-GO, build track AC-3…AC-7 not needed.