Plan 导读
Codex Harness Context Engine Port:先抓住它真正发力的那一下
这一页不是在堆术语,它像把“Codex Harness Context Engine Port”这台小机器搬到桌上,当着你的面拆开给你看。你先不用全记住,先抓住它到底在忙什么:Draft implementation specification.
先听这页的人话版
Codex Harness Context Engine Port
这一页不是在堆术语,它像把“Codex Harness Context Engine Port”这台小机器搬到桌上,当着你的面拆开给你看。你先不用全记住,先抓住它到底在忙什么:Draft implementation specification.
如果把这页当成“给普通人看的版本”,你最应该带走的是:它到底在教你一件什么事、什么时候要这样做、以及哪里最容易踩坑。
第 1 站
Status
这一节主要在解释“Status”到底是干什么的,以及你什么时候会遇到它。
这一节主要在解释“Status”到底是干什么的,以及你什么时候会遇到它。
如果你是第一次接触 OpenClaw,这一节最值得看的不是术语本身,而是它背后的使用场景和限制。
真正动手时,先看它有没有默认值、有没有必须打开的选项、以及会不会影响安全边界。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Draft implementation specification.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Draft implementation specification.
Draft implementation specification.
第 2 站
Goal
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这种内容决定了 OpenClaw 是“能做”还是“现在还不能做”,读懂它比记术语更重要。
你可以把这一节当成权限说明书,真正配置时优先盯住 default、required、allow、deny 这几个词。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Make the bundled Codex app-大房子服务器 harness honor the same OpenClaw context-engine lifecycle contract that embedded PI tu…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Make the bundled Codex app-大房子服务器 harness honor the same OpenClaw context-engine lifecycle contract that embedded PI tu…。
Make the bundled Codex app-server harness honor the same OpenClaw context-engine lifecycle contract that embedded PI turns already honor.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:A session using 机器人朋友s.defaults.embeddedHarness.runtime: "codex" or a codex/* 聪明脑袋模型 should still let the selected cont…。
A session using agents.defaults.embeddedHarness.runtime: "codex" or a codex/* model should still let the selected context-engine plugin, such as lossless-claw, control context assembly, post-turn ingest, maintenance, and OpenClaw-level compaction policy as far as the Codex app-server boundary allows.
第 3 站
Non-goals
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:non-ACP embedded 机器人朋友 harness path only. the existing bundled-新本领插件 trust boundary remains unchanged.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:non-ACP embedded 机器人朋友 harness path only.
non-ACP embedded agent harness path only.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:the existing bundled-新本领插件 trust boundary remains unchanged.
the existing bundled-plugin trust boundary remains unchanged.
这一串条目别硬背,把它当成“Non-goals”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:Do not reimplement Codex app-大房子服务器 inter…、Do not make Codex native thread compactio…、Do not require non-Codex 聪明脑袋模型s to use t…、Do not change ACP/acpx session behavior.…。
- Do not reimplement Codex app-server internals.
- Do not make Codex native thread compaction produce a lossless-claw summary.
- Do not require non-Codex models to use the Codex harness.
- Do not change ACP/acpx session behavior. This specification is for the
- Do not make third-party plugins register Codex app-server extension factories;
第 4 站
Current architecture
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这种内容决定了 OpenClaw 是“能做”还是“现在还不能做”,读懂它比记术语更重要。
你可以把这一节当成权限说明书,真正配置时优先盯住 default、required、allow、deny 这几个词。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The embedded run loop resolves the 设置说明书ured context engine once per run before selecting a concrete low-level harness:…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The embedded run loop resolves the 设置说明书ured context engine once per run before selecting a concrete low-level harness:。
The embedded run loop resolves the configured context engine once per run before selecting a concrete low-level harness:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:runEmbeddedAttemptWithBackend(...)。
runEmbeddedAttemptWithBackend(...)
这一串条目别硬背,把它当成“Current architecture”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:src/机器人朋友s/pi-embedded-runner/run.ts、initializes context-engine 新本领插件s、calls resolveContextEngine(params.设置说明书)、passes contextEngine and contextTokenBudg…。
src/agents/pi-embedded-runner/run.ts- initializes context-engine plugins
- calls
resolveContextEngine(params.config) - passes
contextEngineandcontextTokenBudgetinto
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:runEmbeddedAttemptWithBackend(...) delegates to the selected 机器人朋友 harness:。
runEmbeddedAttemptWithBackend(...) delegates to the selected agent harness:
这一串条目别硬背,把它当成“Current architecture”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:src/机器人朋友s/pi-embedded-runner/run/backend…、src/机器人朋友s/harness/selection.ts。
src/agents/pi-embedded-runner/run/backend.tssrc/agents/harness/selection.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The Codex app-大房子服务器 harness is registered by the bundled Codex 新本领插件:。
The Codex app-server harness is registered by the bundled Codex plugin:
这一串条目别硬背,把它当成“Current architecture”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:extensions/codex/index.ts、extensions/codex/harness.ts。
extensions/codex/index.tsextensions/codex/harness.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The Codex harness implementation receives the same EmbeddedRunAttemptParams as PI-backed attempts:。
The Codex harness implementation receives the same EmbeddedRunAttemptParams as PI-backed attempts:
这一串条目别硬背,把它当成“Current architecture”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:extensions/codex/src/app-大房子服务器/run-attem…。
extensions/codex/src/app-server/run-attempt.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:That means the required hook point is in OpenClaw-controlled code. The external boundary is the Codex app-大房子服务器 protoc…。
That means the required hook point is in OpenClaw-controlled code. The external boundary is the Codex app-server protocol itself: OpenClaw can control what it sends to thread/start, thread/resume, and turn/start, and can observe notifications, but it cannot change Codex's internal thread store or native compactor.
第 5 站
Current gap
这一节主要在解释“Current gap”到底是干什么的,以及你什么时候会遇到它。
这一节主要在解释“Current gap”到底是干什么的,以及你什么时候会遇到它。
如果你是第一次接触 OpenClaw,这一节最值得看的不是术语本身,而是它背后的使用场景和限制。
真正动手时,先看它有没有默认值、有没有必须打开的选项、以及会不会影响安全边界。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Embedded PI attempts call the context-engine lifecycle directly: Relevant PI code: Codex app-大房子服务器 attempts currently…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Embedded PI attempts call the context-engine lifecycle directly:。
Embedded PI attempts call the context-engine lifecycle directly:
这一串条目别硬背,把它当成“Current gap”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:bootstrap/maintenance before the attempt、assemble before the 聪明脑袋模型 call、afterTurn or ingest after the attempt、maintenance after a successful turn。
- bootstrap/maintenance before the attempt
- assemble before the model call
- afterTurn or ingest after the attempt
- maintenance after a successful turn
- context-engine compaction for engines that own compaction
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Relevant PI code:。
Relevant PI code:
这一串条目别硬背,把它当成“Current gap”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:src/机器人朋友s/pi-embedded-runner/run/attempt…、src/机器人朋友s/pi-embedded-runner/run/attempt…、src/机器人朋友s/pi-embedded-runner/context-eng…。
src/agents/pi-embedded-runner/run/attempt.tssrc/agents/pi-embedded-runner/run/attempt.context-engine-helpers.tssrc/agents/pi-embedded-runner/context-engine-maintenance.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex app-大房子服务器 attempts currently run generic 机器人朋友-harness hooks and mirror the transcript, but do not call params.c…。
Codex app-server attempts currently run generic agent-harness hooks and mirror the transcript, but do not call params.contextEngine.bootstrap, params.contextEngine.assemble, params.contextEngine.afterTurn, params.contextEngine.ingestBatch, params.contextEngine.ingest, or params.contextEngine.maintain.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Relevant Codex code:。
Relevant Codex code:
这一串条目别硬背,把它当成“Current gap”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:extensions/codex/src/app-大房子服务器/run-attem…、extensions/codex/src/app-大房子服务器/thread-li…、extensions/codex/src/app-大房子服务器/event-pro…、extensions/codex/src/app-大房子服务器/compact.ts。
extensions/codex/src/app-server/run-attempt.tsextensions/codex/src/app-server/thread-lifecycle.tsextensions/codex/src/app-server/event-projector.tsextensions/codex/src/app-server/compact.ts
第 6 站
Desired behavior
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:For Codex harness turns, OpenClaw should preserve this lifecycle: 1. Read the mirrored OpenClaw session transcript. 2.…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:For Codex harness turns, OpenClaw should preserve this lifecycle:。
For Codex harness turns, OpenClaw should preserve this lifecycle:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. Read the mirrored OpenClaw session transcript. 2. Bootstrap the active context engine when a previous session file e…。
1. Read the mirrored OpenClaw session transcript. 2. Bootstrap the active context engine when a previous session file exists. 3. Run bootstrap maintenance when available. 4. Assemble context using the active context engine. 5. Convert the assembled context into Codex-compatible inputs. 6. Start or resume the Codex thread with developer instructions that include any context-engine systemPromptAddition. 7. Start the Codex turn with the assembled user-facing prompt. 8. Mirror the Codex result back into the OpenClaw transcript. 9. Call afterTurn if implemented, otherwise ingestBatch/ingest, using the mirrored transcript snapshot. 10. Run turn maintenance after successful non-aborted turns. 11. Preserve Codex native compaction signals and OpenClaw compaction hooks.
第 7 站
Codex app-大房子服务器 remains canonical for native thread state
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex owns its native thread and any internal extended history. OpenClaw should not try to mutate the app-大房子服务器's inte…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex owns its native thread and any internal extended history. OpenClaw should not try to mutate the app-大房子服务器's inte…。
Codex owns its native thread and any internal extended history. OpenClaw should not try to mutate the app-server's internal history except through supported protocol calls.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:OpenClaw's transcript mirror remains the source for OpenClaw features:。
OpenClaw's transcript mirror remains the source for OpenClaw features:
这一串条目别硬背,把它当成“Codex app-server remains canonical for native thread state”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:chat history、search、/new and /reset bookkeeping、future 聪明脑袋模型 or harness switching。
- chat history
- search
/newand/resetbookkeeping- future model or harness switching
- context-engine plugin state
第 8 站
Context engine assembly must be projected into Codex inputs
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The context-engine interface returns OpenClaw 机器人朋友小纸条消息[], not a Codex thread patch. Codex app-大房子服务器 turn/start accep…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The context-engine interface returns OpenClaw 机器人朋友小纸条消息[], not a Codex thread patch. Codex app-大房子服务器 turn/start accep…。
The context-engine interface returns OpenClaw AgentMessage[], not a Codex thread patch. Codex app-server turn/start accepts a current user input, while thread/start and thread/resume accept developer instructions.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Therefore the implementation needs a projection layer. The safe first version should avoid pretending it can replace Co…。
Therefore the implementation needs a projection layer. The safe first version should avoid pretending it can replace Codex internal history. It should inject assembled context as deterministic prompt/developer-instruction material around the current turn.
第 9 站
Prompt-cache stability matters
这一节主要在解释“Prompt-cache stability matters”到底是干什么的,以及你什么时候会遇到它。
这一节主要在解释“Prompt-cache stability matters”到底是干什么的,以及你什么时候会遇到它。
如果你是第一次接触 OpenClaw,这一节最值得看的不是术语本身,而是它背后的使用场景和限制。
真正动手时,先看它有没有默认值、有没有必须打开的选项、以及会不会影响安全边界。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:For engines like lossless-claw, the assembled context should be deterministic for unchanged inputs. Do not add timestam…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:For engines like lossless-claw, the assembled context should be deterministic for unchanged inputs. Do not add timestam…。
For engines like lossless-claw, the assembled context should be deterministic for unchanged inputs. Do not add timestamps, random ids, or nondeterministic ordering to generated context text.
第 10 站
Runtime selection semantics do not change
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Harness selection remains as-is: This work changes what happens after the Codex harness is selected.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Harness selection remains as-is:。
Harness selection remains as-is:
这一串条目别硬背,把它当成“Runtime selection semantics do not change”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:runtime: "pi" forces PI、runtime: "codex" selects the registered C…、runtime: "auto" lets 新本领插件 harnesses clai…、unmatched auto runs use PI。
runtime: "pi"forces PIruntime: "codex"selects the registered Codex harnessruntime: "auto"lets plugin harnesses claim supported providers- unmatched
autoruns use PI
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:This work changes what happens after the Codex harness is selected.
This work changes what happens after the Codex harness is selected.
第 11 站
1. Export or relocate reusable context-engine attempt helpers
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Today the reusable lifecycle helpers live under the PI runner: Codex should not import from an implementation path whos…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Today the reusable lifecycle helpers live under the PI runner:。
Today the reusable lifecycle helpers live under the PI runner:
这一串条目别硬背,把它当成“1. Export or relocate reusable context-engine attempt helpers”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:src/机器人朋友s/pi-embedded-runner/run/attempt…、src/机器人朋友s/pi-embedded-runner/run/attempt…、src/机器人朋友s/pi-embedded-runner/context-eng…。
src/agents/pi-embedded-runner/run/attempt.context-engine-helpers.tssrc/agents/pi-embedded-runner/run/attempt.prompt-helpers.tssrc/agents/pi-embedded-runner/context-engine-maintenance.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex should not import from an implementation path whose name implies PI if we can avoid it.
Codex should not import from an implementation path whose name implies PI if we can avoid it.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Create a harness-neutral module, for example:。
Create a harness-neutral module, for example:
这一串条目别硬背,把它当成“1. Export or relocate reusable context-engine attempt helpers”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:src/机器人朋友s/harness/context-engine-lifecyc…。
src/agents/harness/context-engine-lifecycle.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Move or re-export:。
Move or re-export:
这一串条目别硬背,把它当成“1. Export or relocate reusable context-engine attempt helpers”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:runAttemptContextEngineBootstrap、assembleAttemptContextEngine、finalizeAttemptContextEngineTurn、buildAfterTurnRuntimeContext。
runAttemptContextEngineBootstrapassembleAttemptContextEnginefinalizeAttemptContextEngineTurnbuildAfterTurnRuntimeContextbuildAfterTurnRuntimeContextFromUsage- a small wrapper around
runContextEngineMaintenance
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Keep PI imports working either by re-exporting from the old files or updating PI call sites in the same PR.
Keep PI imports working either by re-exporting from the old files or updating PI call sites in the same PR.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The neutral helper names should not mention PI.
The neutral helper names should not mention PI.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Suggested names:。
Suggested names:
这一串条目别硬背,把它当成“1. Export or relocate reusable context-engine attempt helpers”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:bootstrapHarnessContextEngine、assembleHarnessContextEngine、finalizeHarnessContextEngineTurn、buildHarnessContextEngineRuntimeContext。
bootstrapHarnessContextEngineassembleHarnessContextEnginefinalizeHarnessContextEngineTurnbuildHarnessContextEngineRuntimeContextrunHarnessContextEngineMaintenance
第 12 站
2. Add a Codex context projection helper
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add a new module: Responsibilities: prompt. input. Proposed 对话接口: Recommended first projection: Example prompt shape: T…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add a new module:。
Add a new module:
这一串条目别硬背,把它当成“2. Add a Codex context projection helper”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:extensions/codex/src/app-大房子服务器/context-e…。
extensions/codex/src/app-server/context-engine-projection.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Responsibilities:。
Responsibilities:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:prompt.
prompt.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:input.
input.
这一串条目别硬背,把它当成“2. Add a Codex context projection helper”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:Accept the assembled 机器人朋友小纸条消息[], origin…、Determine which context belongs in develo…、Preserve the current user prompt as the f…、Render prior 小纸条消息s in a stable, explicit…。
- Accept the assembled
AgentMessage[], original mirrored history, and current - Determine which context belongs in developer instructions vs current user
- Preserve the current user prompt as the final actionable request.
- Render prior messages in a stable, explicit format.
- Avoid volatile metadata.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Proposed 对话接口:。
Proposed API:
这段像放在桌上的操作卡,谁来照着做,现场就会动起来。
- 这一行“export type CodexContextProjection = {”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
- 这里在给“developerInstructionAddition?”挂牌子,告诉系统它该指向“string;”。
- 这里在给“promptText”挂牌子,告诉系统它该指向“string;”。
export type CodexContextProjection = {
developerInstructionAddition?: string;
promptText: string;
assembledMessages: AgentMessage[];
prePromptMessageCount: number;
};
export function projectContextEngineAssemblyForCodex(params: {
assembledMessages: AgentMessage[];
originalHistoryMessages: AgentMessage[];
prompt: string;
systemPromptAddition?: string;
}): CodexContextProjection;
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Recommended first projection:。
Recommended first projection:
这一串条目别硬背,把它当成“2. Add a Codex context projection helper”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:Put systemPromptAddition into developer i…、Put the assembled transcript context befo…、Label it clearly as OpenClaw assembled co…、Keep current prompt last.
- Put
systemPromptAdditioninto developer instructions. - Put the assembled transcript context before the current prompt in
promptText. - Label it clearly as OpenClaw assembled context.
- Keep current prompt last.
- Exclude duplicate current user prompt if it already appears at the tail.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Example prompt shape:。
Example prompt shape:
这是一句直接对 OpenClaw 说的话,像你把任务清清楚楚塞到它手里。
- 这里在给“OpenClaw assembled context for this turn”挂牌子,告诉系统它该指向“”。
- 这个尖括号标签“<conversation_context>”像一块结构积木,专门拿来把页面骨架卡稳。
- 这一行“[user]”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
OpenClaw assembled context for this turn:
<conversation_context>
[user]
...
[assistant]
...
</conversation_context>
Current user request:
...
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:This is less elegant than native Codex history surgery, but it is implementable inside OpenClaw and preserves context-e…。
This is less elegant than native Codex history surgery, but it is implementable inside OpenClaw and preserves context-engine semantics.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Future improvement: if Codex app-大房子服务器 exposes a protocol for replacing or supplementing thread history, swap this pro…。
Future improvement: if Codex app-server exposes a protocol for replacing or supplementing thread history, swap this projection layer to use that API.
第 13 站
3. Wire bootstrap before Codex thread startup
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:In extensions/codex/src/app-大房子服务器/run-attempt.ts: that checks fs.stat(params.sessionFile) before mirroring writes. req…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:In extensions/codex/src/app-大房子服务器/run-attempt.ts:。
In extensions/codex/src/app-server/run-attempt.ts:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:that checks fs.stat(params.sessionFile) before mirroring writes.
that checks fs.stat(params.sessionFile) before mirroring writes.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:requires it.
requires it.
这一串条目别硬背,把它当成“3. Wire bootstrap before Codex thread startup”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:Read mirrored session history as today.、Determine whether the session file existe…、Open a SessionManager or use a narrow ses…、Call the neutral bootstrap helper when pa…。
- Read mirrored session history as today.
- Determine whether the session file existed before this run. Prefer a helper
- Open a
SessionManageror use a narrow session manager adapter if the helper - Call the neutral bootstrap helper when
params.contextEngineexists.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Pseudo-flow:。
Pseudo-flow:
这段像放在桌上的操作卡,谁来照着做,现场就会动起来。
- 这一行“const hadSessionFile = await fileExists(params.sessionFile);”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
- 这一行“const sessionManager = SessionManager.open(params.sessionFile);”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
- 这一行“const historyMessages = sessionManager.buildSessionContext().messages;”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
const hadSessionFile = await fileExists(params.sessionFile);
const sessionManager = SessionManager.open(params.sessionFile);
const historyMessages = sessionManager.buildSessionContext().messages;
await bootstrapHarnessContextEngine({
hadSessionFile,
contextEngine: params.contextEngine,
sessionId: params.sessionId,
sessionKey: sandboxSessionKey,
sessionFile: params.sessionFile,
sessionManager,
runtimeContext: buildHarnessContextEngineRuntimeContext(...),
runMaintenance: runHarnessContextEngineMaintenance,
warn,
});
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Use the same sessionKey convention as the Codex 工具小帮手 bridge and transcript mirror. Today Codex computes sandboxSession…。
Use the same sessionKey convention as the Codex tool bridge and transcript mirror. Today Codex computes sandboxSessionKey from params.sessionKey or params.sessionId; use that consistently unless there is a reason to preserve raw params.sessionKey.
第 14 站
4. Wire assemble before `thread/start` / `thread/resume` and `turn/start`
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:In runCodexApp大房子服务器Attempt: 1. Build dynamic 工具小帮手s first, so the context engine sees the actual available 工具小帮手 names…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:In runCodexApp大房子服务器Attempt:。
In runCodexAppServerAttempt:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. Build dynamic 工具小帮手s first, so the context engine sees the actual available 工具小帮手 names. 2. Read mirrored session hi…。
1. Build dynamic tools first, so the context engine sees the actual available tool names. 2. Read mirrored session history. 3. Run context-engine assemble(...) when params.contextEngine exists. 4. Project the assembled result into:
这一串条目别硬背,把它当成“4. Wire assemble before `thread/start` / `thread/resume` and `turn/start`”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:developer instruction addition、prompt text for turn/start。
- developer instruction addition
- prompt text for
turn/start
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The existing hook call:。
The existing hook call:
这段像放在桌上的操作卡,谁来照着做,现场就会动起来。
- 这一行“resolveAgentHarnessBeforePromptBuildResult({”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
- 这里在给“prompt”挂牌子,告诉系统它该指向“params.prompt”。
- 这里在给“developerInstructions”挂牌子,告诉系统它该指向“buildDeveloperInstructions(params)”。
resolveAgentHarnessBeforePromptBuildResult({
prompt: params.prompt,
developerInstructions: buildDeveloperInstructions(params),
messages: historyMessages,
ctx: hookContext,
});
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:should become context-aware:。
should become context-aware:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. compute base developer instructions with buildDeveloperInstructions(params) 2. apply context-engine assembly/project…。
1. compute base developer instructions with buildDeveloperInstructions(params) 2. apply context-engine assembly/projection 3. run before_prompt_build with the projected prompt/developer instructions
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:This order lets generic prompt hooks see the same prompt Codex will receive. If we need strict PI parity, run context-e…。
This order lets generic prompt hooks see the same prompt Codex will receive. If we need strict PI parity, run context-engine assembly before hook composition, because PI applies context-engine systemPromptAddition to the final system prompt after its prompt pipeline. The important invariant is that both context engine and hooks get a deterministic, documented order.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Recommended order for first implementation:。
Recommended order for first implementation:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. buildDeveloperInstructions(params) 2. context-engine assemble() 3. append/prepend systemPromptAddition to developer…。
1. buildDeveloperInstructions(params) 2. context-engine assemble() 3. append/prepend systemPromptAddition to developer instructions 4. project assembled messages into prompt text 5. resolveAgentHarnessBeforePromptBuildResult(...) 6. pass final developer instructions to startOrResumeThread(...) 7. pass final prompt text to buildTurnStartParams(...)
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The spec should be encoded in tests so future changes do not reorder it by accident.
The spec should be encoded in tests so future changes do not reorder it by accident.
第 15 站
5. Preserve prompt-cache stable formatting
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这种内容决定了 OpenClaw 是“能做”还是“现在还不能做”,读懂它比记术语更重要。
你可以把这一节当成权限说明书,真正配置时优先盯住 default、required、allow、deny 这几个词。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The projection helper must produce byte-stable output for identical inputs: Use fixed delimiters and explicit sections.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The projection helper must produce byte-stable output for identical inputs:。
The projection helper must produce byte-stable output for identical inputs:
这一串条目别硬背,把它当成“5. Preserve prompt-cache stable formatting”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:stable 小纸条消息 order、stable role labels、no generated timestamps、no object key order leakage。
- stable message order
- stable role labels
- no generated timestamps
- no object key order leakage
- no random delimiters
- no per-run ids
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Use fixed delimiters and explicit sections.
Use fixed delimiters and explicit sections.
第 16 站
6. Wire post-turn after transcript mirroring
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex's CodexApp大房子服务器EventProjector builds a local 小纸条消息sSnapshot for the current turn. mirrorTranscriptBestEffort(...…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex's CodexApp大房子服务器EventProjector builds a local 小纸条消息sSnapshot for the current turn. mirrorTranscriptBestEffort(...…。
Codex's CodexAppServerEventProjector builds a local messagesSnapshot for the current turn. mirrorTranscriptBestEffort(...) writes that snapshot into the OpenClaw transcript mirror.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:After mirroring succeeds or fails, call the context-engine finalizer with the best available 小纸条消息 snapshot:。
After mirroring succeeds or fails, call the context-engine finalizer with the best available message snapshot:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:expects the session snapshot, not only the current turn.
expects the session snapshot, not only the current turn.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:cannot be reopened.
cannot be reopened.
这一串条目别硬背,把它当成“6. Wire post-turn after transcript mirroring”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:Prefer full mirrored session context afte…、Fall back to history小纸条消息s + result.小纸条消息…。
- Prefer full mirrored session context after the write, because
afterTurn - Fall back to
historyMessages + result.messagesSnapshotif the session file
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Pseudo-flow:。
Pseudo-flow:
这段像放在桌上的操作卡,谁来照着做,现场就会动起来。
- 这一行“const prePromptMessageCount = historyMessages.length;”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
- 这一行“await mirrorTranscriptBestEffort(...);”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
- 这一行“const finalMessages = readMirroredSessionHistoryMessages(params.sessionFile)”是在给电脑递一张小纸条,告诉它眼下该做哪一步。
const prePromptMessageCount = historyMessages.length;
await mirrorTranscriptBestEffort(...);
const finalMessages = readMirroredSessionHistoryMessages(params.sessionFile)
?? [...historyMessages, ...result.messagesSnapshot];
await finalizeHarnessContextEngineTurn({
contextEngine: params.contextEngine,
promptError: Boolean(finalPromptError),
aborted: finalAborted,
yieldAborted,
sessionIdUsed: params.sessionId,
sessionKey: sandboxSessionKey,
sessionFile: params.sessionFile,
messagesSnapshot: finalMessages,
prePromptMessageCount,
tokenBudget: params.contextTokenBudget,
runtimeContext: buildHarnessContextEngineRuntimeContextFromUsage({
attempt: params,
workspaceDir: effectiveWorkspace,
agentDir,
tokenBudget: params.contextTokenBudget,
lastCallUsage: result.attemptUsage,
promptCache: result.promptCache,
}),
runMaintenance: runHarnessContextEngineMaintenance,
sessionManager,
warn,
});
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:If mirroring fails, still call afterTurn with the fallback snapshot, but log that the context engine is ingesting from…。
If mirroring fails, still call afterTurn with the fallback snapshot, but log that the context engine is ingesting from fallback turn data.
第 17 站
7. Normalize usage and prompt-cache runtime context
这一节主要在解释“7. Normalize usage and prompt-cache runtime context”到底是干什么的,以及你什么时候会遇到它。
这一节主要在解释“7. Normalize usage and prompt-cache runtime context”到底是干什么的,以及你什么时候会遇到它。
如果你是第一次接触 OpenClaw,这一节最值得看的不是术语本身,而是它背后的使用场景和限制。
真正动手时,先看它有没有默认值、有没有必须打开的选项、以及会不会影响安全边界。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex results include normalized usage from app-大房子服务器 token notifications when available. Pass that usage into the con…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex results include normalized usage from app-大房子服务器 token notifications when available. Pass that usage into the con…。
Codex results include normalized usage from app-server token notifications when available. Pass that usage into the context-engine runtime context.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:If Codex app-大房子服务器 eventually exposes cache read/write details, map them into ContextEnginePromptCacheInfo. Until then…。
If Codex app-server eventually exposes cache read/write details, map them into ContextEnginePromptCacheInfo. Until then, omit promptCache rather than inventing zeros.
第 18 站
8. Compaction policy
这一节主要在解释“8. Compaction policy”到底是干什么的,以及你什么时候会遇到它。
这一节主要在解释“8. Compaction policy”到底是干什么的,以及你什么时候会遇到它。
如果你是第一次接触 OpenClaw,这一节最值得看的不是术语本身,而是它背后的使用场景和限制。
真正动手时,先看它有没有默认值、有没有必须打开的选项、以及会不会影响安全边界。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:There are two compaction systems: 1. OpenClaw context-engine compact() 2. Codex app-大房子服务器 native thread/compact/start…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:There are two compaction systems:。
There are two compaction systems:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. OpenClaw context-engine compact() 2. Codex app-大房子服务器 native thread/compact/start。
1. OpenClaw context-engine compact() 2. Codex app-server native thread/compact/start
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Do not silently conflate them.
Do not silently conflate them.
第 19 站
`/compact` and explicit OpenClaw compaction
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这种内容决定了 OpenClaw 是“能做”还是“现在还不能做”,读懂它比记术语更重要。
你可以把这一节当成权限说明书,真正配置时优先盯住 default、required、allow、deny 这几个词。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:When the selected context engine has info.ownsCompaction === true, explicit OpenClaw compaction should prefer the conte…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:When the selected context engine has info.ownsCompaction === true, explicit OpenClaw compaction should prefer the conte…。
When the selected context engine has info.ownsCompaction === true, explicit OpenClaw compaction should prefer the context engine's compact() result for the OpenClaw transcript mirror and plugin state.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:When the selected Codex harness has a native thread binding, we may additionally request Codex native compaction to kee…。
When the selected Codex harness has a native thread binding, we may additionally request Codex native compaction to keep the app-server thread healthy, but this must be reported as a separate backend action in details.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Recommended behavior:。
Recommended behavior:
这一串条目别硬背,把它当成“`/compact` and explicit OpenClaw compaction”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:If contextEngine.info.ownsCompaction ===…、call context-engine compact() first、then best-effort call Codex native compac…、return the context-engine result as the p…。
- If
contextEngine.info.ownsCompaction === true: - call context-engine
compact()first - then best-effort call Codex native compaction when a thread binding exists
- return the context-engine result as the primary result
- include Codex native compaction status in
details.codexNativeCompaction - If the active context engine does not own compaction:
- preserve current Codex native compaction behavior
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:This likely requires changing extensions/codex/src/app-大房子服务器/compact.ts or wrapping it from the generic compaction pat…。
This likely requires changing extensions/codex/src/app-server/compact.ts or wrapping it from the generic compaction path, depending on where maybeCompactAgentHarnessSession(...) is invoked.
第 20 站
In-turn Codex native contextCompaction events
这一节主要在解释“In-turn Codex native contextCompaction events”到底是干什么的,以及你什么时候会遇到它。
这一节主要在解释“In-turn Codex native contextCompaction events”到底是干什么的,以及你什么时候会遇到它。
如果你是第一次接触 OpenClaw,这一节最值得看的不是术语本身,而是它背后的使用场景和限制。
真正动手时,先看它有没有默认值、有没有必须打开的选项、以及会不会影响安全边界。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex may emit contextCompaction item events during a turn. Keep the current before/after compaction hook emission in e…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex may emit contextCompaction item events during a turn. Keep the current before/after compaction hook emission in e…。
Codex may emit contextCompaction item events during a turn. Keep the current before/after compaction hook emission in event-projector.ts, but do not treat that as a completed context-engine compaction.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:For engines that own compaction, emit an explicit diagnostic when Codex performs native compaction anyway:。
For engines that own compaction, emit an explicit diagnostic when Codex performs native compaction anyway:
这一串条目别硬背,把它当成“In-turn Codex native contextCompaction events”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:一边说一边送/event name: existing compaction 一边…、details: { backend: "codex-app-大房子服务器", o…。
- stream/event name: existing
compactionstream is acceptable - details:
{ backend: "codex-app-server", ownsCompaction: true }
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:This makes the split auditable.
This makes the split auditable.
第 21 站
9. Session reset and binding behavior
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The existing Codex harness reset(...) clears the Codex app-大房子服务器 binding from the OpenClaw session file. Preserve that…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:The existing Codex harness reset(...) clears the Codex app-大房子服务器 binding from the OpenClaw session file. Preserve that…。
The existing Codex harness reset(...) clears the Codex app-server binding from the OpenClaw session file. Preserve that behavior.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Also ensure context-engine state cleanup continues to happen through existing OpenClaw session lifecycle paths. Do not…。
Also ensure context-engine state cleanup continues to happen through existing OpenClaw session lifecycle paths. Do not add Codex-specific cleanup unless the context-engine lifecycle currently misses reset/delete events for all harnesses.
第 22 站
10. Error handling
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Follow PI semantics: Codex-specific additions: fallback 小纸条消息s. do not fail the whole OpenClaw compaction when the cont…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Follow PI semantics:。
Follow PI semantics:
这一串条目别硬背,把它当成“10. Error handling”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:bootstrap failures warn and continue、assemble failures warn and fall back to u…、afterTurn/ingest failures warn and mark p…、maintenance runs only after successful, n…。
- bootstrap failures warn and continue
- assemble failures warn and fall back to unassembled pipeline messages/prompt
- afterTurn/ingest failures warn and mark post-turn finalization unsuccessful
- maintenance runs only after successful, non-aborted, non-yield turns
- compaction errors should not be retried as fresh prompts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Codex-specific additions:。
Codex-specific additions:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:fallback 小纸条消息s.
fallback messages.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:do not fail the whole OpenClaw compaction when the context engine is primary.
do not fail the whole OpenClaw compaction when the context engine is primary.
这一串条目别硬背,把它当成“10. Error handling”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:If context projection fails, warn and fal…、If transcript mirror fails, still attempt…、If Codex native compaction fails after co…。
- If context projection fails, warn and fall back to the original prompt.
- If transcript mirror fails, still attempt context-engine finalization with
- If Codex native compaction fails after context-engine compaction succeeds,
第 23 站
Unit tests
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add tests under extensions/codex/src/app-大房子服务器: 1. run-attempt.context-engine.test.ts citations mode, 聪明脑袋模型 id, and p…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add tests under extensions/codex/src/app-大房子服务器:。
Add tests under extensions/codex/src/app-server:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. run-attempt.context-engine.test.ts。
1. run-attempt.context-engine.test.ts
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:citations mode, 聪明脑袋模型 id, and prompt.
citations mode, model id, and prompt.
这一串条目别硬背,把它当成“Unit tests”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:Codex calls bootstrap when a session file…、Codex calls assemble with mirrored 小纸条消息s…、systemPromptAddition is included in devel…、Assembled 小纸条消息s are projected into the p…。
- Codex calls
bootstrapwhen a session file exists. - Codex calls
assemblewith mirrored messages, token budget, tool names, systemPromptAdditionis included in developer instructions.- Assembled messages are projected into the prompt before current request.
- Codex calls
afterTurnafter transcript mirroring. - Without
afterTurn, Codex callsingestBatchor per-messageingest. - Turn maintenance runs after successful turns.
- Turn maintenance does not run on prompt error, abort, or yield abort.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:2. context-engine-projection.test.ts。
2. context-engine-projection.test.ts
这一串条目别硬背,把它当成“Unit tests”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:stable output for identical inputs、no duplicate current prompt when assemble…、handles empty history、preserves role order。
- stable output for identical inputs
- no duplicate current prompt when assembled history includes it
- handles empty history
- preserves role order
- includes system prompt addition only in developer instructions
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:3. compact.context-engine.test.ts。
3. compact.context-engine.test.ts
这一串条目别硬背,把它当成“Unit tests”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:owning context engine primary result wins、Codex native compaction status appears in…、Codex native failure does not fail owning…、non-owning context engine preserves curre…。
- owning context engine primary result wins
- Codex native compaction status appears in details when also attempted
- Codex native failure does not fail owning context-engine compaction
- non-owning context engine preserves current native compaction behavior
第 24 站
Existing tests to update
这一节主要在解释“Existing tests to update”到底是干什么的,以及你什么时候会遇到它。
这一节主要在解释“Existing tests to update”到底是干什么的,以及你什么时候会遇到它。
如果你是第一次接触 OpenClaw,这一节最值得看的不是术语本身,而是它背后的使用场景和限制。
真正动手时,先看它有没有默认值、有没有必须打开的选项、以及会不会影响安全边界。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:nearest Codex app-大房子服务器 run tests. event details change. behavior changes; it should remain stable.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:nearest Codex app-大房子服务器 run tests.
nearest Codex app-server run tests.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:event details change.
event details change.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:behavior changes; it should remain stable.
behavior changes; it should remain stable.
这一串条目别硬背,把它当成“Existing tests to update”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:extensions/codex/src/app-大房子服务器/run-attem…、extensions/codex/src/app-大房子服务器/event-pro…、src/机器人朋友s/harness/selection.test.ts shou…、PI context-engine tests should continue t…。
extensions/codex/src/app-server/run-attempt.test.tsif present, otherwiseextensions/codex/src/app-server/event-projector.test.tsonly if compactionsrc/agents/harness/selection.test.tsshould not need changes unless config- PI context-engine tests should continue to pass unchanged.
第 25 站
Integration / live tests
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这种内容决定了 OpenClaw 是“能做”还是“现在还不能做”,读懂它比记术语更重要。
你可以把这一节当成权限说明书,真正配置时优先盯住 default、required、allow、deny 这几个词。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add or extend live Codex harness smoke tests: Avoid requiring lossless-claw in OpenClaw core tests. Use a small in-repo…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add or extend live Codex harness smoke tests:。
Add or extend live Codex harness smoke tests:
这一串条目别硬背,把它当成“Integration / live tests”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:设置说明书ure 新本领插件s.slots.contextEngine to a…、设置说明书ure 机器人朋友s.defaults.聪明脑袋模型 to a code…、设置说明书ure 机器人朋友s.defaults.embeddedHarness.…、assert test engine observed:。
- configure
plugins.slots.contextEngineto a test engine - configure
agents.defaults.modelto acodex/*model - configure
agents.defaults.embeddedHarness.runtime = "codex" - assert test engine observed:
- bootstrap
- assemble
- afterTurn or ingest
- maintenance
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Avoid requiring lossless-claw in OpenClaw core tests. Use a small in-repo fake context engine 新本领插件.
Avoid requiring lossless-claw in OpenClaw core tests. Use a small in-repo fake context engine plugin.
第 26 站
Observability
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add debug logs around Codex context-engine lifecycle calls: Avoid logging full prompts or transcript contents. Add stru…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add debug logs around Codex context-engine lifecycle calls:。
Add debug logs around Codex context-engine lifecycle calls:
这一串条目别硬背,把它当成“Observability”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:codex context engine bootstrap started/co…、codex context engine assemble applied、codex context engine finalize completed/f…、codex context engine maintenance skipped…。
codex context engine bootstrap started/completed/failedcodex context engine assemble appliedcodex context engine finalize completed/failedcodex context engine maintenance skippedwith reasoncodex native compaction completed alongside context-engine compaction
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Avoid logging full prompts or transcript contents.
Avoid logging full prompts or transcript contents.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Add structured fields where useful:。
Add structured fields where useful:
这一串条目别硬背,把它当成“Observability”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:sessionId、sessionKey redacted or omitted according…、engineId、threadId。
sessionIdsessionKeyredacted or omitted according to existing logging practiceengineIdthreadIdturnIdassembledMessageCountestimatedTokenshasSystemPromptAddition
第 27 站
Migration / compatibility
这一节更像安装或配置步骤,重点不是概念,而是“按什么顺序做才不会卡住”。
这一节更像安装或配置步骤,重点不是概念,而是“按什么顺序做才不会卡住”。
很多文档看起来长,其实是在防你漏掉前置条件。
真正照做时,先找前置条件,再找必填项,最后看验证方法。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:This should be backward-compatible: equivalent to today's Codex harness behavior. prompt path. every context change cou…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:This should be backward-compatible:。
This should be backward-compatible:
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:equivalent to today's Codex harness behavior.
equivalent to today's Codex harness behavior.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:prompt path.
prompt path.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:every context change could force a new Codex thread. Only the 工具小帮手 catalog should affect the dynamic 工具小帮手 fingerprint.
every context change could force a new Codex thread. Only the tool catalog should affect the dynamic tool fingerprint.
这一串条目别硬背,把它当成“Migration / compatibility”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:If no context engine is 设置说明书ured, legacy…、If context-engine assemble fails, Codex s…、Existing Codex thread bindings should rem…、Dynamic 工具小帮手 fingerprinting should not i…。
- If no context engine is configured, legacy context engine behavior should be
- If context-engine
assemblefails, Codex should continue with the original - Existing Codex thread bindings should remain valid.
- Dynamic tool fingerprinting should not include context-engine output; otherwise
第 28 站
Open questions
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这一节在讲规则和边界:什么默认允许、什么必须显式打开、什么被禁止。
这种内容决定了 OpenClaw 是“能做”还是“现在还不能做”,读懂它比记术语更重要。
你可以把这一节当成权限说明书,真正配置时优先盯住 default、required、allow、deny 这几个词。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. Should assembled context be injected entirely into the user prompt, entirely into developer instructions, or split?…。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:1. Should assembled context be injected entirely into the user prompt, entirely into developer instructions, or split?
1. Should assembled context be injected entirely into the user prompt, entirely into developer instructions, or split?
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Recommendation: split. Put systemPromptAddition in developer instructions; put assembled transcript context in the user…。
Recommendation: split. Put systemPromptAddition in developer instructions; put assembled transcript context in the user prompt wrapper. This best matches the current Codex protocol without mutating native thread history.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:2. Should Codex native compaction be disabled when a context engine owns compaction?
2. Should Codex native compaction be disabled when a context engine owns compaction?
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Recommendation: no, not initially. Codex native compaction may still be necessary to keep the app-大房子服务器 thread alive.…。
Recommendation: no, not initially. Codex native compaction may still be necessary to keep the app-server thread alive. But it must be reported as native Codex compaction, not as context-engine compaction.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:3. Should before_prompt_build run before or after context-engine assembly?
3. Should before_prompt_build run before or after context-engine assembly?
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Recommendation: after context-engine projection for Codex, so generic harness hooks see the actual prompt/developer ins…。
Recommendation: after context-engine projection for Codex, so generic harness hooks see the actual prompt/developer instructions Codex will receive. If PI parity requires the opposite, encode the chosen order in tests and document it here.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:4. Can Codex app-大房子服务器 accept a future structured context/history override?
4. Can Codex app-server accept a future structured context/history override?
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:Unknown. If it can, replace the text projection layer with that protocol and keep the lifecycle calls unchanged.
Unknown. If it can, replace the text projection layer with that protocol and keep the lifecycle calls unchanged.
第 29 站
Acceptance criteria
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
这一节在讲一类能力是怎么工作的:它能做什么、不能做什么、适合在什么场景下调用。
你理解的是能力边界,不只是功能名字。
如果这节里同时出现命令、配置和例子,优先先看例子,再回头看配置。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:assemble lifecycle. is selected or when assembly fails. ---。
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:assemble lifecycle.
assemble lifecycle.
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:is selected or when assembly fails.
is selected or when assembly fails.
这一串条目别硬背,把它当成“Acceptance criteria”门口贴出来的几张便签就行。它们在提醒你先备好什么、别漏掉什么、哪里最容易走错:A codex/* embedded harness turn invokes t…、A context-engine systemPromptAddition aff…、Assembled context affects the Codex turn…、Successful Codex turns call afterTurn or…。
- A
codex/*embedded harness turn invokes the selected context engine's - A context-engine
systemPromptAdditionaffects Codex developer instructions. - Assembled context affects the Codex turn input deterministically.
- Successful Codex turns call
afterTurnor ingest fallback. - Successful Codex turns run context-engine turn maintenance.
- Failed/aborted/yield-aborted turns do not run turn maintenance.
- Context-engine-owned compaction remains primary for OpenClaw/plugin state.
- Codex native compaction remains auditable as native Codex behavior.
- Existing PI context-engine behavior is unchanged.
- Existing Codex harness behavior is unchanged when no non-legacy context engine
如果把这一段摆成一个小场景,你会看到几样东西正在互相打招呼、拦路或者传东西。别急着记名词,先抓住它此刻到底在发生什么:---。
---
AdSense 连接验证已经放在页面头部;广告单元等站点审批通过后再启用。
google-adsense-account: ca-pub-3833673520933536