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:
Steve Yegge
2025-12-25 13:26:38 -08:00
parent 77a43886a3
commit 9afd6c5572
9 changed files with 67 additions and 19 deletions

View File

@@ -120,6 +120,7 @@ func startMayorSession(t *tmux.Tmux) error {
// Set environment
_ = t.SetEnvironment(MayorSessionName, "GT_ROLE", "mayor")
_ = t.SetEnvironment(MayorSessionName, "BD_ACTOR", "mayor")
// Apply Mayor theme
theme := tmux.MayorTheme()
@@ -127,8 +128,8 @@ func startMayorSession(t *tmux.Tmux) error {
// Launch Claude - the startup hook handles 'gt prime' automatically
// Use SendKeysDelayed to allow shell initialization after NewSession
// Export GT_ROLE in the command since tmux SetEnvironment only affects new panes
claudeCmd := `export GT_ROLE=mayor && claude --dangerously-skip-permissions`
// Export GT_ROLE and BD_ACTOR in the command since tmux SetEnvironment only affects new panes
claudeCmd := `export GT_ROLE=mayor BD_ACTOR=mayor && claude --dangerously-skip-permissions`
if err := t.SendKeysDelayed(MayorSessionName, claudeCmd, 200); err != nil {
return fmt.Errorf("sending command: %w", err)
}