From 8d47911623a4bbc44a4174be23831e08023c61ad Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Tue, 23 Dec 2025 12:39:04 -0800 Subject: [PATCH] Fix deacon startup: use ~/gt/deacon dir and export GT_ROLE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon was creating the deacon session in ~/gt (town root) which loaded the Mayor CLAUDE.md instead of the Deacon CLAUDE.md. Also, tmux SetEnvironment does not export variables to spawned processes. Changes: - Create deacon session in ~/gt/deacon (correct CLAUDE.md) - Export GT_ROLE=deacon in launch command (process inherits env) - Apply to both initial launch and restart paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/daemon/daemon.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index 8611ca42..17a0f2e3 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -212,7 +212,7 @@ func (d *Daemon) ensureDeaconRunning() { // Claude has exited (shell is showing) - restart it d.logger.Printf("Deacon session exists but Claude exited (cmd=%s), restarting...", cmd) - if err := d.tmux.SendKeys(DeaconSessionName, "claude --dangerously-skip-permissions"); err != nil { + if err := d.tmux.SendKeys(DeaconSessionName, "export GT_ROLE=deacon && claude --dangerously-skip-permissions"); err != nil { d.logger.Printf("Error restarting Claude in Deacon session: %v", err) } return @@ -221,8 +221,9 @@ func (d *Daemon) ensureDeaconRunning() { // Session doesn't exist - create it and start Claude d.logger.Println("Deacon session not running, starting...") - // Create session in town root - if err := d.tmux.NewSession(DeaconSessionName, d.config.TownRoot); err != nil { + // Create session in deacon directory (ensures correct CLAUDE.md is loaded) + deaconDir := filepath.Join(d.config.TownRoot, "deacon") + if err := d.tmux.NewSession(DeaconSessionName, deaconDir); err != nil { d.logger.Printf("Error creating Deacon session: %v", err) return } @@ -232,7 +233,8 @@ func (d *Daemon) ensureDeaconRunning() { // Launch Claude directly (no shell respawn loop) // The daemon will detect if Claude exits and restart it on next heartbeat - if err := d.tmux.SendKeys(DeaconSessionName, "claude --dangerously-skip-permissions"); err != nil { + // Export GT_ROLE so Claude inherits it (tmux SetEnvironment doesn't export to processes) + if err := d.tmux.SendKeys(DeaconSessionName, "export GT_ROLE=deacon && claude --dangerously-skip-permissions"); err != nil { d.logger.Printf("Error launching Claude in Deacon session: %v", err) return }