Skip to content

feat(agent-core): add tower command to orchestrate multi-agents - #2633

Open
tpoisonooo wants to merge 9 commits into
MoonshotAI:mainfrom
tpoisonooo:feat-cowork
Open

feat(agent-core): add tower command to orchestrate multi-agents#2633
tpoisonooo wants to merge 9 commits into
MoonshotAI:mainfrom
tpoisonooo:feat-cowork

Conversation

@tpoisonooo

@tpoisonooo tpoisonooo commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Problem

希望 9 个 agent 同时迭代 1 个 repo,改接口协议的、动数据的、调渲染的互相不会冲突打架。

以维护 ncnn 为例,输入多个指令:

  • M1:调研 contributor list 写入 README
  • M2:调研 repo 用到的所有 vulkan API 写入 README
  • M3:开发一个 vulkan int4 gemm
  • M4:跑一个 vulkan int4 的 sqznet 测试

/tower 命令下:

  1. M1 会和 M2 通信,避免同时写 README
  2. M2 和 M3 会读后写,实际会同时跑
  3. M4 会被 tower 安排到 M3 之后启动

差异对比

  • Swarm 是 总-分-总 模式
  • Subagent 是 总-分 模式
  • Goal 是 plan-run-revise 模式
  • Tower 是乱序
    想象一下 team lead 找不同的人沟通事情。沟通时间、冲突情况都是不保证的,但沟通内容都是 team 内的事情。
    内部有个塔台(tower)来分发任务、协调冲突、指定 reviewer、合并代码、清理残留。

收益

  • 同样 N 条指令, /tower 模式会更快跑完
  • 精度轻微上涨,因为有 revisit

代价

  • 目前 TowerWorker 不会 AskUserQuestion,但 Tower 会协商需求
  • 要额外 token 做内部协商+ code review

Feature

  • agent swarm 配置 secondary 模型的方法,对 /tower worker 同样生效(注意 reviewer 仍然是 primary model
## 前置条件(实验功能,默认关闭)

export KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1

## 配置次主力模型(三选一)

- `config.toml`:

[secondary_model]
model = "kimi-code/kimi-k2.5"   # [models] 中已有条目的别名,不限 kimi,可任意供应商
default_effort = "low"          # 可选:子 Agent 绑定时的 thinking effort
max_output_size = 8192          # 可选:接受 models overrides 全部字段,仅对子 Agent 生效的补丁

- 环境变量(优先级高于配置文件):`KIMI_SECONDARY_MODEL` / `KIMI_SECONDARY_EFFORT`
- TUI 内:`/secondary_model` 命令打开选择器,写入配置并即时生效

运行截图

image

致谢

What changed

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f47bc1d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tpoisonooo tpoisonooo changed the title Feat cowork feat(agent-core): add tower mode Aug 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60c6209818

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/agent-core/src/agent/tower/store.ts
Comment thread apps/kimi-code/package.json Outdated
Comment thread packages/agent-core/src/tools/builtin/tower/init.ts Outdated
Comment thread packages/agent-core/src/tools/builtin/tower/spawn.ts Outdated
Comment thread packages/agent-core-v2/src/features/tower/tools/spawn/spawnTool.ts Outdated
Comment thread apps/kimi-code/src/tui/kimi-tui.ts Outdated
@tpoisonooo tpoisonooo changed the title feat(agent-core): add tower mode feat(agent-core): misc Aug 5, 2026
@tpoisonooo tpoisonooo changed the title feat(agent-core): misc feat(agent-core): add tower mode to orchestrate multi-agents Aug 5, 2026
@tpoisonooo tpoisonooo changed the title feat(agent-core): add tower mode to orchestrate multi-agents feat(agent-core): add tower command to orchestrate multi-agents Aug 5, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@f47bc1d
npx https://pkg.pr.new/@moonshot-ai/kimi-code@f47bc1d

commit: f47bc1d

Liewzheng added a commit to Liewzheng/kimi-code that referenced this pull request Aug 7, 2026
Declare kimiteam v0.33.0 as the last maintained open-source release of
this series, with the reasons stated plainly: upstream adopted the
community tower approach (MoonshotAI/kimi-code PR MoonshotAI#2633) rather than
the subagent-team scheme, and the official web UI went closed-source
(code-app private repo). The release stays installable and forkable.
konghuanjun added 2 commits August 14, 2026 17:47
feat(packages): update throttle control

feat(agent-core): rename to /tower

feat(agent-core-v2): support tower mode

fix(packages): keep tower teardown from stranding submodule worktrees

A plain `git worktree remove` refuses worktrees containing initialized
submodules even when they are clean, so tower teardown silently left
behind exactly the worktrees whose workers had run builds (the failure
only reached the tool report, never the activity log).

The dirty check is the data-loss gate; once it passes, removal always
passes --force (harmless on a clean worktree, and precisely what
bypasses git's submodule refusal). Kept and failed removals now also
land in the activity log as worktree.keep / worktree.remove.failed.

feat(packages): allow the tower to AskUserQuestion, workers still cannot

The tower-mode AskUserQuestion deny only ever fired on the tower itself:
workers never enter tower mode, and their tower-worker profile simply
does not list the tool. Drop the deny so the tower can clarify
requirements with the human up front; workers and reviewers stay
ask-less and escalate via TowerSend. Auto permission mode still
disables AskUserQuestion for everyone.

fix(agent-core-v2): import LifecycleScope from #/app/scopes

main moved the enum out of #/_base/di/scope; follow the new location in
the two tower services.

test(agent-core-v2): refresh fullCompaction token expectations

main's MoonshotAI#2699 counts compaction tokens on the full-request basis, so the
tower tool schemas (default registry) and the /tower skill catalog entry
(system prompt) shift the pinned numbers: +2789 with the default tool
set, +173 with the explicit harness tool list. The 20k-window test keeps
its shape with a 22k window so the post-compaction floor still fits.

feat(agent-core-v2): tower command support secondary model

fix(tower): disable todo-list tool

feat(tower): reviewer keep primary model

fix(tower): tower worker call for authroization

update
"@moonshot-ai/kimi-code": patch
---

Fix several seconds of startup lag: the global search index (used only by the web UI's search) was being opened and synced in every terminal session, including ones that never search. It now loads on demand, so interactive startup stays fast.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是在修复启动的时候,要十几秒卡住的 bug。如果 master 已修,可以删掉。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前 master 还没修掉

reason: busyReason,
};
}
// Skill activations are never blocked by a busy session: the TUI queues

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

未声明 busy 的 skill 会从"被拒"变成"延迟自动执行",看能否接受。


// Bash commands (`! …`) are not steerable: keep them queued so they run
// after the current task instead of being injected into the turn as text.
// Bash commands (`! …`) and slash-skill activations are not steerable:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tower 和 ctrl+s 冲突,因此需要改。

headline: () => ({ main: <Dim>swarm mode exited</Dim> }),
},

'tower_mode.enter': {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tower 需要前端回显

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant