Problem
claude -p called from the Bash tool inside a Claude Code session exits 0 but produces zero bytes of stdout. The Seatbelt nesting bypass (CLAUDE_SANDBOX_ACTIVE + unset CLAUDECODE) works correctly — no sandbox or nesting errors. But output is lost.
Context
Another session needs claude -p as a semantic layer inside a UserPromptSubmit hook (learning injection via haiku). The sandbox fix on branch fix/nested-seatbelt-bypass resolved the kernel-level nesting error, but stdout capture remains broken.
Definition of Success
From inside a running Claude Code session, this Bash tool call:
echo '{"prompt":"test"}' | claude -p --model haiku --max-turns 1 --output-format text
Must:
- Exit 0
- Print non-empty text to stdout (any response from haiku)
- Complete in under 15 seconds
- Work without manual env overrides (no
env -u CLAUDECODE, no unset prefix)
Evidence
Tested on branch fix/nested-seatbelt-bypass with CLAUDE_SANDBOX_ACTIVE=1 confirmed in env:
| Criteria |
Result |
| Exit 0 |
✅ |
| Non-empty stdout |
❌ Empty (0 bytes) |
| Complete in <15s |
✅ |
| No manual env overrides |
✅ |
Hypothesis
Claude Code may redirect or suppress child claude process stdout when invoked from the Bash tool. This is separate from the Seatbelt sandbox issue — it's Claude Code internal output handling.
Acceptance Criteria
Problem
claude -pcalled from the Bash tool inside a Claude Code session exits 0 but produces zero bytes of stdout. The Seatbelt nesting bypass (CLAUDE_SANDBOX_ACTIVE+unset CLAUDECODE) works correctly — no sandbox or nesting errors. But output is lost.Context
Another session needs
claude -pas a semantic layer inside aUserPromptSubmithook (learning injection via haiku). The sandbox fix on branchfix/nested-seatbelt-bypassresolved the kernel-level nesting error, but stdout capture remains broken.Definition of Success
From inside a running Claude Code session, this Bash tool call:
Must:
env -u CLAUDECODE, nounsetprefix)Evidence
Tested on branch
fix/nested-seatbelt-bypasswithCLAUDE_SANDBOX_ACTIVE=1confirmed in env:Hypothesis
Claude Code may redirect or suppress child
claudeprocess stdout when invoked from the Bash tool. This is separate from the Seatbelt sandbox issue — it's Claude Code internal output handling.Acceptance Criteria
claude -pproduces non-empty stdout when called from Bash tool