@@ -7,13 +7,16 @@ import * as l10n from '@vscode/l10n';
77import * as vscode from 'vscode' ;
88import { ICustomInstructionsService } from '../../../platform/customInstructions/common/customInstructionsService' ;
99import { INSTRUCTION_FILE_EXTENSION , SKILL_FILENAME } from '../../../platform/customInstructions/common/promptTypes' ;
10+ import { IFileSystemService } from '../../../platform/filesystem/common/fileSystemService' ;
1011import { ILogService } from '../../../platform/log/common/logService' ;
1112import { IPromptsService } from '../../../platform/promptFiles/common/promptsService' ;
13+ import { IWorkspaceService } from '../../../platform/workspace/common/workspaceService' ;
1214import { CancellationToken } from '../../../util/vs/base/common/cancellation' ;
1315import { isCancellationError } from '../../../util/vs/base/common/errors' ;
1416import { Emitter } from '../../../util/vs/base/common/event' ;
1517import { Disposable } from '../../../util/vs/base/common/lifecycle' ;
1618import { basename } from '../../../util/vs/base/common/resources' ;
19+ import { URI } from '../../../util/vs/base/common/uri' ;
1720import { IChatPromptFileService } from '../common/chatPromptFileService' ;
1821import { ICopilotCLIAgents } from '../copilotcli/node/copilotCli' ;
1922
@@ -42,6 +45,8 @@ export class CopilotCLICustomizationProvider extends Disposable implements vscod
4245 @ICustomInstructionsService private readonly customInstructionsService : ICustomInstructionsService ,
4346 @IPromptsService private readonly promptsService : IPromptsService ,
4447 @ILogService private readonly logService : ILogService ,
48+ @IWorkspaceService private readonly workspaceService : IWorkspaceService ,
49+ @IFileSystemService private readonly fileSystemService : IFileSystemService ,
4550 ) {
4651 super ( ) ;
4752
@@ -90,12 +95,26 @@ export class CopilotCLICustomizationProvider extends Disposable implements vscod
9095 * Collects all instruction items from the prompt file service,
9196 * categorizing them with groupKeys and badges matching the core
9297 * implementation:
93- * - agent-instructions: copilot-instructions.md files
98+ * - agent-instructions: AGENTS.md, CLAUDE.md, copilot-instructions.md
9499 * - context-instructions: files with an applyTo pattern (badge = pattern)
95100 * - on-demand-instructions: files without an applyTo pattern
96101 */
97102 private async getInstructionItems ( token : CancellationToken ) : Promise < vscode . ChatSessionCustomizationItem [ ] > {
103+ // Collect agent instruction URIs from customInstructionsService
104+ // (copilot-instructions.md) plus workspace-root AGENTS.md and CLAUDE.md
98105 const agentInstructionUriList = await this . customInstructionsService . getAgentInstructions ( ) ;
106+ const rootFileNames = [ 'AGENTS.md' , 'CLAUDE.md' ] ;
107+ for ( const folder of this . workspaceService . getWorkspaceFolders ( ) ) {
108+ for ( const fileName of rootFileNames ) {
109+ const uri = URI . joinPath ( folder , fileName ) ;
110+ try {
111+ await this . fileSystemService . stat ( uri ) ;
112+ agentInstructionUriList . push ( uri ) ;
113+ } catch {
114+ // file doesn't exist
115+ }
116+ }
117+ }
99118
100119 const items : vscode . ChatSessionCustomizationItem [ ] = [ ] ;
101120 const seenUris = new Set < string > ( ) ;
0 commit comments