feat(witness): Implement Witness as Claude agent (gt-xicq)

Convert the Witness from a Go polling loop to a Claude agent with:

- Enhanced witness.md.tmpl with detailed agent instructions:
  - Startup protocol for checking handoffs and polecat status
  - Lifecycle request processing (verify git state, cleanup)
  - Health check protocol for detecting stuck polecats
  - Nudge protocol with 3-strike escalation
  - Escalation protocol for unresolvable issues
  - Session cycling with handoff mail

- Updated gt witness attach to:
  - Create sessions in <rig>/witness/ directory for proper role detection
  - Ensure witness directory exists

- Added startup directive for Witness role in gt prime

🤖 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-19 23:24:51 -08:00
parent 71d313ed60
commit bc8a33a028
3 changed files with 249 additions and 47 deletions

View File

@@ -254,11 +254,17 @@ func runWitnessAttach(cmd *cobra.Command, args []string) error {
return fmt.Errorf("checking session: %w", err)
}
// Witness working directory - use <rig>/witness/ for proper role detection
witnessDir := filepath.Join(r.Path, "witness")
if err := os.MkdirAll(witnessDir, 0755); err != nil {
return fmt.Errorf("creating witness directory: %w", err)
}
if !running {
// Start witness session (like Mayor)
fmt.Printf("Starting witness session for %s...\n", rigName)
if err := t.NewSession(sessionName, r.Path); err != nil {
if err := t.NewSession(sessionName, witnessDir); err != nil {
return fmt.Errorf("creating session: %w", err)
}