File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/core/prompts/sections Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -862,7 +862,7 @@ describe("addCustomInstructions", () => {
862862 expect ( readFileMock ) . toHaveBeenCalledWith ( expect . stringContaining ( "AGENT.md" ) , "utf-8" )
863863 } )
864864
865- it ( "should prefer AGENTS.md over AGENT.md when both exist" , async ( ) => {
865+ it ( "should load both AGENTS.md and AGENT.md when both exist" , async ( ) => {
866866 // Simulate no .roo/rules-test-mode directory
867867 statMock . mockRejectedValueOnce ( { code : "ENOENT" } )
868868
@@ -902,11 +902,13 @@ describe("addCustomInstructions", () => {
902902 } ,
903903 )
904904
905- // Should contain AGENTS.md content (preferred) and not AGENT.md
905+ // Should contain BOTH AGENTS.md and AGENT.md content
906906 expect ( result ) . toContain ( "# Agent Rules Standard (AGENTS.md):" )
907907 expect ( result ) . toContain ( "Agent rules from AGENTS.md file (plural)" )
908- expect ( result ) . not . toContain ( "Agent rules from AGENT.md file (singular)" )
908+ expect ( result ) . toContain ( "# Agent Rules Standard (AGENT.md):" )
909+ expect ( result ) . toContain ( "Agent rules from AGENT.md file (singular)" )
909910 expect ( readFileMock ) . toHaveBeenCalledWith ( expect . stringContaining ( "AGENTS.md" ) , "utf-8" )
911+ expect ( readFileMock ) . toHaveBeenCalledWith ( expect . stringContaining ( "AGENT.md" ) , "utf-8" )
910912 } )
911913
912914 it ( "should return empty string when no instructions provided" , async ( ) => {
Original file line number Diff line number Diff line change @@ -276,12 +276,13 @@ async function readAgentRulesFile(filePath: string): Promise<string> {
276276}
277277
278278/**
279- * Load AGENTS.md or AGENT.md file from a specific directory
280- * Checks for both AGENTS.md (standard) and AGENT.md (alternative) for compatibility
281- * Also loads AGENTS.local.md for personal overrides (not checked in to version control)
282- * AGENTS.local.md can be loaded even if AGENTS.md doesn't exist
279+ * Load agent rules files from a specific directory
280+ * Loads ALL of the following files if they exist:
281+ * - AGENTS.md (standard agent rules)
282+ * - AGENT.md (alternative naming)
283+ * - AGENTS.local.md (personal overrides, not checked in to version control)
283284 *
284- * @param directory - Directory to check for AGENTS.md
285+ * @param directory - Directory to check for agent rules files
285286 * @param showPath - Whether to include the directory path in the header
286287 * @param cwd - Current working directory for computing relative paths (optional)
287288 */
@@ -306,9 +307,7 @@ async function loadAgentRulesFileFromDirectory(
306307 ? `# Agent Rules Standard (${ filename } ) from ${ displayPath } :`
307308 : `# Agent Rules Standard (${ filename } ):`
308309 results . push ( `${ header } \n${ content } ` )
309-
310- // Found a standard file, don't check alternative
311- break
310+ // Continue to check for additional agent rules files
312311 }
313312 } catch ( err ) {
314313 // Silently ignore errors - agent rules files are optional
You can’t perform that action at this time.
0 commit comments