1. System Prompt
System Prompt 是 Agent 的 核心资产,Github 上 system-prompts-and-models-of-ai-tools 仓库收集了各类 AI 应用的 System Prompt,已有 56.6K Star,可见其重要性。
Cline 的 System Prompt 位于 src/core/prompts/system.ts,根据上下文信息、工具及模型信息动态生成。基础身份设定如下:
You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
1.1 工具 TOOL USE
Cline 要求模型一次使用一个工具,每步都基于上一步的结果。工具调用格式使用 XML 语法:
value1
value2
...
工具列表
Cline 内置十多个工具,覆盖命令行、文件操作、浏览器、MCP 等。以 write_to_file 为例:
## 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.
Parameters:
- path: (required) The path of the file to write to (relative to the current working directory ${cwd.toPosix()})
- content: (required) 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 ha ven't been modified.
Usage:
File path here
Your file content here
工具调用示例
展示多个样例供模型参考:
# Tool Use Examples
## Example 1: Requesting to execute a command
npm run dev
false
工具使用指引(思维链 CoT)
Cline 手把手教会模型逐步思考:
- 1)首先评估已掌握信息,使用
标签包裹。 - 2)根据任务和工具描述选择最合适的工具。
- 3)一次只用一个工具,每步依赖上一步结果。
- 4)使用指定 XML 格式构建调用。
- 5)每次工具后等待用户回复结果,据此继续任务。
- 6)每次使用工具后必须等待用户确认。
这能确保模型按步骤拆解任务,实时调整,保证正确性。
