What happened?
hooks_cli.py claims to support both claude-code and codex harnesses, but _count_human_messages() appears to only count transcript entries shaped like:
{"message": {"role": "user", "content": "..."}}
That matches the Claude-style transcript shape, but it does not match the Codex session format already handled in normalize.py, where user messages are parsed from event_msg entries with payload.type == "user_message".
As a result, Codex hook message counting may stay at 0 or undercount user turns, which means the stop hook auto-save threshold may never trigger correctly for Codex sessions.
What did you expect?
If hooks_cli.py supports the codex harness, it should count user turns from the Codex transcript schema correctly, so stop-hook checkpointing works the same way it does for Claude-compatible transcripts.
How to reproduce:
- Inspect
mempalace/hooks_cli.py and note that _count_human_messages() only looks for entry["message"]["role"] == "user"
- Inspect
mempalace/normalize.py and note that Codex sessions are parsed from event_msg entries with payload.type == "user_message"
- Run the stop hook against a Codex transcript using the Codex schema
- Observe that user messages may not be counted correctly, so the save interval logic does not trigger as expected
Environment:
- OS: macOS
- Python version: 3.12
- MemPal version: 3.0.14
What happened?
hooks_cli.py claims to support both
claude-codeandcodexharnesses, but_count_human_messages()appears to only count transcript entries shaped like:{"message": {"role": "user", "content": "..."}}That matches the Claude-style transcript shape, but it does not match the Codex session format already handled in
normalize.py, where user messages are parsed fromevent_msgentries withpayload.type == "user_message".As a result, Codex hook message counting may stay at 0 or undercount user turns, which means the stop hook auto-save threshold may never trigger correctly for Codex sessions.
What did you expect?
If
hooks_cli.pysupports thecodexharness, it should count user turns from the Codex transcript schema correctly, so stop-hook checkpointing works the same way it does for Claude-compatible transcripts.How to reproduce:
mempalace/hooks_cli.pyand note that_count_human_messages()only looks forentry["message"]["role"] == "user"mempalace/normalize.pyand note that Codex sessions are parsed fromevent_msgentries withpayload.type == "user_message"Environment: