<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>AGENTS.md on Huoke.Me - 跨境生活，从理财开始！</title><link>https://blog.huoke.me/tags/agents.md/</link><description>Recent content in AGENTS.md on Huoke.Me - 跨境生活，从理财开始！</description><generator>Hugo</generator><language>cn</language><lastBuildDate>Sat, 05 Sep 2026 17:41:00 +0800</lastBuildDate><atom:link href="https://blog.huoke.me/tags/agents.md/index.xml" rel="self" type="application/rss+xml"/><item><title>Codex新记忆如何省Token</title><link>https://blog.huoke.me/posts/codex-memory/</link><pubDate>Sat, 05 Sep 2026 17:41:00 +0800</pubDate><guid>https://blog.huoke.me/posts/codex-memory/</guid><description>&lt;blockquote>
&lt;p>🎯 Astra在Codex里增加了实验性上下文管理：跨窗口维护笔记，同时保留可搜索的早期消息与工具结果。它主要解决长任务的细节丢失，Token是否下降仍取决于检索量、笔记长度和工作流设计。&lt;/p>&lt;/blockquote>
&lt;p>&lt;img src="https://blog.huoke.me/img/posts/codex-memory/hero.webp" alt="Codex笔记与可搜索历史上下文管理" title="Codex实验性上下文管理" width="1200" height="630" loading="lazy" decoding="async">
&lt;/p>
&lt;p>传统compaction会把较早的对话压成一份摘要。任务持续数小时后，同一份历史可能被重复压缩，错误日志、失败原因和早期约束会逐渐变模糊。&lt;/p>
&lt;p>Astra的新模式把“保留什么”和“在哪里找细节”拆成两层：当前窗口携带精简笔记，旧窗口继续可检索。模型需要某个测试结果时，可以回查原消息和工具输出。&lt;/p>
&lt;hr>
&lt;h2 id="-新模式改变了什么">📌 新模式改变了什么&lt;/h2>
&lt;p>OpenAI在&lt;a href="https://openai.com/index/gpt-6-astra/" target="_blank" rel="noopener noreferrer">Astra发布说明&lt;/a>
中确认了三点：&lt;/p>
&lt;ol>
&lt;li>Astra可以跨上下文窗口维护笔记；&lt;/li>
&lt;li>更早的上下文窗口保持可搜索；&lt;/li>
&lt;li>搜索范围包含历史消息和工具结果。&lt;/li>
&lt;/ol>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>方式&lt;/th>
 &lt;th>当前窗口携带内容&lt;/th>
 &lt;th>早期细节&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>传统反复摘要&lt;/td>
 &lt;td>一份持续压缩的摘要&lt;/td>
 &lt;td>依赖摘要是否保留&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>笔记 + 可搜索历史&lt;/td>
 &lt;td>结构化笔记&lt;/td>
 &lt;td>需要时回查原记录&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>全量上下文&lt;/td>
 &lt;td>大量原始消息&lt;/td>
 &lt;td>直接存在窗口内，Token占用高&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;p>这套机制适合复杂调试、大规模重构、跨阶段研究和多轮工具任务。短小、边界清楚的修改通常在单个上下文窗口内结束，收益有限。&lt;/p>
&lt;p>该功能仍处于实验阶段，当前默认关闭。OpenAI计划在后续数周内把它设为Astra的默认方式，实际时间以Codex版本和账户开放状态为准。&lt;/p>
&lt;hr>
&lt;h2 id="-如何开启实验功能">⚙️ 如何开启实验功能&lt;/h2>
&lt;p>官方配置项是&lt;code>features.context_management.experimental_mode&lt;/code>。编辑&lt;code>~/.codex/config.toml&lt;/code>：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-toml" data-lang="toml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000;font-weight:bold">[&lt;/span>&lt;span style="color:#000">features&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">context_management&lt;/span>&lt;span style="color:#000;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">experimental_mode&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#204a87;font-weight:bold">true&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>也可以使用完整键写法理解其层级：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-text" data-lang="text">&lt;span style="display:flex;">&lt;span>features.context_management.experimental_mode = true
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>配置完成后启动一个新任务。Codex通常在新会话开始时重新构建模型、功能和项目指令环境。&lt;/p>
&lt;p>检查清单：&lt;/p>
&lt;ol>
&lt;li>Codex客户端已更新到支持Astra与该配置项的版本；&lt;/li>
&lt;li>使用ChatGPT账户登录，套餐具备对应功能权限；&lt;/li>
&lt;li>模型选择器中能看到并使用Astra；&lt;/li>
&lt;li>&lt;code>config.toml&lt;/code>的TOML层级和布尔值正确；&lt;/li>
&lt;li>工作区管理员没有通过受管配置关闭实验功能。&lt;/li>
&lt;/ol>
&lt;p>官方配置参考把该功能标为“under development / off by default”，并列出ChatGPT登录与套餐要求。Business、Enterprise等受管账户还会受到工作区策略影响。&lt;/p>
&lt;hr>
&lt;h2 id="-agentsmd最小模板">📝 AGENTS.md最小模板&lt;/h2>
&lt;p>&lt;img src="https://blog.huoke.me/img/posts/codex-memory/workflow.webp" alt="Codex长任务上下文工作流与AGENTS.md内容边界" title="Codex长任务上下文工作流" width="1200" height="760" loading="lazy" decoding="async">
&lt;/p>
&lt;p>新记忆机制负责保留任务过程，&lt;code>AGENTS.md&lt;/code>负责提供稳定规则。两者承担不同角色。&lt;/p>
&lt;p>官方文档说明，Codex会在开始工作前读取&lt;code>AGENTS.md&lt;/code>。全局文件通常位于&lt;code>~/.codex/AGENTS.md&lt;/code>，项目文件放在仓库根目录；更接近当前工作目录的文件拥有更高优先级。&lt;/p>
&lt;p>一个够用的项目模板：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-markdown" data-lang="markdown">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000080;font-weight:bold"># Project instructions
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000080;font-weight:bold">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Repository:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Application code: &lt;span style="color:#4e9a06">`src/`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Tests: &lt;span style="color:#4e9a06">`tests/`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Documentation: &lt;span style="color:#4e9a06">`docs/`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Commands:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Install: &lt;span style="color:#4e9a06">`npm ci`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Test: &lt;span style="color:#4e9a06">`npm test`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Lint: &lt;span style="color:#4e9a06">`npm run lint`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Build: &lt;span style="color:#4e9a06">`npm run build`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Engineering rules:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Keep changes scoped to the requested feature or bug.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Preserve public API compatibility unless the task requires a breaking change.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Add or update tests for behavior changes.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Never print secrets, tokens, customer data, or production credentials.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Done:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Required tests pass.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Changed files are reviewed for security and error handling.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">-&lt;/span> Report modified files, verification commands, and remaining risks.
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>模板里的命令必须换成项目真实命令。Codex官方建议让&lt;code>AGENTS.md&lt;/code>保持简短、准确，把架构长文、计划和专项规范放到独立文件中引用。&lt;/p></description></item></channel></rss>