refactor: consolidate agent env vars into config.AgentEnv
Create centralized AgentEnv function as single source of truth for all agent environment variables. All agents now consistently receive: - GT_ROLE, BD_ACTOR, GIT_AUTHOR_NAME (role identity) - GT_ROOT, BEADS_DIR (workspace paths) - GT_RIG, GT_POLECAT/GT_CREW (rig-specific identity) - BEADS_AGENT_NAME, BEADS_NO_DAEMON (beads config) - CLAUDE_CONFIG_DIR (optional account selection) Remove RoleEnvVars in favor of AgentEnvSimple wrapper. Remove IncludeBeadsEnv flag - beads env vars always included. Update all manager and cmd call sites to use AgentEnv. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
52b9a95f98
commit
e999ceb1c1
@@ -186,19 +186,19 @@ func (m *Manager) Start(foreground bool) error {
|
||||
}
|
||||
|
||||
// Set environment variables (non-fatal: session works without these)
|
||||
// Use shared RoleEnvVars for consistency across all role startup paths
|
||||
envVars := config.RoleEnvVars("refinery", m.rig.Name, "")
|
||||
// Use centralized AgentEnv for consistency across all role startup paths
|
||||
townRoot := filepath.Dir(m.rig.Path)
|
||||
envVars := config.AgentEnv(config.AgentEnvConfig{
|
||||
Role: "refinery",
|
||||
Rig: m.rig.Name,
|
||||
TownRoot: townRoot,
|
||||
BeadsDir: beads.ResolveBeadsDir(m.rig.Path),
|
||||
BeadsNoDaemon: true,
|
||||
})
|
||||
|
||||
// Add refinery-specific flag
|
||||
envVars["GT_REFINERY"] = "1"
|
||||
|
||||
// Add beads environment - refinery uses rig-level beads
|
||||
// Use ResolveBeadsDir to handle both tracked (mayor/rig) and local beads
|
||||
beadsDir := beads.ResolveBeadsDir(m.rig.Path)
|
||||
envVars["BEADS_DIR"] = beadsDir
|
||||
envVars["BEADS_NO_DAEMON"] = "1"
|
||||
envVars["BEADS_AGENT_NAME"] = envVars["BD_ACTOR"]
|
||||
|
||||
// Set all env vars in tmux session (for debugging) and they'll also be exported to Claude
|
||||
for k, v := range envVars {
|
||||
_ = t.SetEnvironment(sessionID, k, v)
|
||||
|
||||
Reference in New Issue
Block a user