From samocode
Runs OpenAI Codex CLI as a subagent for second opinions, code reviews, and questions. Useful when you want a different AI model's perspective.
How this skill is triggered — by the user, by Claude, or both
Slash command
/samocode:codexThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Run OpenAI Codex CLI (GPT-5.2) for second opinions and external reviews.
Run OpenAI Codex CLI (GPT-5.2) for second opinions and external reviews.
Before using Codex, verify it's installed:
which codex >/dev/null 2>&1 || echo "CODEX_NOT_INSTALLED"
If not installed, inform the user: "Codex CLI is not installed. Skipping Codex review."
OUTPUT_FILE=$(mktemp)
codex exec \
--skip-git-repo-check \
--dangerously-bypass-approvals-and-sandbox \
-o "$OUTPUT_FILE" \
"$PROMPT" </dev/null 2>/tmp/codex_stderr.log
cat "$OUTPUT_FILE"
rm "$OUTPUT_FILE"
| Flag | Purpose |
|---|---|
exec | Non-interactive mode |
--skip-git-repo-check | Run outside git repositories |
--dangerously-bypass-approvals-and-sandbox | No prompts, no sandbox restrictions |
-o <file> | Capture clean output to file |
</dev/null | Required. Close stdin — without it codex blocks on "Reading additional input from stdin..." and the -o file comes back empty (exit 0, zero bytes). Bites hardest in non-interactive / background Bash where there's no TTY. |
2>/tmp/codex_stderr.log | Send stderr to a file, not 2>/dev/null — if codex hangs or errors you need to see the stdin/auth message. Inspect the log when the output file is empty. |
Codex can take several minutes for complex prompts. Use 15 minute timeout:
timeout 900 codex exec --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox -o "$OUTPUT_FILE" "$PROMPT" </dev/null 2>/tmp/codex_stderr.log
OUTPUT_FILE=$(mktemp)
codex exec --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox -o "$OUTPUT_FILE" \
"What are the tradeoffs between Redis and Memcached for session storage?" 2>/dev/null
cat "$OUTPUT_FILE"
rm "$OUTPUT_FILE"
DIFF=$(git diff main...HEAD)
OUTPUT_FILE=$(mktemp)
codex exec --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox -o "$OUTPUT_FILE" \
"Review this diff for issues:
$DIFF
List concerns with severity (blocking/important/nice-to-have)." 2>/dev/null
cat "$OUTPUT_FILE"
rm "$OUTPUT_FILE"
OUTPUT_FILE=$(mktemp)
codex exec --dangerously-bypass-approvals-and-sandbox -C /path/to/repo -o "$OUTPUT_FILE" \
"Analyze the architecture of this codebase" 2>/dev/null
cat "$OUTPUT_FILE"
rm "$OUTPUT_FILE"
Codex has access to gh CLI. Pass the PR URL and let it fetch the diff:
OUTPUT_FILE=$(mktemp)
timeout 900 codex exec --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox -o "$OUTPUT_FILE" \
"Review this PR: https://github.com/owner/repo/pull/123
Use gh CLI to get the diff and review for issues." 2>/dev/null
cat "$OUTPUT_FILE"
rm "$OUTPUT_FILE"
/dev/null. Even with a prompt passed as an argument, codex exec reads stdin; in a non-interactive/background Bash call with no TTY it blocks ("Reading additional input from stdin...") and the -o output file ends up empty with exit code 0. The simpler usage examples above omit </dev/null — add it to every invocation.npx claudepluginhub yuvasee/samocodeConsults OpenAI Codex (GPT-5) via CLI for code investigation, debugging, or review. Runs read-only with full project access; activates on 'ask codex' phrases or /ask-codex.
Cross-model review using OpenAI Codex to independently verify plans or code diffs, iterating up to 5 rounds. Useful for architecture decisions, non-trivial refactors, and critical config changes.
Invokes OpenAI Codex and Google Gemini CLIs via Bash for second opinions, code reviews, and alternative analysis. Useful when users request external AI verification or explicitly say 'ask codex' or 'ask gemini'.