codex-background-stdin-close

Launch Codex CLI background runs in Hermes when Codex hangs at `Reading additional input from stdin...`; use explicit process stdin close and isolated worktrees.

5 stars

Best use case

codex-background-stdin-close is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Launch Codex CLI background runs in Hermes when Codex hangs at `Reading additional input from stdin...`; use explicit process stdin close and isolated worktrees.

Teams using codex-background-stdin-close should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/codex-background-stdin-close/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/autonomous-ai-agents/codex-background-stdin-close/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/codex-background-stdin-close/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How codex-background-stdin-close Compares

Feature / Agentcodex-background-stdin-closeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Launch Codex CLI background runs in Hermes when Codex hangs at `Reading additional input from stdin...`; use explicit process stdin close and isolated worktrees.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Codex Background Stdin Close Pattern

## Class of task

Use this skill when launching non-interactive Codex CLI execution from Hermes, especially for long-running implementation lanes or quota-burn batches in isolated worktrees.

## Trigger conditions

- `codex exec ...` prints `Reading additional input from stdin...` and appears to hang.
- `< /dev/null`, an empty pipe, or PTY launch does not make Codex proceed.
- The task is a background Codex implementation/review lane that should continue while Hermes does other work.
- Multiple Codex lanes are running and duplicate/stale launches must be avoided.

## Reliable Hermes launch pattern

1. Put the prompt in a file when it is long:
   ```bash
   cat > /tmp/codex-issue-NNN.md <<'EOF'
   ...self-contained prompt...
   EOF
   ```

2. Launch Codex as a Hermes-tracked background process, without shell stdin redirection:
   ```python
   terminal(
     command='codex exec -c model_reasoning_effort="high" --dangerously-bypass-approvals-and-sandbox --cd /path/to/worktree "$(cat /tmp/codex-issue-NNN.md)"',
     background=True,
     notify_on_complete=True,
   )
   ```

3. Immediately close stdin for the returned session:
   ```python
   process(action='close', session_id='proc_...')
   ```

4. Monitor with:
   ```python
   process(action='poll', session_id='proc_...')
   process(action='log', session_id='proc_...', limit=200)
   ```

5. If the run remains stuck at the stdin message, kill the Hermes process session and relaunch once with the same pattern. Do not launch duplicates before checking OS-level `ps`, worktree git state, and logs.

## Scope and safety rules

- Use isolated worktrees/clones for each issue lane.
- Verify the issue is `status:plan-approved` before implementation; otherwise do planning/review only.
- Use `--dangerously-bypass-approvals-and-sandbox` only when the user has authorized autonomous execution and the worktree scope is isolated. Record the sandbox failure reason, such as `bwrap: loopback: Failed RTM_NEWADDR`.
- Do not force-push.
- Require final output or handoff to include issue number, branch, commit SHA(s), validation commands/results, push status, issue URL, and blockers.
- On remote/overflow machines, CLI presence and auth files are not enough. Before assigning a Codex burn lane, run a tiny real `codex exec` smoke through the same login shell/launch path. A worker may have `codex --version` and `~/.codex/` present but still fail with `401 Unauthorized` / `Failed to refresh token: refresh token was already used`.
- If a remote worker falls back to Codex and produces a branch for an issue that another Codex lane also touched, do **not** push blindly. First compare commit/file scope against the already-pushed branch and choose one canonical branch/PR; treat the other as a salvage/reference artifact.

## Why this exists

In workspace-hub on 2026-04-27, Codex CLI 0.125 repeatedly hung at `Reading additional input from stdin...` with `< /dev/null`, `printf "" |`, and PTY launches. Starting the run as a Hermes background process and explicitly closing stdin with `process close` allowed it to proceed.

Related Skills

flywheel-closeout

5
from vamseeachanta/workspace-hub

Use this at the end of substantial repo or agent waves to convert evidence-backed lessons into proposed durable assets: skills, scripts, rules/checks, prompt templates, docs, or issues. Always use it when the user mentions flywheel, wave closeout, repo ecosystem learning, durable asset promotion, or learning-to-tools.

verify-Codex-run-commit-vs-working-tree-before-closing

5
from vamseeachanta/workspace-hub

After a Codex implementation run, verify the claimed file set against the actual commit and working tree before treating the issue as fully complete.

extract-skills-from-Codex-sessions

5
from vamseeachanta/workspace-hub

Automatically extract reusable skills from Codex session transcripts using LLM analysis and wire them into a Stop hook

interactive-Codex-to-file-based-fallback

5
from vamseeachanta/workspace-hub

Switch from tmux/interactive Codex to file-based Codex -p execution when interactive runs fail with upstream errors or analysis-only stalls, then verify landing from git/GitHub state.

exclude-wiki-Codex-md-from-harness-line-limit-hook

5
from vamseeachanta/workspace-hub

Fix false-positive pre-commit failures where workspace-hub's AGENTS.md line-limit hook blocks edits to auto-generated wiki schema files under knowledge/wikis/.

session-start-dirty-state-triage-with-background-agents

5
from vamseeachanta/workspace-hub

Distinguish real implementation dirt from generated session-state churn when resuming a repo with active overnight/background agents.

overnight-worktree-Codex-noop-recovery

5
from vamseeachanta/workspace-hub

Recover overnight Codex worktree batches that appear to succeed but produce no artifacts; harden rerun prompts and launch commands.

overnight-verify-close-and-blocker-conversion

5
from vamseeachanta/workspace-hub

Use overnight Codex lanes to clear stale-open GitHub issues by verification-first closure, and convert blocked PR-repair attempts into dedicated blocker issues instead of speculative edits.

orcawave-orcaflex-semantic-proof-wave-closeout

5
from vamseeachanta/workspace-hub

Close out an OrcaWave/OrcaFlex semantic-proof wave after a PR merges, split unrelated CI blockers, and seed the next semantic-proof issue wave without duplicating existing issues.

codex-skill-loader-broken-symlink-recovery

5
from vamseeachanta/workspace-hub

Diagnose Codex startup failures in workspace-hub caused by a broken `.Codex/skills/skills` symlink and recover without misattributing the failure to issue scope.

Codex-quota-failover-to-codex-for-overnight-plan-lanes

5
from vamseeachanta/workspace-hub

Recover an overnight multi-worktree planning wave when some Codex lanes hit quota by relaunching only the failed lanes with Codex in the same isolated worktrees and prompt files.

background-Codex-worktree-absolute-path-launch

5
from vamseeachanta/workspace-hub

Prevent overnight/background Codex worker launch failures in git worktrees by using absolute prompt/log paths and immediate post-launch polling.