From 12a8b7e2b31d92cb2e6cbc04671354c876a4f9c6 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 21 Dec 2025 11:51:06 -0800 Subject: [PATCH] feat(crew): auto-prime when exec'ing Claude in-session MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running `gt crew at ` from inside the target session, we exec Claude directly. Previously this meant we couldn't send `gt prime` afterward. Now we pass "gt prime" as the initial prompt argument to the Claude CLI, so Claude loads context immediately upon startup. Closes gt-qivm 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/crew_at.go | 3 ++- internal/cmd/crew_helpers.go | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/cmd/crew_at.go b/internal/cmd/crew_at.go index cfd52587..d292c057 100644 --- a/internal/cmd/crew_at.go +++ b/internal/cmd/crew_at.go @@ -133,8 +133,9 @@ func runCrewAt(cmd *cobra.Command, args []string) error { // Check if we're already in the target session if isInTmuxSession(sessionID) { // We're in the session at a shell prompt - just start Claude directly + // Pass "gt prime" as initial prompt so Claude loads context immediately fmt.Printf("Starting Claude in current session...\n") - return execClaude() + return execClaude("gt prime") } // Attach to session using exec to properly forward TTY diff --git a/internal/cmd/crew_helpers.go b/internal/cmd/crew_helpers.go index 127edd34..0e3eda87 100644 --- a/internal/cmd/crew_helpers.go +++ b/internal/cmd/crew_helpers.go @@ -147,7 +147,8 @@ func isShellCommand(cmd string) bool { // execClaude execs claude, replacing the current process. // Used when we're already in the target session and just need to start Claude. -func execClaude() error { +// If prompt is provided, it's passed as the initial prompt to Claude. +func execClaude(prompt string) error { claudePath, err := exec.LookPath("claude") if err != nil { return fmt.Errorf("claude not found: %w", err) @@ -155,6 +156,9 @@ func execClaude() error { // exec replaces current process with claude args := []string{"claude", "--dangerously-skip-permissions"} + if prompt != "" { + args = append(args, prompt) + } return syscall.Exec(claudePath, args, os.Environ()) }