Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Jan 3, 2026

When Roo is opened in a folder containing multiple git repos, each with their own .roo folder, rules are now recursively discovered and loaded from all subdirectories.

Changes:

  • Add discoverSubfolderRooDirectories() using ripgrep to find all .roo dirs
  • Add getAllRooDirectoriesForCwd() to return ordered list of .roo directories
  • Add getAgentsDirectoriesForCwd() for AGENTS.md discovery
  • Update loadRuleFiles() to use recursive discovery
  • Add loadAllAgentRulesFiles() to load AGENTS.md from all directories
  • Update addCustomInstructions() for subfolder support
  • Add comprehensive tests for new functionality

Rules are loaded in order: Global -> Root -> Subfolders (alphabetically) Paths are shown clearly in the prompt for subfolder rules.


Important

Enhance Roo to recursively load .roo/rules and AGENTS.md from subdirectories, with new functions for directory discovery and a setting to enable this feature.

  • Behavior:
    • Recursively load .roo/rules and AGENTS.md from subdirectories when enableSubfolderRules is true.
    • Update loadRuleFiles() and addCustomInstructions() in custom-instructions.ts to support recursive loading.
  • Functions:
    • Add discoverSubfolderRooDirectories(), getAllRooDirectoriesForCwd(), and getAgentsDirectoriesForCwd() in roo-config/index.ts for directory discovery.
    • Add loadAllAgentRulesFiles() in custom-instructions.ts for loading AGENTS.md from all directories.
  • Settings:
    • Add enableSubfolderRules to global-settings.ts and SystemPromptSettings in types.ts.
    • Update ContextManagementSettings.tsx and SettingsView.tsx to include enableSubfolderRules setting.
  • Tests:
    • Add tests for new functions in roo-config/__tests__/index.spec.ts.
    • Update existing tests in custom-instructions.spec.ts and custom-instructions-global.spec.ts to cover recursive loading.
  • Misc:
    • Update translations in multiple settings.json files to include enableSubfolderRules descriptions.

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

When Roo is opened in a folder containing multiple git repos, each with their own .roo folder, rules are now recursively discovered and loaded from all subdirectories.

Changes:
- Add discoverSubfolderRooDirectories() using ripgrep to find all .roo dirs
- Add getAllRooDirectoriesForCwd() to return ordered list of .roo directories
- Add getAgentsDirectoriesForCwd() for AGENTS.md discovery
- Update loadRuleFiles() to use recursive discovery
- Add loadAllAgentRulesFiles() to load AGENTS.md from all directories
- Update addCustomInstructions() for subfolder support
- Add comprehensive tests for new functionality

Rules are loaded in order: Global -> Root -> Subfolders (alphabetically)
Paths are shown clearly in the prompt for subfolder rules.
@mrubens mrubens requested review from cte and jr as code owners January 3, 2026 05:19
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Jan 3, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 3, 2026

Rooviewer Clock   See task on Roo Cloud

All issues resolved. Latest commit removes unused dirPath parameter from formatDirectoryContent - a clean refactor with no issues.

  • src/shared/string-extensions.d.ts - File restored with documentation explaining it provides type declarations for webview-ui package
Previous reviews

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

Removed duplicate type declaration file that was not imported anywhere.
The same declaration already exists in src/utils/path.ts.
@mrubens
Copy link
Collaborator Author

mrubens commented Jan 3, 2026

@roomote now the type check is failing. Can you figure out what's going on and fix the root cause?

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jan 3, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 3, 2026

Fixaroo Clock   See task on Roo Cloud

Fixed the type check failure by restoring src/shared/string-extensions.d.ts. The webview-ui package includes ../src/shared but not ../src/utils/path.ts, so it needed this separate declaration file to see the toPosix() method. All local checks passed.

View commit | Revert commit

The webview-ui tsconfig.json includes ../src/shared but not ../src/utils/path.ts.
Without this declaration file, the webview-ui cannot see the toPosix() method
that is declared in src/utils/path.ts, causing type check failures.
@mrubens
Copy link
Collaborator Author

mrubens commented Jan 3, 2026

@roomote tests are failing now

@roomote
Copy link
Contributor

roomote bot commented Jan 3, 2026

Fixaroo Clock   See task on Roo Cloud

Fixed the failing tests by adding vscode to rollupOptions.external in webview-ui vite config. All local checks passed.

View commit | Revert commit

The roo-config/index.ts now dynamically imports file-search.ts which imports
vscode. Even with dynamic import, the bundler still tries to resolve vscode
for the webview-ui build. Adding vscode to external prevents this error.
@mrubens
Copy link
Collaborator Author

