Implement handoffs using pinned beads (gt-cu7r)
Replace mail-based handoff system with pinned beads that persist across sessions. This fixes the issue where handoff messages get closed before successors can read them. Changes: - beads: Add StatusPinned constant and handoff functions: - HandoffBeadTitle() for well-known naming - FindHandoffBead() to locate role handoff bead - GetOrCreateHandoffBead() to ensure bead exists - UpdateHandoffContent() to set handoff message - ClearHandoffContent() to reset after reading - cmd/handoff: Update to use pinned beads instead of mail - sendHandoffMail() now updates pinned bead content - cmd/prime: Display handoff content on startup - outputHandoffContent() reads and shows handoff bead - cmd/rig: Add reset command with --handoff flag - gt rig reset --handoff clears handoff content Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/gastown/internal/beads"
|
||||
"github.com/steveyegge/gastown/internal/style"
|
||||
"github.com/steveyegge/gastown/internal/templates"
|
||||
"github.com/steveyegge/gastown/internal/workspace"
|
||||
@@ -71,7 +72,14 @@ func runPrime(cmd *cobra.Command, args []string) error {
|
||||
ctx := detectRole(cwd, townRoot)
|
||||
|
||||
// Output context
|
||||
return outputPrimeContext(ctx)
|
||||
if err := outputPrimeContext(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Output handoff content if present
|
||||
outputHandoffContent(ctx)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func detectRole(cwd, townRoot string) RoleContext {
|
||||
@@ -307,3 +315,31 @@ func outputUnknownContext(ctx RoleContext) {
|
||||
fmt.Println()
|
||||
fmt.Printf("Town root: %s\n", style.Dim.Render(ctx.TownRoot))
|
||||
}
|
||||
|
||||
// outputHandoffContent reads and displays the pinned handoff bead for the role.
|
||||
func outputHandoffContent(ctx RoleContext) {
|
||||
if ctx.Role == RoleUnknown {
|
||||
return
|
||||
}
|
||||
|
||||
// Get role key for handoff bead lookup
|
||||
roleKey := string(ctx.Role)
|
||||
|
||||
bd := beads.New(ctx.TownRoot)
|
||||
issue, err := bd.FindHandoffBead(roleKey)
|
||||
if err != nil {
|
||||
// Silently skip if beads lookup fails (might not be a beads repo)
|
||||
return
|
||||
}
|
||||
if issue == nil || issue.Description == "" {
|
||||
// No handoff content
|
||||
return
|
||||
}
|
||||
|
||||
// Display handoff content
|
||||
fmt.Println()
|
||||
fmt.Printf("%s\n\n", style.Bold.Render("## 🤝 Handoff from Previous Session"))
|
||||
fmt.Println(issue.Description)
|
||||
fmt.Println()
|
||||
fmt.Println(style.Dim.Render("(Clear with: gt rig reset --handoff)"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user