Bug: Prompts starting with --- are parsed as CLI options, crashing the launch
Problem
When launching Claude Code via agentctl launch claude-code -p "<prompt>" where the prompt content begins with --- (e.g., YAML frontmatter from a spec file), Claude Code's argument parser interprets --- as an invalid CLI option flag and exits immediately:
error: unknown option '---
The session never starts. agentctl reports success ("Launched session pending-XXXXX") because the process was spawned, but it exits immediately with an arg parse error.
Reproduction
agentctl launch claude-code --cwd /tmp/test -p "---
title: test
---
Build this."
Impact
- Silent failure — agentctl reports success but no work happens
- Discovered after two wasted launches (dashboard-redesign and unified-feed)
- Any prompt containing a spec file with YAML frontmatter will fail
Suggested Fixes
In agentctl (workaround):
- Prefix prompts that start with
- with a newline or space to prevent arg parser confusion
- Or write the prompt to a temp file and use
--prompt-file if Claude Code supports it
In Claude Code (root cause):
- The
--print -p argument should not be parsed for sub-options. Everything after -p should be treated as literal prompt text.
Environment
- agentctl 1.5.2
- Claude Code 2.1.52
Bug: Prompts starting with
---are parsed as CLI options, crashing the launchProblem
When launching Claude Code via
agentctl launch claude-code -p "<prompt>"where the prompt content begins with---(e.g., YAML frontmatter from a spec file), Claude Code's argument parser interprets---as an invalid CLI option flag and exits immediately:The session never starts. agentctl reports success ("Launched session pending-XXXXX") because the process was spawned, but it exits immediately with an arg parse error.
Reproduction
Impact
Suggested Fixes
In agentctl (workaround):
-with a newline or space to prevent arg parser confusion--prompt-fileif Claude Code supports itIn Claude Code (root cause):
--print -pargument should not be parsed for sub-options. Everything after-pshould be treated as literal prompt text.Environment