hermes - 💡(How to fix) Fix [Feature]: Support dynamic role loading for sub-agents

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…

Code Example

Main agent assigns: "Use the 'security-expert' role to audit this code"
Sub-agent loads: roles/security-expert.md
Executes task with loaded persona

---

# Config or command
sub_agent:
  available_roles:
    - security-expert
    - code-reviewer
    - documentation-writer
    - domain-expert
  
  load_role: security-expert  # loaded before task execution

---

> /role security-expert
[Sub-agent persona switched to security-expert]

> /role code-reviewer  
[Sub-agent persona switched to code-reviewer]
RAW_BUFFERClick to expand / collapse

Problem or Use Case / 问题或使用场景

Currently, sub-agents cannot dynamically load roles/personas to execute tasks. Each sub-agent must be configured with a fixed role at creation time, which limits flexibility in dynamic task assignment.

目前子代理无法动态加载角色/人物设定来执行任务。每个子代理必须在创建时配置固定的角色,限制了动态任务分配的灵活性。

Use case / 使用场景:

  • Main agent breaks down a complex task into sub-tasks with different specialized roles / 主智能体将复杂任务分解为需要不同专业角色的子任务
  • Dynamically assign coding expert, reviewer, documentation writer roles to different sub-agents / 动态为不同子代理分配代码专家、审查员、文档撰写者等角色
  • Tasks requiring context switching between different personas / 需要在不同人物设定间切换的任务

Proposed Solution / 建议方案

Allow sub-agents to load roles dynamically at runtime:

允许子代理在运行时动态加载角色:

Option 1: Role Loading via Task Assignment / 方案1:任务分配时加载角色

Main agent assigns: "Use the 'security-expert' role to audit this code"
Sub-agent loads: roles/security-expert.md
Executes task with loaded persona

Option 2: Role Manifest / 方案2:角色清单

# Config or command
sub_agent:
  available_roles:
    - security-expert
    - code-reviewer
    - documentation-writer
    - domain-expert
  
  load_role: security-expert  # loaded before task execution

Option 3: Runtime Role Switching / 方案3:运行时角色切换

> /role security-expert
[Sub-agent persona switched to security-expert]

> /role code-reviewer  
[Sub-agent persona switched to code-reviewer]

Alternatives Considered / 备选方案

  • Hard-coded role in sub-agent config: inflexible, requires recreation of agents / 子代理配置中硬编码角色:不灵活,需重新创建代理
  • System prompt injection per message: fragile, easy to forget / 每条消息注入系统提示:脆弱,容易遗漏

Feature Type / 功能类型

  • Configuration option
  • CLI improvement
  • Agent Core improvement

Scope / 范围

  • Medium (few files, < 300 lines)

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

hermes - 💡(How to fix) Fix [Feature]: Support dynamic role loading for sub-agents