Summary
External memory systems (e.g. Mimir) need to persist the user/assistant exchange at the end of a turn. The current Stop hook only exposes last_assistant_message and a transcript_path, which forces integrations to parse the Codex JSONL transcript themselves.
Request
Include an inline messages array in the Stop and SubagentStop hook payloads, containing the recent user/assistant exchange. This would make Codex easier to integrate with external memory systems without requiring them to parse transcript_path.
This request mirrors the interface introduced in MoonshotAI/kimi-code#1299.
Proposed schema
{
"messages": [
{ "role": "user", "content": "..." },
{ "role": "assistant", "content": "..." }
]
}
messages should be optional to preserve backward compatibility.
Reference implementation
I have implemented this on a fork at Liewzheng/codex in the branch mimir-stop-messages (see Liewzheng/codex@main...mimir-stop-messages). The changes include:
- Added
StopMessage { role, content } to codex-rs/hooks/src/schema.rs.
- Added an optional
messages field to StopCommandInput and SubagentStopCommandInput.
- Populated
messages from the last user/assistant entries in the JSONL transcript when the caller does not provide them inline.
- Updated
codex-rs/core/src/hook_runtime.rs to thread messages into the Stop request.
- Regenerated schema fixtures for
stop.command.input and subagent-stop.command.input.
- Added unit tests for the transcript fallback.
I'd be happy to open a PR, but I see this repository currently restricts pull requests to collaborators. Please let me know if you'd like me to provide the patch in another format or if there's a process for external contributors.
Summary
External memory systems (e.g. Mimir) need to persist the user/assistant exchange at the end of a turn. The current Stop hook only exposes
last_assistant_messageand atranscript_path, which forces integrations to parse the Codex JSONL transcript themselves.Request
Include an inline
messagesarray in theStopandSubagentStophook payloads, containing the recent user/assistant exchange. This would make Codex easier to integrate with external memory systems without requiring them to parsetranscript_path.This request mirrors the interface introduced in MoonshotAI/kimi-code#1299.
Proposed schema
{ "messages": [ { "role": "user", "content": "..." }, { "role": "assistant", "content": "..." } ] }messagesshould be optional to preserve backward compatibility.Reference implementation
I have implemented this on a fork at
Liewzheng/codexin the branchmimir-stop-messages(see Liewzheng/codex@main...mimir-stop-messages). The changes include:StopMessage { role, content }tocodex-rs/hooks/src/schema.rs.messagesfield toStopCommandInputandSubagentStopCommandInput.messagesfrom the last user/assistant entries in the JSONL transcript when the caller does not provide them inline.codex-rs/core/src/hook_runtime.rsto threadmessagesinto the Stop request.stop.command.inputandsubagent-stop.command.input.I'd be happy to open a PR, but I see this repository currently restricts pull requests to collaborators. Please let me know if you'd like me to provide the patch in another format or if there's a process for external contributors.