@unblocklabs/unblock-codex-prompt 0.2.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +391 -74
- package/RELEASING.md +6 -5
- package/dist/adapter.d.ts +23 -25
- package/dist/adapter.js +187 -150
- package/dist/catalog.d.ts +14 -1
- package/dist/catalog.js +17 -3
- package/dist/claude-adapter.d.ts +63 -0
- package/dist/claude-adapter.js +255 -0
- package/dist/compatibility.d.ts +1 -1
- package/dist/compatibility.js +4 -3
- package/dist/compiler.d.ts +103 -13
- package/dist/compiler.js +42 -37
- package/dist/config.d.ts +2 -4
- package/dist/config.js +7 -22
- package/dist/context.d.ts +10 -0
- package/dist/context.js +96 -0
- package/dist/index.js +251 -79
- package/dist/managed-target.d.ts +16 -0
- package/dist/managed-target.js +26 -0
- package/dist/manager.d.ts +72 -18
- package/dist/manager.js +131 -40
- package/dist/patched-files.d.ts +117 -0
- package/dist/patched-files.js +160 -0
- package/dist/refresh-error.d.ts +1 -0
- package/dist/refresh-error.js +40 -0
- package/dist/remote.d.ts +27 -3
- package/dist/remote.js +23 -6
- package/dist/runtime.d.ts +40 -1
- package/dist/runtime.js +118 -14
- package/dist/runtimes.d.ts +34 -0
- package/dist/runtimes.js +79 -0
- package/openclaw.plugin.json +10 -9
- package/package.json +9 -9
- package/prompts/developer.md +0 -22
- package/prompts/system.md +0 -173
package/README.md
CHANGED
|
@@ -1,36 +1,67 @@
|
|
|
1
1
|
# Unblock Codex Prompt
|
|
2
2
|
|
|
3
3
|
A small, explicit prompt-management bridge for dedicated OpenClaw Mac agents.
|
|
4
|
-
**Version 0.
|
|
5
|
-
stable releases with a
|
|
4
|
+
**Version 0.4.0.** The bridge supports OpenClaw/Codex 2026.10.5 and newer
|
|
5
|
+
stable releases with a reviewed context-assembly layout, and agents running
|
|
6
|
+
through the Claude CLI backend on reviewed OpenClaw core layouts (2026.10.6–2026.10.9).
|
|
7
|
+
See [Claude CLI agents](#claude-cli-agents).
|
|
6
8
|
|
|
7
9
|
## What you control
|
|
8
10
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
- Required `promptUrl`: the shared policy compiled from Fleet Prompt's dev/prod
|
|
12
|
+
sections and served by Cloudflare. It is the only shared-policy source; the plugin
|
|
13
|
+
selects the artifact per runtime (Codex: as configured; Claude: `runtime=claude`).
|
|
14
|
+
- Each agent's memory reference (not memory bodies).
|
|
15
|
+
|
|
16
|
+
**Identity and workspace files are live.** `SOUL.md`, `IDENTITY.md`, `USER.md`
|
|
17
|
+
(shared and the session's selected personal file) and `AGENTS.md` are never
|
|
18
|
+
snapshotted. OpenClaw loads them every turn, so an edit by you or by the agent
|
|
19
|
+
applies to the next turn without a sync. The `MEMORY.md` body stays out of the
|
|
20
|
+
prompt; a memory reference points to it.
|
|
21
|
+
|
|
22
|
+
**The OpenClaw skills catalog is live on both runtimes.** Each runtime receives the
|
|
23
|
+
session's catalog from OpenClaw's own session skills snapshot, exactly as OpenClaw
|
|
24
|
+
renders it; the plugin never compiles or freezes a copy. Codex gets it in the thread
|
|
25
|
+
developer instructions (see below); Claude gets it through OpenClaw's native
|
|
26
|
+
`openclaw-skills` mount, or the live session skills prompt when no mount exists.
|
|
27
|
+
|
|
28
|
+
**The fleet policy is live too.** On Codex the generated file (fleet policy and memory
|
|
29
|
+
reference) replaces Codex's native base through `model_instructions_file`.
|
|
30
|
+
The patched adapter also sends that same file as each thread's `baseInstructions` when
|
|
31
|
+
OpenClaw starts or resumes it. Codex reads base instructions per session, not from
|
|
32
|
+
history, and OpenClaw fingerprints these requests, so a refreshed revision resumes an
|
|
33
|
+
existing thread on its next turn with the new base: no duplicate copy, nothing in
|
|
34
|
+
history, and compaction cannot revert it. If the adapter is ever missing, Codex still
|
|
35
|
+
reads the policy from the file. The adapter replaces OpenClaw's generic developer
|
|
36
|
+
policy with the live OpenClaw skills catalog and the live persona, in the thread
|
|
37
|
+
developer instructions native children inherit, and suppresses the separate memory
|
|
38
|
+
contribution. Cron guidance remains in its existing parent-local carrier. The optional
|
|
39
|
+
managed model catalog removes native Default-mode prose.
|
|
40
|
+
|
|
41
|
+
There are no bundled system/developer templates or base-only mode. Downloaded
|
|
42
|
+
policy and the memory reference are written only to
|
|
43
|
+
`<agentDir>/codex-home/unblock-codex-prompt.md`, outside the plugin directory.
|
|
44
|
+
Codex reads that generated file; the plugin package does not retain its own copy
|
|
45
|
+
of the downloaded policy.
|
|
20
46
|
|
|
21
47
|
**Still live and untouched:** native AGENTS.md, native skills, tool schemas and
|
|
22
|
-
executor protocol, sandbox/approvals, native collaboration,
|
|
23
|
-
|
|
48
|
+
executor protocol, sandbox/approvals, native collaboration mechanics, routing
|
|
49
|
+
identifiers, date/timezone and user messages. Reviewed duplicate OpenClaw prose is
|
|
50
|
+
normalized; unknown `extraSystemPrompt` additions, including incognito context, survive. This is not total
|
|
24
51
|
prompt ownership; other plugins/hooks can still add instructions.
|
|
25
52
|
|
|
26
53
|
Customer documents stay on each agent's machine, outside this package. Snapshot
|
|
27
|
-
files use private permissions.
|
|
54
|
+
files use private permissions.
|
|
28
55
|
|
|
29
56
|
## Compatibility
|
|
30
57
|
|
|
31
|
-
-
|
|
32
|
-
2026.
|
|
33
|
-
|
|
58
|
+
- Codex: **OpenClaw and @openclaw/codex >=2026.10.5**. Every published release from
|
|
59
|
+
2026.10.5 through 2026.10.9 has the identical reviewed context-assembly functions.
|
|
60
|
+
Older layouts (2026.9.x and 2026.10.1–2026.10.4) are refused: 2026.9.x carries
|
|
61
|
+
persona in turn-scoped text native children never see. Nodes on those versions
|
|
62
|
+
stay on plugin 0.3.x until upgraded; restore still works for them. Once the Codex
|
|
63
|
+
update has replaced the 0.3.x-patched bundles (new names), a 0.4 sync starts fresh
|
|
64
|
+
without a restore. Bundle names
|
|
34
65
|
may change; fingerprints of the context-assembly functions must still match.
|
|
35
66
|
Changed assembly is refused pending review, rather than patched blindly.
|
|
36
67
|
- Local stdio Codex with an OpenClaw agent-scoped home. Operator-selected
|
|
@@ -38,22 +69,229 @@ files use private permissions. Missing identity documents are recorded as absent
|
|
|
38
69
|
The launcher must honor OpenClaw's `CODEX_HOME` and must not override the
|
|
39
70
|
managed `model_instructions_file`; status cannot attest to launcher behavior.
|
|
40
71
|
- One target agent per installation. Other agents use upstream behavior. Native
|
|
41
|
-
children
|
|
42
|
-
|
|
43
|
-
This bridge uses
|
|
44
|
-
fix the dropped-context path
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
Codex children inherit the fleet policy and live persona.
|
|
73
|
+
|
|
74
|
+
This bridge uses one private upstream seam, the guarded Codex context carriers,
|
|
75
|
+
because public prompt hooks cannot fix the dropped-context path. It no longer depends
|
|
76
|
+
on OpenClaw's private skills-catalog builder. The adapter suppresses memory at its
|
|
77
|
+
producer and moves two host-rendered contributions out of the parent-only and
|
|
78
|
+
refreshable carriers into the thread developer instructions, after the fleet policy:
|
|
79
|
+
the session's OpenClaw skills catalog (with OpenClaw's `skills_search`/`skills_read`
|
|
80
|
+
hints, exactly as upstream renders it, and nothing when upstream renders nothing), then
|
|
81
|
+
the persona (SOUL, IDENTITY, shared USER and the selected personal USER). Those are
|
|
82
|
+
rebuilt every turn: a catalog change or persona edit changes them, and Codex re-syncs
|
|
83
|
+
the existing thread on its next turn with a policy handoff. They survive compaction
|
|
84
|
+
and are inherited by native children. Native AGENTS and operational context remain
|
|
85
|
+
live; cron guidance and execution permissions are unchanged. The adapter additionally
|
|
86
|
+
removes active-computer context, known Slack participation/style/activation policy,
|
|
87
|
+
duplicate progress-card prose and basic Markdown tutorials. It compacts source
|
|
88
|
+
delivery to current facts and scopes meaningful exec overrides to OpenClaw Gateway
|
|
89
|
+
exec; inherited steady-state defaults are omitted. Unrecognized additions are
|
|
90
|
+
preserved, not removed by heading. Changed operational functions require review
|
|
91
|
+
before sync.
|
|
92
|
+
The installer backs up and tracks every
|
|
51
93
|
patched bundle; old single-file receipts remain restorable. Runtime module paths
|
|
52
94
|
come from the loader's selected entry, never its temporary execution capture.
|
|
53
95
|
It validates private seams and is not a promise of compatibility with unseen layouts.
|
|
54
|
-
The catalog
|
|
55
|
-
|
|
56
|
-
|
|
96
|
+
The skills catalog is OpenClaw's own per-session snapshot, with its eligibility,
|
|
97
|
+
allowlist, visibility and size-limit logic; the plugin neither adds nor removes skills.
|
|
98
|
+
|
|
99
|
+
## Claude CLI agents
|
|
100
|
+
|
|
101
|
+
For agents whose models run through OpenClaw's `claude-cli` backend, the plugin
|
|
102
|
+
replaces **only OpenClaw's generic operating policy** with the fleet policy for Claude.
|
|
103
|
+
Identity and workspace files stay live through OpenClaw's own project context. Claude Code's native system prompt and prefix,
|
|
104
|
+
`CLAUDE.md`, independently installed Claude skills/plugins, tool schemas,
|
|
105
|
+
permissions and authentication are untouched. Other agents, other CLI backends and
|
|
106
|
+
control/side-question operations keep upstream behavior.
|
|
107
|
+
|
|
108
|
+
**Each runtime gets its own fleet policy.** The plugin fetches the configured
|
|
109
|
+
`promptUrl` once per enrolled runtime. Codex fetches it exactly as configured, with no
|
|
110
|
+
`runtime` parameter (the Worker returns the Codex artifact). Claude fetches it with
|
|
111
|
+
`runtime=claude` added (via the URL API, so `channel` and other parameters are kept) and
|
|
112
|
+
requires the Worker to confirm it in `X-Prompt-Runtime`. The policy wording lives in
|
|
113
|
+
the Fleet Prompt sections, not in this package.
|
|
114
|
+
|
|
115
|
+
**Deploy order.** Deploy the fleet-prompt Worker with runtime support **before**
|
|
116
|
+
enrolling any Claude agent. A Worker without it answers `runtime=claude` with HTTP 400:
|
|
117
|
+
sync then writes nothing and tells you to deploy the Worker, and a daily refresh keeps
|
|
118
|
+
the installed policy and retries hourly. Codex-only nodes never send `runtime` and do
|
|
119
|
+
not depend on the Worker deploy.
|
|
120
|
+
|
|
121
|
+
### How it works
|
|
122
|
+
|
|
123
|
+
OpenClaw renders the Claude CLI appended system prompt in core, not in a separate
|
|
124
|
+
package. Two reviewed functions are patched with exact-byte backups, fingerprinted by
|
|
125
|
+
function body (identical in 2026.10.6 and 2026.10.9) and located by following the
|
|
126
|
+
assembly's own imports:
|
|
127
|
+
|
|
128
|
+
- `buildCliAgentSystemPrompt` scopes management to the target agent and the
|
|
129
|
+
host-generated `claude-cli/<model>` model display, then passes the hash-verified
|
|
130
|
+
snapshot down. Tampered or invalid enrolled state aborts the run.
|
|
131
|
+
- `buildAgentSystemPrompt` reuses OpenClaw's own builders for the retained mechanics
|
|
132
|
+
and context, and omits the generic policy sections. Downstream Claude MCP
|
|
133
|
+
tool-naming guidance, registered text transforms and the model identity line
|
|
134
|
+
still apply.
|
|
135
|
+
|
|
136
|
+
| Context or mechanic | Claude CLI treatment |
|
|
137
|
+
|---|---|
|
|
138
|
+
| Fleet operating policy | The Claude policy (`runtime=claude`), once; never the Codex policy |
|
|
139
|
+
| SOUL / IDENTITY / shared USER / selected personal USER | Live host project context, with host persona and precedence wording |
|
|
140
|
+
| MEMORY body, generic memory recall section | Omitted; managed memory reference retained |
|
|
141
|
+
| AGENTS / TOOLS / HEARTBEAT / BOOTSTRAP and other eligible files | Live host-selected context, routing and truncation; bootstrap notices |
|
|
142
|
+
| Unknown `extraSystemPrompt`, including incognito restrictions | Kept, with the reviewed duplicate-prose normalization |
|
|
143
|
+
| Output directives, messaging/delivery mechanics, channel message-tool hints | Kept (OpenClaw's builders) |
|
|
144
|
+
| Authorized senders, exec-approval protocol, sandbox/elevated facts, TTS, reactions, Control UI embeds, collapsible details | Kept |
|
|
145
|
+
| Directory roles, temporal facts, Runtime section, git co-author guidance | Kept |
|
|
146
|
+
| Runtime-context block protocol | Short plugin-owned mechanics note |
|
|
147
|
+
| Identity line, tooling list, tool-call style, execution bias, Care, OpenClaw Control, delegation/orchestration, docs, model aliases, UI presentation, side chat, silent-reply section | Replaced by the fleet policy |
|
|
148
|
+
| OpenClaw's generated `openclaw-skills` Claude plugin | Kept |
|
|
149
|
+
| Live session skills catalog (only when OpenClaw mounts no native plugin) | Kept |
|
|
150
|
+
|
|
151
|
+
**Skills are live on both runtimes.** Both take the catalog from OpenClaw's session
|
|
152
|
+
skills snapshot, so skill selection follows OpenClaw's session/refresh lifecycle on
|
|
153
|
+
each: Codex in its thread developer instructions, Claude through OpenClaw's native
|
|
154
|
+
skills mount or the live session skills prompt.
|
|
155
|
+
|
|
156
|
+
**Identity files are live on both runtimes, and so is the session's selected
|
|
157
|
+
personal USER.md.** Unlike upstream OpenClaw, which keeps persona and personal files
|
|
158
|
+
away from subagents, native Codex children inherit them with the thread developer
|
|
159
|
+
instructions. Claude Code's native subagents do not receive the appended system
|
|
160
|
+
prompt at all (verified on Claude Code 2.1.316), so they see neither the fleet policy
|
|
161
|
+
nor persona. On Codex, editing a persona file or changing the skills catalog during a
|
|
162
|
+
live incognito conversation changes its thread instructions, which Codex refuses for
|
|
163
|
+
incognito threads: that thread's next turn fails. Start a new incognito conversation
|
|
164
|
+
after such a change.
|
|
165
|
+
|
|
166
|
+
### Enroll
|
|
167
|
+
|
|
168
|
+
Sync derives runtimes from the agent's configured models using OpenClaw's public
|
|
169
|
+
`api.runtime.modelConfig.resolveModelRuntimePolicy`. Models resolve as OpenClaw resolves
|
|
170
|
+
them: the agent's own model replaces the default primary and, unless it lists its own,
|
|
171
|
+
the default fallbacks. The agent's own allowed-model map also counts, because the agent
|
|
172
|
+
can switch to those models at run time; the Gateway-wide `agents.defaults.models` map
|
|
173
|
+
does not.
|
|
174
|
+
Legacy `claude-cli/<model>` refs count as Claude CLI. This reads authored policy,
|
|
175
|
+
not availability; each turn's actual execution path stays authoritative. Sync adds
|
|
176
|
+
components and never removes one; use restore. Configuration changes never
|
|
177
|
+
enroll a runtime by themselves.
|
|
178
|
+
|
|
179
|
+
To drop a runtime, restore, change the agent's model configuration, then sync.
|
|
180
|
+
The receipts and backups restore keeps are rollback evidence, so a restored
|
|
181
|
+
runtime is not re-enrolled from them. If restore was interrupted and this plugin's
|
|
182
|
+
patched bytes are still installed for a runtime that is no longer configured, sync
|
|
183
|
+
refuses until `openclaw codex-prompt restore` completes.
|
|
184
|
+
|
|
185
|
+
Both adapters share one rule for a receipt. It is cleared once every recorded file is
|
|
186
|
+
back at its original bytes (a completed restore), or once nothing of the plugin's is
|
|
187
|
+
left: every changed file is gone (an update renamed it, or the install directory was
|
|
188
|
+
deleted) or the recorded install version was replaced. A sync after that starts fresh,
|
|
189
|
+
may target a different OpenClaw installation or Codex package, and replaces the old
|
|
190
|
+
receipt's backups. Otherwise sync keeps refusing foreign edits and foreign backups.
|
|
191
|
+
|
|
192
|
+
Codex `appServer` settings (agent-scoped local stdio only) are checked by sync when
|
|
193
|
+
it selects Codex and reported by status as `codexConfigError` for a Codex
|
|
194
|
+
enrollment. They never block Claude-only enrollment, status or restore.
|
|
195
|
+
|
|
196
|
+
Claude CLI enrollment requires the conversation-access grant for the
|
|
197
|
+
final-adoption gate:
|
|
198
|
+
|
|
199
|
+
```json5
|
|
200
|
+
{
|
|
201
|
+
plugins: { entries: { "unblock-codex-prompt": {
|
|
202
|
+
enabled: true,
|
|
203
|
+
hooks: { allowConversationAccess: true },
|
|
204
|
+
config: { agentId: "main", frozenContext: true, promptUrl: "https://fleet-prompt.unblocklabs.ai/prompt?channel=dev" },
|
|
205
|
+
} } },
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```sh
|
|
210
|
+
openclaw codex-prompt sync # add --codex-plugin-dir for a first Codex enrollment
|
|
211
|
+
openclaw codex-prompt status
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
A Claude-only agent needs no Codex package, TOML pointer, provider catalog
|
|
215
|
+
credentials or Codex skill-config writes. Snapshot files still live under
|
|
216
|
+
`<agentDir>/codex-home/`. Its sync never fetches the Codex artifact. Its generated
|
|
217
|
+
prompt file holds only the shared agent context
|
|
218
|
+
(the `## Memory reference` section), so the file's hash still anchors the
|
|
219
|
+
sync receipt; there is no Codex policy prefix to refresh. Adding Codex later (sync) regenerates
|
|
220
|
+
the file in the Codex layout.
|
|
221
|
+
|
|
222
|
+
**Where each policy is stored.** The Codex policy stays the prefix of the generated file
|
|
223
|
+
(`model_instructions_file`, also sent as `baseInstructions`). The Claude policy and the
|
|
224
|
+
shared agent context are stored in the sync receipt (`.unblock-codex-prompt-bundle.json`)
|
|
225
|
+
as `claudePolicy` (`text`, `url`, `revision`, `checkedAt`) and `agentContext`. The managed
|
|
226
|
+
Claude prompt is `claudePolicy.text`, a blank line, then `agentContext`, read from the
|
|
227
|
+
receipt only; the generated file is still verified against the receipt's `promptSha256`.
|
|
228
|
+
The receipt is the trust root for Claude: anyone who can write it can set the policy, as
|
|
229
|
+
with the file. The final-adoption gate compares the rendered prompt with what the
|
|
230
|
+
receipt currently yields, so an edit to `claudePolicy` after assembly blocks the run and
|
|
231
|
+
an invalid or missing `claudePolicy` fails closed with a "run codex-prompt sync" error.
|
|
232
|
+
|
|
233
|
+
**Activation:** drain the target agent's work and restart the Gateway to load the
|
|
234
|
+
patched core (and to register the gate after adding the grant). From sync until that
|
|
235
|
+
restart, the running Gateway still holds unpatched core, so the gate blocks the
|
|
236
|
+
target agent's enrolled Claude runs. The next Claude CLI
|
|
237
|
+
process receives the managed prompt. Later policy refreshes change the prompt hash
|
|
238
|
+
that OpenClaw keys live Claude processes on, so the conversation's next turn starts a
|
|
239
|
+
new process with the new revision and resumes the conversation; its earlier history
|
|
240
|
+
is not cleaned. Validate each policy revision in a fresh native conversation.
|
|
241
|
+
|
|
242
|
+
### Final-adoption gate
|
|
243
|
+
|
|
244
|
+
A `before_agent_run` gate, registered only with the grant above, checks enrolled
|
|
245
|
+
Claude runs for the target agent. If the grant is removed after enrollment, the gate is
|
|
246
|
+
not registered and those runs are not checked; startup logs this as an error. The CLI runner's gate context has no runtime
|
|
247
|
+
identity, so an observe-only `before_prompt_build` hook marks runs whose preparation
|
|
248
|
+
context reports `claude-cli`; it never changes the prompt. Keep `allowPromptInjection`
|
|
249
|
+
unset or true. Model fallback reuses the run ID, so each preparation replaces the
|
|
250
|
+
mark and a gate context naming a non-Claude provider is never checked as Claude: a
|
|
251
|
+
Claude attempt that fails before execution cannot block its fallback. It blocks the run when the final system prompt
|
|
252
|
+
lacks the verified managed policy, still contains OpenClaw's generic policy, or the
|
|
253
|
+
managed state is invalid. This covers a lost assembly patch, a later prompt-hook
|
|
254
|
+
replacement and an incompatible registered text transform. Never-enrolled or
|
|
255
|
+
restored agents pass and are reported once with a sync suggestion. Prompt and
|
|
256
|
+
history text are compared, never logged. It is a prompt-management guarantee
|
|
257
|
+
while the plugin is enabled, not a security boundary.
|
|
258
|
+
|
|
259
|
+
Known limitation: a run is marked as Claude only when OpenClaw's prompt-build hooks
|
|
260
|
+
run. If OpenClaw cannot prepare those hooks (for example, history holding a value its
|
|
261
|
+
hook isolation cannot copy), the run is not marked and the gate does not check it. The
|
|
262
|
+
assembly patch still manages the prompt; only this extra check is skipped. The gate
|
|
263
|
+
does not block unmarked runs, because at that point nothing reliably tells a Claude
|
|
264
|
+
run from another CLI backend.
|
|
265
|
+
|
|
266
|
+
### OpenClaw updates and core integrity
|
|
267
|
+
|
|
268
|
+
OpenClaw core ships `dist/postinstall-content-inventory.json`, which its update,
|
|
269
|
+
triage and settlement paths compare against installed files. A patched core does
|
|
270
|
+
not match it. Status reports `coreIntegrity` and distinguishes `patched`,
|
|
271
|
+
`partial` (an interrupted restore), `original`, `missing` and `changed` core files. The plugin never edits vendor
|
|
272
|
+
inventories.
|
|
273
|
+
|
|
274
|
+
1. `openclaw codex-prompt restore`, then confirm status reports `original`.
|
|
275
|
+
2. Update OpenClaw.
|
|
276
|
+
3. Review the new layout. Sync refuses an unreviewed assembly function.
|
|
277
|
+
4. `openclaw codex-prompt sync`, then restart the Gateway.
|
|
278
|
+
|
|
279
|
+
If an update already replaced the patched chunks, restore leaves the updater's
|
|
280
|
+
files alone (they are superseded) and restores any chunk still holding the plugin's
|
|
281
|
+
bytes; enrolled Claude runs are blocked until re-sync. If OpenClaw was reinstalled in
|
|
282
|
+
another directory and the old one deleted, the old receipt is superseded and sync
|
|
283
|
+
targets the new installation directly. Prove update and rollback behavior on a disposable installation; inventory
|
|
284
|
+
checks alone do not show which update paths fail.
|
|
285
|
+
|
|
286
|
+
To review a layout without touching the Gateway's installation:
|
|
287
|
+
|
|
288
|
+
```sh
|
|
289
|
+
npm run build
|
|
290
|
+
node scripts/validate-claude-layout.mjs /path/to/disposable/node_modules/openclaw
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
It patches that copy, renders managed and upstream prompts through the real
|
|
294
|
+
assembly, restores, and checks restored bytes against the vendor inventory.
|
|
57
295
|
|
|
58
296
|
## Install and enroll
|
|
59
297
|
|
|
@@ -61,7 +299,7 @@ Remote-node-only skills are not added; this is for dedicated local Mac agents.
|
|
|
61
299
|
npm ci
|
|
62
300
|
npm run preflight
|
|
63
301
|
npm pack
|
|
64
|
-
openclaw plugins install ./unblocklabs-unblock-codex-prompt-0.
|
|
302
|
+
openclaw plugins install ./unblocklabs-unblock-codex-prompt-0.4.0.tgz --force --accept-capabilities
|
|
65
303
|
```
|
|
66
304
|
|
|
67
305
|
Include the plugin in `plugins.allow` if applicable, then configure:
|
|
@@ -73,7 +311,7 @@ Include the plugin in `plugins.allow` if applicable, then configure:
|
|
|
73
311
|
"unblock-codex-prompt": {
|
|
74
312
|
enabled: true,
|
|
75
313
|
config: {
|
|
76
|
-
agentId: "main",
|
|
314
|
+
agentId: "main", frozenContext: true,
|
|
77
315
|
promptUrl: "https://fleet-prompt.unblocklabs.ai/prompt?channel=dev"
|
|
78
316
|
}
|
|
79
317
|
}
|
|
@@ -82,25 +320,28 @@ Include the plugin in `plugins.allow` if applicable, then configure:
|
|
|
82
320
|
}
|
|
83
321
|
```
|
|
84
322
|
|
|
85
|
-
`agentId` defaults to `main
|
|
86
|
-
|
|
87
|
-
|
|
323
|
+
`agentId` defaults to `main`. Both `promptUrl` and `frozenContext: true` are
|
|
324
|
+
required; the key keeps its historical name, though identity files are now live.
|
|
325
|
+
Legacy `agentName` values remain accepted but are unused; identity comes from the
|
|
326
|
+
live agent documents. Existing remote fleet configurations need no changes.
|
|
327
|
+
Configurations without a remote URL or with base-only mode are no longer supported.
|
|
328
|
+
Codex-only enrollment needs no conversation-access hook grant; Claude CLI
|
|
329
|
+
enrollment requires one (see [Claude CLI agents](#claude-cli-agents)). Initial enrollment enables daily shared-prompt refresh
|
|
88
330
|
and overdue startup catch-up. Startup never rebuilds local context or patches the
|
|
89
331
|
adapter. The optional model-catalog service can also refresh metadata.
|
|
90
332
|
|
|
91
|
-
|
|
333
|
+
Use `channel=dev` for Bill and `channel=prod`
|
|
92
334
|
for approved fleet deployments. The URL must use HTTPS without embedded credentials
|
|
93
335
|
or a fragment. Sync fetches without authentication, refuses redirects, and checks
|
|
94
336
|
plain-text content, a 256 KiB limit, UTF-8, and the endpoint's SHA-256
|
|
95
337
|
`X-Prompt-Revision` header, with a ten-second request timeout. These integrity
|
|
96
338
|
checks are not a signature; the configured HTTPS publisher controls the policy.
|
|
97
339
|
|
|
98
|
-
The remote text
|
|
99
|
-
|
|
100
|
-
`prompts/developer.md` policy copy. The frozen local context is still appended.
|
|
340
|
+
The remote text supplies the shared base and replaces OpenClaw's generic developer
|
|
341
|
+
policy; the generated file is hash-checked against its sync receipt at every assembly.
|
|
101
342
|
No local documents are sent to the Worker. The installed snapshot is the local
|
|
102
|
-
last-known-good
|
|
103
|
-
|
|
343
|
+
last-known-good generated file in the agent's managed home: a failed fetch aborts
|
|
344
|
+
sync before writes and does not disrupt normal turns. There is no bundled fallback. Status shows
|
|
104
345
|
the installed URL/revision separately from the configured URL, without fetching.
|
|
105
346
|
|
|
106
347
|
Back up configuration and drain active work. Inspect the installed official
|
|
@@ -114,8 +355,8 @@ openclaw codex-prompt status
|
|
|
114
355
|
|
|
115
356
|
`--adopt` explicitly takes ownership of an existing custom prompt pointer. Its
|
|
116
357
|
previous value is retained for restoration; leave the original file in place.
|
|
117
|
-
First
|
|
118
|
-
|
|
358
|
+
First sync compiles the memory reference and installs the guarded adapter patch with
|
|
359
|
+
a private original-source backup. Later syncs reuse its receipt.
|
|
119
360
|
|
|
120
361
|
## Refresh and activate
|
|
121
362
|
|
|
@@ -124,19 +365,42 @@ openclaw codex-prompt sync
|
|
|
124
365
|
openclaw codex-prompt status
|
|
125
366
|
```
|
|
126
367
|
|
|
127
|
-
Only explicit `sync` rebuilds
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
368
|
+
Only explicit `sync` rebuilds the memory reference and adapter policy.
|
|
369
|
+
Sync fetches every enrolled runtime's policy before writing anything; if any fetch
|
|
370
|
+
fails, nothing is written. The daily service fetches the configured Worker channel for
|
|
371
|
+
each enrolled runtime, then, in one locked write, replaces only the Codex policy prefix
|
|
372
|
+
of the generated file and/or `claudePolicy` in the receipt when their content changes;
|
|
373
|
+
everything after the Codex prefix is preserved byte-for-byte, and a Claude-only change
|
|
374
|
+
leaves the Codex file untouched (same bytes and inode). Identity and workspace files
|
|
375
|
+
and the skills catalog need neither: they are read live every turn. The catalog lists
|
|
376
|
+
each skill's name, description and location; skill bodies remain files the model reads
|
|
377
|
+
when triggered. Editing only a `SKILL.md` body therefore does not change the catalog
|
|
378
|
+
(or the Codex thread instructions); the next read of that file sees the edit.
|
|
379
|
+
|
|
380
|
+
A snapshot written by an earlier version still ends in its frozen skills catalog.
|
|
381
|
+
Refresh keeps that tail byte-for-byte until the next `sync` rewrites the file without
|
|
382
|
+
it. The earlier adapter suppressed the live catalog, so no thread sees both copies,
|
|
383
|
+
and no migration is needed: sync, then restart as below.
|
|
134
384
|
|
|
135
385
|
**After sync, drain work, restart the Gateway/managed app-server, and use new
|
|
136
|
-
conversations.**
|
|
386
|
+
conversations.** Sync can change the adapter itself, which a running app-server keeps
|
|
387
|
+
until restart. Policy refreshes, identity edits and catalog changes need neither.
|
|
388
|
+
Upgrading from a version with a frozen catalog: between this sync and the restart, the
|
|
389
|
+
running Gateway still holds the earlier patch, which suppresses the live catalog, while
|
|
390
|
+
the new file no longer carries the frozen one, so Codex turns in that window have no
|
|
391
|
+
skills catalog. Drain the agent before sync and restart right after it.
|
|
137
392
|
The plugin never interrupts or resets sessions. Capture an actual request after
|
|
138
393
|
provisioning or upgrades; `status` is disk evidence, not live adoption.
|
|
139
394
|
|
|
395
|
+
For this instruction cleanup, run explicit `sync` to install the new adapter and
|
|
396
|
+
empty remote policy, refresh the enabled catalog, then restart while idle and use
|
|
397
|
+
fresh root/child conversations. Daily prompt refresh alone does not replace a
|
|
398
|
+
snapshot's developer policy or install an adapter. New turns on a newly activated
|
|
399
|
+
conversation stay normalized, but old conversations can retain removed
|
|
400
|
+
active-computer, permission, role or routing text. Do not reuse them to validate
|
|
401
|
+
the cleanup. Warm generic-policy changes explicitly withdraw removed sections;
|
|
402
|
+
they cannot erase unrelated creation-time context.
|
|
403
|
+
|
|
140
404
|
The patched assembly boundary validates enrollment, pointer and compiled prompt
|
|
141
405
|
hash before replacing/suppressing context. Invalid state aborts assembly.
|
|
142
406
|
This guard does not attest to an old thread's retained prompt or detect every
|
|
@@ -144,12 +408,11 @@ possible higher-priority Codex config override. An upgrade replacing the adapter
|
|
|
144
408
|
removes the guard; startup status is diagnostic, not a global inference gate.
|
|
145
409
|
Restore before upgrading, then revalidate compatibility before reenrollment.
|
|
146
410
|
|
|
147
|
-
If an upgrade already removed the old package generation,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
unless a new snapshot was requested. A source update still requires idle activation
|
|
411
|
+
If an upgrade already removed the old package generation, restore leaves the
|
|
412
|
+
replacement files alone and the old receipt is superseded: sync installs the reviewed
|
|
413
|
+
adapter against the current inspected official package without editing receipts.
|
|
414
|
+
Keep the snapshot and operator-selected launcher intact unless a new snapshot was
|
|
415
|
+
requested. A source update still requires idle activation
|
|
153
416
|
and fresh-session verification; disk status alone does not prove adoption.
|
|
154
417
|
|
|
155
418
|
### Daily shared-prompt refresh
|
|
@@ -160,14 +423,23 @@ Use `openclaw codex-prompt refresh` to run the same remote-prompt and enabled
|
|
|
160
423
|
model-catalog refresh immediately, without resnapshotting local context.
|
|
161
424
|
|
|
162
425
|
Both components are attempted independently: a catalog outage cannot prevent a
|
|
163
|
-
prompt update, or vice versa.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
426
|
+
prompt update, or vice versa. Within the shared prompt, every enrolled runtime is
|
|
427
|
+
fetched first: if any fetch fails or validation fails, neither runtime's policy is
|
|
428
|
+
updated; failures retry hourly. Unchanged prompt content is not rewritten. Status
|
|
429
|
+
reports each runtime's policy revision and last successful `checkedAt` timestamp:
|
|
430
|
+
`remotePrompt` for Codex and `claudePolicy` (`url`, `revision`, `checkedAt`) for Claude;
|
|
431
|
+
policy text is never printed. A changed
|
|
432
|
+
revision reaches existing conversations on their next turn: Codex resumes the thread
|
|
433
|
+
with the new base instructions (`nextCodexTurn`), and Claude starts the next CLI
|
|
434
|
+
process with the new prompt, resuming the conversation (`nextClaudeProcess`). Earlier
|
|
435
|
+
history is not rewritten. A live Codex incognito conversation cannot be resumed; it
|
|
436
|
+
keeps the revision it started with.
|
|
167
437
|
The plugin never restarts the Gateway automatically.
|
|
168
438
|
|
|
169
439
|
Existing remote snapshots migrate their shared/context boundary without rereading
|
|
170
|
-
agent files.
|
|
440
|
+
agent files. A node upgraded from 0.3.x keeps its frozen identity copy and old
|
|
441
|
+
adapter until its next `sync`, which installs live identity and policy delivery;
|
|
442
|
+
until then refreshes still reach only new conversations. Ambiguous or externally modified snapshots are refused rather than
|
|
171
443
|
guessed; inspect them and use explicit `sync` to rebuild when appropriate.
|
|
172
444
|
|
|
173
445
|
## Optional daily model-catalog refresh
|
|
@@ -183,8 +455,19 @@ endpoint must return a full Codex `models` catalog, not only an OpenAI-style
|
|
|
183
455
|
`data` list. The managed model cache supplies only the client-version query
|
|
184
456
|
parameter, never the catalog contents.
|
|
185
457
|
|
|
186
|
-
The
|
|
187
|
-
|
|
458
|
+
The existing `suppressExplicitDelegationPrompt` opt-in manages these fields on
|
|
459
|
+
each model, preserving unrelated metadata and other permission/mode messages:
|
|
460
|
+
|
|
461
|
+
- `multi_agent.mode.explicit`: empty, preserving standing useful delegation.
|
|
462
|
+
- `collaboration_modes.default`: empty, leaving runtime mode selection unchanged.
|
|
463
|
+
- `multi_agent.role.root` / `subagent`: compact role identity and child-result delivery.
|
|
464
|
+
Codex still appends its live executor/shared-state/concurrency/fork guidance.
|
|
465
|
+
- `permissions.danger_full_access`: `Native execution: filesystem unrestricted; network {{ network_access }}.`
|
|
466
|
+
- `approvals.never`: `Approval escalation unavailable; omit sandbox_permissions.`
|
|
467
|
+
|
|
468
|
+
All paths above are under `model_messages`. Empty catalog strings are intentional
|
|
469
|
+
overrides, not `null` fallback values. The changes affect instruction text, not
|
|
470
|
+
tool definitions, execution settings, approval enforcement or Plan mode. The plugin
|
|
188
471
|
writes `unblock-codex-models.json` in the managed Codex home and sets the top-level
|
|
189
472
|
`model_catalog_json` pointer. It refuses to overwrite another owner's pointer.
|
|
190
473
|
Manual edits to this generated catalog are intentionally replaced on refresh.
|
|
@@ -195,7 +478,9 @@ there is no fallback to stale cached metadata. Stopping the service cancels its
|
|
|
195
478
|
timer and waits for an in-flight refresh. Status exposes last/next refresh times
|
|
196
479
|
and verifies the local catalog hash without fetching. A successful catalog-only
|
|
197
480
|
`refresh-catalog` never changes the fleet prompt or local context snapshot. The
|
|
198
|
-
daily service and `refresh` also check the shared prompt
|
|
481
|
+
daily service and `refresh` also check the shared prompt.
|
|
482
|
+
Failures report every failing component, a safe cause and the next hourly retry
|
|
483
|
+
time; transport details, configuration snippets and response bodies are not logged.
|
|
199
484
|
|
|
200
485
|
Restart the Gateway after first activating the catalog pointer. On the validated
|
|
201
486
|
managed Codex 0.153.4 build, a fresh conversation adopted refreshed catalog
|
|
@@ -231,11 +516,42 @@ openclaw codex-prompt restore
|
|
|
231
516
|
openclaw codex-prompt status
|
|
232
517
|
```
|
|
233
518
|
|
|
234
|
-
Restore recovers exact original adapter bytes
|
|
235
|
-
the previous TOML pointer. It
|
|
236
|
-
|
|
519
|
+
Restore recovers exact original adapter bytes (Codex package and OpenClaw core),
|
|
520
|
+
deactivates enrollment and restores the previous TOML pointer. It plans each adapter
|
|
521
|
+
first, validating its files and the backups it will write; an adapter is restored only
|
|
522
|
+
while any recorded file still holds the plugin's bytes. Restore then validates the
|
|
523
|
+
pointer and pauses enrollment, and only then removes the Codex catalog and skills
|
|
524
|
+
block and restores the adapters, so a refusal changes nothing and no run sees a
|
|
525
|
+
half-restored bridge. Missing files, and files with other bytes after the recorded
|
|
526
|
+
version changed, are superseded and left to the updater; other changes are refused as
|
|
527
|
+
foreign edits. A receipt whose files are restored, superseded or otherwise no longer
|
|
528
|
+
hold the plugin's bytes never blocks a restore (its state is reported in the output
|
|
529
|
+
and in status). Restore retains backup, receipt and generated files as rollback
|
|
530
|
+
evidence; they do not keep a runtime enrolled. It does not require the current Codex
|
|
531
|
+
`appServer` settings to be supported. Restart and use fresh conversations to activate it.
|
|
237
532
|
Restore **before** disabling/uninstalling or changing target agents. Disabling
|
|
238
|
-
without restoring leaves the
|
|
533
|
+
without restoring leaves the managed base but re-enables OpenClaw's generic injections.
|
|
534
|
+
|
|
535
|
+
### Rolling back to 0.3.x
|
|
536
|
+
|
|
537
|
+
1. With 0.4 still installed, run `openclaw codex-prompt restore`. A restored enrollment
|
|
538
|
+
is saved in the state format 0.3 reads.
|
|
539
|
+
2. Restart the Gateway so the restored OpenClaw core and Codex package are loaded.
|
|
540
|
+
3. Install the 0.3.x plugin, then run its `sync` if you want it to manage the agent again.
|
|
541
|
+
|
|
542
|
+
0.3.x cannot manage Claude CLI agents. Any enrollment that includes Codex, with or
|
|
543
|
+
without Claude, and any restored enrollment are saved in the format 0.3.x reads. If the
|
|
544
|
+
plugin is rolled back without restoring first, the 0.4 patches find the older runtime
|
|
545
|
+
and fall back instead of failing turns: 0.3.x keeps managing Codex, which reads the
|
|
546
|
+
policy from its base file, and Claude renders OpenClaw's normal prompt. An active
|
|
547
|
+
Claude-only enrollment is refused by 0.3.x; install 0.4 again and restore. 0.3.x
|
|
548
|
+
rewrites the state without the Claude runtime when it syncs or restores, and does not
|
|
549
|
+
restore OpenClaw core: after returning to 0.4, run restore (or sync) before relying on
|
|
550
|
+
Claude runs. A 0.4 snapshot uses a heading 0.3.x's daily refresh does not recognize, so
|
|
551
|
+
after rolling back, run 0.3.x's `sync` once to rebuild it. That sync reinstalls 0.3.x's
|
|
552
|
+
Codex patch and its frozen skills catalog; drain and restart after it, as after any
|
|
553
|
+
sync. Until then the 0.4 patch keeps relaying the live catalog (the relay is inline in
|
|
554
|
+
the patch, so it does not depend on the plugin runtime).
|
|
239
555
|
|
|
240
556
|
## Safety and scope
|
|
241
557
|
|
|
@@ -248,14 +564,15 @@ without restoring leaves the frozen base but re-enables live injections.
|
|
|
248
564
|
- Do not run concurrent sync/install/restore operations. If a crash left an empty
|
|
249
565
|
lock directory, confirm no sync is running before removing it.
|
|
250
566
|
- A prompt guides behavior; it is not a security boundary or obedience guarantee.
|
|
251
|
-
-
|
|
567
|
+
- The fleet policy replaces OpenClaw's generic policy, so upstream base-policy
|
|
568
|
+
improvements are not inherited. Review upgrades.
|
|
252
569
|
- Never commit customer snapshots, raw captures, credentials or host backups.
|
|
253
570
|
|
|
254
571
|
## Development and release
|
|
255
572
|
|
|
256
573
|
```sh
|
|
257
574
|
npm run preflight
|
|
258
|
-
npm run release:check -- v0.
|
|
575
|
+
npm run release:check -- v0.4.0
|
|
259
576
|
```
|
|
260
577
|
|
|
261
578
|
Tests cover compilation, explicit refresh, native/private-body exclusion,
|
|
@@ -265,7 +582,7 @@ proof and limits.
|
|
|
265
582
|
|
|
266
583
|
Install with
|
|
267
584
|
the packed archive above for an unreleased candidate. After publication, use
|
|
268
|
-
`openclaw plugins install npm:@unblocklabs/unblock-codex-prompt@0.
|
|
585
|
+
`openclaw plugins install npm:@unblocklabs/unblock-codex-prompt@0.4.0 --accept-capabilities`.
|
|
269
586
|
The existing [GitHub Release workflow](RELEASING.md) publishes npm only when a
|
|
270
587
|
GitHub Release is published. Normal pushes do not release the package.
|
|
271
588
|
|
package/RELEASING.md
CHANGED
|
@@ -44,7 +44,7 @@ ClawHub publishing is not configured.
|
|
|
44
44
|
|
|
45
45
|
1. Update `package.json`, `package-lock.json` (including its root package), and
|
|
46
46
|
`openclaw.plugin.json` to the same version.
|
|
47
|
-
2. Review
|
|
47
|
+
2. Review both fleet-prompt dev/prod section diffs separately from plugin code and
|
|
48
48
|
verify a real fresh-session Responses request after meaningful prompt or
|
|
49
49
|
compatibility changes. Keep captures private; publish only sanitized findings.
|
|
50
50
|
3. Run `npm ci`, `npm run preflight`, and `npm run release:check -- vX.Y.Z`.
|
|
@@ -66,12 +66,13 @@ Back up the managed Codex TOML privately before temporarily changing the provide
|
|
|
66
66
|
endpoint. Preserve credentials and unrelated settings, and arrange restoration
|
|
67
67
|
even if the test fails.
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
Use an isolated prompt endpoint with revision A, then one unmistakable harmless
|
|
70
|
+
marker in revision B. Sync each and capture them in **different native threads**. Assert the rendered
|
|
71
71
|
base prompt appears exactly once (allowing Codex's outer-whitespace trimming),
|
|
72
|
-
the marker changes,
|
|
72
|
+
the marker changes, OpenClaw's generic policy stays replaced, and required runtime
|
|
73
|
+
context remains. Do not edit a bundled template; none exists.
|
|
73
74
|
Inspect both `instructions` and developer text items in `input`: Bill's current
|
|
74
75
|
Codex build carries the base prompt in `input`, not `instructions`. A synthetic receiver
|
|
75
|
-
proves wire composition, not model obedience. Restore the
|
|
76
|
+
proves wire composition, not model obedience. Restore the configured prompt URL and
|
|
76
77
|
real endpoint, verify a real model turn, and check Gateway health. Never commit
|
|
77
78
|
the marker, raw captures, local ports/PIDs, private config, or test conversations.
|