feat: Set BD_ACTOR env var when spawning agents (gt-rhfji)
When gt spawns agents (polecats, crew, patrol roles), it now sets the BD_ACTOR env var so that bd commands (like `bd hook`) know the agent identity without coupling to gt. Updated spawn points: - gt up (mayor, deacon, witness via ensureSession/ensureWitness) - gt deacon start - gt witness start - gt start refinery - gt mayor start - Daemon deacon restart - Daemon lifecycle restart - Handoff respawn - Refinery manager start BD_ACTOR uses slash format (e.g., gastown/witness, gastown/crew/max) while GT_ROLE may use dash format internally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -197,7 +197,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, "export GT_ROLE=deacon && claude --dangerously-skip-permissions"); err != nil {
|
||||
if err := d.tmux.SendKeys(DeaconSessionName, "export GT_ROLE=deacon BD_ACTOR=deacon && claude --dangerously-skip-permissions"); err != nil {
|
||||
d.logger.Printf("Error restarting Claude in Deacon session: %v", err)
|
||||
}
|
||||
return
|
||||
@@ -215,11 +215,12 @@ func (d *Daemon) ensureDeaconRunning() {
|
||||
|
||||
// Set environment
|
||||
_ = d.tmux.SetEnvironment(DeaconSessionName, "GT_ROLE", "deacon")
|
||||
_ = d.tmux.SetEnvironment(DeaconSessionName, "BD_ACTOR", "deacon")
|
||||
|
||||
// Launch Claude directly (no shell respawn loop)
|
||||
// The daemon will detect if Claude exits and restart it on next heartbeat
|
||||
// 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 {
|
||||
// Export GT_ROLE and BD_ACTOR so Claude inherits them (tmux SetEnvironment doesn't export to processes)
|
||||
if err := d.tmux.SendKeys(DeaconSessionName, "export GT_ROLE=deacon BD_ACTOR=deacon && claude --dangerously-skip-permissions"); err != nil {
|
||||
d.logger.Printf("Error launching Claude in Deacon session: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user