fix(hooks): PreCompact emits bare {} — Claude Code dropped the PreCompact envelope - #108
Merged
Merged
Conversation
…e PreCompact envelope
Claude Code tightened its hook stdout schema: the hookSpecificOutput
union now only accepts hookEventName in {PreToolUse, UserPromptSubmit,
PostToolUse, PostToolBatch, Stop, SubagentStop}. There is no PreCompact
variant, so our old {"hookSpecificOutput": {"hookEventName": "PreCompact"}}
(and the {"suppressOutput": true} shape) now fails validation:
PreCompact [simba hook PreCompact] failed: Hook JSON output validation
failed -- (root): Invalid input
All top-level fields are optional, so the only shape guaranteed to
validate is a bare {}. claude.render's PreCompact branch now always
returns {} regardless of suppress_output/additional_context; stderr
remains the channel for human-visible notes. Other events' envelopes
are unchanged.
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.
What
Claude Code tightened its hook stdout schema: the
hookSpecificOutputunion no longer has aPreCompactvariant, so the previous envelope{"hookSpecificOutput": {"hookEventName": "PreCompact"}}now fails validation:The PreCompact render path now emits a bare
{}(every top-level field is optional), which is valid under both the old and new schemas. stderr remains the human-visible channel; the export/distill work itself is unchanged.Changes
src/simba/harness/adapters/claude.py— the PreCompact branch returns{}unconditionally (neversuppressOutput, never ahookSpecificOutputenvelope).src/simba/hooks/_io.py— docstring carve-out: PreCompact no longer has an envelope variant and never calls into this module.Notes
.codex/hooks.jsonalso registers PreCompact through this same render path; a bare{}is an inert no-op there too.CanonicalResult.suppress_outputis still used by the internalhook-canonicaldebugging surface; intentionally untouched.