diff --git a/src/core/prompts/system-prompt/tools/attempt_completion.ts b/src/core/prompts/system-prompt/tools/attempt_completion.ts
index 11c68e1e..76e908dc 100644
--- a/src/core/prompts/system-prompt/tools/attempt_completion.ts
+++ b/src/core/prompts/system-prompt/tools/attempt_completion.ts
@@ -99,8 +99,8 @@ const GPT_5: ClineToolSpec = {
isZhCN(context.locale) ? INSTRUCTION_TASK_PROGRESS_GENERIC_ZH_CN : INSTRUCTION_TASK_PROGRESS_GENERIC_EN,
usage: "Checklist here (required if you used task_progress in previous tool uses)",
dependencies: [ClineDefaultTool.TODO],
- description: (context: SystemPromptContext) =>
- isZhCN(context.locale) ? INSTRUCTION_TASK_PROGRESS_DEPENDENCY_ZH_CN : INSTRUCTION_TASK_PROGRESS_DEPENDENCY_EN,
+ description:
+ "If you were using task_progress to update the task progress, you must include the completed list in the result as well.",
},
],
}
diff --git a/src/core/prompts/system-prompt/tools/browser_action.ts b/src/core/prompts/system-prompt/tools/browser_action.ts
index 4b6a5a70..a54e9cc0 100644
--- a/src/core/prompts/system-prompt/tools/browser_action.ts
+++ b/src/core/prompts/system-prompt/tools/browser_action.ts
@@ -1,57 +1,114 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
const id = ClineDefaultTool.BROWSER
+const DESCRIPTION_EN = `Request to interact with a Puppeteer-controlled browser. Every action, except \`close\`, will be responded to with a screenshot of the browser's current state, along with any new console logs. You may only perform one browser action per message, and wait for the user's response including a screenshot and logs to determine the next action.
+- The sequence of actions **must always start with** launching the browser at a URL, and **must always end with** closing the browser. If you need to visit a new URL that is not possible to navigate to from the current webpage, you must first close the browser, then launch again at the new URL.
+- While the browser is active, only the \`browser_action\` tool can be used. No other tools should be called during this time. You may proceed to use other tools only after closing the browser. For example if you run into an error and need to fix a file, you must close the browser, then use other tools to make the necessary changes, then re-launch the browser to verify the result.
+- The browser window has a resolution of **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** pixels. When performing any click actions, ensure the coordinates are within this resolution range.
+- Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges.`
+
+const DESCRIPTION_ZH_CN = `请求与 Puppeteer 控制的浏览器交互。除了 \`close\` 之外的每个操作都将通过浏览器当前状态的屏幕截图以及任何新的控制台日志来响应。每条消息只能执行一个浏览器操作,并等待用户的响应(包括屏幕截图和日志)以确定下一个操作。
+- 操作序列**必须始终以**在 URL 启动浏览器**开始**,并**必须始终以**关闭浏览器**结束**。如果您需要访问无法从当前网页导航到的新 URL,必须先关闭浏览器,然后在新 URL 处重新启动。
+- 在浏览器处于活动状态时,只能使用\`browser_action\`工具。在此期间不应调用其他工具。只有在关闭浏览器后才能继续使用其他工具。例如,如果遇到错误需要修复文件,必须关闭浏览器,然后使用其他工具进行必要的更改,然后重新启动浏览器以验证结果。
+- 浏览器窗口的分辨率为 **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** 像素。执行任何点击操作时,确保坐标在此分辨率范围内。
+- 在点击任何元素(如图标、链接或按钮)之前,必须查看提供的页面屏幕截图以确定元素的坐标。点击应针对**元素的中心**,而不是其边缘。`
+
+const INSTRUCTION_ACTION_EN = `The action to perform. The available actions are:
+ * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**.
+ - Use with the \`url\` parameter to provide the URL.
+ - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.)
+ * click: Click at a specific x,y coordinate.
+ - Use with the \`coordinate\` parameter to specify the location.
+ - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
+ * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text.
+ - Use with the \`text\` parameter to provide the string to type.
+ * scroll_down: Scroll down the page by one page height.
+ * scroll_up: Scroll up the page by one page height.
+ * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**.
+ - Example: \`close\``
+
+const INSTRUCTION_ACTION_ZH_CN = `要执行的操作。可用的操作有:
+ * launch:在指定的 URL 启动一个新的 Puppeteer 控制的浏览器实例。这**必须始终是第一个操作**。
+ - 与\`url\`参数一起使用以提供 URL。
+ - 确保 URL 有效并包含适当的协议(例如 http://localhost:3000/page、file:///path/to/file.html 等)
+ * click:在特定的 x,y 坐标处点击。
+ - 与\`coordinate\`参数一起使用以指定位置。
+ - 始终根据从屏幕截图得出的坐标点击元素(图标、按钮、链接等)的中心。
+ * type:在键盘上输入一段文本。您可以在单击文本字段后使用它来输入文本。
+ - 与\`text\`参数一起使用以提供要输入的字符串。
+ * scroll_down:向下滚动页面一个页面高度。
+ * scroll_up:向上滚动页面一个页面高度。
+ * close:关闭 Puppeteer 控制的浏览器实例。这**必须始终是最后的浏览器操作**。
+ - 示例:\`close\``
+
+const INSTRUCTION_URL_GENERIC_EN = `Use this for providing the URL for the \`launch\` action.
+ * Example: https://example.com`
+
+const INSTRUCTION_URL_GENERIC_ZH_CN = `用于为\`launch\`操作提供 URL。
+ * 示例:https://example.com`
+
+const INSTRUCTION_COORDINATE_GENERIC_EN = `The X and Y coordinates for the \`click\` action. Coordinates should be within the **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** resolution.
+ * Example: 450,300`
+
+const INSTRUCTION_COORDINATE_GENERIC_ZH_CN = `\`click\`操作的 X 和 Y 坐标。坐标应在 **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** 分辨率范围内。
+ * 示例:450,300`
+
+const INSTRUCTION_TEXT_GENERIC_EN = `Use this for providing the text for the \`type\` action.
+ * Example: Hello, world!`
+
+const INSTRUCTION_TEXT_GENERIC_ZH_CN = `用于为\`type\`操作提供文本。
+ * 示例:Hello, world!`
+
+const INSTRUCTION_URL_NATIVE_EN = `Use this for providing the URL for the \`launch\` action.`
+const INSTRUCTION_URL_NATIVE_ZH_CN = `用于为\`launch\`操作提供 URL。`
+
+const INSTRUCTION_COORDINATE_NATIVE_EN =
+ "x,y coordinates - The X and Y coordinates for the `click` action. Coordinates should be within the **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** resolution. Example: '450,300'"
+
+const INSTRUCTION_COORDINATE_NATIVE_ZH_CN =
+ "x,y 坐标 - `click`操作的 X 和 Y 坐标。坐标应在 **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** 分辨率范围内。示例:'450,300'"
+
+const INSTRUCTION_TEXT_NATIVE_EN = `Use this for providing the text for the \`type\` action. Example: 'Hello, world!'`
+const INSTRUCTION_TEXT_NATIVE_ZH_CN = `用于为\`type\`操作提供文本。示例:'Hello, world!'`
+
const GENERIC: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "browser_action",
- description: `Request to interact with a Puppeteer-controlled browser. Every action, except \`close\`, will be responded to with a screenshot of the browser's current state, along with any new console logs. You may only perform one browser action per message, and wait for the user's response including a screenshot and logs to determine the next action.
-- The sequence of actions **must always start with** launching the browser at a URL, and **must always end with** closing the browser. If you need to visit a new URL that is not possible to navigate to from the current webpage, you must first close the browser, then launch again at the new URL.
-- While the browser is active, only the \`browser_action\` tool can be used. No other tools should be called during this time. You may proceed to use other tools only after closing the browser. For example if you run into an error and need to fix a file, you must close the browser, then use other tools to make the necessary changes, then re-launch the browser to verify the result.
-- The browser window has a resolution of **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** pixels. When performing any click actions, ensure the coordinates are within this resolution range.
-- Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges.`,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
contextRequirements: (context) => context.supportsBrowserUse === true,
parameters: [
{
name: "action",
required: true,
- instruction: `The action to perform. The available actions are:
- * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**.
- - Use with the \`url\` parameter to provide the URL.
- - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.)
- * click: Click at a specific x,y coordinate.
- - Use with the \`coordinate\` parameter to specify the location.
- - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
- * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text.
- - Use with the \`text\` parameter to provide the string to type.
- * scroll_down: Scroll down the page by one page height.
- * scroll_up: Scroll up the page by one page height.
- * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**.
- - Example: \`close\``,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_ACTION_ZH_CN : INSTRUCTION_ACTION_EN,
usage: "Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close)",
},
{
name: "url",
required: false,
- instruction: `Use this for providing the URL for the \`launch\` action.
- * Example: https://example.com`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_URL_GENERIC_ZH_CN : INSTRUCTION_URL_GENERIC_EN,
usage: "URL to launch the browser at (optional)",
},
{
name: "coordinate",
required: false,
- instruction: `The X and Y coordinates for the \`click\` action. Coordinates should be within the **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** resolution.
- * Example: 450,300`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_COORDINATE_GENERIC_ZH_CN : INSTRUCTION_COORDINATE_GENERIC_EN,
usage: "x,y coordinates (optional)",
},
{
name: "text",
required: false,
- instruction: `Use this for providing the text for the \`type\` action.
- * Example: Hello, world!`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TEXT_GENERIC_ZH_CN : INSTRUCTION_TEXT_GENERIC_EN,
usage: "Text to type (optional)",
},
],
@@ -61,44 +118,32 @@ const NATIVE_NEXT_GEN: ClineToolSpec = {
variant: ModelFamily.NATIVE_NEXT_GEN,
id,
name: "browser_action",
- description: `Request to interact with a Puppeteer-controlled browser. Every action, except \`close\`, will be responded to with a screenshot of the browser's current state, along with any new console logs. You may only perform one browser action per message, and wait for the user's response including a screenshot and logs to determine the next action.
-- The sequence of actions **must always start with** launching the browser at a URL, and **must always end with** closing the browser. If you need to visit a new URL that is not possible to navigate to from the current webpage, you must first close the browser, then launch again at the new URL.
-- While the browser is active, only the \`browser_action\` tool can be used. No other tools should be called during this time. You may proceed to use other tools only after closing the browser. For example if you run into an error and need to fix a file, you must close the browser, then use other tools to make the necessary changes, then re-launch the browser to verify the result.
-- The browser window has a resolution of **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** pixels. When performing any click actions, ensure the coordinates are within this resolution range.
-- Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges.`,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
contextRequirements: (context) => context.supportsBrowserUse === true,
parameters: [
{
name: "action",
required: true,
- instruction: `The action to perform. The available actions are:
- * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**.
- - Use with the \`url\` parameter to provide the URL.
- - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.)
- * click: Click at a specific x,y coordinate.
- - Use with the \`coordinate\` parameter to specify the location.
- - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
- * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text.
- - Use with the \`text\` parameter to provide the string to type.
- * scroll_down: Scroll down the page by one page height.
- * scroll_up: Scroll up the page by one page height.
- * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**.
- - Example: 'scroll_up'`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_ACTION_ZH_CN : INSTRUCTION_ACTION_EN,
},
{
name: "url",
required: false,
- instruction: `Use this for providing the URL for the \`launch\` action.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_URL_NATIVE_ZH_CN : INSTRUCTION_URL_NATIVE_EN,
},
{
name: "coordinate",
required: false,
- instruction: `x,y coordinates - The X and Y coordinates for the \`click\` action. Coordinates should be within the **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** resolution. Example: '450,300'`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_COORDINATE_NATIVE_ZH_CN : INSTRUCTION_COORDINATE_NATIVE_EN,
},
{
name: "text",
required: false,
- instruction: `Use this for providing the text for the \`type\` action. Example: 'Hello, world!'`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TEXT_NATIVE_ZH_CN : INSTRUCTION_TEXT_NATIVE_EN,
},
],
}
diff --git a/src/core/prompts/system-prompt/tools/execute_command.ts b/src/core/prompts/system-prompt/tools/execute_command.ts
index 1f50e8f8..289b81fb 100644
--- a/src/core/prompts/system-prompt/tools/execute_command.ts
+++ b/src/core/prompts/system-prompt/tools/execute_command.ts
@@ -1,24 +1,48 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
+
+const DESCRIPTION_GENERIC_EN = `Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: {{CWD}}{{MULTI_ROOT_HINT}}`
+
+const DESCRIPTION_GENERIC_ZH_CN =
+ "请求在系统上执行 CLI 命令。当您需要执行系统操作或运行特定命令以完成用户任务的任何步骤时,请使用此命令。您必须根据用户的系统定制您的命令,并清楚解释该命令的作用。对于命令链,请使用适合用户 shell 的链接语法。优先执行复杂的 CLI 命令而不是创建可执行脚本,因为它们更灵活且更易于运行。命令将在当前工作目录中执行:{{CWD}}{{MULTI_ROOT_HINT}}"
+
+const INSTRUCTION_COMMAND_GENERIC_EN =
+ "The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions."
+
+const INSTRUCTION_COMMAND_GENERIC_ZH_CN = "要执行的 CLI 命令。这应适用于当前操作系统。确保命令格式正确且不包含任何有害指令。"
+
+const INSTRUCTION_REQUIRES_APPROVAL_GENERIC_EN =
+ "A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations."
+
+const INSTRUCTION_REQUIRES_APPROVAL_GENERIC_ZH_CN =
+ "一个布尔值,指示在用户启用自动批准模式的情况下,此命令在执行前是否需要明确的用户批准。对于可能产生影响的操作(如安装/卸载软件包、删除/覆盖文件、系统配置更改、网络操作或任何可能产生意外副作用的命令),设置为 'true'。对于安全操作(如读取文件/目录、运行开发服务器、构建项目和其他非破坏性操作),设置为 'false'。"
+
+const INSTRUCTION_TIMEOUT_GENERIC_EN =
+ "Integer representing the timeout in seconds for how long to run the terminal command, before timing out and continuing the task."
+
+const INSTRUCTION_TIMEOUT_GENERIC_ZH_CN = "表示终端命令运行超时时间(秒)的整数,超时后将继续任务。"
const GENERIC: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id: ClineDefaultTool.BASH,
name: "execute_command",
- description: `Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: {{CWD}}{{MULTI_ROOT_HINT}}`,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GENERIC_ZH_CN : DESCRIPTION_GENERIC_EN),
parameters: [
{
name: "command",
required: true,
- instruction: `The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_COMMAND_GENERIC_ZH_CN : INSTRUCTION_COMMAND_GENERIC_EN,
usage: "Your command here",
},
{
name: "requires_approval",
required: true,
- instruction:
- "A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_REQUIRES_APPROVAL_GENERIC_ZH_CN : INSTRUCTION_REQUIRES_APPROVAL_GENERIC_EN,
usage: "true or false",
type: "boolean",
},
@@ -27,31 +51,82 @@ const GENERIC: ClineToolSpec = {
required: false,
type: "integer",
contextRequirements: (context) => context.yoloModeToggled === true,
- instruction:
- "Integer representing the timeout in seconds for how long to run the terminal command, before timing out and continuing the task.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TIMEOUT_GENERIC_ZH_CN : INSTRUCTION_TIMEOUT_GENERIC_EN,
usage: "30",
},
],
}
+const DESCRIPTION_NATIVE_EN =
+ "Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task."
+
+const DESCRIPTION_NATIVE_ZH_CN =
+ "请求在系统上执行 CLI 命令。当您需要执行系统操作或运行特定命令以完成用户任务的任何步骤时,请使用此命令。"
+
+const INSTRUCTION_COMMAND_NATIVE_EN =
+ "The CLI command to execute. This should be valid for the current operating system. Do not use the ~ character or $HOME to refer to the home directory. Always use absolute paths. The command will be executed from the current workspace, you do not need to cd to the workspace."
+
+const INSTRUCTION_COMMAND_NATIVE_ZH_CN =
+ "要执行的 CLI 命令。这应适用于当前操作系统。不要使用 ~ 字符或 $HOME 来引用主目录。始终使用绝对路径。命令将从当前工作区执行,您不需要 cd 到工作区。"
+
+const INSTRUCTION_REQUIRES_APPROVAL_NATIVE_EN =
+ "To indicate whether this command requires explicit user approval or interaction before it should be executed. For system/file altering operations like installing/uninstalling packages, removing/overwriting files, system configuration changes, network operations, or any commands that are considered potentially dangerous must be set to true. False for safe operations like running development servers, building projects, and other non-destructive operations."
+
+const INSTRUCTION_REQUIRES_APPROVAL_NATIVE_ZH_CN =
+ "指示此命令在执行前是否需要明确的用户批准或交互。对于系统/文件更改操作,如安装/卸载软件包、删除/覆盖文件、系统配置更改、网络操作或任何被认为具有潜在危险的命令,必须设置为 true。对于安全操作(如运行开发服务器、构建项目和其他非破坏性操作),设置为 false。"
+
const NATIVE_GPT_5: ClineToolSpec = {
variant: ModelFamily.NATIVE_GPT_5,
id: ClineDefaultTool.BASH,
name: ClineDefaultTool.BASH,
- description:
- "Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_NATIVE_ZH_CN : DESCRIPTION_NATIVE_EN),
parameters: [
{
name: "command",
required: true,
- instruction:
- "The CLI command to execute. This should be valid for the current operating system. Do not use the ~ character or $HOME to refer to the home directory. Always use absolute paths. The command will be executed from the current workspace, you do not need to cd to the workspace.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_COMMAND_NATIVE_ZH_CN : INSTRUCTION_COMMAND_NATIVE_EN,
},
{
name: "requires_approval",
required: true,
- instruction:
- "To indicate whether this command requires explicit user approval or interaction before it should be executed. For system/file altering operations like installing/uninstalling packages, removing/overwriting files, system configuration changes, network operations, or any commands that are considered potentially dangerous must be set to true. False for safe operations like running development servers, building projects, and other non-destructive operations.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_REQUIRES_APPROVAL_NATIVE_ZH_CN : INSTRUCTION_REQUIRES_APPROVAL_NATIVE_EN,
+ type: "boolean",
+ },
+ ],
+}
+
+const DESCRIPTION_GEMINI_EN =
+ "Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. When chaining commands, use the shell operator && (not the HTML entity &&). If using search/grep commands, be careful to not use vague search terms that may return thousands of results. When in PLAN MODE, you may use the execute_command tool, but only in a non-destructive manner and in a way that does not alter any files."
+
+const DESCRIPTION_GEMINI_ZH_CN =
+ "请求在系统上执行 CLI 命令。当您需要执行系统操作或运行特定命令以完成用户任务的任何步骤时,请使用此命令。链接命令时,请使用 shell 运算符 &&(而不是 HTML 实体 &&)。如果使用搜索/grep 命令,请注意不要使用可能返回数千个结果的模糊搜索词。在 PLAN MODE 中,您可以使用 execute_command 工具,但只能以非破坏性的方式和不更改任何文件的方式使用。"
+
+const INSTRUCTION_COMMAND_GEMINI_EN =
+ "The CLI command to execute. This should be valid for the current operating system. For command chaining, use proper shell operators like && to chain commands (e.g., 'cd path && command'). Do not use the ~ character or $HOME to refer to the home directory. Always use absolute paths. Do not run search/grep commands that may return thousands of results."
+
+const INSTRUCTION_COMMAND_GEMINI_ZH_CN =
+ "要执行的 CLI 命令。这应适用于当前操作系统。对于命令链,请使用适当的 shell 运算符(如 &&)来链接命令(例如,'cd path && command')。不要使用 ~ 字符或 $HOME 来引用主目录。始终使用绝对路径。不要运行可能返回数千个结果的搜索/grep 命令。"
+
+const GEMINI_3: ClineToolSpec = {
+ variant: ModelFamily.GEMINI_3,
+ id: ClineDefaultTool.BASH,
+ name: ClineDefaultTool.BASH,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GEMINI_ZH_CN : DESCRIPTION_GEMINI_EN),
+ parameters: [
+ {
+ name: "command",
+ required: true,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_COMMAND_GEMINI_ZH_CN : INSTRUCTION_COMMAND_GEMINI_EN,
+ },
+ {
+ name: "requires_approval",
+ required: true,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_REQUIRES_APPROVAL_NATIVE_ZH_CN : INSTRUCTION_REQUIRES_APPROVAL_NATIVE_EN,
type: "boolean",
},
],
@@ -62,27 +137,4 @@ const NATIVE_NEXT_GEN: ClineToolSpec = {
variant: ModelFamily.NATIVE_NEXT_GEN,
}
-const GEMINI_3: ClineToolSpec = {
- variant: ModelFamily.GEMINI_3,
- id: ClineDefaultTool.BASH,
- name: ClineDefaultTool.BASH,
- description:
- "Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. When chaining commands, use the shell operator && (not the HTML entity &&). If using search/grep commands, be careful to not use vague search terms that may return thousands of results. When in PLAN MODE, you may use the execute_command tool, but only in a non-destructive manner and in a way that does not alter any files.",
- parameters: [
- {
- name: "command",
- required: true,
- instruction:
- "The CLI command to execute. This should be valid for the current operating system. For command chaining, use proper shell operators like && to chain commands (e.g., 'cd path && command'). Do not use the ~ character or $HOME to refer to the home directory. Always use absolute paths. Do not run search/grep commands that may return thousands of results.",
- },
- {
- name: "requires_approval",
- required: true,
- instruction:
- "To indicate whether this command requires explicit user approval or interaction before it should be executed. For system/file altering operations like installing/uninstalling packages, removing/overwriting files, system configuration changes, network operations, or any commands that are considered potentially dangerous must be set to true. False for safe operations like running development servers, building projects, and other non-destructive operations.",
- type: "boolean",
- },
- ],
-}
-
export const execute_command_variants: ClineToolSpec[] = [GENERIC, NATIVE_GPT_5, NATIVE_NEXT_GEN, GEMINI_3]
diff --git a/src/core/prompts/system-prompt/tools/generate_explanation.ts b/src/core/prompts/system-prompt/tools/generate_explanation.ts
index a2e2967b..260d0bb0 100644
--- a/src/core/prompts/system-prompt/tools/generate_explanation.ts
+++ b/src/core/prompts/system-prompt/tools/generate_explanation.ts
@@ -1,36 +1,61 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
const id = ClineDefaultTool.GENERATE_EXPLANATION
+const DESCRIPTION_EN =
+ "Opens a multi-file diff view and generates AI-powered inline comments explaining the changes between two git references. Use this tool to help users understand code changes from git commits, pull requests, branches, or any git refs. The tool uses git to retrieve file contents and displays a side-by-side diff view with explanatory comments."
+
+const DESCRIPTION_ZH_CN =
+ "打开多文件差异视图并生成 AI 驱动的内联注释,解释两个 git 引用之间的更改。使用此工具帮助用户理解来自 git 提交、拉取请求、分支或任何 git 引用的代码更改。该工具使用 git 检索文件内容并显示带有解释性注释的并排差异视图。"
+
+const INSTRUCTION_TITLE_EN =
+ "A descriptive title for the diff view (e.g., 'Changes in commit abc123', 'PR #42: Add authentication', 'Changes between main and feature-branch')"
+
+const INSTRUCTION_TITLE_ZH_CN =
+ "差异视图的描述性标题(例如,「提交 abc123 中的更改」、「PR #42:添加身份验证」、「main 和 feature-branch 之间的更改」)"
+
+const INSTRUCTION_FROM_REF_EN =
+ "The git reference for the 'before' state. Can be a commit hash, branch name, tag, or relative reference like HEAD~1, HEAD^, origin/main, etc."
+
+const INSTRUCTION_FROM_REF_ZH_CN =
+ "「之前」状态的 git 引用。可以是提交哈希、分支名称、标签或相对引用,如 HEAD~1、HEAD^、origin/main 等。"
+
+const INSTRUCTION_TO_REF_EN =
+ "The git reference for the 'after' state. Can be a commit hash, branch name, tag, or relative reference. If not provided, compares to the current working directory (including uncommitted changes)."
+
+const INSTRUCTION_TO_REF_ZH_CN =
+ "「之后」状态的 git 引用。可以是提交哈希、分支名称、标签或相对引用。如果未提供,则与当前工作目录(包括未提交的更改)进行比较。"
+
const GENERIC: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "generate_explanation",
- description:
- "Opens a multi-file diff view and generates AI-powered inline comments explaining the changes between two git references. Use this tool to help users understand code changes from git commits, pull requests, branches, or any git refs. The tool uses git to retrieve file contents and displays a side-by-side diff view with explanatory comments.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
contextRequirements: (context) => context.isCliEnvironment !== true,
parameters: [
{
name: "title",
required: true,
- instruction:
- "A descriptive title for the diff view (e.g., 'Changes in commit abc123', 'PR #42: Add authentication', 'Changes between main and feature-branch')",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TITLE_ZH_CN : INSTRUCTION_TITLE_EN,
usage: "Changes in last commit",
},
{
name: "from_ref",
required: true,
- instruction:
- "The git reference for the 'before' state. Can be a commit hash, branch name, tag, or relative reference like HEAD~1, HEAD^, origin/main, etc.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_FROM_REF_ZH_CN : INSTRUCTION_FROM_REF_EN,
usage: "HEAD~1",
},
{
name: "to_ref",
required: false,
- instruction:
- "The git reference for the 'after' state. Can be a commit hash, branch name, tag, or relative reference. If not provided, compares to the current working directory (including uncommitted changes).",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TO_REF_ZH_CN : INSTRUCTION_TO_REF_EN,
usage: "HEAD",
},
],
diff --git a/src/core/prompts/system-prompt/tools/list_code_definition_names.ts b/src/core/prompts/system-prompt/tools/list_code_definition_names.ts
index 975403ce..61b71886 100644
--- a/src/core/prompts/system-prompt/tools/list_code_definition_names.ts
+++ b/src/core/prompts/system-prompt/tools/list_code_definition_names.ts
@@ -1,21 +1,41 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
const id = ClineDefaultTool.LIST_CODE_DEF
+const DESCRIPTION_EN =
+ "Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture."
+
+const DESCRIPTION_ZH_CN =
+ "请求列出指定目录顶层源代码文件中使用的定义名称(类、函数、方法等)。此工具提供有关代码库结构和重要构造的见解,封装了对于理解整体架构至关重要的高级概念和关系。"
+
+const INSTRUCTION_PATH_GENERIC_EN =
+ "The path of a directory (not a file) relative to the current working directory {{CWD}}{{MULTI_ROOT_HINT}}. Lists definitions across all source files in that directory. To inspect a single file, use read_file instead."
+
+const INSTRUCTION_PATH_GENERIC_ZH_CN =
+ "目录(而非文件)相对于当前工作目录 {{CWD}}{{MULTI_ROOT_HINT}} 的路径。列出该目录中所有源文件的定义。要检查单个文件,请改用 read_file。"
+
+const INSTRUCTION_PATH_NATIVE_EN =
+ "The path of a directory (not a file) relative to the current working directory {{CWD}}{{MULTI_ROOT_HINT}}. Lists definitions across all source files in that directory. To inspect a single file, use read_file instead."
+
+const INSTRUCTION_PATH_NATIVE_ZH_CN =
+ "目录(而非文件)相对于当前工作目录 {{CWD}}{{MULTI_ROOT_HINT}} 的路径。列出该目录中所有源文件的定义。要检查单个文件,请改用 read_file。"
+
const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "list_code_definition_names",
- description:
- "Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
parameters: [
{
name: "path",
required: true,
- instruction: `The path of a directory (not a file) relative to the current working directory {{CWD}}{{MULTI_ROOT_HINT}}. Lists definitions across all source files in that directory. To inspect a single file, use read_file instead.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_GENERIC_ZH_CN : INSTRUCTION_PATH_GENERIC_EN,
usage: "Directory path here",
},
TASK_PROGRESS_PARAMETER,
@@ -26,13 +46,13 @@ const NATIVE_GPT_5: ClineToolSpec = {
variant: ModelFamily.NATIVE_GPT_5,
id,
name: "list_code_definition_names",
- description:
- "Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
parameters: [
{
name: "path",
required: true,
- instruction: `The path of a directory (not a file) relative to the current working directory {{CWD}}{{MULTI_ROOT_HINT}}. Lists definitions across all source files in that directory. To inspect a single file, use read_file instead.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_NATIVE_ZH_CN : INSTRUCTION_PATH_NATIVE_EN,
},
TASK_PROGRESS_PARAMETER,
],
diff --git a/src/core/prompts/system-prompt/tools/list_files.ts b/src/core/prompts/system-prompt/tools/list_files.ts
index e51d7189..1ed89c71 100644
--- a/src/core/prompts/system-prompt/tools/list_files.ts
+++ b/src/core/prompts/system-prompt/tools/list_files.ts
@@ -1,28 +1,45 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
const id = ClineDefaultTool.LIST_FILES
+const DESCRIPTION_EN =
+ "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not."
+
+const DESCRIPTION_ZH_CN =
+ "请求列出指定目录中的文件和目录。如果 recursive 为 true,它将递归列出所有文件和目录。如果 recursive 为 false 或未提供,它将仅列出顶层内容。不要使用此工具来确认您可能创建的文件是否存在,因为用户会告诉您文件是否成功创建。"
+
+const INSTRUCTION_PATH_EN =
+ "The path of the directory to list contents for (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}"
+
+const INSTRUCTION_PATH_ZH_CN = "要列出其内容的目录的路径(相对于当前工作目录 {{CWD}}){{MULTI_ROOT_HINT}}"
+
+const INSTRUCTION_RECURSIVE_EN =
+ "Whether to list files recursively. Use true for recursive listing, false or omit for top-level only."
+const INSTRUCTION_RECURSIVE_ZH_CN = "是否递归列出文件。使用 true 进行递归列出,使用 false 或省略以仅列出顶层内容。"
+
const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "list_files",
- description:
- "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
parameters: [
{
name: "path",
required: true,
- instruction:
- "The path of the directory to list contents for (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_ZH_CN : INSTRUCTION_PATH_EN,
usage: "Directory path here",
},
{
name: "recursive",
required: false,
- instruction: "Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_RECURSIVE_ZH_CN : INSTRUCTION_RECURSIVE_EN,
usage: "true or false (optional)",
type: "boolean",
},
@@ -30,22 +47,30 @@ const generic: ClineToolSpec = {
],
}
+const INSTRUCTION_PATH_NATIVE_EN = "The path of the directory to list contents for."
+const INSTRUCTION_PATH_NATIVE_ZH_CN = "要列出其内容的目录的路径。"
+
+const INSTRUCTION_RECURSIVE_NATIVE_EN =
+ "Whether to list files recursively. Use true for recursive listing, false or omit for top-level only."
+const INSTRUCTION_RECURSIVE_NATIVE_ZH_CN = "是否递归列出文件。使用 true 进行递归列出,使用 false 或省略以仅列出顶层内容。"
+
const NATIVE_GPT_5: ClineToolSpec = {
variant: ModelFamily.NATIVE_GPT_5,
id,
name: "list_files",
- description:
- "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
parameters: [
{
name: "path",
required: true,
- instruction: "The path of the directory to list contents for.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_NATIVE_ZH_CN : INSTRUCTION_PATH_NATIVE_EN,
},
{
name: "recursive",
required: false,
- instruction: "Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_RECURSIVE_NATIVE_ZH_CN : INSTRUCTION_RECURSIVE_NATIVE_EN,
type: "boolean",
},
TASK_PROGRESS_PARAMETER,
diff --git a/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts b/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts
index a97e4fb8..9742e63d 100644
--- a/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts
+++ b/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts
@@ -1,6 +1,8 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
/**
* ## load_mcp_documentation
@@ -13,11 +15,16 @@ Usage:
const id = ClineDefaultTool.MCP_DOCS
+const DESCRIPTION_EN = `Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with \`use_mcp_tool\` and \`access_mcp_resource\`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples.`
+
+const DESCRIPTION_ZH_CN =
+ "加载有关创建 MCP 服务器的文档。当用户请求创建或安装 MCP 服务器时,应使用此工具(用户可能会要求您「添加工具」来执行某些功能,换句话说,创建一个 MCP 服务器,提供可以连接到外部 API 的工具和资源。您有能力创建 MCP 服务器并将其添加到配置文件中,然后将向您的`use_mcp_tool`和`access_mcp_resource`公开这些工具和资源)。文档提供了有关 MCP 服务器创建过程的详细信息,包括设置说明、最佳实践和示例。"
+
const generic: ClineToolSpec = {
id,
variant: ModelFamily.GENERIC,
name: "load_mcp_documentation",
- description: `Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with \`use_mcp_tool\` and \`access_mcp_resource\`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples.`,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
contextRequirements: (context) => context.mcpHub !== undefined && context.mcpHub !== null,
}
diff --git a/src/core/prompts/system-prompt/tools/plan_mode_respond.ts b/src/core/prompts/system-prompt/tools/plan_mode_respond.ts
index 788dd8c8..4cf97e44 100644
--- a/src/core/prompts/system-prompt/tools/plan_mode_respond.ts
+++ b/src/core/prompts/system-prompt/tools/plan_mode_respond.ts
@@ -1,45 +1,89 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
-
-/**
- * ## plan_mode_respond
-Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool.
-However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead.
-Parameters:
-- response: (required) The response to provide to the user. Do not try to use tools in this parameter, this is simply a chat response. (You MUST use the response parameter, do not simply place the response text directly within tags.)
-- needs_more_exploration: (optional) Set to true if while formulating your response that you found you need to do more exploration with tools, for example reading files. (Remember, you can explore the project with tools like read_file in PLAN MODE without the user having to toggle to ACT MODE.) Defaults to false if not specified.
-${focusChainSettings.enabled ? `- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)` : "" }
-Usage:
-
-Your response here
-true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools)
-${focusChainSettings.enabled ? `
-Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.)
-` : "" }
-
- */
+import type { SystemPromptContext } from "../types"
const id = ClineDefaultTool.PLAN_MODE
+const DESCRIPTION_GENERIC_EN = `Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool.
+However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead.`
+
+const DESCRIPTION_GENERIC_ZH_CN = `响应用户的询问,以规划用户任务的解决方案。此工具仅应在您已探索相关文件并准备展示具体计划时使用。不要使用此工具来宣布您将要读取的文件 - 只需先读取它们。此工具仅在 PLAN MODE 中可用。environment_details 将指定当前模式;如果不是 PLAN_MODE,则不应使用此工具。
+但是,如果在编写响应时您意识到在提供完整计划之前实际上需要做更多的探索,您可以添加可选的 needs_more_exploration 参数来指示这一点。这允许您承认您应该先进行更多的探索,并表明您的下一条消息将使用探索工具。`
+
+const DESCRIPTION_NATIVE_EN =
+ "Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool.\n\tHowever, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead."
+
+const DESCRIPTION_NATIVE_ZH_CN =
+ "响应用户的询问,以规划用户任务的解决方案。此工具仅应在您已探索相关文件并准备展示具体计划时使用。不要使用此工具来宣布您将要读取的文件 - 只需先读取它们。此工具仅在 PLAN MODE 中可用。environment_details 将指定当前模式;如果不是 PLAN_MODE,则不应使用此工具。\n\t但是,如果在编写响应时您意识到在提供完整计划之前实际上需要做更多的探索,您可以添加可选的 needs_more_exploration 参数来指示这一点。这允许您承认您应该先进行更多的探索,并表明您的下一条消息将使用探索工具。"
+
+const DESCRIPTION_GEMINI_EN = `Respond with a plan that outlines a solution to the user's request. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. Only use this tool after you have explored relevant files and collected sufficient context to create a detailed, accurate plan. This tool is only available in PLAN MODE, as indicated by the environment_details.
+If it becomes apparent that additional exploration is required while the plan_mode_respond response is being generated, the optional needs_more_exploration parameter can be toggled to enable further research. This allows you to acknowledge that more exploration is required before the final plan_mode_respond is generated, and signals that your next message will use exploration tools instead.`
+
+const DESCRIPTION_GEMINI_ZH_CN = `响应一个概述用户请求解决方案的计划。此工具仅应在您已探索相关文件并准备展示具体计划时使用。只有在您探索了相关文件并收集了足够的上下文以创建详细、准确的计划后,才使用此工具。此工具仅在 PLAN MODE 中可用,如 environment_details 所示。
+如果在生成 plan_mode_respond 响应时显然需要额外的探索,可以切换可选的 needs_more_exploration 参数以启用进一步的研究。这允许您承认在生成最终的 plan_mode_respond 之前需要更多的探索,并表明您的下一条消息将使用探索工具。`
+
+const INSTRUCTION_RESPONSE_GENERIC_EN = `The response to provide to the user. Do not try to use tools in this parameter, this is simply a chat response. (You MUST use the response parameter, do not simply place the response text directly within tags.)`
+
+const INSTRUCTION_RESPONSE_GENERIC_ZH_CN =
+ "提供给用户的响应。不要尝试在此参数中使用工具,这只是一个聊天响应。(您必须使用 response 参数,不要简单地将响应文本直接放在 标签内。)"
+
+const INSTRUCTION_RESPONSE_NATIVE_EN = "The response to provide to the user."
+const INSTRUCTION_RESPONSE_NATIVE_ZH_CN = "提供给用户的响应。"
+
+const INSTRUCTION_RESPONSE_GEMINI_EN = "A chat message response to the user."
+const INSTRUCTION_RESPONSE_GEMINI_ZH_CN = "给用户的聊天消息响应。"
+
+const INSTRUCTION_NEEDS_MORE_EXPLORATION_GENERIC_EN =
+ "Set to true if while formulating your response that you found you need to do more exploration with tools, for example reading files. (Remember, you can explore the project with tools like read_file in PLAN MODE without the user having to toggle to ACT MODE.) Defaults to false if not specified."
+
+const INSTRUCTION_NEEDS_MORE_EXPLORATION_GENERIC_ZH_CN =
+ "如果在制定响应时发现您需要使用工具进行更多的探索(例如读取文件),则设置为 true。(请记住,您可以在 PLAN MODE 中使用 read_file 等工具探索项目,而无需用户切换到 ACT MODE。)如果未指定,默认为 false。"
+
+const INSTRUCTION_NEEDS_MORE_EXPLORATION_GEMINI_EN =
+ "needs_more_exploration can be set to true if it is determined that further exploration with read_file/search tools is necessary to formulate a complete plan. This determination can be reached during the response generation process, but should not be acknowledged until this parameter is set to true if required."
+
+const INSTRUCTION_NEEDS_MORE_EXPLORATION_GEMINI_ZH_CN =
+ "如果确定需要使用 read_file/search 工具进行进一步的探索以制定完整的计划,可以将 needs_more_exploration 设置为 true。此确定可以在响应生成过程中达成,但如果需要,应在此参数设置为 true 之前不予确认。"
+
+const INSTRUCTION_TASK_PROGRESS_GENERIC_EN =
+ " A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)"
+
+const INSTRUCTION_TASK_PROGRESS_GENERIC_ZH_CN =
+ " 显示此工具使用完成后任务进度的检查清单。(有关更多详细信息,请参阅「更新任务进度」部分)"
+
+const INSTRUCTION_TASK_PROGRESS_NATIVE_EN =
+ "A checklist showing task progress with the latest status of each subtasks included previously if any."
+
+const INSTRUCTION_TASK_PROGRESS_NATIVE_ZH_CN = "显示任务进度的检查清单,包含之前包含的每个子任务的最新状态(如果有)。"
+
+const INSTRUCTION_TASK_PROGRESS_GEMINI_EN =
+ "A checklist showing task progress after this tool use is completed. If you are presenting a final implementation plan to the user with needs_more_exploration set to false, you should include a checklist of items to be completed during Act Mode when implementation is underway. (See 'Updating Task Progress' section for more details)"
+
+const INSTRUCTION_TASK_PROGRESS_GEMINI_ZH_CN =
+ "显示此工具使用完成后任务进度的检查清单。如果您向用户展示最终实施计划并将 needs_more_exploration 设置为 false,您应该包括在 Act MODE 实施期间要完成的项目检查清单。(有关更多详细信息,请参阅「更新任务进度」部分)"
+
const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "plan_mode_respond",
- description: `Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool.
-However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead.`,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GENERIC_ZH_CN : DESCRIPTION_GENERIC_EN),
parameters: [
{
name: "response",
required: true,
- instruction: `The response to provide to the user. Do not try to use tools in this parameter, this is simply a chat response. (You MUST use the response parameter, do not simply place the response text directly within tags.)`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_RESPONSE_GENERIC_ZH_CN : INSTRUCTION_RESPONSE_GENERIC_EN,
usage: "Your response here",
},
{
name: "needs_more_exploration",
required: false,
- instruction:
- "Set to true if while formulating your response that you found you need to do more exploration with tools, for example reading files. (Remember, you can explore the project with tools like read_file in PLAN MODE without the user having to toggle to ACT MODE.) Defaults to false if not specified.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale)
+ ? INSTRUCTION_NEEDS_MORE_EXPLORATION_GENERIC_ZH_CN
+ : INSTRUCTION_NEEDS_MORE_EXPLORATION_GENERIC_EN,
usage: "true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools)",
type: "boolean",
},
@@ -47,8 +91,8 @@ However, if while writing your response you realize you actually need to do more
{
name: "task_progress",
required: false,
- instruction:
- " A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TASK_PROGRESS_GENERIC_ZH_CN : INSTRUCTION_TASK_PROGRESS_GENERIC_EN,
usage: "Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.)",
dependencies: [ClineDefaultTool.TODO],
},
@@ -59,18 +103,19 @@ const NATIVE_GPT_5: ClineToolSpec = {
variant: ModelFamily.NATIVE_GPT_5,
id,
name: "plan_mode_respond",
- description: `Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. DO NOT use this tool to announce what files you're going to read - just read them first. This tool is only available in PLAN MODE. The environment_details will specify the current mode; if it is not PLAN_MODE then you should not use this tool.
-However, if while writing your response you realize you actually need to do more exploration before providing a complete plan, you can add the optional needs_more_exploration parameter to indicate this. This allows you to acknowledge that you should have done more exploration first, and signals that your next message will use exploration tools instead.`,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_NATIVE_ZH_CN : DESCRIPTION_NATIVE_EN),
parameters: [
{
name: "response",
required: true,
- instruction: `The response to provide to the user.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_RESPONSE_NATIVE_ZH_CN : INSTRUCTION_RESPONSE_NATIVE_EN,
},
{
name: "task_progress",
required: false,
- instruction: "A checklist showing task progress with the latest status of each subtasks included previously if any.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TASK_PROGRESS_NATIVE_ZH_CN : INSTRUCTION_TASK_PROGRESS_NATIVE_EN,
},
],
}
@@ -79,27 +124,30 @@ const GEMINI_3: ClineToolSpec = {
variant: ModelFamily.GEMINI_3,
id,
name: "plan_mode_respond",
- description: `Respond with a plan that outlines a solution to the user's request. This tool should ONLY be used when you have already explored the relevant files and are ready to present a concrete plan. Only use this tool after you have explored relevant files and collected sufficient context to create a detailed, accurate plan. This tool is only available in PLAN MODE, as indicated by the environment_details.
-If it becomes apparent that additional exploration is required while the plan_mode_respond response is being generated, the optional needs_more_exploration parameter can be toggled to enable further research. This allows you to acknowledge that more exploration is required before the final plan_mode_respond is generated, and signals that your next message will use exploration tools instead.`,
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GEMINI_ZH_CN : DESCRIPTION_GEMINI_EN),
parameters: [
{
name: "response",
required: true,
- instruction: `A chat message response to the user.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_RESPONSE_GEMINI_ZH_CN : INSTRUCTION_RESPONSE_GEMINI_EN,
usage: "Your response here",
},
{
name: "needs_more_exploration",
required: false,
- instruction: `needs_more_exploration can be set to true if it is determined that further exploration with read_file/search tools is necessary to formulate a complete plan. This determination can be reached during the response generation process, but should not be acknowledged until this parameter is set to true if required.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale)
+ ? INSTRUCTION_NEEDS_MORE_EXPLORATION_GEMINI_ZH_CN
+ : INSTRUCTION_NEEDS_MORE_EXPLORATION_GEMINI_EN,
usage: "true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools)",
type: "boolean",
},
{
name: "task_progress",
required: false,
- instruction:
- "A checklist showing task progress after this tool use is completed. If you are presenting a final implementation plan to the user with needs_more_exploration set to false, you should include a checklist of items to be completed during Act Mode when implementation is underway. (See 'Updating Task Progress' section for more details)",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TASK_PROGRESS_GEMINI_ZH_CN : INSTRUCTION_TASK_PROGRESS_GEMINI_EN,
usage: "Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.)",
dependencies: [ClineDefaultTool.TODO],
},
diff --git a/src/core/prompts/system-prompt/tools/read_file.ts b/src/core/prompts/system-prompt/tools/read_file.ts
index 041fa3f0..e94c5995 100644
--- a/src/core/prompts/system-prompt/tools/read_file.ts
+++ b/src/core/prompts/system-prompt/tools/read_file.ts
@@ -1,33 +1,52 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
const id = ClineDefaultTool.FILE_READ
-const READ_FILE_DESCRIPTION =
+const READ_FILE_DESCRIPTION_EN =
"Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files."
-const READ_FILE_PARAMETERS: ClineToolSpec["parameters"] = [
+const READ_FILE_DESCRIPTION_ZH_CN =
+ "请求读取指定路径的文件内容。当您需要检查您不知道内容的现有文件的内容时,请使用此工具,例如分析代码、查看文本文件或从配置文件中提取信息。返回的文本行带有行前缀(例如 `1 |`、`2 |`)。这些前缀是元数据,不是文件内容的一部分。对于大文件,输出自动限制为 1000 行。使用 start_line 和 end_line 读取特定部分。自动从 PDF 和 DOCX 文件中提取原始文本。可能不适用于其他类型的二进制文件,因为它以字符串形式返回原始内容。不要使用此工具列出目录的内容。仅对此工具用于文件。"
+
+const INSTRUCTION_PATH_EN = "The path of the file to read (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}"
+
+const INSTRUCTION_PATH_ZH_CN = "要读取的文件的路径(相对于当前工作目录 {{CWD}}){{MULTI_ROOT_HINT}}"
+
+const INSTRUCTION_START_LINE_EN = "The 1-based line number to start reading from (inclusive). Defaults to 1."
+const INSTRUCTION_START_LINE_ZH_CN = "开始读取的基于 1 的行号(包含)。默认为 1。"
+
+const INSTRUCTION_END_LINE_EN =
+ "The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files."
+
+const INSTRUCTION_END_LINE_ZH_CN =
+ "停止读取的基于 1 的行号(包含)。默认为 start_line + 1000。与 start_line 一起使用以读取大文件的特定部分。"
+
+const getReadFileParameters = (): ClineToolSpec["parameters"] => [
{
name: "path",
required: true,
- instruction: `The path of the file to read (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}`,
+ instruction: (context: SystemPromptContext) => (isZhCN(context.locale) ? INSTRUCTION_PATH_ZH_CN : INSTRUCTION_PATH_EN),
usage: "File path here",
},
{
name: "start_line",
required: false,
type: "integer",
- instruction: "The 1-based line number to start reading from (inclusive). Defaults to 1.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_START_LINE_ZH_CN : INSTRUCTION_START_LINE_EN,
usage: "1",
},
{
name: "end_line",
required: false,
type: "integer",
- instruction:
- "The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_END_LINE_ZH_CN : INSTRUCTION_END_LINE_EN,
usage: "1000",
},
TASK_PROGRESS_PARAMETER,
@@ -37,16 +56,18 @@ const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "read_file",
- description: READ_FILE_DESCRIPTION,
- parameters: READ_FILE_PARAMETERS,
+ description: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? READ_FILE_DESCRIPTION_ZH_CN : READ_FILE_DESCRIPTION_EN,
+ parameters: getReadFileParameters(),
}
const NATIVE_GPT_5: ClineToolSpec = {
variant: ModelFamily.NATIVE_GPT_5,
id,
name: "read_file",
- description: READ_FILE_DESCRIPTION,
- parameters: READ_FILE_PARAMETERS,
+ description: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? READ_FILE_DESCRIPTION_ZH_CN : READ_FILE_DESCRIPTION_EN,
+ parameters: getReadFileParameters(),
}
const NATIVE_NEXT_GEN: ClineToolSpec = {
diff --git a/src/core/prompts/system-prompt/tools/replace_in_file.ts b/src/core/prompts/system-prompt/tools/replace_in_file.ts
index 21768f04..1a1c123a 100644
--- a/src/core/prompts/system-prompt/tools/replace_in_file.ts
+++ b/src/core/prompts/system-prompt/tools/replace_in_file.ts
@@ -1,7 +1,9 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
-import { SystemPromptContext, TASK_PROGRESS_PARAMETER } from "../types"
+import type { SystemPromptContext } from "../types"
+import { TASK_PROGRESS_PARAMETER } from "../types"
const id = ClineDefaultTool.FILE_EDIT
@@ -13,7 +15,7 @@ const shouldIncludeNotebookInstructions = (context: SystemPromptContext) => {
return getOpenOrVisibleTabPaths(context).some((p) => p.endsWith(".ipynb"))
}
-const BASE_DIFF_INSTRUCTIONS = `One or more SEARCH/REPLACE blocks following this exact format:
+const BASE_DIFF_INSTRUCTIONS_EN = `One or more SEARCH/REPLACE blocks following this exact format:
\`\`\`
------- SEARCH
[exact content to find]
@@ -39,7 +41,33 @@ const BASE_DIFF_INSTRUCTIONS = `One or more SEARCH/REPLACE blocks following this
* To delete code: Use empty REPLACE section
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.`
-const NOTEBOOK_INSTRUCTIONS = `
+const BASE_DIFF_INSTRUCTIONS_ZH_CN = `一个或多个遵循此确切格式的 SEARCH/REPLACE 块:
+ \`\`\`
+ ------- SEARCH
+ [要查找的确切内容]
+ =======
+ [要替换的新内容]
+ +++++++ REPLACE
+ \`\`\`
+ 关键规则:
+ 1. SEARCH 内容必须完全匹配要查找的关联文件部分:
+ * 逐个字符匹配,包括空白、缩进、行结尾
+ * 包括所有注释、文档字符串等
+ 2. SEARCH/REPLACE 块将仅替换第一个匹配项。
+ * 如果您需要进行多个更改,请包括多个唯一的 SEARCH/REPLACE 块。
+ * 在每个 SEARCH 部分中仅包含足够的行以唯一匹配需要更改的每组行。
+ * 使用多个 SEARCH/REPLACE 块时,按它们在文件中出现的顺序列出。
+ 3. 保持 SEARCH/REPLACE 块简洁:
+ * 将大型 SEARCH/REPLACE 块分解为一系列较小的块,每个块更改文件的一小部分。
+ * 仅包括更改的行,如果需要唯一性,请包括几行周围的行。
+ * 不要在 SEARCH/REPLACE 块中包含长段不变的行。
+ * 每一行都必须完整。永远不要中途截断行,因为这可能导致匹配失败。
+ 4. 特殊操作:
+ * 要移动代码:使用两个 SEARCH/REPLACE 块(一个从原位置删除 + 一个在新位置插入)
+ * 要删除代码:使用空的 REPLACE 部分
+ 5. 如果您的源上下文来自 read_file 并且包含行标签(例如,"42 | const x = 1"),请不要在 SEARCH 或 REPLACE 内容中包含 "42 | " 前缀。仅匹配原始文件文本。`
+
+const NOTEBOOK_INSTRUCTIONS_EN = `
6. For Jupyter Notebook (.ipynb) files:
* Match the exact JSON structure including quotes, commas, and \\n characters
* Each line in "source" array (except last) must end with "\\n"
@@ -57,21 +85,64 @@ const NOTEBOOK_INSTRUCTIONS = `
]
+++++++ REPLACE`
+const NOTEBOOK_INSTRUCTIONS_ZH_CN = `
+ 6. 对于 Jupyter Notebook (.ipynb) 文件:
+ * 匹配确切的 JSON 结构,包括引号、逗号和 \\n 字符
+ * "source" 数组中的每一行(最后一行除外)必须以 "\\n" 结尾
+ * 每个 source 行是数组中的一个单独的 JSON 字符串
+ * 笔记本的 SEARCH 块示例:
+ ------- SEARCH
+ "source": [
+ "x = 10\\n",
+ "print(x)"
+ ]
+ =======
+ "source": [
+ "x = 100\\n",
+ "print(x)"
+ ]
+ +++++++ REPLACE`
+
const diffInstruction = (context: SystemPromptContext) => {
- return shouldIncludeNotebookInstructions(context) ? BASE_DIFF_INSTRUCTIONS + NOTEBOOK_INSTRUCTIONS : BASE_DIFF_INSTRUCTIONS
+ if (isZhCN(context.locale)) {
+ return shouldIncludeNotebookInstructions(context)
+ ? BASE_DIFF_INSTRUCTIONS_ZH_CN + NOTEBOOK_INSTRUCTIONS_ZH_CN
+ : BASE_DIFF_INSTRUCTIONS_ZH_CN
+ }
+ return shouldIncludeNotebookInstructions(context)
+ ? BASE_DIFF_INSTRUCTIONS_EN + NOTEBOOK_INSTRUCTIONS_EN
+ : BASE_DIFF_INSTRUCTIONS_EN
}
+const DESCRIPTION_GENERIC_EN =
+ "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file."
+
+const DESCRIPTION_GENERIC_ZH_CN =
+ "请求使用 SEARCH/REPLACE 块替换现有文件中的内容部分,这些块定义对文件特定部分的确切更改。当您需要对文件的特定部分进行定向更改时,应使用此工具。"
+
+const DESCRIPTION_NATIVE_EN =
+ "[IMPORTANT: Always output the absolutePath first] Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file."
+
+const DESCRIPTION_NATIVE_ZH_CN =
+ "[重要提示:始终先输出 absolutePath] 请求使用 SEARCH/REPLACE 块替换现有文件中的内容部分,这些块定义对文件特定部分的确切更改。当您需要对文件的特定部分进行定向更改时,应使用此工具。"
+
+const INSTRUCTION_PATH_GENERIC_EN = `The path of the file to modify (relative to the current working directory {{CWD}})`
+const INSTRUCTION_PATH_GENERIC_ZH_CN = `要修改的文件的路径(相对于当前工作目录 {{CWD}})`
+
+const INSTRUCTION_ABSOLUTE_PATH_NATIVE_EN = "The absolute path to the file to write to."
+const INSTRUCTION_ABSOLUTE_PATH_NATIVE_ZH_CN = "要写入的文件的绝对路径。"
+
const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "replace_in_file",
- description:
- "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GENERIC_ZH_CN : DESCRIPTION_GENERIC_EN),
parameters: [
{
name: "path",
required: true,
- instruction: `The path of the file to modify (relative to the current working directory {{CWD}})`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_GENERIC_ZH_CN : INSTRUCTION_PATH_GENERIC_EN,
usage: "File path here",
},
{
@@ -88,13 +159,13 @@ const NATIVE_NEXT_GEN: ClineToolSpec = {
variant: ModelFamily.NATIVE_NEXT_GEN,
id,
name: "replace_in_file",
- description:
- "[IMPORTANT: Always output the absolutePath first] Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_NATIVE_ZH_CN : DESCRIPTION_NATIVE_EN),
parameters: [
{
name: "absolutePath",
required: true,
- instruction: "The absolute path to the file to write to.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_ABSOLUTE_PATH_NATIVE_ZH_CN : INSTRUCTION_ABSOLUTE_PATH_NATIVE_EN,
},
{
name: "diff",
diff --git a/src/core/prompts/system-prompt/tools/search_files.ts b/src/core/prompts/system-prompt/tools/search_files.ts
index 4b2d2cb4..0cfa9b68 100644
--- a/src/core/prompts/system-prompt/tools/search_files.ts
+++ b/src/core/prompts/system-prompt/tools/search_files.ts
@@ -1,6 +1,8 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
/**
@@ -20,30 +22,51 @@ Usage:
const id = ClineDefaultTool.SEARCH
+const DESCRIPTION_EN =
+ "Request to perform a regex search across files in a specified directory, providing context-rich results. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context."
+
+const DESCRIPTION_ZH_CN =
+ "请求在指定目录中的文件中执行正则表达式搜索,提供上下文丰富的结果。此工具在多个文件中搜索模式或特定内容,显示每个匹配项及其周围的上下文。"
+
+const INSTRUCTION_PATH_EN =
+ "The path of the directory to search in (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}. This directory will be recursively searched."
+
+const INSTRUCTION_PATH_ZH_CN = "要搜索的目录的路径(相对于当前工作目录 {{CWD}}){{MULTI_ROOT_HINT}}。此目录将被递归搜索。"
+
+const INSTRUCTION_REGEX_EN = "The regular expression pattern to search for. Uses Rust regex syntax."
+const INSTRUCTION_REGEX_ZH_CN = "要搜索的正则表达式模式。使用 Rust 正则表达式语法。"
+
+const INSTRUCTION_FILE_PATTERN_EN =
+ "Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*)."
+
+const INSTRUCTION_FILE_PATTERN_ZH_CN =
+ "用于过滤文件的 Glob 模式(例如,'*.ts' 用于 TypeScript 文件)。如果未提供,它将搜索所有文件 (*)。"
+
const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "search_files",
- description:
- "Request to perform a regex search across files in a specified directory, providing context-rich results. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
parameters: [
{
name: "path",
required: true,
- instruction: `The path of the directory to search in (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}. This directory will be recursively searched.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_ZH_CN : INSTRUCTION_PATH_EN,
usage: "Directory path here",
},
{
name: "regex",
required: true,
- instruction: "The regular expression pattern to search for. Uses Rust regex syntax.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_REGEX_ZH_CN : INSTRUCTION_REGEX_EN,
usage: "Your regex pattern here",
},
{
name: "file_pattern",
required: false,
- instruction:
- "Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*).",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_FILE_PATTERN_ZH_CN : INSTRUCTION_FILE_PATTERN_EN,
usage: "file pattern here (optional)",
},
TASK_PROGRESS_PARAMETER,
@@ -54,26 +77,27 @@ const NATIVE_NEXT_GEN: ClineToolSpec = {
variant: ModelFamily.NATIVE_NEXT_GEN,
id,
name: "search_files",
- description:
- "Request to perform a regex search across files in a specified directory, providing context-rich results. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
parameters: [
{
name: "path",
required: true,
- instruction: `The path of the directory to search in (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}. This directory will be recursively searched.`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_ZH_CN : INSTRUCTION_PATH_EN,
usage: "Directory path here",
},
{
name: "regex",
required: true,
- instruction: "The regular expression pattern to search for. Uses Rust regex syntax.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_REGEX_ZH_CN : INSTRUCTION_REGEX_EN,
usage: "Your regex pattern here",
},
{
name: "file_pattern",
required: false,
- instruction:
- "Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*).",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_FILE_PATTERN_ZH_CN : INSTRUCTION_FILE_PATTERN_EN,
usage: "file pattern here (optional)",
},
TASK_PROGRESS_PARAMETER,
diff --git a/src/core/prompts/system-prompt/tools/subagent.ts b/src/core/prompts/system-prompt/tools/subagent.ts
index 3807c220..845d1061 100644
--- a/src/core/prompts/system-prompt/tools/subagent.ts
+++ b/src/core/prompts/system-prompt/tools/subagent.ts
@@ -1,41 +1,68 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
const id = ClineDefaultTool.USE_SUBAGENTS
+const DESCRIPTION_EN =
+ "Run up to five focused in-process subagents in parallel. Each subagent gets its own prompt and returns a comprehensive research result with tool and token stats. Use this for broad exploration when reading many files would consume the main agent's context window. You do not need to launch multiple subagents every time; using one subagent is valid when it avoids unnecessary context usage for light discovery work."
+
+const DESCRIPTION_ZH_CN =
+ "并行运行最多五个专注的进程内子代理。每个子代理都有自己的提示,并返回包含工具和令牌统计信息的综合研究结果。当读取许多文件会消耗主代理的上下文窗口时,使用此工具进行广泛探索。您不需要每次都启动多个子代理;当使用一个子代理可以避免轻量级发现工作的不必要上下文使用时,使用一个子代理是有效的。"
+
+const INSTRUCTION_PROMPT_1_EN = "First subagent prompt."
+const INSTRUCTION_PROMPT_1_ZH_CN = "第一个子代理提示。"
+
+const INSTRUCTION_PROMPT_2_EN = "Optional second subagent prompt."
+const INSTRUCTION_PROMPT_2_ZH_CN = "可选的第二个子代理提示。"
+
+const INSTRUCTION_PROMPT_3_EN = "Optional third subagent prompt."
+const INSTRUCTION_PROMPT_3_ZH_CN = "可选的第三个子代理提示。"
+
+const INSTRUCTION_PROMPT_4_EN = "Optional fourth subagent prompt."
+const INSTRUCTION_PROMPT_4_ZH_CN = "可选的第四个子代理提示。"
+
+const INSTRUCTION_PROMPT_5_EN = "Optional fifth subagent prompt."
+const INSTRUCTION_PROMPT_5_ZH_CN = "可选的第五个子代理提示。"
+
const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "use_subagents",
- description:
- "Run up to five focused in-process subagents in parallel. Each subagent gets its own prompt and returns a comprehensive research result with tool and token stats. Use this for broad exploration when reading many files would consume the main agent's context window. You do not need to launch multiple subagents every time; using one subagent is valid when it avoids unnecessary context usage for light discovery work.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
contextRequirements: (context) => context.subagentsEnabled === true && !context.isSubagentRun,
parameters: [
{
name: "prompt_1",
required: true,
- instruction: "First subagent prompt.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PROMPT_1_ZH_CN : INSTRUCTION_PROMPT_1_EN,
},
{
name: "prompt_2",
required: false,
- instruction: "Optional second subagent prompt.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PROMPT_2_ZH_CN : INSTRUCTION_PROMPT_2_EN,
},
{
name: "prompt_3",
required: false,
- instruction: "Optional third subagent prompt.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PROMPT_3_ZH_CN : INSTRUCTION_PROMPT_3_EN,
},
{
name: "prompt_4",
required: false,
- instruction: "Optional fourth subagent prompt.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PROMPT_4_ZH_CN : INSTRUCTION_PROMPT_4_EN,
},
{
name: "prompt_5",
required: false,
- instruction: "Optional fifth subagent prompt.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PROMPT_5_ZH_CN : INSTRUCTION_PROMPT_5_EN,
},
],
}
diff --git a/src/core/prompts/system-prompt/tools/use_mcp_tool.ts b/src/core/prompts/system-prompt/tools/use_mcp_tool.ts
index e00ebd8a..d9b704ab 100644
--- a/src/core/prompts/system-prompt/tools/use_mcp_tool.ts
+++ b/src/core/prompts/system-prompt/tools/use_mcp_tool.ts
@@ -1,6 +1,8 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
/**
@@ -31,30 +33,47 @@ Checklist here (optional)
*/
+const DESCRIPTION_EN =
+ "Request to use a tool provided by a connected MCP server. Each MCP server can provide multiple tools with different capabilities. Tools have defined input schemas that specify required and optional parameters."
+
+const DESCRIPTION_ZH_CN =
+ "请求使用已连接的 MCP 服务器提供的工具。每个 MCP 服务器可以提供多个具有不同功能的工具。工具具有定义的输入模式,指定必需和可选参数。"
+
+const INSTRUCTION_SERVER_NAME_EN = "The name of the MCP server providing the tool"
+const INSTRUCTION_SERVER_NAME_ZH_CN = "提供工具的 MCP 服务器的名称"
+
+const INSTRUCTION_TOOL_NAME_EN = "The name of the tool to execute"
+const INSTRUCTION_TOOL_NAME_ZH_CN = "要执行的工具的名称"
+
+const INSTRUCTION_ARGUMENTS_EN = "A JSON object containing the tool's input parameters, following the tool's input schema"
+const INSTRUCTION_ARGUMENTS_ZH_CN = "包含工具输入参数的 JSON 对象,遵循工具的输入模式"
+
const generic: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id: ClineDefaultTool.MCP_USE,
name: "use_mcp_tool",
- description:
- "Request to use a tool provided by a connected MCP server. Each MCP server can provide multiple tools with different capabilities. Tools have defined input schemas that specify required and optional parameters.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
contextRequirements: (context) => context.mcpHub !== undefined && context.mcpHub !== null,
parameters: [
{
name: "server_name",
required: true,
- instruction: "The name of the MCP server providing the tool",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_SERVER_NAME_ZH_CN : INSTRUCTION_SERVER_NAME_EN,
usage: "server name here",
},
{
name: "tool_name",
required: true,
- instruction: "The name of the tool to execute",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_TOOL_NAME_ZH_CN : INSTRUCTION_TOOL_NAME_EN,
usage: "tool name here",
},
{
name: "arguments",
required: true,
- instruction: "A JSON object containing the tool's input parameters, following the tool's input schema",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_ARGUMENTS_ZH_CN : INSTRUCTION_ARGUMENTS_EN,
usage: `
{
"param1": "value1",
diff --git a/src/core/prompts/system-prompt/tools/use_skill.ts b/src/core/prompts/system-prompt/tools/use_skill.ts
index e3ca06d1..b0d94adf 100644
--- a/src/core/prompts/system-prompt/tools/use_skill.ts
+++ b/src/core/prompts/system-prompt/tools/use_skill.ts
@@ -1,21 +1,32 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
const id = ClineDefaultTool.USE_SKILL
+const DESCRIPTION_EN =
+ "Load and activate a skill by name. Skills provide specialized instructions for specific tasks. Use this tool ONCE when a user's request matches one of the available skill descriptions shown in the SKILLS section of your system prompt. After activation, follow the skill's instructions directly - do not call use_skill again."
+
+const DESCRIPTION_ZH_CN =
+ "按名称加载并激活技能。技能为特定任务提供专门的说明。当用户的请求与系统提示的 SKILLS 部分中显示的可用技能描述之一匹配时,请使用此工具一次。激活后,直接遵循技能的说明 - 不要再次调用 use_skill。"
+
+const INSTRUCTION_SKILL_NAME_EN = "The name of the skill to activate (must match exactly one of the available skill names)"
+const INSTRUCTION_SKILL_NAME_ZH_CN = "要激活的技能的名称(必须与可用技能名称之一完全匹配)"
+
const generic: ClineToolSpec = {
id,
variant: ModelFamily.GENERIC,
name: "use_skill",
- description:
- "Load and activate a skill by name. Skills provide specialized instructions for specific tasks. Use this tool ONCE when a user's request matches one of the available skill descriptions shown in the SKILLS section of your system prompt. After activation, follow the skill's instructions directly - do not call use_skill again.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_ZH_CN : DESCRIPTION_EN),
contextRequirements: (context) => context.skills !== undefined && context.skills.length > 0,
parameters: [
{
name: "skill_name",
required: true,
- instruction: "The name of the skill to activate (must match exactly one of the available skill names)",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_SKILL_NAME_ZH_CN : INSTRUCTION_SKILL_NAME_EN,
},
],
}
diff --git a/src/core/prompts/system-prompt/tools/web_fetch.ts b/src/core/prompts/system-prompt/tools/web_fetch.ts
index a5790641..55794105 100644
--- a/src/core/prompts/system-prompt/tools/web_fetch.ts
+++ b/src/core/prompts/system-prompt/tools/web_fetch.ts
@@ -1,13 +1,11 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
-const GENERIC: ClineToolSpec = {
- variant: ModelFamily.GENERIC,
- id: ClineDefaultTool.WEB_FETCH,
- name: "web_fetch",
- description: `Fetches content from a specified URL and analyzes it using your prompt
+const DESCRIPTION_GENERIC_EN = `Fetches content from a specified URL and analyzes it using your prompt
- Takes a URL and analysis prompt as input
- Fetches the URL content and processes based on your prompt
- Use this tool when you need to retrieve and analyze web content
@@ -15,19 +13,51 @@ const GENERIC: ClineToolSpec = {
- The URL must be a fully-formed valid URL
- The prompt must be at least 2 characters
- HTTP URLs will be automatically upgraded to HTTPS
-- This tool is read-only and does not modify any files`,
+- This tool is read-only and does not modify any files`
+
+const DESCRIPTION_GENERIC_ZH_CN = `从指定的 URL 获取内容并使用您的提示对其进行分析
+- 接受 URL 和分析提示作为输入
+- 获取 URL 内容并根据您的提示进行处理
+- 当您需要检索和分析网络内容时,请使用此工具
+- 重要提示:如果提供了 MCP 提供的网络获取工具,请优先使用该工具而不是此工具,因为它可能具有更少的限制。
+- URL 必须是完整格式的有效 URL
+- 提示必须至少包含 2 个字符
+- HTTP URL 将自动升级到 HTTPS
+- 此工具是只读的,不会修改任何文件`
+
+const DESCRIPTION_NATIVE_EN =
+ "Fetches and analyzes content from a specified URL. IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions."
+
+const DESCRIPTION_NATIVE_ZH_CN =
+ "从指定的 URL 获取并分析内容。重要提示:如果提供了 MCP 提供的网络获取工具,请优先使用该工具而不是此工具,因为它可能具有更少的限制。"
+
+const INSTRUCTION_URL_EN = "The URL to fetch content from"
+const INSTRUCTION_URL_ZH_CN = "要从中获取内容的 URL"
+
+const INSTRUCTION_PROMPT_GENERIC_EN = "The prompt to use for analyzing the webpage content"
+const INSTRUCTION_PROMPT_GENERIC_ZH_CN = "用于分析网页内容的提示"
+
+const INSTRUCTION_PROMPT_NATIVE_EN = "Prompt for analyzing the webpage content"
+const INSTRUCTION_PROMPT_NATIVE_ZH_CN = "用于分析网页内容的提示"
+
+const GENERIC: ClineToolSpec = {
+ variant: ModelFamily.GENERIC,
+ id: ClineDefaultTool.WEB_FETCH,
+ name: "web_fetch",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GENERIC_ZH_CN : DESCRIPTION_GENERIC_EN),
contextRequirements: (context) => context.providerInfo.providerId === "cline" && context.clineWebToolsEnabled === true,
parameters: [
{
name: "url",
required: true,
- instruction: "The URL to fetch content from",
+ instruction: (context: SystemPromptContext) => (isZhCN(context.locale) ? INSTRUCTION_URL_ZH_CN : INSTRUCTION_URL_EN),
usage: "https://example.com/docs",
},
{
name: "prompt",
required: true,
- instruction: "The prompt to use for analyzing the webpage content",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PROMPT_GENERIC_ZH_CN : INSTRUCTION_PROMPT_GENERIC_EN,
usage: "Summarize the main points and key takeaways",
},
TASK_PROGRESS_PARAMETER,
@@ -38,19 +68,19 @@ const NATIVE_NEXT_GEN: ClineToolSpec = {
variant: ModelFamily.NATIVE_NEXT_GEN,
id: ClineDefaultTool.WEB_FETCH,
name: "web_fetch",
- description:
- "Fetches and analyzes content from a specified URL. IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_NATIVE_ZH_CN : DESCRIPTION_NATIVE_EN),
contextRequirements: (context) => context.providerInfo.providerId === "cline" && context.clineWebToolsEnabled === true,
parameters: [
{
name: "url",
required: true,
- instruction: "The URL to fetch content from",
+ instruction: (context: SystemPromptContext) => (isZhCN(context.locale) ? INSTRUCTION_URL_ZH_CN : INSTRUCTION_URL_EN),
},
{
name: "prompt",
required: true,
- instruction: "Prompt for analyzing the webpage content",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PROMPT_NATIVE_ZH_CN : INSTRUCTION_PROMPT_NATIVE_EN,
},
TASK_PROGRESS_PARAMETER,
],
diff --git a/src/core/prompts/system-prompt/tools/web_search.ts b/src/core/prompts/system-prompt/tools/web_search.ts
index 3211c6e3..07a11885 100644
--- a/src/core/prompts/system-prompt/tools/web_search.ts
+++ b/src/core/prompts/system-prompt/tools/web_search.ts
@@ -1,13 +1,11 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
-const GENERIC: ClineToolSpec = {
- variant: ModelFamily.GENERIC,
- id: ClineDefaultTool.WEB_SEARCH,
- name: "web_search",
- description: `Performs a web search and returns relevant results
+const DESCRIPTION_GENERIC_EN = `Performs a web search and returns relevant results
- Takes a search query as input and returns search results with titles and URLs
- Optionally filter results by allowed or blocked domains
- Use this tool when you need to search the web for information
@@ -15,25 +13,59 @@ const GENERIC: ClineToolSpec = {
- The query must be at least 2 characters
- You may provide either allowed_domains OR blocked_domains, but NOT both
- Domains should be provided as a JSON array of strings
-- This tool is read-only and does not modify any files`,
+- This tool is read-only and does not modify any files`
+
+const DESCRIPTION_GENERIC_ZH_CN = `执行网络搜索并返回相关结果
+- 接受搜索查询作为输入,并返回带有标题和 URL 的搜索结果
+- 可以通过允许或阻止的域名过滤结果
+- 当您需要在线搜索信息时,请使用此工具
+- 重要提示:如果提供了 MCP 提供的网络搜索工具,请优先使用该工具而不是此工具,因为它可能具有更少的限制。
+- 查询必须至少包含 2 个字符
+- 您可以提供 allowed_domains 或 blocked_domains,但不能同时提供两者
+- 域名应作为字符串的 JSON 数组提供
+- 此工具是只读的,不会修改任何文件`
+
+const DESCRIPTION_NATIVE_EN =
+ "Performs a web search and returns relevant results with titles and URLs. IMPORTANT: If an MCP-provided web search tool is available, prefer using that tool instead of this one, as it may have fewer restrictions."
+
+const DESCRIPTION_NATIVE_ZH_CN =
+ "执行网络搜索并返回带有标题和 URL 的相关结果。重要提示:如果提供了 MCP 提供的网络搜索工具,请优先使用该工具而不是此工具,因为它可能具有更少的限制。"
+
+const INSTRUCTION_QUERY_EN = "The search query to use"
+const INSTRUCTION_QUERY_ZH_CN = "要使用的搜索查询"
+
+const INSTRUCTION_ALLOWED_DOMAINS_EN = "JSON array of domains to restrict results to"
+const INSTRUCTION_ALLOWED_DOMAINS_ZH_CN = "用于限制结果的域名的 JSON 数组"
+
+const INSTRUCTION_BLOCKED_DOMAINS_EN = "JSON array of domains to exclude from results"
+const INSTRUCTION_BLOCKED_DOMAINS_ZH_CN = "要从结果中排除的域名的 JSON 数组"
+
+const GENERIC: ClineToolSpec = {
+ variant: ModelFamily.GENERIC,
+ id: ClineDefaultTool.WEB_SEARCH,
+ name: "web_search",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GENERIC_ZH_CN : DESCRIPTION_GENERIC_EN),
contextRequirements: (context) => context.providerInfo.providerId === "cline" && context.clineWebToolsEnabled === true,
parameters: [
{
name: "query",
required: true,
- instruction: "The search query to use",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_QUERY_ZH_CN : INSTRUCTION_QUERY_EN,
usage: "latest developments in AI",
},
{
name: "allowed_domains",
required: false,
- instruction: "JSON array of domains to restrict results to",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_ALLOWED_DOMAINS_ZH_CN : INSTRUCTION_ALLOWED_DOMAINS_EN,
usage: '["example.com", "github.com"]',
},
{
name: "blocked_domains",
required: false,
- instruction: "JSON array of domains to exclude from results",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_BLOCKED_DOMAINS_ZH_CN : INSTRUCTION_BLOCKED_DOMAINS_EN,
usage: '["ads.com", "spam.com"]',
},
TASK_PROGRESS_PARAMETER,
@@ -44,24 +76,26 @@ const NATIVE_NEXT_GEN: ClineToolSpec = {
variant: ModelFamily.NATIVE_NEXT_GEN,
id: ClineDefaultTool.WEB_SEARCH,
name: "web_search",
- description:
- "Performs a web search and returns relevant results with titles and URLs. IMPORTANT: If an MCP-provided web search tool is available, prefer using that tool instead of this one, as it may have fewer restrictions.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_NATIVE_ZH_CN : DESCRIPTION_NATIVE_EN),
contextRequirements: (context) => context.providerInfo.providerId === "cline" && context.clineWebToolsEnabled === true,
parameters: [
{
name: "query",
required: true,
- instruction: "The search query to use",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_QUERY_ZH_CN : INSTRUCTION_QUERY_EN,
},
{
name: "allowed_domains",
required: false,
- instruction: "JSON array of domains to restrict results to",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_ALLOWED_DOMAINS_ZH_CN : INSTRUCTION_ALLOWED_DOMAINS_EN,
},
{
name: "blocked_domains",
required: false,
- instruction: "JSON array of domains to exclude from results",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_BLOCKED_DOMAINS_ZH_CN : INSTRUCTION_BLOCKED_DOMAINS_EN,
},
TASK_PROGRESS_PARAMETER,
],
diff --git a/src/core/prompts/system-prompt/tools/write_to_file.ts b/src/core/prompts/system-prompt/tools/write_to_file.ts
index e76723f7..7f6958bf 100644
--- a/src/core/prompts/system-prompt/tools/write_to_file.ts
+++ b/src/core/prompts/system-prompt/tools/write_to_file.ts
@@ -1,6 +1,8 @@
import { ModelFamily } from "@/shared/prompts"
import { ClineDefaultTool } from "@/shared/tools"
+import { isZhCN } from "../i18n/getLocaleText"
import type { ClineToolSpec } from "../spec"
+import type { SystemPromptContext } from "../types"
import { TASK_PROGRESS_PARAMETER } from "../types"
/**
@@ -24,24 +26,55 @@ Checklist here (optional)
const id = ClineDefaultTool.FILE_NEW
+const DESCRIPTION_GENERIC_EN =
+ "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file."
+
+const DESCRIPTION_GENERIC_ZH_CN =
+ "请求将内容写入指定路径的文件。如果文件存在,它将被提供的内容覆盖。如果文件不存在,它将被创建。此工具将自动创建写入文件所需的任何目录。"
+
+const DESCRIPTION_NATIVE_EN =
+ "[IMPORTANT: Always output the absolutePath first] Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file."
+
+const DESCRIPTION_NATIVE_ZH_CN =
+ "[重要提示:始终先输出 absolutePath] 请求将内容写入指定路径的文件。如果文件存在,它将被提供的内容覆盖。如果文件不存在,它将被创建。此工具将自动创建写入文件所需的任何目录。"
+
+const INSTRUCTION_PATH_GENERIC_EN =
+ "The path of the file to write to (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}"
+
+const INSTRUCTION_PATH_GENERIC_ZH_CN = "要写入的文件的路径(相对于当前工作目录 {{CWD}}){{MULTI_ROOT_HINT}}"
+
+const INSTRUCTION_CONTENT_GENERIC_EN =
+ "The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified."
+
+const INSTRUCTION_CONTENT_GENERIC_ZH_CN =
+ "要写入文件的内容。始终提供文件的完整预期内容,不得有任何截断或遗漏。必须包含文件的所有部分,即使它们没有被修改。"
+
+const INSTRUCTION_ABSOLUTE_PATH_NATIVE_EN = "The absolute path to the file to write to."
+const INSTRUCTION_ABSOLUTE_PATH_NATIVE_ZH_CN = "要写入的文件的绝对路径。"
+
+const INSTRUCTION_CONTENT_NATIVE_EN =
+ "After providing the path so a file can be created, then use this to provide the content to write to the file."
+
+const INSTRUCTION_CONTENT_NATIVE_ZH_CN = "在提供路径以便创建文件后,然后使用它来提供要写入文件的内容。"
+
const GENERIC: ClineToolSpec = {
variant: ModelFamily.GENERIC,
id,
name: "write_to_file",
- description:
- "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_GENERIC_ZH_CN : DESCRIPTION_GENERIC_EN),
parameters: [
{
name: "path",
required: true,
- instruction: `The path of the file to write to (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}`,
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_PATH_GENERIC_ZH_CN : INSTRUCTION_PATH_GENERIC_EN,
usage: "File path here",
},
{
name: "content",
required: true,
- instruction:
- "The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_CONTENT_GENERIC_ZH_CN : INSTRUCTION_CONTENT_GENERIC_EN,
usage: "Your file content here",
},
TASK_PROGRESS_PARAMETER,
@@ -52,19 +85,19 @@ const NATIVE_NEXT_GEN: ClineToolSpec = {
variant: ModelFamily.NATIVE_NEXT_GEN,
id,
name: "write_to_file",
- description:
- "[IMPORTANT: Always output the absolutePath first] Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file.",
+ description: (context: SystemPromptContext) => (isZhCN(context.locale) ? DESCRIPTION_NATIVE_ZH_CN : DESCRIPTION_NATIVE_EN),
parameters: [
{
name: "absolutePath",
required: true,
- instruction: "The absolute path to the file to write to.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_ABSOLUTE_PATH_NATIVE_ZH_CN : INSTRUCTION_ABSOLUTE_PATH_NATIVE_EN,
},
{
name: "content",
required: true,
- instruction:
- "After providing the path so a file can be created, then use this to provide the content to write to the file.",
+ instruction: (context: SystemPromptContext) =>
+ isZhCN(context.locale) ? INSTRUCTION_CONTENT_NATIVE_ZH_CN : INSTRUCTION_CONTENT_NATIVE_EN,
},
TASK_PROGRESS_PARAMETER,
],