-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: main
Are you sure you want to change the base?
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 |
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
):generatePrompt
function to assemble the prompt from modular components.SYSTEM_PROMPT
export now prioritizes loading custom system prompts from dedicated files (e.g.,.cline/.system-prompt
or.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_replace
were updated for brevity and clarity within the main "TOOL USE" section and related "RULES". TheFILE_CONTENT_WARNING
constant 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_WARNING
to centralize common messages.Testing:
src/core/prompts/__tests__/__snapshots__/system.test.ts.snap
have been updated to reflect all structural and content changes to the system prompts.src/core/prompts/__tests__/responses-rooignore.test.ts
andsrc/core/prompts/__tests__/sections.test.ts
.Shared Mode Logic: Minor updates in
src/shared/modes.ts
andsrc/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.snap
to see the new prompt structures.code
mode and any custom modes) to inspect the output..cline/.system-prompt
file 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-prompt
file for a specific custom mode and verify it's used for that mode.fetch_instructions
forcreate_mcp_server
andcreate_mode
to 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.ts
withgeneratePrompt()
for modular assembly.SYSTEM_PROMPT
to prioritize file-based prompts, falling back to component-based generation.rules.ts
,capabilities.ts
, andtool-use-guidelines.ts
for clarity and brevity.tools/
for consistency and clarity.create-mcp-server.ts
andcreate-mode.ts
instructions for conciseness.constants.ts
for shared text elements likeTOOL_USE_FORMAT
andFILE_CONTENT_WARNING
.system.test.ts.snap
to reflect prompt changes.responses-rooignore.test.ts
andsections.test.ts
.modes.ts
with 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.