fix: remove vestigial state.json files from agent directories
Agent directories (witness/, refinery/, mayor/) contained state.json files with last_active timestamps that were never updated, making them stale and misleading. This change removes: - initAgentStates function that created vestigial state.json files - AgentState type and related Load/Save functions from config package - MayorStateValidCheck from doctor checks - requesting_* lifecycle verification (dead code - flags were never set) - FileStateJSON constant and MayorStatePath function Kept intact: - daemon/state.json (actively used for daemon runtime state) - crew/<name>/state.json (operational CrewWorker metadata) - Agent state tracking via beads (the ZFC-compliant approach) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -133,9 +133,9 @@ func (m *Manager) loadRig(name string, entry config.RigEntry) (*Rig, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for witness (witnesses don't have clones, just state.json)
|
||||
witnessStatePath := filepath.Join(rigPath, "witness", "state.json")
|
||||
if _, err := os.Stat(witnessStatePath); err == nil {
|
||||
// Check for witness (witnesses don't have clones, just the witness directory)
|
||||
witnessPath := filepath.Join(rigPath, "witness")
|
||||
if info, err := os.Stat(witnessPath); err == nil && info.IsDir() {
|
||||
rig.HasWitness = true
|
||||
}
|
||||
|
||||
@@ -414,11 +414,6 @@ Use crew for your own workspace. Polecats are for batch work dispatch.
|
||||
return nil, fmt.Errorf("creating polecats dir: %w", err)
|
||||
}
|
||||
|
||||
// Initialize agent state files
|
||||
if err := m.initAgentStates(rigPath); err != nil {
|
||||
return nil, fmt.Errorf("initializing agent states: %w", err)
|
||||
}
|
||||
|
||||
// Initialize beads at rig level
|
||||
fmt.Printf(" Initializing beads database...\n")
|
||||
if err := m.initBeads(rigPath, opts.BeadsPrefix); err != nil {
|
||||
@@ -484,33 +479,6 @@ func LoadRigConfig(rigPath string) (*RigConfig, error) {
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
// initAgentStates creates initial state.json files for agents.
|
||||
func (m *Manager) initAgentStates(rigPath string) error {
|
||||
agents := []struct {
|
||||
path string
|
||||
role string
|
||||
}{
|
||||
{filepath.Join(rigPath, "refinery", "state.json"), "refinery"},
|
||||
{filepath.Join(rigPath, "witness", "state.json"), "witness"},
|
||||
{filepath.Join(rigPath, "mayor", "state.json"), "mayor"},
|
||||
}
|
||||
|
||||
for _, agent := range agents {
|
||||
state := &config.AgentState{
|
||||
Role: agent.role,
|
||||
LastActive: time.Now(),
|
||||
}
|
||||
data, err := json.MarshalIndent(state, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.WriteFile(agent.path, data, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// initBeads initializes the beads database at rig level.
|
||||
// The project's .beads/config.yaml determines sync-branch settings.
|
||||
// Use `bd doctor --fix` in the project to configure sync-branch if needed.
|
||||
|
||||
Reference in New Issue
Block a user