返回列表
🧠 阿头学 · 💬 讨论题

AGENTS.md 不是越全越好,臃肿文档正在给编码智能体加税

这篇文章的判断是对的:大而全的 AGENTS.md 往往不是增强剂,而是让编码智能体更慢、更散、更容易抓不到重点的固定成本。
打开原文 ↗

2026-03-24 原文链接 ↗
阅读简报
双语对照
完整翻译
原文
讨论归档

核心观点

  • 问题不在“有没有 AGENTS.md”,而在“信息是否高价值” 作者最有力的判断是,智能体通常不缺更多说明文字,真正缺的是任务当下可用的正确状态、最新决策和关键约束;因此把 AGENTS.md 写成总说明书,方向本身就偏了。
  • 臃肿 AGENTS.md 会形成持续性的“上下文税” 如果 agent 每次开工都要先读一遍 AGENTS.md,那么重复信息、空泛哲学和低相关架构描述就会不断挤占上下文预算、增加延迟并稀释注意力,这个负担在高频调用时尤其明显。
  • 最该保留的是“代码里推不出来的例外知识” 作者把 AGENTS.md 重新定位为例外清单,这是全文最站得住脚的部分:精确测试命令、离谱初始化步骤、部署怪癖、隐藏约束,这些才是模型最难自行恢复、但一旦缺失就最容易翻车的信息。
  • “编码哲学”和重复架构介绍大多该删 README 已有的内容、代码里可推断的内容、泛泛而谈的风格原则,放进 AGENTS.md 大概率弊大于利;这类内容看似是在兜底,实际上是在制造噪音。
  • 但文章也有明显过度外推 作者把“很多 AGENTS.md 写坏了”推成“AGENTS.md 可能让智能体更糟”,这个标题级结论偏重;对遗留系统、架构混乱仓库或新人/新 agent 频繁切入的团队,适度的全局说明仍然可能是刚需。

跟我们的关联

  • 对 ATou 意味着什么、下一步怎么用 ATou 如果在做 agent 工作流或 coding setup,重点不该放在雕一份“完美总提示”,而该放在状态管理和上下文路由;下一步可以直接审计现有 AGENTS.md,删除哲学、保留命令、坑点和例外。
  • 对 Neta 意味着什么、下一步怎么用 Neta 如果在整理方法论或知识系统,这篇文章说明“高频入口文档必须做信噪比管理”;下一步可以把任何 SOP/Prompt/知识卡片按“可推导 / 不可推导、通用 / 例外”重新分类。
  • 对 Uota 意味着什么、下一步怎么用 Uota 如果关注协作体验,这篇文章提醒“说明越多不等于体验越好”,因为用户和 agent 一样都会被重文档拖慢;下一步可以在产品和文档中测试“最小必要信息 + 场景化注入”的方案。
  • 对三者共同意味着什么、下一步怎么用 这不是单纯的文档问题,而是上下文工程问题;下一步最值得做的不是继续补字,而是建立一套“任务开始时注入什么、任务中如何压缩状态、任务后如何沉淀例外”的流程。

讨论引子

1. AGENTS.md 失效的根因到底是“太长太杂”,还是“模型指令遵循本来就不稳定”? 2. 对于遗留系统和复杂仓库,删掉架构概览真的是优化,还是会让 agent 更容易局部最优、全局误判? 3. 如果 Prompt Caching 已经降低了长上下文成本,那么今天真正该优化的是 token 费用,还是注意力分配与状态注入机制?

在花了更多时间拼命优化我的 AGENTS.md 文件,又读了不少同样在折腾的人给出的反馈之后,我得出的结论是,对很多人来说,它带来的伤害大于帮助。

有一阵子还以为只有我这样,费尽心思想让智能体真的去读、去按我写在 AGENTS.md 里的东西做事。后来看到 Karpathy 的这条推文才意识到,好吧,原来不止我一个。

Karpathy 说得很直白,智能体不会听我在 AGENTS.md 文件里的指令。

我觉得这里的核心问题是,智能体不缺更多文字,它真正缺的是更好的状态。Anthropic 去年 9 月就谈过这个话题,只是当时没注意到。我不太爱在文章里放链接,因为总有人觉得是在打广告。想看的话可以自己去找那篇文章,标题是 Effective context engineering for AI agents,发布时间是去年 9 月 29 日。

回到核心,去看一个 AGENTS.md 文件时,问题不在于要不要它,而在于智能体能不能在需要的时候拿到正确的命令、约束和最近的决策。在我刚提到的 Anthropic 那篇文章里,他们把关键细节的总结与压缩,视为长期运行的编码智能体保持连续性的组成部分。

