Skip to content

feat(vscode): reference a model inline in the prompt with @ - #14006

Merged
marius-kilocode merged 2 commits into
mainfrom
allow-inline-model-referencing
Sep 10, 2026
Merged

marius-kilocode merged 2 commits into
mainfrom
allow-inline-model-referencing

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

An orchestrator cannot tell an Agent Manager session or the subagent tool which model to use from the prompt. It has to describe the model in prose, and the receiving agent has to guess the exact provider/model key. There is no way to pick a model inline while composing a prompt.

Why This Change Was Made

The @ mention menu already powers files, terminal output, git changes, past chats, and worktrees. This adds a Model entry to that menu. Selecting it opens the existing shared model selector and inserts an @providerID/modelID token into the prompt text.

The token is inline text, not a file attachment. It is tracked separately from file paths, so it is never sent as a file or rendered as a clickable path link. This keeps the exact model key visible to the model reading the prompt, for example to pass as the model parameter of the subagent or Agent Manager tool.

The reuse is deliberately non-invasive:

  • ModelSelectorBase gains an optional collapsed prop. The inline @ picker forces the compact list, because there is no current model to preview and picking is a one-click insert. Normal chat and settings selectors keep the persisted expand/collapse preference.
  • The hidden instance is opened through the selector's existing openModelPicker event, keyed to a mention-model trigger, so the chat selector and /models are unaffected.
  • No existing caller changes behavior when collapsed is not passed.

User Impact

Typing @, then choosing Model, opens the model picker. Picking a model inserts @provider/model into the prompt. It does not change the active session model. The token behaves as one atomic unit for cursor movement and deletion.

Evidence

The @ menu now lists Model first:

The @ mention menu with the Model entry

Picking it opens the shared model picker in its compact form:

The inline model picker

The inserted reference is inline text; the session model stays unchanged:

The prompt with an inserted model reference

Verified in an isolated VS Code instance (sidebar and Agent Manager): the menu entry appears and filters, the picker opens and searches, keyboard navigation and Enter insert, Escape closes and refocuses the prompt, the session model is unchanged, and no console errors appear. bun run test:unit passes (5505 pass, 2 skip), along with extension lint, typecheck, knip, and check-kilocode-change.

Add a Model entry to the @ mention menu that opens the shared model
selector and inserts an @provider/model reference. The token is inline
text, never a file attachment, so an orchestrator can pass an exact
model to Agent Manager or the subagent tool.
@kilo-code-bot

kilo-code-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/kilo-vscode/tests/unit/use-file-mention.test.ts
  • packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts
Previous Review Summary (commit e9f18b7)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit e9f18b7)

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts 926 Restored @provider/model tokens are classified only against the catalog at seed time, so they can still become file attachments
Files Reviewed (8 files)
  • .changeset/inline-model-references.md
  • packages/kilo-vscode/tests/unit/file-mention-utils.test.ts
  • packages/kilo-vscode/tests/unit/use-file-mention.test.ts
  • packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx
  • packages/kilo-vscode/webview-ui/src/components/shared/ModelSelector.tsx
  • packages/kilo-vscode/webview-ui/src/hooks/file-mention-utils.ts
  • packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts - 1 issue
  • packages/kilo-vscode/webview-ui/src/styles/prompt-dropdowns.css

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 118.4K · Output: 11.1K · Cached: 395.6K

Review guidance: REVIEW.md from base branch main

Classify a restored @-mention against the live model catalog when syncing
and when parsing attachments, not only at seed time. A draft restored
before the catalog loads can no longer turn a model reference into a bogus
file attachment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants