Skip to content

Commit 22f2d1a

Browse files
committed
docs(codex): document native model lifecycle hooks
1 parent dbdf286 commit 22f2d1a

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎docs/concepts/agent-loop.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ These run inside the agent loop or gateway pipeline:
9595
- **`before_agent_start`**: legacy compatibility hook that may run in either phase; prefer the explicit hooks above.
9696
- **`before_agent_reply`**: runs after inline actions and before the LLM call, letting a plugin claim the turn and return a synthetic reply or silence the turn entirely.
9797
- **`agent_end`**: inspect the final message list and run metadata after completion.
98+
- **`llm_input` / `llm_output`**: observe the model input and output shape that the active OpenClaw harness can report.
9899
- **`before_compaction` / `after_compaction`**: observe or annotate compaction cycles.
99100
- **`before_tool_call` / `after_tool_call`**: intercept tool params/results.
100101
- **`before_install`**: inspect built-in scan findings and optionally block skill or plugin installs.
@@ -117,6 +118,9 @@ See [Plugin hooks](/plugins/architecture-internals#provider-runtime-hooks) for t
117118
Harnesses may adapt these hooks differently. The Codex app-server harness keeps
118119
OpenClaw plugin hooks as the compatibility contract for documented mirrored
119120
surfaces, while Codex native hooks remain a separate lower-level Codex mechanism.
121+
Codex native `PreModelRequest` and `PostModelResponse` hooks, when available,
122+
are Codex command hooks and do not replace OpenClaw plugin `llm_input` or
123+
`llm_output`.
120124

121125
## Streaming + partial replies
122126

‎docs/plugins/codex-harness.md‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,17 @@ thread unless Codex exposes that operation through app-server or native hook
530530
callbacks.
531531

532532
When newer Codex app-server builds expose native compaction and model lifecycle
533-
hook events, OpenClaw should version-gate that protocol support and map the
534-
events into the existing OpenClaw hook contract where the semantics are honest.
535-
Until then, OpenClaw's `before_compaction`, `after_compaction`, `llm_input`, and
536-
`llm_output` events are adapter-level observations, not byte-for-byte captures
537-
of Codex's internal request or compaction payloads.
533+
hook events, OpenClaw version-gates that protocol support and maps events into
534+
the existing OpenClaw hook contract where the semantics are honest. The
535+
OpenClaw `before_compaction`, `after_compaction`, `llm_input`, and `llm_output`
536+
events remain adapter-level observations, not byte-for-byte captures of Codex's
537+
internal request or compaction payloads.
538+
539+
Codex native `PreModelRequest` and `PostModelResponse` hooks are lower-level
540+
Codex command hooks. They run inside Codex around native model requests, using
541+
Codex hook configuration. OpenClaw's plugin `llm_input` and `llm_output` hooks
542+
remain OpenClaw adapter events for plugin compatibility, and OpenClaw does not
543+
double-fire them just because native Codex model lifecycle hooks are available.
538544

539545
## Tools, media, and compaction
540546

0 commit comments

Comments
 (0)