Use rig prefix for agent bead IDs instead of hardcoded gt- (gt-w0fqg)

The getCleanupStatus function in witness/handlers.go and crew removal
in cmd/crew_lifecycle.go were constructing agent bead IDs with hardcoded
"gt-" prefix. This failed for rigs that use a different prefix like "bd-".

Now uses beads.GetPrefixForRig to look up the correct prefix from
routes.jsonl, enabling support for the beads rig and any future rigs
with custom prefixes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/polecats/furiosa
2025-12-30 23:05:55 -08:00
committed by Steve Yegge
parent 1cbe638e4f
commit 0da29050dd
2 changed files with 19 additions and 4 deletions

View File

@@ -9,12 +9,14 @@ import (
"time"
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/beads"
"github.com/steveyegge/gastown/internal/constants"
"github.com/steveyegge/gastown/internal/crew"
"github.com/steveyegge/gastown/internal/mail"
"github.com/steveyegge/gastown/internal/session"
"github.com/steveyegge/gastown/internal/style"
"github.com/steveyegge/gastown/internal/tmux"
"github.com/steveyegge/gastown/internal/workspace"
)
func runCrewRemove(cmd *cobra.Command, args []string) error {
@@ -80,8 +82,13 @@ func runCrewRemove(cmd *cobra.Command, args []string) error {
style.Bold.Render("✓"), r.Name, name)
// Close the agent bead if it exists
// Format: gt-<rig>-crew-<name> (matches session name format)
agentBeadID := fmt.Sprintf("gt-%s-crew-%s", r.Name, name)
// Use the rig's configured prefix (e.g., "gt" for gastown, "bd" for beads)
townRoot, _ := workspace.Find(r.Path)
if townRoot == "" {
townRoot = r.Path
}
prefix := beads.GetPrefixForRig(townRoot, r.Name)
agentBeadID := beads.CrewBeadIDWithPrefix(prefix, r.Name, name)
closeCmd := exec.Command("bd", "close", agentBeadID, "--reason=Crew workspace removed")
closeCmd.Dir = r.Path // Run from rig directory for proper beads resolution
if output, err := closeCmd.CombinedOutput(); err != nil {