-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Refactoring System Prompt #3275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… prevent long-running commands with attempt completion
# Conflicts: # src/core/prompts/instructions/create-mode.ts # src/core/prompts/sections/rules.ts # src/core/prompts/sections/system-info.ts # src/core/prompts/tools/new-task.ts
|
|
I recommend 0.25 temp for coder |
* do not exit with status code 0 if tests fail * fix broken tests * use a data-testid to find the button * Fix API options test
|
The changes are no longer valid |
Description
This PR refactors the system prompt generation logic and simplifies various sections of the prompt for conciseness and clarity. The main goals were to provide more flexibility in how system prompts are defined and to make the prompts easier for the AI to process.
Key changes include:
System Prompt Generation Refactor (
src/core/prompts/system.ts):generatePromptfunction to assemble the prompt from modular components.SYSTEM_PROMPTexport now prioritizes loading custom system prompts from dedicated files (e.g.,.cline/.system-promptor.cline/modes/your-mode/.system-prompt).Simplification of Prompt Sections:
src/core/prompts/sections/rules.ts): Significantly condensed and streamlined. Redundant explanations, lengthy examples, and verbose wording have been removed or shortened to make the rules more direct.src/core/prompts/tools/andsections/): Descriptions for tools likeapply_diff,write_to_file,insert_content, andsearch_and_replacewere updated for brevity and clarity within the main "TOOL USE" section and related "RULES". TheFILE_CONTENT_WARNINGconstant is now used forwrite_to_file.src/core/prompts/instructions/create-mcp-server.ts): The instructions for creating MCP servers have been heavily refactored into a more concise quick reference guide. It now focuses on configuration examples (local stdio and remote SSE) and essential steps, removing verbose explanations.capabilities.ts,custom-instructions.ts,modes.ts,objective.ts,system-info.ts,tool-use-guidelines.ts) received minor updates to align with the overall simplification and refactoring.Constants (
src/core/prompts/constants.ts): Introduced/updated constants likeFILE_CONTENT_WARNINGto centralize common messages.Testing:
src/core/prompts/__tests__/__snapshots__/system.test.ts.snaphave been updated to reflect all structural and content changes to the system prompts.src/core/prompts/__tests__/responses-rooignore.test.tsandsrc/core/prompts/__tests__/sections.test.ts.Shared Mode Logic: Minor updates in
src/shared/modes.tsandsrc/shared/__tests__/modes.test.ts.This refactor should improve the maintainability of the prompt generation code and the effectiveness of the prompts themselves.
Test Procedure
src/core/prompts/__tests__/__snapshots__/system.test.ts.snapto see the new prompt structures.codemode and any custom modes) to inspect the output..cline/.system-promptfile in the workspace root with custom content. Observe that the generated prompt uses this content and has a simpler structure..cline/modes/your-custom-mode/.system-promptfile for a specific custom mode and verify it's used for that mode.fetch_instructionsforcreate_mcp_serverandcreate_modeto see the updated instructions.npm test) to ensure they pass.Type of Change
Pre-Submission Checklist
Screenshots / Videos
N/A (Changes are to internal prompt generation)
Documentation Updates
Additional Notes
This refactor is a significant step towards making system prompts more manageable and customizable. The introduction of file-based prompts offers users greater control over the AI's persona and instructions for specific modes or globally.
Important
Refactors system prompt generation for modularity and clarity, introduces file-based custom prompts, and updates tool descriptions and prompt sections for improved maintainability and user customization.
system.tswithgeneratePrompt()for modular assembly.SYSTEM_PROMPTto prioritize file-based prompts, falling back to component-based generation.rules.ts,capabilities.ts, andtool-use-guidelines.tsfor clarity and brevity.tools/for consistency and clarity.create-mcp-server.tsandcreate-mode.tsinstructions for conciseness.constants.tsfor shared text elements likeTOOL_USE_FORMATandFILE_CONTENT_WARNING.system.test.ts.snapto reflect prompt changes.responses-rooignore.test.tsandsections.test.ts.modes.tswith new mode configurations and instructions.This description was created by
for 755ca43. You can customize this summary. It will automatically update as commits are pushed.