OpenAI发布了开源的Agent README格式: AGENTS.md
而且这就是它的域名,可以直接访问。
目前Codex, Amp, Google jules , Cursor, FactoryAI和RooCode都已比加入到这个这个统一标准中。
AGENTS.md 是一种专门为 AI 编码代理(coding agents)设计的开放格式文档,作用相当于项目的 “README for agents”,但它不是给人类贡献者看的,而是给 AI 看的,用来集中、明确地告诉 AI 代理如何在你的项目中工作。
AGENTS.md 是一个放在代码仓库根目录(或子项目目录)的 Markdown 文件,里面记录的是 AI 编码代理需要的上下文和指令,比如:
- 项目安装、构建、运行、测试的命令
- 代码风格与约定
- PR/Commit 格式要求
- 部署或调试技巧
- 安全注意事项、特殊依赖等
它的定位是补充 README.md:
README.md 给人类贡献者的快速上手、项目介绍,AGENTS.md则是给 AI 的详细工作说明,方便它自动构建、测试、修复
一个典型的AGENTS.md长这样
# Sample AGENTS.md file ## Dev environment tips - Use `pnpm dlx turbo run where <project_name>` to jump to a package instead of scanning with `ls`. - Run `pnpm install --filter <project_name>` to add the package to your workspace so Vite, ESLint, and TypeScript can see it. - Use `pnpm create vite@latest <project_name> -- --template react-ts` to spin up a new React + Vite package with TypeScript checks ready. - Check the name field inside each package's package.json to confirm the right name—skip the top-level one. ## Testing instructions - Find the CI plan in the .github/workflows folder. - Run `pnpm turbo run test --filter <project_name>` to run every check defined for that package. - From the package root you can just call `pnpm test`. The commit should pass all tests before you merge. - To focus on one step, add the Vitest pattern: `pnpm vitest run -t "<test name>"`. - Fix any test or type errors until the whole suite is green. - After moving files or changing imports, run `pnpm lint --filter <project_name>` to be sure ESLint and TypeScript rules still pass. - Add or update tests for the code you change, even if nobody asked. ## PR instructions - Title format: [<project_name>] <Title> - Always run `pnpm lint` and `pnpm test` before committing.
其实就是markdown文件,但是这个文件可以让让 AI 工作更精准。
通过结构化的描述,AI 在写代码、修 bug 时,不必从零推测项目的构建方式和规范,也避免 AI 去执行错误的命令或采用不符合规范的代码风格。
而且因为统一了编写 ,OpenAI Codex、Cursor、RooCode、Google Amp/Jules 等支持同一份 AGENTS.md,一处编写,处处可写,还可以做为团队开发的共享文档。
除此之外,一些大型的monorepo项目,可以不在同的子目录放不同的 AGENTS.md,让AI读取离编辑文件最近的那份,这样一个项目就可以有不同的参照标准了。