问题在于,而且我跟大家一样也犯这个毛病,大而全的 AGENTS.md 并不会让智能体更聪明,更多时候只是给每个任务都加了一道税。OpenAI 在谈 Codex 时也提到过这一点,大意是 Codex 每次开工前都会读取 AGENTS.md,所以文件一旦臃肿,每次运行都会多出一段固定开销。

现在更偏向于少即是多,甚至算是比较极端的那一派。最近觉得放在 AGENTS.md 里最有用的,是精确的测试命令、一些离谱的项目专属初始化步骤、部署时的各种怪毛病之类。基本都是那种光看代码和 README.md 文件也未必能自然而然推出来的东西。

以前会写进 AGENTS.md、现在开始删掉的,是所谓的编码哲学,这也是最先被拿掉的部分。见过太多示例 AGENTS.md 里塞着一大段冗长的编码哲学,把这些删掉吧,真的太浪费了。

我也在删架构概览这类内容、README.md 里已经写过的东西,以及任何我觉得智能体从代码库里就能自己搞明白的部分。

所以并没有彻底抛弃 AGENTS.md,也不会劝别人一定要把它整份扔掉。只是现在更愿意把它当成一份会持续更新的例外清单。

而且没错,周一早上醒来脑子里会随机冒出这些念头,于是就顺手写了这篇文章。

好了,就这些。该去喝第二杯咖啡了。感谢阅读,正如 Irv 叔叔以前常说的,TGIM(谢天谢地,今天是周一)。

链接 http://x.com/i/article/2036064815941398528

After spending more time trying to optimize the heck out of my AGENTS.md file, and reading more feedback from other people trying to do the same, I've come to the conclusion that for many people, it's hurting more than helping.

For a while there I thought it was just me, struggling to get my agent to actually read and follow what I put in AGENTS.md, but after seeing this tweet from Karpathy I realized, okay - it's not just me.

Karpathy says it directly: "The agents do not listen to my instructions in the AGENTS.md files."

I think the core of the issue here is that Agents don't need more text, what they really need is better state. This is something Anthropic talked about back in September of last year...but I missed it. I don't like including links in my articles because then ppl accuse me of being a shill, so you can go find the article if you want, it's called "Effective context engineering for AI agents" and it's from Sept 29th of last year.

At the core, when you look at an AGENTS.md file, I don't think the issue is whether you have it or not, it's really about if the agents is able to actually get the right commands, constraints, and recent decisions, at the right time. In the article I referenced above from Anthropic, they talk about summarization and compression of critical details as part of how long-running coding agents maintain continuity.

The problem is, and I'm guilty of this as much as anyone else, big AGENTS.md files don't end up making your agents smarter, they really just end up being a tax on every task. OpenAI has talked about this themselves w/respect to Codex, essentially saying that since Codex reads AGENTS.md before starting work, a bloated file can end up being fixed overhead on every run.

Where I'm at now is probably in the extreme "less is more" camp. I think the most useful stuff I'm putting in my AGENTS.md file these days is exact test commands, wacky project-specific setup steps, deployment funkiness, etc. Pretty much things that I don't think the agent is going to get just from reading the code and the README.md file.

The things that I used to put in my AGENTS.md file that I'm leaving out now are things like coding philosophy, which I think was the first thing I pulled out. I see soooooo many sample AGENTS.md files that have these super long-winded coding philosophy blocks in them, get those out - it's such a waste.

I'm also removing things like architecture summaries, stuff that's already in the README.md file, and anything else I think the agent can probably get itself from the codebase.

So while I haven't gotten rid of AGENTS.md completely, and wouldn't tell anyone to completely scrap the file necessarily, I am now, more than anything, treating it as a living exception file.

And yes, I wake up on Monday morning, thinking about these things randomly, which is why I thought I'd whip up this article.

Okay, that's all I got, time for my second cup of coffee, thanks for reading and as my Uncle Irv used to say - TGIM (thank goodness it's Monday).

在花了更多时间拼命优化我的 AGENTS.md 文件,又读了不少同样在折腾的人给出的反馈之后,我得出的结论是,对很多人来说,它带来的伤害大于帮助。

有一阵子还以为只有我这样,费尽心思想让智能体真的去读、去按我写在 AGENTS.md 里的东西做事。后来看到 Karpathy 的这条推文才意识到,好吧,原来不止我一个。

Karpathy 说得很直白,智能体不会听我在 AGENTS.md 文件里的指令。

