Implement town activity logging (gt-ewzon)

Add centralized logging for Gas Town agent lifecycle events:
- spawn: new agent created
- wake: agent resumed
- nudge: message injected
- handoff: agent handed off
- done: agent finished work
- crash: agent exited unexpectedly
- kill: agent killed intentionally

Implementation:
- Add internal/townlog package with LogEvent() function
- Log to ~/gt/logs/town.log with human-readable format
- Add gt log command to view/tail/filter logs
- Integrate logging into spawn, nudge, handoff, done, stop, session commands

🤖 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-26 15:51:28 -08:00
parent d524f65af3
commit e2b8f16c48
9 changed files with 903 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/style"
"github.com/steveyegge/gastown/internal/tmux"
"github.com/steveyegge/gastown/internal/workspace"
)
func init() {
@@ -60,6 +61,11 @@ func runNudge(cmd *cobra.Command, args []string) error {
}
fmt.Printf("%s Nudged %s/%s\n", style.Bold.Render("✓"), rigName, polecatName)
// Log nudge event
if townRoot, err := workspace.FindFromCwd(); err == nil && townRoot != "" {
LogNudge(townRoot, target, message)
}
} else {
// Raw session name (legacy)
exists, err := t.HasSession(target)
@@ -75,6 +81,11 @@ func runNudge(cmd *cobra.Command, args []string) error {
}
fmt.Printf("✓ Nudged %s\n", target)
// Log nudge event
if townRoot, err := workspace.FindFromCwd(); err == nil && townRoot != "" {
LogNudge(townRoot, target, message)
}
}
return nil