Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { IContextKeyService } from '../../../../platform/contextkey/common/conte
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
import { ResourceSet } from '../../../../base/common/map.js';
import { IPromptsService } from '../../../../workbench/contrib/chat/common/promptSyntax/service/promptsService.js';
import { PromptsType } from '../../../../workbench/contrib/chat/common/promptSyntax/promptTypes.js';
import { AICustomizationManagementSection } from '../../../../workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.js';
Expand Down Expand Up @@ -171,6 +172,17 @@ export class AICustomizationOverviewView extends ViewPane {
} else {
const allItems = await this.promptsService.listPromptFiles(type, CancellationToken.None);
count = allItems.length;

// For instructions, also count agent instructions (AGENTS.md, copilot-instructions.md, CLAUDE.md, etc.)
if (type === PromptsType.instructions) {
const existingUris = new ResourceSet(allItems.map(item => item.uri));
const agentInstructions = await this.promptsService.listAgentInstructions(CancellationToken.None);
for (const file of agentInstructions) {
if (!existingUris.has(file.uri)) {
count++;
}
}
}
}

const sectionData = this.sections.find(s => s.id === section);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { IThemeService } from '../../../../platform/theme/common/themeService.js
import { IViewPaneOptions, ViewPane } from '../../../../workbench/browser/parts/views/viewPane.js';
import { IViewDescriptorService } from '../../../../workbench/common/views.js';
import { IPromptsService, PromptsStorage, IAgentSkill, IPromptPath } from '../../../../workbench/contrib/chat/common/promptSyntax/service/promptsService.js';
import { ResourceSet } from '../../../../base/common/map.js';
import { PromptsType } from '../../../../workbench/contrib/chat/common/promptSyntax/promptTypes.js';
import { agentIcon, extensionIcon, instructionsIcon, mcpServerIcon, pluginIcon, promptIcon, skillIcon, userIcon, workspaceIcon, builtinIcon } from '../../../../workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js';
import { AICustomizationItemMenuId } from './aiCustomizationTreeView.js';
Expand Down Expand Up @@ -446,7 +447,19 @@ class UnifiedAICustomizationDataSource implements IAsyncDataSource<RootElement,

// For other types, fetch once and cache grouped by storage
if (!cached.files) {
const allItems = await this.promptsService.listPromptFiles(promptType, CancellationToken.None);
const allItems: IPromptPath[] = [...await this.promptsService.listPromptFiles(promptType, CancellationToken.None)];

// For instructions, also include agent instructions (AGENTS.md, copilot-instructions.md, CLAUDE.md, etc.)
if (promptType === PromptsType.instructions) {
const existingUris = new ResourceSet(allItems.map(item => item.uri));
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.
}
}
}

const workspaceItems = allItems.filter(item => item.storage === PromptsStorage.local);
const userItems = allItems.filter(item => item.storage === PromptsStorage.user);
const extensionItems = allItems.filter(item => item.storage === PromptsStorage.extension);
Expand Down
Loading