mrubens commented Jan 3, 2026

@roomote put this behind a setting in the Context section, defaulted to off

@roomote
Copy link
Contributor

roomote bot commented Jan 3, 2026

Fixaroo Clock   Follow along on Roo Cloud

Working on the following issue:

  • Add a setting for recursive subfolder rule loading, placed in the Context section, defaulted to off

Added a new setting in the Context section to control whether recursive
rule loading from subdirectories is enabled. The setting defaults to OFF
as requested.

Changes:
- Added roo-cline.enableSubfolderRules setting to package.json
- Added enableSubfolderRules to SystemPromptSettings and ExtensionState
- Added checkbox in ContextManagementSettings component
- Modified loadRuleFiles() and loadAllAgentRulesFiles() to check setting
- Updated addCustomInstructions() to pass setting through to functions
- Added enableSubfolderRules to GlobalSettings schema
- Updated all relevant test files with new property
@roomote
Copy link
Contributor

roomote bot commented Jan 3, 2026

Fixaroo Clock   See task on Roo Cloud

Added enableSubfolderRules setting in Context section (defaulted to OFF) to control recursive rule loading from subdirectories. All local checks passed.

View commit | Revert commit

@mrubens
Copy link
Collaborator Author

mrubens commented Jan 3, 2026

@roomote now switch into translate mode to translate the untranslated strings

@roomote
Copy link
Contributor

roomote bot commented Jan 3, 2026

Fixaroo Clock   See task on Roo Cloud

Translated the enableSubfolderRules setting to all 17 locales (webview-ui and package.nls files). All translations verified complete.

View commit | Revert commit

@mrubens
Copy link
Collaborator Author

mrubens commented Jan 3, 2026

@roomote move the configuration for this into the Context settings tab / state object.

@roomote
Copy link
Contributor

roomote bot commented Jan 3, 2026

Fixaroo Clock   See task on Roo Cloud

Moved enableSubfolderRules from VS Code configuration to Context settings state. All local checks passed.

View commit | Revert commit

Removed enableSubfolderRules from package.json contributes.configuration and all
i18n translation files. The setting is now managed exclusively through the
Context settings tab using ExtensionState, matching the pattern of other
context-related settings like showRooIgnoredFiles.
@mrubens mrubens merged commit 08c3431 into main Jan 3, 2026
10 checks passed
@mrubens mrubens deleted the feat/recursive-roo-rules-loading branch January 3, 2026 20:05
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jan 3, 2026
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jan 3, 2026
@github-actions github-actions bot mentioned this pull request Jan 4, 2026
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Jan 4, 2026
* test: update built-in commands count to 9

