docs: 优化 Agents.md 参考 https://github.com/forrestchang/andrej-karpathy-skills/blob/main/CLAUDE.md
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
73304c61d9
commit
f7cf7788a5
64
AGENTS.md
64
AGENTS.md
@ -7,15 +7,69 @@ Yuxi 是一个基于大模型的智能知识库与知识图谱智能体开发平
|
||||
|
||||
## 开发准则
|
||||
|
||||
Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.
|
||||
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
|
||||
|
||||
Don't add features, refactor code, or make "improvements" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability.
|
||||
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
|
||||
|
||||
Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use backwards-compatibility shims when you can just change the code.
|
||||
## 1. Think Before Coding
|
||||
|
||||
Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task. Reuse existing abstractions where possible and follow the DRY principle.
|
||||
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
||||
|
||||
To ensure readability, it is necessary to add essential comments at key points, particularly to explain the functionality of a function and the design intent.
|
||||
Before implementing:
|
||||
- State your assumptions explicitly. If uncertain, ask.
|
||||
- If multiple interpretations exist, present them - don't pick silently.
|
||||
- If a simpler approach exists, say so. Push back when warranted.
|
||||
- If something is unclear, stop. Name what's confusing. Ask.
|
||||
|
||||
## 2. Simplicity First
|
||||
|
||||
**Minimum code that solves the problem. Nothing speculative.**
|
||||
|
||||
- No features beyond what was asked.
|
||||
- No abstractions for single-use code.
|
||||
- No "flexibility" or "configurability" that wasn't requested.
|
||||
- No error handling for impossible scenarios.
|
||||
- If you write 200 lines and it could be 50, rewrite it.
|
||||
|
||||
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
||||
|
||||
## 3. Surgical Changes
|
||||
|
||||
**Touch only what you must. Clean up only your own mess.**
|
||||
|
||||
When editing existing code:
|
||||
- Don't "improve" adjacent code, comments, or formatting.
|
||||
- Don't refactor things that aren't broken.
|
||||
- Match existing style, even if you'd do it differently.
|
||||
- If you notice unrelated dead code, mention it - don't delete it.
|
||||
|
||||
When your changes create orphans:
|
||||
- Remove imports/variables/functions that YOUR changes made unused.
|
||||
- Don't remove pre-existing dead code unless asked.
|
||||
|
||||
The test: Every changed line should trace directly to the user's request.
|
||||
|
||||
## 4. Goal-Driven Execution
|
||||
|
||||
**Define success criteria. Loop until verified.**
|
||||
|
||||
Transform tasks into verifiable goals:
|
||||
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
||||
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
||||
- "Refactor X" → "Ensure tests pass before and after"
|
||||
|
||||
For multi-step tasks, state a brief plan:
|
||||
```
|
||||
1. [Step] → verify: [check]
|
||||
2. [Step] → verify: [check]
|
||||
3. [Step] → verify: [check]
|
||||
```
|
||||
|
||||
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
|
||||
|
||||
---
|
||||
|
||||
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
|
||||
|
||||
## 开发与调试工作流 (Development & Debugging Workflow)
|
||||
|
||||
|
||||
@ -12,9 +12,12 @@
|
||||
- Langfuse 增加 self-host 模式支持,补齐私有化部署与配置说明(已支持 cloud,待调试)
|
||||
- 检索测试中,添加问答
|
||||
- 集成 Memory,基于 deepagents 的文件后端实现,需要考虑定位
|
||||
- 添加自定义向量模型和 rerank 模型的配置,在网页上面 `0.7`
|
||||
- Yuxi-cli 相关的功能,放在后续版本中实现(不是类似于编程助手,而是管理平台的工,等各个 router 接口优化之后)
|
||||
- 完善个人知识库(仅设想,欢迎讨论)
|
||||
- 完善测试基准自动生成功能,目前的实现过于简单,无法覆盖实际需求
|
||||
- 完善 Skills 的环境变量注入
|
||||
- 拓宽检索的知识源,统一多知识源(channel),目前已知知识库/知识图谱/网页,可拓展:个人知识库、数据库、历史对话等
|
||||
- 前置任务,多知识库并行检索(扩展 query_kb)
|
||||
|
||||
### Bugs
|
||||
- 目前的知识库的图片存在公开访问风险
|
||||
|
||||
Loading…
Reference in New Issue
Block a user