fix: use mayor/rig path for beads to prevent prefix mismatch (#38)

When creating agent beads for polecats or crew workers, the code was
using the rig root path (e.g., ~/gt/infra-dashboard/) instead of the
mayor/rig path where the actual beads database lives.

The rig root .beads/ directory only contains config.yaml with no
database. When bd runs from there, it walks up the directory tree
and finds the town-level beads database (with 'gm' prefix) instead
of the rig's database (with the rig's prefix like 'id'). This causes
prefix mismatch errors:

  Error: prefix mismatch: database uses 'gm' but you specified 'id'

The routes.jsonl file maps rig prefixes to <rig>/mayor/rig, so the
code should always use that path for beads operations.

Changes:
- polecat/manager.go: Always use mayor/rig path, remove fallback logic
- cmd/crew_add.go: Use mayor/rig path instead of rig root

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Sloane
2026-01-04 15:58:53 -05:00
committed by GitHub
parent 257bfbcbd8
commit 1733c6dbae
2 changed files with 9 additions and 12 deletions

View File

@@ -56,8 +56,9 @@ func runCrewAdd(cmd *cobra.Command, args []string) error {
crewGit := git.NewGit(r.Path)
crewMgr := crew.NewManager(r, crewGit)
// Beads for agent bead creation (use rig root where .beads/ lives)
bd := beads.New(r.Path)
// Beads for agent bead creation (use mayor/rig where beads.db lives)
// The rig root .beads/ only has config.yaml, no database.
bd := beads.New(filepath.Join(r.Path, "mayor", "rig"))
// Track results
var created []string