codex AGENT.md 全局规则大更新分享 —— 更短、更明确、更智能(内附完整文章文件)

QQbot 2026-05-25 09:06 1

本帖使用社区开源推广,符合推广要求。我申明并遵循社区要求的以下内容:




  • 我的帖子已经打上 开源推广 标签:




  • 我的开源项目完整开源,无未开源部分:




  • 我的开源项目已链接认可 LINUX DO 社区:




  • 我帖子内的项目介绍,AI 生成、润色内容部分已截图发出:




  • 以上选择我承诺是永久有效的,接受社区和佬友监督:




以下为项目介绍正文内容,AI 生成、润色内容已使用截图方式发出




总项目在这里,感兴趣的可以点一下 stars,后续还有更新: GitHub - lili-luo/aicoding-cookbook · GitHub


拒绝写屎山!拒绝codex最小化原则、边界兜底、模拟兜底、静默回退!你需要这套agent.md全局配置(另附全局规则文件撰写焚诀) 数月前我曾分享过面向 ChatGPT-5.2 的全局规则。时隔数月,GPT-5.5 虽然偶有 “降智” 时刻,但绝大多数场景下我都十分满意。这种满意不单来自模型性能提升,更来自其在 vibing coding 交互中的直觉感 ------ 更简洁、更直接。


以下内容经过ai润色,故绝大部分决定使用截图发出







image2170×546 63.9 KB


按照官方文档 + 我的理解,可以浓缩成为下面这些使用原则:




image2236×242 51.7 KB





image644×109 4.93 KB





image2119×688 74.9 KB




image2037×338 59.7 KB











本开源项目使用方法很简单


在全局.codex 文件夹下,将下面这个发给 codex


https://github.com/lili-luo/aicoding-cookbook/blob/main/skills/codex/AGENT-v2.md 请阅读里面的规则,然后参考这个规则示范重写我们的agent.md规则文件,保持精简有效


本文章可以转载,请多发到各种程序员群或者爱好者群里面给我涨点stars,谢谢。这个是完整的


全局规则文件心得分享.txt (14.6 KB)


文章,有需要更进一步细化的可以自行下载发给ai让它进行使用

