Skip to content

Conversational agent routing: one tool-calling co-pilot (answer-from-context vs delegate-to-Claude) #3

Closed

Description

@serge-ivo

Problem

The coding Agent chat has TWO explicit buttons — Send (always relays to Claude Code, expensive + side-effecting) and Status (always answers from context, cheap, read-only). That split is clunky: users shouldn't have to pre-classify their own message.

Approach (researched best practice)

Collapse to ONE chat backed by a single cheap co-pilot LLM running a tool-calling loop with three tools:

  • answer_from_context — default; it already holds the terminal + recent history.
  • search_history(query) — vector/semantic search over coding_timeline, on-demand (only when the question reaches past the in-window history). Not always-on context.
  • drive_claude(instruction) — the expensive, side-effecting delegation to Claude Code (the existing /message path); its "result" streams back into the same thread.

The LLM decides per message. No code words, no separate intent-classifier (only justified at hundreds of tools). This is the orchestrator-worker pattern Anthropic recommends for coding.

Prompt disposition: context-first, delegate on action — anything that changes files / runs commands / needs live repo state → drive_claude; otherwise describe from context.

Scope

  • Backend: turn /explain (or a new /agent) into a tool-calling loop (reuse BYOK Claude + the tool-loop machinery from the apply pipeline); add drive_claude (→ /coding/act) and search_history (→ coding_timeline + vectors) tools.
  • Frontend: fold Send + Status into one input; keep a thin /run or @claude override to force delegation.

Guard against

  • Under-delegation (cheap LLM answers a question it should have delegated) → hard prompt rule on action intent.
  • Over-delegation (wastes Claude on a status question) → make context-answer first-class.
  • Loop thrash → cap rounds + dedup identical tool calls (reuse existing 3-round cap).

Acceptance

  • One chat input. Typing "what's it doing?" answers from context; "add a test" drives Claude. @claude <x> always delegates. No double LLM cost on pure status questions.

Activity

  1. serge-ivo commented on Jun 26, 2026

    @serge-ivo
    ContributorAuthor

    Superseded-by / rolls up into the Overseer agent (one cross-repo conversational AI). This per-session routing (answer-from-context vs drive_claude) is the reusable tool-loop CORE; the Overseer lifts it to global scope with all-repos context + memory. Build this loop first, then generalise.

  2. added a commit that references this issue on Jun 26, 2026
  3. serge-ivo commented on Aug 6, 2026

    @serge-ivo
    ContributorAuthor

    Closing as implemented against the ticket's user-facing acceptance. Current code has the single coding chat route at /v1/instances/:instanceId/coding/sessions/:sessionId/agent, force-delegation via @claude//run, and the drive_claude tool path; the Coder UI sends normal turns to that single /agent input. Note: the originally proposed search_history tool did not land as a separate tool; if deeper semantic history search is still needed, it should be a narrower follow-up rather than keeping this broad routing ticket open.

  4. serge-ivo commented on Aug 6, 2026

    @serge-ivo
    ContributorAuthor

    Implementation links: no associated PR was found via GitHub's commit-to-PR API; this landed direct on main in 6127186.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions