Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Feb 27, 2025

Important

Allow users to set custom system prompts by creating a file in the workspace, with UI support and tests included.

  • Behavior:
    • Users can override system prompts by creating a file at .roo/system-prompt-[mode].
    • If the file exists, its content is used as the system prompt, excluding role definition and custom instructions.
    • If the file does not exist, default prompts are used.
  • Functions:
    • loadSystemPromptFile() in custom-system-prompt.ts reads the custom prompt file.
    • getSystemPromptFilePath() in custom-system-prompt.ts constructs the file path for the custom prompt.
  • UI:
    • PromptsView.tsx updated to include a disclosure for overriding system prompts.
    • Button added to open or create the custom prompt file.
  • Tests:
    • Added tests in custom-system-prompt.test.ts to verify custom prompt loading behavior.
    • Added tests in fs.test.ts for safeReadFile() and fileExistsAtPath() functions.
  • Misc:
    • safeReadFile() moved to fs.ts for reuse.

This description was created by Ellipsis for 8ab92b55ab0ffc77199deb25bfd6f4f1c19d4da8. It will automatically update as commits are pushed.

@mrubens mrubens requested a review from cte as a code owner February 27, 2025 20:07
@changeset-bot
Copy link

changeset-bot bot commented Feb 27, 2025

⚠️ No Changeset found

Latest commit: 1f0211e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Feb 27, 2025
/**
* Safely reads a file, returning an empty string if the file doesn't exist
*/
async function safeReadFile(filePath: string): Promise<string> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is identical to the existing safeReadFile. Consider importing and reusing the existing function instead.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 27, 2025
@mrubens mrubens force-pushed the custom_system_prompt branch from 1f0211e to 8ab92b5 Compare February 27, 2025 20:26
Copy link
Contributor

Choose a reason for hiding this comment

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

Document and consider refactoring the branch where a file-based custom system prompt exists. This branch omits default sections (TOOL USE, CAPABILITIES, MODES) – ensure that this behavior is intentional and clearly documented.

@mrubens mrubens force-pushed the custom_system_prompt branch from 8ab92b5 to 1f0211e Compare February 27, 2025 20:33
@mrubens mrubens merged commit 3d0e054 into main Feb 27, 2025
26 checks passed
@mrubens mrubens deleted the custom_system_prompt branch February 27, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants