拒绝写屎山!拒绝codex最小化原则、边界兜底、模拟兜底、静默回退!你需要这套agent.md全局配置(另附全局规则文件撰写焚诀)
众所周知,codex cli的gpt-5.2-xhigh很好用也很聪明,但是有时候聪明过头了,为了使得自己的任务能够通过,会做一些很愚蠢很投机取巧的操作,会为了跑通项目,去做一个假的模拟数值或者模拟函数,会为了无意义的成功,生成一个所谓的兜底方案导致你根本无法排查错误。因此为了避免此类问题,我们必须要做一个agent.md去强制要求,所幸,gpt的模型指令性遵循超级强,codex的远程压缩也很厉害,能够实现很多轮对话都不丢失信息,只需要写上去了,就不会再犯此类错误。
链接如下,感兴趣的可以点个star:
github.com/lili-luo/aicoding-cookbook
skills/codex/AGENTS.md
main
# Global Agent Rules
## Language
Default to Chinese in user-facing replies unless the user explicitly requests another language.
## Response Style
Do not propose follow-up tasks or enhancement at the end of your final answer.
## Debug-First Policy (No Silent Fallbacks)
- Do **not** introduce new boundary rules / guardrails / blockers / caps (e.g. max-turns), fallback behaviors, or silent degradation **just to make it run**.
- Do **not** add mock/simulation fake success paths (e.g. returning `(mock) ok`, templated outputs that bypass real execution, or swallowing errors).
- Do **not** write defensive or fallback code; it does not solve the root problem and only increases debugging cost.
- Prefer **full exposure**: let failures surface clearly (explicit errors, exceptions, logs, failing tests) so bugs are visible and can be fixed at the root cause.
- If a boundary rule or fallback is truly necessary (security/safety/privacy, or the user explicitly requests it), it must be:
- explicit (never silent),
- documented,
- easy to disable,
此文件已被截断。
显示原始文件
另外分享一个心得:agent.md和Claude.md是全局性的内容,也就是说你的对话每次都会载入作为上下文的一部分,这部分的空间注意力资源是非常非常重要的,如果你想要添加某些规则的话,务必务必谨慎,即便添加了也要十分精简。
早期你如果想要让ai遵循一套范式,你可能要加一大堆的提示词,要和ai说一堆话,才能让他明白到底要干什么。但是现在ai大部分训练都很成熟,参数量也越来越大,很多网络上热门的编程规范比如SOLID、DRY、解耦性啥的,你不需要和他全部解释清楚,只需要稍微提点,他就能明白了。总而言之,你的某些想法、规范是一大坨的,恰巧ai本身内生性训练也包含的,那你就无需解释,而是简单提点就好,保留好你珍贵的全局规则文件行数空间吧。
36 个帖子 - 26 位参与者
阅读完整话题
via
LINUX DO - 热门话题 (author: QQbot)