Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 24, 2025

Summary

This PR implements support for custom instruction file paths as requested in #6168. Users can now load instruction files from paths outside the default .roocode/ folder, enabling teams to reuse shared instruction templates across projects.

Changes

  • Added customInstructionPaths field to global settings schema
  • Implemented loadCustomInstructionFiles function to load instructions from external paths
  • Added comprehensive security validation:
    • Files must be within the workspace or parent directories (for monorepo scenarios)
    • Only markdown (.md, .markdown) and text (.txt) files are allowed
    • File size limit of 1MB to prevent loading huge files
    • Path validation to prevent dangerous patterns
  • Updated state management to pass customInstructionPaths through ClineProvider
  • Updated system prompt generation to include custom instruction paths
  • Added comprehensive tests covering all edge cases and security scenarios
  • Added JSDoc documentation for the new functionality

Usage Example

Users can now configure custom instruction paths in their settings:

{
  "customInstructionPaths": [
    ".github/copilot-instructions.md",
    "../shared/ai-instructions.md",
    "docs/team-guidelines.md"
  ]
}

Security Considerations

  • Files are validated to ensure they're within the workspace or parent directories
  • Absolute paths outside the workspace hierarchy are rejected
  • Only text-based files (markdown and txt) are supported
  • Large files (>1MB) are automatically skipped

Testing

  • Added comprehensive unit tests for all functionality
  • All existing tests pass
  • Security validation is thoroughly tested

Fixes #6168

- Add customInstructionPaths field to global settings schema
- Implement loadCustomInstructionFiles function to load from external paths
- Add security validation to ensure files are within workspace or parent dirs
- Support markdown (.md, .markdown) and text (.txt) files only
- Add file size limit (1MB) to prevent loading huge files
- Pass customInstructionPaths through ClineProvider state management
- Update system prompt generation to include custom instruction paths
- Add comprehensive tests for the new functionality
- Add JSDoc documentation for the new feature

Fixes #6168
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 24, 2025 14:24
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 24, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 24, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 25, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 25, 2025
@daniel-lxs
Copy link
Member

Closing for now, the issue requires scoping around the UX part, usually the main configuration file is not accessible by users

@daniel-lxs daniel-lxs closed this Aug 11, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Aug 11, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 11, 2025
@daniel-lxs daniel-lxs deleted the feature/custom-instruction-paths branch August 11, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Support Custom Instruction File Paths for RooCode

4 participants