@unblocklabs/unblock-codex-prompt 0.4.0 → 0.5.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 +178 -151
- package/dist/claude-adapter.d.ts +9 -40
- package/dist/claude-adapter.js +31 -195
- package/dist/claude-prompt.d.ts +36 -0
- package/dist/claude-prompt.js +134 -0
- package/dist/index.js +99 -93
- package/dist/managed-target.d.ts +10 -1
- package/dist/managed-target.js +21 -1
- package/dist/manager.d.ts +1 -1
- package/dist/manager.js +3 -3
- package/dist/runtime.d.ts +9 -25
- package/dist/runtime.js +18 -51
- package/openclaw.plugin.json +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Unblock Codex Prompt
|
|
2
2
|
|
|
3
3
|
A small, explicit prompt-management bridge for dedicated OpenClaw Mac agents.
|
|
4
|
-
**Version 0.
|
|
4
|
+
**Version 0.5.0.** The bridge supports OpenClaw/Codex 2026.10.5 and newer
|
|
5
5
|
stable releases with a reviewed context-assembly layout, and agents running
|
|
6
|
-
through the Claude CLI backend
|
|
6
|
+
through the Claude CLI backend, whose whole system prompt it replaces through
|
|
7
|
+
OpenClaw's public `before_prompt_build` hook without patching OpenClaw core.
|
|
7
8
|
See [Claude CLI agents](#claude-cli-agents).
|
|
8
9
|
|
|
9
10
|
## What you control
|
|
@@ -14,8 +15,9 @@ See [Claude CLI agents](#claude-cli-agents).
|
|
|
14
15
|
- Each agent's memory reference (not memory bodies).
|
|
15
16
|
|
|
16
17
|
**Identity and workspace files are live.** `SOUL.md`, `IDENTITY.md`, `USER.md`
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
and `AGENTS.md` are never snapshotted. On Codex OpenClaw loads them every turn
|
|
19
|
+
(shared `USER.md` and the session's selected personal file); on Claude CLI the
|
|
20
|
+
plugin reads the workspace files every turn. An edit by you or by the agent
|
|
19
21
|
applies to the next turn without a sync. The `MEMORY.md` body stays out of the
|
|
20
22
|
prompt; a memory reference points to it.
|
|
21
23
|
|
|
@@ -23,7 +25,8 @@ prompt; a memory reference points to it.
|
|
|
23
25
|
session's catalog from OpenClaw's own session skills snapshot, exactly as OpenClaw
|
|
24
26
|
renders it; the plugin never compiles or freezes a copy. Codex gets it in the thread
|
|
25
27
|
developer instructions (see below); Claude gets it through OpenClaw's native
|
|
26
|
-
`openclaw-skills`
|
|
28
|
+
`openclaw-skills` Claude plugin mount. When OpenClaw mounts no such plugin it lists
|
|
29
|
+
skills in its system prompt instead, and that list is dropped with the rest of that prompt.
|
|
27
30
|
|
|
28
31
|
**The fleet policy is live too.** On Codex the generated file (fleet policy and memory
|
|
29
32
|
reference) replaces Codex's native base through `model_instructions_file`.
|
|
@@ -46,9 +49,10 @@ of the downloaded policy.
|
|
|
46
49
|
|
|
47
50
|
**Still live and untouched:** native AGENTS.md, native skills, tool schemas and
|
|
48
51
|
executor protocol, sandbox/approvals, native collaboration mechanics, routing
|
|
49
|
-
identifiers, date/timezone and user messages.
|
|
50
|
-
normalized; unknown `extraSystemPrompt` additions, including incognito context, survive.
|
|
51
|
-
|
|
52
|
+
identifiers, date/timezone and user messages. On Codex, reviewed duplicate OpenClaw prose is
|
|
53
|
+
normalized; unknown `extraSystemPrompt` additions, including incognito context, survive.
|
|
54
|
+
On Claude CLI they are dropped (see [What Claude CLI no longer receives](#what-claude-cli-no-longer-receives)).
|
|
55
|
+
This is not total prompt ownership; other plugins/hooks can still add instructions.
|
|
52
56
|
|
|
53
57
|
Customer documents stay on each agent's machine, outside this package. Snapshot
|
|
54
58
|
files use private permissions.
|
|
@@ -70,6 +74,11 @@ files use private permissions.
|
|
|
70
74
|
managed `model_instructions_file`; status cannot attest to launcher behavior.
|
|
71
75
|
- One target agent per installation. Other agents use upstream behavior. Native
|
|
72
76
|
Codex children inherit the fleet policy and live persona.
|
|
77
|
+
- Claude CLI: no OpenClaw core layout is reviewed or patched for Claude any more. The
|
|
78
|
+
plugin uses OpenClaw's public `before_prompt_build` hook, whose `systemPrompt`
|
|
79
|
+
result replaces the CLI system prompt, so it works on any OpenClaw version with that
|
|
80
|
+
hook behavior. Verified on **2026.10.6** and **2026.10.9** with
|
|
81
|
+
`scripts/validate-claude-hook.mjs` (see [Verify against an OpenClaw install](#verify-against-an-openclaw-install)).
|
|
73
82
|
|
|
74
83
|
This bridge uses one private upstream seam, the guarded Codex context carriers,
|
|
75
84
|
because public prompt hooks cannot fix the dropped-context path. It no longer depends
|
|
@@ -99,10 +108,11 @@ allowlist, visibility and size-limit logic; the plugin neither adds nor removes
|
|
|
99
108
|
## Claude CLI agents
|
|
100
109
|
|
|
101
110
|
For agents whose models run through OpenClaw's `claude-cli` backend, the plugin
|
|
102
|
-
replaces **
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
111
|
+
replaces **OpenClaw's entire Claude CLI system prompt**, as it does for Codex. It
|
|
112
|
+
does this through OpenClaw's public `before_prompt_build` hook and never patches
|
|
113
|
+
OpenClaw core. Claude Code's native system prompt and prefix, `CLAUDE.md`,
|
|
114
|
+
independently installed Claude skills/plugins, tool schemas, permissions and
|
|
115
|
+
authentication are untouched. Other agents, other CLI backends and
|
|
106
116
|
control/side-question operations keep upstream behavior.
|
|
107
117
|
|
|
108
118
|
**Each runtime gets its own fleet policy.** The plugin fetches the configured
|
|
@@ -120,48 +130,71 @@ not depend on the Worker deploy.
|
|
|
120
130
|
|
|
121
131
|
### How it works
|
|
122
132
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
**Identity
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
133
|
+
For a run whose hook context names the `claude-cli` provider and the target agent
|
|
134
|
+
(subagent sessions of that agent included), with an active enrollment that includes
|
|
135
|
+
Claude CLI, the hook returns `systemPrompt`. OpenClaw uses it in place of the prompt it
|
|
136
|
+
built (`prepareCliTurnPromptContext`), then applies registered text transforms and
|
|
137
|
+
appends its model identity line. The prompt is, in order, with nothing else added:
|
|
138
|
+
|
|
139
|
+
1. the Claude fleet policy (`runtime=claude`), never the Codex policy;
|
|
140
|
+
2. the memory reference (`## Memory reference`);
|
|
141
|
+
3. each of `AGENTS.md`, `SOUL.md`, `IDENTITY.md`, `USER.md` and `BOOTSTRAP.md` that
|
|
142
|
+
exists in the run's workspace and is not empty, under a `## <absolute path>` header.
|
|
143
|
+
That is OpenClaw's own workspace bootstrap set without `MEMORY.md`, whose body is
|
|
144
|
+
never included. As in OpenClaw, `BOOTSTRAP.md` goes only to primary user or manual
|
|
145
|
+
runs, never to subagent sessions, heartbeats or cron.
|
|
146
|
+
|
|
147
|
+
The files are read on every call from the run's workspace (the configured agent
|
|
148
|
+
workspace when the run names none), so an edit applies to the next turn. Each file is
|
|
149
|
+
cut to OpenClaw's per-file bootstrap cap: the agent's `bootstrapMaxChars`, else
|
|
150
|
+
`agents.defaults.bootstrapMaxChars`, else OpenClaw's default of 20000 characters, and at
|
|
151
|
+
most 4000 for `USER.md` as in OpenClaw. All files together are cut to OpenClaw's total
|
|
152
|
+
budget, `bootstrapTotalMaxChars` (default 60000). A cut file keeps its head, with no
|
|
153
|
+
marker (OpenClaw keeps head and tail and adds a marker).
|
|
154
|
+
Symlinks are followed only within the workspace; a file resolving outside it, a
|
|
155
|
+
non-regular file or one over 2 MiB is left out with a warning.
|
|
156
|
+
|
|
157
|
+
The policy and memory reference come from the sync receipt, verified on every call
|
|
158
|
+
(enrollment, prompt-file hash). Invalid or tampered enrolled state is logged as an
|
|
159
|
+
error, without prompt text, and that run keeps OpenClaw's own prompt. Other agents,
|
|
160
|
+
other providers, and paused or never-enrolled agents are left alone. When the hook
|
|
161
|
+
returns nothing, OpenClaw's prompt applies unchanged.
|
|
162
|
+
|
|
163
|
+
**Skills.** Claude gets the session skills through OpenClaw's native `openclaw-skills`
|
|
164
|
+
Claude plugin mount, which is not part of the system prompt and is kept.
|
|
165
|
+
|
|
166
|
+
**Identity on both runtimes.** Native Codex children inherit persona with the thread
|
|
167
|
+
developer instructions. Claude Code's native subagents do not receive the appended
|
|
168
|
+
system prompt at all (verified on Claude Code 2.1.316), so they see neither the fleet
|
|
169
|
+
policy nor persona. On Codex, editing a persona file or changing the skills catalog
|
|
170
|
+
during a live incognito conversation changes its thread instructions, which Codex
|
|
171
|
+
refuses for incognito threads: that thread's next turn fails. Start a new incognito
|
|
172
|
+
conversation after such a change.
|
|
173
|
+
|
|
174
|
+
### What Claude CLI no longer receives
|
|
175
|
+
|
|
176
|
+
Replacing the whole prompt drops everything OpenClaw puts in it for these runs, with no
|
|
177
|
+
exception for subagent sessions:
|
|
178
|
+
|
|
179
|
+
- `extraSystemPrompt` content: incognito restrictions, group-chat and channel prompts,
|
|
180
|
+
and subagent task framing;
|
|
181
|
+
- per-person `USER.md` overlays (the session's selected personal file); only the
|
|
182
|
+
workspace `USER.md` is carried;
|
|
183
|
+
- OpenClaw's generic sections: identity line, tooling list, tool-call style, execution
|
|
184
|
+
bias, Care, OpenClaw Control, delegation, docs, model aliases, UI presentation, side
|
|
185
|
+
chat and silent replies;
|
|
186
|
+
- its mechanics: output directives, messaging and delivery sections, channel hints,
|
|
187
|
+
authorized senders, exec-approval protocol, sandbox and elevated facts, TTS,
|
|
188
|
+
reactions, Control UI embeds, directory roles, the Runtime section, git co-author
|
|
189
|
+
guidance, bootstrap truncation notices, and the system-prompt skills list used when no
|
|
190
|
+
native skills plugin is mounted;
|
|
191
|
+
- the Claude backend's tool-name section, which OpenClaw adds before hooks run.
|
|
192
|
+
|
|
193
|
+
Still delivered: per-turn facts OpenClaw puts in the turn's user context (source
|
|
194
|
+
delivery, runtime context blocks, relocated runtime facts), the native skills mount,
|
|
195
|
+
`prependSystemContext`/`appendSystemContext` from other plugins' hooks, registered text
|
|
196
|
+
transforms and the model identity line. If several plugins return `systemPrompt`, the
|
|
197
|
+
highest-priority hook wins; this hook registers at priority 1000 so it runs first.
|
|
165
198
|
|
|
166
199
|
### Enroll
|
|
167
200
|
|
|
@@ -178,23 +211,27 @@ enroll a runtime by themselves.
|
|
|
178
211
|
|
|
179
212
|
To drop a runtime, restore, change the agent's model configuration, then sync.
|
|
180
213
|
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
|
|
182
|
-
patched bytes are still installed
|
|
183
|
-
refuses until `openclaw codex-prompt restore` completes.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
214
|
+
runtime is not re-enrolled from them. If a restore was interrupted and the Codex
|
|
215
|
+
adapter's patched bytes are still installed while Codex is no longer configured, sync
|
|
216
|
+
refuses until `openclaw codex-prompt restore` completes. A leftover 0.4 Claude core
|
|
217
|
+
patch is instead removed by sync (see [Upgrading from 0.4](#upgrading-from-04-and-openclaw-updates)).
|
|
218
|
+
|
|
219
|
+
The Codex adapter and the 0.4 Claude core receipt share one rule. A receipt is cleared
|
|
220
|
+
once every recorded file is back at its original bytes (a completed restore), or once
|
|
221
|
+
nothing of the plugin's is left: every changed file is gone (an update renamed it, or
|
|
222
|
+
the install directory was deleted) or the recorded install version was replaced. A
|
|
223
|
+
Codex sync after that starts fresh, may target a different Codex package, and replaces
|
|
224
|
+
the old receipt's backups. Otherwise sync and restore keep refusing foreign edits and
|
|
225
|
+
foreign backups.
|
|
191
226
|
|
|
192
227
|
Codex `appServer` settings (agent-scoped local stdio only) are checked by sync when
|
|
193
228
|
it selects Codex and reported by status as `codexConfigError` for a Codex
|
|
194
229
|
enrollment. They never block Claude-only enrollment, status or restore.
|
|
195
230
|
|
|
196
|
-
Claude CLI enrollment
|
|
197
|
-
|
|
231
|
+
Claude CLI enrollment needs the hook to be registrable. OpenClaw registers
|
|
232
|
+
`before_prompt_build` for a non-bundled plugin only with
|
|
233
|
+
`hooks.allowConversationAccess: true`, and blocks it when `hooks.allowPromptInjection`
|
|
234
|
+
is `false` (it defaults to allowed). Sync refuses Claude without both:
|
|
198
235
|
|
|
199
236
|
```json5
|
|
200
237
|
{
|
|
@@ -222,76 +259,58 @@ the file in the Codex layout.
|
|
|
222
259
|
**Where each policy is stored.** The Codex policy stays the prefix of the generated file
|
|
223
260
|
(`model_instructions_file`, also sent as `baseInstructions`). The Claude policy and the
|
|
224
261
|
shared agent context are stored in the sync receipt (`.unblock-codex-prompt-bundle.json`)
|
|
225
|
-
as `claudePolicy` (`text`, `url`, `revision`, `checkedAt`) and `agentContext
|
|
226
|
-
|
|
227
|
-
receipt
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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:
|
|
262
|
+
as `claudePolicy` (`text`, `url`, `revision`, `checkedAt`) and `agentContext`, and read
|
|
263
|
+
from the receipt only; the generated file is still verified against the receipt's
|
|
264
|
+
`promptSha256`. The receipt is the trust root for Claude: anyone who can write it can set
|
|
265
|
+
the policy, as with the file. An invalid or missing `claudePolicy` is reported by status
|
|
266
|
+
and leaves Claude runs on OpenClaw's prompt until `sync`.
|
|
267
|
+
|
|
268
|
+
**Activation.** The hook builds the prompt on every turn, so once the Gateway has
|
|
269
|
+
loaded this plugin version the target agent's next Claude turn uses it: no restart
|
|
270
|
+
after sync, refresh or a workspace edit. Installing or updating the plugin needs a
|
|
271
|
+
Gateway restart to load it; a grant change hot-reloads under OpenClaw's default hybrid
|
|
272
|
+
reload mode. A changed prompt changes the hash OpenClaw keys live Claude processes on,
|
|
273
|
+
so the conversation's next turn starts a new process that resumes the conversation; its
|
|
274
|
+
earlier history is not cleaned. Validate each policy revision in a fresh native
|
|
275
|
+
conversation. Status `claude.ready` means enrolled, a valid Claude policy, the hook
|
|
276
|
+
grant in place and no leftover 0.4 core patch.
|
|
277
|
+
|
|
278
|
+
Known limitations: OpenClaw runs prompt-build hooks only after it prepares them; if that
|
|
279
|
+
fails (for example, history its hook isolation cannot copy) or its turn-context
|
|
280
|
+
preparation fails, OpenClaw logs a warning and that run keeps OpenClaw's prompt. The
|
|
281
|
+
plugin cannot see those runs.
|
|
282
|
+
|
|
283
|
+
### Upgrading from 0.4 and OpenClaw updates
|
|
284
|
+
|
|
285
|
+
0.4 patched two OpenClaw core functions for Claude and kept a receipt
|
|
286
|
+
(`codex-home/.unblock-claude-prompt-adapter.json`) with exact-byte backups. On a node
|
|
287
|
+
with that patch still installed, status reports `legacyClaudeCore` with
|
|
288
|
+
`leftover: true` and Claude is not ready. `sync` validates the patched files and their
|
|
289
|
+
backups before writing anything, restores the original bytes, and reports
|
|
290
|
+
`legacyClaudeCoreRestored` with `restartRequired: true`: restart the Gateway to reload
|
|
291
|
+
the restored core. `restore` removes a leftover patch too. A same-version foreign edit
|
|
292
|
+
to a patched file is refused rather than overwritten; files an OpenClaw update already
|
|
293
|
+
replaced are left to the updater.
|
|
294
|
+
|
|
295
|
+
Updating OpenClaw needs no restore for Claude: there is nothing in core to remove. Run
|
|
296
|
+
`openclaw codex-prompt restore` first only while status still shows a leftover 0.4
|
|
297
|
+
patch, or for Codex as described below.
|
|
298
|
+
|
|
299
|
+
### Verify against an OpenClaw install
|
|
287
300
|
|
|
288
301
|
```sh
|
|
289
302
|
npm run build
|
|
290
|
-
node scripts/validate-claude-
|
|
303
|
+
node scripts/validate-claude-hook.mjs /path/to/node_modules/openclaw [...]
|
|
291
304
|
```
|
|
292
305
|
|
|
293
|
-
|
|
294
|
-
|
|
306
|
+
With no argument it checks the development dependency (also run by `npm test`). It
|
|
307
|
+
loads that OpenClaw's own plugin registrar, hook runner, `resolvePromptBuildHookResult`
|
|
308
|
+
and `prepareCliTurnPromptContext`, registers this plugin through them, and checks that
|
|
309
|
+
the hook's prompt replaces OpenClaw's, that turn context stays in the user prompt, and
|
|
310
|
+
that OpenClaw refuses the hook without the grant. It also asserts on the CLI runner's
|
|
311
|
+
source that the hook context carries the provider, agent and workspace, that the hook
|
|
312
|
+
result reaches the turn context, and that only finalization follows. It does not run a
|
|
313
|
+
Claude CLI process. It uses a temporary state directory and changes nothing installed.
|
|
295
314
|
|
|
296
315
|
## Install and enroll
|
|
297
316
|
|
|
@@ -299,7 +318,7 @@ assembly, restores, and checks restored bytes against the vendor inventory.
|
|
|
299
318
|
npm ci
|
|
300
319
|
npm run preflight
|
|
301
320
|
npm pack
|
|
302
|
-
openclaw plugins install ./unblocklabs-unblock-codex-prompt-0.
|
|
321
|
+
openclaw plugins install ./unblocklabs-unblock-codex-prompt-0.5.0.tgz --force --accept-capabilities
|
|
303
322
|
```
|
|
304
323
|
|
|
305
324
|
Include the plugin in `plugins.allow` if applicable, then configure:
|
|
@@ -325,8 +344,8 @@ required; the key keeps its historical name, though identity files are now live.
|
|
|
325
344
|
Legacy `agentName` values remain accepted but are unused; identity comes from the
|
|
326
345
|
live agent documents. Existing remote fleet configurations need no changes.
|
|
327
346
|
Configurations without a remote URL or with base-only mode are no longer supported.
|
|
328
|
-
Codex-only enrollment needs no
|
|
329
|
-
|
|
347
|
+
Codex-only enrollment needs no hook grant; Claude CLI enrollment needs
|
|
348
|
+
`hooks.allowConversationAccess: true` with prompt injection not disabled (see [Claude CLI agents](#claude-cli-agents)). Initial enrollment enables daily shared-prompt refresh
|
|
330
349
|
and overdue startup catch-up. Startup never rebuilds local context or patches the
|
|
331
350
|
adapter. The optional model-catalog service can also refresh metadata.
|
|
332
351
|
|
|
@@ -516,8 +535,8 @@ openclaw codex-prompt restore
|
|
|
516
535
|
openclaw codex-prompt status
|
|
517
536
|
```
|
|
518
537
|
|
|
519
|
-
Restore recovers exact original adapter bytes (Codex package and
|
|
520
|
-
deactivates enrollment and restores the previous TOML pointer. It plans each adapter
|
|
538
|
+
Restore recovers exact original adapter bytes (the Codex package, and any 0.4 Claude
|
|
539
|
+
patch left in OpenClaw core), deactivates enrollment and restores the previous TOML pointer. It plans each adapter
|
|
521
540
|
first, validating its files and the backups it will write; an adapter is restored only
|
|
522
541
|
while any recorded file still holds the plugin's bytes. Restore then validates the
|
|
523
542
|
pointer and pauses enrollment, and only then removes the Codex catalog and skills
|
|
@@ -528,30 +547,38 @@ foreign edits. A receipt whose files are restored, superseded or otherwise no lo
|
|
|
528
547
|
hold the plugin's bytes never blocks a restore (its state is reported in the output
|
|
529
548
|
and in status). Restore retains backup, receipt and generated files as rollback
|
|
530
549
|
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
|
|
550
|
+
`appServer` settings to be supported. Restart and use fresh conversations to activate it
|
|
551
|
+
for Codex. Claude CLI turns use OpenClaw's prompt from the next turn, because the hook
|
|
552
|
+
reads the paused enrollment; a restart is needed only when a 0.4 core patch was removed.
|
|
532
553
|
Restore **before** disabling/uninstalling or changing target agents. Disabling
|
|
533
554
|
without restoring leaves the managed base but re-enables OpenClaw's generic injections.
|
|
534
555
|
|
|
556
|
+
### Rolling back to 0.4
|
|
557
|
+
|
|
558
|
+
0.4 manages Claude CLI through its OpenClaw core patch, and its final-adoption gate
|
|
559
|
+
blocks enrolled Claude runs whose prompt lacks it. Restore with 0.5 first, install 0.4,
|
|
560
|
+
then run its `sync` and restart the Gateway. The Codex adapter and the state format are
|
|
561
|
+
unchanged between 0.4 and 0.5.
|
|
562
|
+
|
|
535
563
|
### Rolling back to 0.3.x
|
|
536
564
|
|
|
537
|
-
1. With 0.
|
|
565
|
+
1. With 0.5 still installed, run `openclaw codex-prompt restore`. A restored enrollment
|
|
538
566
|
is saved in the state format 0.3 reads.
|
|
539
567
|
2. Restart the Gateway so the restored OpenClaw core and Codex package are loaded.
|
|
540
568
|
3. Install the 0.3.x plugin, then run its `sync` if you want it to manage the agent again.
|
|
541
569
|
|
|
542
570
|
0.3.x cannot manage Claude CLI agents. Any enrollment that includes Codex, with or
|
|
543
571
|
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
|
|
545
|
-
and
|
|
546
|
-
policy from its base file, and Claude renders OpenClaw's normal prompt.
|
|
547
|
-
Claude-only enrollment is refused by 0.3.x; install 0.
|
|
548
|
-
rewrites the state without the Claude runtime when it syncs or
|
|
549
|
-
|
|
550
|
-
Claude runs. A 0.4 snapshot uses a heading 0.3.x's daily refresh does not recognize, so
|
|
572
|
+
plugin is rolled back without restoring first, the Codex patch finds the older runtime
|
|
573
|
+
and falls back instead of failing turns: 0.3.x keeps managing Codex, which reads the
|
|
574
|
+
policy from its base file, and Claude renders OpenClaw's normal prompt (0.3.x registers
|
|
575
|
+
no Claude hook). An active Claude-only enrollment is refused by 0.3.x; install 0.5 again
|
|
576
|
+
and restore. 0.3.x rewrites the state without the Claude runtime when it syncs or
|
|
577
|
+
restores. A 0.4 or 0.5 snapshot uses a heading 0.3.x's daily refresh does not recognize, so
|
|
551
578
|
after rolling back, run 0.3.x's `sync` once to rebuild it. That sync reinstalls 0.3.x's
|
|
552
579
|
Codex patch and its frozen skills catalog; drain and restart after it, as after any
|
|
553
|
-
sync. Until then the
|
|
554
|
-
the patch, so it does not depend on the plugin runtime).
|
|
580
|
+
sync. Until then the current Codex patch keeps relaying the live catalog (the relay is
|
|
581
|
+
inline in the patch, so it does not depend on the plugin runtime).
|
|
555
582
|
|
|
556
583
|
## Safety and scope
|
|
557
584
|
|
|
@@ -564,15 +591,15 @@ the patch, so it does not depend on the plugin runtime).
|
|
|
564
591
|
- Do not run concurrent sync/install/restore operations. If a crash left an empty
|
|
565
592
|
lock directory, confirm no sync is running before removing it.
|
|
566
593
|
- A prompt guides behavior; it is not a security boundary or obedience guarantee.
|
|
567
|
-
- The fleet policy replaces OpenClaw's generic policy,
|
|
568
|
-
improvements are not inherited. Review upgrades.
|
|
594
|
+
- The fleet policy replaces OpenClaw's generic policy (on Claude CLI, OpenClaw's whole
|
|
595
|
+
system prompt), so upstream base-policy improvements are not inherited. Review upgrades.
|
|
569
596
|
- Never commit customer snapshots, raw captures, credentials or host backups.
|
|
570
597
|
|
|
571
598
|
## Development and release
|
|
572
599
|
|
|
573
600
|
```sh
|
|
574
601
|
npm run preflight
|
|
575
|
-
npm run release:check -- v0.
|
|
602
|
+
npm run release:check -- v0.5.0
|
|
576
603
|
```
|
|
577
604
|
|
|
578
605
|
Tests cover compilation, explicit refresh, native/private-body exclusion,
|
|
@@ -582,7 +609,7 @@ proof and limits.
|
|
|
582
609
|
|
|
583
610
|
Install with
|
|
584
611
|
the packed archive above for an unreleased candidate. After publication, use
|
|
585
|
-
`openclaw plugins install npm:@unblocklabs/unblock-codex-prompt@0.
|
|
612
|
+
`openclaw plugins install npm:@unblocklabs/unblock-codex-prompt@0.5.0 --accept-capabilities`.
|
|
586
613
|
The existing [GitHub Release workflow](RELEASING.md) publishes npm only when a
|
|
587
614
|
GitHub Release is published. Normal pushes do not release the package.
|
|
588
615
|
|
package/dist/claude-adapter.d.ts
CHANGED
|
@@ -1,44 +1,13 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
export declare const CLAUDE_ASSEMBLY_HASHES: {
|
|
4
|
-
readonly buildCliAgentSystemPrompt: "6b21cdba8192074f8014243b8f8588bdcf51f8dada2f52f61c1787c7d3a60eb3";
|
|
5
|
-
readonly buildConfiguredAgentSystemPrompt: "9f5a1c2923678008d7f276f7fc3af62af4e1cef8c5cc7678fcfe665d036e154a";
|
|
6
|
-
readonly buildAgentSystemPrompt: "c81eb1a28a58a943bc17cec18459a2080ebf411a92811dc61b868d574312aa86";
|
|
7
|
-
};
|
|
8
|
-
type Role = keyof typeof CLAUDE_ASSEMBLY_HASHES;
|
|
9
|
-
type Located = {
|
|
10
|
-
role: Role;
|
|
11
|
-
path: string;
|
|
12
|
-
node: FunctionDeclaration;
|
|
13
|
-
program: Program;
|
|
14
|
-
};
|
|
15
|
-
type Receipt = {
|
|
16
|
-
schema: 1;
|
|
17
|
-
openclawRoot: string;
|
|
18
|
-
openclawVersion: string;
|
|
19
|
-
files: PatchedFile[];
|
|
20
|
-
};
|
|
1
|
+
import { type RestorePlan } from "./patched-files.js";
|
|
2
|
+
/** "patched" while any recorded core file still holds the 0.4 patch: a leftover to remove. */
|
|
21
3
|
export declare function claudeAdapterOwnership(agentDir: string): Promise<import("./patched-files.js").Ownership>;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
sources: Map<string, string>;
|
|
27
|
-
located: Located[];
|
|
28
|
-
}>;
|
|
29
|
-
export declare function prepareClaudeAdapter(agentDir: string, agentId: string, runtimePath: string, root?: string): Promise<{
|
|
30
|
-
files: import("./patched-files.js").PreparedFile[];
|
|
31
|
-
receipt: Receipt;
|
|
32
|
-
previousReceipt: string | null;
|
|
33
|
-
staleBackups: Set<string>;
|
|
34
|
-
}>;
|
|
35
|
-
export declare function installClaudeAdapter(agentDir: string, plan: Awaited<ReturnType<typeof prepareClaudeAdapter>>): Promise<{
|
|
36
|
-
adapterChanged: boolean;
|
|
37
|
-
restartRequired: boolean;
|
|
38
|
-
}>;
|
|
39
|
-
/** Disk state: distinguishes missing (e.g. after an OpenClaw update) from foreign edits. */
|
|
4
|
+
/**
|
|
5
|
+
* Disk state of a 0.4 receipt's files; distinguishes missing (e.g. after an OpenClaw update) from
|
|
6
|
+
* foreign edits. `leftover` is true while any recorded file still holds the 0.4 patch bytes.
|
|
7
|
+
*/
|
|
40
8
|
export declare function claudeAdapterStatus(agentDir: string): Promise<{
|
|
41
9
|
installed: boolean;
|
|
10
|
+
leftover: boolean;
|
|
42
11
|
state: "absent";
|
|
43
12
|
openclawRoot?: never;
|
|
44
13
|
openclawVersion?: never;
|
|
@@ -46,13 +15,14 @@ export declare function claudeAdapterStatus(agentDir: string): Promise<{
|
|
|
46
15
|
coreIntegrity?: never;
|
|
47
16
|
} | {
|
|
48
17
|
installed: boolean;
|
|
18
|
+
leftover: boolean;
|
|
49
19
|
state: "changed" | "patched" | "partial" | "original" | "missing";
|
|
50
20
|
openclawRoot: string;
|
|
51
21
|
openclawVersion: string | undefined;
|
|
52
22
|
paths: string[];
|
|
53
23
|
coreIntegrity: string;
|
|
54
24
|
}>;
|
|
55
|
-
/** Validates every recorded chunk before any write; empty unless
|
|
25
|
+
/** Validates every recorded chunk and backup before any write; empty unless the 0.4 patch bytes are installed. */
|
|
56
26
|
export declare function planClaudeRestore(agentDir: string): Promise<RestorePlan>;
|
|
57
27
|
export declare function applyClaudeRestore(plan: RestorePlan): Promise<{
|
|
58
28
|
ownership: import("./patched-files.js").Ownership;
|
|
@@ -60,4 +30,3 @@ export declare function applyClaudeRestore(plan: RestorePlan): Promise<{
|
|
|
60
30
|
superseded: string[];
|
|
61
31
|
restartRequired: boolean;
|
|
62
32
|
}>;
|
|
63
|
-
export {};
|