codex-cli-runtime skill should instruct agents to use --prompt-file for shell-safe prompt passing
Problem
The codex-cli-runtime skill instructs the codex:codex-rescue subagent to pass task prompts as positional arguments:
node "$CODEX_COMPANION" task "<raw arguments>"
When the prompt contains shell metacharacters (backticks, ${}, (), file paths), zsh interprets them before node receives the argument. This causes the Codex task to fail silently.
Observed errors
(eval):1: permission denied: app/services/results/serial_codes/destroy_service.rb
(eval):1: command not found: find_serial_code
(eval):1: no matches found: .record_limit(count)
(eval):1: parse error near `}'
(eval):1: parse error in command substitution
Root cause
The skill definition (skills/codex-cli-runtime/skill.md) only mentions positional argument passing. However, codex-companion.mjs already supports --prompt-file (line 614, readTaskPrompt function) and piped stdin (readStdinIfPiped).
Suggested fix
Update skills/codex-cli-runtime/skill.md to instruct agents to:
- Write the prompt to a temp file
- Pass it via
--prompt-file /path/to/fileinstead of as a positional argument
This avoids shell metacharacter expansion entirely.
Environment
- Claude Code 2.1.185
- codex plugin 1.0.4
- macOS (zsh)
This is the Windows side of the same problem, where the limit is length and not only quoting, plus a gap in the suggested fix.
Length. On Windows the Bash tool's text reaches bash.exe -c through a runtime that cuts it at 8186 characters with no error (git-for-windows/git#6516). In a clean session about 900 of those are used before the command starts, which leaves room for about 7300. A longer prompt on the command line fails with unexpected EOF while looking for matching, which says nothing about length. agents/codex-rescue.md says to use exactly one Bash call (line 22) and to keep the task text as-is (line 40), and skills/codex-cli-runtime/SKILL.md shows task "<raw arguments>" (line 12), so a long prompt runs straight into this. #777 is a different failure from the same habit, on macOS.
The gap. The agent has tools: Bash and nothing else (line 5), and only one Bash call. Writing the prompt to a file in that call puts the same text on its command line, and a heredoc is part of that command, so telling the agent to write a temp file doesn't help on Windows. The open PRs also pull in opposite directions: #399 documents --prompt-file, and #692 forbids prompt files written with node, fs or heredocs and requires inline prompts.
What works. The caller writes the file and the request only names it. codex:codex-rescue told to run task --prompt-file <path> got a 6 KB prompt through on plugin 1.0.6, Windows 11.
So either add Write to the agent's tools and tell it to write the text to a temporary file before its one Bash call, or have the calling command write the file and forward only the path.