Skip to content

Commit 03fef16

Browse files
steveyeggeclaude
andcommitted
feat(rig): add route from rig beads to town beads
Add AppendRouteToDir helper and use it to add hq-* route during rig initialization. This allows rig beads to resolve role beads and other hq-* prefixed beads stored in town beads. Uses safe append pattern (load, merge, write) instead of overwriting to avoid clobbering future rig routes. Supersedes PR gastownhall#184 with proper implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e8d27e7 commit 03fef16

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

internal/beads/routes.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ func LoadRoutes(beadsDir string) ([]Route, error) {
5757
// If the prefix already exists, it updates the path.
5858
func AppendRoute(townRoot string, route Route) error {
5959
beadsDir := filepath.Join(townRoot, ".beads")
60+
return AppendRouteToDir(beadsDir, route)
61+
}
6062

63+
// AppendRouteToDir appends a route to routes.jsonl in the given beads directory.
64+
// If the prefix already exists, it updates the path.
65+
func AppendRouteToDir(beadsDir string, route Route) error {
6166
// Load existing routes
6267
routes, err := LoadRoutes(beadsDir)
6368
if err != nil {

internal/rig/manager.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,15 @@ func (m *Manager) initBeads(rigPath, prefix string) error {
547547
// Ignore errors - fingerprint is optional for functionality
548548
_, _ = migrateCmd.CombinedOutput()
549549

550+
// Add route from rig beads to town beads for cross-database resolution.
551+
// This allows rig beads to resolve hq-* prefixed beads (role beads, etc.)
552+
// that are stored in town beads.
553+
townRoute := beads.Route{Prefix: "hq-", Path: ".."}
554+
if err := beads.AppendRouteToDir(beadsDir, townRoute); err != nil {
555+
// Non-fatal: role slot set will fail but agent beads still work
556+
fmt.Printf(" ⚠ Could not add route to town beads: %v\n", err)
557+
}
558+
550559
return nil
551560
}
552561

0 commit comments

Comments
 (0)