fix(rig): Use correct beads path during rig/crew creation (GHI #7)

initAgentBeads and crew_add were looking for beads at mayor/rig/.beads/
but during initial creation, beads is at rig root. The redirect
mechanism to mayor/rig/.beads/ gets set up later.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/jack
2026-01-02 01:31:49 -08:00
committed by Steve Yegge
parent 17fd366888
commit 9cb33ee289
2 changed files with 5 additions and 6 deletions

View File

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

View File

@@ -437,8 +437,8 @@ func (m *Manager) initBeads(rigPath, prefix string) error {
//
// Agent beads track lifecycle state for ZFC compliance (gt-h3hak, gt-pinkq).
func (m *Manager) initAgentBeads(rigPath, rigName, prefix string, isFirstRig bool) error {
// Run bd commands from mayor/rig which has the beads database
mayorRigPath := filepath.Join(rigPath, "mayor", "rig")
// Run bd commands from rig root where .beads/ was initialized
// Set BEADS_DIR explicitly to ensure bd finds the database
beadsDir := filepath.Join(rigPath, ".beads")
prevBeadsDir, hadBeadsDir := os.LookupEnv("BEADS_DIR")
if err := os.Setenv("BEADS_DIR", beadsDir); err != nil {
@@ -451,7 +451,7 @@ func (m *Manager) initAgentBeads(rigPath, rigName, prefix string, isFirstRig boo
_ = os.Unsetenv("BEADS_DIR")
}
}()
bd := beads.New(mayorRigPath)
bd := beads.New(rigPath)
// Define agents to create
type agentDef struct {