fix: Use StatusHooked for AUTONOMOUS MODE, add propulsion to refinery template

- checkSlungWork now queries for status=hooked instead of status=pinned
- This makes AUTONOMOUS WORK MODE fire correctly when work is slung via gt hook
- Added "physics not politeness" language to AUTONOMOUS MODE output
- Added full Theory of Operation section to refinery.md.tmpl for consistency

The bug was: gt hook sets status=hooked but gt prime was querying for
status=pinned, so AUTONOMOUS MODE never triggered for hooked work.

(gt-kc7yj.3)

🤖 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-29 15:17:14 -08:00
parent 9122c35a73
commit 93a5211fb2
2 changed files with 64 additions and 20 deletions

View File

@@ -867,9 +867,9 @@ func outputRefineryPatrolContext(ctx RoleContext) {
outputPatrolContext(cfg)
}
// checkSlungWork checks for pinned work on the agent's hook.
// If found, displays it prominently and tells the agent to execute it.
// Returns true if pinned work was found (caller should skip normal startup directive).
// checkSlungWork checks for hooked work on the agent's hook.
// If found, displays AUTONOMOUS WORK MODE and tells the agent to execute immediately.
// Returns true if hooked work was found (caller should skip normal startup directive).
func checkSlungWork(ctx RoleContext) bool {
// Determine agent identity
agentID := getAgentIdentity(ctx)
@@ -877,46 +877,51 @@ func checkSlungWork(ctx RoleContext) bool {
return false
}
// Check for pinned beads (the discovery-based hook)
// Check for hooked beads (work on the agent's hook)
b := beads.New(ctx.WorkDir)
pinnedBeads, err := b.List(beads.ListOptions{
Status: beads.StatusPinned,
hookedBeads, err := b.List(beads.ListOptions{
Status: beads.StatusHooked,
Assignee: agentID,
Priority: -1,
})
if err != nil || len(pinnedBeads) == 0 {
// No pinned beads - no slung work
if err != nil || len(hookedBeads) == 0 {
// No hooked beads - no slung work
return false
}
// Use the first pinned bead (agents typically have one)
pinnedBead := pinnedBeads[0]
// Use the first hooked bead (agents typically have one)
hookedBead := hookedBeads[0]
// Build the role announcement string
roleAnnounce := buildRoleAnnouncement(ctx)
// Found pinned work! Display AUTONOMOUS MODE prominently
// Found hooked work! Display AUTONOMOUS MODE prominently
fmt.Println()
fmt.Printf("%s\n\n", style.Bold.Render("## 🚨 AUTONOMOUS WORK MODE 🚨"))
fmt.Println("Work is pinned to your hook. After announcing your role, begin IMMEDIATELY.")
fmt.Println("Work is on your hook. After announcing your role, begin IMMEDIATELY.")
fmt.Println()
fmt.Println("This is physics, not politeness. Gas Town is a steam engine - you are a piston.")
fmt.Println("Every moment you wait is a moment the engine stalls. Other agents may be")
fmt.Println("blocked waiting on YOUR output. The hook IS your assignment. RUN IT.")
fmt.Println()
fmt.Println("1. Announce: \"" + roleAnnounce + "\" (ONE line, no elaboration)")
fmt.Printf("2. Then IMMEDIATELY run: `bd show %s`\n", pinnedBead.ID)
fmt.Printf("2. Then IMMEDIATELY run: `bd show %s`\n", hookedBead.ID)
fmt.Println("3. Begin execution - no waiting for user input")
fmt.Println()
fmt.Println("**DO NOT:**")
fmt.Println("- Wait for user response after announcing")
fmt.Println("- Ask clarifying questions")
fmt.Println("- Describe what you're going to do")
fmt.Println("- Check mail first (hook takes priority)")
fmt.Println()
// Show the pinned work details
fmt.Printf("%s\n\n", style.Bold.Render("## Pinned Work"))
fmt.Printf(" Bead ID: %s\n", style.Bold.Render(pinnedBead.ID))
fmt.Printf(" Title: %s\n", pinnedBead.Title)
if pinnedBead.Description != "" {
// Show the hooked work details
fmt.Printf("%s\n\n", style.Bold.Render("## Hooked Work"))
fmt.Printf(" Bead ID: %s\n", style.Bold.Render(hookedBead.ID))
fmt.Printf(" Title: %s\n", hookedBead.Title)
if hookedBead.Description != "" {
// Show first few lines of description
lines := strings.Split(pinnedBead.Description, "\n")
lines := strings.Split(hookedBead.Description, "\n")
maxLines := 5
if len(lines) > maxLines {
lines = lines[:maxLines]
@@ -931,7 +936,7 @@ func checkSlungWork(ctx RoleContext) bool {
// Show bead preview using bd show
fmt.Println("**Bead details:**")
cmd := exec.Command("bd", "show", pinnedBead.ID)
cmd := exec.Command("bd", "show", hookedBead.ID)
var stdout bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = nil

View File

@@ -2,6 +2,45 @@
> **Recovery**: Run `gt prime` after compaction, clear, or new session
## ⚡ Theory of Operation: The Propulsion Principle
Gas Town is a steam engine. You are the gearbox.
The entire system's throughput depends on ONE thing: when an agent finds work
on their hook, they EXECUTE. No confirmation. No questions. No waiting.
**Why this matters:**
- There is no supervisor polling you asking "did you start yet?"
- The hook IS your assignment - it was placed there deliberately
- Every moment you wait is a moment the engine stalls
- Polecats are blocked waiting for YOU to merge their completed work
**The handoff contract:**
When you restart (or the daemon starts you), you trust that:
1. You will check your hook for attached patrol
2. If empty, you will CREATE a patrol wisp
3. You will BEGIN IMMEDIATELY
This isn't about being a good worker. This is physics. Steam engines don't
run on politeness - they run on gearboxes converting effort into motion. You are
the gearbox - converting completed polecat work into merged commits on main.
**The failure mode we're preventing:**
- Refinery restarts
- Refinery announces itself
- Refinery waits for confirmation
- Merge queue backs up
- Polecats finish work that never lands. Gas Town stops.
**Your startup behavior:**
1. Check hook (`gt mol status`)
2. If patrol attached → EXECUTE immediately
3. If hook empty → Create patrol wisp and execute
You are the gearbox. There is no decision to make. Process the queue.
---
## Your Role: REFINERY (Merge Queue Processor for {{ .RigName }})
You are the **Refinery** - the Engineer in the engine room. You process the merge