Summary
Add agent source tracking to messages — tag each message with its originating agent (orchestrator, subagent, etc.) to enable multi-agent context support in the TUI.
Motivation
The TUI currently has no concept of agent source. All messages flow through a single linear chat with no distinction between orchestrator output and subagent output. As the system evolves to support multi-agent orchestration (DeepAgents), users need to see which agent produced which response. This enables:
- Context switching (tabs or panels) per agent
- Visual distinction of agent source in the chat
- Debugging multi-agent workflows
Proposed Solution
- Add
agentName field to the Message model (messages.js typedef)
- Update
addMessage, updateMessage, and setMessages in messageList.js to accept/pass agentName
- Update MessageBubble to display agent name in the role label (or as a separate badge)
- Update app.js streaming handlers to pass agent name from graph events
- Add config for default agent display name (e.g.,
tui.defaultAgentName)
Alternatives Considered
- Using the existing
role field — too coarse (user/assistant/system), no subagent distinction
- Tool call display for agent attribution — already used for tool results, not suitable
- Separate message types per agent — over-engineered, agentName on existing model is simpler
OpenSpec Note
This project uses OpenSpec for feature development. If this request is approved, I will:
- Run
/opsx:propose to generate a full proposal with specs and tasks
- Iterate on the design before any code is written
- Follow the task-driven implementation workflow
Additional Context
- Message model has role/content/reasoningContent/activeToolCall/toolCallDisplay/time/streaming —
agentName is a natural addition
- No agent tracking exists at any layer currently — this is a new capability
- The graph/streaming layer needs to be updated to pass agent names from events
Audit Findings (for Issue #601)
- src/tui/messages.js:2-10 — Message typedef, needs
agentName property
- src/tui/messageList.js:117-135 —
addMessage accepts options, needs agentName handling
- src/tui/messageList.js:143-161 —
updateMessage merges updates, agentName would flow through
- src/tui/messageList.js:187-211 —
setMessages loads from array, needs agentName passthrough
- src/tui/messageList.js:354-369 — MessageBubble creation, needs
agentName prop
- src/tui/messageBubble.js:119-128 — Props destructuring, needs
agentName
- src/tui/messageBubble.js:224-229 — Role label rendering, agent name could be displayed here or as a badge
- src/tui/app.js:684-700 —
createStreamingHandler needs to capture agent name from events
- src/tui/app.js:709-735 —
finalizeStreaming needs to pass agent name to message update
Implementation scope: 4 files touched (messages.js, messageList.js, messageBubble.js, app.js). Requires graph/streaming changes to supply agent names. Medium complexity, foundational for multi-agent support.
Summary
Add agent source tracking to messages — tag each message with its originating agent (orchestrator, subagent, etc.) to enable multi-agent context support in the TUI.
Motivation
The TUI currently has no concept of agent source. All messages flow through a single linear chat with no distinction between orchestrator output and subagent output. As the system evolves to support multi-agent orchestration (DeepAgents), users need to see which agent produced which response. This enables:
Proposed Solution
agentNamefield to the Message model (messages.js typedef)addMessage,updateMessage, andsetMessagesin messageList.js to accept/passagentNametui.defaultAgentName)Alternatives Considered
rolefield — too coarse (user/assistant/system), no subagent distinctionOpenSpec Note
This project uses OpenSpec for feature development. If this request is approved, I will:
/opsx:proposeto generate a full proposal with specs and tasksAdditional Context
agentNameis a natural additionAudit Findings (for Issue #601)
agentNamepropertyaddMessageaccepts options, needsagentNamehandlingupdateMessagemerges updates,agentNamewould flow throughsetMessagesloads from array, needsagentNamepassthroughagentNamepropagentNamecreateStreamingHandlerneeds to capture agent name from eventsfinalizeStreamingneeds to pass agent name to message updateImplementation scope: 4 files touched (messages.js, messageList.js, messageBubble.js, app.js). Requires graph/streaming changes to supply agent names. Medium complexity, foundational for multi-agent support.