UserPromptSubmit hook that blocks execution until you review and approve the prompt in the Local Composer. Because Codex does not expose a direct same-session dispatch API, approved prompts are delivered via clipboard fallback.
Verified version
EISPATCH v1.1.0 is verified withcodex-cli 0.169.0.
Installation
Run the installer from the cloned repository:What the installer writes
The installer modifies~/.codex/ and adds the following:
- MCP server in
~/.codex/config.tomlundermcp_servers.eispatch. - UserPromptSubmit hook registered in the host.
- Skill installed to
~/.agents/skills/eispatch/.
Hook flow
When you submit a prompt, the hook reads JSON from stdin containing at leastprompt, session_id, and cwd. On trigger it follows this flow:
1
Intercept
The hook matches the trigger prefix and identifies that EISPATCH should handle the prompt.
2
Launch Local Composer
A detached process spawns
core/launch-local-composer.mjs with --host codex, the prompt, workspace path, and a temporary ready-file path.3
Wait for ready signal
The hook waits up to 2.5 seconds for the ready file to contain a JSON object with
url, port, and pid.4
Block and respond
The hook outputs a block JSON containing
composerUrl so Codex can present the launcher URL.Block JSON example
dispatch_compose or by running npm run preview.
Clipboard fallback flow
1
Launch
Open the Local Composer URL from the block message or start it with
npm run preview.2
Review
Review discovered capabilities, edit the final prompt, and click Approve.
3
Dispatch
Click Dispatch to copy the approved prompt to your clipboard.
4
Paste and submit
Paste the prompt into Codex and submit it. Prompts containing the compiled marker (
<!-- DISPATCH_COMPILED_PROMPT) pass through the hook automatically.Local Composer server
The Codex adapter uses the shared hardened Local Composer server (core/local-composer.mjs). It binds to 127.0.0.1 on an ephemeral port, requires a per-session token (401 if missing or wrong), and rejects requests whose Host, Origin, or Referer does not match the loopback address (403). Dispatch requires a one-time approval token bound to the SHA-256 hash of the approved prompt; missing or invalid approvals return 403, and replay or tampering returns 409. The hook’s launcher closes the server after 30 minutes without requests.
Codex has no session injection API in EISPATCH, so dispatch always uses clipboard fallback. Native same-session dispatch is available only in Antigravity.