Skip to content

feat(orchestration): auto-inject accessible agent descriptions into Trinity system prompt #701

Open

Description

@vybe

Summary

At task execution time, Trinity should inject a brief description of all agents the current agent has MCP access to — name, role, and capability summary from template.yaml — into the Trinity system prompt. This lets each agent know who it can delegate to without requiring manual updates to CLAUDE.md.

Context

Trinity already injects a small system-level prompt at task execution time (visible in admin settings → System Prompt). Currently this does not include peer agent awareness. Agents learn about available peers only if manually documented in their own CLAUDE.md.

The correct fix — discussed in the 2026-05-07 Flex your Agent call — is runtime injection: when a task fires, pull the list of agents accessible to this agent (via agent_permissions or agent-scoped MCP key), read their template.yaml descriptions, and append a compact peer-awareness block to the Trinity system prompt.

This is a prerequisite for reliable agent-to-agent delegation without agent-specific CLAUDE.md maintenance.

Acceptance Criteria

  • On each task execution, Trinity assembles a list of agents the executing agent has MCP access to
  • For each peer agent, Trinity reads its template.yaml (specifically the description and capabilities fields)
  • A compact peer-awareness block is appended to the Trinity system prompt injected at runtime
  • The block is capped at a reasonable size (e.g. 500 tokens) and truncated gracefully for large fleets
  • Agents with no peers receive no peer block (no injection overhead)
  • Admin settings show the combined system prompt with peer block (existing preview feature)

Technical Notes

  • Trinity system prompt is injected in task_execution_service.py / agent_client.py — extend the prompt assembly there
  • Peer list: query agent_permissions for the agent's permissions, or derive from agent-scoped MCP key context
  • template.yaml is available in the agent container at /home/developer/template.yaml — readable via docker exec or cached from last agent start
  • Consider caching template.yaml descriptions in Redis or the DB to avoid per-execution Docker reads
  • Aligns with Target Architecture Coordination Model: agents need peer awareness for proper delegation

Activity

  1. added
    priority-p1
    type-feature
    on May 7, 2026
  2. added
    complexity-low
    theme-reliability
    on Jun 3, 2026
  3. added
    priority-p2
    and removed
    priority-p1
    on Jun 12, 2026
  4. vybe commented on Jun 13, 2026

    @vybe
    ContributorAuthor

    /claim

  5. github-actions commented on Jun 13, 2026

    @github-actions

    Claimed by @vybe. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/701-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #701
  6. added
    status-in-progress
    on Jun 13, 2026
  7. added
    status-ready
    and removed
    status-in-progress
    on Aug 4, 2026
  8. added
    complexity-medium
    and removed
    complexity-low
    on Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-mediumpriority-p2status-readytheme-reliabilitytype-feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions