From a31adfc412b12ad6011a319c8c282df39e55c1d4 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sun, 20 Jul 2025 01:58:16 +0000 Subject: [PATCH 01/12] feat: add support for Agent Rules standard via AGENTS.md (#5966) - Add AGENTS.md detection and loading in custom-instructions.ts - Add VS Code setting "roo-cline.useAgentRules" (default: true) - Integrate with existing custom instructions system - Add comprehensive test coverage for AGENTS.md functionality - Update README to mention Agent Rules support This enables unified natural language guidelines across different AI coding tools following the agent-rules.org standard. --- README.md | 1 + .../__tests__/custom-instructions.spec.ts | 122 ++++++++++++++++++ .../prompts/sections/custom-instructions.ts | 26 +++- src/core/prompts/system.ts | 14 +- src/core/task/Task.ts | 2 + src/core/webview/generateSystemPrompt.ts | 5 + src/package.json | 5 + src/package.nls.json | 3 +- 8 files changed, 174 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c173cdb3d71..e9ebeed1437 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ Make Roo Code work your way with: - [Custom Modes](https://docs.roocode.com/advanced-usage/custom-modes) for specialized tasks - [Local Models](https://docs.roocode.com/advanced-usage/local-models) for offline use - [Auto-Approval Settings](https://docs.roocode.com/advanced-usage/auto-approving-actions) for faster workflows +- **Agent Rules Standard** - Roo Code supports the [Agent Rules](https://agent-rules.org/) standard via `AGENTS.md` files, enabling unified natural language guidelines across different AI coding tools ## Resources diff --git a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts index f6fb8ea1f4a..e5ca76d0ed7 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts @@ -505,6 +505,128 @@ describe("addCustomInstructions", () => { expect(result).toContain("Rules from .roorules-test-mode:\nmode specific rules") }) + it("should load AGENTS.md when useAgentRules is true", async () => { + // Simulate no .roo/rules-test-mode directory + statMock.mockRejectedValueOnce({ code: "ENOENT" }) + + readFileMock.mockImplementation((filePath: PathLike) => { + const pathStr = filePath.toString() + if (pathStr.endsWith("AGENTS.md")) { + return Promise.resolve("Agent rules from AGENTS.md file") + } + return Promise.reject({ code: "ENOENT" }) + }) + + const result = await addCustomInstructions( + "mode instructions", + "global instructions", + "/fake/path", + "test-mode", + { useAgentRules: true }, + ) + + expect(result).toContain("# Agent Rules Standard (AGENTS.md):") + expect(result).toContain("Agent rules from AGENTS.md file") + expect(readFileMock).toHaveBeenCalledWith(expect.stringContaining("AGENTS.md"), "utf-8") + }) + + it("should not load AGENTS.md when useAgentRules is false", async () => { + // Simulate no .roo/rules-test-mode directory + statMock.mockRejectedValueOnce({ code: "ENOENT" }) + + readFileMock.mockImplementation((filePath: PathLike) => { + const pathStr = filePath.toString() + if (pathStr.endsWith("AGENTS.md")) { + return Promise.resolve("Agent rules from AGENTS.md file") + } + return Promise.reject({ code: "ENOENT" }) + }) + + const result = await addCustomInstructions( + "mode instructions", + "global instructions", + "/fake/path", + "test-mode", + { useAgentRules: false }, + ) + + expect(result).not.toContain("# Agent Rules Standard (AGENTS.md):") + expect(result).not.toContain("Agent rules from AGENTS.md file") + }) + + it("should load AGENTS.md by default when useAgentRules is undefined", async () => { + // Simulate no .roo/rules-test-mode directory + statMock.mockRejectedValueOnce({ code: "ENOENT" }) + + readFileMock.mockImplementation((filePath: PathLike) => { + const pathStr = filePath.toString() + if (pathStr.endsWith("AGENTS.md")) { + return Promise.resolve("Agent rules from AGENTS.md file") + } + return Promise.reject({ code: "ENOENT" }) + }) + + const result = await addCustomInstructions( + "mode instructions", + "global instructions", + "/fake/path", + "test-mode", + {}, // No useAgentRules specified + ) + + expect(result).toContain("# Agent Rules Standard (AGENTS.md):") + expect(result).toContain("Agent rules from AGENTS.md file") + }) + + it("should handle missing AGENTS.md gracefully", async () => { + // Simulate no .roo/rules-test-mode directory + statMock.mockRejectedValueOnce({ code: "ENOENT" }) + + readFileMock.mockRejectedValue({ code: "ENOENT" }) + + const result = await addCustomInstructions( + "mode instructions", + "global instructions", + "/fake/path", + "test-mode", + { useAgentRules: true }, + ) + + expect(result).toContain("Global Instructions:\nglobal instructions") + expect(result).toContain("Mode-specific Instructions:\nmode instructions") + expect(result).not.toContain("# Agent Rules Standard (AGENTS.md):") + }) + + it("should include AGENTS.md content along with other rules", async () => { + // Simulate no .roo/rules-test-mode directory + statMock.mockRejectedValueOnce({ code: "ENOENT" }) + + readFileMock.mockImplementation((filePath: PathLike) => { + const pathStr = filePath.toString() + if (pathStr.endsWith("AGENTS.md")) { + return Promise.resolve("Agent rules content") + } + if (pathStr.endsWith(".roorules")) { + return Promise.resolve("Roo rules content") + } + return Promise.reject({ code: "ENOENT" }) + }) + + const result = await addCustomInstructions( + "mode instructions", + "global instructions", + "/fake/path", + "test-mode", + { useAgentRules: true }, + ) + + // Should contain both AGENTS.md and .roorules content + expect(result).toContain("# Agent Rules Standard (AGENTS.md):") + expect(result).toContain("Agent rules content") + expect(result).toContain("# Rules from .roorules:") + expect(result).toContain("Roo rules content") + }) + it("should return empty string when no instructions provided", async () => { // Simulate no .roo/rules directory statMock.mockRejectedValueOnce({ code: "ENOENT" }) diff --git a/src/core/prompts/sections/custom-instructions.ts b/src/core/prompts/sections/custom-instructions.ts index a78882cc904..20a1195a2c6 100644 --- a/src/core/prompts/sections/custom-instructions.ts +++ b/src/core/prompts/sections/custom-instructions.ts @@ -214,12 +214,28 @@ export async function loadRuleFiles(cwd: string): Promise { return "" } +/** + * Load AGENTS.md file from the project root if it exists + */ +async function loadAgentRulesFile(cwd: string): Promise { + try { + const agentsPath = path.join(cwd, "AGENTS.md") + const content = await safeReadFile(agentsPath) + if (content) { + return `# Agent Rules Standard (AGENTS.md):\n${content}` + } + } catch (err) { + // Silently ignore errors - AGENTS.md is optional + } + return "" +} + export async function addCustomInstructions( modeCustomInstructions: string, globalCustomInstructions: string, cwd: string, mode: string, - options: { language?: string; rooIgnoreInstructions?: string; settings?: Record } = {}, + options: { language?: string; rooIgnoreInstructions?: string; useAgentRules?: boolean; settings?: Record } = {}, ): Promise { const sections = [] @@ -297,6 +313,14 @@ export async function addCustomInstructions( rules.push(options.rooIgnoreInstructions) } + // Add AGENTS.md content if enabled (default: true) + if (options.useAgentRules !== false) { + const agentRulesContent = await loadAgentRulesFile(cwd) + if (agentRulesContent && agentRulesContent.trim()) { + rules.push(agentRulesContent.trim()) + } + } + // Add generic rules const genericRuleContent = await loadRuleFiles(cwd) if (genericRuleContent && genericRuleContent.trim()) { diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index ea4f43823ea..4b109ced55a 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -119,7 +119,12 @@ ${getSystemInfoSection(cwd)} ${getObjectiveSection(codeIndexManager, experiments)} -${await addCustomInstructions(baseInstructions, globalCustomInstructions || "", cwd, mode, { language: language ?? formatLanguage(vscode.env.language), rooIgnoreInstructions, settings })}` +${await addCustomInstructions(baseInstructions, globalCustomInstructions || "", cwd, mode, { + language: language ?? formatLanguage(vscode.env.language), + rooIgnoreInstructions, + useAgentRules: settings?.useAgentRules, + settings, +})}` return basePrompt } @@ -177,7 +182,12 @@ export const SYSTEM_PROMPT = async ( globalCustomInstructions || "", cwd, mode, - { language: language ?? formatLanguage(vscode.env.language), rooIgnoreInstructions, settings }, + { + language: language ?? formatLanguage(vscode.env.language), + rooIgnoreInstructions, + useAgentRules: settings?.useAgentRules, + settings, + }, ) // For file-based prompts, don't include the tool sections diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index d12c0a2ffe9..bbe34ef06d2 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1,4 +1,5 @@ import * as path from "path" +import * as vscode from "vscode" import os from "os" import crypto from "crypto" import EventEmitter from "events" @@ -1662,6 +1663,7 @@ export class Task extends EventEmitter { { maxConcurrentFileReads, todoListEnabled: apiConfiguration?.todoListEnabled, + useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, }, ) })() diff --git a/src/core/webview/generateSystemPrompt.ts b/src/core/webview/generateSystemPrompt.ts index 2c88b98d2e2..98fb91d745b 100644 --- a/src/core/webview/generateSystemPrompt.ts +++ b/src/core/webview/generateSystemPrompt.ts @@ -1,3 +1,4 @@ +import * as vscode from "vscode" import { WebviewMessage } from "../../shared/WebviewMessage" import { defaultModeSlug, getModeBySlug, getGroupName } from "../../shared/modes" import { buildApiHandler } from "../../api" @@ -82,6 +83,10 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web maxReadFileLine !== -1, { maxConcurrentFileReads, + useAgentRules: + provider.context.globalState.get("useAgentRules") ?? + vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? + true, }, ) diff --git a/src/package.json b/src/package.json index ccfd2d5dd62..1fac5fb3659 100644 --- a/src/package.json +++ b/src/package.json @@ -386,6 +386,11 @@ "type": "string", "default": "", "description": "%settings.autoImportSettingsPath.description%" + }, + "roo-cline.useAgentRules": { + "type": "boolean", + "default": true, + "description": "%settings.useAgentRules.description%" } } } diff --git a/src/package.nls.json b/src/package.nls.json index 1eb294ca443..d029be82077 100644 --- a/src/package.nls.json +++ b/src/package.nls.json @@ -36,5 +36,6 @@ "settings.vsCodeLmModelSelector.family.description": "The family of the language model (e.g. gpt-4)", "settings.customStoragePath.description": "Custom storage path. Leave empty to use the default location. Supports absolute paths (e.g. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Enable Roo Code quick fixes", - "settings.autoImportSettingsPath.description": "Path to a RooCode configuration file to automatically import on extension startup. Supports absolute paths and paths relative to the home directory (e.g. '~/Documents/roo-code-settings.json'). Leave empty to disable auto-import." + "settings.autoImportSettingsPath.description": "Path to a RooCode configuration file to automatically import on extension startup. Supports absolute paths and paths relative to the home directory (e.g. '~/Documents/roo-code-settings.json'). Leave empty to disable auto-import.", + "settings.useAgentRules.description": "Enable support for Agent Rules standard via AGENTS.md file in project root. When enabled, natural language guidelines from AGENTS.md will be included in agent prompts for improved interoperability with other AI coding tools." } From d149c5b64d0d8c1af97464688cc18c5ca31a8de1 Mon Sep 17 00:00:00 2001 From: Daniel Riccio Date: Wed, 23 Jul 2025 14:16:15 -0500 Subject: [PATCH 02/12] fix: address PR review feedback for AGENTS.md support - Revert README.md changes (no longer needed) - Add agent-rules.org link to useAgentRules setting description - Change default value of useAgentRules to false - Update tests to reflect new default behavior - Update all language translations with the new setting description --- .../prompts/sections/__tests__/custom-instructions.spec.ts | 6 +++--- src/core/task/Task.ts | 3 ++- src/core/webview/generateSystemPrompt.ts | 2 +- src/package.json | 2 +- src/package.nls.ca.json | 3 ++- src/package.nls.de.json | 3 ++- src/package.nls.es.json | 3 ++- src/package.nls.fr.json | 3 ++- src/package.nls.hi.json | 3 ++- src/package.nls.id.json | 3 ++- src/package.nls.it.json | 3 ++- src/package.nls.ja.json | 3 ++- src/package.nls.json | 2 +- src/package.nls.ko.json | 3 ++- src/package.nls.nl.json | 3 ++- src/package.nls.pl.json | 3 ++- src/package.nls.pt-BR.json | 3 ++- src/package.nls.ru.json | 3 ++- src/package.nls.tr.json | 3 ++- src/package.nls.vi.json | 3 ++- src/package.nls.zh-CN.json | 3 ++- src/package.nls.zh-TW.json | 3 ++- 22 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts index e5ca76d0ed7..33335d0b0d7 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts @@ -554,7 +554,7 @@ describe("addCustomInstructions", () => { expect(result).not.toContain("Agent rules from AGENTS.md file") }) - it("should load AGENTS.md by default when useAgentRules is undefined", async () => { + it("should not load AGENTS.md by default when useAgentRules is undefined", async () => { // Simulate no .roo/rules-test-mode directory statMock.mockRejectedValueOnce({ code: "ENOENT" }) @@ -574,8 +574,8 @@ describe("addCustomInstructions", () => { {}, // No useAgentRules specified ) - expect(result).toContain("# Agent Rules Standard (AGENTS.md):") - expect(result).toContain("Agent rules from AGENTS.md file") + expect(result).not.toContain("# Agent Rules Standard (AGENTS.md):") + expect(result).not.toContain("Agent rules from AGENTS.md file") }) it("should handle missing AGENTS.md gracefully", async () => { diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index bbe34ef06d2..76fc1860e19 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1663,7 +1663,8 @@ export class Task extends EventEmitter { { maxConcurrentFileReads, todoListEnabled: apiConfiguration?.todoListEnabled, - useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, + useAgentRules: + vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? false, }, ) })() diff --git a/src/core/webview/generateSystemPrompt.ts b/src/core/webview/generateSystemPrompt.ts index 98fb91d745b..031e805241f 100644 --- a/src/core/webview/generateSystemPrompt.ts +++ b/src/core/webview/generateSystemPrompt.ts @@ -86,7 +86,7 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web useAgentRules: provider.context.globalState.get("useAgentRules") ?? vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? - true, + false, }, ) diff --git a/src/package.json b/src/package.json index 1fac5fb3659..f77ca2fcd72 100644 --- a/src/package.json +++ b/src/package.json @@ -389,7 +389,7 @@ }, "roo-cline.useAgentRules": { "type": "boolean", - "default": true, + "default": false, "description": "%settings.useAgentRules.description%" } } diff --git a/src/package.nls.ca.json b/src/package.nls.ca.json index f7910db978d..54a0ed49231 100644 --- a/src/package.nls.ca.json +++ b/src/package.nls.ca.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "La família del model de llenguatge (p. ex. gpt-4)", "settings.customStoragePath.description": "Ruta d'emmagatzematge personalitzada. Deixeu-la buida per utilitzar la ubicació predeterminada. Admet rutes absolutes (p. ex. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Habilitar correccions ràpides de Roo Code.", - "settings.autoImportSettingsPath.description": "Ruta a un fitxer de configuració de RooCode per importar automàticament en iniciar l'extensió. Admet rutes absolutes i rutes relatives al directori d'inici (per exemple, '~/Documents/roo-code-settings.json'). Deixeu-ho en blanc per desactivar la importació automàtica." + "settings.autoImportSettingsPath.description": "Ruta a un fitxer de configuració de RooCode per importar automàticament en iniciar l'extensió. Admet rutes absolutes i rutes relatives al directori d'inici (per exemple, '~/Documents/roo-code-settings.json'). Deixeu-ho en blanc per desactivar la importació automàtica.", + "settings.useAgentRules.description": "Activa la càrrega de fitxers AGENTS.md per a regles específiques de l'agent (vegeu https://agent-rules.org/)" } diff --git a/src/package.nls.de.json b/src/package.nls.de.json index d25145616d9..4630154093d 100644 --- a/src/package.nls.de.json +++ b/src/package.nls.de.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "Die Familie des Sprachmodells (z.B. gpt-4)", "settings.customStoragePath.description": "Benutzerdefinierter Speicherpfad. Leer lassen, um den Standardspeicherort zu verwenden. Unterstützt absolute Pfade (z.B. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Roo Code Schnelle Problembehebung aktivieren.", - "settings.autoImportSettingsPath.description": "Pfad zu einer RooCode-Konfigurationsdatei, die beim Start der Erweiterung automatisch importiert wird. Unterstützt absolute Pfade und Pfade relativ zum Home-Verzeichnis (z.B. '~/Documents/roo-code-settings.json'). Leer lassen, um den automatischen Import zu deaktivieren." + "settings.autoImportSettingsPath.description": "Pfad zu einer RooCode-Konfigurationsdatei, die beim Start der Erweiterung automatisch importiert wird. Unterstützt absolute Pfade und Pfade relativ zum Home-Verzeichnis (z.B. '~/Documents/roo-code-settings.json'). Leer lassen, um den automatischen Import zu deaktivieren.", + "settings.useAgentRules.description": "Aktiviert das Laden von AGENTS.md-Dateien für agentenspezifische Regeln (siehe https://agent-rules.org/)" } diff --git a/src/package.nls.es.json b/src/package.nls.es.json index 057754dfb5d..d162a96e569 100644 --- a/src/package.nls.es.json +++ b/src/package.nls.es.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "La familia del modelo de lenguaje (ej. gpt-4)", "settings.customStoragePath.description": "Ruta de almacenamiento personalizada. Dejar vacío para usar la ubicación predeterminada. Admite rutas absolutas (ej. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Habilitar correcciones rápidas de Roo Code.", - "settings.autoImportSettingsPath.description": "Ruta a un archivo de configuración de RooCode para importar automáticamente al iniciar la extensión. Admite rutas absolutas y rutas relativas al directorio de inicio (por ejemplo, '~/Documents/roo-code-settings.json'). Dejar vacío para desactivar la importación automática." + "settings.autoImportSettingsPath.description": "Ruta a un archivo de configuración de RooCode para importar automáticamente al iniciar la extensión. Admite rutas absolutas y rutas relativas al directorio de inicio (por ejemplo, '~/Documents/roo-code-settings.json'). Dejar vacío para desactivar la importación automática.", + "settings.useAgentRules.description": "Habilita la carga de archivos AGENTS.md para reglas específicas del agente (ver https://agent-rules.org/)" } diff --git a/src/package.nls.fr.json b/src/package.nls.fr.json index 7f1193855f1..f2aef4c6543 100644 --- a/src/package.nls.fr.json +++ b/src/package.nls.fr.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "La famille du modèle de langage (ex: gpt-4)", "settings.customStoragePath.description": "Chemin de stockage personnalisé. Laisser vide pour utiliser l'emplacement par défaut. Prend en charge les chemins absolus (ex: 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Activer les correctifs rapides de Roo Code.", - "settings.autoImportSettingsPath.description": "Chemin d'accès à un fichier de configuration RooCode à importer automatiquement au démarrage de l'extension. Prend en charge les chemins absolus et les chemins relatifs au répertoire de base (par exemple, '~/Documents/roo-code-settings.json'). Laisser vide pour désactiver l'importation automatique." + "settings.autoImportSettingsPath.description": "Chemin d'accès à un fichier de configuration RooCode à importer automatiquement au démarrage de l'extension. Prend en charge les chemins absolus et les chemins relatifs au répertoire de base (par exemple, '~/Documents/roo-code-settings.json'). Laisser vide pour désactiver l'importation automatique.", + "settings.useAgentRules.description": "Active le chargement des fichiers AGENTS.md pour les règles spécifiques à l'agent (voir https://agent-rules.org/)" } diff --git a/src/package.nls.hi.json b/src/package.nls.hi.json index de531a03a87..5f5cbba42cc 100644 --- a/src/package.nls.hi.json +++ b/src/package.nls.hi.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "भाषा मॉडल का परिवार (उदा. gpt-4)", "settings.customStoragePath.description": "कस्टम स्टोरेज पाथ। डिफ़ॉल्ट स्थान का उपयोग करने के लिए खाली छोड़ें। पूर्ण पथ का समर्थन करता है (उदा. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Roo Code त्वरित सुधार सक्षम करें", - "settings.autoImportSettingsPath.description": "RooCode कॉन्फ़िगरेशन फ़ाइल का पथ जिसे एक्सटेंशन स्टार्टअप पर स्वचालित रूप से आयात किया जाएगा। होम डायरेक्टरी के सापेक्ष पूर्ण पथ और पथों का समर्थन करता है (उदाहरण के लिए '~/Documents/roo-code-settings.json')। ऑटो-इंपोर्ट को अक्षम करने के लिए खाली छोड़ दें।" + "settings.autoImportSettingsPath.description": "RooCode कॉन्फ़िगरेशन फ़ाइल का पथ जिसे एक्सटेंशन स्टार्टअप पर स्वचालित रूप से आयात किया जाएगा। होम डायरेक्टरी के सापेक्ष पूर्ण पथ और पथों का समर्थन करता है (उदाहरण के लिए '~/Documents/roo-code-settings.json')। ऑटो-इंपोर्ट को अक्षम करने के लिए खाली छोड़ दें।", + "settings.useAgentRules.description": "एजेंट-विशिष्ट नियमों के लिए AGENTS.md फ़ाइलों को लोड करना सक्षम करें (देखें https://agent-rules.org/)" } diff --git a/src/package.nls.id.json b/src/package.nls.id.json index 61a98cec1a2..5a6ba9706c1 100644 --- a/src/package.nls.id.json +++ b/src/package.nls.id.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "Keluarga dari model bahasa (misalnya gpt-4)", "settings.customStoragePath.description": "Path penyimpanan kustom. Biarkan kosong untuk menggunakan lokasi default. Mendukung path absolut (misalnya 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Aktifkan perbaikan cepat Roo Code.", - "settings.autoImportSettingsPath.description": "Path ke file konfigurasi RooCode untuk diimpor secara otomatis saat ekstensi dimulai. Mendukung path absolut dan path relatif terhadap direktori home (misalnya '~/Documents/roo-code-settings.json'). Biarkan kosong untuk menonaktifkan impor otomatis." + "settings.autoImportSettingsPath.description": "Path ke file konfigurasi RooCode untuk diimpor secara otomatis saat ekstensi dimulai. Mendukung path absolut dan path relatif terhadap direktori home (misalnya '~/Documents/roo-code-settings.json'). Biarkan kosong untuk menonaktifkan impor otomatis.", + "settings.useAgentRules.description": "Aktifkan pemuatan file AGENTS.md untuk aturan khusus agen (lihat https://agent-rules.org/)" } diff --git a/src/package.nls.it.json b/src/package.nls.it.json index 383ea1041cd..c77f1f9282a 100644 --- a/src/package.nls.it.json +++ b/src/package.nls.it.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "La famiglia del modello linguistico (es. gpt-4)", "settings.customStoragePath.description": "Percorso di archiviazione personalizzato. Lasciare vuoto per utilizzare la posizione predefinita. Supporta percorsi assoluti (es. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Abilita correzioni rapide di Roo Code.", - "settings.autoImportSettingsPath.description": "Percorso di un file di configurazione di RooCode da importare automaticamente all'avvio dell'estensione. Supporta percorsi assoluti e percorsi relativi alla directory home (ad es. '~/Documents/roo-code-settings.json'). Lasciare vuoto per disabilitare l'importazione automatica." + "settings.autoImportSettingsPath.description": "Percorso di un file di configurazione di RooCode da importare automaticamente all'avvio dell'estensione. Supporta percorsi assoluti e percorsi relativi alla directory home (ad es. '~/Documents/roo-code-settings.json'). Lasciare vuoto per disabilitare l'importazione automatica.", + "settings.useAgentRules.description": "Abilita il caricamento dei file AGENTS.md per regole specifiche dell'agente (vedi https://agent-rules.org/)" } diff --git a/src/package.nls.ja.json b/src/package.nls.ja.json index 2e3a75930b2..aea89f5ff7c 100644 --- a/src/package.nls.ja.json +++ b/src/package.nls.ja.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "言語モデルのファミリー(例:gpt-4)", "settings.customStoragePath.description": "カスタムストレージパス。デフォルトの場所を使用する場合は空のままにします。絶対パスをサポートします(例:'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Roo Codeのクイック修正を有効にする。", - "settings.autoImportSettingsPath.description": "拡張機能の起動時に自動的にインポートするRooCode設定ファイルへのパス。絶対パスとホームディレクトリからの相対パスをサポートします(例:'~/Documents/roo-code-settings.json')。自動インポートを無効にするには、空のままにします。" + "settings.autoImportSettingsPath.description": "拡張機能の起動時に自動的にインポートするRooCode設定ファイルへのパス。絶対パスとホームディレクトリからの相対パスをサポートします(例:'~/Documents/roo-code-settings.json')。自動インポートを無効にするには、空のままにします。", + "settings.useAgentRules.description": "エージェント固有のルールのためにAGENTS.mdファイルの読み込みを有効にします(参照:https://agent-rules.org/)" } diff --git a/src/package.nls.json b/src/package.nls.json index d029be82077..1285a2367f3 100644 --- a/src/package.nls.json +++ b/src/package.nls.json @@ -37,5 +37,5 @@ "settings.customStoragePath.description": "Custom storage path. Leave empty to use the default location. Supports absolute paths (e.g. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Enable Roo Code quick fixes", "settings.autoImportSettingsPath.description": "Path to a RooCode configuration file to automatically import on extension startup. Supports absolute paths and paths relative to the home directory (e.g. '~/Documents/roo-code-settings.json'). Leave empty to disable auto-import.", - "settings.useAgentRules.description": "Enable support for Agent Rules standard via AGENTS.md file in project root. When enabled, natural language guidelines from AGENTS.md will be included in agent prompts for improved interoperability with other AI coding tools." + "settings.useAgentRules.description": "Enable loading of AGENTS.md files for agent-specific rules (see https://agent-rules.org/)" } diff --git a/src/package.nls.ko.json b/src/package.nls.ko.json index fc4142553c0..83c63b2b68c 100644 --- a/src/package.nls.ko.json +++ b/src/package.nls.ko.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "언어 모델 계열 (예: gpt-4)", "settings.customStoragePath.description": "사용자 지정 저장소 경로. 기본 위치를 사용하려면 비워두세요. 절대 경로를 지원합니다 (예: 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Roo Code 빠른 수정 사용 설정", - "settings.autoImportSettingsPath.description": "확장 프로그램 시작 시 자동으로 가져올 RooCode 구성 파일의 경로입니다. 절대 경로 및 홈 디렉토리에 대한 상대 경로를 지원합니다(예: '~/Documents/roo-code-settings.json'). 자동 가져오기를 비활성화하려면 비워 둡니다." + "settings.autoImportSettingsPath.description": "확장 프로그램 시작 시 자동으로 가져올 RooCode 구성 파일의 경로입니다. 절대 경로 및 홈 디렉토리에 대한 상대 경로를 지원합니다(예: '~/Documents/roo-code-settings.json'). 자동 가져오기를 비활성화하려면 비워 둡니다.", + "settings.useAgentRules.description": "에이전트별 규칙에 대한 AGENTS.md 파일 로드를 활성화합니다 (참조: https://agent-rules.org/)" } diff --git a/src/package.nls.nl.json b/src/package.nls.nl.json index 36efa6d1e47..d57da551d88 100644 --- a/src/package.nls.nl.json +++ b/src/package.nls.nl.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "De familie van het taalmodel (bijv. gpt-4)", "settings.customStoragePath.description": "Aangepast opslagpad. Laat leeg om de standaardlocatie te gebruiken. Ondersteunt absolute paden (bijv. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Snelle correcties van Roo Code inschakelen.", - "settings.autoImportSettingsPath.description": "Pad naar een RooCode-configuratiebestand om automatisch te importeren bij het opstarten van de extensie. Ondersteunt absolute paden en paden ten opzichte van de thuismap (bijv. '~/Documents/roo-code-settings.json'). Laat leeg om automatisch importeren uit te schakelen." + "settings.autoImportSettingsPath.description": "Pad naar een RooCode-configuratiebestand om automatisch te importeren bij het opstarten van de extensie. Ondersteunt absolute paden en paden ten opzichte van de thuismap (bijv. '~/Documents/roo-code-settings.json'). Laat leeg om automatisch importeren uit te schakelen.", + "settings.useAgentRules.description": "Laden van AGENTS.md-bestanden voor agentspecifieke regels inschakelen (zie https://agent-rules.org/)" } diff --git a/src/package.nls.pl.json b/src/package.nls.pl.json index 3c500a166ff..9157c74edec 100644 --- a/src/package.nls.pl.json +++ b/src/package.nls.pl.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "Rodzina modelu językowego (np. gpt-4)", "settings.customStoragePath.description": "Niestandardowa ścieżka przechowywania. Pozostaw puste, aby użyć domyślnej lokalizacji. Obsługuje ścieżki bezwzględne (np. 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Włącz szybkie poprawki Roo Code.", - "settings.autoImportSettingsPath.description": "Ścieżka do pliku konfiguracyjnego RooCode, który ma być automatycznie importowany podczas uruchamiania rozszerzenia. Obsługuje ścieżki bezwzględne i ścieżki względne do katalogu domowego (np. '~/Documents/roo-code-settings.json'). Pozostaw puste, aby wyłączyć automatyczne importowanie." + "settings.autoImportSettingsPath.description": "Ścieżka do pliku konfiguracyjnego RooCode, który ma być automatycznie importowany podczas uruchamiania rozszerzenia. Obsługuje ścieżki bezwzględne i ścieżki względne do katalogu domowego (np. '~/Documents/roo-code-settings.json'). Pozostaw puste, aby wyłączyć automatyczne importowanie.", + "settings.useAgentRules.description": "Włącz wczytywanie plików AGENTS.md dla reguł specyficznych dla agenta (zobacz https://agent-rules.org/)" } diff --git a/src/package.nls.pt-BR.json b/src/package.nls.pt-BR.json index d5ac0b3b2c3..e66199b0393 100644 --- a/src/package.nls.pt-BR.json +++ b/src/package.nls.pt-BR.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "A família do modelo de linguagem (ex: gpt-4)", "settings.customStoragePath.description": "Caminho de armazenamento personalizado. Deixe vazio para usar o local padrão. Suporta caminhos absolutos (ex: 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Habilitar correções rápidas do Roo Code.", - "settings.autoImportSettingsPath.description": "Caminho para um arquivo de configuração do RooCode para importar automaticamente na inicialização da extensão. Suporta caminhos absolutos e caminhos relativos ao diretório inicial (por exemplo, '~/Documents/roo-code-settings.json'). Deixe em branco para desativar a importação automática." + "settings.autoImportSettingsPath.description": "Caminho para um arquivo de configuração do RooCode para importar automaticamente na inicialização da extensão. Suporta caminhos absolutos e caminhos relativos ao diretório inicial (por exemplo, '~/Documents/roo-code-settings.json'). Deixe em branco para desativar a importação automática.", + "settings.useAgentRules.description": "Habilita o carregamento de arquivos AGENTS.md para regras específicas do agente (consulte https://agent-rules.org/)" } diff --git a/src/package.nls.ru.json b/src/package.nls.ru.json index 282ff869e7a..443d6df3e07 100644 --- a/src/package.nls.ru.json +++ b/src/package.nls.ru.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "Семейство языковой модели (например, gpt-4)", "settings.customStoragePath.description": "Пользовательский путь хранения. Оставьте пустым для использования пути по умолчанию. Поддерживает абсолютные пути (например, 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Включить быстрые исправления Roo Code.", - "settings.autoImportSettingsPath.description": "Путь к файлу конфигурации RooCode для автоматического импорта при запуске расширения. Поддерживает абсолютные пути и пути относительно домашнего каталога (например, '~/Documents/roo-code-settings.json'). Оставьте пустым, чтобы отключить автоматический импорт." + "settings.autoImportSettingsPath.description": "Путь к файлу конфигурации RooCode для автоматического импорта при запуске расширения. Поддерживает абсолютные пути и пути относительно домашнего каталога (например, '~/Documents/roo-code-settings.json'). Оставьте пустым, чтобы отключить автоматический импорт.", + "settings.useAgentRules.description": "Включить загрузку файлов AGENTS.md для специфичных для агента правил (см. https://agent-rules.org/)" } diff --git a/src/package.nls.tr.json b/src/package.nls.tr.json index 7508c42c6ed..707335b17b5 100644 --- a/src/package.nls.tr.json +++ b/src/package.nls.tr.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "Dil modelinin ailesi (örn: gpt-4)", "settings.customStoragePath.description": "Özel depolama yolu. Varsayılan konumu kullanmak için boş bırakın. Mutlak yolları destekler (örn: 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Roo Code hızlı düzeltmeleri etkinleştir.", - "settings.autoImportSettingsPath.description": "Uzantı başlangıcında otomatik olarak içe aktarılacak bir RooCode yapılandırma dosyasının yolu. Mutlak yolları ve ana dizine göreli yolları destekler (ör. '~/Documents/roo-code-settings.json'). Otomatik içe aktarmayı devre dışı bırakmak için boş bırakın." + "settings.autoImportSettingsPath.description": "Uzantı başlangıcında otomatik olarak içe aktarılacak bir RooCode yapılandırma dosyasının yolu. Mutlak yolları ve ana dizine göreli yolları destekler (ör. '~/Documents/roo-code-settings.json'). Otomatik içe aktarmayı devre dışı bırakmak için boş bırakın.", + "settings.useAgentRules.description": "Aracıya özgü kurallar için AGENTS.md dosyalarının yüklenmesini etkinleştirin (bkz. https://agent-rules.org/)" } diff --git a/src/package.nls.vi.json b/src/package.nls.vi.json index 58d386deac2..2de4bfa1406 100644 --- a/src/package.nls.vi.json +++ b/src/package.nls.vi.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "Họ mô hình ngôn ngữ (ví dụ: gpt-4)", "settings.customStoragePath.description": "Đường dẫn lưu trữ tùy chỉnh. Để trống để sử dụng vị trí mặc định. Hỗ trợ đường dẫn tuyệt đối (ví dụ: 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Bật sửa lỗi nhanh Roo Code.", - "settings.autoImportSettingsPath.description": "Đường dẫn đến tệp cấu hình RooCode để tự động nhập khi khởi động tiện ích mở rộng. Hỗ trợ đường dẫn tuyệt đối và đường dẫn tương đối đến thư mục chính (ví dụ: '~/Documents/roo-code-settings.json'). Để trống để tắt tính năng tự động nhập." + "settings.autoImportSettingsPath.description": "Đường dẫn đến tệp cấu hình RooCode để tự động nhập khi khởi động tiện ích mở rộng. Hỗ trợ đường dẫn tuyệt đối và đường dẫn tương đối đến thư mục chính (ví dụ: '~/Documents/roo-code-settings.json'). Để trống để tắt tính năng tự động nhập.", + "settings.useAgentRules.description": "Bật tải tệp AGENTS.md cho các quy tắc dành riêng cho tác nhân (xem https://agent-rules.org/)" } diff --git a/src/package.nls.zh-CN.json b/src/package.nls.zh-CN.json index 07f1877bc0a..8fccecb3511 100644 --- a/src/package.nls.zh-CN.json +++ b/src/package.nls.zh-CN.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "语言模型的系列(例如:gpt-4)", "settings.customStoragePath.description": "自定义存储路径。留空以使用默认位置。支持绝对路径(例如:'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "启用 Roo Code 快速修复", - "settings.autoImportSettingsPath.description": "RooCode 配置文件的路径,用于在扩展启动时自动导入。支持绝对路径和相对于主目录的路径(例如 '~/Documents/roo-code-settings.json')。留空以禁用自动导入。" + "settings.autoImportSettingsPath.description": "RooCode 配置文件的路径,用于在扩展启动时自动导入。支持绝对路径和相对于主目录的路径(例如 '~/Documents/roo-code-settings.json')。留空以禁用自动导入。", + "settings.useAgentRules.description": "为特定于代理的规则启用 AGENTS.md 文件的加载(请参阅 https://agent-rules.org/)" } diff --git a/src/package.nls.zh-TW.json b/src/package.nls.zh-TW.json index 237a2c2a6ba..e3a6253d75d 100644 --- a/src/package.nls.zh-TW.json +++ b/src/package.nls.zh-TW.json @@ -35,5 +35,6 @@ "settings.vsCodeLmModelSelector.family.description": "語言模型系列(例如:gpt-4)", "settings.customStoragePath.description": "自訂儲存路徑。留空以使用預設位置。支援絕對路徑(例如:'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "啟用 Roo Code 快速修復。", - "settings.autoImportSettingsPath.description": "RooCode 設定檔案的路徑,用於在擴充功能啟動時自動匯入。支援絕對路徑和相對於主目錄的路徑(例如 '~/Documents/roo-code-settings.json')。留空以停用自動匯入。" + "settings.autoImportSettingsPath.description": "RooCode 設定檔案的路徑,用於在擴充功能啟動時自動匯入。支援絕對路徑和相對於主目錄的路徑(例如 '~/Documents/roo-code-settings.json')。留空以停用自動匯入。", + "settings.useAgentRules.description": "為特定於代理的規則啟用 AGENTS.md 檔案的載入(請參閱 https://agent-rules.org/)" } From 073e817706fde0a314ca6470699605bbe65faa82 Mon Sep 17 00:00:00 2001 From: Daniel Riccio Date: Wed, 23 Jul 2025 15:19:11 -0500 Subject: [PATCH 03/12] fix: revert README.md changes for AGENTS.md feature As requested in PR review, removing the Agent Rules mention from README.md since the feature is now disabled by default. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e9ebeed1437..c173cdb3d71 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,6 @@ Make Roo Code work your way with: - [Custom Modes](https://docs.roocode.com/advanced-usage/custom-modes) for specialized tasks - [Local Models](https://docs.roocode.com/advanced-usage/local-models) for offline use - [Auto-Approval Settings](https://docs.roocode.com/advanced-usage/auto-approving-actions) for faster workflows -- **Agent Rules Standard** - Roo Code supports the [Agent Rules](https://agent-rules.org/) standard via `AGENTS.md` files, enabling unified natural language guidelines across different AI coding tools ## Resources From 2fc7bf5cd7cce063bccf79ddc3db6eec3da2e3ea Mon Sep 17 00:00:00 2001 From: Daniel Riccio Date: Wed, 23 Jul 2025 15:26:51 -0500 Subject: [PATCH 04/12] fix: ensure AGENTS.md only loads when useAgentRules is explicitly true --- src/core/prompts/sections/custom-instructions.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/prompts/sections/custom-instructions.ts b/src/core/prompts/sections/custom-instructions.ts index 20a1195a2c6..3ce8cdc0f63 100644 --- a/src/core/prompts/sections/custom-instructions.ts +++ b/src/core/prompts/sections/custom-instructions.ts @@ -235,7 +235,12 @@ export async function addCustomInstructions( globalCustomInstructions: string, cwd: string, mode: string, - options: { language?: string; rooIgnoreInstructions?: string; useAgentRules?: boolean; settings?: Record } = {}, + options: { + language?: string + rooIgnoreInstructions?: string + useAgentRules?: boolean + settings?: Record + } = {}, ): Promise { const sections = [] @@ -313,8 +318,8 @@ export async function addCustomInstructions( rules.push(options.rooIgnoreInstructions) } - // Add AGENTS.md content if enabled (default: true) - if (options.useAgentRules !== false) { + // Add AGENTS.md content if enabled (default: false) + if (options.useAgentRules === true) { const agentRulesContent = await loadAgentRulesFile(cwd) if (agentRulesContent && agentRulesContent.trim()) { rules.push(agentRulesContent.trim()) From 8456f02e4024fab894d23aaf0fa29978be696a6c Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 23 Jul 2025 20:41:57 +0000 Subject: [PATCH 05/12] feat: add AGENTS.md to protected files list --- src/core/protect/RooProtectedController.ts | 1 + src/core/protect/__tests__/RooProtectedController.spec.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/core/protect/RooProtectedController.ts b/src/core/protect/RooProtectedController.ts index 86122c76608..e6d57b22b54 100644 --- a/src/core/protect/RooProtectedController.ts +++ b/src/core/protect/RooProtectedController.ts @@ -20,6 +20,7 @@ export class RooProtectedController { ".roo/**", ".vscode/**", ".rooprotected", // For future use + "AGENTS.md", ] constructor(cwd: string) { diff --git a/src/core/protect/__tests__/RooProtectedController.spec.ts b/src/core/protect/__tests__/RooProtectedController.spec.ts index 6c998e365a4..0ee6135e810 100644 --- a/src/core/protect/__tests__/RooProtectedController.spec.ts +++ b/src/core/protect/__tests__/RooProtectedController.spec.ts @@ -44,6 +44,10 @@ describe("RooProtectedController", () => { expect(controller.isWriteProtected(".vscode/tasks.json")).toBe(true) }) + it("should protect AGENTS.md file", () => { + expect(controller.isWriteProtected("AGENTS.md")).toBe(true) + }) + it("should not protect other files starting with .roo", () => { expect(controller.isWriteProtected(".roosettings")).toBe(false) expect(controller.isWriteProtected(".rooconfig")).toBe(false) @@ -142,6 +146,7 @@ describe("RooProtectedController", () => { ".roo/**", ".vscode/**", ".rooprotected", + "AGENTS.md", ]) }) }) From 7c36b5883f836e4eb9f18f1b64fb9af35c404c8c Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 23 Jul 2025 21:06:28 +0000 Subject: [PATCH 06/12] feat: change default value of useAgentRules to true - Updated default value in package.json from false to true - Updated implementation to load AGENTS.md when useAgentRules is undefined - Updated test expectations to match new default behavior - Updated fallback values in Task.ts and generateSystemPrompt.ts This enables AGENTS.md loading by default as requested by @mrubens --- .../prompts/sections/__tests__/custom-instructions.spec.ts | 7 ++++--- src/core/prompts/sections/custom-instructions.ts | 4 ++-- src/core/task/Task.ts | 3 +-- src/core/webview/generateSystemPrompt.ts | 2 +- src/package.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts index 33335d0b0d7..48443484ffb 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts @@ -554,7 +554,7 @@ describe("addCustomInstructions", () => { expect(result).not.toContain("Agent rules from AGENTS.md file") }) - it("should not load AGENTS.md by default when useAgentRules is undefined", async () => { + it("should load AGENTS.md by default when useAgentRules is undefined", async () => { // Simulate no .roo/rules-test-mode directory statMock.mockRejectedValueOnce({ code: "ENOENT" }) @@ -574,8 +574,9 @@ describe("addCustomInstructions", () => { {}, // No useAgentRules specified ) - expect(result).not.toContain("# Agent Rules Standard (AGENTS.md):") - expect(result).not.toContain("Agent rules from AGENTS.md file") + expect(result).toContain("# Agent Rules Standard (AGENTS.md):") + expect(result).toContain("Agent rules from AGENTS.md file") + expect(readFileMock).toHaveBeenCalledWith(expect.stringContaining("AGENTS.md"), "utf-8") }) it("should handle missing AGENTS.md gracefully", async () => { diff --git a/src/core/prompts/sections/custom-instructions.ts b/src/core/prompts/sections/custom-instructions.ts index 3ce8cdc0f63..d00ad69b00b 100644 --- a/src/core/prompts/sections/custom-instructions.ts +++ b/src/core/prompts/sections/custom-instructions.ts @@ -318,8 +318,8 @@ export async function addCustomInstructions( rules.push(options.rooIgnoreInstructions) } - // Add AGENTS.md content if enabled (default: false) - if (options.useAgentRules === true) { + // Add AGENTS.md content if enabled (default: true) + if (options.useAgentRules !== false) { const agentRulesContent = await loadAgentRulesFile(cwd) if (agentRulesContent && agentRulesContent.trim()) { rules.push(agentRulesContent.trim()) diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 76fc1860e19..bbe34ef06d2 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1663,8 +1663,7 @@ export class Task extends EventEmitter { { maxConcurrentFileReads, todoListEnabled: apiConfiguration?.todoListEnabled, - useAgentRules: - vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? false, + useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, }, ) })() diff --git a/src/core/webview/generateSystemPrompt.ts b/src/core/webview/generateSystemPrompt.ts index 031e805241f..98fb91d745b 100644 --- a/src/core/webview/generateSystemPrompt.ts +++ b/src/core/webview/generateSystemPrompt.ts @@ -86,7 +86,7 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web useAgentRules: provider.context.globalState.get("useAgentRules") ?? vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? - false, + true, }, ) diff --git a/src/package.json b/src/package.json index f77ca2fcd72..1fac5fb3659 100644 --- a/src/package.json +++ b/src/package.json @@ -389,7 +389,7 @@ }, "roo-cline.useAgentRules": { "type": "boolean", - "default": false, + "default": true, "description": "%settings.useAgentRules.description%" } } From e3c11afbfa6e8bdb8206f9b558f6f67658226604 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 23 Jul 2025 21:17:14 +0000 Subject: [PATCH 07/12] fix: update test mocks to account for AGENTS.md being loaded by default --- .../sections/__tests__/custom-instructions-global.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts index 75896f31dde..8a4013885b5 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts @@ -193,6 +193,7 @@ describe("custom-instructions global .roo support", () => { mockReadFile .mockResolvedValueOnce("global mode rule content") .mockResolvedValueOnce("project mode rule content") + .mockResolvedValueOnce("") // AGENTS.md file (empty) - now checked by default .mockResolvedValueOnce("") // .roorules legacy file (empty) .mockResolvedValueOnce("") // .clinerules legacy file (empty) @@ -218,6 +219,7 @@ describe("custom-instructions global .roo support", () => { // Mock legacy mode file reading mockReadFile .mockResolvedValueOnce("legacy mode rule content") // .roorules-code + .mockResolvedValueOnce("") // AGENTS.md file (empty) - now checked by default .mockResolvedValueOnce("") // generic .roorules (empty) .mockResolvedValueOnce("") // generic .clinerules (empty) From f77189b3eb2c6f8098ab5209aa08d6bb2c927192 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 24 Jul 2025 00:12:58 -0400 Subject: [PATCH 08/12] Type cleanup --- .../__tests__/custom-instructions.spec.ts | 16 ++++++++-------- src/core/prompts/sections/custom-instructions.ts | 7 ++++--- src/core/prompts/system.ts | 8 ++++---- src/core/prompts/types.ts | 8 ++++++++ 4 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 src/core/prompts/types.ts diff --git a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts index 48443484ffb..2da87a82320 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts @@ -505,7 +505,7 @@ describe("addCustomInstructions", () => { expect(result).toContain("Rules from .roorules-test-mode:\nmode specific rules") }) - it("should load AGENTS.md when useAgentRules is true", async () => { + it("should load AGENTS.md when settings.useAgentRules is true", async () => { // Simulate no .roo/rules-test-mode directory statMock.mockRejectedValueOnce({ code: "ENOENT" }) @@ -522,7 +522,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { useAgentRules: true }, + { settings: { useAgentRules: true } }, ) expect(result).toContain("# Agent Rules Standard (AGENTS.md):") @@ -530,7 +530,7 @@ describe("addCustomInstructions", () => { expect(readFileMock).toHaveBeenCalledWith(expect.stringContaining("AGENTS.md"), "utf-8") }) - it("should not load AGENTS.md when useAgentRules is false", async () => { + it("should not load AGENTS.md when settings.useAgentRules is false", async () => { // Simulate no .roo/rules-test-mode directory statMock.mockRejectedValueOnce({ code: "ENOENT" }) @@ -547,14 +547,14 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { useAgentRules: false }, + { settings: { useAgentRules: false } }, ) expect(result).not.toContain("# Agent Rules Standard (AGENTS.md):") expect(result).not.toContain("Agent rules from AGENTS.md file") }) - it("should load AGENTS.md by default when useAgentRules is undefined", async () => { + it("should load AGENTS.md by default when settings.useAgentRules is undefined", async () => { // Simulate no .roo/rules-test-mode directory statMock.mockRejectedValueOnce({ code: "ENOENT" }) @@ -571,7 +571,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - {}, // No useAgentRules specified + {}, // No settings.useAgentRules specified ) expect(result).toContain("# Agent Rules Standard (AGENTS.md):") @@ -590,7 +590,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { useAgentRules: true }, + { settings: { useAgentRules: true } }, ) expect(result).toContain("Global Instructions:\nglobal instructions") @@ -618,7 +618,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { useAgentRules: true }, + { settings: { useAgentRules: true } }, ) // Should contain both AGENTS.md and .roorules content diff --git a/src/core/prompts/sections/custom-instructions.ts b/src/core/prompts/sections/custom-instructions.ts index d00ad69b00b..ccd36b26627 100644 --- a/src/core/prompts/sections/custom-instructions.ts +++ b/src/core/prompts/sections/custom-instructions.ts @@ -5,6 +5,8 @@ import { Dirent } from "fs" import { isLanguage } from "@roo-code/types" +import type { SystemPromptSettings } from "../types" + import { LANGUAGES } from "../../../shared/language" import { getRooDirectoriesForCwd, getGlobalRooDirectory } from "../../../services/roo-config" @@ -238,8 +240,7 @@ export async function addCustomInstructions( options: { language?: string rooIgnoreInstructions?: string - useAgentRules?: boolean - settings?: Record + settings?: SystemPromptSettings } = {}, ): Promise { const sections = [] @@ -319,7 +320,7 @@ export async function addCustomInstructions( } // Add AGENTS.md content if enabled (default: true) - if (options.useAgentRules !== false) { + if (options.settings?.useAgentRules !== false) { const agentRulesContent = await loadAgentRulesFile(cwd) if (agentRulesContent && agentRulesContent.trim()) { rules.push(agentRulesContent.trim()) diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index 4b109ced55a..cbe91903ee3 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -3,6 +3,8 @@ import * as os from "os" import type { ModeConfig, PromptComponent, CustomModePrompts, TodoItem } from "@roo-code/types" +import type { SystemPromptSettings } from "./types" + import { Mode, modes, defaultModeSlug, getModeBySlug, getGroupName, getModeSelection } from "../../shared/modes" import { DiffStrategy } from "../../shared/tools" import { formatLanguage } from "../../shared/language" @@ -57,7 +59,7 @@ async function generatePrompt( language?: string, rooIgnoreInstructions?: string, partialReadsEnabled?: boolean, - settings?: Record, + settings?: SystemPromptSettings, todoList?: TodoItem[], ): Promise { if (!context) { @@ -122,7 +124,6 @@ ${getObjectiveSection(codeIndexManager, experiments)} ${await addCustomInstructions(baseInstructions, globalCustomInstructions || "", cwd, mode, { language: language ?? formatLanguage(vscode.env.language), rooIgnoreInstructions, - useAgentRules: settings?.useAgentRules, settings, })}` @@ -146,7 +147,7 @@ export const SYSTEM_PROMPT = async ( language?: string, rooIgnoreInstructions?: string, partialReadsEnabled?: boolean, - settings?: Record, + settings?: SystemPromptSettings, todoList?: TodoItem[], ): Promise => { if (!context) { @@ -185,7 +186,6 @@ export const SYSTEM_PROMPT = async ( { language: language ?? formatLanguage(vscode.env.language), rooIgnoreInstructions, - useAgentRules: settings?.useAgentRules, settings, }, ) diff --git a/src/core/prompts/types.ts b/src/core/prompts/types.ts new file mode 100644 index 00000000000..b8bd8f9f013 --- /dev/null +++ b/src/core/prompts/types.ts @@ -0,0 +1,8 @@ +/** + * Settings passed to system prompt generation functions + */ +export interface SystemPromptSettings { + maxConcurrentFileReads?: number + todoListEnabled?: boolean + useAgentRules?: boolean +} From aa4b35ee69b888aa6153bbf40a662e92d5dbc4b0 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 24 Jul 2025 00:17:13 -0400 Subject: [PATCH 09/12] Fixes to generateSystemPrompt --- src/core/webview/generateSystemPrompt.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/webview/generateSystemPrompt.ts b/src/core/webview/generateSystemPrompt.ts index 98fb91d745b..39270e2aaa5 100644 --- a/src/core/webview/generateSystemPrompt.ts +++ b/src/core/webview/generateSystemPrompt.ts @@ -83,10 +83,8 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web maxReadFileLine !== -1, { maxConcurrentFileReads, - useAgentRules: - provider.context.globalState.get("useAgentRules") ?? - vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? - true, + todoListEnabled: apiConfiguration?.todoListEnabled, + useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, }, ) From 565b4efdd4b7d82227aa097baecb6b261e9c8e83 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 24 Jul 2025 00:26:47 -0400 Subject: [PATCH 10/12] Update src/package.nls.fr.json Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- src/package.nls.fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.nls.fr.json b/src/package.nls.fr.json index f2aef4c6543..ad4a4b77717 100644 --- a/src/package.nls.fr.json +++ b/src/package.nls.fr.json @@ -36,5 +36,5 @@ "settings.customStoragePath.description": "Chemin de stockage personnalisé. Laisser vide pour utiliser l'emplacement par défaut. Prend en charge les chemins absolus (ex: 'D:\\RooCodeStorage')", "settings.enableCodeActions.description": "Activer les correctifs rapides de Roo Code.", "settings.autoImportSettingsPath.description": "Chemin d'accès à un fichier de configuration RooCode à importer automatiquement au démarrage de l'extension. Prend en charge les chemins absolus et les chemins relatifs au répertoire de base (par exemple, '~/Documents/roo-code-settings.json'). Laisser vide pour désactiver l'importation automatique.", - "settings.useAgentRules.description": "Active le chargement des fichiers AGENTS.md pour les règles spécifiques à l'agent (voir https://agent-rules.org/)" + "settings.useAgentRules.description": "Activer le chargement des fichiers AGENTS.md pour les règles spécifiques à l'agent (voir https://agent-rules.org/)" } From 9ad49a1329044854fdf610e36158c401f6748e74 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 24 Jul 2025 00:27:44 -0400 Subject: [PATCH 11/12] Update custom-instructions-global.spec.ts --- .../sections/__tests__/custom-instructions-global.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts index 8a4013885b5..269dd554ea5 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions-global.spec.ts @@ -193,7 +193,7 @@ describe("custom-instructions global .roo support", () => { mockReadFile .mockResolvedValueOnce("global mode rule content") .mockResolvedValueOnce("project mode rule content") - .mockResolvedValueOnce("") // AGENTS.md file (empty) - now checked by default + .mockResolvedValueOnce("") // AGENTS.md file (empty) .mockResolvedValueOnce("") // .roorules legacy file (empty) .mockResolvedValueOnce("") // .clinerules legacy file (empty) @@ -219,7 +219,7 @@ describe("custom-instructions global .roo support", () => { // Mock legacy mode file reading mockReadFile .mockResolvedValueOnce("legacy mode rule content") // .roorules-code - .mockResolvedValueOnce("") // AGENTS.md file (empty) - now checked by default + .mockResolvedValueOnce("") // AGENTS.md file (empty) .mockResolvedValueOnce("") // generic .roorules (empty) .mockResolvedValueOnce("") // generic .clinerules (empty) From d3fb2b41dc1894fd888eb7fb83ef5e377447c61b Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 24 Jul 2025 00:31:27 -0400 Subject: [PATCH 12/12] Ensure that all settings are passed in --- src/core/prompts/__tests__/system-prompt.spec.ts | 8 +++++++- .../sections/__tests__/custom-instructions.spec.ts | 8 ++++---- src/core/prompts/types.ts | 6 +++--- src/core/task/Task.ts | 4 ++-- src/core/webview/generateSystemPrompt.ts | 4 ++-- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/core/prompts/__tests__/system-prompt.spec.ts b/src/core/prompts/__tests__/system-prompt.spec.ts index 7589790efe4..4d5579408c5 100644 --- a/src/core/prompts/__tests__/system-prompt.spec.ts +++ b/src/core/prompts/__tests__/system-prompt.spec.ts @@ -577,7 +577,9 @@ describe("SYSTEM_PROMPT", () => { it("should exclude update_todo_list tool when todoListEnabled is false", async () => { const settings = { + maxConcurrentFileReads: 5, todoListEnabled: false, + useAgentRules: true, } const prompt = await SYSTEM_PROMPT( @@ -607,7 +609,9 @@ describe("SYSTEM_PROMPT", () => { it("should include update_todo_list tool when todoListEnabled is true", async () => { const settings = { + maxConcurrentFileReads: 5, todoListEnabled: true, + useAgentRules: true, } const prompt = await SYSTEM_PROMPT( @@ -636,7 +640,9 @@ describe("SYSTEM_PROMPT", () => { it("should include update_todo_list tool when todoListEnabled is undefined", async () => { const settings = { - // todoListEnabled not set + maxConcurrentFileReads: 5, + todoListEnabled: true, + useAgentRules: true, } const prompt = await SYSTEM_PROMPT( diff --git a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts index 2da87a82320..01574406b2d 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts @@ -522,7 +522,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { useAgentRules: true } }, + { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, ) expect(result).toContain("# Agent Rules Standard (AGENTS.md):") @@ -547,7 +547,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { useAgentRules: false } }, + { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: false } }, ) expect(result).not.toContain("# Agent Rules Standard (AGENTS.md):") @@ -590,7 +590,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { useAgentRules: true } }, + { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, ) expect(result).toContain("Global Instructions:\nglobal instructions") @@ -618,7 +618,7 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { useAgentRules: true } }, + { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, ) // Should contain both AGENTS.md and .roorules content diff --git a/src/core/prompts/types.ts b/src/core/prompts/types.ts index b8bd8f9f013..3977ea98c51 100644 --- a/src/core/prompts/types.ts +++ b/src/core/prompts/types.ts @@ -2,7 +2,7 @@ * Settings passed to system prompt generation functions */ export interface SystemPromptSettings { - maxConcurrentFileReads?: number - todoListEnabled?: boolean - useAgentRules?: boolean + maxConcurrentFileReads: number + todoListEnabled: boolean + useAgentRules: boolean } diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index bbe34ef06d2..95d12f66aa1 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1661,8 +1661,8 @@ export class Task extends EventEmitter { rooIgnoreInstructions, maxReadFileLine !== -1, { - maxConcurrentFileReads, - todoListEnabled: apiConfiguration?.todoListEnabled, + maxConcurrentFileReads: maxConcurrentFileReads ?? 5, + todoListEnabled: apiConfiguration?.todoListEnabled ?? true, useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, }, ) diff --git a/src/core/webview/generateSystemPrompt.ts b/src/core/webview/generateSystemPrompt.ts index 39270e2aaa5..b8e87a1d4a6 100644 --- a/src/core/webview/generateSystemPrompt.ts +++ b/src/core/webview/generateSystemPrompt.ts @@ -82,8 +82,8 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web rooIgnoreInstructions, maxReadFileLine !== -1, { - maxConcurrentFileReads, - todoListEnabled: apiConfiguration?.todoListEnabled, + maxConcurrentFileReads: maxConcurrentFileReads ?? 5, + todoListEnabled: apiConfiguration?.todoListEnabled ?? true, useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, }, )