Skip to main content
Codex reports its lifecycle through mcp_tool hooks that call codex_hook_event. The installer sets this up:

Manual setup

~/.codex/config.toml
These three hooks are the minimum for threads and runs to appear in Quaero. They send metadata only. Each hook’s server value must match the server name in config.toml.
~/.codex/hooks.json
To fill the agent’s Chat tab with prompts and replies, also add chat_hook_event hooks (Hooks and capture).

What each event does

Thread routing

One Codex process can run several conversations over one MCP connection. Slaunt keeps them apart using the params._meta.threadId Codex attaches to every request, including ordinary tool calls.
  • Same threadId means same Slaunt thread and run; a different one means a different thread.
  • Calls with no selector belong to the connection’s own runtime, separate from every hook thread, and need their own thread_begin.
  • To get a new Codex thread, start a new conversation. new_thread: true on a hook thread is rejected.
  • A bridge that can’t forward threadId can send the native ID as _meta["ai.slaunt/codex-session-id"] or the X-Slaunt-Codex-Session-Id header. If both are present they must match.
  • Don’t combine Codex selectors with the generic boundary headers; the request is rejected with -32602.