Skip to content

spike: Support a friendly display name on agents separate from the slug-based name #964

Closed
5 of 5 issues completed

Description

@vybe

Summary

Today an agent's name is its identifier — slug-cased, lowercase, no spaces (e.g. tom-marketing-operations-agent). Users want to call it TOM — Marketing operations in the UI. The current create / rename flows reject non-slug input.

This is a feature spike, not a fix. Decide whether to add a separate display_name field, or to relax slug rules (and pay the schema/Docker cost).

Context

Reported during a UI/UX review session. The slug is load-bearing — per Invariant #1 / schema in docs/memory/architecture.md, agent_name is the PK across ~20 tables and is used as a Docker container label (trinity.agent-name), volume name (agent-{name}-public), and route segment (/api/agents/{name}/...). Changing the slug rules globally is high blast-radius.

Cheapest cleanest path is almost certainly: keep the slug as today, add an optional display_name TEXT column to agent_ownership, render it where humans look (avatar caption, agent list, header), keep the slug everywhere machines look (URLs, MCP, Docker labels). Doable but worth a design pass before code.

Open Questions

  • Add display_name (UI-only) and keep the slug, or actually relax slug rules?
  • If display_name: who can set it (owner only? collaborators?), what's the max length, unicode handling, profanity / abuse policy
  • How does it interact with rename_agent flow (Soft-delete all entities + configurable data retention policy #834 cascade rename)?
  • Does the MCP tool surface need it (get_agent_info, list_agents)? External orchestrators?
  • Where exactly does it render — agent list, agent header, avatar caption, anywhere else?
  • Search / disambiguation: today users type the slug to find an agent — does display name need to be searchable?

Acceptance Criteria

  • Decision recorded (issue comment) on display_name approach vs slug relaxation
  • If display_name approach: short design doc (issue comment is fine) covering schema, API, MCP surface, render sites
  • Implementation broken into follow-up issues — this spike does not ship code
  • Update docs/memory/architecture.md schema section if the decision lands

Technical Notes

  • Constraints from Invariant Fix: Add missing Docker labels to system agent container #1 (docs/memory/architecture.md): agent_name is PK across many tables, used as Docker label, volume name, route segment
  • Existing rename flow: routers/agent_rename.py, services/agent_service/ rename, manual cascade across 17+ tables
  • Sites that probably need the display name if we add one: Agent list view, Agent detail header, Agent Avatar dialog, agent cards in collaboration graph, system agent picker
  • MCP tools that may need to surface it: get_agent, get_agent_info, list_agents (src/mcp-server/src/tools/agents.ts)

Sub-issues

Sub-issues

5 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. added
    priority-p2
    type-feature
    theme-ui-ux
    on May 28, 2026
  2. added
    complexity-medium
    status-incubating
    on Jun 12, 2026
  3. added
    status-ready
    and removed
    status-incubating
    on Jul 3, 2026
  4. vybe commented on Jul 15, 2026

    @vybe
    ContributorAuthor

    Decision: add display_name, keep the slug

    Approach chosen: optional display_name column on agent_ownership. Slug rules are NOT relaxed.

    The slug stays the identity everywhere machines look (PK across ~19 tables, trinity.agent-name Docker label, agent-{name}-* volume names, route segments, MCP/API addressing). display_name is additive, owner-editable, and UI-only.

    Four constraints set the shape of this:

    1. When display_name is set, the slug remains visible — the friendly name never replaces the slug, so it's always clear which agent you're looking at.
    2. Every UI surface treats it consistently (rule below).
    3. MCP and the REST API keep addressing agents by slug. No routing, PK, label, or volume change.
    4. MCP listings return both names, so callers can render the friendly name while still calling by slug.

    This is not a greenfield field — a partial version already ships

    A friendly name already renders on three surfaces today, sourced from template.yaml:

    • OverviewPanel.vue:276 — info?.display_name || info?.name || agent.name
    • InfoPanel.vue:31
    • Public chat header — public.py:222-245 falls back through template info → trinity.agent-type label → slug

    That existing path has three defects this issue really exists to fix:

    • Not owner-editable — it lives in template.yaml inside the agent's own repo.
    • Disappears when the agent stops — public.py only fetches it when agent_available, via a live HTTP call into the container.
    • Covers 3 of ~67 render sites — which is the inconsistency originally reported.

    Two more surfaces are already hand-rolling a friendly name because the column doesn't exist: public.py:222 (label-faking) and voice.py:435 (agent_name.replace("-", " ").title()).

    Precedence (resolves the name collision):

    agent_ownership.display_name   (owner-set, durable, renders when stopped)
      ↓ falls back to
    template.yaml display_name     (today's behavior)
      ↓ falls back to
    agent_name (slug)
    

    get_agent_info already returns a display_name meaning the template's name. We keep the key and let the DB value win wherever both exist — one concept with a fallback chain, not two competing fields. This needs an explicit note in architecture.md and in the MCP tool descriptions, since GET /api/agents and GET /api/agents/{name}/info will both carry the key from different sources.


    Render rule — consistent by intent, not by literal uniformity

    ~67 sites render an agent name. Only 9 are roomy enough for a two-line treatment; 30+ are tight single-string contexts where a second line cannot physically go. So "consistent" is defined per surface class:

    Surface class Treatment Example
    Roomy (9) Display name primary, slug as secondary line AgentHeader:73, OverviewPanel:276, PortalBriefing:4, PortalSidebar:63, PortalConversation:36, PortalChat:11, ClientPortal:63, MobileAdmin:87, AgentTile:21 (reuse .t-repo)
    Pickers / filters (disambiguation matters) Concat Display (slug) the six <option> dropdowns — ExecutionsPanel:73, ReportsPanelFleet:27, QueueList:35, NotificationsPanel:15, FileManager:36, Settings:1285
    Dense operational tables (machine-facing) Slug stays primary executions rows, operator queue rows, monitoring alerts, RoleMatrix:78 (100px column)
    Prose / toasts (identity already established) Display name alone Agents.vue:1119, Settings.vue:3968, PortalChat:52, PortalFilesPanel:16,56

    Idiom to copy — already in the codebase at SharingPanel.vue:247-248, which promotes the identity to primary when there's no friendly name so there's never a dangling empty line:

    <span class="font-medium">{{ x.display_name || x.identity }}</span>
    <span v-if="x.display_name" class="block text-xs text-gray-500 dark:text-gray-400">{{ x.identity }}</span>

    Cross-cutting risks (none of these are in the original issue)

    1. AgentAvatar hashes the name into its gradient (AgentAvatar.vue:72-88) and derives initials from it. Passing display_name makes "TOM — Marketing operations" yield initials TM and silently recolors every agent's avatar the moment a display name is set — across 16 call sites, plus a duplicate implementation at ClientPortal.vue:60. Decision: keep passing the slug to AgentAvatar so identity color stays stable.
    2. data.label is both display text and API key in the collaboration graph (AgentNode.vue:444,454,466 use it for router.push / toggleAutonomy / toggleAgentRunning). Keep label = slug; add a sibling field in stores/network.js:511,545.
    3. Bare-string agent arrays — agentNames / availableAgents in ExecutionsPanel, ReportsPanelFleet, QueueList, NotificationsPanel are arrays of strings and need a store-shape change (or a slug→display resolver) before they can render both names.
    4. Search — Agents.vue:834 filters on agent.name only. Must match display_name too, or users type "TOM" and get nothing. Sort (Agents.vue:101-104, "Name (A-Z)") needs a stated key.
    5. Operator/monitoring payloads carry agent_name from the API, not the agents store — those payloads need the display name added, or a frontend resolver.
    6. Rename — display_name sits on agent_ownership, which is not in AGENT_REFS; the cascade only re-keys the agent_name column, so the friendly name survives a slug rename untouched. That's the intended semantic and should be stated in the migration docstring.
    7. Creation/rename affordances — CreateAgentModal.vue:15-22 is the only name input (labelled "Agent Name", placeholder is a slug); AgentHeader.vue:58-71 is the only rename input and edits the slug. Both need a second field and a relabel to "Slug"/"Identifier".

    Backend/MCP change surface — small and cheap

    GET /api/agents returns enriched plain dicts (no response_model); list_all_agents_fast supplies Docker-label identity and get_accessible_agents merges DB fields via one batched query for the whole fleet (get_all_agent_metadata). So display_name is +1 column in an existing SELECT, +0 queries. Exact precedent: mcp_exposed (#846) is a DB column on agent_ownership already surfaced through this path.

    Layer File Cost
    SQLite DDL db/schema.py:68 trivial
    Core MetaData db/tables.py:71 trivial
    SQLite migration db/migrations.py (+fn, +registry) trivial
    Alembic (PG) migrations/versions/0024_agent_ownership_display_name.py (head is 0023_agent_sync_state_gc_signals) new file
    Batch query db/agent_settings/metadata.py:330-400 +1 column, +0 queries
    List assembly services/agent_service/helpers.py:247 + orphan branch ~220 2 lines
    MCP type src/mcp-server/src/types.ts:3-15 — add display_name?: string 1 line
    MCP tools src/mcp-server/src/tools/agents.ts no code change — pass-through; description text only

    list_agents / get_agent / get_agent_info are thin pass-throughs that JSON.stringify the backend payload verbatim (list_agents only touches .name, to filter by permission), so both names flow to MCP automatically once the field is on GET /api/agents.

    Do NOT add display_name to AgentStatus / list_all_agents_fast. That's a hot labels-only path (startup, telemetry, ops ×7, monitoring); adding it there forces either a per-agent DB lookup or a new Docker label — and a mutable friendly name in a Docker label cuts against Invariant #11's slug-as-identity. Docker stays authoritative for name; the DB owns display_name.


    Sizing

    complexity-medium (5-8 pts) is wrong for the whole of this — ~67 render sites, a store-shape change, and a dual-track migration. Split into the five follow-ups below (sized individually) rather than re-sizing this spike.

    Follow-ups (created, all status-ready, OSS-core / ungated)

    1. feat: Agent display_name — schema, API, and MCP surface (#964 follow-up 1/5) #1639 — Schema + API + MCP — column (both migration tracks), batch query, list assembly, types.ts, tool descriptions. Ships the data end-to-end with no UI. Blocks the other four.
    2. feat: set an agent's display label at creation time (#964 follow-up 2/5 — residual) #1640 — Set/edit affordance — PUT /api/agents/{name}/display-name (owner-only, max length, unicode/trim policy), plus the create + rename inputs and the "Slug"/"Identifier" relabel.
    3. feat: Render agent display name on the nine roomy UI surfaces (#964 follow-up 3/5) #1641 — Roomy surfaces (9) — the two-line SharingPanel idiom; retire the template-derived fallback on OverviewPanel/InfoPanel/public chat in favor of the precedence chain.
    4. feat: Agent display name in pickers, search, and sort (#964 follow-up 4/5) #1642 — Pickers + search + sort — store-shape change for the bare-string arrays, Display (slug) concat, search matches both fields, stated sort key.
    5. feat: Agent display name across remaining surfaces — operator, monitoring, executions, graph (#964 follow-up 5/5) #1643 — Long tail — operator/monitoring/executions payloads, collaboration graph, tab titles, prose/toasts.

    Remaining open questions

    • Max length, unicode handling, trim/normalization policy; profanity/abuse policy (public-facing on portal + public chat surfaces).
    • Who can set it — owner-only, or collaborators too?
    • Uniqueness — are two agents allowed the same display name? (Slug already guarantees uniqueness; the concat rule in pickers makes collisions survivable, which argues for allowing them.)
    • Sort key on the agent list: slug or display name?
  5. vybe commented on Jul 20, 2026

    @vybe
    ContributorAuthor

    Groom (2026-07-20): spike resolved — the decision was made and implemented.

    Outcome: a presentation-only agent_ownership.display_label; the slug remains the identity every route, container, volume, MCP key and A2A card keys on. Shipped OSS-core via trinity-enterprise#181 (PR #1676), then #1687 / #1699 / #1700 across the render surfaces.

    Follow-ups 1/5 (#1639), 3/5 (#1641), 4/5 (#1642) and 5/5 (#1643) are status-in-dev. The only surviving gap is #1640, narrowed to accepting a display label at creation time. Closing the spike.

  6. removed
    status-ready
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-mediumpriority-p2theme-ui-uxtype-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions