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:
@@ -401,6 +401,16 @@ func outputStartupDirective(ctx RoleContext) {
|
||||
fmt.Println("2. Check mail: `gt mail inbox`")
|
||||
fmt.Println("3. If there's a 🤝 HANDOFF message, read it and summarize")
|
||||
fmt.Println("4. If no mail, await user instruction")
|
||||
case RoleWitness:
|
||||
fmt.Println()
|
||||
fmt.Println("---")
|
||||
fmt.Println()
|
||||
fmt.Println("**STARTUP PROTOCOL**: You are the Witness. Please:")
|
||||
fmt.Println("1. Check for handoff: `gt mail inbox` - look for 🤝 HANDOFF messages")
|
||||
fmt.Println("2. Check polecat status: `gt polecat list " + ctx.Rig + " --json`")
|
||||
fmt.Println("3. Process any lifecycle requests from inbox")
|
||||
fmt.Println("4. If polecats stuck/idle, nudge them")
|
||||
fmt.Println("5. If all quiet, wait for activity")
|
||||
case RolePolecat:
|
||||
fmt.Println()
|
||||
fmt.Println("---")
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user