@joekytc/dsh-swarm 0.2.0 → 0.3.1
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 +177 -139
- package/README.zh-CN.md +173 -125
- package/client/ConfigSection.tsx +96 -5
- package/client/ConfigSelect.tsx +3 -1
- package/client/TaskDrawer.tsx +2 -0
- package/client/config-store.ts +48 -7
- package/client/kanban.css +69 -0
- package/client/timeline-model.ts +2 -0
- package/lib/client.js +172 -14
- package/lib/config.d.ts +20 -1
- package/lib/config.js +15 -0
- package/lib/dispatcher/agent-runner.d.ts +13 -5
- package/lib/dispatcher/agent-runner.js +78 -38
- package/lib/dispatcher/chain-auditor.d.ts +4 -4
- package/lib/dispatcher/chain-auditor.js +10 -8
- package/lib/dispatcher/dispatcher.d.ts +18 -18
- package/lib/dispatcher/dispatcher.js +59 -43
- package/lib/dispatcher/event-waker.d.ts +1 -1
- package/lib/dispatcher/event-waker.js +2 -2
- package/lib/dispatcher/git-credentials.d.ts +2 -2
- package/lib/dispatcher/git-credentials.js +2 -2
- package/lib/dispatcher/model-candidates.d.ts +1 -1
- package/lib/dispatcher/model-candidates.js +1 -1
- package/lib/dispatcher/session-events.d.ts +1 -1
- package/lib/dispatcher/session-events.js +1 -1
- package/lib/dispatcher/target-repo.d.ts +2 -2
- package/lib/dispatcher/target-repo.js +3 -3
- package/lib/dispatcher/v-orchestrator.d.ts +8 -8
- package/lib/dispatcher/v-orchestrator.js +41 -41
- package/lib/dispatcher/watchdog.d.ts +1 -1
- package/lib/dispatcher/watchdog.js +2 -2
- package/lib/domain/config-override.d.ts +14 -0
- package/lib/domain/config-override.js +38 -1
- package/lib/domain/delivery-contract.d.ts +2 -2
- package/lib/domain/delivery-contract.js +5 -5
- package/lib/domain/delivery-evidence.d.ts +1 -1
- package/lib/domain/delivery-evidence.js +1 -1
- package/lib/domain/event-store.js +1 -1
- package/lib/domain/im-message.d.ts +15 -0
- package/lib/domain/im-message.js +149 -0
- package/lib/domain/kanban-service.d.ts +13 -10
- package/lib/domain/kanban-service.js +36 -28
- package/lib/domain/memory.d.ts +6 -1
- package/lib/domain/memory.js +25 -8
- package/lib/domain/ocr-review.d.ts +47 -0
- package/lib/domain/ocr-review.js +105 -0
- package/lib/domain/permissions.js +5 -5
- package/lib/domain/projection.js +6 -6
- package/lib/domain/state-machine.js +1 -1
- package/lib/domain/task-parents.js +1 -1
- package/lib/domain/types.d.ts +4 -4
- package/lib/index.js +14 -9
- package/lib/roles/clean-fs-tools.js +3 -4
- package/lib/roles/preset-installer.js +3 -3
- package/lib/roles/skill-installer.js +1 -1
- package/lib/roles/toolsets.d.ts +60 -16
- package/lib/roles/toolsets.js +265 -47
- package/lib/roles/wiki-worker.js +3 -3
- package/lib/routes/kanban-http.d.ts +25 -2
- package/lib/routes/kanban-http.js +171 -11
- package/lib/routes/kanban-sse.d.ts +1 -1
- package/lib/routes/kanban-sse.js +1 -1
- package/lib/routes/planning-driver.d.ts +4 -2
- package/lib/routes/planning-driver.js +7 -3
- package/lib/routes/prefix-router.d.ts +5 -3
- package/lib/routes/prefix-router.js +14 -5
- package/lib/services/config-provider.d.ts +0 -4
- package/lib/services/config-provider.js +7 -9
- package/lib/services/im-delivery.d.ts +109 -0
- package/lib/services/im-delivery.js +301 -0
- package/lib/services/kanban-provider.d.ts +1 -1
- package/lib/services/kanban-provider.js +2 -2
- package/lib/services/ocr-cli.d.ts +35 -0
- package/lib/services/ocr-cli.js +128 -0
- package/lib/tools/kanban-tools.d.ts +2 -2
- package/lib/tools/kanban-tools.js +1 -1
- package/lib/tools/main-session-tools.d.ts +7 -3
- package/lib/tools/main-session-tools.js +120 -21
- package/lib/tools/ocr-review-tools.d.ts +11 -0
- package/lib/tools/ocr-review-tools.js +63 -0
- package/lib/tools/planning-tools.d.ts +5 -2
- package/lib/tools/planning-tools.js +19 -11
- package/lib/tools/wiki-tools.js +2 -2
- package/lib/wiki/kb-linkage.d.ts +1 -1
- package/lib/wiki/local-kb-client.js +3 -3
- package/lib/wiki/local-kb.d.ts +1 -1
- package/lib/wiki/local-kb.js +2 -2
- package/lib/wiki/page-path.d.ts +1 -1
- package/lib/wiki/page-path.js +6 -3
- package/lib/wiki/wiki-vault-client.d.ts +1 -1
- package/lib/wiki/wiki-vault-client.js +1 -1
- package/package.json +1 -1
- package/personas/kanban-d/agent.cordis.yml +33 -12
- package/personas/kanban-dt/agent.cordis.yml +23 -5
- package/personas/kanban-p/agent.cordis.yml +3 -3
- package/personas/kanban-pt/agent.cordis.yml +1 -1
- package/personas/kanban-v/agent.cordis.yml +3 -3
- package/personas/kanban-w/agent.cordis.yml +21 -11
- package/personas/persona-d.md +8 -6
- package/personas/persona-dt.md +12 -4
- package/personas/persona-p.md +1 -1
- package/personas/persona-v.md +2 -2
- package/personas/persona-w.md +2 -2
- package/personas/swarm/agent.cordis.yml +44 -0
- package/personas/swarm/preset.yml +5 -0
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Say one requirement, reply one confirmation — six specialist agents take it from planning to verified delivery. No commands to memorize.**
|
|
8
8
|
|
|
9
|
-
An orchestrator (V) decomposes an approved spec into a strictly ordered phase chain (`p → (pt?) → w2 → d → dt → w3 → summary`); six single-purpose roles (V / P / W / D / PT / DT) run each phase with isolated, permission-gated tool faces; every handoff is machine-verified against an evidence contract; failures recover through idempotent retry and human-gated reviews; and a live Workflow kanban tab streams all state to the browser via SSE. Design inspired by the [Hermes Agent kanban](https://github.com/NousResearch/hermes-agent).
|
|
9
|
+
dsh-swarm is a DSH plugin that turns one requirement into a strict, evidence-verified delivery pipeline. An orchestrator (V) decomposes an approved spec into a strictly ordered phase chain (`p → (pt?) → w2 → d → dt → w3 → summary`); six single-purpose roles (V / P / W / D / PT / DT) run each phase with isolated, permission-gated tool faces; every handoff is machine-verified against an evidence contract; failures recover through idempotent retry and human-gated reviews; and a live Workflow kanban tab streams all state to the browser via SSE. Design inspired by the [Hermes Agent kanban](https://github.com/NousResearch/hermes-agent).
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|

|
|
@@ -14,125 +14,121 @@ An orchestrator (V) decomposes an approved spec into a strictly ordered phase ch
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Swarm mode (recommended)
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Swarm mode turns your main session into a **team lead**: **you state the requirement, it clarifies, plans, confirms, delegates and follows through** — entirely in natural language, no commands to remember.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
- **No commands to memorize** — just state your requirement; no `/plan:` or `/openspec:` prefixes needed.
|
|
22
|
+
- **Automatic intent recognition** — development requests → clarify/plan and build a chain; lessons & retrospectives → persist to memory; group notifications → deliver to WeCom; Q&A / chit-chat → answered directly.
|
|
23
|
+
- **Free delivery** — `/sms <intent>` (e.g. "post current progress to the group"): facts are grounded via kanban lookup, then the body is composed per intent and delivered; `-s` or wording like "private chat" targets the DM. Group and private-chat targets must each be exactly one (0 or 2+ targets error out; clean up in dsh-im settings or set `imDelivery.dmTargetId`).
|
|
24
|
+
- **Confirmation gate against accidental chains** — after the checklist is saved, a chain is only built once you reply with an explicit affirmative (`确认` / `开干` / `开跑` / `开始` / `go`, etc.); vague replies, topic switches, or edit-only feedback count as *not confirmed*.
|
|
25
|
+
- **The lead is read-only** — the main session cannot write/edit repo sources, nor run git mutations (push/commit/checkout…); writing code is done by the executor (D) in an isolated workspace by design.
|
|
26
|
+
- **Progress is always actually queried** — ask "how is it going?" anytime and the lead reports from real kanban lookups, never fabricated.
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
### Why it's designed this way
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Roles & the execution pipeline
|
|
30
|
+
Coordinating several agents on one task typically fails in three ways:
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|---|---|---|---|
|
|
35
|
-
| **V** | Orchestrator | Drives the phase machine, creates one card per phase, posts `[blocked-review]` guidance on stalls. Never executes. | `kanban_create` + task tools + spec view |
|
|
36
|
-
| **P** | Planner | Reads spec + repo facts (incl. read-only self-checks), writes an OpenSpec implementation plan, opts into PT via `pt_decision.needed`. Never executes. | Task tools + spec view, read-only (writes only `openspec/changes/`) |
|
|
37
|
-
| **PT** | Plan reviewer | Read-only review of P's plan (requirements alignment, completeness, logic). Outputs verdict + issues. | Task tools + spec view, **read-only ToolGuard** |
|
|
38
|
-
| **W** | Knowledge officer | W2/W3 KB sync (`w:kb`). Never touches code/git. | Task tools + `wiki_search/read/write` (remote) / `skill`→llm-wiki (local) + read-only spec view |
|
|
39
|
-
| **D** | Executor | The *only* role that writes code: worktree → implement → verify → `[AI-GEN]` commit → push feature branch (merging into the spec-declared target branch is done by the system only after DT passes). | Task tools + wiki read + bash/fs/run_code (full dev) + subagent (spawn/fork/list-agents) + goal |
|
|
40
|
-
| **DT** | Implementation reviewer | Empirically verifies D's work (test/build/typecheck/diff/git + open-code-review), writes review page to KB. Read-only against the repo. | Task tools + wiki read/write (review namespace) + bash/fs/run_code, **read-only ToolGuard** |
|
|
32
|
+
- **Role drift** — the "planner" starts writing code, the "executor" reviews its own work, and nobody owns the outcome.
|
|
33
|
+
- **Unverifiable handoffs** — an agent claims "done" with no reproducible evidence, and the next agent builds on sand.
|
|
34
|
+
- **Silent deadlocks** — an agent stops without finishing and the pipeline hangs, or bad code is merged before anyone reviewed it.
|
|
41
35
|
|
|
42
|
-
|
|
36
|
+
dsh-swarm encodes a *contract* against all three: one machine-enforced responsibility per role;
|
|
37
|
+
every handoff must carry structured evidence or the phase will not close; every stall or review
|
|
38
|
+
failure lands in a visible, recoverable state — with you (the human) as the final trust anchor.
|
|
39
|
+
It is built correctness-first: deterministic state machines, append-only event sourcing, idempotent
|
|
40
|
+
schedulers, and a red-team test suite that replays the event log and rejects any illegal transition
|
|
41
|
+
(mechanics in [Advanced](#advanced--developers)).
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
p ──> (pt?) ──> w2 ──> d ──> dt ──> w3 ──> summary
|
|
46
|
-
| | | | | | |
|
|
47
|
-
plan plan plan impl impl KB wrap-up
|
|
48
|
-
(P) review sync (D) review sync (system)
|
|
49
|
-
(only when P (W2) (fixed) (W3)
|
|
50
|
-
opts in)
|
|
51
|
-
```
|
|
43
|
+
### Two modes
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
| Mode | How you use it | Notes |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| **Swarm mode** (recommended) | Just say the requirement in natural language | No commands to memorize, intent auto-recognized, runs on confirmation |
|
|
48
|
+
| **Command mode** (compatible) | `/plan: <requirement>` → clarify → `/openspec: confirm` | Kept for compatibility, functionally equivalent; may be removed in the future — new users should use swarm mode |
|
|
57
49
|
|
|
58
50
|
---
|
|
59
51
|
|
|
60
|
-
##
|
|
61
|
-
|
|
62
|
-
### Prerequisites
|
|
52
|
+
## Quickstart
|
|
63
53
|
|
|
64
|
-
|
|
65
|
-
- Node.js ≥ 22.19 and npm (match DSH's runtime requirement).
|
|
66
|
-
- Peer dependencies shipped with DSH: `@deepseek-ai/dsh-tool-bash`, `@deepseek-ai/dsh-tool-fs`, `@deepseek-ai/dsh-tool-fs-search`, `@deepseek-ai/schemastery`.
|
|
67
|
-
- An optional wiki-vault HTTP service for W/P/D KB reads and W2/W3 syncs (see [Configuration](#configuration)).
|
|
54
|
+
### 1. Install
|
|
68
55
|
|
|
69
|
-
|
|
56
|
+
Prerequisites: a working DSH runtime (`@deepseek-ai/*`), Node.js ≥ 22.19 and npm. Optional: a wiki-vault HTTP service (KB features, see [Configuration](#configuration)).
|
|
70
57
|
|
|
71
58
|
```bash
|
|
72
59
|
npm install
|
|
73
|
-
npm run build # tsc -p tsconfig.build.json
|
|
60
|
+
npm run build # tsc -p tsconfig.build.json + client bundle (lib/client.js)
|
|
61
|
+
dsh plugin --profile web add @joekytc/dsh-swarm
|
|
74
62
|
```
|
|
75
63
|
|
|
76
|
-
|
|
64
|
+
> From GitHub source: `dsh plugin --profile web add github:joekytc/dsh-swarm`
|
|
77
65
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
### 2. Switch your main-session preset
|
|
67
|
+
|
|
68
|
+
Switch the main session's agent preset to **Swarm (蜂群模式)** — it is installed at `$DSH_HOME/.agent-presets/swarm` once the plugin is installed.
|
|
69
|
+
|
|
70
|
+
### 3. Say → confirm → watch progress
|
|
71
|
+
|
|
72
|
+
Example conversation:
|
|
81
73
|
|
|
82
|
-
# From the local checkout (development)
|
|
83
|
-
dsh plugin --profile <name> add ./dsh-swarm
|
|
84
74
|
```
|
|
75
|
+
You: Add a role-management page to the admin project with CRUD and permission checkboxes
|
|
76
|
+
|
|
77
|
+
Lead: Let me confirm a few things first —
|
|
78
|
+
· Which role fields do you need (name/description/status/…)?
|
|
79
|
+
· Permission source: the existing menu tree, or custom?
|
|
80
|
+
· Any acceptance requirements, e.g. "deleting a role must not affect linked users"?
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
>
|
|
88
|
-
> `storageDir` must be set with the **unquoted** `!!js dshHomePath("storages/kanban")`
|
|
89
|
-
> form. Quoting it degrades the path into a literal string (a known footgun).
|
|
82
|
+
You: Fields are name and description, permissions from the existing menu tree, acceptance via TDD
|
|
90
83
|
|
|
91
|
-
|
|
84
|
+
Lead: Checklist saved (six spec sections + repo facts). Reply "confirm" to launch —
|
|
85
|
+
I'll spin up the p → (pt) → w2 → d → dt → w3 pipeline.
|
|
92
86
|
|
|
93
|
-
|
|
87
|
+
You: confirm
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
Lead: Chain created (ch_…), live progress on the kanban tab (Conversation → Trajectory → Kanban).
|
|
90
|
+
First phase: Planning (P)…
|
|
91
|
+
```
|
|
98
92
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
sections (`problem / solution / user_stories / impl_decisions / testing /
|
|
103
|
-
out_of_scope`) plus a repo manifest. `planning_checklist_save` schema-validates
|
|
104
|
-
the checklist — an invalid or incomplete one blocks approval.
|
|
93
|
+
- **Kanban**: the third tab of the conversation center (Conversation → Trajectory → Kanban). Click a card for Overview / Trajectory / Handoff / Spec / Comments.
|
|
94
|
+
- **Completion**: when a chain completes, the system audits the workspace and (for D chains) automatically merges the feature branch into the spec-declared target branch; if an audit warning fires, confirm ownership in the GUI first.
|
|
95
|
+
- **Progress**: just ask "how is it going?" — the lead reports from real kanban lookups and relays blocking reasons faithfully.
|
|
105
96
|
|
|
106
|
-
|
|
97
|
+
---
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
/openspec: 确认执行
|
|
110
|
-
```
|
|
99
|
+
## What it does for you
|
|
111
100
|
|
|
112
|
-
|
|
113
|
-
(repo path) and `kb` (checklist page) attachments are mounted, the spec is
|
|
114
|
-
approved, the chain transitions to `executing`, and the dispatcher wakes the V
|
|
115
|
-
orchestrator, which builds the pipeline one phase at a time.
|
|
101
|
+
Six roles, one job each, machine-enforced boundaries — no role creep:
|
|
116
102
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
103
|
+
| Role | One-line responsibility | What it never does |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| **V** Orchestrator | Creates phase cards, drives the pipeline, gives guidance on stalls | Never executes |
|
|
106
|
+
| **P** Planner | Reads the spec + repo facts, writes the implementation plan | Never writes code |
|
|
107
|
+
| **PT** Plan reviewer | Read-only review of P's plan (on demand) | Never changes anything |
|
|
108
|
+
| **W** Knowledge officer | Syncs the KB in planning/completion phases | Never touches code/git |
|
|
109
|
+
| **D** Executor | The only role that writes code: implement → verify → commit → push feature branch | Never merges into the target branch itself |
|
|
110
|
+
| **DT** Implementation reviewer | Empirically verifies D's delivery (tests/build/typecheck/diff) | Read-only against the repo |
|
|
120
111
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
The pipeline (strictly serial within a chain, parallel across chains):
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
p ──> (pt?) ──> w2 ──> d ──> dt ──> w3 ──> summary
|
|
116
|
+
plan plan rev. KB impl impl rev. KB wrap-up
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- `pt` appears only when P decides a plan review is needed; `d` is **always** followed by an implementation review (`dt`).
|
|
120
|
+
- Chain completion is decided by a mechanical rule (W3 done + D done with delivery evidence + no open tasks), not by an agent's self-assessment.
|
|
124
121
|
|
|
125
122
|
---
|
|
126
123
|
|
|
127
124
|
## Configuration
|
|
128
125
|
|
|
129
|
-
All keys are optional;
|
|
126
|
+
All keys are optional; schema lives in `src/config.ts`. **Most users only need the first three** — keep the rest at their defaults.
|
|
130
127
|
|
|
131
128
|
| Key | Default | Description |
|
|
132
129
|
|---|---|---|
|
|
133
|
-
| `storageDir` | `$DSH_HOME/storages/kanban` | Event log (`events.jsonl`), orchestration state, per-task workspaces, `dispatcher.log` |
|
|
130
|
+
| `storageDir` | `$DSH_HOME/storages/kanban` | Event log (`events.jsonl`), orchestration state, per-task workspaces, `dispatcher.log`. Value must use the unquoted `!!js dshHomePath("storages/kanban")` form — quoting degrades it into a literal string |
|
|
134
131
|
| `wikiVault.baseUrl` | `''` (empty) | wiki-vault HTTP service for KB reads/writes — required for KB features; set to your own server |
|
|
135
|
-
| `wikiVault.pagePrefix` | `projects/` | Whitelist root prefix; actual page paths are projects/<repoSlug>/… (repoSlug derived from the chain workspaceDir) |
|
|
136
132
|
| `roles.models.<role>` | `{}` | Per-role model: `{ provider, model, reasoningEffort?, fallbacks?[] }` |
|
|
137
133
|
| `roles.models.<role>.reasoningEffort` | `high` | Default reasoning effort for all roles |
|
|
138
134
|
| `roles.models.<role>.fallbacks` | `[]` | Silent fallback candidates (audited via `[model-fallback]` comment) |
|
|
@@ -141,8 +137,8 @@ All keys are optional; defaults shown. Schema lives in `src/config.ts`.
|
|
|
141
137
|
| `dispatcher.heartbeatIntervalSeconds` | `300` | Watchdog heartbeat period |
|
|
142
138
|
| `dispatcher.maxProtocolViolations` | `2` | Protocol-violation guardrail: after this many consecutive violations the next one is final (`gave_up`) |
|
|
143
139
|
| `dispatcher.maxReworksPerRole` | `{ pt: 2, dt: 3 }` | Max review rework rounds before `review/gave-up` + `[review-final]` |
|
|
144
|
-
| `prefixRoutes.plan` | `/plan:` |
|
|
145
|
-
| `prefixRoutes.openspec` | `/openspec:` |
|
|
140
|
+
| `prefixRoutes.plan` | `/plan:` | Command-mode planning prefix |
|
|
141
|
+
| `prefixRoutes.openspec` | `/openspec:` | Command-mode approve-and-execute prefix |
|
|
146
142
|
| `ui.enabled` | `true` | Enable the kanban web tab |
|
|
147
143
|
| `ui.contentMinWidth` | `715` | Minimum kanban content width (px) |
|
|
148
144
|
| `ui.contentMaxWidth` | `780` | Maximum kanban content width (px) |
|
|
@@ -150,9 +146,69 @@ All keys are optional; defaults shown. Schema lives in `src/config.ts`.
|
|
|
150
146
|
|
|
151
147
|
---
|
|
152
148
|
|
|
153
|
-
##
|
|
149
|
+
## Review engine (ocr)
|
|
150
|
+
|
|
151
|
+
Implementation reviews (the in-chain DT phase and standalone reviews) are powered by
|
|
152
|
+
[open-code-review](https://open-codereview.ai) (ocr), with two modes switchable in the
|
|
153
|
+
web config panel under "Swarm config → Review engine (ocr)":
|
|
154
|
+
|
|
155
|
+
| Mode | How it works | Notes |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| **Delegate** (default) | ocr only outputs the review scope and rules; DT reviews each file with its own model | Zero API keys, works out of the box |
|
|
158
|
+
| **Managed** | ocr runs the full review with your chosen provider/model and returns normalized findings in one shot | For large change sets; delegate mode hints at switching past 50 files (a hint only, never auto-switched) |
|
|
159
|
+
|
|
160
|
+
### Install
|
|
161
|
+
|
|
162
|
+
- When ocr is missing, the config panel shows a red banner — click "Install ocr" for a one-click global install (async, cancellable);
|
|
163
|
+
- or run `npm install -g @alibaba-group/open-code-review` in a terminal, then verify with `ocr --version`.
|
|
154
164
|
|
|
155
|
-
###
|
|
165
|
+
### Standalone review (no chain needed)
|
|
166
|
+
|
|
167
|
+
1. Switch the session to "Delivery Reviewer (DT)" at the top of the dsh web UI and just talk;
|
|
168
|
+
2. State the review target: a local directory / branch range (from…to) / a single commit / uncommitted workspace diff / a public repo URL (auto-cloned into a temp dir, discarded afterwards);
|
|
169
|
+
3. The report is first fully output to the conversation;
|
|
170
|
+
4. Only after you confirm is it written to the wiki at `projects/<repo>/reviews/<topic>-<date>/`. Read-only throughout — reviewed code is never modified.
|
|
171
|
+
|
|
172
|
+
### Configuration notes
|
|
173
|
+
|
|
174
|
+
- Mode, provider and model are all chosen on the "Review engine (ocr)" card; the provider/model dropdowns share the same catalog as the model chain;
|
|
175
|
+
- After picking, click "Apply to ocr" — the system writes the wiring into ocr's custom config (`dsh-managed`); the API key is resolved from the dsh model config and written into ocr, never shown in plain text in the panel; if resolution fails it degrades gracefully and points you to a manual `ocr config provider` in a terminal;
|
|
176
|
+
- When managed is not ready, reviews silently fall back to delegate mode — nothing is blocked.
|
|
177
|
+
|
|
178
|
+
Official docs: [Installation](https://open-codereview.ai/docs/installation) · [Model configuration](https://open-codereview.ai/docs/configuration) · [Delegate mode](https://open-codereview.ai/docs/delegate)
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Trust & guardrails (user's view)
|
|
183
|
+
|
|
184
|
+
- **Read-only hard gate for the lead** — in swarm mode, main-session writes to sources and git mutations are blocked by a system gate; if blocked, just let the lead explain — execution is done by the D role.
|
|
185
|
+
- **Confirmation gate** — no chain is ever built without your explicit confirmation.
|
|
186
|
+
- **TDD hard gate** — implementations must ship with tests (or an explained skip); reviews machine-verify "tests really ran, and were written first".
|
|
187
|
+
- **Human trust anchors** — spec approval, unblock, audit confirmation and chain deletion are human-only; neither the main session nor role agents can create chains or approve specs.
|
|
188
|
+
- Full mechanics (permission matrix, delivery contract, review chain, rework, failure recovery) live under [Advanced / Developers](#advanced--developers).
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Advanced / Developers
|
|
193
|
+
|
|
194
|
+
> Mechanics and implementation details below — regular users can skip.
|
|
195
|
+
|
|
196
|
+
### Roles & the execution pipeline (full table)
|
|
197
|
+
|
|
198
|
+
Six roles are dispatched by the scheduler as one-shot agent sessions (deterministic session id `kbn-<taskId>`, resumed on retry/rework via `resumeSessionId`). Each role-agent session is bound to exactly one task (`boundTaskId`) and gets a trimmed tool face. V is the exception: a chain-scoped orchestrator session (`kbn-v-<chainId>`) with no `boundTaskId`.
|
|
199
|
+
|
|
200
|
+
| Role | Alias | Responsibility | Tool face (highlights) |
|
|
201
|
+
|---|---|---|---|
|
|
202
|
+
| **V** | Orchestrator | Drives the phase machine, creates one card per phase, posts `[blocked-review]` guidance on stalls. Never executes. | `kanban_create` + task tools + spec view |
|
|
203
|
+
| **P** | Planner | Reads spec + repo facts (incl. read-only self-checks), writes an OpenSpec implementation plan, opts into PT via `pt_decision.needed`. Never executes. | Task tools + spec view, read-only (writes only `openspec/changes/`) |
|
|
204
|
+
| **PT** | Plan reviewer | Read-only review of P's plan (requirements alignment, completeness, logic). Outputs verdict + issues. | Task tools + spec view, **read-only ToolGuard** |
|
|
205
|
+
| **W** | Knowledge officer | W2/W3 KB sync (`w:kb`). Never touches code/git. | Task tools + `wiki_search/read/write` (remote) / `skill`→llm-wiki (local) + read-only spec view |
|
|
206
|
+
| **D** | Executor | The *only* role that writes code: worktree → implement → verify → `[AI-GEN]` commit → push feature branch (merging into the spec-declared target branch is done by the system only after DT passes). | Task tools + wiki read + bash/fs/run_code (full dev) + subagent (spawn/fork/list-agents) + goal |
|
|
207
|
+
| **DT** | Implementation reviewer | Empirically verifies D's work (test/build/typecheck/diff/git + open-code-review), writes review page to KB. Read-only against the repo. | Task tools + wiki read/write (review namespace) + bash/fs/run_code, **read-only ToolGuard** |
|
|
208
|
+
|
|
209
|
+
### Guardrails in detail
|
|
210
|
+
|
|
211
|
+
#### Permission matrix
|
|
156
212
|
|
|
157
213
|
`can(action, actor, task, { boundTaskId })` in `src/domain/permissions.ts`.
|
|
158
214
|
"Bound" means the actor is the role agent session spawned for *that exact task*
|
|
@@ -184,7 +240,7 @@ Key guarantees (two):
|
|
|
184
240
|
- **The main session cannot execute.** It only gets `kanban_show`/`kanban_list`/
|
|
185
241
|
`kanban_comment` + `spec_card_view` + `kanban_route` — never
|
|
186
242
|
`kanban_create`/`kanban_complete`/`kanban_block`. Chains/specs are created only
|
|
187
|
-
via `/plan:`+`/openspec:`; the GUI observes and mutates task state but never
|
|
243
|
+
via swarm-mode intents or `/plan:`+`/openspec:`; the GUI observes and mutates task state but never
|
|
188
244
|
creates chains or tasks — "who decided to run what" stays explicit and auditable.
|
|
189
245
|
- **Session binding prevents cross-task escalation** (a W agent bound to task A
|
|
190
246
|
cannot complete/block task B even though both are W tasks); DT writes are
|
|
@@ -192,7 +248,7 @@ Key guarantees (two):
|
|
|
192
248
|
the matrix; and no role agent can approve specs, unblock, or confirm audits —
|
|
193
249
|
those are human trust anchors; `system` handles only mechanical bookkeeping.
|
|
194
250
|
|
|
195
|
-
|
|
251
|
+
#### Delivery contract (upstream owes downstream)
|
|
196
252
|
|
|
197
253
|
Each phase's handoff must carry the keys its downstream actually reads
|
|
198
254
|
(`src/domain/delivery-contract.ts`). Missing keys block the current role's card
|
|
@@ -206,7 +262,7 @@ parent):
|
|
|
206
262
|
| D (`d:execute`) | `changed_files` + (`commit_hash` or `push`) — `hasDeliveryEvidence`; `branch` (feature branch) is expected for the merge gate, not a hard-complete blocker; `tdd` (`test_files` or `skipped.reason`, XOR) |
|
|
207
263
|
| PT / DT | `review_evidence` (schema-valid) — `validateReviewEvidence` |
|
|
208
264
|
|
|
209
|
-
|
|
265
|
+
#### TDD hard gate (evidence threshold)
|
|
210
266
|
|
|
211
267
|
D completes only with `tdd` — `test_files` (with `test_first`) or `skipped.reason`
|
|
212
268
|
(XOR, `delivery-evidence.ts`). DT's `review_evidence` must carry `tdd`; on a
|
|
@@ -214,31 +270,32 @@ D completes only with `tdd` — `test_files` (with `test_first`) or `skipped.rea
|
|
|
214
270
|
must hold (`review-evidence.ts`). This makes "tests actually ran, and were written
|
|
215
271
|
first" a machine-checked property rather than a claim.
|
|
216
272
|
|
|
217
|
-
|
|
273
|
+
#### Phase-0 planning checklist
|
|
218
274
|
|
|
219
|
-
|
|
275
|
+
Planning runs a read-only planning session (`grill-me` → `planning_prefetch` →
|
|
220
276
|
`planning_checklist_save`, `planning-driver.ts`). The checklist carries a structured
|
|
221
277
|
manifest (repo facts + file baseline, `prefetch-manifest.ts`); an invalid manifest
|
|
222
|
-
blocks the save, and
|
|
278
|
+
blocks the save, and chain creation mounts the checklist as the `file-prefetch` +
|
|
223
279
|
`kb` attachments on the spec card (`prefix-router.ts`).
|
|
224
280
|
|
|
225
|
-
|
|
281
|
+
#### Review quality chain
|
|
226
282
|
|
|
227
283
|
- After **P** completes, **PT** is created only when P's handoff delivers
|
|
228
284
|
`pt_decision.needed = true`; the orchestrator never overrides the decision
|
|
229
285
|
(V only creates the card).
|
|
230
286
|
- After **D** completes, a **DT** card is *always* created.
|
|
231
|
-
- **PT/DT
|
|
287
|
+
- **PT/DT are read-only**: a ToolGuard mechanically denies writes to the repo
|
|
232
288
|
sources, git mutations, and (for DT) wiki writes outside the review namespace.
|
|
233
|
-
- **DT** review engine: `open-code-review` (ocr,
|
|
234
|
-
|
|
235
|
-
|
|
289
|
+
- **DT** review engine: `open-code-review` (ocr, dual mode: delegate/managed, see
|
|
290
|
+
[Review engine (ocr)](#review-engine-ocr)); a pre-start probe blocks
|
|
291
|
+
`review-tool-unavailable` when ocr is missing (reason notes GUI install),
|
|
292
|
+
without burning retries.
|
|
236
293
|
- `review_evidence` must pass `validateReviewEvidence` or the review card cannot
|
|
237
294
|
complete: PT needs verdict + issues + plan ref; DT additionally needs
|
|
238
295
|
test (exit 0 on pass), build/typecheck, lint, non-empty diff, git,
|
|
239
296
|
ocr/fallback conclusion, and `tdd`.
|
|
240
297
|
|
|
241
|
-
|
|
298
|
+
#### Rework (review failure)
|
|
242
299
|
|
|
243
300
|
A failed review never mutates a `done` card. Instead the system records
|
|
244
301
|
`review/failed`, creates a **rework task** (`[返工] ...`) that inherits the source's
|
|
@@ -248,7 +305,7 @@ When `reviewAttempt` reaches `maxReworksPerRole` (PT 2 / DT 3), the system recor
|
|
|
248
305
|
`review/gave-up` and posts a `[review-final]` evidence-chain comment; the pipeline
|
|
249
306
|
stalls at the review stage for human intervention.
|
|
250
307
|
|
|
251
|
-
|
|
308
|
+
#### Failure recovery
|
|
252
309
|
|
|
253
310
|
Two orthogonal failure paths, both human-recoverable:
|
|
254
311
|
|
|
@@ -268,7 +325,7 @@ Two orthogonal failure paths, both human-recoverable:
|
|
|
268
325
|
it blocks `model-unavailable` for the human. A single hanging V wake cannot
|
|
269
326
|
stall the scheduler — every dispatch is wrapped in a timeout.
|
|
270
327
|
|
|
271
|
-
|
|
328
|
+
#### Chain completion: audit gate + merge gate
|
|
272
329
|
|
|
273
330
|
When the mechanical chain-complete rule fires, two gates run in the
|
|
274
331
|
`chain/completed` hook:
|
|
@@ -288,9 +345,7 @@ When the mechanical chain-complete rule fires, two gates run in the
|
|
|
288
345
|
Failures never throw — a bad merge is never performed, which is the safe
|
|
289
346
|
direction; humans can repair afterwards.
|
|
290
347
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
## Event sourcing & domain model
|
|
348
|
+
### Event sourcing & domain model
|
|
294
349
|
|
|
295
350
|
Every state change is appended to `<storageDir>/events.jsonl`, one JSON event per
|
|
296
351
|
line. The `seq` is assigned by the store (re-read from the file tail on every
|
|
@@ -319,9 +374,7 @@ The service emits events through a serialized queue (append-then-publish), and
|
|
|
319
374
|
subscribers (SSE) receive every event exactly once in order. UI and dispatcher both
|
|
320
375
|
consume the same persisted events — there is no secondary source of truth.
|
|
321
376
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
## Web client (Workflow kanban tab)
|
|
377
|
+
### Web client (Workflow kanban tab)
|
|
325
378
|
|
|
326
379
|
A browser-half React tab registered as the third `conversation.view` slot
|
|
327
380
|
(`id=kanban`, `order=20`, after Conversation and Trajectory). It registers **no
|
|
@@ -349,9 +402,7 @@ shell-level overlays, sidebars, or detail panes**.
|
|
|
349
402
|
`window.__ModuleLoader__.load()` format (identical convention to `dsh-client-*`).
|
|
350
403
|
Adding dsh-swarm to a web profile auto-embeds it into `__DSH_BOOT__`.
|
|
351
404
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
## Architecture
|
|
405
|
+
### Architecture
|
|
355
406
|
|
|
356
407
|
Five layers, with the domain layer kept **free of any DSH dependency** so it can be
|
|
357
408
|
fully unit-tested and replayed in isolation.
|
|
@@ -375,7 +426,7 @@ flowchart TB
|
|
|
375
426
|
|
|
376
427
|
subgraph Integration ["integration (cordis)"]
|
|
377
428
|
TOOLS["tools: kanban_* / spec_card_* / wiki_* / prefetch_* / kanban_route"]
|
|
378
|
-
ROUTES["prefix-router + planning-driver (/plan: /openspec:)"]
|
|
429
|
+
ROUTES["prefix-router + planning-driver (/plan: /openspec: + intent)"]
|
|
379
430
|
HTTP["kanban-http + kanban-sse (/kanban/board, /kanban/events, /kanban/action)"]
|
|
380
431
|
end
|
|
381
432
|
|
|
@@ -389,8 +440,8 @@ flowchart TB
|
|
|
389
440
|
end
|
|
390
441
|
|
|
391
442
|
subgraph Roles ["roles/ + personas/"]
|
|
392
|
-
PRESETS["preset-installer (6
|
|
393
|
-
TOOLSETS["toolsets (per-role tool faces + write guards)"]
|
|
443
|
+
PRESETS["preset-installer (6 role presets + swarm)"]
|
|
444
|
+
TOOLSETS["toolsets (per-role tool faces + write guards + swarm hard gate)"]
|
|
394
445
|
WK["wiki-worker (W prefetch worker)"]
|
|
395
446
|
end
|
|
396
447
|
|
|
@@ -415,7 +466,7 @@ flowchart TB
|
|
|
415
466
|
EC --> KS
|
|
416
467
|
```
|
|
417
468
|
|
|
418
|
-
|
|
469
|
+
#### Layer responsibilities
|
|
419
470
|
|
|
420
471
|
- **Domain** (`src/domain/`) — the entire business model as pure TypeScript:
|
|
421
472
|
event store, state machines, projection, permission matrix, delivery/review/
|
|
@@ -428,18 +479,17 @@ flowchart TB
|
|
|
428
479
|
agent runner (persona preset mounting, model candidate chain, ToolGuard
|
|
429
480
|
installation), watchdog, chain auditor, and merge gate.
|
|
430
481
|
- **Roles** (`src/roles/`, `personas/`) — trimmed agent presets installed into
|
|
431
|
-
`$DSH_HOME/.agent-presets
|
|
482
|
+
`$DSH_HOME/.agent-presets/` (including the swarm preset), per-role tool
|
|
483
|
+
assembly, write-guard logic, and the swarm-session hard gate.
|
|
432
484
|
- **Wiki** (`src/wiki/`) — thin HTTP client for wiki-vault.
|
|
433
485
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
## Development
|
|
486
|
+
### Development
|
|
437
487
|
|
|
438
488
|
Quality gates (see `AGENTS.md`):
|
|
439
489
|
|
|
440
490
|
```bash
|
|
441
491
|
npm run typecheck # tsc -p tsconfig.json --noEmit (0 errors)
|
|
442
|
-
npm test # npx vitest run (
|
|
492
|
+
npm test # npx vitest run (all green)
|
|
443
493
|
npm run build # tsc -p tsconfig.build.json + build:client (lib/client.js)
|
|
444
494
|
```
|
|
445
495
|
|
|
@@ -453,12 +503,11 @@ python tests/e2e/gui-check.py --url http://127.0.0.1:3080/
|
|
|
453
503
|
> Deploying to a running DSH instance requires a plugin reload/restart; building
|
|
454
504
|
> alone does not hot-reload the running plugin.
|
|
455
505
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
## Roadmap & known limitations
|
|
506
|
+
### Implemented & known limitations
|
|
459
507
|
|
|
460
|
-
|
|
508
|
+
#### Implemented (v0.1.0)
|
|
461
509
|
|
|
510
|
+
- [x] **Swarm mode**: natural-language intent recognition (plan/openspec/learning/send) + confirmation gate + read-only main-session hard gate
|
|
462
511
|
- [x] Event-sourced domain + deterministic state machines (red-team replay)
|
|
463
512
|
- [x] 6-role phase pipeline with trimmed presets and session-bound permissions
|
|
464
513
|
- [x] Delivery contract + review evidence gates + rework lifecycle
|
|
@@ -471,32 +520,21 @@ python tests/e2e/gui-check.py --url http://127.0.0.1:3080/
|
|
|
471
520
|
- [x] Model candidate chain with silent fallback + high reasoning effort
|
|
472
521
|
- [x] Live SSE kanban tab (Conversation → Trajectory → Kanban)
|
|
473
522
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
- [ ] Per-task budget guardrails (max tokens / tool calls / wall-clock) and
|
|
477
|
-
failure-classified backoff
|
|
478
|
-
- [ ] Reproducible DT verification (replayed commands + stdout evidence) and
|
|
479
|
-
dual-model arbitration on hard flags
|
|
480
|
-
- [ ] Structured metrics + per-chain audit trace aggregation
|
|
481
|
-
- [ ] V context compaction / state-summary injection + session self-healing
|
|
482
|
-
- [ ] End-to-end contract test harness for multi-agent flows
|
|
483
|
-
- [ ] More human intervention points (before push / on hard flags) and
|
|
484
|
-
system-assisted hard-flag detection
|
|
485
|
-
|
|
486
|
-
### Known limitations
|
|
523
|
+
#### Known limitations
|
|
487
524
|
|
|
525
|
+
- **Swarm-mode intent recognition relies on model self-judgment**: misjudgments are caught by the confirmation gate (no confirmation, no chain), but the risk is non-zero.
|
|
488
526
|
- **Write guards are string-heuristic, not hard isolation.** PT/DT ToolGuards
|
|
489
527
|
rely on path/command regex and reviewers get no git credentials; a soft
|
|
490
528
|
constraint plus audit trail, not a mount-level sandbox.
|
|
491
|
-
- **`open-code-review`
|
|
492
|
-
|
|
493
|
-
|
|
529
|
+
- **`open-code-review` (ocr) is optional per machine**: when missing, in-chain
|
|
530
|
+
reviews block `review-tool-unavailable` before DT starts, with install guidance
|
|
531
|
+
(one-click GUI install available) — no retries burned.
|
|
494
532
|
- **Review evidence is existence-checked, not replay-proven.** Fields must be
|
|
495
|
-
present and well-formed; proving the tests actually ran is
|
|
533
|
+
present and well-formed; proving the tests actually ran is not yet supported.
|
|
496
534
|
- **Single default wiki-vault host** in the config default — point
|
|
497
535
|
`wikiVault.baseUrl` at your deployment.
|
|
498
536
|
- **PT creation depends on P's self-reported `pt_decision.needed`** —
|
|
499
|
-
system-assisted detection from repo signals is
|
|
537
|
+
system-assisted detection from repo signals is not yet implemented.
|
|
500
538
|
|
|
501
539
|
---
|
|
502
540
|
|