The optimizeFor knob (tokens | turns | balanced) is exactly
the right trade-off for Copilot agent mode vs one-shot chat. But
right now the user has to set it manually in settings or policy.
We should detect agent-mode-like signals at request time and flip
to turns automatically (with a way to opt out).
Possible signals
- Presence of tools in the
ChatRequest.toolReferences array (agent
mode passes tools; ask-mode doesn't).
- Prompt keywords that strongly suggest multi-step work:
"refactor across", "migrate", "implement ... and write tests",
"investigate why", "walk the codebase".
- The task classifier already returns
code_large / agentic —
treat those as an auto-bias to turns regardless of user setting.
What to do
- In
src/participant.ts, inspect
request.toolReferences on each turn; record whether any tools
were attached.
- In
src/core/index.ts analyzeAsync, if
optimizeFor came in as "auto" (new value, default?), resolve
to "turns" when (a) tools are attached, (b) task is
code_large or agentic, (c) judge turns estimate > 5.
Otherwise resolve to "tokens".
- Surface the chosen mode in the footer (e.g.
opt=turns (auto: tools)).
- Add a setting
tokenProctor.optimizeFor default "auto" and
document the resolution rules.
Acceptance
Why this matters
The #1 failure mode today is a user who installs Token Proctor and
never touches settings — they get the tokens default, which is
actively wrong for their 20-turn agent loops. This fixes the
default-on experience.
The
optimizeForknob (tokens|turns|balanced) is exactlythe right trade-off for Copilot agent mode vs one-shot chat. But
right now the user has to set it manually in settings or policy.
We should detect agent-mode-like signals at request time and flip
to
turnsautomatically (with a way to opt out).Possible signals
ChatRequest.toolReferencesarray (agentmode passes tools; ask-mode doesn't).
"refactor across", "migrate", "implement ... and write tests",
"investigate why", "walk the codebase".
code_large/agentic—treat those as an auto-bias to
turnsregardless of user setting.What to do
src/participant.ts, inspectrequest.toolReferenceson each turn; record whether any toolswere attached.
src/core/index.tsanalyzeAsync, ifoptimizeForcame in as"auto"(new value, default?), resolveto
"turns"when (a) tools are attached, (b) task iscode_largeoragentic, (c) judge turns estimate > 5.Otherwise resolve to
"tokens".opt=turns (auto: tools)).tokenProctor.optimizeFordefault"auto"anddocument the resolution rules.
Acceptance
"auto"option in the settings enum + README.turns.tokens.Why this matters
The #1 failure mode today is a user who installs Token Proctor and
never touches settings — they get the
tokensdefault, which isactively wrong for their 20-turn agent loops. This fixes the
default-on experience.