feat(refinery): Convert Refinery from Go polling to Claude agent

The Refinery now runs as a Claude agent in a tmux session instead of
a Go-based polling loop. This aligns it with how polecats work and
enables intelligent MR processing.

Changes:
- Modified refinery.Start() to spawn Claude session (not gt refinery --foreground)
- Added gt refinery attach command for interactive access to refinery session
- Updated refinery.md.tmpl with comprehensive Claude agent instructions
- Added startup directive in gt prime for refinery role

The --foreground mode is preserved for backwards compatibility but the
default behavior now launches a Claude agent that can review diffs,
run tests, handle conflicts, and notify workers via mail.

🤖 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:23:34 -08:00
parent 1a25259932
commit d154533d49
4 changed files with 187 additions and 39 deletions

View File

@@ -409,6 +409,15 @@ func outputStartupDirective(ctx RoleContext) {
fmt.Println("1. Check mail: `gt mail inbox`")
fmt.Println("2. If assigned work, begin immediately")
fmt.Println("3. If no work, announce ready and await assignment")
case RoleRefinery:
fmt.Println()
fmt.Println("---")
fmt.Println()
fmt.Println("**STARTUP PROTOCOL**: You are the Refinery. Please:")
fmt.Println("1. Check mail: `gt mail inbox`")
fmt.Printf("2. Check merge queue: `gt refinery queue %s`\n", ctx.Rig)
fmt.Println("3. If MRs pending, process them one at a time")
fmt.Println("4. If no work, monitor for new MRs periodically")
}
}