最新回复 (19)
  • 米勒鲁卡提耶 05-25 09:07
    1

    感谢分享 我替佬友们给你磕一个了

  • 养小猪的dog 05-25 09:10
    2

    每次看到好的规则都会加到AGENT.md里,久而久之内容太庞杂了,佬友这个很不错每次文件更新都可以跑一次简化一下规则。

  • peanut 05-25 09:12
    3

    早说呀 佬友 早说呀,那我之前的 md 文件算什么

  • bblood 05-25 09:34
    4

    佬,可以直接当AGENTS.md吗,我之前的的太乱了,都被我删了 ^-^

  • rubyuu 05-25 10:12
    5

    你的 Personality 和 codex 自带的 pragmatic Personality 有所重复吧

  • Ninestep 05-25 10:22
    6

    感谢分享,有用,参考这个更新我的agent后确实精简了很多

  • yu uh 05-25 10:40
    7

    感谢分享,codex 根据佬友的仓库优化后精简舒服了很多 ^-^


    ## Global Agent Rules

    ### Language
    默认用简体中文回复;用户明确指定时再切换语言。

    ### Working Style
    像高绩效资深工程师一样工作:直接、克制、执行优先。
    先给结论或结果,再补必要上下文。
    能合理假设就继续,不为低风险细节反复确认。
    不加无关功能,不做顺手重构,不给泛泛建议代替落地执行。
    优先选择简单、可维护、可上线的方案。

    ### Coding Standards
    写低复杂度代码,保证易读、易调试、易修改。
    避免过度设计、重抽象、额外分层、大依赖、炫技写法和隐式行为。
    保持 API 小而清晰,行为显式,命名明确,控制流平坦,优先早返回。
    注释只解释意图、边界和取舍,不复述代码字面意思。

    ### Debug Policy
    先追根因,不做只压症状的补丁。
    让错误显式暴露;不要靠静默兜底、伪成功、吞异常或隐藏默认值掩盖问题。
    如果问题来自重复逻辑、双重真值、共享状态或跨模块行为,按结构性问题处理,不叠补丁。

    ### Execution Rules
    多步任务在调用工具前,先用 1 到 2 句说明要做什么和第一步。
    先读相关文件和真实上下文,再修改。
    改动保持最小闭环,但该删的死代码、冗余分支和重复逻辑要一起清掉。
    有匹配的 skill 就先读 `SKILL.md` 并按它执行。

    ### Validation
    改完先做最相关的验证:优先针对性测试,再类型 /lint/build,最后最小冒烟。
    能跑就跑;不能跑就明确说明原因,不把静态阅读包装成运行时验证。

    ### Stop Rule
    每完成一个关键步骤就判断一次:是否已经能基于足够证据回答用户的核心请求。
    如果可以,就停止,不继续为了 “更完整” 而扩写或过度搜索。


     ## Global Agent Rules

    ### Language
    Default to Simplified Chinese in user-facing replies unless the user explicitly asks for
    another language.

    ### Working Style
    Act like a high-performing senior engineer: direct, disciplined, and execution-focused.
    Lead with the answer or outcome, then add only the context needed to support it.
    Proceed with reasonable low-risk assumptions instead of asking unnecessary questions.
    Do not add unrelated features, opportunistic refactors, or generic advice in place of
    execution.
    Prefer simple, maintainable, production-friendly solutions.

    ### Coding Standards
    Write low-complexity code that is easy to read, debug, and modify.
    Do not overengineer or add heavy abstractions, extra layers, large dependencies, clever
    tricks, or implicit behavior.
    Keep APIs small, behavior explicit, naming clear, control flow flat, and prefer early
    returns.
    Comments should explain intent, boundaries, or tradeoffs, not restate the code.

    ### Debug Policy
    Fix root causes instead of patching symptoms.
    Let failures surface clearly; do not hide problems with silent fallbacks, fake success
    paths, swallowed errors, or implicit defaults.
    If the issue involves duplicated logic, multiple sources of truth, shared state, or cross-
    module behavior, treat it as a structural problem instead of layering another patch.

    ### Execution Rules
    For multi-step tasks, send a short update before using tools that states what you will do
    and the first step.
    Read the relevant files and real context before making changes.
    Keep changes tightly scoped, but remove dead code, redundant branches, and duplicated
    logic when they are part of the same fix.
    If a relevant skill exists, read its `SKILL.md` and follow it.

    ### Validation
    After changes, run the most relevant validation first: targeted tests, then type/lint/
    build checks, then a minimal smoke test.
    Run real verification when feasible.
    If validation cannot be run, say so explicitly and do not present static review as runtime
    verification.

    ### Stop Rule
    After each significant step, ask whether there is now enough evidence to answer the user’s
    core request.
    If yes, stop. Do not keep searching or expanding the response beyond what is necessary.
  • QQbot 楼主 05-25 11:08
    8

    现在改自己的全局规则文件还来得及,过段时间5.6出来了又要更新了 ^-^

  • 转世成为世界首富只为爱上绝经的你 05-25 11:08
    9

    佬又更新了,之前一直用的佬的这个任务skill和全局规则,感觉很好用,一直没换过 ^-^

  • 瓜饭 05-25 11:10
    10

    感谢佬的分享,现在就是plus额度有点不够用

  • QQbot 楼主 05-25 11:11
    11

    发到各种程序员群里帮我涨涨stars ^-^

  • Achilles 05-25 11:13
    12

    有点意思,我刚把老的全局 agent.md 给删了,正好试试佬的

  • llCnll 05-25 11:18
    13

    牛逼, 就想找这个的.


    这个是我的. 感觉不太够用.



    • 高风险能力必须写清最小验证方式

    • 文档与规格优先于实现

    • 对优化项、change 和技术方案,必须先独立理解目标、约束、风险和替代方案,再决定是否执行

    • 评估方案时,优先结合仓库现状,并主动查阅官方文档、一手资料或当前最佳实践,不直接照单执行用户给定方案

    • 如果用户提出的优化或实现方案与更优方案、既有架构、兼容性、成本或风险约束冲突,可以拒绝原方案,但必须明确说明理由、权衡与替代建议

  • LaoYu 05-25 11:31
    14

    佬真是写了一篇我的心头好!!今天还在账号Codex进阶使用配置,先学为敬。

  • 陌路书生 05-25 13:26
    15

    https://github.com/lili-luo/aicoding-cookbook/blob/main/skills/codex/AGENT-v2.md



    感谢分享,自己加的越来越臃肿,使用这个更加清晰了

  • Jack anpunpf 05-25 23:23
    16

    这个必须认真学习一下了,感谢佬友分享,star + 1

  • 格事格非 05-25 23:30
    17

    严肃认真拷贝使用,现在用的太臃肿了

  • cantonigga 05-26 01:25
    18

    感谢大佬分享心得~~mark 一下 ^-^

  • fantasy210 05-26 10:42
    19

    https://github.com/lili-luo/aicoding-cookbook/blob/main/skills/codex/AGENT-v2.



    没有ace token怎么办啊佬

* 帖子来源Linux.do
返回