feat: pass hooks through natively for codex instead of degrading to prose - #10
Merged
Conversation
…rose Codex plugins do support native hooks: the default hook file is hooks/hooks.json at the plugin root with a Claude-compatible schema — same events (SessionStart/Stop/PreCompact and more, incl. SubagentStart), matchers, type:command, additionalContextLimit. Verified against https://developers.openai.com/plugins/build/plugins and https://learn.chatgpt.com/docs/hooks. convertHooks(codex) now emits hooks/hooks.json losslessly (fields beyond our HookEntry type survive since the scanner keeps the parsed JSON) and warns that plugin hooks are non-managed (users trust via /hooks). The AGENTS.md degradation path remains for opencode only; the PreCompact inclusion and timing phrases from the previous commit still apply there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #9 (this commit was pushed after the merge).
Codex plugins support native hooks — default file
hooks/hooks.jsonat the plugin root, Claude-compatible schema: same events (incl.SessionStart/Stop/PreCompact/SubagentStart), matchers,type:command,additionalContextLimit. Sources: plugins guide ("The default plugin hook file is hooks/hooks.json … you don't need a hooks entry in .codex-plugin/plugin.json") and the hooks reference.So
convertHooks(codex)now passes hooks through losslessly tohooks/hooks.json(fields beyond ourHookEntrytype survive since the scanner keeps parsed JSON; Codex itself skips non-command handler types) and warns that plugin hooks are non-managed (/hookstrust review). The AGENTS.md prose degradation stays for opencode only, where #9's PreCompact inclusion and timing phrases still apply. README capability table updated.Verified end-to-end on the llmdoc plugin surface: all three hook events land in
hooks/hooks.jsonwithadditionalContextLimit: 1200intact, no AGENTS.md fallback. 92 tests pass (2 new passthrough tests; degradation tests moved to opencode).