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