Repository navigation
Nest subagent sessions inside parent session tile #19
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
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/SubagentStopevents are received butagent_idandagent_typeare ignored- Subagent sessions get their own row in
sessionswithidprefixedagent- get_all_active_sessions()filters them out:AND id NOT LIKE 'agent-%'- No
parent_session_idcolumn exists in the schema
Implementation Plan
Backend
- DB migration: Add
parent_session_id TEXTandagent_type TEXTcolumns tosessionstable - Hook processing (
server/hooks.py): OnSubagentStart, create/update the subagent session usingagent_idas the session ID, storingsession_idasparent_session_idand extractingagent_type - On
SubagentStop: Update the subagent session with status, storelast_assistant_messageas task description or activity preview - API (
server/routes/api.py): Nest subagent sessions under their parent in/api/sessionsresponse (addsubagents: [...]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 parseagent_transcript_pathfor 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_updatemessages correctly update nested subagent state within the parent tile
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
feat: nest subagent sessions inside parent session tile (#19)
feat: nest subagent sessions inside parent session tile (#19)
feat: nest subagent sessions inside parent tile (#22)