fix(startup): unify agent startup with beacon + instructions in CLI prompt (#977)
All agents now receive their startup beacon + role-specific instructions via the CLI prompt, making sessions identifiable in /resume picker while removing unreliable post-startup nudges. Changes: - Rename FormatStartupNudge → FormatStartupBeacon, StartupNudgeConfig → BeaconConfig - Remove StartupNudge() function (no longer needed) - Remove PropulsionNudge() and PropulsionNudgeForRole() functions - Update deacon, witness, refinery, polecat managers to include beacon in CLI prompt - Update boot to inline beacon (can't import session due to import cycle) - Update daemon/lifecycle.go to include beacon via BuildCommandWithPrompt - Update cmd/deacon.go to include beacon in startup command - Remove redundant StartupNudge and PropulsionNudge calls from all startup paths The beacon is now part of the CLI prompt which is queued before Claude starts, making it more reliable than post-startup nudges which had timing issues. SessionStart hook runs gt prime automatically, so PropulsionNudge was redundant. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,9 +3,6 @@ package session
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Prefix is the common prefix for rig-level Gas Town tmux sessions.
|
||||
@@ -46,57 +43,12 @@ func PolecatSessionName(rig, name string) string {
|
||||
return fmt.Sprintf("%s%s-%s", Prefix, rig, name)
|
||||
}
|
||||
|
||||
// PropulsionNudge generates the GUPP (Gas Town Universal Propulsion Principle) nudge.
|
||||
// This is sent after the beacon to trigger autonomous work execution.
|
||||
// The agent receives this as user input, triggering the propulsion principle:
|
||||
// "If work is on your hook, YOU RUN IT."
|
||||
func PropulsionNudge() string {
|
||||
return "Run `gt hook` to check your hook and begin work."
|
||||
// BootSessionName returns the session name for the Boot watchdog.
|
||||
// Note: We use "gt-boot" instead of "hq-deacon-boot" to avoid tmux prefix
|
||||
// matching collisions. Tmux matches session names by prefix, so "hq-deacon-boot"
|
||||
// would match when checking for "hq-deacon", causing HasSession("hq-deacon")
|
||||
// to return true when only Boot is running.
|
||||
func BootSessionName() string {
|
||||
return Prefix + "boot"
|
||||
}
|
||||
|
||||
// PropulsionNudgeForRole generates a role-specific GUPP nudge.
|
||||
// Different roles have different startup flows:
|
||||
// - polecat/crew: Check hook for slung work
|
||||
// - witness/refinery: Start patrol cycle
|
||||
// - deacon: Start heartbeat patrol
|
||||
// - mayor: Check mail for coordination work
|
||||
//
|
||||
// The workDir parameter is used to locate .runtime/session_id for including
|
||||
// session ID in the message (for Claude Code /resume picker discovery).
|
||||
func PropulsionNudgeForRole(role, workDir string) string {
|
||||
var msg string
|
||||
switch role {
|
||||
case "polecat", "crew":
|
||||
msg = PropulsionNudge()
|
||||
case "witness":
|
||||
msg = "Run `gt prime` to check patrol status and begin work."
|
||||
case "refinery":
|
||||
msg = "Run `gt prime` to check MQ status and begin patrol."
|
||||
case "deacon":
|
||||
msg = "Run `gt prime` to check patrol status and begin heartbeat cycle."
|
||||
case "mayor":
|
||||
msg = "Run `gt prime` to check mail and begin coordination."
|
||||
default:
|
||||
msg = PropulsionNudge()
|
||||
}
|
||||
|
||||
// Append session ID if available (for /resume picker visibility)
|
||||
if sessionID := readSessionID(workDir); sessionID != "" {
|
||||
msg = fmt.Sprintf("%s [session:%s]", msg, sessionID)
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
// readSessionID reads the session ID from .runtime/session_id if it exists.
|
||||
// Returns empty string if the file doesn't exist or can't be read.
|
||||
func readSessionID(workDir string) string {
|
||||
if workDir == "" {
|
||||
return ""
|
||||
}
|
||||
sessionPath := filepath.Join(workDir, ".runtime", "session_id")
|
||||
data, err := os.ReadFile(sessionPath)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(string(data))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user