Skip to content

Detect Copilot agent mode at chat time and default optimizeFor to "turns #3

Description

@navintkr

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

  1. In src/participant.ts, inspect
    request.toolReferences on each turn; record whether any tools
    were attached.
  2. 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".
  3. Surface the chosen mode in the footer (e.g. opt=turns (auto: tools)).
  4. Add a setting tokenProctor.optimizeFor default "auto" and
    document the resolution rules.

Acceptance

  • New "auto" option in the settings enum + README.
  • Agentic prompts (or prompts with tools) resolve to turns.
  • Q&A prompts resolve to tokens.
  • Footer shows why the mode was chosen.

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions