feat: Agentic Dynamic Workflows — Multi-Agent Legion Orchestration#1535
Open
1688mengdie wants to merge 49 commits into
Open
feat: Agentic Dynamic Workflows — Multi-Agent Legion Orchestration#15351688mengdie wants to merge 49 commits into
1688mengdie wants to merge 49 commits into
Conversation
Owner
|
感谢贡献,Agentic Dynamic Workflows也将是BitFun下一步重点发力方向,BitFun将围绕长程任务打造ultra模式,其中就包含Agentic Dynamic Workflows,虽然当前代码没办法直接合入,我们后续也会仔细review,并将可吸收内容作为参考。 |
added 15 commits
July 16, 2026 07:00
…tale-strategy detection
1688mengdie
force-pushed
the
feature/agentic-dynamic-workflows
branch
from
July 15, 2026 23:04
1857248 to
d70d189
Compare
added 12 commits
July 16, 2026 07:11
…on, stale tracker cleanup
added 14 commits
July 18, 2026 05:56
…tale-strategy detection
…on, stale tracker cleanup
…tests - framework.rs: add dedup check for GetToolSpec in expanded_tool_names to prevent 'Tool names must be unique' API error - common.rs / message_converter.rs: add dedup in convert_tools_flat and convert_tools for defensive deduplication - catalog.rs / tool_contracts.rs: update test expectations for dedup - registry.rs: add LegionControl to builtin tool manifest test; remove SessionControl/Message/History from collapsed manifest test
- RuntimeHookKind::Stop fires after each dialog round completes - StopHookContext carries round-level data (tool calls, file reads/edits) - StopHookExecutor trait with context_guard (B01) + behavior_guard (C01) - run_stop_hooks_for_round() wired into execution_engine round loop - C01 detects systemic violations: all-edits-unread, all-tools-failed
1688mengdie
force-pushed
the
feature/agentic-dynamic-workflows
branch
from
July 17, 2026 22:27
b0db461 to
d335a52
Compare
added 3 commits
July 18, 2026 13:30
## Core: cc-haha style stop-hook LLM review (execution_engine + post_call_hooks)
Every round with tool calls spawns a background thread that calls the primary
LLM to review the agent's behavior. The review covers three responsibilities:
1. 书记官 (Context Guardian): detects context compression, extracts critical
decisions/progress/user corrections from before compression, and injects
them as CTX: prefixed context recovery notes.
2. 纪律委员 (Behavior Auditor): checks Read-before-Edit violations, LionHeart
path protection, repeated tool failures without strategy change, PowerShell
with Chinese+JSON, all-tools-failed, and edit-without-verification. Returns
ABORT: on violations (injected as HookResult::Abort) or WARN: on warnings.
3. 提示蜂 (Skill Advisor): matches agent activity to available BitFun skills
(miniapp-dev, Pair-Programming, agent-reach, etc.) and recommends loading.
Architecture: std::thread::spawn -> tokio runtime -> get_global_ai_client_factory
-> send_message_stream -> push_review_result to REVIEW_BUFFER -> next round's
stop hook drains buffer and injects results as additional_contexts/Abort.
Matches cc-haha pattern: stop -> external process -> result injected next round.
## DAG MiniApp (builtin + floating panel)
- Built-in MiniApp 'bee-colony-dag' renders 8-node vertical DAG (cmd->sec->pm->plan->exec->review->accept->opt)
- Node colors: idle=gray, running=blue(pulse), done=green, failed=red
- Gate nodes (review/accept) marked with red dashed border
- Polls app.storage('bee-colony-state') every 500ms for state updates
- BeeColonyMonitor floating panel (GitBranch button in agent scenes)
## Agent definitions
- bee-reviewer: B01+C01 merged, fork full context, monitor goals/compression/violations
- b01-context-agent: context guardian, silent unless context degrading
- c01-audit-agent: behavior auditor, silent unless violation detected
## State push tool
Python helper at %APPDATA%/bitfun/tools/bee_colony_state_push.py
Usage: set <node_id> <status>, reset, or full JSON push
1688mengdie
force-pushed
the
feature/agentic-dynamic-workflows
branch
from
July 18, 2026 06:09
8aa0ed1 to
8308ba3
Compare
1688mengdie
force-pushed
the
feature/agentic-dynamic-workflows
branch
from
July 18, 2026 06:15
293a00a to
f264a52
Compare
Author
|
已将本 PR 按功能拆分为 6 个独立的、小而聚焦的 PR,每个均基于 main 且独立可编译:
所有 PR 已通过 cargo check --workspace + pnpm run type-check:web,符合 CONTRIBUTING_CN.md 的 PR 拆分要求。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
免责声明
cargo check --workspace+pnpm run type-check:web+ Team 模式端到端功能验证。未经过完整单元测试覆盖。核心设计思路
不积跬步,无以至千里;千里之堤,溃于蚁穴。 长任务实现的本质不是"一个 Agent 扛到底",而是把每一步都做对——每一步过审查、每一步纠偏、每一步确定性输出。
原子任务分解: 任何复杂任务都可分解为不可再分的原子步骤。分解粒度决定并行度——可并行的并行(提效),有依赖的串行(保流程)。
三蜂 Loop 循环: 每个原子任务由提示蜂+执行蜂+审查蜂三个 Agent 通过 SessionMessage 自循环。Loop 确保执行上下文最大化节省 token,不通过 Gate 绝不输出到下一步。审查蜂不是"最后看一眼",是每一步都盯——偷懒、幻觉、死循环、跳过验证——实时拦截+纠正注入。
事实、效率、结果: 三个不可妥协的维度。事实 = 每一步基于证据,不做假设;效率 = 最大化并行,最小化空转;结果 = Gate 通过才是输出,不通过就是回退。
只调度不执行: 军团长分解任务、拓扑排序、并行派发、Gate 裁决。不亲手改一行代码。
Mesh 网状通信: 军团成员之间 SessionMessage 直连(不经军团长),形成真正的对等网络。
现成积木最大化复用: DeepReview 审查团队已是完整三蜂结构。Claw 已有 session 工具。不做新引擎——泛化现有结构即可支持任意任务编排。不引入外部依赖。
每一步都是正确的: 行为守卫生效(Hook Abort)+ 审查蜂实时行为审计 + Gate Loop 层层把关 → 长任务才敢放心交出去。
蜂群架构:多Agent军团编排 + 审查Hook + DAG画布
一、核心架构思想
公司(分解派发) + 军事(容错重组) + 航天(追溯零错) 三域合一,通过八个固定Agent角色实现任意复杂度的任务编排。
八个固定角色(积木)
六条原则
10棵二元决策树
每棵只有两条路:通过→下一棵,不通过→修正→重检→直到通过。任何节点可展开为完整子链(自由嵌套)。
与ruflo的本质差异
角色固定(八个通用骨架),提示词灵活。同一executor注入量化提示词→量化执行者,注入前端提示词→前端执行者。B01管理领域提示词库。
二、LegionControl 军团编排
动态DAG拓扑排序执行引擎。 读JSON模板→拓扑排序→分层创建session→注入上下文→串行/并行派发。
核心实现
LegionControl工具:load模板 / list / status,支持自定义agent类型SessionControl:Collapsed→Expanded,支持动态创建/列出/关闭会话SessionMessage:跨会话消息派发,传workspace路径和agent类型SessionHistory:导出会话转录,支持turn选择器(单轮/范围/最后N轮)预设模板
bee-colony-standard:8节点全链(cmd→sec→pm→plan→exec→review→accept→opt)bee-colony-quick:4节点精简链(cmd→exec→review→accept)bee-colony-parallel:12节点3并行执行者+各自审查bee-colony-single:单执行者模式bee-colony-multi-legion:14节点多军团接力三、cc-haha 模式审查Hook
每轮对话结束触发LLM审查(非自审,非Agent会话),审查结果注入下一轮上下文。
审查员三合一职责
设计要点
四、STALE_TRACKER 修复
新增
last_target字段区分"同工具不同文件"和"同工具同文件"。五、蜂群DAG画布MiniApp
内置MiniApp
bee-colony-dagapp.storage('bee-colony-state')实时更新BeeColonyMonitor浮动面板
状态推送工具
bee_colony_state_push.py:set/reset/批量JSON三种模式,直写storage.json六、Agent注册
%APPDATA%/bitfun/agents/commander.md%APPDATA%/bitfun/agents/secretary.md%APPDATA%/bitfun/agents/product-manager.md%APPDATA%/bitfun/agents/planner.md%APPDATA%/bitfun/agents/executor.md%APPDATA%/bitfun/agents/reviewer.md%APPDATA%/bitfun/agents/acceptor.md%APPDATA%/bitfun/agents/optimizer.md%APPDATA%/bitfun/agents/bee-reviewer.md%APPDATA%/bitfun/agents/b01-context-agent.md%APPDATA%/bitfun/agents/c01-audit-agent.md七、关键文件变更
legion_control_tool.rspost_call_hooks.rs(core)post_call_hooks.rs(agent-runtime)execution_engine.rssession_control_tool.rssession_message_tool.rssession_history_tool.rsbuiltin.rsBeeColonyMonitor.tsx/.scsscommander.mdSKILL.mdv10.4AgentsScene.tsxSummary
Agentic Dynamic Workflows: 泛化 BitFun 原生会话工具,实现智能体军团编排——Agent 通过 SessionControl 创建子 Agent 会话节点,SessionMessage 发送任务并自动接收回复,SessionHistory 审查战报,Goal 追踪进度。不引入新引擎,全用原生基础设施。
Fixes #N/A(新功能)
Type and Areas
Type: feat
Areas: Rust core, desktop/Tauri, web UI, ACP interface
Motivation / Impact
问题: Team 模式的 SessionControl/SessionMessage/SessionHistory 三个工具处于 Collapsed 状态,Agent 看不到。session 工具的 agent_type 硬编码,ACP 外部 Agent 无法被编排。DeepReview 审查团队被限制为代码审查专用。
改动:
影响: Team/Claw/agentic/Plan/Debug/Multitask 模式现在全部能创建和互发消息。ACP 外部 Agent 可被编排。审查蜂可见性保持不变。
Verification
Reviewer Notes
架构边界: 所有改动严格遵循 BitFun 六层架构:
不引入新引擎: 全用 SessionControl/SessionMessage/SessionHistory/Goal/Task 原生工具。
不破坏现有功能: DeepReview 审查流程不变,审查蜂可见性保持 Hidden/restricted 原始状态。
AI 辅助: 本 PR 由 AI 辅助完成,已通过 cargo check --workspace + type-check:web + 完整 E2E 功能验证。
Checklist