Files
amc/plans/subagent-visibility.md
teernisse fb9d4e5b9f chore(plans): update implementation plans
plans/PLAN-tool-result-display.md:
- Add comprehensive plan for displaying tool results inline in
  conversation view, including truncation strategies and expand/collapse
  UI patterns

plans/subagent-visibility.md:
- Mark completed phases and update remaining work items
- Reflects current state of subagent tracking implementation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-28 00:49:02 -05:00

52 lines
1.9 KiB
Markdown

# Subagent & Agent Team Visibility for AMC
> **Status**: Draft
> **Last Updated**: 2026-02-27
## Summary
Add a button in the turn stats section showing the count of active subagents/team members. Clicking it opens a list with names and lifetime stats (time taken, tokens used). Mirrors Claude Code's own agent display.
---
## User Workflow
1. User views a session card in AMC
2. Turn stats area shows: `2h 15m | 84k tokens | 3 agents`
3. User clicks "3 agents" button
4. List opens showing:
```
claude-code-guide (running) 12m 42,000 tokens
Explore (completed) 3m 18,500 tokens
Explore (completed) 5m 23,500 tokens
```
5. List updates in real-time as agents complete
---
## Acceptance Criteria
### Discovery
- **AC-1**: Subagent JSONL files discovered at `{session_dir}/subagents/agent-*.jsonl`
- **AC-2**: Both regular subagents (Task tool) and team members (Task with `team_name`) are discovered from same location
### Status Detection
- **AC-3**: Subagent is "running" if: parent session is alive AND last assistant entry has `stop_reason != "end_turn"`
- **AC-4**: Subagent is "completed" if: last assistant entry has `stop_reason == "end_turn"` OR parent session is dead
### Stats Extraction
- **AC-5**: Subagent name extracted from parent's Task tool invocation: use `name` if present (team member), else `subagent_type`
- **AC-6**: Lifetime duration = first entry timestamp to last entry timestamp (or now if running)
- **AC-7**: Lifetime tokens = sum of all assistant entries' `usage.input_tokens + usage.output_tokens`
### UI
- **AC-8**: Turn stats area shows agent count button when subagents exist
- **AC-9**: Button shows count + running indicator (e.g., "3 agents" or "2 agents (1 running)")
- **AC-10**: Clicking button opens popover with: name, status, duration, token count
- **AC-11**: Running agents show activity indicator
- **AC-12**: List updates via existing polling/SSE