Problem
Subagent sessions currently appear as separate tiles in the dashboard (or are filtered out entirely via id NOT LIKE 'agent-%' in db.py). This makes it hard to see the relationship between a parent session and its subagents. Other tools like Agentsview don't show subagents at all — we have the data, but we're not presenting it effectively.
Proposed Change
Nest subagent sessions within their parent session's tile instead of treating them as independent entries.
Investigation Findings
Hook event payloads (confirmed)
SubagentStart provides:
| Field |
Description |
session_id |
Parent session's ID |
agent_id |
Subagent's unique ID (e.g., agent-abc123) |
agent_type |
Agent type (e.g., "Explore", "Plan", "Bash") |
cwd |
Current working directory |
transcript_path |
Path to parent session's transcript |
SubagentStop additionally provides:
| Field |
Description |
agent_transcript_path |
Path to subagent's own transcript file |
last_assistant_message |
Subagent's final response text |
Key finding: The parent-child relationship is explicit — session_id is the parent, agent_id is the child. No inference needed.
Current behavior
SubagentStart/SubagentStop events are received but agent_id and agent_type are ignored
- Subagent sessions get their own row in
sessions with id prefixed agent-
get_all_active_sessions() filters them out: AND id NOT LIKE 'agent-%'
- No
parent_session_id column exists in the schema
Implementation Plan
Backend
- DB migration: Add
parent_session_id TEXT and agent_type TEXT columns to sessions table
- Hook processing (
server/hooks.py): On SubagentStart, create/update the subagent session using agent_id as the session ID, storing session_id as parent_session_id and extracting agent_type
- On
SubagentStop: Update the subagent session with status, store last_assistant_message as task description or activity preview
- API (
server/routes/api.py): Nest subagent sessions under their parent in /api/sessions response (add subagents: [...] array to each parent session)
- Remove filter: Stop filtering out
agent-* sessions from the main query (they'll be nested instead)
- Watcher (
server/watcher.py): Optionally parse agent_transcript_path for subagent transcripts
Frontend
- Session tile: Add a collapsible "Subagents" section inside the parent session card
- Compact subagent rows: Show status dot, agent_type, description/display_name, duration, and cost
- Real-time updates: Ensure WebSocket
session_update messages correctly update nested subagent state within the parent tile
Problem
Subagent sessions currently appear as separate tiles in the dashboard (or are filtered out entirely via
id NOT LIKE 'agent-%'indb.py). This makes it hard to see the relationship between a parent session and its subagents. Other tools like Agentsview don't show subagents at all — we have the data, but we're not presenting it effectively.Proposed Change
Nest subagent sessions within their parent session's tile instead of treating them as independent entries.
Investigation Findings
Hook event payloads (confirmed)
SubagentStartprovides:session_idagent_idagent-abc123)agent_typecwdtranscript_pathSubagentStopadditionally provides:agent_transcript_pathlast_assistant_messageKey finding: The parent-child relationship is explicit —
session_idis the parent,agent_idis the child. No inference needed.Current behavior
SubagentStart/SubagentStopevents are received butagent_idandagent_typeare ignoredsessionswithidprefixedagent-get_all_active_sessions()filters them out:AND id NOT LIKE 'agent-%'parent_session_idcolumn exists in the schemaImplementation Plan
Backend
parent_session_id TEXTandagent_type TEXTcolumns tosessionstableserver/hooks.py): OnSubagentStart, create/update the subagent session usingagent_idas the session ID, storingsession_idasparent_session_idand extractingagent_typeSubagentStop: Update the subagent session with status, storelast_assistant_messageas task description or activity previewserver/routes/api.py): Nest subagent sessions under their parent in/api/sessionsresponse (addsubagents: [...]array to each parent session)agent-*sessions from the main query (they'll be nested instead)server/watcher.py): Optionally parseagent_transcript_pathfor subagent transcriptsFrontend
session_updatemessages correctly update nested subagent state within the parent tile