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

@@ -202,6 +202,7 @@ func startDeaconSession(t *tmux.Tmux) error {
// Set environment
_ = t.SetEnvironment(DeaconSessionName, "GT_ROLE", "deacon")
_ = t.SetEnvironment(DeaconSessionName, "BD_ACTOR", "deacon")
// Apply Deacon theme
theme := tmux.DeaconTheme()
@@ -210,8 +211,8 @@ func startDeaconSession(t *tmux.Tmux) error {
// Launch Claude directly (no shell respawn loop)
// Restarts are handled by daemon via ensureDeaconRunning on each heartbeat
// The startup hook handles context loading automatically
// Export GT_ROLE in the command since tmux SetEnvironment only affects new panes
if err := t.SendKeys(DeaconSessionName, "export GT_ROLE=deacon && claude --dangerously-skip-permissions"); err != nil {
// Export GT_ROLE and BD_ACTOR in the command since tmux SetEnvironment only affects new panes
if err := t.SendKeys(DeaconSessionName, "export GT_ROLE=deacon BD_ACTOR=deacon && claude --dangerously-skip-permissions"); err != nil {
return fmt.Errorf("sending command: %w", err)
}