feat(witness): Implement Witness MVP for automated polecat lifecycle

Implements the core Witness functionality:

- gt witness start: Creates tmux session with Claude, theming, auto-priming
- gt witness stop: Kills tmux session and updates state
- gt witness status: Shows session state reconciled with tmux
- Shutdown handler: Verifies git clean state before cleanup, sends nudges
- Auto-spawn: Spawns polecats for ready work up to configurable capacity
- Health checks: Monitors polecat activity, nudges stuck workers, escalates

Also updates handoff to include polecat name in lifecycle requests.

Closes: gt-53w6, gt-mxyj, gt-5wtw, gt-cpm2, gt-es1i

🤖 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-20 09:32:44 -08:00
parent c01e965d37
commit 6cfab58e86
4 changed files with 581 additions and 45 deletions

View File

@@ -41,6 +41,30 @@ type Witness struct {
// Stats contains cumulative statistics.
Stats WitnessStats `json:"stats"`
// Config contains auto-spawn configuration.
Config WitnessConfig `json:"config"`
// SpawnedIssues tracks which issues have been spawned (to avoid duplicates).
SpawnedIssues []string `json:"spawned_issues,omitempty"`
}
// WitnessConfig contains configuration for the witness.
type WitnessConfig struct {
// MaxWorkers is the maximum number of concurrent polecats (default: 4).
MaxWorkers int `json:"max_workers"`
// SpawnDelayMs is the delay between spawns in milliseconds (default: 5000).
SpawnDelayMs int `json:"spawn_delay_ms"`
// AutoSpawn enables automatic spawning for ready issues (default: true).
AutoSpawn bool `json:"auto_spawn"`
// EpicID limits spawning to children of this epic (optional).
EpicID string `json:"epic_id,omitempty"`
// IssuePrefix limits spawning to issues with this prefix (optional).
IssuePrefix string `json:"issue_prefix,omitempty"`
}
// WitnessStats contains cumulative witness statistics.