Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/claude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ The runner constructs Claude commands with these flags:
| `--session-id <uuid>` | Unique session identifier |
| `--resume <uuid>` | Resume existing session |
| `--dangerously-skip-permissions` | Skip interactive permission prompts |
| `--append-system-prompt-file <path>` | Path to system prompt file |
| `--append-system-prompt <text>` | System prompt content (read from file via shell expansion) |

## Prompt Building

Expand Down
2 changes: 1 addition & 1 deletion pkg/claude/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/claude/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/claude/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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')"`,
},
},
{
Expand Down