openclaw - 💡(How to fix) Fix Inject sibling agent list into session system prompt [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#52146Fetched 2026-04-08 01:15:07
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
commented ×1

From a given agent's perspective, other agents are currently accessed purely through tool interfaces (sessions_send, sessions_list), but the agent has no built-in knowledge of who to contact or what roles they serve. A lightweight injection of the agent roster would close this gap without requiring manual sync.

Root Cause

This leads to:

  • Stale information when agents are added/removed but docs aren't updated
  • Agents unable to proactively collaborate because they don't know who else exists
  • Manual maintenance overhead
RAW_BUFFERClick to expand / collapse

Problem

In a multi-agent setup, each agent's session has no awareness of other agents configured in agents.list. The only way for an agent to know about its siblings is through manually maintained documentation (e.g., a table in TOOLS.md).

This leads to:

  • Stale information when agents are added/removed but docs aren't updated
  • Agents unable to proactively collaborate because they don't know who else exists
  • Manual maintenance overhead

Proposal

Inject a minimal sibling agent summary into the system prompt (or a discoverable tool), containing for each peer agent:

  • id
  • name (from identity.name)
  • theme / role (from identity.theme)
  • Whether agentToAgent communication is allowed with them

This would be analogous to how tools and channels info is already surfaced in the runtime context.

Context

From a given agent's perspective, other agents are currently accessed purely through tool interfaces (sessions_send, sessions_list), but the agent has no built-in knowledge of who to contact or what roles they serve. A lightweight injection of the agent roster would close this gap without requiring manual sync.

extent analysis

Fix Plan

To address the issue, we will implement a solution that injects a minimal sibling agent summary into the system prompt.

Here are the steps:

  • Modify the agents.list configuration parser to generate a summary of sibling agents.
  • Create a new function to format the agent summary, including id, name, theme, and agentToAgent communication status.
  • Inject the formatted agent summary into the system prompt.

Example Code

def generate_agent_summary(agents):
    """Generate a summary of sibling agents."""
    summary = []
    for agent in agents:
        agent_info = {
            'id': agent['id'],
            'name': agent['identity']['name'],
            'theme': agent['identity']['theme'],
            'agentToAgent': agent.get('agentToAgent', False)
        }
        summary.append(agent_info)
    return summary

def inject_agent_summary(system_prompt, agents):
    """Inject the agent summary into the system prompt."""
    agent_summary = generate_agent_summary(agents)
    system_prompt['agentSummary'] = agent_summary
    return system_prompt

# Example usage:
agents = [
    {'id': 'agent1', 'identity': {'name': 'Agent 1', 'theme': 'role1'}, 'agentToAgent': True},
    {'id': 'agent2', 'identity': {'name': 'Agent 2', 'theme': 'role2'}, 'agentToAgent': False}
]

system_prompt = {}
updated_system_prompt = inject_agent_summary(system_prompt, agents)
print(updated_system_prompt)

Verification

To verify that the fix worked, check the system prompt for the presence of the agentSummary key and ensure that it contains the expected information for each sibling agent.

Extra Tips

  • Consider implementing a caching mechanism to reduce the overhead of generating the agent summary.
  • Ensure that the agentToAgent communication status is correctly updated when an agent's configuration changes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING