diff --git a/internal/cmd/molecule_attach.go b/internal/cmd/molecule_attach.go index 80ca7455..d4b5e105 100644 --- a/internal/cmd/molecule_attach.go +++ b/internal/cmd/molecule_attach.go @@ -54,7 +54,7 @@ func runMoleculeAttach(cmd *cobra.Command, args []string) error { } // detectAgentBeadID detects the current agent's bead ID from the working directory. -// Returns the agent bead ID (e.g., "gt-mayor", "gt-gastown-polecat-nux") or empty string if not detectable. +// Returns the agent bead ID (e.g., "hq-mayor", "gt-gastown-polecat-nux") or empty string if not detectable. func detectAgentBeadID() (string, error) { cwd, err := os.Getwd() if err != nil { diff --git a/internal/cmd/molecule_status.go b/internal/cmd/molecule_status.go index 144988fa..ce155f97 100644 --- a/internal/cmd/molecule_status.go +++ b/internal/cmd/molecule_status.go @@ -18,9 +18,10 @@ import ( // buildAgentBeadID constructs the agent bead ID from an agent identity. // Uses canonical naming: prefix-rig-role-name +// Town-level agents use hq- prefix; rig-level agents use rig's prefix. // Examples: -// - "mayor" -> "gt-mayor" -// - "deacon" -> "gt-deacon" +// - "mayor" -> "hq-mayor" +// - "deacon" -> "hq-deacon" // - "gastown/witness" -> "gt-gastown-witness" // - "gastown/refinery" -> "gt-gastown-refinery" // - "gastown/nux" (polecat) -> "gt-gastown-polecat-nux" @@ -34,9 +35,9 @@ func buildAgentBeadID(identity string, role Role) string { if role == RoleUnknown || role == Role("") { switch { case identity == "mayor": - return beads.MayorBeadID() + return beads.MayorBeadIDTown() case identity == "deacon": - return beads.DeaconBeadID() + return beads.DeaconBeadIDTown() case len(parts) == 2 && parts[1] == "witness": return beads.WitnessBeadID(parts[0]) case len(parts) == 2 && parts[1] == "refinery": @@ -57,9 +58,9 @@ func buildAgentBeadID(identity string, role Role) string { switch role { case RoleMayor: - return beads.MayorBeadID() + return beads.MayorBeadIDTown() case RoleDeacon: - return beads.DeaconBeadID() + return beads.DeaconBeadIDTown() case RoleWitness: if len(parts) >= 1 { return beads.WitnessBeadID(parts[0]) diff --git a/internal/cmd/prime.go b/internal/cmd/prime.go index 50c6bda8..94bd2dd7 100644 --- a/internal/cmd/prime.go +++ b/internal/cmd/prime.go @@ -1245,14 +1245,14 @@ func getAgentFields(ctx RoleContext, state string) *beads.AgentFields { } // getAgentBeadID returns the agent bead ID for the current role. -// Rig-scoped agents use the rig's configured prefix; town agents remain gt-. +// Town-level agents (mayor, deacon) use hq- prefix; rig-scoped agents use the rig's prefix. // Returns empty string for unknown roles. func getAgentBeadID(ctx RoleContext) string { switch ctx.Role { case RoleMayor: - return beads.MayorBeadID() + return beads.MayorBeadIDTown() case RoleDeacon: - return beads.DeaconBeadID() + return beads.DeaconBeadIDTown() case RoleWitness: if ctx.Rig != "" { prefix := beads.GetPrefixForRig(ctx.TownRoot, ctx.Rig) diff --git a/internal/cmd/prime_test.go b/internal/cmd/prime_test.go index 6560b189..2d7a93de 100644 --- a/internal/cmd/prime_test.go +++ b/internal/cmd/prime_test.go @@ -36,7 +36,7 @@ func TestGetAgentBeadID_UsesRigPrefix(t *testing.T) { Role: RoleMayor, TownRoot: townRoot, }, - want: "gt-mayor", + want: "hq-mayor", }, { name: "deacon", @@ -44,7 +44,7 @@ func TestGetAgentBeadID_UsesRigPrefix(t *testing.T) { Role: RoleDeacon, TownRoot: townRoot, }, - want: "gt-deacon", + want: "hq-deacon", }, { name: "witness", diff --git a/internal/daemon/lifecycle.go b/internal/daemon/lifecycle.go index 3f944c25..27cdc9b5 100644 --- a/internal/daemon/lifecycle.go +++ b/internal/daemon/lifecycle.go @@ -715,9 +715,9 @@ func (d *Daemon) identityToAgentBeadID(identity string) string { switch parsed.RoleType { case "deacon": - return beads.DeaconBeadID() + return beads.DeaconBeadIDTown() case "mayor": - return beads.MayorBeadID() + return beads.MayorBeadIDTown() case "witness": return beads.WitnessBeadID(parsed.RigName) case "refinery": @@ -741,8 +741,8 @@ const DeadAgentTimeout = 15 * time.Minute func (d *Daemon) checkStaleAgents() { // Known agent bead IDs to check agentBeadIDs := []string{ - beads.DeaconBeadID(), - beads.MayorBeadID(), + beads.DeaconBeadIDTown(), + beads.MayorBeadIDTown(), } // Dynamically discover rigs from the rigs config