correct
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCorrect
Correct
The operator keeps correcting agents in this repo for the same mistakes. Change the repo so the next agent can't make them.
Assume every contributor is an agent that sees only the files it opened, copies the nearest example, and takes the shortest path that compiles. Design the repo so a change that looks right from one file is right for the whole repo.
操作者一直在纠正此仓库中的 Agent 所犯的相同错误。修改仓库,让下一个 Agent 无法再犯这些错误。
假设每位贡献者都是 Agent,只能看到自己打开的文件,会复制最近的示例,并选择能够编译的最短路径。应对仓库进行设计,使得一项改动即使从单个文件看是正确的,对整个仓库而言也是正确的。
Find the mistake classes
找出错误类别
First, read recent commits, reverts, review comments, agent instruction files, and comments that explain workarounds. Group the mistakes into classes. A class counts once it has happened twice.
首先,阅读最近的 commit、revert、review comment、Agent instruction file,以及解释 workaround 的 comment。将这些错误归入不同类别。同一类别发生两次后,才算作一个类别。
Fix each class at the highest level that works
在最高可行层级修复每个类别
- Eliminate it with architecture. Give each piece of state one owner and each task one supported way. Hide internals so the wrong import fails. Replace hand-synced lists with one source of truth. Delete old ways and dead code an agent would copy.
- Enforce it with types so the bad state can't be written. If bad code still compiles, add a lint or CI check whose error names the file, type, or function to use instead. If the pattern is already common, fail only when a change adds more.
- Test the behavior. Fix or delete any test that would still pass if every function it calls returned nothing.
- Write docs or agent rules last, only for judgment calls. Nothing fails when an agent skips them.
- 用架构彻底消除它。 让每份状态只有一个所有者,让每项任务只有一种受支持的方式。隐藏内部实现,使错误的 import 失败。用单一事实来源替换需要手动同步的列表。删除旧做法以及 Agent 可能会复制的死代码。
- 使用 types 进行约束,使错误状态无法被写入。 如果错误代码仍能编译,则添加 lint 或 CI 检查,其报错信息必须指出应改用的 file、type 或 function。如果该模式已经很常见,则仅当某次改动增加了更多此类模式时,检查才应失败。
- 测试行为。 修复或删除任何存在以下情况的 test:即使它调用的每个 function 都不返回任何内容,该 test 仍会通过。
- 最后才编写文档或 Agent 规则,并且只用于需要判断力的事项。 Agent 跳过它们时,不应有任何检查失败。
Fix and prove
修复并证明
Then fix the most frequent classes now, one commit each. Prove each new check fails on a real past mistake. Run the same command locally and in CI. Exceptions go on the offending line with a reason, an expiry date, and a human's approval.
随后立即修复最常发生的错误类别,每个类别单独创建一个 commit。证明每项新检查都会在真实发生过的历史错误上失败。在本地和 CI 中运行相同的命令。例外应放在违规的那一行,并附上原因、到期日期和人工批准。
Keep the rule table
维护规则表
Last, keep a table in the agent instruction file that pairs each rule with what enforces it. When the operator corrects you, fix the mistake and add the rule. If the rule was already there and nothing enforces it, that's a repeat, so fix it at the highest level in the same change. Drop a rule once its mistake can't happen.
Reply: each class with its evidence, the level you picked, and why a higher level didn't work.
最后,在 Agent instruction file 中维护一张表,将每条规则与其执行机制对应起来。当操作者纠正你时,修复该错误并添加相应规则。如果规则已经存在,却没有任何机制强制执行,这就是重复问题,因此应在同一次改动中按最高可行层级进行修复。一旦某条规则对应的错误已不可能发生,就删除该规则。
回复: 列出每个错误类别及其证据、所选择的层级,以及为什么更高层级行不通。