sessions: include AGENTS.md in instructions listing#307747
sessions: include AGENTS.md in instructions listing#307747joshspicer wants to merge 1 commit intomainfrom
Conversation
The sessions AI customization tree view and overview were only calling listPromptFiles(PromptsType.instructions) to discover instruction files. However, AGENTS.md (along with CLAUDE.md and copilot-instructions.md) is classified as an agent type by getPromptFileType(), so it was never returned by that call. Fix by also calling listAgentInstructions() and merging the results (deduplicating by URI), matching the pattern already used by the workbench customization editor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the Sessions window AI customization sidebar views so that agent instruction files (e.g. AGENTS.md, CLAUDE.md, copilot-instructions.md) are included in the “Instructions” discovery paths, matching the workbench customization editor behavior.
Changes:
- Merge
listAgentInstructions()results into the “Instructions” listing in the sessions customization tree view (with URI de-duping). - Include agent instruction files in the “Instructions” count shown in the sessions customization overview.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeViewViews.ts | Adds agent instruction files into the instructions list used for grouping/rendering in the tree view. |
| src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationOverviewView.ts | Adds agent instruction files into the instructions count calculation (with URI de-duping). |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
| const agentInstructions = await this.promptsService.listAgentInstructions(CancellationToken.None); | ||
| for (const file of agentInstructions) { | ||
| if (!existingUris.has(file.uri)) { | ||
| allItems.push({ uri: file.uri, storage: PromptsStorage.local, type: PromptsType.instructions }); |
There was a problem hiding this comment.
Agent instruction files returned from listAgentInstructions() can come from user-level locations (e.g. ~/.claude/CLAUDE.md). This code always injects them as storage: PromptsStorage.local, which will mis-group them under “Workspace”, skew the group counts, and set the wrong itemStorage context key for menus. In src/vs/sessions/contrib/sessions/browser/customizationCounts.ts the storage is derived based on whether the URI is inside a workspace folder/active root; this view should apply the same classification (or extend listAgentInstructions() to return storage) before pushing items into allItems.
| allItems.push({ uri: file.uri, storage: PromptsStorage.local, type: PromptsType.instructions }); | |
| const storage = this.workspaceContextService.getWorkspaceFolder(file.uri) ? PromptsStorage.local : PromptsStorage.user; | |
| allItems.push({ uri: file.uri, storage, type: PromptsType.instructions }); |
The sessions AI customization tree view and overview were only calling
listPromptFiles(PromptsType.instructions)to discover instruction files. However,AGENTS.md(along withCLAUDE.mdandcopilot-instructions.md) is classified as an agent type bygetPromptFileType(), so it was never returned by that call — making these files invisible in the Instructions section.Fix
Call
listAgentInstructions()alongsidelistPromptFiles()and merge the results (deduplicating by URI). This matches the pattern already used by the workbench customization editor inaiCustomizationListWidget.ts.Changed files
aiCustomizationTreeViewViews.ts—getStorageGroups()now merges agent instruction files into the instructions listaiCustomizationOverviewView.ts—loadCounts()now includes agent instruction files in the instructions count badge