Codex JSON-RPC Daemon
Overview
Use this skill to implement a TypeScript/Node.js remote backend daemon and client that are protocol-compatible with the Rust CodexMonitor implementation. The full specification is in references/codex-jsonrpc-typescript-spec.md.
Implementation workflow
- •Implement TCP server with line-delimited JSON framing.
- •Add auth gating (
authfirst) and error responses. - •Implement workspace/worktree CRUD and persistence.
- •Spawn and proxy
codex app-serversessions per workspace. - •Broadcast app-server events to all authenticated clients.
- •Implement the TypeScript client wrapper for calls and notifications.
- •Verify method names, params, and error messages match spec.
Protocol checklist
- •One JSON object per line; ignore blank or invalid JSON.
- •No response if request has no numeric
id. - •Responses are
{id,result}or{id,error:{message}}with exact messages. - •Notifications:
app-server-event(snakeworkspace_id) and optionalterminal-output.
Codex app-server proxy rules
- •Initialize app-server on spawn and emit
codex/connectedevent. - •Map accessMode to sandboxPolicy and approvalPolicy exactly.
- •Proxy thread/turn/review/model/skills methods as raw JSON.
Persistence
- •
workspaces.jsonandsettings.jsonin dataDir. - •Atomic writes after each mutation.
References
- •
references/codex-jsonrpc-typescript-spec.mdcontains the full spec.