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:
@@ -180,10 +180,19 @@ func (m *SessionManager) Start(polecat string, opts SessionStartOptions) error {
|
||||
return fmt.Errorf("ensuring runtime settings: %w", err)
|
||||
}
|
||||
|
||||
// Build startup command first
|
||||
// Build startup command with beacon for predecessor discovery.
|
||||
// Topic "assigned" already includes instructions in FormatStartupBeacon.
|
||||
address := fmt.Sprintf("%s/polecats/%s", m.rig.Name, polecat)
|
||||
beacon := session.FormatStartupBeacon(session.BeaconConfig{
|
||||
Recipient: address,
|
||||
Sender: "witness",
|
||||
Topic: "assigned",
|
||||
MolID: opts.Issue,
|
||||
})
|
||||
|
||||
command := opts.Command
|
||||
if command == "" {
|
||||
command = config.BuildPolecatStartupCommand(m.rig.Name, polecat, m.rig.Path, "")
|
||||
command = config.BuildPolecatStartupCommand(m.rig.Name, polecat, m.rig.Path, beacon)
|
||||
}
|
||||
// Prepend runtime config dir env if needed
|
||||
if runtimeConfig.Session != nil && runtimeConfig.Session.ConfigDirEnv != "" && opts.RuntimeConfigDir != "" {
|
||||
@@ -237,19 +246,6 @@ func (m *SessionManager) Start(polecat string, opts SessionStartOptions) error {
|
||||
runtime.SleepForReadyDelay(runtimeConfig)
|
||||
_ = runtime.RunStartupFallback(m.tmux, sessionID, "polecat", runtimeConfig)
|
||||
|
||||
// Inject startup nudge for predecessor discovery via /resume
|
||||
address := fmt.Sprintf("%s/polecats/%s", m.rig.Name, polecat)
|
||||
debugSession("StartupNudge", session.StartupNudge(m.tmux, sessionID, session.StartupNudgeConfig{
|
||||
Recipient: address,
|
||||
Sender: "witness",
|
||||
Topic: "assigned",
|
||||
MolID: opts.Issue,
|
||||
}))
|
||||
|
||||
// GUPP: Send propulsion nudge to trigger autonomous work execution
|
||||
time.Sleep(2 * time.Second)
|
||||
debugSession("NudgeSession PropulsionNudge", m.tmux.NudgeSession(sessionID, session.PropulsionNudge()))
|
||||
|
||||
// Verify session survived startup - if the command crashed, the session may have died.
|
||||
// Without this check, Start() would return success even if the pane died during initialization.
|
||||
running, err = m.tmux.HasSession(sessionID)
|
||||
|
||||
Reference in New Issue
Block a user