feat: Add mol_type schema field for molecule type classification (bd-oxgi)

Add mol_type field to beads for swarm coordination:
- Values: 'swarm' (multi-polecat), 'patrol' (recurring ops), 'work' (default)
- Nullable, defaults to empty string (treated as 'work')

Changes:
- Add mol_type column to SQLite schema and migration 031
- Add MolType type with IsValid() validation in types.go
- Update insertIssue/GetIssue to handle mol_type
- Add --mol-type flag to create command
- Add mol_type filtering to list and ready commands
- Update RPC protocol for daemon mode support
- Update test schema in migrations_test.go

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-28 19:50:55 -08:00
parent 77ba8f3d10
commit f3dcafca66
13 changed files with 167 additions and 8 deletions

View File

@@ -97,6 +97,9 @@ type Issue struct {
LastActivity *time.Time `json:"last_activity,omitempty"` // Updated on each action (timeout detection)
RoleType string `json:"role_type,omitempty"` // Role: polecat|crew|witness|refinery|mayor|deacon
Rig string `json:"rig,omitempty"` // Rig name (empty for town-level agents)
// ===== Molecule Type Fields (swarm coordination) =====
MolType MolType `json:"mol_type,omitempty"` // Molecule type: swarm|patrol|work (empty = work)
}
// ComputeContentHash creates a deterministic hash of the issue's content.
@@ -156,6 +159,9 @@ func (i *Issue) ComputeContentHash() string {
w.str(i.RoleType)
w.str(i.Rig)
// Molecule type
w.str(string(i.MolType))
return fmt.Sprintf("%x", h.Sum(nil))
}
@@ -422,6 +428,25 @@ func (s AgentState) IsValid() bool {
return false
}
// MolType categorizes the molecule type for swarm coordination
type MolType string
// MolType constants
const (
MolTypeSwarm MolType = "swarm" // Swarm molecule: coordinated multi-polecat work
MolTypePatrol MolType = "patrol" // Patrol molecule: recurring operational work (Witness, Deacon, etc.)
MolTypeWork MolType = "work" // Work molecule: regular polecat work (default)
)
// IsValid checks if the mol type value is valid
func (m MolType) IsValid() bool {
switch m {
case MolTypeSwarm, MolTypePatrol, MolTypeWork, "":
return true // empty is valid (defaults to work)
}
return false
}
// Dependency represents a relationship between issues
type Dependency struct {
IssueID string `json:"issue_id"`
@@ -680,6 +705,9 @@ type IssueFilter struct {
// Parent filtering: filter children by parent issue ID
ParentID *string // Filter by parent issue (via parent-child dependency)
// Molecule type filtering
MolType *MolType // Filter by molecule type (nil = any, swarm/patrol/work)
}
// SortPolicy determines how ready work is ordered
@@ -724,6 +752,9 @@ type WorkFilter struct {
// Parent filtering: filter to descendants of a bead/epic (recursive)
ParentID *string // Show all descendants of this issue
// Molecule type filtering
MolType *MolType // Filter by molecule type (nil = any, swarm/patrol/work)
}
// StaleFilter is used to filter stale issue queries