agestra 4.13.2 → 4.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  [![npm version](https://img.shields.io/npm/v/agestra.svg)](https://www.npmjs.com/package/agestra)
4
4
  [![license](https://img.shields.io/npm/l/agestra.svg)](LICENSE)
5
5
 
6
- **Agent + Orchestra** — A multi-host orchestration toolkit for Claude Code, Codex CLI, and Gemini CLI.
6
+ **Agent + Orchestra** — Multi-host MCP orchestration for Claude Code, Codex CLI, Gemini CLI, and local models.
7
7
 
8
8
  [English](README.md) | [한국어](README.ko.md) | [日本語](README.ja.md) | [中文](README.zh.md)
9
9
 
10
- Agestra connects the Claude host, Ollama (local), Gemini CLI, and Codex CLI as pluggable providers, enabling multi-agent orchestration with independent aggregation, consensus debates, autonomous CLI workers, parallel task dispatch, cross-validation, and quality-based provider routing — all through 44 MCP tools.
10
+ Agestra connects the Claude host/CLI, Ollama (local), Gemini CLI, and Codex CLI as pluggable providers, enabling multi-agent orchestration with independent aggregation, consensus debates, autonomous CLI workers, parallel task dispatch, cross-validation, and capability-based provider routing with optional trace evidence — all through 45 MCP tools.
11
11
 
12
12
  ## Quick Start
13
13
 
@@ -46,10 +46,13 @@ At least one AI provider must be installed:
46
46
 
47
47
  | Provider | Install | Type |
48
48
  |----------|---------|------|
49
+ | [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) | `npm install -g @anthropic-ai/claude-code` | Cloud |
49
50
  | [Ollama](https://ollama.com/) | `curl -fsSL https://ollama.com/install.sh \| sh` | Local LLM |
50
51
  | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `npm install -g @google/gemini-cli` | Cloud |
51
52
  | [Codex CLI](https://github.com/openai/codex) | `npm install -g @openai/codex` | Cloud |
52
53
 
54
+ Each CLI manages its own authentication. Sign in through each CLI's own login flow before using Agestra — Agestra spawns these CLIs as child processes and does not handle their credentials.
55
+
53
56
  Optional but recommended:
54
57
  - **tmux** — enables visible CLI worker panes during autonomous execution
55
58
  - **ripgrep (`rg`)** on Windows — if Codex resolves `rg` to its bundled Store-app path and fails with an "Access is denied" error, install ripgrep separately so a normal `rg.exe` is found first in `PATH`:
@@ -70,6 +73,52 @@ winget install BurntSushi.ripgrep.MSVC
70
73
 
71
74
  **Multi-AI is for verification, not token savings.** The review, design exploration, and idea generation workflows are structured as validation processes — getting independent opinions from multiple AI providers to catch blind spots, not to parallelize for speed.
72
75
 
76
+ ## How It Works
77
+
78
+ ```mermaid
79
+ flowchart TD
80
+ Start([User invokes /agestra command]) --> Preflight[Setup status / environment / provider check]
81
+ Preflight --> Domain{Workflow type}
82
+
83
+ Domain -->|Idea / design / review / security| TextLead[Leader assembles specialist and external AIs]
84
+ Domain -->|QA| QaLead[Leader forms QA Brigade]
85
+ Domain -->|Implementation| ImplLead[Leader decomposes implementation work]
86
+
87
+ ImplLead --> ImplRoute{Task shape}
88
+ ImplRoute -->|Clear parallel implementation| CliWorkers[Codex / Gemini CLI workers<br/>isolated worktrees]
89
+ ImplRoute -->|Capability-matched scoped work| Ollama[Local/tool models<br/>read / write if policy allows]
90
+ ImplRoute -->|Risky or core change| HostImpl[Host implementer<br/>close leader supervision]
91
+ CliWorkers --> ReviewDiff[Leader monitors status / quota / diff]
92
+ Ollama --> ReviewDiff
93
+ HostImpl --> ReviewDiff
94
+ ReviewDiff --> Merge{Acceptable?}
95
+ Merge -->|No| Reassign[Correction prompt or reassignment]
96
+ Reassign --> ImplRoute
97
+ Merge -->|Yes| QaEvidence
98
+
99
+ QaLead --> QaEvidence[Host QA collects executable evidence<br/>build / tests / E2E / screenshots]
100
+ TextLead --> Providers{External AIs available?}
101
+ QaEvidence --> Providers
102
+
103
+ Providers -->|No| LocalOut[Host specialist writes<br/>domain report or document]
104
+ Providers -->|Yes| Individual[Each AI writes independent source material]
105
+ LocalOut --> Final([Report back to user])
106
+
107
+ Individual --> Ledger[ITEM-* JSON consensus ledger]
108
+ Ledger --> Round[Sequential rounds<br/>agree / disagree / revise / opinion]
109
+ Round --> Gate{Ledger state}
110
+ Gate -->|Needs more discussion| Round
111
+ Gate -->|Leader judgment needed| LeaderDecision[Leader chooses continue / approve / reject]
112
+ Gate -->|Resolved| LeaderDecision
113
+ LeaderDecision -->|Continue| Round
114
+ LeaderDecision -->|Approve| Approved[Approved synthesis document]
115
+ LeaderDecision -->|Reject| Rejected[Rejected / unresolved synthesis document]
116
+ Approved --> Final
117
+ Rejected --> Final
118
+ ```
119
+
120
+ When no external provider is configured, Agestra skips consensus rounds and the host specialist writes the domain artifact: review or QA report, design plan, idea record, and so on. When a structured debate runs, leader finalization always leaves a synthesis document: approval produces an approved synthesis, while rejection produces a rejected/unresolved synthesis that lists accepted, excluded, and still-open items.
121
+
73
122
  ## Host Workflows
74
123
 
75
124
  | Host | Natural entrypoint |
@@ -98,7 +147,7 @@ When external providers are available, review, QA, security, design, and idea wo
98
147
 
99
148
  | Agent | Model | Role |
100
149
  |-------|-------|------|
101
- | `agestra-team-lead` | Sonnet | Full orchestrator — environment check, quality-based provider routing, work mode selection, CLI worker supervision, QA loop |
150
+ | `agestra-team-lead` | Sonnet | Full orchestrator — environment check, capability-based provider routing, work mode selection, CLI worker supervision, QA loop |
102
151
  | `agestra-implementer` | Sonnet | Scoped implementation executor — code edits, test updates, local verification |
103
152
  | `agestra-e2e-writer` | Sonnet | Persistent E2E test writer — creates approved browser-flow tests without changing product behavior |
104
153
  | `agestra-reviewer` | Opus | Strict quality verifier — security, orphans, spec drift, test gaps |
@@ -134,13 +183,14 @@ Turborepo monorepo with 8 packages:
134
183
 
135
184
  | Package | Description |
136
185
  |---------|-------------|
137
- | `@agestra/core` | `AIProvider` interface, registry with difficulty-based routing, config loader, CLI runner, atomic writes, job queue, secret scanner, worktree manager, task manifest, CLI worker manager |
186
+ | `@agestra/core` | `AIProvider` interface, provider descriptors with capability/difficulty metadata, config loader, CLI runner, atomic writes, job queue, secret scanner, worktree manager, task manifest, CLI worker manager |
187
+ | `@agestra/provider-claude` | Anthropic Claude CLI adapter |
138
188
  | `@agestra/provider-ollama` | Ollama HTTP adapter with model detection |
139
189
  | `@agestra/provider-gemini` | Google Gemini CLI adapter |
140
190
  | `@agestra/provider-codex` | OpenAI Codex CLI adapter |
141
191
  | `@agestra/agents` | Debate engine with consensus detection, turn quality evaluator, task dispatcher, cross-validator, task chain, auto-QA, file change tracker, session manager |
142
192
  | `@agestra/workspace` | Workspace document manager for reviews, analysis notes, and aggregated reports |
143
- | `@agestra/mcp-server` | MCP protocol layer, 44 tools, environment-aware tool filtering, dispatch |
193
+ | `@agestra/mcp-server` | MCP protocol layer, 45 tools, environment-aware tool filtering, dispatch |
144
194
 
145
195
  ### Design Principles
146
196
 
@@ -154,25 +204,27 @@ Turborepo monorepo with 8 packages:
154
204
 
155
205
  ### Work Modes
156
206
 
207
+ In multi-provider modes (consensus debate, cross-validation, review rounds), one provider's output may become part of the prompt the next provider receives.
208
+
157
209
  **Text work** (review, QA, security, design, idea): providers available → consensus debate mode; no providers → Leader-host only. For QA, the team lead runs a QA Brigade by default while E2E/runtime checks stay host-owned.
158
210
 
159
211
  **Implementation work** (team-lead orchestration):
160
212
  - **Leader-host only** — `agestra-implementer` applies scoped code changes; the team lead still routes QA through the QA Brigade by default, with host-only review/QA available on request.
161
- - **Suggested AI distribution** — the team lead proposes a routing table, asks for approval, then dispatches Codex/Gemini CLI workers for suitable code edits and Ollama for simple/repetitive proposal work.
213
+ - **Suggested AI distribution** — the team lead proposes a routing table, asks for approval, then distributes work according to the capabilities of detected models, including frontier and local models. Codex/Gemini CLI workers handle suitable autonomous code edits, and local/tool models may receive read-only or read/write AgentLoop tools according to their `executionPolicy`.
162
214
 
163
215
  ---
164
216
 
165
- ## Tools (44)
217
+ ## Tools (45)
166
218
 
167
219
  ### AI Chat (3)
168
220
 
169
221
  | Tool | Description |
170
222
  |------|-------------|
171
- | `ai_chat` | Chat with a specific provider (use `"auto"` for quality-based routing); optionally persist replies with `save_as_document` |
223
+ | `ai_chat` | Chat with a specific provider (use `"auto"` for trace-assisted routing when observations exist); optionally persist replies with `save_as_document` |
172
224
  | `ai_analyze_files` | Read files from disk and send contents with a question to a provider |
173
225
  | `ai_compare` | Send the same prompt to multiple providers, compare responses |
174
226
 
175
- ### Agent Orchestration (14)
227
+ ### Agent Orchestration (15)
176
228
 
177
229
  | Tool | Description |
178
230
  |------|-------------|
@@ -181,10 +233,11 @@ Turborepo monorepo with 8 packages:
181
233
  | `agent_debate_create` | Create a turn-based debate session (returns debate ID) |
182
234
  | `agent_debate_turn` | Execute one provider's turn; supports `provider: "claude"` for Claude's independent participation |
183
235
  | `agent_debate_conclude` | End a debate and generate final transcript |
184
- | `agent_debate_structured` | Start an approval-gated structured debate in the background — individual reviews, optional alias clarification, JSON consensus rounds, status polling, and no synthesis until approved |
185
- | `agent_debate_approve` | Leader-approve a ready-for-approval structured debate; writes the synthesis document and closes the session |
236
+ | `agent_debate_structured` | Start an approval-gated structured debate in the background — individual reviews, optional alias clarification, JSON consensus rounds, status polling, and no synthesis until the leader approves or rejects |
237
+ | `agent_debate_approve` | Leader-approve a ready-for-approval structured debate; writes the approved synthesis document and closes the session |
186
238
  | `agent_debate_continue` | Start additional background rounds on a ready-for-approval or escalated structured-debate session (3/5/10), then poll status |
187
- | `agent_debate_reject` | Reject a structured-debate session without writing synthesis |
239
+ | `agent_debate_reject` | Reject a structured-debate session; writes a rejected synthesis document and optionally an issue document |
240
+ | `agent_debate_submit_turn` | Submit a native host-specialist turn when structured debate status reports `phase: awaiting-host-turn`; the workflow resumes after all pending host turns arrive |
188
241
  | `agent_debate_review` | Send a document to multiple providers for independent review |
189
242
  | `agent_cross_validate` | Cross-validate outputs (agent-tier validators only) |
190
243
  | `agent_changes_review` | Review file changes from an isolated task |
@@ -204,7 +257,7 @@ Turborepo monorepo with 8 packages:
204
257
 
205
258
  | Tool | Description |
206
259
  |------|-------------|
207
- | `environment_check` | Detect CLI tools, Ollama models with tiers, tmux, git worktree support, available modes |
260
+ | `environment_check` | Detect CLI tools, local model tiers, tmux, git worktree support, available modes |
208
261
 
209
262
  ### Workspace (7)
210
263
 
@@ -265,7 +318,7 @@ Turborepo monorepo with 8 packages:
265
318
  | Tool | Description |
266
319
  |------|-------------|
267
320
  | `trace_query` | Query trace records with filtering (provider, task, time range) |
268
- | `trace_summary` | Get quality stats, performance metrics, and difficulty qualification per provider |
321
+ | `trace_summary` | Get optional prior quality observations and performance metrics per provider |
269
322
  | `trace_visualize` | Generate a Mermaid diagram of a traced operation's flow |
270
323
 
271
324
  ---
@@ -283,7 +336,7 @@ Created by `/agestra setup`. The default location is the host-shared `~/.agestra
283
336
  | `providers[].id` | Unique identifier |
284
337
  | `providers[].type` | `ollama`, `gemini-cli`, `codex-cli`, or `claude-cli` |
285
338
  | `providers[].enabled` | Whether to register this provider at startup — hard opt-out when `false` |
286
- | `providers[].executionPolicy` | `read-only` or `workspace-write` |
339
+ | `providers[].executionPolicy` | `read-only`, `workspace-write`, or `full-auto`; Ollama uses this to choose read-only vs read/write AgentLoop tools |
287
340
  | `providers[].config` | Type-specific settings (host, timeout, etc.) |
288
341
 
289
342
  ### Runtime Data
@@ -374,12 +427,13 @@ agestra/
374
427
  │ └── uninstall-host-mcp.mjs # Remove host registrations and managed assets
375
428
  ├── packages/
376
429
  │ ├── core/ # AIProvider interface, registry, security, workers
430
+ │ ├── provider-claude/ # Anthropic Claude CLI adapter
377
431
  │ ├── provider-ollama/ # Ollama HTTP adapter
378
432
  │ ├── provider-gemini/ # Gemini CLI adapter
379
433
  │ ├── provider-codex/ # Codex CLI adapter
380
434
  │ ├── agents/ # Debate engine, dispatcher, cross-validator
381
435
  │ ├── workspace/ # Workspace document manager
382
- │ └── mcp-server/ # MCP server, 44 tools, environment-aware filtering, dispatch
436
+ │ └── mcp-server/ # MCP server, 45 tools, environment-aware filtering, dispatch
383
437
  ├── package.json # Workspace root
384
438
  └── turbo.json # Turborepo pipeline
385
439
  ```
package/README.zh.md CHANGED
@@ -3,56 +3,34 @@
3
3
  [![npm version](https://img.shields.io/npm/v/agestra.svg)](https://www.npmjs.com/package/agestra)
4
4
  [![license](https://img.shields.io/npm/l/agestra.svg)](LICENSE)
5
5
 
6
- **Agent + Orchestra** — 一个可在 Claude Code、Codex CLIGemini CLI 中共用的多宿主编排工具包。
6
+ **Agent + Orchestra** — 面向 Claude Code、Codex CLIGemini CLI 和本地模型的多宿主 MCP 编排工具包。
7
7
 
8
8
  [English](README.md) | [한국어](README.ko.md) | [日本語](README.ja.md) | [中文](README.zh.md)
9
9
 
10
- Agestra 将 Ollama(本地)、Gemini CLI 和 Codex CLI 作为可插拔提供方接入 Claude Code,通过 44 个 MCP 工具提供多 AI 编排、独立汇总、共识辩论、自主 CLI Worker、并行任务分发、交叉验证和基于质量的提供方路由。
10
+ Agestra 将 Claude host/CLI、Ollama(本地)、Gemini CLI 和 Codex CLI 作为可插拔提供方接入,通过 45 个 MCP 工具提供多 AI 编排、独立汇总、共识辩论、自主 CLI Worker、并行任务分发、交叉验证,以及可选参考 trace 证据的能力型提供方路由。
11
11
 
12
12
  ## 快速开始
13
13
 
14
- ### Claude Code
14
+ 先选择你要使用的宿主。需要安装宿主原生命令/代理时使用 `--assets` 路径;只需要服务器连接时使用 MCP-only 注册。
15
15
 
16
- ```
17
- /plugin marketplace add mua-vtuber/Agestra
18
- /plugin install agestra@agestra
19
- ```
20
-
21
- Claude 保持现有插件安装体验不变。Agestra 会在首次使用时通过 `environment_check` 自动检测可用的提供方(Claude host、Ollama、Gemini CLI、Codex CLI)。
16
+ | 宿主 | 从本仓库安装 | 从全局 npm 安装 | `--assets` 会添加 |
17
+ |------|--------------|----------------|-------------------|
18
+ | Claude Code | `/plugin marketplace add mua-vtuber/Agestra` 后执行 `/plugin install agestra@agestra` | 同样的插件流程 | 插件包、命令、代理、hooks 和 MCP server |
19
+ | Codex CLI | `npm run bundle` 后执行 `npm run install:codex:assets` | `npm install -g agestra` 后执行 `agestra-install codex --assets` | `.codex/agents/` 下的生成 custom agents |
20
+ | Gemini CLI | `npm run bundle` 后执行 `npm run install:gemini:assets` | `npm install -g agestra` 后执行 `agestra-install gemini --assets --scope user` | project scope 的受管文件,或 user scope 的 native `agestra` Gemini extension |
22
21
 
23
- ### Codex CLI
22
+ 也可以只注册 MCP:
24
23
 
25
- ```
26
- npm run bundle
27
- npm run install:codex:assets
28
- ```
29
-
30
- 使用全局 npm 包时:
31
-
32
- ```
33
- npm install -g agestra
34
- agestra-install codex --assets
35
- ```
24
+ | 宿主 | 仓库包 | 从 checkout 注册全局包 |
25
+ |------|--------|------------------------|
26
+ | Codex CLI | `npm run install:codex` | `npm run install:codex:global` |
27
+ | Gemini CLI | `npm run install:gemini` | `npm run install:gemini:global` |
36
28
 
37
- Codex 会结合仓库根目录下的 [AGENTS.md](AGENTS.md) 与已注册的 `agestra` MCP 服务一起工作。生成 Codex custom agent 需要使用 `--assets` 路径,它会在 `.codex/agents/` 下安装 agent,并写入 Agestra host-asset manifest。不安装 custom agent、只注册 MCP 时,请使用 `npm run install:codex` 或 `agestra-install codex`。
38
-
39
- ### Gemini CLI
40
-
41
- ```
42
- npm run bundle
43
- npm run install:gemini:assets
44
- ```
45
-
46
- 使用全局 npm 包时:
47
-
48
- ```
49
- npm install -g agestra
50
- agestra-install gemini --assets --scope user
51
- ```
29
+ Claude 保持原生插件 UX。Codex 会结合 [AGENTS.md](AGENTS.md)、生成的 custom agents 和已注册的 `agestra` MCP server。Gemini 会结合 [GEMINI.md](GEMINI.md)、`.gemini/commands/agestra/`、生成的 skills,以及 project-scope 受管文件或 user-scope native extension。
52
30
 
53
- Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/commands/agestra/`](.gemini/commands/agestra) 和生成的 skills 一起工作。project scope 的 `--assets` 会写入受管文件,user scope 的 `--assets` 会安装 Agestra Gemini native extension。只注册 MCP 时,请使用 `npm run install:gemini` 或 `agestra-install gemini`。`npm run install:gemini:assets` 默认使用 user scope;如果要从 checkout 安装 project-scope 受管文件,请运行 `node scripts/install-host-mcp.mjs gemini --assets --scope project`。
31
+ 注意:`npm run install:gemini:assets` 默认使用 user scope。如果要从 checkout 安装 project-scope Gemini 受管文件,请运行 `node scripts/install-host-mcp.mjs gemini --assets --scope project`。
54
32
 
55
- 安装后可用的 Gemini 命令:
33
+ Assets 安装后可用的 Gemini 命令:
56
34
 
57
35
  - `/agestra:setup`
58
36
  - `/agestra:review`
@@ -68,12 +46,26 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
68
46
 
69
47
  | 提供方 | 安装 | 类型 |
70
48
  |--------|------|------|
49
+ | [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) | `npm install -g @anthropic-ai/claude-code` | Cloud |
71
50
  | [Ollama](https://ollama.com/) | `curl -fsSL https://ollama.com/install.sh \| sh` | Local LLM |
72
51
  | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `npm install -g @google/gemini-cli` | Cloud |
73
52
  | [Codex CLI](https://github.com/openai/codex) | `npm install -g @openai/codex` | Cloud |
74
53
 
54
+ 每个 CLI 都自行管理其认证。请在使用前通过对应 CLI 自身的登录流程完成认证 — Agestra 仅作为子进程启动这些 CLI,不会处理其认证信息。
55
+
75
56
  可选但推荐:
76
57
  - **tmux** — 让你在自主执行期间可视化查看 CLI Worker 面板
58
+ - **Windows 上的 ripgrep (`rg`)** — 如果 Codex 解析到 Store app bundled path 的 `rg` 并出现 "Access is denied",请单独安装 ripgrep,让正常的 `rg.exe` 在 `PATH` 中优先被找到:
59
+
60
+ ```
61
+ cargo install ripgrep
62
+ ```
63
+
64
+ 替代方式:
65
+
66
+ ```
67
+ winget install BurntSushi.ripgrep.MSVC
68
+ ```
77
69
 
78
70
  ---
79
71
 
@@ -81,6 +73,52 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
81
73
 
82
74
  **Multi-AI 的目标是验证,而不是节省 token。** 代码审查、设计探索和想法生成工作流都被设计成验证流程,核心不是为了更快并行,而是让多个 AI 提供方独立给出意见,从而发现盲点。
83
75
 
76
+ ## 工作方式
77
+
78
+ ```mermaid
79
+ flowchart TD
80
+ Start([用户调用 /agestra 命令]) --> Preflight[设置状态 / 环境 / 提供方检查]
81
+ Preflight --> Domain{工作流类型}
82
+
83
+ Domain -->|想法 / 设计 / 审查 / 安全| TextLead[负责人组建专家代理和外部 AI]
84
+ Domain -->|QA| QaLead[负责人组建 QA Brigade]
85
+ Domain -->|实现| ImplLead[负责人拆分实现任务]
86
+
87
+ ImplLead --> ImplRoute{任务形态}
88
+ ImplRoute -->|清晰可并行的实现| CliWorkers[Codex / Gemini CLI Worker<br/>隔离 worktree 中实现]
89
+ ImplRoute -->|能力匹配的有范围任务| Ollama[本地 / 工具模型<br/>策略允许时可读 / 写]
90
+ ImplRoute -->|高风险或核心改动| HostImpl[宿主实现代理<br/>负责人近距离监督]
91
+ CliWorkers --> ReviewDiff[负责人监控状态 / 用量 / diff]
92
+ Ollama --> ReviewDiff
93
+ HostImpl --> ReviewDiff
94
+ ReviewDiff --> Merge{可接受?}
95
+ Merge -->|否| Reassign[修正指令或重新分配]
96
+ Reassign --> ImplRoute
97
+ Merge -->|是| QaEvidence
98
+
99
+ QaLead --> QaEvidence[宿主 QA 收集可执行证据<br/>构建 / 测试 / E2E / 截图]
100
+ TextLead --> Providers{有外部 AI?}
101
+ QaEvidence --> Providers
102
+
103
+ Providers -->|无| LocalOut[宿主专家代理生成<br/>领域报告或文档]
104
+ Providers -->|有| Individual[各 AI 编写独立意见]
105
+ LocalOut --> Final([向用户报告结果])
106
+
107
+ Individual --> Ledger[ITEM-* JSON 共识台账]
108
+ Ledger --> Round[顺序轮次<br/>同意 / 反对 / 修订 / 意见]
109
+ Round --> Gate{台账状态}
110
+ Gate -->|需要继续讨论| Round
111
+ Gate -->|需要负责人判断| LeaderDecision[负责人选择继续 / 批准 / 拒绝]
112
+ Gate -->|已整理| LeaderDecision
113
+ LeaderDecision -->|继续| Round
114
+ LeaderDecision -->|批准| Approved[批准版综合文档]
115
+ LeaderDecision -->|拒绝| Rejected[拒绝 / 未解决综合文档]
116
+ Approved --> Final
117
+ Rejected --> Final
118
+ ```
119
+
120
+ 当未配置任何外部提供方时,Agestra 会跳过共识轮次,由宿主专家代理生成对应领域产物,例如 review/QA 报告、设计文档或想法记录。只要进入结构化辩论,负责人无论批准还是拒绝都会留下综合文档;拒绝文档会整理已接受、已排除以及仍未解决/需要意见的项目。
121
+
84
122
  ## 各宿主的自然入口
85
123
 
86
124
  | 宿主 | 自然入口 |
@@ -101,15 +139,15 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
101
139
  | `/agestra security [target]` | 执行专门的安全审查 |
102
140
  | `/agestra idea [topic]` | 通过与相似项目对比发掘改进点 |
103
141
  | `/agestra design [subject]` | 在实现前探索架构与设计取舍 |
104
- | `/agestra implement [task]` | Claude only 或 Multi-AI 模式执行实现 |
142
+ | `/agestra implement [task]` | 以领导者宿主单独模式或 Multi-AI 分发模式执行实现 |
105
143
 
106
- 当外部提供方可用时,review、QA、security、design、idea 工作流会经由 team-lead 进入多 AI 交叉验证。当未检测到提供方时,当前宿主的本地 specialist agent 会自动处理。
144
+ 当外部提供方可用时,review、QA、security、design、idea 工作流会经由 team-lead 进入多 AI 交叉验证。对于 QA,team-lead 默认会从已配置的提供方集合中组建 QA Brigade,然后交给 moderator engine 现有的 `ITEM-*` / JSON stance ledger:宿主 QA 收集可执行证据,提供方承担不同验证视角,候选 finding 在纳入前会被挑战,综合文档会保留共识与异议。E2E/browser/runtime 执行仍归宿主所有,外部提供方会审查这些证据。当未检测到提供方时,当前宿主的本地 specialist agent 会自动处理。实现请求会先分类任务,并可询问是否提出 AI 任务分配方案。
107
145
 
108
146
  ## 代理
109
147
 
110
148
  | 代理 | 模型 | 角色 |
111
149
  |------|------|------|
112
- | `agestra-team-lead` | Sonnet | 全局编排者:环境检查、按质量路由提供方、选择工作模式、监督 CLI Worker、驱动 QA 循环 |
150
+ | `agestra-team-lead` | Sonnet | 全局编排者:环境检查、能力型提供方路由、选择工作模式、监督 CLI Worker、驱动 QA 循环 |
113
151
  | `agestra-implementer` | Sonnet | 有范围的实现执行者:代码修改、测试更新、本地验证 |
114
152
  | `agestra-e2e-writer` | Sonnet | 持久 E2E 测试作者:只编写已批准的浏览器流程测试 |
115
153
  | `agestra-reviewer` | Opus | 严格质量审查者:关注安全、孤立实现、规格漂移、测试缺口 |
@@ -145,13 +183,14 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
145
183
 
146
184
  | 包 | 说明 |
147
185
  |----|------|
148
- | `@agestra/core` | `AIProvider` 接口、基于难度的路由注册表、配置加载、CLI runner、原子写入、任务队列、密钥扫描、worktree 管理、任务清单、CLI Worker 管理器 |
186
+ | `@agestra/core` | `AIProvider` 接口、带能力/难度元数据的 provider descriptor、配置加载、CLI runner、原子写入、任务队列、密钥扫描、worktree 管理、任务清单、CLI Worker 管理器 |
187
+ | `@agestra/provider-claude` | Anthropic Claude CLI 适配器 |
149
188
  | `@agestra/provider-ollama` | 带模型检测的 Ollama HTTP 适配器 |
150
189
  | `@agestra/provider-gemini` | Google Gemini CLI 适配器 |
151
190
  | `@agestra/provider-codex` | OpenAI Codex CLI 适配器 |
152
191
  | `@agestra/agents` | 带共识检测的辩论引擎、轮次质量评估、任务分发、交叉验证、任务链、自动 QA、文件变更跟踪、会话管理 |
153
192
  | `@agestra/workspace` | 用于评审、分析笔记和汇总报告的工作区文档管理器 |
154
- | `@agestra/mcp-server` | MCP 协议层,44 个工具,按环境过滤工具并动态分发 |
193
+ | `@agestra/mcp-server` | MCP 协议层,45 个工具,按环境过滤工具并动态分发 |
155
194
 
156
195
  ### 设计原则
157
196
 
@@ -165,37 +204,40 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
165
204
 
166
205
  ### 工作模式
167
206
 
168
- **文本工作**(review、QA、security、design、idea):有提供方 → 终极辩论模式;无提供方 → Claude only
207
+ 在多提供方模式(终极辩论、交叉验证、复审轮次)中,一个提供方的输出可能成为下一个提供方所收到提示词的一部分。
208
+
209
+ **文本工作**(review、QA、security、design、idea):有提供方 → 结构化辩论;无提供方 → 负责人宿主的专家代理
169
210
 
170
211
  **实现工作**(team-lead orchestration):
171
- - **仅 Claude** Claude 直接结合项目/全局代理完成实现。
172
- - **与其他 AI 一起**CLI Worker(Codex/Gemini)在隔离的 git worktree 中自主编码,Ollama 处理简单任务,Claude 负责监督与合并。
212
+ - **仅负责人宿主**当前宿主的 `agestra-implementer` 执行有范围的代码修改。除非明确要求 host-only,QA 仍可根据已配置提供方使用 QA Brigade。
213
+ - **建议式 AI 分工**负责人先提出任务分配表并取得批准,然后根据检测到的模型能力分配工作,包括 frontier 模型和本地模型。Codex/Gemini CLI Worker 处理适合的自主代码修改,本地/工具模型可根据 `executionPolicy` 获得只读或读写 AgentLoop 工具。负责人持续监督状态、用量和 diff,并负责合并。
173
214
 
174
215
  ---
175
216
 
176
- ## 工具(44
217
+ ## 工具(45
177
218
 
178
219
  ### AI Chat(3)
179
220
 
180
221
  | 工具 | 说明 |
181
222
  |------|------|
182
- | `ai_chat` | 与指定提供方对话(使用 `"auto"` 可启用基于质量的路由);如有需要,可通过 `save_as_document` 将回复保存为文档 |
223
+ | `ai_chat` | 与指定提供方对话(有观测记录时可用 `"auto"` 启用 trace 辅助路由);如有需要,可通过 `save_as_document` 将回复保存为文档 |
183
224
  | `ai_analyze_files` | 从磁盘读取文件并连同问题一起发送给提供方 |
184
225
  | `ai_compare` | 将同一提示发送给多个提供方并比较结果 |
185
226
 
186
- ### Agent Orchestration(14
227
+ ### Agent Orchestration(15
187
228
 
188
229
  | 工具 | 说明 |
189
230
  |------|------|
190
231
  | `agent_debate_start` | 启动多提供方辩论(非阻塞,可选质量循环 + 验证者) |
191
- | `agent_debate_status` | 查看辩论状态与转录 |
232
+ | `agent_debate_status` | 查看 legacy 辩论或结构化会话的进度、phase、参与者活动和文档路径 |
192
233
  | `agent_debate_create` | 创建回合制辩论会话(返回 debate ID) |
193
234
  | `agent_debate_turn` | 执行某个提供方的一回合;支持 `provider: "claude"` 让 Claude 独立参与 |
194
235
  | `agent_debate_conclude` | 结束辩论并生成最终转录 |
195
- | `agent_debate_structured` | 启动带审批闸门的结构化辩论:进行独立审查、可选别名整理、带投票聚合的多轮推进,合成在批准前不写入,会话停留在 `ready-for-approval` |
196
- | `agent_debate_approve` | 领导者批准 `ready-for-approval` 会话;写入合成文档并结束会话 |
236
+ | `agent_debate_structured` | 启动带审批闸门的结构化辩论:进行独立审查、可选别名整理和 JSON 共识轮次;负责人批准或拒绝前不会写入综合文档 |
237
+ | `agent_debate_approve` | 负责人批准 `ready-for-approval` 会话;写入批准版综合文档并结束会话 |
197
238
  | `agent_debate_continue` | 对 `ready-for-approval`(或 `escalated`)会话追加轮次(3/5/10) |
198
- | `agent_debate_reject` | 拒绝结构化辩论会话,不写入合成 |
239
+ | `agent_debate_reject` | 拒绝结构化辩论会话;写入拒绝版综合文档,并可按需写入 issue 文档 |
240
+ | `agent_debate_submit_turn` | 当结构化辩论状态报告 `phase: awaiting-host-turn` 时提交原生宿主专家 turn;所有待处理宿主 turn 到齐后工作流会自动继续 |
199
241
  | `agent_debate_review` | 将文档发送给多个提供方进行独立审查 |
200
242
  | `agent_cross_validate` | 对输出进行交叉验证(仅限 agent-tier validators) |
201
243
  | `agent_changes_review` | 审查隔离任务中的文件变更 |
@@ -215,7 +257,7 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
215
257
 
216
258
  | 工具 | 说明 |
217
259
  |------|------|
218
- | `environment_check` | 检测 CLI 工具、带分层信息的 Ollama 模型、tmux、git worktree 支持与可用模式 |
260
+ | `environment_check` | 检测 CLI 工具、本地模型分层、tmux、git worktree 支持与可用模式 |
219
261
 
220
262
  ### Workspace(7)
221
263
 
@@ -267,16 +309,16 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
267
309
 
268
310
  ### QA(1)
269
311
 
270
- | Tool | Description |
271
- |------|-------------|
312
+ | 工具 | 说明 |
313
+ |------|------|
272
314
  | `qa_run` | 自动检测 build/test 命令并运行 QA,输出 PASS/FAIL 摘要 |
273
315
 
274
316
  ### Trace / Observability(3)
275
317
 
276
- | Tool | Description |
277
- |------|-------------|
318
+ | 工具 | 说明 |
319
+ |------|------|
278
320
  | `trace_query` | 按条件查询 trace 记录(提供方、任务、时间范围) |
279
- | `trace_summary` | 获取各提供方的质量统计、性能指标和难度资格 |
321
+ | `trace_summary` | 获取各提供方可选的历史质量观测值和性能指标 |
280
322
  | `trace_visualize` | 生成某次追踪操作流程的 Mermaid 图 |
281
323
 
282
324
  ---
@@ -285,7 +327,7 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
285
327
 
286
328
  ### providers.config.json
287
329
 
288
- 由 `/agestra setup` 生成。文件存放于单一的插件范围位置(解析顺序:`AGESTRA_CONFIG_PATH` 环境变量 → `$CLAUDE_PLUGIN_ROOT/providers.config.json` → `~/.agestra/providers.config.json`)。不随仓库一起提交,已加入 gitignore。
330
+ 由 `/agestra setup` 生成。默认保存位置是宿主共享的 `~/.agestra/providers.config.json`。解析顺序为 `AGESTRA_CONFIG_PATH` 环境变量 → 已存在的 `~/.agestra/providers.config.json` → 已存在的 legacy `$CLAUDE_PLUGIN_ROOT/providers.config.json` → 用于新写入的 `~/.agestra/providers.config.json`。它不应放在项目仓库中,并已加入 gitignore。
289
331
 
290
332
  | 字段 | 说明 |
291
333
  |------|------|
@@ -294,7 +336,7 @@ Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md)、[`.gemini/command
294
336
  | `providers[].id` | 唯一标识符 |
295
337
  | `providers[].type` | `ollama`、`gemini-cli`、`codex-cli`、`claude-cli` |
296
338
  | `providers[].enabled` | 启动时是否注册 — `false` 为强制跳过 |
297
- | `providers[].executionPolicy` | `read-only` 或 `workspace-write` |
339
+ | `providers[].executionPolicy` | `read-only`、`workspace-write` 或 `full-auto`;Ollama 根据该值选择只读或读写 AgentLoop 工具 |
298
340
  | `providers[].config` | 类型相关配置(host、timeout 等) |
299
341
 
300
342
  ### 运行时数据
@@ -385,12 +427,13 @@ agestra/
385
427
  │ └── uninstall-host-mcp.mjs # 移除宿主注册和受管理资产
386
428
  ├── packages/
387
429
  │ ├── core/ # AIProvider 接口、注册表、安全、worker
430
+ │ ├── provider-claude/ # Anthropic Claude CLI 适配器
388
431
  │ ├── provider-ollama/ # Ollama HTTP 适配器
389
432
  │ ├── provider-gemini/ # Gemini CLI 适配器
390
433
  │ ├── provider-codex/ # Codex CLI 适配器
391
434
  │ ├── agents/ # 辩论引擎、分发器、交叉验证器
392
435
  │ ├── workspace/ # 工作区文档管理器
393
- │ └── mcp-server/ # MCP Server,44 个工具,按环境过滤并分发
436
+ │ └── mcp-server/ # MCP Server,45 个工具,按环境过滤并分发
394
437
  ├── package.json # 工作区根目录
395
438
  └── turbo.json # Turborepo pipeline
396
439
  ```
@@ -97,7 +97,7 @@ Do not ask `agestra-e2e-writer` to change product behavior. Product fixes belong
97
97
 
98
98
  ### Mode: Structured Debate
99
99
 
100
- **Preferred entry point:** Call `agent_debate_structured` with `mode`, topic, scope, participants, optional `source_documents`, and leader. Use `mode: "review"` for code/document review and `mode: "idea"` for idea/design option discovery. `source_documents` is optional and must use `{ "document_id": "...", "provider": "..." }` entries when independent documents already exist. The tool creates a structured session record immediately and returns `status: running`; use `agent_debate_status` to monitor phase, provider progress, item summary, and document paths. The moderator engine owns the full lifecycle: individual/source material loading, JSON consensus ledger creation, optional alias clarification, sequential provider turns, strict JSON response validation, generated debate markdown, structured session record, and final synthesis after leader approval.
100
+ **Preferred entry point:** Call `agent_debate_structured` with `mode`, topic, scope, participants, optional `source_documents`, and leader. Use `mode: "review"` for code/document review and `mode: "idea"` for idea/design option discovery. `source_documents` is optional and must use `{ "document_id": "...", "provider": "..." }` entries when independent documents already exist. The tool creates a structured session record immediately and returns `status: running`; use `agent_debate_status` to monitor phase, provider progress, item summary, and document paths. The moderator engine owns the full lifecycle: individual/source material loading, JSON consensus ledger creation, optional alias clarification, sequential provider turns, strict JSON response validation, generated debate markdown, structured session record, and final synthesis after leader approval or rejection.
101
101
 
102
102
  The JSON consensus ledger is the source of truth. Debate markdown and synthesis markdown are generated human-readable artifacts. The moderator may inspect and report their paths, but must not edit markdown to change item status, provider stance, or consensus state.
103
103
 
@@ -161,9 +161,9 @@ The engine persists the JSON ledger atomically, then regenerates:
161
161
 
162
162
  The moderator does not write the final synthesis file on its own. Three dedicated MCP tools close out the flow:
163
163
 
164
- - `agent_debate_approve`: writes the synthesis markdown, updates ledger document paths, and transitions to `approved`.
164
+ - `agent_debate_approve`: writes the approved synthesis markdown, updates ledger document paths, and transitions to `approved`.
165
165
  - `agent_debate_continue`: loads the persisted ledger/session record, starts additional consensus rounds in the background, and returns `running`.
166
- - `agent_debate_reject`: closes without synthesis. With `spawn_issue = true`, an issue document can be written under `individual/` listing non-accepted items.
166
+ - `agent_debate_reject`: writes the rejected synthesis markdown, updates ledger document paths, and transitions to `rejected`. With `spawn_issue = true`, an additional issue document can be written under `individual/` listing non-accepted items.
167
167
 
168
168
  Idempotency: a second call on a terminal state (`approved`, `rejected`, `leader-timeout`) returns the cached outcome. Calling approval-gate tools on a `running` or `error` session returns `isError: true` with a descriptive state message.
169
169
 
@@ -206,7 +206,7 @@ All paths relative to `workspaceBaseDir` (`.agestra/workspace/` under the projec
206
206
  .agestra/workspace/
207
207
  individual/ — each participant's initial independent review (pre-debate; no votes)
208
208
  debates/ — generated debate markdown + {sessionId}.consensus.json + {sessionId}.session.json
209
- synthesis/ — leader-approved final synthesis document (written only on _approve)
209
+ synthesis/ — leader-finalized synthesis document (written on _approve or _reject)
210
210
  reviews/ — legacy, read-only; no new writes
211
211
  ```
212
212
 
@@ -224,7 +224,7 @@ The moderator's terminal report and the synthesis document are derived from the
224
224
  - **Excluded items** - items where all active participants disagreed.
225
225
  - **Open items** - items that need opinion, have no response, or remain unresolved.
226
226
  - **AI Contribution Summary** - per participant: proposed items, accepted items, revisions, opinions, and non-responses.
227
- - **Footer** - debate markdown path, consensus JSON path, and synthesis path when approved.
227
+ - **Footer** - debate markdown path, consensus JSON path, and synthesis path when finalized.
228
228
 
229
229
  Severity labels are lifted from the proposer's individual review verbatim. The moderator does **not** translate participant-authored item titles, comments, or individual-review bodies.
230
230
 
@@ -503,10 +503,10 @@ If `max_rounds` is hit with open proposals, the moderator surfaces the choice to
503
503
 
504
504
  <Tool_Usage>
505
505
  - `provider_list` — check available providers at the start.
506
- - `agent_debate_structured` — **recommended entry point for Structured Debate**: accepts `mode: "review" | "idea"` and optional `source_documents`, starts or loads individual source material, runs optional alias clarification, JSON consensus turns, ledger persistence, generated debate markdown, and the approval gate in the background. Returns `running`; poll `agent_debate_status`. Does NOT write synthesis.
507
- - `agent_debate_approve` — write synthesis markdown, mark the snapshot `approved`, close the session.
506
+ - `agent_debate_structured` — **recommended entry point for Structured Debate**: accepts `mode: "review" | "idea"` and optional `source_documents`, starts or loads individual source material, runs optional alias clarification, JSON consensus turns, ledger persistence, generated debate markdown, and the approval gate in the background. Returns `running`; poll `agent_debate_status`. Does NOT write synthesis until the leader approves or rejects.
507
+ - `agent_debate_approve` — write approved synthesis markdown, mark the snapshot `approved`, close the session.
508
508
  - `agent_debate_continue` — force additional rounds on a `ready-for-approval` or `escalated` session; returns `running`, then poll status.
509
- - `agent_debate_reject` — close without synthesis; optionally spawn an issue branch listing non-accepted proposals.
509
+ - `agent_debate_reject` — write rejected synthesis markdown, mark the snapshot `rejected`, close the session; optionally spawn an issue branch listing non-accepted proposals.
510
510
  - Legacy manual debate primitives — diagnostic use only; do not use them for review, idea, or design consensus workflows.
511
511
  - `agent_debate_review` — send a document to providers for structured review (Document Review mode).
512
512
  - `ai_chat` — query individual providers for feedback (Independent Aggregation mode).