diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 3e06628b..1e0773a7 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -5551,7 +5551,10 @@ func (c *CLI) restartClaude(args []string) error { // Add common flags cmdArgs = append(cmdArgs, "--dangerously-skip-permissions") if _, err := os.Stat(promptFile); err == nil { - cmdArgs = append(cmdArgs, "--append-system-prompt-file", promptFile) + promptContent, readErr := os.ReadFile(promptFile) + if readErr == nil { + cmdArgs = append(cmdArgs, "--append-system-prompt", string(promptContent)) + } } // Exec claude @@ -5874,7 +5877,7 @@ func (c *CLI) startClaudeInTmux(binaryPath, tmuxSession, tmuxWindow, workDir, se // Add prompt file if provided if promptFile != "" { - claudeCmd += fmt.Sprintf(" --append-system-prompt-file %s", promptFile) + claudeCmd += fmt.Sprintf(` --append-system-prompt "$(cat '%s')"`, promptFile) } // Send command to tmux window diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index c7554129..efc76c36 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -2060,7 +2060,7 @@ func (d *Daemon) startAgentWithConfig(repoName string, repo *state.Repository, c } // Build CLI command - claudeCmd := fmt.Sprintf("%s --session-id %s --dangerously-skip-permissions --append-system-prompt-file %s", + claudeCmd := fmt.Sprintf(`%s --session-id %s --dangerously-skip-permissions --append-system-prompt "$(cat '%s')"`, binaryPath, sessionID, cfg.promptFile) // Send command to tmux window diff --git a/pkg/claude/README.md b/pkg/claude/README.md index 4e9901b5..41710b53 100644 --- a/pkg/claude/README.md +++ b/pkg/claude/README.md @@ -205,7 +205,7 @@ The runner constructs Claude commands with these flags: | `--session-id ` | Unique session identifier | | `--resume ` | Resume existing session | | `--dangerously-skip-permissions` | Skip interactive permission prompts | -| `--append-system-prompt-file ` | Path to system prompt file | +| `--append-system-prompt ` | System prompt content (read from file via shell expansion) | ## Prompt Building diff --git a/pkg/claude/doc.go b/pkg/claude/doc.go index d833bafc..55074619 100644 --- a/pkg/claude/doc.go +++ b/pkg/claude/doc.go @@ -3,7 +3,7 @@ // This package abstracts the details of launching and interacting with Claude Code // instances running in terminal emulators. It handles: // -// - CLI flag construction (--session-id, --dangerously-skip-permissions, --append-system-prompt-file) +// - CLI flag construction (--session-id, --dangerously-skip-permissions, --append-system-prompt) // - Session ID generation (UUID v4) // - Startup timing quirks // - Terminal integration via the [TerminalRunner] interface diff --git a/pkg/claude/runner.go b/pkg/claude/runner.go index af0ff380..5b5b28f6 100644 --- a/pkg/claude/runner.go +++ b/pkg/claude/runner.go @@ -188,7 +188,7 @@ type Config struct { WorkDir string // SystemPromptFile is the path to a file containing the system prompt. - // This is passed via --append-system-prompt-file. + // The file contents are read and passed inline via --append-system-prompt. SystemPromptFile string // InitialMessage is an optional message to send to Claude after startup. @@ -315,9 +315,9 @@ func (r *Runner) buildCommand(sessionID string, cfg Config) string { cmd += " --dangerously-skip-permissions" } - // Add system prompt file + // Add system prompt (read file contents via shell expansion) if cfg.SystemPromptFile != "" { - cmd += fmt.Sprintf(" --append-system-prompt-file %s", cfg.SystemPromptFile) + cmd += fmt.Sprintf(` --append-system-prompt "$(cat '%s')"`, cfg.SystemPromptFile) } return cmd diff --git a/pkg/claude/runner_test.go b/pkg/claude/runner_test.go index 1268eee3..0a106af5 100644 --- a/pkg/claude/runner_test.go +++ b/pkg/claude/runner_test.go @@ -173,8 +173,8 @@ func TestStart(t *testing.T) { if !strings.Contains(call.text, "--dangerously-skip-permissions") { t.Errorf("expected command to contain --dangerously-skip-permissions, got %q", call.text) } - if !strings.Contains(call.text, "--append-system-prompt-file /path/to/prompt.md") { - t.Errorf("expected command to contain prompt file, got %q", call.text) + if !strings.Contains(call.text, `--append-system-prompt "$(cat '/path/to/prompt.md')"`) { + t.Errorf("expected command to contain prompt via cat, got %q", call.text) } } @@ -491,7 +491,7 @@ func TestBuildCommand(t *testing.T) { SystemPromptFile: "/path/to/prompt.md", }, contains: []string{ - "--append-system-prompt-file /path/to/prompt.md", + `--append-system-prompt "$(cat '/path/to/prompt.md')"`, }, }, {