← All proposals

Context: AgentTree

A tree of agent cards: the lead on top, its sub-agents side by side below, their helpers under them, joined by thin connectors.

Net-new componentOpen in Storybook

proposals/AgentTree/decisions.md200 lines · View on GitHub

Decisions: AgentTree

Append as you go, newest last. Record choices someone could reasonably question later, not every edit.

Name: Agent Tree

  • Decision: The component is AgentTree (pds-agent-tree), "Agent Tree" in Storybook.
  • Why: A hierarchy of a lead, sub-agents and helpers. A name that describes the structure fits PDS (Timeline, Stepper, Event Log). Rejected: Orchestrator and Orchestration (a role of one node, not the thing you look at), Team (suggests people), Fleet (the Autopilot product's word), Map (vague, suggests geography). Graph would be the name if agents can connect sideways, which they cannot here. Working name; easy to rename.
  • Port impact: none.

Built from PDS parts, not from the reference's own markup

  • Decision: The reference's pixel mark becomes AgentAvatar (halo on only while the agent is working), the status chip becomes StatusBadge, the context bar becomes ProgressBar, the buttons and message field become Button, IconButton and TextInput, the project switcher becomes the local bare Select, and every icon is a PDS icon.
  • Why: Rule 1 (reuse first). The designer chose AgentAvatar over the pixel marks on 2026-11-18.
  • Port impact: none beyond the dependency on the local Icon (stop) and bare Select.

Scope: everything in the reference

  • Decision: v1 keeps the project switcher, steering (message, pause, resume, stop, retry, approve, decline), the handoff light and the Gradient Floor (the floor was removed later the same day, see below).
  • Why: The designer said "include all" (2026-11-18), against the proposed cut.
  • Port impact: the engineer can drop the switcher (a page concern) without touching the rest; it is a separate part and off by default through its prop (projects).

Connectors are the default border color; the AI border is for working agents (2026-11-18, replaces the AI gradient lines)

  • Decision: The connectors and the hollow dots are --pds-color-border-default, 1px, plain SVG strokes that draw themselves in. The AI gradient is reserved for working agents: an active card is a Panel with variant='agentic-default' (the AI gradient border), and a connector between two working agents (for example Release lead to Code reviewer) is the AI gradient too, drawn over the default line through a mask of just those connectors, with the hollow dot at its start. isAnimated (default false, on in the Default story) slides both, as the animated Panel does. The quick stroke that runs down a card a handoff reaches is kept: it is the handoff, not a state, and it plays on top of the card's own border.
  • Why: The designer asked (2026-11-18). The gradient lines (first the focus token, then the AI gradient through a mask) made every line compete with the cards; the one gradient on screen now means "this agent is working". Resting agents' connectors no longer fade, since the border color is already light.
  • Port impact: the working border is the existing Panel variant. The gradient between two working agents needs the mask (an SVG stroke cannot take a CSS gradient token), or an SVG <linearGradient> in user-space units with the token's stops (a bounding-box gradient does not render on a straight line).
  • Open: does the handoff stroke on a non-working receiver go against "AI border for working agents only"? A receiver usually starts working.

Header removed for now (2026-11-18)

  • Decision: The visible heading ("Checkout fix") and the tally at the upper right (working, needs you, agent count) are gone. The bar is only drawn when projects is set, and then holds just the switcher. heading stays as the accessible name of the section and the tree, and is not shown. The strings that only the tally used (summaryWorking, summaryNeedsYou, agents, agentCountOne) are removed with it.
  • Why: The designer asked to remove them for now (2026-11-18).
  • Port impact: none. If the tally comes back, so do those four strings.

Flat tree semantics (aria-level), cards are the tree items

  • Decision: role='tree' on the container, role='treeitem' on each card with aria-level, aria-posinset and aria-setsize, and no nested group elements. The selected card (details open) has aria-selected='true'. aria-expanded is not used: the children are always shown.
  • Why: The reference put treeitem on wrappers and focus on the inner card, and used aria-expanded for "details open", which a tree reads as "children shown". ARIA allows a flat tree described by level, position and size. Keyboard: Down and Up walk the cards in tree order, Right goes to the first child, Left to the parent, Home and End to the first and last, Enter and Space open the details, Escape closes them.
  • Port impact: none.

Details expand inside the card, Agent Inbox style (2026-11-18, replaces the top-layer popover)

  • Decision: A card opens in place, the way an Agent Inbox card does: under the summary, a divider line (--pds-color-border-default), then the details with the card's own spacing: the task, the model and tool badges, time, cost, tokens, the last handoff and the steering buttons, which hug their content at the end of the row. One card is open at a time. The summary is the tree item (role='treeitem', the one tab stop, aria-selected and aria-controls point at the region); the details are a region after it inside the same card, so their buttons and field are not inside the tree item. Escape closes them and returns focus to the summary; a click on the summary toggles. The focus ring goes around the whole card.
  • Why: The designer asked for an in-place expansion instead of a floating panel, first with a sunken area (a mockup), then to keep Agent Inbox's own style and use that one here (2026-11-18). Agent Inbox is unchanged. The connectors are re-measured after every render, so the helpers' lines follow an open card.
  • Port impact: none. The close button and the close label string are gone; the details have no heading of their own, because the card above already names the agent. Agent Inbox has no chevron on its card; Agent Tree has none either (the row is tight at 15rem).
  • Open: should several cards be open at once? Should the Tree card have a chevron like the Inbox's?

Strings and formatting

  • Decision: Every visible string is in labelStrings (like Agent Inbox), with {count}, {name}, {from} and {to} placeholders for the sentences. Duration and cost are formatted by the consumer through formatDuration and formatCost, with Intl defaults. Token counts use Intl.NumberFormat compact notation.
  • Why: Rule 6 (no content hardcoded) and translation safety.
  • Port impact: none.

Select options carry the project counts in the label

  • Decision: The project switcher option label is the name plus a short meta string ("Autopilot · 2 need you"), because a PDS Select option is a label only.
  • Why: Reuse the PDS Select. The reference showed the counts as a separate muted column.
  • Port impact: if the counts should be a separate column, the switcher needs a Dropdown-based list (open question).

Gradient Floor removed

  • Decision: The soft floor of light that showed on a card when a handoff reached it is removed (2026-11-18). The handoff light along the connectors stays. AgentTreeFloor.tsx, the floor prop of the card, the floor CSS and its variables are gone, and so is the light's onArrive callback, which only fed the floor.
  • Why: The floor's path shapes were copied from the reference, which credits an outside motion library, and the licence was never confirmed. The designer chose to remove it rather than carry the question into PDS.
  • Port impact: none to resolve; nothing in the proposal is copied from an outside source now. Earlier entries that mention the floor are history.

What changed from the reference

  • Decision: Renames and removals against the pasted AgentCrew: title is heading (it would clash with the HTML title attribute), onSelect is onAgentSelect (it would clash with the DOM onSelect event), root keeps its name; the per-agent logo (a mark instead of the pixel pattern) is gone with the pixel marks; started and ended stay as millisecond timestamps.
  • Why: The component extends ComponentPropsWithoutRef<'section'> like the other proposals, so its own props must not collide with the element's.
  • Port impact: none.

Card is 15rem wide

  • Decision: --agent-tree-card-width is 15rem (the reference used 208px, 13rem).
  • Why: The PDS StatusBadge is a bordered pill, wider than the reference's chip, and at 13rem "Release lead" and "Code reviewer" truncated beside it. At 15rem both fit; very long names still truncate with a tooltip.
  • Port impact: the engineer can tune the width; the layout threshold reads it from the CSS, so it follows.

Context bar colors come from ProgressBar

  • Decision: The bar is ProgressBar size s with breakpoints: info below 80%, warning from 80%, critical from 95%.
  • Why: The reference drew the bar in the agent's color and went orange and red from 80% and 95%. With one connector color there is no agent color, and the package bar already maps status colors. The tokens line (136K / 200K) is a sibling span, not the bar's message, so the bar and the number share one row.
  • Port impact: none.

Helpers show a status dot, not a word

  • Decision: Cards at depth 2 and more show the StatusBadge as a dot (the label is visually hidden, still read), and no model line, tools or last handoff.
  • Why: The reference did the same to keep helper cards small.
  • Port impact: none.

Narrow layout stretches the cards

  • Decision: In a narrow container the cards are as wide as the container, as in the reference.
  • Why: The container is the drawer; a fixed card width would leave empty space or overflow. In a wide window with many sub-agents (more than fit side by side) this also applies, and the cards get very wide.
  • Port impact: open question: cap the card width when narrow but the container is wide (a max-width)?

Spacing opened up (2026-11-18)

  • Decision: Card padding is --pds-spacing-xs on all sides (was 2xs above and below), the gap inside a card is 2xs (was 3xs), the gap between cards is --agent-tree-gap = xs (was 2xs), and the indent per level is three times xs (was xl).
  • Why: The designer found the narrow layout too tight: the connector ran about 4px from the card it enters. The indent is now the card padding, half the avatar and one gap, so the elbow is a full xs wide.
  • Port impact: none.

Tools are borderless PDS icon buttons

  • Decision: The tool tiles on a card are package IconButtons (size='xs', hasBorder={false}, tooltip with the tool's name), side by side, not overlapping. A tool is { iconName, name } (a PDS icon name), not a logo. More than four show three and a plain "+N" count. The agent's own modelLogo stays a node.
  • Why: The designer asked for PDS icon buttons, then borderless (2026-11-18). An IconButton takes an icon name, so a tool logo is no longer possible; a brand's logo is not a PDS icon.
  • Behavior (my default, not confirmed): the buttons have tabIndex={-1}, so the card stays one tab stop and keyboard users read the tool names in the details; a click on one bubbles to the card and opens the details. No onToolClick.
  • Port impact: none. If tools should act on their own, add an onToolClick(agent, tool) and make them tab stops.

Details panel: heading, badges, hugged buttons (2026-11-18)

  • Decision: The agent's name in the details is pds-heading-m. The model and the tools are package Badges, color='silver-muted', size='s' (a tool carries its PDS icon through the badge's iconName; the model maker's logo goes in the badge's label). The buttons hug their content at the PDS padding and sit at the end of the row.
  • Why: The designer asked for heading/m on the name, a silver-muted badge for the model, and no stretched buttons. The tool chips became the same badge so the two rows match; the custom chip CSS is gone.
  • Port impact: none.

Zappy and third-party agents (2026-11-18)

  • Decision: AgentTreeAgent.iconName ('zappy' default, or 'sparklesSolid') goes to the card's AgentAvatar, so only Zappy shows the bolt and a third-party agent shows the sparkles. The avatar's screen reader text says "Zappy agent" or "Third-party agent" (labelStrings.agentZappy, agentThirdParty). The halo still shows while an agent works, for both. In the stories the Code reviewer and the Docs writer are third-party (model "Partner model").
  • Why: The designer wants Zappy and third-party agents in one flow, and only Zappy uses the bolt. AgentAvatar already offers these two icons for exactly this ("zappy for Pantheon agents, sparklesSolid for third-party"), so the prop mirrors it instead of inventing a vendor field.
  • Port impact: none.
  • Open: should a third-party agent show its own logo instead of the sparkles? AgentAvatar has no logo slot, so that would be an AgentAvatar proposal.

Card name is semibold (2026-11-18)

  • Decision: The agent's name on the card is --pds-typography-fw-semibold, set on an inner element (__name-text) inside the pds-copy-s element.
  • Why: The designer asked for semibold. The pds-copy-* classes set font-weight: regular !important on their own element, so a weight set there never applied (the earlier medium on the name didn't either, the same trap as in docs/STATUS.md about the copy classes).
  • Port impact: none.

Message is an icon button that opens a floating Composer (2026-11-18)

  • Decision: In the details, Message is a bordered IconButton (comment, xs, tooltip "Message to {name}") in the steering row, not a text button. It opens the local compact Composer in a floating bar: a native popover='manual' in the top layer, at the bottom center of the viewport (one --pds-spacing-xl up from the bottom edge; first tried at the true center, the popover default of inset: 0 with auto margins), 36rem wide, with Send as a primary IconButton. Enter or Send calls onSteer(agent, 'message', text) and closes it; Escape closes it and returns focus to the message button; a press elsewhere closes it without moving focus; the message button toggles it. The inline text field is gone, and so is labelStrings.message.
  • Why: The designer asked for it (2026-11-18): first "center", then "try bottom". The center covers the tree behind it while you type; the bottom keeps the tree visible. Going back to the center is two declarations (inset-block, margin-block).
  • Port impact: Agent Tree now imports the local Composer (compact, unchanged) and IconButton. Both are ready-for-dev, so port them first.
  • Open: bottom or center after trying both? Should the bar show which agent it is for (it is only in the field's label and placeholder)?

Sample model names (2026-11-18)

  • Decision: In the stories, Zappy agents show the model "Zappy" (and no maker logo), not a model name such as Opus or Sonnet; third-party agents show their own model ("Partner model", with a stand-in logo).
  • Why: The designer corrected it: Zappy is the agent, and it uses the Zappy avatar; its model is not the point.
  • Port impact: none. model stays free text.

Animated gradient lines, and a stroke on the card a handoff reaches (2026-11-18)

  • Decision: isAnimated (default false, on in the Default story) slides the AI gradient along the connectors, the way Panel's isAnimated slides its border: the layer is two widths wide, moves one tile in --pds-animation-duration-ai-shimmer and loops (the gradient ends on its start color). When a handoff reaches an agent, the AI gradient keeps flowing around that card's border from the top to the bottom and fades out as it goes (a soft band sweeps down a 1px ring of the same gradient, drawn over the card's own border, in 800ms, once per handoff; the first version took the PDS shimmer duration, 1.6s, and the designer asked for faster), so the connector and the card read as one stroke. First version faded the whole ring in and out at once; the designer asked for the top-to-bottom flow. It replaces the soft floor of light that was removed. The arrival is timed to when the handoff light reaches the card. Both are off for reduced motion.
  • Why: The designer asked for it (2026-11-18). The ring is the border area of a gradient layer (a mask removes the middle), so it uses the token, not a copy of its colors, and it sits just inside the card's own 1px border instead of changing the Panel's variant, which would snap on and off.
  • Port impact: none. AgentTreeLight gets an onArrive callback.
  • Open: should the ring also replay for a handoff to the lead? (It does for every receiver.) Is 1.6s too long for "quick"?

Agentic Spinner on the working state: tried, reverted (2026-11-18)

  • Decision: The working state uses the plain, monochrome spinner (the package StatusBadge for the badge). The agentic Spinner (the AI gradient) was tried on the working state and reverted the same day.
  • Why: The designer did not like it.
  • Port impact: none. No StatusBadge option is needed.

Body text is secondary, and an open card shows the full text (2026-11-18)

  • Decision: The activity line is the default secondary text color for every status; the discovery and critical colors on it are gone (the status badge already says it). An open card shows the full text: the name, the model, the activity line and the last handoff wrap instead of ending in an ellipsis. A closed card keeps one line each, with the full text in a tooltip. A working agent's activity line still has the shimmer, a darker highlight that sweeps across it.
  • Why: The designer asked for it (2026-11-18): all body text default secondary, and a click shows the full text.
  • Port impact: none.
  • Open: should the working shimmer go too, so the text is always plain secondary?

The card follows the Agent Inbox card layout (2026-11-18)

  • Decision: An agent card is laid out like an Inbox card: a title row with the avatar where the Inbox has its status icon, the name (semibold) over a small secondary subtitle (the model), and a chevron at the end that turns when the card is open; then the activity line (the Inbox's description: two lines, in full when open); then the context bar and tokens (Agent Tree only); then a foot with the status badge and the elapsed time on the left and the tool icon buttons on the right; then the last handoff as its own small line. Helper cards use the same layout without the model, the tools and the last handoff. The status badge is now always the full label (the icon-only badge for helpers is gone). The elapsed time is on the card (it ticks while the agent runs) and no longer needs the details to be open. The last handoff was removed from the details, since the card shows it in full when open.
  • Why: The designer asked for the same layout as the Inbox card, for consistency (2026-11-18).
  • Port impact: none. AgentTreeCard now takes formatDuration; the elapsed-time hook is shared with the details.
  • Open: the Inbox card puts the status icon where the Tree puts the avatar; should the Tree card also show a status icon? The Inbox's counts (sources, tool calls) are icon buttons in the Tree.

A handoff changes the agents when it arrives (2026-11-18)

  • Decision: New event onHandoffArrive(handoff): it fires when the handoff light reaches the receiver (at once for reduced motion). The screen changes its data then: the receiver becomes active with the handed-over text as its last handoff and a new activity line, and a sender that is not the lead finishes (done). The border and the connector turn AI gradient because both ends are now working, so the visual follows the data. The stories play a scripted run of 8 handoffs from a start where only the lead is working: lead to reviewer, reviewer to lint helper, lint helper back to the reviewer, reviewer back to the lead, lead to tests, tests back to lead, lead to docs, docs back to lead, ending with the lead waiting for your OK. A "Play demo" button plays the whole run on its own (each handoff starts about a second after the last one has landed, and the button becomes "Stop demo"); "Next handoff (n/8)" plays one; Reset starts over.
  • Why: The first demo ran the light between agents whose status never changed, to agents that were already done, failed or waiting, so nothing was handed over (analysis, 2026-11-18). The light and the stroke can only say "work moved here" if the receiver starts and the sender stops, and the order matters: the status must change when the light arrives, not when the button is pressed.
  • Port impact: onHandoffArrive is a new prop on the component. The scenario is story data (SCRIPT and applyHandoff in agent-tree-story-shared.tsx) and is not ported. The component still owns no status.
  • Confirmed (2026-11-18): a sender that is not the lead finishes on arrival, with the receiver, in one beat. Stopping when the light leaves it would need a second event (onHandoffStart) for one case; revisit only if the light running along a still-gradient connector on a result handoff, which snaps off at arrival, looks wrong. The lead keeps working until the end.

Connectors are measured again when an animation ends (2026-11-18)

  • Decision: The connectors are re-measured on animationend inside the tree, as well as on resize and every render.
  • Why: The cards scale in when they mount, and a scaled card reports shifted positions. The first measure ran during that animation and nothing measured again once it ended, so in the narrow layout (wide cards) a connector sat about 10px off, right against the cards' edge. It looked like tight spacing; the spacing itself was right.
  • Port impact: none. If the entrance animation is dropped, so is this listener.

Verified by

  • Checked in Storybook (2026-11-18, headless script and screenshots, not by eye in a full review): Default, All Statuses, Context Warning, Narrow, With Projects and Lead Only render with no errors; keyboard walking (Right, Down, Left, Home, End), one tab stop, the details panel under its card, and a handoff (light and live announcement; the floor has since been removed) were run. Dark mode was looked at on All Statuses. Not checked: the project switcher by hand, hover states, reduced motion, axe, the handoff light frame by frame.

Open questions

  • Who needs it first, and which product? (designer)
  • Is the AI gradient right for the connectors, and should the handoff light follow it? (designer)
  • Licence of the Gradient Floor: resolved 2026-11-18 by removing the floor.
  • Does Agent Inbox adopt the same status union, and do the two link to each other? (designer)
  • Should the project counts be a separate column in the switcher? (designer)
  • Cap the card width in the narrow layout when the container is wide? (designer)

"Needs you" uses the discovery status (2026-11-18)

  • Decision: An agent that is waiting shows the StatusBadge with statusType='discovery' (the purple dot). Its activity line, and the "N needs you" count in the header, use --pds-color-status-discovery-foreground instead of warning. The context bar keeps its warning color from 80%; that is a different meaning (a full window).
  • Why: The designer asked for the discovery dot and status badge for Needs you, in both Agent Inbox and Agent Tree, so the two match.
  • Port impact: none.