From 199da5aa9b6e7619c45c2b8a7ce26f9d991b8219 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 21 Dec 2025 01:24:56 -0800 Subject: [PATCH] fix(handoff): write crew state.json to correct location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon verifies requesting_cycle=true in state.json before executing lifecycle actions. For crew workers, the state file must be at //crew//state.json. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/handoff.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/internal/cmd/handoff.go b/internal/cmd/handoff.go index a42637fc..9c6e2c3a 100644 --- a/internal/cmd/handoff.go +++ b/internal/cmd/handoff.go @@ -464,6 +464,20 @@ func setRequestingState(role Role, action HandoffAction, townRoot string) error case RoleWitness: // Would need rig context stateFile = filepath.Join(townRoot, "witness", "state.json") + case RoleCrew: + // Crew state: //crew//state.json + if crewID := getCrewIdentity(); crewID != "" { + // crewID format: -crew- + parts := strings.SplitN(crewID, "-crew-", 2) + if len(parts) == 2 { + stateFile = filepath.Join(townRoot, parts[0], "crew", parts[1], "state.json") + } + } + if stateFile == "" { + // Fallback to cwd + cwd, _ := os.Getwd() + stateFile = filepath.Join(cwd, "state.json") + } default: // For other roles, use a generic location stateFile = filepath.Join(townRoot, ".gastown", "agent-state.json")