Skip to content

feat: live subagent fleet rendering (Agent cards) - #277

Merged
Juliusolsson05 merged 4 commits into
mainfrom
feat/subagent-inline-render
Jun 14, 2026
Merged

Juliusolsson05 merged 4 commits into
mainfrom
feat/subagent-inline-render

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

What

Replaces the dead generic Agent tool card in the feed with a live subagent fleet view: see how many subagents are running at once, and expand any one to watch what it's doing in real time.

Before — an Agent spawn rendered as a static generic tool card (just the name + description, never updating):

⏺ Agent
  ⎿ Sub-agent flow correlation feasibility

After — sibling spawns group under a live header; each row drills in to its tool-call timeline:

⏺ Spawned 4 agents          ◐ 2 running · ✓ 2 done
  ├ ◐ Explore   Render integration points for nested feed     12 tools · 0:42
  └ ✓ Explore   Current active-agent showcase surfaces        25 tools · done

  └ ▾ ◐ Explore  Render integration points…   12 tools · 0:42
        ⏺ Read   Block.tsx
        ⏺ Grep   "tool_use"        18 matches
        ◐ analyzing render model…

How

The data was already on disk, never read. Claude Code writes each subagent's full transcript live to <sessionDir>/subagents/agent-<id>.jsonl, with a sidecar agent-<id>.meta.json carrying { agentType, description, toolUseId }. toolUseId matches the parent Agent tool_use block id exactly — a deterministic join key, no wire/heuristic correlation needed.

  • Main process (src/main/subagents/): a per-session polling watcher tails the subagents/ dir, parses appended JSONL incrementally (byte offsets), and derives a SubAgentState per toolUseId (status, tool-call timeline capped at 40, turn count, elapsed, current activity). The dir is derived from the main transcript's file path (sidesteps providerSessionId-timing); parent tool_result blocks flip a subagent running→done. Pushed via a new session:sub-agents IPC channel.
  • Renderer: runtime.subAgents folds the push; SubAgentsContext (provided from Feed, threaded via TileLeaf) exposes it to rows. Block.tsx routes Agent tool_use → TaskSubagentRow (live status + expandable SubagentMiniFeed); ConversationRow groups sibling Agent spawns under SubagentGroupHeader.

All disk I/O is main-side — the renderer never reads files. Disk-sourced means it's durable (survives reload), unlike the ephemeral proxy stream.

Scope / safety

  • Strictly additive. When no subagents exist (subAgents = {}) the feed renders exactly as before; a lone Agent spawn renders without a group header. No existing contract touched (there was no Agent renderer before — it fell through to the generic ToolUseRow).
  • Codex sessions have no subagents/ dir → inert.
  • Bounds: tool-call timeline capped (40) with a +N earlier count; mini-feed lazy (only the data we push); watcher scoped per active session.

Design docs

  • Spec: docs/superpowers/specs/2026-06-14-subagent-fleet-rendering-design.md
  • Plan: docs/superpowers/plans/2026-06-14-subagent-fleet-rendering.md

Verification

  • npx tsc -b tsconfig.web.json and tsconfig.node.json: no new errors (only the 4 pre-existing baseline).
  • State-builder logic validated against live subagents/ data on disk (correct tool counts, cap/drop, toolUseId linkage, running/done resolution).
  • Live in-app acceptance (spawn parallel agents, expand, completion, reload, no-subagent session) is the reviewer's manual step.

🤖 Generated with Claude Code

Juliusolsson05 and others added 4 commits June 14, 2026 16:23
Live concurrency header + expandable per-subagent tool-call mini-feed,
sourced from <sessionDir>/subagents/agent-<id>.jsonl, linked to the parent
Task card via meta.toolUseId. Disk-sourced (durable), no proxy correlation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Shared SubAgentState/SubAgentToolCall/SessionSubAgentsEvent types
- Pure buildSubAgentState (transcript+meta -> state, tool-call timeline, cap 40)
- SubAgentWatcher: per-session polling tail of <sessionDir>/subagents/*.jsonl
- SubAgentWatcherManager: dir derived from transcript path; parent tool_result
  flips running->done; wired into the session forwarder as session:sub-agents

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- runtime.subAgents folded from session:sub-agents IPC
- SubAgentsContext provided from Feed (threaded via TileLeaf runtime)
- Block.tsx routes Agent tool_use -> TaskSubagentRow (status + tool count +
  expandable tool-call mini-feed) instead of the dead generic ToolUseRow
- ConversationRow groups sibling Agent spawns under SubagentGroupHeader

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant