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

@@ -95,6 +95,8 @@ type CreateArgs struct {
// ID generation
IDPrefix string `json:"id_prefix,omitempty"` // Override prefix for ID generation (mol, eph, etc.)
CreatedBy string `json:"created_by,omitempty"` // Who created the issue
// Molecule type (for swarm coordination)
MolType string `json:"mol_type,omitempty"` // swarm, patrol, or work (default)
}
// UpdateArgs represents arguments for the update operation
@@ -203,6 +205,9 @@ type ListArgs struct {
// Ephemeral filtering
Ephemeral *bool `json:"ephemeral,omitempty"`
// Molecule type filtering
MolType string `json:"mol_type,omitempty"`
}
// CountArgs represents arguments for the count operation
@@ -264,6 +269,7 @@ type ReadyArgs struct {
Labels []string `json:"labels,omitempty"`
LabelsAny []string `json:"labels_any,omitempty"`
ParentID string `json:"parent_id,omitempty"` // Filter to descendants of this bead/epic
MolType string `json:"mol_type,omitempty"` // Filter by molecule type: swarm, patrol, or work
}
// BlockedArgs represents arguments for the blocked operation

View File

@@ -196,6 +196,8 @@ func (s *Server) handleCreate(req *Request) Response {
// ID generation
IDPrefix: createArgs.IDPrefix,
CreatedBy: createArgs.CreatedBy,
// Molecule type
MolType: types.MolType(createArgs.MolType),
}
// Check if any dependencies are discovered-from type
@@ -918,6 +920,12 @@ func (s *Server) handleList(req *Request) Response {
// Ephemeral filtering
filter.Ephemeral = listArgs.Ephemeral
// Molecule type filtering
if listArgs.MolType != "" {
molType := types.MolType(listArgs.MolType)
filter.MolType = &molType
}
// Guard against excessive ID lists to avoid SQLite parameter limits
const maxIDs = 1000
if len(filter.IDs) > maxIDs {
@@ -1353,6 +1361,10 @@ func (s *Server) handleReady(req *Request) Response {
if readyArgs.ParentID != "" {
wf.ParentID = &readyArgs.ParentID
}
if readyArgs.MolType != "" {
molType := types.MolType(readyArgs.MolType)
wf.MolType = &molType
}
ctx := s.reqCtx(req)
issues, err := store.GetReadyWork(ctx, wf)