fix: remove observable states from agent_state (discover, don't track)

The agent_state field was recording observable state like "running",
"dead", "idle" which violated the "Discover, Don't Track" principle.
This caused stale state bugs where agents were marked "dead" in beads
but actually running in tmux.

Changes:
- Remove daemon's checkStaleAgents() which marked agents "dead"
- Simplify ensureXxxRunning() to use tmux.IsClaudeRunning() directly
- Remove reportAgentState() calls from gt prime and gt handoff
- Add SetHookBead/ClearHookBead helpers that don't update agent_state
- Use ClearHookBead in gt done and gt unsling
- Simplify gt status to derive state from tmux, not bead

Non-observable states (stuck, awaiting-gate, muted, paused) are still
set because they represent intentional agent decisions that can't be
discovered from tmux state.

Fixes: gt-zecmc

🤖 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/crew/joe
2026-01-06 20:32:02 -08:00
committed by Steve Yegge
parent 950e35317e
commit 1f44482ad0
8 changed files with 155 additions and 231 deletions

View File

@@ -162,9 +162,8 @@ func runUnsling(cmd *cobra.Command, args []string) error {
return nil
}
// Clear the hook by updating agent bead with empty hook_bead
emptyHook := ""
if err := b.UpdateAgentState(agentBeadID, "running", &emptyHook); err != nil {
// Clear the hook (gt-zecmc: removed agent_state update - observable from tmux)
if err := b.ClearHookBead(agentBeadID); err != nil {
return fmt.Errorf("clearing hook from agent bead %s: %w", agentBeadID, err)
}