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
+3 -2
View File
@@ -149,8 +149,9 @@ func runPrime(cmd *cobra.Command, args []string) error {
// Ensure beads redirect exists for worktree-based roles
ensureBeadsRedirect(ctx)
// Report agent state as running (ZFC: agents self-report state)
reportAgentState(ctx, "running")
// NOTE: reportAgentState("running") removed (gt-zecmc)
// Agent liveness is observable from tmux - no need to record it in bead.
// "Discover, don't track" principle: reality is truth, state is derived.
// Emit session_start event for seance discovery
emitSessionEvent(ctx)