aicoding-backend 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aicoding_backend/__init__.py +3 -0
- aicoding_backend/main.py +349 -0
- aicoding_backend/notebooks/agent.ipynb +19 -0
- aicoding_backend/prompts/CreateFeatureProjectRules.md +81 -0
- aicoding_backend/prompts/__init__.py +3 -0
- aicoding_backend/prompts/init_project_rules.py +255 -0
- aicoding_backend/prompts/init_requirements_doc.py +113 -0
- aicoding_backend/prompts/prp_base.md +217 -0
- aicoding_backend/tools/__init__.py +1 -0
- aicoding_backend/tools/init_project_rules.py +188 -0
- aicoding_backend/tools/init_requirements_doc.py +138 -0
- aicoding_backend/utils/__init__.py +5 -0
- aicoding_backend/utils/file_reader.py +167 -0
- aicoding_backend/utils/file_utils.py +84 -0
- aicoding_backend/utils/loader.py +34 -0
- aicoding_backend/utils/template.py +169 -0
- aicoding_backend-0.1.1.dist-info/METADATA +91 -0
- aicoding_backend-0.1.1.dist-info/RECORD +21 -0
- aicoding_backend-0.1.1.dist-info/WHEEL +4 -0
- aicoding_backend-0.1.1.dist-info/entry_points.txt +2 -0
- aicoding_backend-0.1.1.dist-info/licenses/LICENSE +21 -0
aicoding_backend/main.py
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
from mcp.server.fastmcp import FastMCP
|
|
2
|
+
from .utils import read_file, file_exists, generate_prompt
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from pydantic import BaseModel, Field
|
|
5
|
+
import logging
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Optional, Dict, Any
|
|
8
|
+
from .prompts import get_init_requirements_doc_prompt
|
|
9
|
+
|
|
10
|
+
mcp = FastMCP("backend-coding")
|
|
11
|
+
|
|
12
|
+
current_dir = Path(__file__).parent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ProcessThoughtPromptParam(BaseModel):
|
|
16
|
+
"""process_thought工具的参数结构"""
|
|
17
|
+
thought: str = Field(
|
|
18
|
+
...,
|
|
19
|
+
min_length=1,
|
|
20
|
+
description="思维内容",
|
|
21
|
+
example="这是一个关于项目架构的思考"
|
|
22
|
+
)
|
|
23
|
+
thought_number: int = Field(
|
|
24
|
+
...,
|
|
25
|
+
gt=0,
|
|
26
|
+
description="当前思维编号",
|
|
27
|
+
example=1
|
|
28
|
+
)
|
|
29
|
+
total_thoughts: int = Field(
|
|
30
|
+
...,
|
|
31
|
+
gt=0,
|
|
32
|
+
description="预计总思维数量,如果需要更多的思考可以随时变更",
|
|
33
|
+
example=5
|
|
34
|
+
)
|
|
35
|
+
next_thought_needed: bool = Field(
|
|
36
|
+
...,
|
|
37
|
+
description="是否需要下一步思维",
|
|
38
|
+
example=True
|
|
39
|
+
)
|
|
40
|
+
stage: str = Field(
|
|
41
|
+
...,
|
|
42
|
+
min_length=1,
|
|
43
|
+
description="思维阶段。可用阶段包括:问题定义、信息收集、研究、分析、综合、结论、批判性提问和规划。",
|
|
44
|
+
example="分析"
|
|
45
|
+
)
|
|
46
|
+
tags: Optional[List[str]] = Field(
|
|
47
|
+
default=None,
|
|
48
|
+
description="思维标签,是一个数组字符串",
|
|
49
|
+
example=["架构", "设计"]
|
|
50
|
+
)
|
|
51
|
+
axioms_used: Optional[List[str]] = Field(
|
|
52
|
+
default=None,
|
|
53
|
+
description="使用的公理,是一个数组字符串",
|
|
54
|
+
example=["单一职责原则", "开闭原则"]
|
|
55
|
+
)
|
|
56
|
+
assumptions_challenged: Optional[List[str]] = Field(
|
|
57
|
+
default=None,
|
|
58
|
+
description="挑战的假设,是一个数组字符串",
|
|
59
|
+
example=["所有用户都需要这个功能"]
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
class GeneratePrpParam(BaseModel):
|
|
63
|
+
"""generate_prp 工具的参数结构"""
|
|
64
|
+
feature_file: str = Field(
|
|
65
|
+
...,
|
|
66
|
+
description="功能需求文件路径(例如:INITIAL.md)"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@mcp.tool("generate_prp")
|
|
71
|
+
async def handle_generate_prp(args: GeneratePrpParam) -> str:
|
|
72
|
+
"""根据功能需求文件生成全面的产品需求提示(PRP)文档的指导。
|
|
73
|
+
|
|
74
|
+
此工具会:
|
|
75
|
+
1. 读取功能需求文件。
|
|
76
|
+
2. 加载一个模板,指导用户或 AI 如何通过研究代码库和外部资源来构建一个高质量的 PRP。
|
|
77
|
+
"""
|
|
78
|
+
try:
|
|
79
|
+
feature_file = args.feature_file
|
|
80
|
+
|
|
81
|
+
if not file_exists(feature_file):
|
|
82
|
+
raise Exception(f"功能需求文件不存在: {feature_file}")
|
|
83
|
+
|
|
84
|
+
# 获取当前文件的目录路径
|
|
85
|
+
template_path = current_dir / "prompts"
|
|
86
|
+
|
|
87
|
+
# 构建示例文件路径(注释掉的代码)
|
|
88
|
+
# form_example_path = current_dir / "../../examples/form-vue-template.md"
|
|
89
|
+
# list_example_path = current_dir / "../../examples/list-vue-template.md"
|
|
90
|
+
# pro_list_example_path = current_dir / "../../examples/pro-list-vue-template.md"
|
|
91
|
+
|
|
92
|
+
# 检查模板文件是否存在
|
|
93
|
+
if not file_exists(template_path / "prp_base.md"):
|
|
94
|
+
raise Exception(f"PRP 模板文件不存在: {template_path}")
|
|
95
|
+
|
|
96
|
+
# 获取 template 内容
|
|
97
|
+
template_content = await read_file(str(template_path), "prp_base.md")
|
|
98
|
+
|
|
99
|
+
# 从功能文件名提取功能名称(用于输出路径)
|
|
100
|
+
feature_name = Path(feature_file).stem
|
|
101
|
+
|
|
102
|
+
prompt_content = f"""
|
|
103
|
+
请用 「process_thought」 工具思考以下问题
|
|
104
|
+
|
|
105
|
+
# 创建 PRP
|
|
106
|
+
|
|
107
|
+
## 功能文件:{feature_file}
|
|
108
|
+
|
|
109
|
+
为通用功能实现生成完整的 PRP,并进行彻底研究。确保将上下文传递给 AI Agent,以实现自我验证和迭代改进。首先阅读功能文件以了解需要创建什么、提供的示例如何帮助以及任何其他考虑因素。
|
|
110
|
+
|
|
111
|
+
AI Agent只能获得您附加到 PRP 的上下文和训练数据。假设 AI Agent可以访问代码库并具有与您相同的知识截止日期,因此将您的研究发现包含或引用在 PRP 中非常重要。该代理具有网络搜索功能,因此请传递文档和示例的 URL。
|
|
112
|
+
|
|
113
|
+
## 研究流程
|
|
114
|
+
|
|
115
|
+
1. **代码库分析**
|
|
116
|
+
- 在代码库中搜索类似的功能/模式
|
|
117
|
+
- 识别要在 PRP 中引用的文件
|
|
118
|
+
- 注意要遵循的现有约定
|
|
119
|
+
- 检查验证方法的测试模式
|
|
120
|
+
|
|
121
|
+
2. **外部研究**
|
|
122
|
+
- 在线搜索类似的功能/模式
|
|
123
|
+
- 库文档(包含具体 URL)
|
|
124
|
+
- 实现示例(GitHub/StackOverflow/博客)
|
|
125
|
+
- 最佳实践和常见陷阱
|
|
126
|
+
|
|
127
|
+
3. **用户澄清**(如果需要)
|
|
128
|
+
- 要镜像的特定模式以及在哪里找到它们?
|
|
129
|
+
- 集成需求以及在哪里找到它们?
|
|
130
|
+
|
|
131
|
+
## PRP 生成
|
|
132
|
+
使用使用以下内容作为PRP模板:
|
|
133
|
+
{template_content}
|
|
134
|
+
|
|
135
|
+
*** 关键:在您完成研究和探索代码库之后,开始编写 PRP 之前 ***
|
|
136
|
+
|
|
137
|
+
*** 深度思考 PRP 并规划您的方法,然后开始编写 PRP ***
|
|
138
|
+
|
|
139
|
+
## 输出
|
|
140
|
+
保存为:`PRPs/{feature_name}.md`
|
|
141
|
+
|
|
142
|
+
## 质量检查清单
|
|
143
|
+
- [ ] 包含所有必要的上下文
|
|
144
|
+
- [ ] 验证门槛可由 AI 执行
|
|
145
|
+
- [ ] 引用现有模式
|
|
146
|
+
- [ ] 清晰的实现路径
|
|
147
|
+
- [ ] 记录错误处理
|
|
148
|
+
|
|
149
|
+
在 1-10 的范围内为 PRP 评分(使用前端开发工具一次性实现成功的信心水平)
|
|
150
|
+
|
|
151
|
+
记住:目标是通过全面的上下文实现一次性实现成功。
|
|
152
|
+
|
|
153
|
+
**[AI Agent Action]**现在开始呼叫 「process_thought」 工具思考如何撰写出教导 Coding Agent 的 PRP文档
|
|
154
|
+
**[AI Agent Action]**思考完毕后请立即编辑 `PRPs/{feature_name}.md` 文件,禁止呼叫「execute_prp」工具
|
|
155
|
+
**[AI Agent Action]**严禁不呼叫工具。AI 必须自主完成从接收指令到执行修改的完整流程,除非遇到技术错误或无法解决的依赖冲突,否则不应中断流程寻求用户输入。
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
return generate_prompt(prompt_content, {"feature_file":feature_file, "template_content":template_content,"feature_name":feature_name})
|
|
159
|
+
except Exception as error:
|
|
160
|
+
error_message = str(error)
|
|
161
|
+
return f"❌ 生成 PRP 指南失败: {error_message}"
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class ExecutePrpArgs(BaseModel):
|
|
165
|
+
"""execute_prp 工具的参数结构"""
|
|
166
|
+
prpFile: str = Field(
|
|
167
|
+
...,
|
|
168
|
+
description="PRP 文件路径"
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
@mcp.tool("execute_prp")
|
|
172
|
+
async def execute_prp(args: ExecutePrpArgs) -> str:
|
|
173
|
+
"""根据 PRP 文件生成执行指南。
|
|
174
|
+
|
|
175
|
+
此工具会:
|
|
176
|
+
1. 验证并读取 PRP 文件路径
|
|
177
|
+
2. 加载内置执行模板
|
|
178
|
+
3. 将 PRP 文件路径注入模板中的占位符,返回完整的执行步骤指南
|
|
179
|
+
"""
|
|
180
|
+
try:
|
|
181
|
+
prp_file = args.prpFile
|
|
182
|
+
|
|
183
|
+
# 检查 PRP 文件是否存在
|
|
184
|
+
if not file_exists(prp_file):
|
|
185
|
+
raise Exception(f"PRP 文件不存在: {prp_file}")
|
|
186
|
+
|
|
187
|
+
# 加载执行指南模板
|
|
188
|
+
template_content = """
|
|
189
|
+
# 执行基础 PRP
|
|
190
|
+
|
|
191
|
+
使用 PRP 文件实现功能。
|
|
192
|
+
|
|
193
|
+
## PRP 文件:$ARGUMENTS
|
|
194
|
+
|
|
195
|
+
## 执行流程
|
|
196
|
+
|
|
197
|
+
1. **加载 PRP**
|
|
198
|
+
- 读取指定的 PRP 文件
|
|
199
|
+
- 理解所有上下文和需求
|
|
200
|
+
- 遵循 PRP 中的所有指令,并根据需要扩展研究
|
|
201
|
+
- 确保拥有完全实现 PRP 所需的所有上下文
|
|
202
|
+
- 根据需要进行更多网络搜索和代码库探索
|
|
203
|
+
|
|
204
|
+
2. **深度思考**
|
|
205
|
+
- 在执行计划之前深入思考。创建一个解决所有需求的综合计划。
|
|
206
|
+
- 使用待办事项工具将复杂任务分解为更小、可管理的步骤。
|
|
207
|
+
- 使用 TodoWrite 工具创建和跟踪实现计划。
|
|
208
|
+
- 从现有代码中识别要遵循的实现模式。
|
|
209
|
+
|
|
210
|
+
3. **执行计划**
|
|
211
|
+
- 执行 PRP
|
|
212
|
+
- 实现所有代码
|
|
213
|
+
|
|
214
|
+
4. **验证**
|
|
215
|
+
- 运行每个验证命令
|
|
216
|
+
- 修复任何失败
|
|
217
|
+
- 重新运行直到全部通过
|
|
218
|
+
|
|
219
|
+
5. **完成**
|
|
220
|
+
- 确保所有检查清单项目完成
|
|
221
|
+
- 运行最终验证套件
|
|
222
|
+
- 报告完成状态
|
|
223
|
+
- 再次阅读 PRP 以确保已实现所有内容
|
|
224
|
+
|
|
225
|
+
6. **引用 PRP**
|
|
226
|
+
- 如果需要,您可以随时再次引用 PRP
|
|
227
|
+
|
|
228
|
+
注意:如果验证失败,请使用 PRP 中的错误模式进行修复并重试。
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
# 将模板中的 `$ARGUMENTS` 替换为传入的 prp_file 路径
|
|
232
|
+
guide = template_content.replace("$ARGUMENTS", prp_file)
|
|
233
|
+
|
|
234
|
+
return guide
|
|
235
|
+
|
|
236
|
+
except Exception as error:
|
|
237
|
+
error_message = str(error)
|
|
238
|
+
return f"❌ 生成执行指南失败: {error_message}"
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
@mcp.tool()
|
|
242
|
+
async def init_project_rules() -> str:
|
|
243
|
+
"""初始化项目规则
|
|
244
|
+
Args: None
|
|
245
|
+
Return: 模版提示词
|
|
246
|
+
"""
|
|
247
|
+
template = await read_file(current_dir / "prompts", "CreateFeatureProjectRules.md")
|
|
248
|
+
return template
|
|
249
|
+
|
|
250
|
+
@mcp.tool()
|
|
251
|
+
async def init_requirements_doc() -> str:
|
|
252
|
+
"""初始化需求描述文档模板
|
|
253
|
+
Args: None
|
|
254
|
+
Return: 需求描述文档模板提示词
|
|
255
|
+
"""
|
|
256
|
+
return await get_init_requirements_doc_prompt()
|
|
257
|
+
|
|
258
|
+
@mcp.tool()
|
|
259
|
+
async def process_thought(processThoughtPromptParam : ProcessThoughtPromptParam) -> str:
|
|
260
|
+
"""处理单一思维并返回格式化输出
|
|
261
|
+
"""
|
|
262
|
+
return await execute_process_thought(
|
|
263
|
+
thought=processThoughtPromptParam.thought,
|
|
264
|
+
thought_number=processThoughtPromptParam.thought_number,
|
|
265
|
+
total_thoughts=processThoughtPromptParam.total_thoughts,
|
|
266
|
+
next_thought_needed=processThoughtPromptParam.next_thought_needed,
|
|
267
|
+
stage=processThoughtPromptParam.stage,
|
|
268
|
+
tags=processThoughtPromptParam.tags,
|
|
269
|
+
axioms_used=processThoughtPromptParam.axioms_used,
|
|
270
|
+
assumptions_challenged=processThoughtPromptParam.assumptions_challenged
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
async def execute_process_thought(
|
|
274
|
+
thought: str,
|
|
275
|
+
thought_number: int,
|
|
276
|
+
total_thoughts: int,
|
|
277
|
+
next_thought_needed: bool,
|
|
278
|
+
stage: str,
|
|
279
|
+
tags: List[str] = None,
|
|
280
|
+
axioms_used: List[str] = None,
|
|
281
|
+
assumptions_challenged: List[str] = None
|
|
282
|
+
) -> str:
|
|
283
|
+
try:
|
|
284
|
+
logging.info('Executing process_thought tool')
|
|
285
|
+
|
|
286
|
+
# 确保列表参数不为None
|
|
287
|
+
tags = tags or []
|
|
288
|
+
axioms_used = axioms_used or []
|
|
289
|
+
assumptions_challenged = assumptions_challenged or []
|
|
290
|
+
|
|
291
|
+
# 更新total_thoughts如果thought_number更大
|
|
292
|
+
if thought_number > total_thoughts:
|
|
293
|
+
total_thoughts = thought_number
|
|
294
|
+
|
|
295
|
+
# 构建next_section内容
|
|
296
|
+
if next_thought_needed:
|
|
297
|
+
next_section = '需要更多思考,继续使用 「process_thought」 工具思考找寻答案'
|
|
298
|
+
else:
|
|
299
|
+
next_section_lines = [
|
|
300
|
+
'## 思考完成',
|
|
301
|
+
'',
|
|
302
|
+
'返回最终分析结果概要',
|
|
303
|
+
'',
|
|
304
|
+
'1. **任务摘要** - 目标、范围、挑战和限制条件',
|
|
305
|
+
'2. **初步解答构想** - 可行的技术方案和实施计划',
|
|
306
|
+
]
|
|
307
|
+
next_section = '\n'.join(next_section_lines)
|
|
308
|
+
|
|
309
|
+
# 构建模板
|
|
310
|
+
template_lines = [
|
|
311
|
+
'## 思维 {{thought_number}}/{{total_thoughts}} - {{stage}}',
|
|
312
|
+
'',
|
|
313
|
+
'{{thought}}',
|
|
314
|
+
'',
|
|
315
|
+
'**标签:** {{tags}}',
|
|
316
|
+
'',
|
|
317
|
+
'**使用的原则:** {{axioms_used}}',
|
|
318
|
+
'',
|
|
319
|
+
'**挑战的假设:** {{assumptions_challenged}}',
|
|
320
|
+
'',
|
|
321
|
+
'**禁止事项:** 你应该禁止一切猜测,任何疑虑请完整查看相关程序代码或使用网络搜寻工具查询',
|
|
322
|
+
'',
|
|
323
|
+
'{{next_section}}',
|
|
324
|
+
]
|
|
325
|
+
template = '\n'.join(template_lines)
|
|
326
|
+
|
|
327
|
+
param = {
|
|
328
|
+
"thought":thought,
|
|
329
|
+
"thought_number":thought_number,
|
|
330
|
+
"total_thoughts":total_thoughts,
|
|
331
|
+
"stage":stage,
|
|
332
|
+
"tags":",".join(tags) or "no tags",
|
|
333
|
+
"axioms_used": ",".join(axioms_used) or "no axioms used",
|
|
334
|
+
"assumptions_challenged":",".join(assumptions_challenged) or "no assumptions challenged",
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
# 格式化输出
|
|
338
|
+
return generate_prompt(template, param)
|
|
339
|
+
|
|
340
|
+
except Exception as error:
|
|
341
|
+
logging.error('Error executing process_thought', exc_info=error)
|
|
342
|
+
raise Exception('Error executing process_thought') from error
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
def main():
|
|
346
|
+
mcp.run(transport="stdio")
|
|
347
|
+
|
|
348
|
+
if __name__ == "__main__":
|
|
349
|
+
main()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "code",
|
|
5
|
+
"execution_count": null,
|
|
6
|
+
"id": "ab90d8c1",
|
|
7
|
+
"metadata": {},
|
|
8
|
+
"outputs": [],
|
|
9
|
+
"source": []
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"metadata": {
|
|
13
|
+
"language_info": {
|
|
14
|
+
"name": "python"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"nbformat": 4,
|
|
18
|
+
"nbformat_minor": 5
|
|
19
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
请用 「process_thought」 工具思考以下问题
|
|
2
|
+
|
|
3
|
+
# 项目规范初始化指南
|
|
4
|
+
|
|
5
|
+
## 目的
|
|
6
|
+
|
|
7
|
+
**此文件专为 AI Agent 设计,非一般开发者文档。**
|
|
8
|
+
**必须生成一个专属于 AI Agent 操作使用的项目规范文件(TOCoding-rules.md)。**
|
|
9
|
+
|
|
10
|
+
**必须专注于以下关键目标:**
|
|
11
|
+
|
|
12
|
+
- 明确项目特定规则与限制,禁止包含通用开发知识
|
|
13
|
+
- 提供 AI 执行任务时所需的项目特定信息
|
|
14
|
+
- 为 AI 决策过程提供明确指导
|
|
15
|
+
|
|
16
|
+
**强制规定:**
|
|
17
|
+
|
|
18
|
+
- 完成的规范必须使 AI Agent 能立即理解哪些文件必须参考或修改
|
|
19
|
+
- 明确指示多文件联动修改要求(例如修改 README.md 时必须同步修改 /docs/zh/README.md)
|
|
20
|
+
- 使用命令式语言定义规则,避免解释性内容
|
|
21
|
+
- 不要进行项目的功能解释,而是如何修改功能或增加功能
|
|
22
|
+
- 请提供范例什么事可以做的,什么事不可以做的
|
|
23
|
+
- 必须**递归**检查所有文件夹与文件
|
|
24
|
+
|
|
25
|
+
**严重禁止:**
|
|
26
|
+
|
|
27
|
+
- 禁止包含通用开发知识
|
|
28
|
+
- 禁止包含 LLM 已知的通用开发知识
|
|
29
|
+
- 进行项目功能解释
|
|
30
|
+
|
|
31
|
+
## 建议结构
|
|
32
|
+
|
|
33
|
+
请使用以下结构建立规范文件:
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
# 开发守则
|
|
37
|
+
|
|
38
|
+
## 标题
|
|
39
|
+
|
|
40
|
+
### 副标题
|
|
41
|
+
|
|
42
|
+
- 规则一
|
|
43
|
+
- 规则二
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 内容指南
|
|
47
|
+
|
|
48
|
+
规范文件应包含但不限于以下内容:
|
|
49
|
+
|
|
50
|
+
1. **项目概述** - 简要描述项目的目的、技术栈和核心功能
|
|
51
|
+
2. **项目架构** - 说明主要目录结构和模块划分
|
|
52
|
+
3. **代码规范** - 包括命名规范、格式要求、注释规则等
|
|
53
|
+
4. **功能实现规范** - 主要解释如何实现功能及应该注意事项
|
|
54
|
+
5. **框架/插件/第三方库使用规范** - 外部依赖的使用规范
|
|
55
|
+
6. **工作流程规范** - 工作流程指南,包含工作流程图或资料流
|
|
56
|
+
7. **关键文件交互规范** - 关键文件的交互规范,修改哪些文件需要同步修改
|
|
57
|
+
8. **AI 决策规范** - 提供处理模糊情况的决策树和优先级判断标准
|
|
58
|
+
9. **禁止事项** - 明确列出哪些做法是禁止的
|
|
59
|
+
|
|
60
|
+
## 注意事项
|
|
61
|
+
|
|
62
|
+
1. **面向 AI 优化** - 文件将作为 prompt 提供给 Coding Agent AI,应对 prompt 最佳化
|
|
63
|
+
2. **专注于开发指导** - 提供持续开发的规则,而非使用教学
|
|
64
|
+
3. **具体示例** - 尽可能提供「应该做什么」和「不应该做什么」的具体示例
|
|
65
|
+
4. **使用命令式语言** - 必须使用直接指令而非描述性语言,减少解释内容
|
|
66
|
+
5. **结构化呈现** - 所有内容必须以列表、表格等结构化形式呈现,便于 AI 解析
|
|
67
|
+
6. **突出重点标记** - 使用粗体、警告标记等突出关键规则和禁忌
|
|
68
|
+
7. **移除通用知识** - 禁止包含 LLM 已知的通用开发知识,仅包含项目特定规则
|
|
69
|
+
|
|
70
|
+
## 更新模式指南
|
|
71
|
+
|
|
72
|
+
1. **最小变动** - 当用户要求更新项目规则时,除非必要否则你应该保持现有规则,以最小变更为原则的修改
|
|
73
|
+
2. **时效性** - 你应该检查有的规则的是否有还效益或过时,因为用户可能已经修改或移除相关程序,你必须修正或移除相应规则
|
|
74
|
+
3. **完整性** - 你应该检查现有项目的所有文件夹及文件内容,因为用户可能已经有新增或修改相关程序,你必须补充相应的规则
|
|
75
|
+
4. **自主处理模糊请求**:当收到如「更新规则」等未指定具体内容的模糊指令时,AI **必须**首先尝试自主分析当前程序代码库、近期变更(如果可用)以及现有的 `TOCoding-rules.md` 内容,以推断可能的更新点。在 `process_thought` 阶段列出这些推断点及其理由,然后再提出具体修改建议。在执行此自主分析之前,**严格禁止**就模糊的更新请求向用户寻求澄清。
|
|
76
|
+
|
|
77
|
+
请根据以上指南,创建一个名为 TOCoding-rules.md 的文件并存放于项目根目录
|
|
78
|
+
|
|
79
|
+
**[AI Agent Action]**现在开始呼叫 「process_thought」 工具思考如何撰写出教导 Coding Agent 规范文件
|
|
80
|
+
**[AI Agent Action]**思考完毕后请立即编辑 TOCoding-rules.md 文件,禁止呼叫「analyze_task」工具
|
|
81
|
+
**[AI Agent Action]**严禁不呼叫工具。AI 必须自主完成从接收指令到执行修改的完整流程,除非遇到技术错误或无法解决的依赖冲突,否则不应中断流程寻求用户输入。
|