fix: Make Mayor/Deacon session names include town name

Session names `gt-mayor` and `gt-deacon` were hardcoded, causing tmux
session name collisions when running multiple towns simultaneously.

Changed to `gt-{town}-mayor` and `gt-{town}-deacon` format (e.g.,
`gt-ai-mayor`) to allow concurrent multi-town operation.

Key changes:
- session.MayorSessionName() and DeaconSessionName() now take townName param
- Added workspace.GetTownName() helper to load town name from config
- Updated all callers in cmd/, daemon/, doctor/, mail/, rig/, templates/
- Updated tests with new session name format
- Bead IDs remain unchanged (already scoped by .beads/ directory)

Fixes #60

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
markov-kernel
2026-01-03 21:21:00 +01:00
parent 7f9795f630
commit e7145cfd77
46 changed files with 4772 additions and 1615 deletions

View File

@@ -35,6 +35,7 @@ type AgentSession struct {
Type AgentType
Rig string // For rig-specific agents
AgentName string // e.g., crew name, polecat name
Town string // For mayor/deacon only (town name from session)
}
// AgentTypeColors maps agent types to tmux color codes.
@@ -135,13 +136,16 @@ func categorizeSession(name string) *AgentSession {
session := &AgentSession{Name: name}
suffix := strings.TrimPrefix(name, "gt-")
// Town-level agents
if suffix == "mayor" {
// Town-level agents: gt-{town}-mayor, gt-{town}-deacon
// Check if suffix ends with -mayor or -deacon (new format)
if strings.HasSuffix(suffix, "-mayor") {
session.Type = AgentMayor
session.Town = strings.TrimSuffix(suffix, "-mayor")
return session
}
if suffix == "deacon" {
if strings.HasSuffix(suffix, "-deacon") {
session.Type = AgentDeacon
session.Town = strings.TrimSuffix(suffix, "-deacon")
return session
}