feat(agent-manager): add @model, @past-chats and @worktrees mentions to New Worktree prompt - #14251
Conversation
…to New Worktree prompt
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of Files Reviewed (1 file, incremental)
Previous Review Summaries (9 snapshots, latest commit 483ac70)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 483ac70)Status: No Issues Found | Recommendation: Merge Incremental review of Files Reviewed (1 file, incremental)
Previous review (commit 4c7d69f)Status: No Issues Found | Recommendation: Merge Incremental review of Files Reviewed (5 files, incremental)
Previous review (commit 0e2f1a5)Status: No Issues Found | Recommendation: Merge Incremental review of Files Reviewed (6 files, incremental)
Previous review (commit b434feb)Status: No Issues Found | Recommendation: Merge Incremental review of Files Reviewed (2 files, incremental)
Previous review (commit 49aef17)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files, incremental)
Fix these issues in Kilo Cloud Previous review (commit 2d7b53e)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (1 file, incremental)
Fix these issues in Kilo Cloud Previous review (commit 1f4180d)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Resolved in Files Reviewed (1 file, incremental)
Fix these issues in Kilo Cloud Previous review (commit 9bdd549)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (2 files, incremental)
Fix these issues in Kilo Cloud Previous review (commit b3ef153)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (6 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
…entions # Conflicts: # packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx
WebReflection
left a comment
There was a problem hiding this comment.
we could drop nativeEscape.call(RegExp, value) and use just nativeEscape(value) instead but it works either ways anyway (context ignored), up to you but this looks good now, thanks
What Problem This Solves
The Agent Manager New Worktree dialog supports slash commands but has no
@-mention support. A prompt written while creating a worktree cannot reference a model, an earlier chat, or another worktree, even though the normal chat composer can.Why This Change Was Made
Mentions here must be worktree-independent. At dialog time the new worktree does not exist yet, so resolving file paths against it is unsafe. The dialog therefore offers only references that are safe before creation:
@modelinserts the inline token@providerID/modelIDas plain text. It never becomes a file attachment.@past-chatsbuilds asession:{id}attachment. The backend resolvessession:file parts into transcript context when the session starts.@worktreesbuilds a metadata-onlydata:URL attachment for another Agent Manager worktree.File, folder, opened-file, terminal, and git-changes mentions are intentionally not offered. Slash-command behavior is unchanged.
A dedicated
useWorktreeMentionhook reuses the shared mention utilities (rankMentionResults,filterSessions,buildSessionAttachments,buildWorktreeAttachments) but restricts the menu to those three entries, so the dialog never runs file search. Attachments are built at creation time and flow through the existingcreateMultiVersionfile pipeline to the created session.User Impact
@in the New Worktree prompt shows Model, Past chats, and Worktrees.@token and sends the resolved context to each created session.Evidence
Self-tested in an isolated VS Code dev instance (
vscode-self-test) against a disposable fixture repository:@menu lists Model, Past chats, and Worktrees, and no file, terminal, or git entries.@modelopened the shared model selector and inserted@kilo/kilo-auto/freeas text.@worktreeslisted the existingfixture-aworktree and inserted its path.@past-chatslisted the earlier titled session and inserted its title.session:part), the worktree path (resolved metadatadata:part), and the model slug.Automated checks from
packages/kilo-vscode/:bun run check-typesandbun run check-types:webviewpass.bun run lintpasses.bun run test:unitpasses. New coverage lives intests/unit/worktree-mention.test.ts(three entries, attachment building, token insertion, prose close, Escape handling, disabled worktrees, highlight tokens),tests/unit/file-mention-utils.test.ts(segmentMentionText), andtests/unit/agent-manager-worktree-reference.test.ts(dialog reference list).