spawn: Add work instruction + export SessionName
- Export session.Manager.SessionName for spawn.go access - Add --address alias for --identity in mail inbox/check - Send explicit work instruction to polecat after spawn - Add CapturePaneLines and WaitForClaudeReady helpers (unused for now) - Proper solution filed as gt-hb0 (needs Witness/Deacon AI monitoring) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -177,6 +177,7 @@ func init() {
|
||||
mailInboxCmd.Flags().BoolVar(&mailInboxJSON, "json", false, "Output as JSON")
|
||||
mailInboxCmd.Flags().BoolVarP(&mailInboxUnread, "unread", "u", false, "Show only unread messages")
|
||||
mailInboxCmd.Flags().StringVar(&mailInboxIdentity, "identity", "", "Explicit identity for inbox (e.g., gastown/Toast)")
|
||||
mailInboxCmd.Flags().StringVar(&mailInboxIdentity, "address", "", "Alias for --identity")
|
||||
|
||||
// Read flags
|
||||
mailReadCmd.Flags().BoolVar(&mailReadJSON, "json", false, "Output as JSON")
|
||||
@@ -185,6 +186,7 @@ func init() {
|
||||
mailCheckCmd.Flags().BoolVar(&mailCheckInject, "inject", false, "Output format for Claude Code hooks")
|
||||
mailCheckCmd.Flags().BoolVar(&mailCheckJSON, "json", false, "Output as JSON")
|
||||
mailCheckCmd.Flags().StringVar(&mailCheckIdentity, "identity", "", "Explicit identity for inbox (e.g., gastown/Toast)")
|
||||
mailCheckCmd.Flags().StringVar(&mailCheckIdentity, "address", "", "Alias for --identity")
|
||||
|
||||
// Thread flags
|
||||
mailThreadCmd.Flags().BoolVar(&mailThreadJSON, "json", false, "Output as JSON")
|
||||
|
||||
@@ -336,7 +336,21 @@ func runSpawn(cmd *cobra.Command, args []string) error {
|
||||
fmt.Printf("%s Session started. Attach with: %s\n",
|
||||
style.Bold.Render("✓"),
|
||||
style.Dim.Render(fmt.Sprintf("gt session at %s/%s", rigName, polecatName)))
|
||||
fmt.Printf(" %s\n", style.Dim.Render("Polecat will read work assignment from inbox on startup"))
|
||||
|
||||
// TODO: Proper solution requires Witness/Deacon to monitor polecat startup
|
||||
// and detect when Claude is ready using AI intelligence. See gt-polecat-ready issue.
|
||||
// For now, use a fixed delay - SessionStart hook runs gt prime which tells polecat
|
||||
// to check mail, but we also send an explicit instruction as backup.
|
||||
sessionName := sessMgr.SessionName(polecatName)
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
// Send work instruction - backup in case SessionStart hook doesn't trigger action
|
||||
workInstruction := "Check your inbox with `gt mail inbox` and begin working on your assigned issue."
|
||||
if err := t.SendKeys(sessionName, workInstruction); err != nil {
|
||||
fmt.Printf(" %s\n", style.Dim.Render(fmt.Sprintf("Warning: could not send work instruction: %v", err)))
|
||||
}
|
||||
|
||||
fmt.Printf(" %s\n", style.Dim.Render("Work instruction sent to polecat"))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user