diff --git a/internal/beads/routes.go b/internal/beads/routes.go index 62a9db77..cd5c2812 100644 --- a/internal/beads/routes.go +++ b/internal/beads/routes.go @@ -57,7 +57,12 @@ func LoadRoutes(beadsDir string) ([]Route, error) { // If the prefix already exists, it updates the path. func AppendRoute(townRoot string, route Route) error { beadsDir := filepath.Join(townRoot, ".beads") + return AppendRouteToDir(beadsDir, route) +} +// AppendRouteToDir appends a route to routes.jsonl in the given beads directory. +// If the prefix already exists, it updates the path. +func AppendRouteToDir(beadsDir string, route Route) error { // Load existing routes routes, err := LoadRoutes(beadsDir) if err != nil { diff --git a/internal/rig/manager.go b/internal/rig/manager.go index 1395a223..55a7edb0 100644 --- a/internal/rig/manager.go +++ b/internal/rig/manager.go @@ -547,6 +547,15 @@ func (m *Manager) initBeads(rigPath, prefix string) error { // Ignore errors - fingerprint is optional for functionality _, _ = migrateCmd.CombinedOutput() + // Add route from rig beads to town beads for cross-database resolution. + // This allows rig beads to resolve hq-* prefixed beads (role beads, etc.) + // that are stored in town beads. + townRoute := beads.Route{Prefix: "hq-", Path: ".."} + if err := beads.AppendRouteToDir(beadsDir, townRoute); err != nil { + // Non-fatal: role slot set will fail but agent beads still work + fmt.Printf(" ⚠ Could not add route to town beads: %v\n", err) + } + return nil }