Skip to content

feat: add support for AGENTS.local.md personal override files#11183

Merged
mrubens merged 6 commits intomainfrom
feature/agents-local-md-support
Feb 4, 2026
Merged

feat: add support for AGENTS.local.md personal override files#11183
mrubens merged 6 commits intomainfrom
feature/agents-local-md-support

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 bot commented Feb 4, 2026

Related GitHub Issue

This PR was initiated from a Roo Code Cloud task request.

Roo Code Task Context (Optional)

View task on Roo Code Cloud

Description

This PR adds support for AGENTS.local.md files alongside AGENTS.md files, providing users with a place to put personal overrides or preferences that they might not want to check in to version control.

Key implementation details:

  • Modified loadAgentRulesFileFromDirectory in src/core/prompts/sections/custom-instructions.ts to also look for .local.md variants after loading the base file
  • When AGENTS.md exists, the system now also checks for AGENTS.local.md and appends its content (same for AGENT.md/AGENT.local.md)
  • Added .gitignore patterns to exclude AGENTS.local.md and AGENT.local.md from version control
  • Local files are only loaded if a base file exists (standalone local files without a base are ignored)

The local file content is displayed with a distinct header (# Agent Rules Local (AGENTS.local.md):) to differentiate it from the standard rules.

Test Procedure

  1. Ran unit tests: cd src && npx vitest run core/prompts/sections/__tests__/custom-instructions.spec.ts - all 42 tests pass
  2. Added 4 new tests specifically for AGENTS.local.md functionality:
    • Loading AGENTS.local.md alongside AGENTS.md
    • Loading AGENT.local.md alongside AGENT.md
    • Not loading local file when base file does not exist
    • Loading AGENTS.md without local file when local does not exist
  3. ESLint passes with no warnings

Pre-Submission Checklist

  • Issue Linked: This PR is linked to a Roo Code Cloud task
  • Scope: Changes are focused on adding AGENTS.local.md support
  • Self-Review: I have performed a thorough self-review of my code
  • Testing: New unit tests have been added to cover the changes
  • Documentation Impact: Documentation updates may be needed to describe the new feature
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines

Screenshots / Videos

N/A - No UI changes

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates may be required to describe how users can use AGENTS.local.md for personal overrides.

Additional Notes

This feature provides a convenient way for developers to maintain personal agent rule overrides without affecting the shared AGENTS.md that is checked into version control. The .local.md files are automatically gitignored.


Important

Adds support for AGENTS.local.md files for personal agent rule overrides, with tests and .gitignore updates.

  • Behavior:
    • loadAgentRulesFileFromDirectory in custom-instructions.ts now loads AGENTS.local.md after AGENTS.md.
    • Appends AGENTS.local.md content if it exists, even if AGENTS.md does not.
    • .gitignore updated to exclude AGENTS.local.md and AGENT.local.md.
  • Tests:
    • Added tests in custom-instructions.spec.ts for loading AGENTS.local.md with/without AGENTS.md.
    • Tests ensure local files are ignored if no base file exists.
  • Misc:
    • AGENTS.local.md content displayed with header # Agent Rules Local (AGENTS.local.md):.

This description was created by Ellipsis for f17637d. You can customize this summary. It will automatically update as commits are pushed.

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 bot commented Feb 4, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The latest commit (fb5d347) reverts the behavior back to preferring AGENTS.md over AGENT.md when both exist. The implementation correctly:

  • Prefers AGENTS.md and breaks after finding it (does not also load AGENT.md)
  • Always loads AGENTS.local.md for personal overrides, even when no base file exists
  • Has comprehensive test coverage for all scenarios

All previously flagged issues have been resolved.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@mrubens mrubens marked this pull request as ready for review February 4, 2026 00:34
@mrubens mrubens requested review from cte, jr and mrubens as code owners February 4, 2026 00:34
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Feb 4, 2026
expect(result).toContain("Local overrides from AGENTS.local.md")
})

it("should not load AGENT.local.md (only AGENTS.local.md is supported)", async () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roomote just remove this test, don't need to test AGENT.md

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 bot commented Feb 4, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. The implementation is clean and well-structured.

  • Address @mrubens feedback: remove the AGENT.md test (comment #2761638761)

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 bot commented Feb 4, 2026

Fixaroo Clock   See task on Roo Cloud

Removed the unnecessary AGENT.md test as requested. All local checks passed.

View commit | Revert commit

expect(result).toContain("Local overrides from AGENTS.local.md")
})

it("should not load AGENTS.local.md when base AGENTS.md does not exist", async () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roomote it should load this even if AGENTS.md doesn't exist

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 bot commented Feb 4, 2026

Fixaroo Clock   See task on Roo Cloud

Fixed the reported issue. AGENTS.local.md now loads even when AGENTS.md doesn't exist. All tests pass.

View commit | Revert commit

…) when present

- Remove break statement to load both AGENTS.md and AGENT.md if they exist
- Update function documentation to clarify all files are loaded
- Update test to verify both files are loaded when both exist
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 4, 2026
@RooCodeInc RooCodeInc deleted a comment from roomote-v0 bot Feb 4, 2026
@RooCodeInc RooCodeInc deleted a comment from roomote-v0 bot Feb 4, 2026
@mrubens mrubens merged commit 1da2b1c into main Feb 4, 2026
10 checks passed
@mrubens mrubens deleted the feature/agents-local-md-support branch February 4, 2026 20:53
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Feb 4, 2026
mini2s referenced this pull request in zgsm-ai/costrict Feb 5, 2026