Haiku asks clarifying questions in -p (print) mode instead of executing
Description
When using claude -p (print/non-interactive mode) with --dangerously-skip-permissions and --model claude-haiku-4-5, the model sometimes asks a clarifying question instead of executing the task, producing zero output files.
Reproduction
mkdir /tmp/cc-test && cd /tmp/cc-test
cat > TASK.md << 'EOF'
# Task: Build a Python CLI Todo App
Build a complete CLI todo application with argparse, persistence, tests (12+), type hints.
EOF
claude -p "Read TASK.md and implement everything it asks for. Write all files and run the tests." \
--model claude-haiku-4-5 \
--max-turns 15 \
--dangerously-skip-permissions \
--output-format text
Expected behavior
In -p mode, the model should execute the task and produce output files, not ask clarifying questions. The docs describe -p as "Print response without interactive mode" — there's no stdin to receive answers, so asking questions is a dead end.
Actual behavior (intermittent)
On ~1 in 3 runs, Haiku outputs a design proposal and asks "Does this approach look right? Should I proceed?" instead of writing code. No files are created. The same prompt on the same model via a different harness (D.U.H.) executes successfully 3/3 times, suggesting the system prompt could be more directive in print mode.
Environment
- Claude Code version: 2.1.109
- Model: claude-haiku-4-5
- OS: macOS (Apple Silicon)
- Flags:
-p --dangerously-skip-permissions --max-turns 15
Notes
This may be a system prompt issue rather than a CLI bug — the model needs stronger instruction to execute rather than deliberate when running in non-interactive mode. Alternatively, -p mode could append something like "Do not ask clarifying questions — execute the task directly" to the system prompt.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