chief icon indicating copy to clipboard operation
chief copied to clipboard

Bug: chief new prompt truncated on Windows (Arm64) — only title line reaches Claude

Open MGundersen opened this issue 8 months ago • 0 comments

Bug Description

chief new on Windows passes only the first line (# Chief PRD Generator) to Claude instead of the full ~7KB
prompt. Claude responds with a generic "what would you like help with?" message and no prd.md is created.

Works correctly on macOS.

Root Cause

InteractiveCommand in internal/agent/claude.go passes the entire multiline prompt as a bare positional argument:

cmd := exec.Command(p.cliPath, prompt)

On Windows, Go's exec.Command uses CreateProcess which constructs a command-line string. The multiline prompt
(containing newlines, backticks, markdown, etc.) gets mangled during Windows command-line escaping, resulting in only the first line being passed to Claude.

On macOS, execve passes arguments directly as byte arrays, so this works fine.

Reproduction

  1. Install chief on Windows (any shell — PowerShell, cmd, Git Bash all affected)
  2. Run chief new TestPrd
  3. Claude receives only # Chief PRD Generator instead of the full prompt
  4. No prd.md is created

Environment: Windows 11, chief v0.7.0, Claude Code 2.1.72

Suggested Fix

Option A — Write the prompt to a temp file and pass a short reference to Claude:

func (p *ClaudeProvider) InteractiveCommand(workDir, prompt string) *exec.Cmd { promptFile := filepath.Join(os.TempDir(), "chief-prompt.txt") if err := os.WriteFile(promptFile, []byte(prompt), 0600); err != nil { cmd := exec.Command(p.cliPath, prompt) cmd.Dir = workDir return cmd } cmd := exec.Command(p.cliPath, "Read the file at "+promptFile+" and follow its instructions exactly. Start
now.") cmd.Dir = workDir return cmd }

Option B — Use -p flag with stdin piping (like ConvertCommand already does), though this conflicts with new.go
setting cmd.Stdin = os.Stdin for interactive use.

Notes: This description was auto-generated by Claude, but I hope it is useful in getting to the root of the problem. I have it working now by cloning the repo down and using fix A. Thank you.

MGundersen avatar Mar 11 '26 14:03 MGundersen