Less re-explaining
Commands, conventions, and repo constraints move into stable instructions instead of living only in your head.
Module 03.4
Codex repo memory
The biggest jump in long-term Codex quality comes when repeated guidance leaves the chat and enters the system. This lesson shows what belongs in AGENTS.md, when to add rules, how skills help, and why MCP should solve a real workflow instead of looking impressive.
模块 03.4
Codex 仓库记忆
长期来看,Codex 质量最大的跃升,来自反复出现的指导离开聊天窗口、进入系统本身。 这个子模块会讲清什么应该放进 AGENTS.md,什么时候需要 rules,skills 有什么价值,以及为什么 MCP 应该解决真实工作流,而不是只看起来高级。
Outcomes
Commands, conventions, and repo constraints move into stable instructions instead of living only in your head.
Codex starts from better defaults when it can read the same durable guidance every time.
Skills and MCP stop being shiny extras and start becoming reusable workflow components.
学习结果
命令、约定和仓库限制进入稳定指令,而不再只留在你的脑子里。
当 Codex 每次都能读到同一套耐用指导时,会话会从更好的默认值开始。
skills 和 MCP 不再只是好看的附加品,而是真正可复用的工作流部件。
Workflow
Capture repo-specific commands, expectations, and constraints that recur often and matter to almost every session.
Keep broad guidance near the repo root, then add more specific AGENTS.md files deeper in the tree only where local rules differ.
Use rules when certain commands, paths, or execution policies need enforcement beyond normal prompt instructions.
When a workflow repeats, package it as a skill so Codex can invoke a clear reusable instruction set.
Bring in external tools or systems only when a real workflow needs outside context, structured data, or remote actions.
工作流程
把那些高频出现、几乎每次会话都重要的仓库命令、预期和限制放进去。
把宽层指导放在仓库根目录,再只在局部规则不同的目录里加更具体的 AGENTS.md。
当某些命令、路径或执行策略需要超出普通提示词的约束时,用 rules 管理。
当某套流程反复出现时,把它封装成 skill,让 Codex 可以调用清晰的可复用指令集。
只有当真实工作流需要外部上下文、结构化数据或远程动作时,才引入外部工具系统。
Templates
# AGENTS.md - Run `pnpm test` before shipping UI changes. - Use `rg` for search and avoid broad grep scans. - Keep edits ASCII unless the file already uses Unicode. - Do not modify generated files directly. - For reviews, prioritize bugs, regressions, and missing tests.
$skill-creator $skill-installer /mcp codex mcp add <name> --url <server>
模板
# AGENTS.md - 发布 UI 改动前先运行 `pnpm test`。 - 搜索优先用 `rg`,不要做宽泛 grep 扫描。 - 除非文件本身已经使用 Unicode,否则保持 ASCII。 - 不要直接修改生成文件。 - 做 review 时优先关注 bug、回归和缺失测试。
$skill-creator $skill-installer /mcp codex mcp add <name> --url <server>
Practice
练习
AGENTS.md is for operational instructions, not for turning your repo into a narrative archive.
If a skill or MCP server does not remove real friction, it is probably increasing cognitive load instead.
AGENTS.md 应该保存操作指导,而不是把仓库变成叙事档案。
如果 skill 或 MCP server 不能移除真实摩擦,它很可能只是在增加认知负担。