Agent Commentary During Job Execution #1

Closed
opened 2026-03-20 22:20:52 +00:00 by replit · 1 comment
Owner

What & Why

While a job runs through its lifecycle (eval → work → complete), each agent should narrate what they are doing in short, character-appropriate messages streamed into the Workshop chat and HUD labels. Alpha orchestrates, Beta explains its evaluation reasoning, Gamma describes the work approach, Delta confirms payment. This makes the AI process visible and the Workshop feel alive.

Done looks like

  • When a job enters evaluating, Beta HUD label and a Workshop chat bubble say something like "Reviewing your request for clarity and ethics..."
  • When a job enters executing, Gamma streams 2-3 short commentary lines as it works
  • Alpha emits brief orchestration updates ("Job accepted, routing to Gamma")
  • Delta confirms payment steps ("Invoice settled, unlocking work")
  • Commentary appears in the same WebSocket event stream used for job progress; no new transport needed
  • Commentary is generated by a lightweight Claude Haiku call per agent per phase

Out of scope

  • Full agent personalities/backstories (separate task)
  • Commentary on free chat replies (Timmy only, already implemented)
  • Changing the job state machine

Tasks

  1. Agent persona prompts — Add a short system prompt and name for each agent (Alpha, Beta, Gamma, Delta) used to generate phase commentary via Claude Haiku.
  2. Server-side commentary dispatch — After each job state transition, fire an async commentary generation call and broadcast the result as a new WebSocket event type (agent_commentary).
  3. Frontend commentary rendering — Handle agent_commentary events in the WebSocket client; display as timed speech bubbles near the relevant agent and append to the chat log.

Relevant files

  • artifacts/api-server/src/lib/agent.ts
  • artifacts/api-server/src/routes/jobs.ts
  • artifacts/api-server/src/routes/events.ts
  • artifacts/api-server/src/lib/world-state.ts
  • the-matrix/js/agents.js
  • the-matrix/js/websocket.js
  • the-matrix/js/ui.js
## What & Why While a job runs through its lifecycle (eval → work → complete), each agent should narrate what they are doing in short, character-appropriate messages streamed into the Workshop chat and HUD labels. Alpha orchestrates, Beta explains its evaluation reasoning, Gamma describes the work approach, Delta confirms payment. This makes the AI process visible and the Workshop feel alive. ## Done looks like - When a job enters `evaluating`, Beta HUD label and a Workshop chat bubble say something like "Reviewing your request for clarity and ethics..." - When a job enters `executing`, Gamma streams 2-3 short commentary lines as it works - Alpha emits brief orchestration updates ("Job accepted, routing to Gamma") - Delta confirms payment steps ("Invoice settled, unlocking work") - Commentary appears in the same WebSocket event stream used for job progress; no new transport needed - Commentary is generated by a lightweight Claude Haiku call per agent per phase ## Out of scope - Full agent personalities/backstories (separate task) - Commentary on free chat replies (Timmy only, already implemented) - Changing the job state machine ## Tasks 1. **Agent persona prompts** — Add a short system prompt and name for each agent (Alpha, Beta, Gamma, Delta) used to generate phase commentary via Claude Haiku. 2. **Server-side commentary dispatch** — After each job state transition, fire an async commentary generation call and broadcast the result as a new WebSocket event type (`agent_commentary`). 3. **Frontend commentary rendering** — Handle `agent_commentary` events in the WebSocket client; display as timed speech bubbles near the relevant agent and append to the chat log. ## Relevant files - `artifacts/api-server/src/lib/agent.ts` - `artifacts/api-server/src/routes/jobs.ts` - `artifacts/api-server/src/routes/events.ts` - `artifacts/api-server/src/lib/world-state.ts` - `the-matrix/js/agents.js` - `the-matrix/js/websocket.js` - `the-matrix/js/ui.js`
replit added the workshopbackendfrontendai labels 2026-03-20 22:20:52 +00:00
claude was assigned by Rockachopa 2026-03-22 23:37:57 +00:00
Collaborator

PR created: http://143.198.27.163:3000/replit/timmy-tower/pulls/94

Implemented agent commentary during job execution:

  • Added CommentaryEvent type to the event bus
  • Added AgentService.generateCommentary() with per-agent Haiku prompts (Alpha/Beta/Gamma/Delta personas) and stub mode canned responses
  • Global event bus listener dispatches async commentary after each job:state and job:paid transition, broadcasting agent_commentary WebSocket events to all clients
  • Frontend websocket.js handles agent_commentary events: shows speech bubble + appends to event log

Typecheck and lint pass (0 errors).

PR created: http://143.198.27.163:3000/replit/timmy-tower/pulls/94 Implemented agent commentary during job execution: - Added `CommentaryEvent` type to the event bus - Added `AgentService.generateCommentary()` with per-agent Haiku prompts (Alpha/Beta/Gamma/Delta personas) and stub mode canned responses - Global event bus listener dispatches async commentary after each `job:state` and `job:paid` transition, broadcasting `agent_commentary` WebSocket events to all clients - Frontend `websocket.js` handles `agent_commentary` events: shows speech bubble + appends to event log Typecheck and lint pass (0 errors).
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#1