Skip to main content

Module codex

Module codex 

Source
Expand description

Codex runtime: build the codex CLI invocation for a resident agent.

Codex (0.120.0+) has no --append-system-prompt / --base-instructions-file flag. We pass the rendered netsky prompt as codex’s positional [PROMPT] arg instead, read at exec time from $NETSKY_PROMPT_FILE via the same $(cat ...) shell trick the claude runtime uses to avoid tmux’s command too long argv limit.

The rendered prompt includes the full base.md + per-agent identity stanza + cwd addendum, so the Codex session receives the same “you are agent” shape Claude does. The separate sidecar path in codex_agent.rs remains for one-off prompt / drain invocations; the resident path lives here.

Startup (/up) parity: codex’s positional [PROMPT] arg is already spoken for by the rendered netsky prompt — codex treats it as the first user turn. The startup prompt therefore lands as a follow-on user turn, pasted into the tmux pane via paste_startup once the session is up. Claude passes startup inline as a second positional.

Structs§

CodexConfig
Per-agent codex-CLI configuration.
TmuxPaneIo
Live PaneIo that shells out to the tmux CLI. Used by the production post_spawn hook.

Constants§

CODEX_BIN

Traits§

PaneIo
Minimal pane-IO abstraction used by paste_startup. A live impl (TmuxPaneIo) shells out to tmux; tests provide a mock that records calls and simulates capture output.

Functions§

paste_startup
Paste startup into a live codex tmux pane as a follow-on user turn. Dismisses codex’s per-cwd “Do you trust” dialog if present, then retries send-text + send-Enter until capture echoes the text or attempts is exhausted. Matches the retry pattern in bin/test-resident-codex (the smoke test paste of netsky channel drain).