From d37bd53a90a5eeab354d9f91d61305e433ed7a9d Mon Sep 17 00:00:00 2001 From: gastown/crew/jack Date: Tue, 30 Dec 2025 23:23:05 -0800 Subject: [PATCH] Dynamically discover rigs in checkStaleAgents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of hardcoding the rig list (gastown, beads), now loads rigs from mayor/rigs.json using config.LoadRigsConfig. Falls back gracefully to just checking global agents if the config cannot be loaded. (gt-mmp0q) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/daemon/lifecycle.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/internal/daemon/lifecycle.go b/internal/daemon/lifecycle.go index 930400ea..24d416f3 100644 --- a/internal/daemon/lifecycle.go +++ b/internal/daemon/lifecycle.go @@ -10,6 +10,7 @@ import ( "time" "github.com/steveyegge/gastown/internal/beads" + "github.com/steveyegge/gastown/internal/config" "github.com/steveyegge/gastown/internal/constants" "github.com/steveyegge/gastown/internal/tmux" ) @@ -730,12 +731,18 @@ func (d *Daemon) checkStaleAgents() { beads.MayorBeadID(), } - // Add rig-specific agents (witness, refinery) for known rigs - // For now, we check gastown - could be expanded to discover rigs dynamically - rigs := []string{"gastown", "beads"} - for _, rig := range rigs { - agentBeadIDs = append(agentBeadIDs, beads.WitnessBeadID(rig)) - agentBeadIDs = append(agentBeadIDs, beads.RefineryBeadID(rig)) + // Dynamically discover rigs from the rigs config + rigsConfigPath := filepath.Join(d.config.TownRoot, "mayor", "rigs.json") + rigsConfig, err := config.LoadRigsConfig(rigsConfigPath) + if err != nil { + // Log warning but continue with global agents only + d.logger.Printf("Warning: could not load rigs config: %v", err) + } else { + // Add rig-specific agents (witness, refinery) for each discovered rig + for rigName := range rigsConfig.Rigs { + agentBeadIDs = append(agentBeadIDs, beads.WitnessBeadID(rigName)) + agentBeadIDs = append(agentBeadIDs, beads.RefineryBeadID(rigName)) + } } for _, agentBeadID := range agentBeadIDs {