Add agent bead lifecycle to gt dog add/remove

When adding a dog, creates an agent bead with role_type:dog label.
When removing a dog, deletes the corresponding agent bead.

This enables @dogs group resolution in the mail router by allowing
queries like `bd list --type=agent --label=role_type:dog`.

Changes:
- Add DogBeadID(), DogRoleBeadID() helper functions
- Add CreateDogAgentBead() for creating dog agent beads with labels
- Add FindDogAgentBead() and DeleteDogAgentBead() for cleanup
- Add Labels field to Issue struct for label parsing
- Update ParseAgentBeadID() to handle dog bead IDs (gt-dog-<name>)
- Update IsAgentSessionBead() to include "dog" as valid role

(gt-qha0g)

🤖 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/polecats/furiosa
2025-12-30 22:38:04 -08:00
committed by Steve Yegge
parent 3db961c4bb
commit 4f99617b49
2 changed files with 140 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import (
"time"
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/beads"
"github.com/steveyegge/gastown/internal/config"
"github.com/steveyegge/gastown/internal/dog"
"github.com/steveyegge/gastown/internal/style"
@@ -201,6 +202,21 @@ func runDogAdd(cmd *cobra.Command, args []string) error {
fmt.Printf(" %s: %s\n", rigName, path)
}
// Create agent bead for the dog
townRoot, _ := workspace.FindFromCwd()
if townRoot != "" {
b := beads.New(townRoot)
location := filepath.Join("deacon", "dogs", name)
issue, err := b.CreateDogAgentBead(name, location)
if err != nil {
// Non-fatal: warn but don't fail dog creation
fmt.Printf(" Warning: could not create agent bead: %v\n", err)
} else {
fmt.Printf(" Agent bead: %s\n", issue.ID)
}
}
return nil
}
@@ -227,6 +243,13 @@ func runDogRemove(cmd *cobra.Command, args []string) error {
names = args
}
// Get beads client for cleanup
townRoot, _ := workspace.FindFromCwd()
var b *beads.Beads
if townRoot != "" {
b = beads.New(townRoot)
}
for _, name := range names {
d, err := mgr.Get(name)
if err != nil {
@@ -244,6 +267,14 @@ func runDogRemove(cmd *cobra.Command, args []string) error {
}
fmt.Printf("✓ Removed dog %s\n", name)
// Delete agent bead for the dog
if b != nil {
if err := b.DeleteDogAgentBead(name); err != nil {
// Non-fatal: warn but don't fail dog removal
fmt.Printf(" Warning: could not delete agent bead: %v\n", err)
}
}
}
return nil