* fix: filter orphaned tool_results when more results than tool_uses (RooCodeInc#10027)

* Release v3.36.5 (RooCodeInc#10029)

* Changeset version bump (RooCodeInc#10032)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* fix: merge settings and versionedSettings for Roo provider models (RooCodeInc#10030)

* Revert "fix: merge settings and versionedSettings for Roo provider models" (RooCodeInc#10034)

* Revert the 3.6.5 release (we halted it) (RooCodeInc#10036)

* Release v3.36.5 (RooCodeInc#10037)

* Changeset version bump (RooCodeInc#10038)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* test: adjust terminal count limits in TerminalRegistry tests

* ux: improve auto-approve timer visibility in follow-up suggestions (RooCodeInc#10048)

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
Co-authored-by: Roo Code <[email protected]>

* fix: cancel auto-approval timeout when user starts typing (RooCodeInc#9937)

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>

* fix: extract raw error message from OpenRouter metadata (RooCodeInc#10039)

OpenRouter wraps upstream provider errors in a generic message but includes
the actual error in metadata.raw. This change:

- Adds OpenRouterErrorResponse interface for proper typing
- Creates handleStreamingError() helper for DRY error handling
- Extracts metadata.raw for actionable error messages in PostHog
- Includes nested error structure so getErrorMessage() can extract raw message

Before: PostHog receives '400 Provider returned error' (generic)
After: PostHog receives 'Model xyz not found' (actionable)

This enables proper error tracking and debugging via PostHog telemetry.

* feat: add tool alias support for model-specific tool customization (RooCodeInc#9989)

Co-authored-by: Hannes Rudolph <[email protected]>

* fix: show tool protocol dropdown for LiteLLM provider (RooCodeInc#10053)

* feat: add WorkspaceTaskVisibility type for organization cloud settings (RooCodeInc#10020)

* feat: add WorkspaceTaskVisibility type and workspaceTaskVisibility property to OrganizationCloudSettings

* refactor: create workspaceTaskVisibilitySchema and derive WorkspaceTaskVisibility type from it

---------

Co-authored-by: Roo Code <[email protected]>

* Release: v1.91.0 (RooCodeInc#10055)

chore: bump version to v1.91.0

* feat: sanitize MCP server/tool names for API compatibility (RooCodeInc#10054)

* Release v3.36.6 (RooCodeInc#10057)

* Changeset version bump (RooCodeInc#10058)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* fix: use JavaScript-based hover for checkpoint menu visibility (RooCodeInc#10056)

* feat: remove auto-approve toggles for to-do and retry actions (RooCodeInc#10062)

* feat(openrouter): add improvements to openrouter provider (RooCodeInc#10082)

* feat: Add Amazon Nova 2 Lite model to Bedrock provider (RooCodeInc#9830)

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>

* feat: add AWS Bedrock service tier support (RooCodeInc#9955)

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Roo Code <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>

* Capture more of OpenRouter's provider specific error details (RooCodeInc#10073)

* Capture more of OpenRouter's provider specific error details

* Actually match the openrouter structure

* feat(web-evals): improve run logs and formatters (RooCodeInc#10081)

* Move isToolAllowedForMode out of shared directory (RooCodeInc#10089)

* chore: add changeset for v3.36.7 (RooCodeInc#10091)

* Changeset version bump (RooCodeInc#10092)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix: prevent duplicate MCP tools error by deduplicating servers at source (RooCodeInc#10096)

* feat: add metadata to error details dialog (RooCodeInc#10050)

* feat: add metadata to error details dialog

- Prepends extension version, provider, model, and repository info to error details
- Helps users provide better bug reports with context
- Uses useExtensionState and useSelectedModel hooks for data

* Tweaks

---------

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: Bruno Bergher <[email protected]>

* web: Fixes link to provider pricing page (RooCodeInc#10107)

* feat(read-file): implement incremental token-budgeted file reading (RooCodeInc#10052)

* Add config to control public sharing (RooCodeInc#10105)

Co-authored-by: Roo Code <[email protected]>

* Release: v1.92.0 (RooCodeInc#10116)

* Remove the description from bedrock service tiers (RooCodeInc#10118)

* feat: remove strict ARN validation for Bedrock custom ARN users (RooCodeInc#10110)

Co-authored-by: Roo Code <[email protected]>

* fix: prevent race condition from deleting wrong API messages (RooCodeInc#10113)

Co-authored-by: daniel-lxs <[email protected]>

* feat(anthropic): enable native tools by default and add telemetry tracking (RooCodeInc#10021)

* feat: enable native tools by default for multiple providers (RooCodeInc#10059)

* Release v3.36.8 (RooCodeInc#10119)

* fix: add additionalProperties: false to nested MCP tool schemas (RooCodeInc#10109)

* fix: normalize tool call IDs for cross-provider compatibility via OpenRouter (RooCodeInc#10102)

* feat: add full error details to streaming failure dialog (RooCodeInc#10131)

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: cte <[email protected]>

* fix: validate tool_result IDs in delegation resume flow (RooCodeInc#10135)

* feat(evals): improve evals UI with tool groups and duration fix (RooCodeInc#10133)

Co-authored-by: Roo Code <[email protected]>

* Changeset version bump (RooCodeInc#10120)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Release v3.36.9 (RooCodeInc#10138)

* Changeset version bump (RooCodeInc#10137)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* fix: correct token counting for context truncation display (RooCodeInc#9961)

* feat(deepseek): implement interleaved thinking mode for deepseek-reasoner (RooCodeInc#9969)

* Update next.js to ~15.2.8 (RooCodeInc#10140)

* fix(deepseek): preserve reasoning_content during tool call sequences (RooCodeInc#10141)

Co-authored-by: Roo Code <[email protected]>

* feat: add gemini-3-flash-preview model (RooCodeInc#10151)

* Release v3.36.10 (RooCodeInc#10153)

* Changeset version bump (RooCodeInc#10154)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix(bedrock): convert tool_result to XML text when native tools disabled (RooCodeInc#10155)

* fix: remove dots and colons from MCP tool names for Bedrock compatibility (RooCodeInc#10152)

* fix: improve terminal process error handling and abort operation

* fix(ROO-202): refresh Roo models cache with session token on auth state change (RooCodeInc#10156)

* fix: support AWS GovCloud and China region ARNs in Bedrock provider (RooCodeInc#10157)

Co-authored-by: Roo Code <[email protected]>

* feat: enable native tool calling by default for Z.ai models (RooCodeInc#10158)

Co-authored-by: Roo Code <[email protected]>

* [feat] Claude Code Provider Native Tool Calling (RooCodeInc#10077)

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* fix: normalize MCP tool schemas for Bedrock and OpenAI strict mode (RooCodeInc#10148)

* fix: enable native tools by default for OpenAI compatible provider (RooCodeInc#10159)

* Release v3.36.11 (RooCodeInc#10161)

* Changeset version bump (RooCodeInc#10162)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* feat(telemetry): extract error messages from JSON payloads for better PostHog grouping (RooCodeInc#10163)

* fix: add userAgentAppId to Bedrock embedder for code indexing (RooCodeInc#10166)

Adds userAgentAppId configuration to the BedrockRuntimeClient in the
code indexing embedder, matching the implementation pattern already
used in the main Bedrock API provider.

This enables proper user agent identification in CloudTrail AWS requests
when using Bedrock for code indexing embeddings.

Fixes RooCodeInc#10165

Co-authored-by: Roo Code <[email protected]>

* feat: update OpenAI and Gemini tool preferences (RooCodeInc#10170)

* Release v3.36.12 (RooCodeInc#10181)

* Changeset version bump (RooCodeInc#10182)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* Revert "Revert "feat: change defaultToolProtocol default from xml to native"" (RooCodeInc#10186)

Co-authored-by: Roo Code <[email protected]>

* fix(litellm): merge default model info with router models for NTC support (RooCodeInc#10187)

* feat(types): add defaultToolProtocol: native to providers

- Added supportsNativeTools: true and defaultToolProtocol: native to all chutes models
- Added defaultToolProtocol: native to moonshot models (already had supportsNativeTools)
- Added defaultToolProtocol: native to litellm default model (already had supportsNativeTools)
- Added defaultToolProtocol: native to minimax models (already had supportsNativeTools)

This enables native tool calling by default for these providers, reducing
the number of users falling back to XML tool protocol unnecessarily.

* fix(litellm): merge only native tool defaults with router models

Only merges supportsNativeTools and defaultToolProtocol from litellmDefaultModelInfo,
not prices or other model-specific info that could be incorrect for different models.

* Release: v1.93.0 (RooCodeInc#10190)

* feat(vscode-lm): add native tool support (RooCodeInc#10191)

* feat: Replace edit_file tool alias with edit_file tool (RooCodeInc#9983)

* feat: lock task tool protocol for consistent task resumption (RooCodeInc#10192)

Co-authored-by: Roo Code <[email protected]>

* feat(telemetry): add PostHog exception tracking for consecutive mistake errors (RooCodeInc#10193)

* Release v3.36.13 (RooCodeInc#10194)

* Changeset version bump (RooCodeInc#10195)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* feat: improve 'no tools used' error handling with grace retry (RooCodeInc#10196)

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* feat(vertex): add native tool calling for Claude models on Vertex AI (RooCodeInc#10197)

Co-authored-by: daniel-lxs <[email protected]>

* fix: strip unsupported JSON Schema format values for OpenAI compatibility (RooCodeInc#10198)

* Release v3.36.14 (RooCodeInc#10200)

* Changeset version bump (RooCodeInc#10201)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* feat(telemetry): add telemetry event handling through webview messages

* fix: refresh models button not flushing cache properly (RooCodeInc#9870)

* feat(vertex): add 1M context window beta support for Claude Sonnet 4 (RooCodeInc#10209)

* feat(providers): add native tool calling support to LM Studio and Qwen-Code (RooCodeInc#10208)

* ux: improve API error handling and visibility (RooCodeInc#10204)

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Daniel <[email protected]>

* ux: add downloadable error diagnostics from chat errors (RooCodeInc#10188)

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
Co-authored-by: daniel-lxs <[email protected]>
Co-authored-by: Chris Estreich <[email protected]>

* feat: merge native tool defaults for openai-compatible provider (RooCodeInc#10213)

* fix: force additionalProperties false for strict mode compatibility (RooCodeInc#10210)

* fix: enable native tool calls for Requesty provider (ROO-235) (RooCodeInc#10211)

* Release v3.36.15 (RooCodeInc#10218)

* Changeset version bump (RooCodeInc#10219)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Estreich <[email protected]>

* fix: normalize tool schemas for VS Code LM API to fix error 400 (RooCodeInc#10221)

* Release v3.36.16 (RooCodeInc#10224)

* Changeset version bump (RooCodeInc#10225)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* Custom tool calling (RooCodeInc#10083)

* Remove the "test" custom tools (