AAswordman / AAswordman/Operit

[ Future request]子代理+Goal模式开发进度

Open
#573 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Already-plan area:backlog feature-request
Dominant language
Kotlin
Stars
7.9k
Forks
651
Avg merge
1d 9h
Merged PRs (30d)
70

Description

#这个实现思路参考claude code的subagent设计出来的。
目前有个大概样子了,测试了50个并发

Image Image ## 核心思路

新增一个 spawn_subagent 工具,让主代理可以创建独立的子代理实例并行执行任务,类似 Claude Code 的 subagents。

关键设计

  1. 子代理 = 普通工具调用:不修改核心对话循环(sendMessage → processStreamCompletion → handleToolInvocation → processToolResults),子代理本质上是一个长时间运行的工具。

  2. 隔离实例:每个子代理使用 EnhancedAIService.getChatInstance(subChatId) + isSubTask=true, stream=false——独立的对话历史,不污染主对话 UI 状态。

  3. 面板嵌入主消息下方:子代理状态卡片(等待中/执行中/已完成)内联显示在聊天消息中,不单独开页面。

  4. JSON 文件持久化:子代理会话用 JSON 文件存储(不用 ObjectBox),避免模型文件冲突。

当前进度

  • dev_subagent 分支 CI 构建通过
  • 工具已对模型可见且功能正常
  • UI 面板渲染偶尔有显示问题(chatId 匹配)
  • 下一步:Goal Mode[可能会和内置的计划模式冲突]、Orchestrator、详情弹窗历史加载

想讨论的问题

  1. 这个功能有人开发了吗?后续有没有重构层面的问题?
  2. ToolExecutionContext 的模式(ThreadLocal + 全局备份)有没有更好的方式给工具传递 chatId?
  3. 子代理工具应该放在 internalToolCategories 里还是单独一个分类?
    4.目前还有很多细节缺失,你觉得这个思路不行的话我这边就暂停开发了

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed spawn_subagent flow, EnhancedAIService.getChatInstance, and ToolExecutionContext usage on the dev_subagent branch. Check the existing CI build and the UI panel's chatId matching behavior first; completion would require a settled design for Goal Mode, orchestration, tool categorization, persistence, and history loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
ai, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.