Skip to content

sessions: include AGENTS.md in instructions listing#307747

Draft
joshspicer wants to merge 1 commit intomainfrom
copilot/teenage-magpie
Draft

sessions: include AGENTS.md in instructions listing#307747
joshspicer wants to merge 1 commit intomainfrom
copilot/teenage-magpie

Conversation

@joshspicer
Copy link
Copy Markdown
Member

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 — making these files invisible in the Instructions section.

Fix

Call listAgentInstructions() alongside listPromptFiles() and merge the results (deduplicating by URI). This matches the pattern already used by the workbench customization editor in aiCustomizationListWidget.ts.

Changed files

  • aiCustomizationTreeViewViews.tsgetStorageGroups() now merges agent instruction files into the instructions list
  • aiCustomizationOverviewView.tsloadCounts() now includes agent instruction files in the instructions count badge

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>
Copilot AI review requested due to automatic review settings April 3, 2026 22:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 });
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 });

Copilot uses AI. Check for mistakes.
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