我觉得这里的核心问题是,智能体不缺更多文字,它真正缺的是更好的状态。Anthropic 去年 9 月就谈过这个话题,只是当时没注意到。我不太爱在文章里放链接,因为总有人觉得是在打广告。想看的话可以自己去找那篇文章,标题是 Effective context engineering for AI agents,发布时间是去年 9 月 29 日。

回到核心,去看一个 AGENTS.md 文件时,问题不在于要不要它,而在于智能体能不能在需要的时候拿到正确的命令、约束和最近的决策。在我刚提到的 Anthropic 那篇文章里,他们把关键细节的总结与压缩,视为长期运行的编码智能体保持连续性的组成部分。

问题在于,而且我跟大家一样也犯这个毛病,大而全的 AGENTS.md 并不会让智能体更聪明,更多时候只是给每个任务都加了一道税。OpenAI 在谈 Codex 时也提到过这一点,大意是 Codex 每次开工前都会读取 AGENTS.md,所以文件一旦臃肿,每次运行都会多出一段固定开销。

现在更偏向于少即是多,甚至算是比较极端的那一派。最近觉得放在 AGENTS.md 里最有用的,是精确的测试命令、一些离谱的项目专属初始化步骤、部署时的各种怪毛病之类。基本都是那种光看代码和 README.md 文件也未必能自然而然推出来的东西。

以前会写进 AGENTS.md、现在开始删掉的,是所谓的编码哲学,这也是最先被拿掉的部分。见过太多示例 AGENTS.md 里塞着一大段冗长的编码哲学,把这些删掉吧,真的太浪费了。

我也在删架构概览这类内容、README.md 里已经写过的东西,以及任何我觉得智能体从代码库里就能自己搞明白的部分。

所以并没有彻底抛弃 AGENTS.md,也不会劝别人一定要把它整份扔掉。只是现在更愿意把它当成一份会持续更新的例外清单。

而且没错,周一早上醒来脑子里会随机冒出这些念头,于是就顺手写了这篇文章。

好了,就这些。该去喝第二杯咖啡了。感谢阅读,正如 Irv 叔叔以前常说的,TGIM(谢天谢地,今天是周一)。

链接 http://x.com/i/article/2036064815941398528

After spending more time trying to optimize the heck out of my AGENTS.md file, and reading more feedback from other people trying to do the same, I've come to the conclusion that for many people, it's hurting more than helping.

For a while there I thought it was just me, struggling to get my agent to actually read and follow what I put in AGENTS.md, but after seeing this tweet from Karpathy I realized, okay - it's not just me.

Karpathy says it directly: "The agents do not listen to my instructions in the AGENTS.md files."

I think the core of the issue here is that Agents don't need more text, what they really need is better state. This is something Anthropic talked about back in September of last year...but I missed it. I don't like including links in my articles because then ppl accuse me of being a shill, so you can go find the article if you want, it's called "Effective context engineering for AI agents" and it's from Sept 29th of last year.

At the core, when you look at an AGENTS.md file, I don't think the issue is whether you have it or not, it's really about if the agents is able to actually get the right commands, constraints, and recent decisions, at the right time. In the article I referenced above from Anthropic, they talk about summarization and compression of critical details as part of how long-running coding agents maintain continuity.

The problem is, and I'm guilty of this as much as anyone else, big AGENTS.md files don't end up making your agents smarter, they really just end up being a tax on every task. OpenAI has talked about this themselves w/respect to Codex, essentially saying that since Codex reads AGENTS.md before starting work, a bloated file can end up being fixed overhead on every run.

Where I'm at now is probably in the extreme "less is more" camp. I think the most useful stuff I'm putting in my AGENTS.md file these days is exact test commands, wacky project-specific setup steps, deployment funkiness, etc. Pretty much things that I don't think the agent is going to get just from reading the code and the README.md file.

The things that I used to put in my AGENTS.md file that I'm leaving out now are things like coding philosophy, which I think was the first thing I pulled out. I see soooooo many sample AGENTS.md files that have these super long-winded coding philosophy blocks in them, get those out - it's such a waste.

I'm also removing things like architecture summaries, stuff that's already in the README.md file, and anything else I think the agent can probably get itself from the codebase.

So while I haven't gotten rid of AGENTS.md completely, and wouldn't tell anyone to completely scrap the file necessarily, I am now, more than anything, treating it as a living exception file.

And yes, I wake up on Monday morning, thinking about these things randomly, which is why I thought I'd whip up this article.

Okay, that's all I got, time for my second cup of coffee, thanks for reading and as my Uncle Irv used to say - TGIM (thank goodness it's Monday).

📋 讨论归档

讨论进行中…