feat(codexcli): add PostCompact hook event and preserve prompt frontmatter - #1895
Merged
Merged
Conversation
…atter Part A: add the PostCompact Codex CLI hook event (matcher applied to trigger: manual/auto), distinct from PreCompact. Wire it through the canonical HookEvent union, CODEXCLI_HOOK_EVENTS, and the Codex CLI event-name maps. Part B: preserve description and argument-hint frontmatter on Codex CLI custom prompts across generate and import, modeling frontmatter with z.looseObject like other command adapters. Closes #1879 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
@dyoshikawa Thank you! |
Merged
This was referenced Jul 31, 2026
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.
Summary
Follow up on Codex CLI upstream updates from issue #1879.
Part A —
PostCompacthook eventCodex CLI documents a
PostCompacthook event that runs after Codex compacts the conversation, with thematcherapplied to thetrigger(manual/auto). This is distinct from the already-supportedPreCompact.postCompactto the canonicalHookEventunion.postCompacttoCODEXCLI_HOOK_EVENTS(afterpreCompact).postCompact: "PostCompact"toCANONICAL_TO_CODEXCLI_EVENT_NAMES; the reverse map is derived automatically. No other tool documents this event, so no other tool map was touched.codexcli-hooks.tsread these constants generically, so no further wiring was needed.Part B — preserve
description/argument-hinton Codex CLI custom prompts (fully implemented)Codex custom prompts support
description:andargument-hint:frontmatter, which the adapter previously discarded on both generate and import. The adapter now models its frontmatter withz.looseObject(consistent withclaudecode-command.ts), reads these fields infromFile, re-emits them infromRulesyncCommand, and round-tripsdescription(canonical) andargument-hint(under thecodexclisection) intoRulesyncCommand. Prompts without metadata stay as plain Markdown bodies (no empty frontmatter is emitted).Files changed
src/types/hooks.ts— addpostCompactevent + Codex CLI mappingsrc/types/hooks.test.ts— Codex CLI event-naming + map-completeness testssrc/features/hooks/codexcli-hooks.test.ts—postCompact⇄PostCompactround-trip testssrc/features/commands/codexcli-command.ts— frontmatter support fordescription/argument-hintsrc/features/commands/codexcli-command.test.ts— frontmatter round-trip testsdocs/reference/file-formats.md—postCompactmatrix row (Codex CLI only) +codexclicommand frontmatter exampleskills/rulesync/file-formats.md— auto-synced fromdocs/Validation evidence
description/argument-hint): https://developers.openai.com/codex/custom-promptsChecks
pnpm cicheckis fully green: format, oxlint, typecheck, 6409 tests passing, skill-docs sync, cspell, secretlint all clean.Closes #1879
Related issue: #1879
🤖 Generated with Claude Code