355
const entries: string[] = [];
356
if (fileReadTool) {
358
>
const searchNestedAgentMd = this._configurationService.getValue(PromptsConfig.USE_NESTED_AGENT_MD);
359
>
const agentsMdPromise = searchNestedAgentMd ? this._promptsService.listNestedAgentMDs(token) : Promise.resolve([]);
360
>
361
>
entries.push('<instructions>');
362
>
entries.push('Here is a list of instruction files that contain rules for working with this codebase.');
363
>
entries.push('These files are important for understanding the codebase structure, conventions, and best practices.');
364
>
entries.push('When an instruction file applies to your task (based on its description or applyTo pattern), follow the rules specified in it.');
365
>
entries.push(`If the file content is not already included in the context, use the ${fileReadTool.variable} tool to read it before proceeding. Use the exact value from the <file> element as-is with the tool; do not add or remove prefixes or otherwise modify it.`);
366
>
entries.push('Only load instruction files when they are relevant to the current task. Do not eagerly load all instructions upfront.');
367
>
entries.push('When modifying or creating files, check for instructions whose applyTo pattern matches the file path and follow them.');
368
>
let hasContent = false;
369
>
for (const instruction of instructionFiles) {
370
if (!matchesSessionType(instruction.sessionTypes, currentSessionType)) {
371
continue;