Skip to content

[Tool Intelligence][P1] Apply intent-aware tool admission to the initial provider request #435

Closed

Description

@gaobrian

Problem

A captured BSH request for the plain message hello 8888 advertises 39 function tools, including workspace editing, shell execution, task orchestration, Federation, scheduling, MCP and surface tools.

BSH already has find_tool and a deferred-tool discovery path. The issue is not the absence of dynamic discovery: it is that the live initial request still exposes a broad tool set even when the current turn has no apparent tool intent.

This increases schema payload and model choice burden on ordinary turns, and weakens the distinction between conversational turns and execution turns.

This is a follow-up based on an actual request capture to the initial-schema budgeting and Tool Intelligence work; it should not reimplement those systems.

Required changes

  • Trace the production path that selects the initial model-visible tool set.
  • Apply a small, deterministic, intent-aware initial tool policy:
    • ordinary conversation: no execution tools, or only the minimum discovery surface if required by the runtime contract;
    • workspace read/edit tasks: expose the relevant core file/search/process tools and discovery;
    • specialist tasks: expose the relevant capability tools, with the rest available through find_tool.
  • Preserve a safe fallback when intent classification is uncertain; do not silently make a required capability unavailable.
  • Keep discovery, capability admission and invocation authorization separate. Advertising or discovering a tool must not grant permission.
  • Reuse the existing schema budget, capability view and discovery telemetry rather than adding parallel registries or budgets.
  • Keep tool ordering deterministic for stable request serialization and provider prompt caching.

Acceptance criteria

Scope

Limit this change to the initial tool-admission decision and its integration with the existing request path. Do not introduce another tool registry, semantic search service or authorization layer.

Related

Review follow-up (2026-11-17)

The submitted intent-aware admission implementation is directionally correct and the review found no reason to redesign the admission architecture. The original scope and acceptance criteria above remain in force.

Remaining verification

The current tests establish the basic split between ordinary conversation, workspace-core tools and withheld specialist tools. Before closing, add or confirm end-to-end regression coverage for the following specialist paths:

  • MCP: an admitted MCP capability is discoverable through find_tool, can be invoked successfully, and remains subject to runtime authorization.
  • Federation: an admitted Federation capability is discoverable and invokable through the existing capability path.
  • Scheduling: an admitted scheduling capability is discoverable and invokable through the existing capability path.
  • Revocation/stale schema: after a capability is revoked or falls outside the current capability view, invocation is denied even if the model or conversation still carries an old tool definition.
  • Turn-to-turn scope changes: a conversation turn followed by an explicit work turn (and the reverse) recomputes the initial tool set; no stale admission decision is reused.

These are verification additions, not requests for new registries, authorization layers or discovery mechanisms.

Acceptance additions

  • Representative MCP, Federation and scheduling tasks complete through discovery when their capabilities are admitted.
  • Revoked/out-of-view capabilities remain denied at invocation time with stale schemas.
  • Consecutive turns with different intents use the correct per-turn tool set.
  • Report the existing complete-request measurement (tool count, schema bytes, total request bytes and estimated tokens) alongside test results. Do not treat the estimate as a measured provider token count.

Review evidence

Review status: Implementation substantially meets the issue; close after the specialist discovery, revocation and per-turn regression coverage is confirmed.

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