07d4740d0c
Claude Code records subagent/peer reports, task notifications, reminders and skill bodies as user-role entries. Classify them server-side (history and live stream) by origin/isMeta/queued_command mode: reports become kind agent_report, task notifications kind notice, harness meta is hidden, and the mid-turn wrapper is unwrapped to the operator's text. The app draws a collapsed Agent report card and a one-line system notice on the agent's side.
1.7 KiB
1.7 KiB
Claude chat: harness-injected user entries
Claude Code records more than the operator's prompts as user-role input. The
server (internal/claude/injected.go) classifies each one for history
(transcript.go) and the live stream (translate.go):
| Entry | Identified by | Shown as |
|---|---|---|
| Subagent / peer report | origin.kind == "peer" (user entry or queued_command attachment, often isMeta), or text opening <agent-message |
ChatMessage{role: assistant, kind: "agent_report"}; text is origin.handbackReportText, else the framed body with the 2-space indent removed; part name is the sender |
| Background task notification | origin.kind == "task-notification", queued_command with commandMode: "task-notification", a <task-notification> block, or the stream's system/task_notification |
kind: "notice", one line Background task finished: <summary>; id task-notice-<tool-use-id>-<status> dedupes repeats |
| Mid-turn wrapper | <system-reminder> + The user sent a new message while you were working: |
the operator's text only, as a user turn |
| Reminders, skill bodies, image placeholders, interrupt markers, local commands | isMeta, or a harness prefix (<system-reminder>, <local-command-, [Request interrupted by user, Base directory for this skill: …) |
hidden |
Report and notice ids are derived from content, so the live frame
(chat_event text with message_kind) and the history entry are one message.
Both carry role assistant, so a client that ignores kind still draws them
on the agent's side. The app renders them as a collapsed "Agent report" card
and a one-line system notice (ui/transcript/chat_injected_rows.dart).