[claude] Agent commentary during job execution (#1) #94

Merged
claude merged 1 commits from claude/issue-1 into main 2026-03-23 20:41:58 +00:00
Collaborator

Fixes #1

Adds character-appropriate narration for each agent (Alpha, Beta, Gamma, Delta) at each job lifecycle phase.

Changes

  • event-bus.ts: Added CommentaryEvent type (agent_commentary) to the BusEvent union
  • agent.ts: Added AgentService.generateCommentary(agentId, phase, context?) method with per-agent Haiku prompts and stub mode canned responses
  • events.ts: Added global event bus listener in attachWebSocketServer that fires async commentary generation after job:state and job:paid transitions, broadcasting agent_commentary events to all WebSocket clients
  • websocket.js: Added agent_commentary handler that shows speech bubbles and appends to the event log

How it works

  • Beta narrates during evaluating: "Reviewing your request for clarity and ethics..."
  • Alpha announces routing: "Routing job to Gamma for execution."
  • Gamma describes work during executing: "Analysing the task. Ready to work."
  • Delta confirms payments: " Work payment confirmed. Unlocking execution."
  • In stub mode, canned responses are used; in live mode, Claude Haiku generates contextual commentary (max 60 tokens)
  • All commentary is fire-and-forget, non-blocking, and non-fatal on error
Fixes #1 Adds character-appropriate narration for each agent (Alpha, Beta, Gamma, Delta) at each job lifecycle phase. ## Changes - **event-bus.ts**: Added `CommentaryEvent` type (`agent_commentary`) to the `BusEvent` union - **agent.ts**: Added `AgentService.generateCommentary(agentId, phase, context?)` method with per-agent Haiku prompts and stub mode canned responses - **events.ts**: Added global event bus listener in `attachWebSocketServer` that fires async commentary generation after `job:state` and `job:paid` transitions, broadcasting `agent_commentary` events to all WebSocket clients - **websocket.js**: Added `agent_commentary` handler that shows speech bubbles and appends to the event log ## How it works - Beta narrates during `evaluating`: "Reviewing your request for clarity and ethics..." - Alpha announces routing: "Routing job to Gamma for execution." - Gamma describes work during `executing`: "Analysing the task. Ready to work." - Delta confirms payments: "⚡ Work payment confirmed. Unlocking execution." - In stub mode, canned responses are used; in live mode, Claude Haiku generates contextual commentary (max 60 tokens) - All commentary is fire-and-forget, non-blocking, and non-fatal on error
claude added 1 commit 2026-03-23 20:41:35 +00:00
feat: agent commentary during job execution
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
29d4a53f8a
Add character-appropriate narration for each agent (Alpha, Beta, Gamma,
Delta) at each job lifecycle phase. Generated by Claude Haiku per agent
per phase and broadcast as agent_commentary WebSocket events.

- Add CommentaryEvent type to event-bus.ts
- Add AgentService.generateCommentary() with per-agent personas and
  stub mode canned responses
- Dispatch commentary in events.ts after job:state and job:paid
  transitions via a global event bus listener
- Handle agent_commentary on frontend: show speech bubble + event log

Fixes #1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude merged commit 2ad3403061 into main 2026-03-23 20:41:58 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#94