Instrument gt commands to appear in activity feed (gt-7aw1m)
Phase 1 of activity feed improvements: gt commands now log events to
~/gt/.events.jsonl. This is the raw audit log that the feed daemon
(phase 2) will curate into the user-facing feed.
Instrumented commands:
- gt sling: logs sling events with bead and target
- gt hook: logs hook events with bead
- gt handoff: logs handoff events with subject
- gt done: logs done events with bead and branch
- gt mail send: logs mail events with to and subject
Event format follows the specification:
```json
{"ts":"2025-12-30T07:36:28Z","source":"gt","type":"mail",
"actor":"gastown/crew/joe","payload":{...},"visibility":"feed"}
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/gastown/internal/beads"
|
||||
"github.com/steveyegge/gastown/internal/events"
|
||||
"github.com/steveyegge/gastown/internal/session"
|
||||
"github.com/steveyegge/gastown/internal/style"
|
||||
"github.com/steveyegge/gastown/internal/tmux"
|
||||
@@ -330,6 +331,10 @@ func runSling(cmd *cobra.Command, args []string) error {
|
||||
|
||||
fmt.Printf("%s Work attached to hook (status=hooked)\n", style.Bold.Render("✓"))
|
||||
|
||||
// Log sling event to activity feed
|
||||
actor := detectActor()
|
||||
_ = events.LogFeed(events.TypeSling, actor, events.SlingPayload(beadID, targetAgent))
|
||||
|
||||
// Update agent bead's hook_bead field (ZFC: agents track their current work)
|
||||
updateAgentHookBead(targetAgent, beadID)
|
||||
|
||||
@@ -688,6 +693,12 @@ func runSlingFormula(args []string) error {
|
||||
}
|
||||
fmt.Printf("%s Attached to hook (status=hooked)\n", style.Bold.Render("✓"))
|
||||
|
||||
// Log sling event to activity feed (formula slinging)
|
||||
actor := detectActor()
|
||||
payload := events.SlingPayload(wispResult.RootID, targetAgent)
|
||||
payload["formula"] = formulaName
|
||||
_ = events.LogFeed(events.TypeSling, actor, payload)
|
||||
|
||||
// Update agent bead's hook_bead field (ZFC: agents track their current work)
|
||||
updateAgentHookBead(targetAgent, wispResult.RootID)
|
||||
|
||||
@@ -768,6 +779,15 @@ func wakeRigAgents(rigName string) {
|
||||
_ = t.NudgeSession(refinerySession, "Polecat dispatched - check for merge requests")
|
||||
}
|
||||
|
||||
// detectActor returns the current agent's actor string for event logging.
|
||||
func detectActor() string {
|
||||
roleInfo, err := GetRole()
|
||||
if err != nil {
|
||||
return "unknown"
|
||||
}
|
||||
return roleInfo.ActorString()
|
||||
}
|
||||
|
||||
// agentIDToBeadID converts an agent ID to its corresponding agent bead ID.
|
||||
// Uses canonical naming: prefix-rig-role-name
|
||||
func agentIDToBeadID(agentID string) string {
|
||||
|
||||
Reference in New Issue
Block a user