vibe-coding-master 0.0.6 → 0.0.8

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.
Files changed (50) hide show
  1. package/README.md +207 -66
  2. package/dist/backend/adapters/filesystem.js +13 -0
  3. package/dist/backend/adapters/git-adapter.js +79 -1
  4. package/dist/backend/adapters/translation-provider.js +145 -0
  5. package/dist/backend/api/artifact-routes.js +16 -7
  6. package/dist/backend/api/harness-routes.js +22 -0
  7. package/dist/backend/api/message-routes.js +2 -0
  8. package/dist/backend/api/project-routes.js +3 -8
  9. package/dist/backend/api/task-routes.js +14 -0
  10. package/dist/backend/api/translation-routes.js +70 -0
  11. package/dist/backend/runtime/node-pty-runtime.js +20 -18
  12. package/dist/backend/server.js +33 -2
  13. package/dist/backend/services/app-settings-service.js +128 -0
  14. package/dist/backend/services/artifact-service.js +7 -4
  15. package/dist/backend/services/claude-transcript-service.js +509 -0
  16. package/dist/backend/services/command-dispatcher.js +4 -2
  17. package/dist/backend/services/harness-service.js +196 -0
  18. package/dist/backend/services/message-service.js +1 -1
  19. package/dist/backend/services/project-service.js +50 -9
  20. package/dist/backend/services/session-service.js +13 -9
  21. package/dist/backend/services/status-service.js +79 -1
  22. package/dist/backend/services/task-service.js +118 -4
  23. package/dist/backend/services/translation-prompts.js +173 -0
  24. package/dist/backend/services/translation-queue.js +39 -0
  25. package/dist/backend/services/translation-service.js +546 -0
  26. package/dist/backend/templates/handoff.js +32 -0
  27. package/dist/backend/templates/harness/architect-agent.js +12 -0
  28. package/dist/backend/templates/harness/claude-root.js +14 -0
  29. package/dist/backend/templates/harness/coder-agent.js +11 -0
  30. package/dist/backend/templates/harness/gitignore.js +9 -0
  31. package/dist/backend/templates/harness/project-manager-agent.js +14 -0
  32. package/dist/backend/templates/harness/reviewer-agent.js +13 -0
  33. package/dist/backend/ws/translation-ws.js +35 -0
  34. package/dist/shared/types/harness.js +1 -0
  35. package/dist/shared/types/translation.js +5 -0
  36. package/dist/shared/validation/artifact-check.js +15 -1
  37. package/dist/shared/validation/language-detect.js +46 -0
  38. package/dist-frontend/assets/index-CuiNNOzj.css +32 -0
  39. package/dist-frontend/assets/index-D59GuHCR.js +58 -0
  40. package/dist-frontend/index.html +2 -2
  41. package/docs/cc-best-practices.md +109 -40
  42. package/docs/product-design.md +370 -1374
  43. package/docs/v1-architecture-design.md +595 -1114
  44. package/docs/v1-implementation-plan.md +898 -1603
  45. package/package.json +1 -1
  46. package/scripts/verify-package.mjs +8 -0
  47. package/dist/backend/templates/role-messaging-context.js +0 -44
  48. package/dist-frontend/assets/index-Bah6k-Ix.css +0 -32
  49. package/dist-frontend/assets/index-EMaQuIB6.js +0 -58
  50. package/docs/v1-message-bus-orchestration-design.md +0 -534
@@ -1,1431 +1,912 @@
1
- # VibeCodingMaster V1 架构设计方案
1
+ # V1 Architecture Design
2
2
 
3
- 版本:v0.2
4
- 日期:2026-05-29
5
- 状态:架构设计草案
6
- 依据:
3
+ Last updated: 2026-05-31
7
4
 
8
- - `docs/product-design.md`
9
- - `docs/cc-best-practices.md`
5
+ This document describes the architecture implemented by the current VCM codebase.
10
6
 
11
- ## 1. V1 架构目标
7
+ ## 1. System Overview
12
8
 
13
- VibeCodingMaster V1 只解决一个核心问题:
9
+ VCM is a local Node.js application with:
14
10
 
15
- > 做一个本地 GUI Session Cockpit,让用户可以在一个任务工作台中启动、切换、查看、输入和管理多个 Claude Code role sessions。
11
+ - Fastify backend.
12
+ - React frontend.
13
+ - `node-pty` terminal runtime.
14
+ - `xterm.js` terminal view.
15
+ - Claude Code role processes.
16
+ - API-driven message bus.
17
+ - Claude transcript JSONL tailer for translation.
16
18
 
17
- V1 不再把 CLI 或手动终端管理作为主交互模式。CLI 可以保留为开发、调试和 smoke test 入口,但用户主流程必须在 GUI 中完成。
19
+ Runtime shape:
18
20
 
19
- 核心能力:
20
-
21
- - 启动本地 GUI 应用。
22
- - 连接或选择本地 Git repo。
23
- - 检查 Claude Code 是否可用。
24
- - 创建任务 workspace。
25
- - 为任务创建 `.ai/handoffs/<task-slug>/`、`role-commands/`、`logs/`。
26
- - GUI 中展示 `project-manager / architect / coder / reviewer` role session tabs。
27
- - 用 embedded terminal 承载每个 Claude Code role session。
28
- - 支持用户在 GUI 内直接输入、确认权限、继续对话。
29
- - 将 terminal output 持续保存为 raw logs。
30
- - 在 GUI 中查看 role command 和 handoff artifacts。
31
- - 从 GUI 将 role command 发送到目标 role session。
32
- - 展示 session 状态、artifact 状态、任务状态和下一步建议。
33
- - 支持停止、重启、恢复单个 role session。
34
-
35
- V1 的成功标准不是“能不能用命令控制多个终端”,而是:
36
-
37
- > 用户是否可以不离开 GUI,就完成多 Claude Code sessions 的创建、切换、沟通、观察、日志保存和 handoff artifact 查看。
38
-
39
- ## 2. V1 非目标
40
-
41
- V1 明确不做:
42
-
43
- - SaaS 多用户协作。
44
- - 企业权限和审计。
45
- - 完整 Desktop 打包和自动更新。
46
- - 产品层翻译管线。
47
- - 独立翻译模型调用。
48
- - 自动生成完整 Task Spec。
49
- - 自动 Preflight Review。
50
- - 自动 Cross-Model Code Review。
51
- - 自动识别 public contract / test contract。
52
- - 自动执行 validation commands。
53
- - 自动创建 PR。
54
- - Jira / Linear / GitHub 双向同步。
55
- - 云端 session 托管。
56
- - 多 repo / 多任务并行调度。
57
- - 多 worktree 自动管理。
58
- - 让用户手动管理底层 terminal process。
21
+ ```text
22
+ browser
23
+ -> React GUI
24
+ -> HTTP API + WebSocket
25
+ -> Fastify backend
26
+ -> services
27
+ -> node-pty
28
+ -> claude --agent <role>
29
+ ```
59
30
 
60
- 这些能力应在 V1 GUI session cockpit 稳定后作为 V2/V3 能力演进。
31
+ The app is local-first. It writes project control state under `.ai/vcm/`, handoff artifacts under `.ai/handoffs/` inside the active task worktree, app settings under `~/.vcm/settings.json`, and reads Claude transcript files under `~/.claude/projects/`.
61
32
 
62
- ## 3. 关键设计原则
33
+ ## 2. Processes And Ports
63
34
 
64
- ### 3.1 GUI First
35
+ Default ports:
65
36
 
66
- V1 的主入口是本地 GUI。用户应该通过页面完成:
37
+ - backend / production GUI: `4173`
38
+ - Vite dev GUI: `5173`
67
39
 
68
- - 选择 repo。
69
- - 创建任务。
70
- - 启动 role sessions。
71
- - 切换 `project-manager / architect / coder / reviewer`。
72
- - 直接在 session 面板中输入和查看输出。
73
- - 查看 role command、logs、handoff artifacts 和状态。
40
+ Development:
74
41
 
75
- CLI 只用于:
42
+ ```text
43
+ npm run dev
44
+ -> backend at http://127.0.0.1:4173
45
+ -> Vite dev server at http://127.0.0.1:5173
46
+ ```
76
47
 
77
- - 启动 dev server。
78
- - 调试 backend。
79
- - 导出状态。
80
- - 执行自动化 smoke test。
48
+ Production / npm package:
81
49
 
82
- ### 3.2 Terminal Runtime Is Internal
50
+ ```text
51
+ vcm
52
+ -> backend serves dist-frontend at http://127.0.0.1:4173
53
+ ```
83
54
 
84
- Claude Code 本质上是交互式终端程序,V1 通过 embedded terminal 承载它。
55
+ `src/main.ts` starts the backend and optionally starts Vite when `--dev` is passed.
85
56
 
86
- 用户不需要理解:
57
+ ## 3. Frontend Architecture
87
58
 
88
- - pseudo-terminal。
89
- - process id。
90
- - terminal stream。
91
- - WebSocket message。
92
- - input/output bridge。
59
+ Entry:
93
60
 
94
- 产品界面表达的是任务、角色、会话、artifact、状态和验收。
61
+ - `src/frontend/main.tsx`
62
+ - `src/frontend/app.tsx`
95
63
 
96
- ### 3.3 Controller-Mediated
64
+ Main state lives in `App`:
97
65
 
98
- Project Manager session 不直接无限制控制其他 Claude Code sessions。
66
+ - connected project
67
+ - recent repository paths
68
+ - harness status
69
+ - task list
70
+ - active task
71
+ - active role
72
+ - active workflow report
73
+ - active messages
74
+ - active orchestration state
75
+ - task-local event list
99
76
 
100
- 正确模型:
77
+ Layout:
101
78
 
102
79
  ```text
103
- Project Manager session
104
- -> writes role command artifact
105
- -> GUI shows command artifact to user
106
- -> user approves or sends from GUI
107
- -> VibeCodingMaster backend writes short instruction to target role session
108
- -> target role session executes
109
- -> backend records raw log
110
- -> handoff artifact becomes stable result
80
+ AppShell
81
+ sidebar: ProjectDashboard
82
+ main: TaskWorkspace or EmptyWorkspace
111
83
  ```
112
84
 
113
- 职责分离:
85
+ ### ProjectDashboard
114
86
 
115
- - PM 决定发什么 role command。
116
- - GUI 让用户看见、确认和发送。
117
- - Backend 把短指令写入正确 role session。
118
- - Role agent 执行命令并产出 artifact。
119
- - Handoff artifacts 是跨 session 的事实源。
87
+ File:
120
88
 
121
- ### 3.4 File Handoff First
89
+ - `src/frontend/routes/project-dashboard.tsx`
122
90
 
123
- 角色交接不依赖聊天记忆。所有关键结果必须进入:
91
+ Responsibilities:
124
92
 
125
- ```text
126
- .ai/handoffs/<task-slug>/
127
- ```
93
+ - Render collapsible sidebar sections.
94
+ - Render repository connect form.
95
+ - Render repository summary.
96
+ - Render workflow panel.
97
+ - Render settings section with Messages, Events, Auto orchestration.
98
+ - Render harness status/actions.
99
+ - Render task creation form with one task-name field, a checked non-optional worktree/branch indicator, and generated branch/path previews.
100
+ - Render task list.
101
+ - Render Messages and Events modals.
128
102
 
129
- Terminal output 是调试信息;长期事实源是 handoff artifacts。
103
+ All sections default collapsed. `Repository Path` opens when there is no selected task.
130
104
 
131
- ### 3.5 One Task, One Workspace
105
+ ### TaskWorkspace
132
106
 
133
- V1 默认:
107
+ File:
134
108
 
135
- ```text
136
- one task
137
- -> one GUI task workspace
138
- -> multiple role sessions
139
- -> one handoff directory
140
- -> one repo working directory
141
- ```
109
+ - `src/frontend/routes/task-workspace.tsx`
142
110
 
143
- V1 不为每个 role 创建独立 worktree。角色隔离由 role session、role prompt、permissions、handoff files 和流程顺序实现。
111
+ Responsibilities:
144
112
 
145
- ### 3.6 Single-Writer Rule
113
+ - Fetch task status, messages, and orchestration state.
114
+ - Poll those every three seconds.
115
+ - Render compact header with task title, branch, immutable worktree path, role tabs, and Refresh.
116
+ - Hold per-role permission mode selection.
117
+ - Render one `SessionConsole` per role but only show the active role.
118
+ - Emit workflow/messages/orchestration/events back to `App` so sidebar stays synchronized.
146
119
 
147
- 同一个任务中,默认只有一个 write-capable role 在编辑代码。
120
+ ### SessionConsole
148
121
 
149
- 推荐顺序:
122
+ File:
150
123
 
151
- ```text
152
- project-manager -> architect -> coder -> reviewer
153
- ```
124
+ - `src/frontend/components/session-console.tsx`
154
125
 
155
- 允许并行:
126
+ Responsibilities:
156
127
 
157
- - read-only review。
158
- - log analysis。
159
- - artifact inspection。
160
- - 用户查看多个 session。
128
+ - Render role toolbar.
129
+ - Render embedded terminal for running sessions.
130
+ - Render empty/resume state for stopped sessions.
131
+ - Toggle translation panel.
132
+ - Split terminal and translation into two equal columns when translation is on.
161
133
 
162
- 不允许:
134
+ ### TranslationPanel
163
135
 
164
- - `coder` 和 `reviewer` 同时大范围改代码。
165
- - PM 直接替代 coder 实现复杂功能。
166
- - reviewer 接管大范围实现。
136
+ File:
167
137
 
168
- ### 3.7 State Can Be Rebuilt
138
+ - `src/frontend/components/translation-panel.tsx`
169
139
 
170
- V1 的状态必须能从四类来源恢复:
140
+ Responsibilities:
171
141
 
172
- ```text
173
- backend session registry
174
- terminal process state
175
- repo artifacts
176
- local VCM metadata
177
- ```
142
+ - Load translation settings and prompt previews.
143
+ - Open translation WebSocket for the current terminal runtime session id.
144
+ - Render dark translation output panel.
145
+ - Render translation status: `ready`, `translating <elapsed>`, or `error`.
146
+ - Render preserved tool output as dim one-line rows.
147
+ - Render prose source while translating, then translated text after completion.
148
+ - Render user composer.
149
+ - Translate on `Enter`; newline on `Shift+Enter`.
150
+ - Replace Chinese input with English draft after translation.
151
+ - Send English draft to the active terminal.
152
+ - Provide panel-level `Auto-send`, `Settings`, and `Clear`.
178
153
 
179
- 不要把前端页面内存作为唯一状态源。
154
+ ## 4. Backend Architecture
180
155
 
181
- ## 4. 技术栈选择
156
+ Entry:
182
157
 
183
- ### 4.1 主语言
158
+ - `src/backend/server.ts`
184
159
 
185
- 推荐:
160
+ `createDefaultServerDeps()` wires:
186
161
 
187
- ```text
188
- TypeScript + Node.js LTS
189
- ```
162
+ - filesystem adapter
163
+ - command runner
164
+ - git adapter
165
+ - Claude adapter
166
+ - app settings service
167
+ - node-pty runtime
168
+ - session registry
169
+ - artifact service
170
+ - harness service
171
+ - project service
172
+ - task service
173
+ - session service
174
+ - command dispatcher
175
+ - status service
176
+ - message service
177
+ - translation service
190
178
 
191
- 原因:
179
+ Fastify registers:
192
180
 
193
- - 前后端共享类型。
194
- - 适合本地 GUI、WebSocket 和进程编排。
195
- - 易于调用 `git`、`claude`、文件系统和终端 runtime。
196
- - 与后续 Desktop shell、Web UI 和自动化能力兼容。
181
+ - project routes
182
+ - harness routes
183
+ - task routes
184
+ - session routes
185
+ - artifact routes
186
+ - message routes
187
+ - translation routes
188
+ - terminal WebSocket
189
+ - translation WebSocket
197
190
 
198
- ### 4.2 前端
191
+ ## 5. Repository Connection
199
192
 
200
- 推荐:
193
+ File:
201
194
 
202
- ```text
203
- React + Vite
204
- ```
205
-
206
- 原因:
195
+ - `src/backend/services/project-service.ts`
196
+ - `src/backend/adapters/git-adapter.ts`
207
197
 
208
- - 适合构建本地单页工作台。
209
- - 与 xterm.js 集成成熟。
210
- - 本地开发体验快。
211
- - 后续可以被 Electron / Tauri / Desktop shell 包装。
212
-
213
- 前端核心依赖:
198
+ Connect flow:
214
199
 
215
200
  ```text
216
- @xterm/xterm
217
- @xterm/addon-fit
218
- @xterm/addon-web-links
201
+ POST /api/projects/connect
202
+ -> resolve path
203
+ -> check path exists
204
+ -> check .git marker directly
205
+ -> create .ai/vcm/config.json
206
+ -> ensure .ai/vcm state dirs
207
+ -> read branch and dirty state
208
+ -> record recent repo path in ~/.vcm/settings.json
219
209
  ```
220
210
 
221
- ### 4.3 后端
211
+ Git repository detection:
222
212
 
223
- 推荐:
224
-
225
- ```text
226
- Node.js HTTP server + WebSocket
227
- ```
213
+ - `.git` directory with `HEAD` is accepted.
214
+ - `.git` file with `gitdir:` pointer and target `HEAD` is accepted.
215
+ - This supports normal repositories and worktrees.
228
216
 
229
- 可选框架:
217
+ Git metadata commands use:
230
218
 
231
219
  ```text
232
- Fastify Express
233
- ws
220
+ git -c safe.directory=<repoRoot> -c safe.directory=<realpath(repoRoot)> ...
234
221
  ```
235
222
 
236
- 后端职责:
223
+ VCM does not require global `safe.directory` configuration.
237
224
 
238
- - 提供 REST API。
239
- - 提供 terminal WebSocket。
240
- - 管理 pseudo-terminal lifecycle。
241
- - 读写 `.vcm` 和 `.ai/handoffs`。
242
- - 执行 git / claude 环境检查。
225
+ ## 6. Task Worktree Architecture
243
226
 
244
- ### 4.4 Terminal Runtime
227
+ Task-level worktree management is the current architecture for multi-task parallelism.
245
228
 
246
- V1 推荐:
229
+ Rule:
247
230
 
248
231
  ```text
249
- node-pty
232
+ one VCM task = one branch + one git worktree + one handoff directory + one role-session set
250
233
  ```
251
234
 
252
- 用途:
253
-
254
- - 启动 `claude --agent <role>`,并按用户选择追加权限参数。
255
- - 承载交互式输入输出。
256
- - 支持 backend 程序化写入 input。
257
- - 支持 backend 程序化监听 output。
258
- - 支持 terminal resize。
259
- - 支持退出码和进程状态。
260
- - 配合 xterm.js 提供接近真实终端的 GUI 体验。
261
-
262
- V1 的 terminal runtime 固定为:
235
+ Branch name:
263
236
 
264
237
  ```text
265
- TerminalRuntime implementation = node-pty
238
+ feature/<taskSlug>
266
239
  ```
267
240
 
268
- 后续持久性增强应优先改进 backend lifecycle、session registry、raw logs 和恢复体验。
269
-
270
- ### 4.5 进程执行
271
-
272
- 推荐:
241
+ Worktree path:
273
242
 
274
243
  ```text
275
- execa
244
+ <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
276
245
  ```
277
246
 
278
- 用途:
247
+ VCM does not support switching a task to another branch or worktree after creation. If the user needs a different branch/worktree, they should create a new task.
279
248
 
280
- - 调用 `git`。
281
- - 调用 `claude --version`。
282
- - 执行 shell-safe command。
283
- - 不用于承载 Claude Code 交互式 session;交互式 session 由 `node-pty` 负责。
284
-
285
- ### 4.6 本地状态存储
286
-
287
- V1 推荐 JSON 文件,而不是 SQLite。
288
-
289
- 推荐路径:
249
+ VCM does not create worktrees by role. All four role sessions for a task share the same task worktree:
290
250
 
291
251
  ```text
292
- .vcm/
293
- config.json
294
- tasks/
295
- <task-slug>.json
296
- sessions/
297
- <task-slug>.json
298
- app-state.json
252
+ .ai/vcm/worktrees/<taskSlug>/
253
+ project-manager session cwd
254
+ architect session cwd
255
+ coder session cwd
256
+ reviewer session cwd
299
257
  ```
300
258
 
301
- 原因:
259
+ ### 6.1 Base Repo vs Task Worktree
302
260
 
303
- - V1 是本地单用户。
304
- - 状态量小。
305
- - 易于检查和恢复。
306
- - 与 repo-local harness 理念一致。
261
+ VCM distinguishes:
307
262
 
308
- 后续加入多任务并发、后台 daemon 或复杂查询后,再迁移到 SQLite。
263
+ - `baseRepoRoot`: repository the user connected.
264
+ - `taskRepoRoot`: git worktree path for a specific task.
265
+ - `branch`: `feature/<taskSlug>`.
266
+ - `worktreePath`: same as `taskRepoRoot`.
309
267
 
310
- ### 4.7 Markdown 处理
311
-
312
- V1 不需要复杂 Markdown AST。
313
-
314
- 建议:
315
-
316
- - 写入模板用字符串模板。
317
- - artifact completeness 用标题存在性检查。
318
- - 前端预览用简单 Markdown renderer。
319
- - 后续再引入 Markdown parser。
320
-
321
- ### 4.8 测试框架
322
-
323
- 推荐:
268
+ Project-level VCM control state stays under the base repo:
324
269
 
325
270
  ```text
326
- Vitest
327
- Playwright
271
+ <baseRepoRoot>/.ai/vcm/config.json
272
+ <baseRepoRoot>/.ai/vcm/tasks/<task>.json
273
+ <baseRepoRoot>/.ai/vcm/sessions/<task>.json
274
+ <baseRepoRoot>/.ai/vcm/messages/<task>.jsonl
275
+ <baseRepoRoot>/.ai/vcm/orchestration/<task>.json
276
+ <baseRepoRoot>/.ai/vcm/worktrees/<task>/
328
277
  ```
329
278
 
330
- 测试重点:
331
-
332
- - slug/path 生成。
333
- - artifact schema 检查。
334
- - session status 推断。
335
- - REST API。
336
- - WebSocket terminal bridge。
337
- - role command dispatch。
338
- - GUI task workspace smoke test。
339
-
340
- ## 5. 进程架构
341
-
342
- V1 采用本地 Web GUI + 本地 Node backend。
279
+ Task source changes and handoff artifacts live in the task worktree:
343
280
 
344
281
  ```text
345
- User
346
- -> Browser / Desktop shell
347
- -> React Task Workspace
348
- -> xterm.js Role Session Console
349
- -> WebSocket terminal bridge
350
- -> REST API
351
- -> Local Node backend
352
- -> GitAdapter
353
- -> ClaudeAdapter
354
- -> FileSystemAdapter
355
- -> ArtifactService
356
- -> TaskService
357
- -> SessionRegistry
358
- -> TerminalRuntimeManager
359
- -> node-pty
360
- -> claude --agent project-manager
361
- -> claude --agent architect
362
- -> claude --agent coder
363
- -> claude --agent reviewer
282
+ <baseRepoRoot>/.ai/vcm/worktrees/<task>/.ai/handoffs/<task>/
364
283
  ```
365
284
 
366
- Backend 是长生命周期本地进程。前端刷新后,应该能重新连接 backend 并恢复可见状态。
285
+ This central base-state model lets VCM list and manage multiple tasks while each task's code changes happen in a separate worktree.
367
286
 
368
- ## 6. GUI 结构
287
+ ### 6.2 Git Ignore Requirement
369
288
 
370
- ### 6.1 Project Dashboard
289
+ The base repository must ignore `.ai/vcm/`.
371
290
 
372
- 职责:
291
+ Reason:
373
292
 
374
- - 显示已连接 repo。
375
- - 显示 active tasks。
376
- - 显示每个任务的 severity、required role route、session health。
377
- - 显示 blocked tasks、recent validation failures、known issues、harness health。
378
- - 提供进入 Task Workspace 的入口。
293
+ - `.ai/vcm/worktrees/<task>` is a nested git worktree.
294
+ - Without `.ai/vcm/` in `.gitignore`, the base repo sees worktree files as untracked noise.
295
+ - `.ai/vcm` also contains local task/session/message metadata that should not be committed by default.
379
296
 
380
- ### 6.2 Task Workspace
297
+ The VCM harness manages a `.gitignore` block that ignores `.ai/vcm/` before task worktree creation.
381
298
 
382
- V1 的主界面。
383
-
384
- 推荐布局:
299
+ ### 6.3 Task Creation Flow
385
300
 
386
301
  ```text
387
- ┌──────────────────────────────────────────────────────────────────────────────┐
388
- Header: repo / branch / task / severity / route / overall status │
389
- ├───────────────┬──────────────────────────────────────────────────────────────┤
390
- Task Nav │ Role Sessions │
391
- │ │ tabs: PM | Architect | Coder | Reviewer │
392
- Session State embedded terminal │
393
- Known Issues │ session ops │
394
- │ │ input handled by terminal │
395
- ├───────────────┴──────────────────────────────────────────────────────────────┤
396
- Event Log: PM wrote architect.md | Coder waiting for approval │
397
- └──────────────────────────────────────────────────────────────────────────────┘
302
+ POST /api/tasks
303
+ -> validate taskSlug
304
+ -> compute branch feature/<taskSlug>
305
+ -> compute worktreePath <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
306
+ -> assert branch does not already exist
307
+ -> assert worktreePath does not already exist
308
+ -> assert .ai/vcm/ is ignored by Git
309
+ -> assert base repo has no uncommitted changes
310
+ -> git worktree add -b feature/<taskSlug> <worktreePath> <baseRef>
311
+ -> create handoff structure in taskRepoRoot
312
+ -> write central task metadata under baseRepoRoot/.ai/vcm/tasks/<task>.json
398
313
  ```
399
314
 
400
- ### 6.3 Session Console
315
+ The default `baseRef` is the connected repo's current `HEAD`.
401
316
 
402
- 每个 role session 对应一个 console。
317
+ ### 6.4 Task Cleanup Flow
403
318
 
404
- 能力:
319
+ ```text
320
+ POST /api/tasks/:taskSlug/cleanup
321
+ -> require no running role sessions
322
+ -> load task metadata
323
+ -> verify worktree path belongs under <baseRepoRoot>/.ai/vcm/worktrees/
324
+ -> check worktree status
325
+ -> refuse cleanup when uncommitted work exists unless force is explicitly requested
326
+ -> git worktree remove <worktreePath>
327
+ -> delete central task/session/message/orchestration metadata
328
+ ```
405
329
 
406
- - 展示 role name。
407
- - 展示 command,例如 `claude --agent architect`。
408
- - 展示 xterm.js terminal viewport。
409
- - 支持输入、复制、选择文本、resize。
410
- - 展示状态:not started / starting / running / waiting / blocked / done / crashed。
411
- - 支持 start / stop / restart。
412
- - 显示 raw log path。
330
+ Branch deletion is intentionally separate:
413
331
 
414
- ### 6.4 Handoff Files
332
+ - Keep `feature/<taskSlug>` by default.
333
+ - Allow branch deletion only with explicit confirmation.
334
+ - Prefer allowing deletion only when the branch has been merged, or when the user force-confirms.
415
335
 
416
- V1 不在主界面展示独立 artifact inspector。handoff artifacts 和 role commands 仍保存在任务目录中,作为 session 之间的文件级事实源;GUI 的主工作区优先展示 embedded terminal。
336
+ ## 7. Task And Artifact Model
417
337
 
418
- ### 6.5 Event Log
338
+ File:
419
339
 
420
- 展示产品级事件,不展示完整 terminal stream。
340
+ - `src/backend/services/task-service.ts`
341
+ - `src/backend/services/artifact-service.ts`
342
+ - `src/shared/types/task.ts`
343
+ - `src/shared/types/artifact.ts`
421
344
 
422
- 示例:
345
+ Task state:
423
346
 
424
347
  ```text
425
- PM session started
426
- PM wrote architect.md
427
- User sent architect command
428
- Architect wrote architecture-plan.md
429
- Coder waiting for permission
430
- Reviewer missing validation evidence
348
+ <baseRepoRoot>/.ai/vcm/tasks/<task>.json
431
349
  ```
432
350
 
433
- ## 7. Terminal Runtime
351
+ Each task stores:
434
352
 
435
- ### 7.1 Role Session 启动命令
353
+ - `taskSlug`
354
+ - optional `title`
355
+ - timestamps
356
+ - `baseRepoRoot`
357
+ - `worktreePath`
358
+ - `repoRoot` / `taskRepoRoot`
359
+ - branch, always `feature/<taskSlug>` for VCM-created tasks
360
+ - handoff directory
361
+ - status
362
+ - optional spec path
436
363
 
437
- 每个 role session 启动对应 Claude Code:
364
+ Task creation:
438
365
 
439
- ```bash
440
- claude --agent project-manager
441
- claude --agent architect
442
- claude --agent coder
443
- claude --agent reviewer
366
+ ```text
367
+ POST /api/tasks
368
+ -> validate slug
369
+ -> create branch and worktree
370
+ -> create handoff directories
371
+ -> create artifact templates
372
+ -> write base .ai/vcm/tasks/<task>.json
444
373
  ```
445
374
 
446
- ### 7.2 TerminalRuntime 接口
447
-
448
- V1 后端应抽象 terminal runtime,避免把 node-pty 写死到上层业务。
375
+ Handoff directory:
449
376
 
450
- ```ts
451
- interface TerminalRuntime {
452
- createSession(input: CreateTerminalSessionInput): Promise<TerminalSession>;
453
- getSession(sessionId: string): TerminalSession | undefined;
454
- listSessions(taskSlug?: string): TerminalSessionSummary[];
455
- write(sessionId: string, data: string): void;
456
- resize(sessionId: string, cols: number, rows: number): void;
457
- stop(sessionId: string): Promise<void>;
458
- restart(sessionId: string): Promise<TerminalSession>;
459
- subscribe(sessionId: string, listener: TerminalEventListener): Unsubscribe;
460
- }
377
+ ```text
378
+ <taskRepoRoot>/.ai/handoffs/<task>/
379
+ role-commands/
380
+ architect.md
381
+ coder.md
382
+ reviewer.md
383
+ logs/
384
+ project-manager.log
385
+ architect.log
386
+ coder.log
387
+ reviewer.log
388
+ architecture-plan.md
389
+ implementation-log.md
390
+ validation-log.md
391
+ review-report.md
392
+ docs-sync-report.md
393
+ messages/
461
394
  ```
462
395
 
463
- ### 7.3 node-pty 实现
464
-
465
- `NodePtyTerminalRuntime` 负责:
466
-
467
- - spawn `claude`。
468
- - 设置 cwd 为 repo root。
469
- - 设置 env。
470
- - 捕获 stdout/stderr stream。
471
- - 将 stream 推送给 WebSocket subscribers。
472
- - 将 stream append 到 role log。
473
- - 监听 exit code。
474
- - 更新 session status。
475
- - 支持 resize。
396
+ Artifact checks are simple V1 checks:
476
397
 
477
- ### 7.4 WebSocket Terminal Bridge
398
+ - missing
399
+ - placeholder / incomplete
400
+ - ok
478
401
 
479
- WebSocket 负责前后端双向通信。
402
+ They are used for workflow readiness, not content quality judgment.
480
403
 
481
- 推荐消息:
482
-
483
- ```json
484
- { "type": "input", "sessionId": "session_123", "data": "hello\n" }
485
- { "type": "resize", "sessionId": "session_123", "cols": 120, "rows": 32 }
486
- { "type": "output", "sessionId": "session_123", "data": "..." }
487
- { "type": "status", "sessionId": "session_123", "status": "running" }
488
- { "type": "exit", "sessionId": "session_123", "exitCode": 0 }
489
- ```
404
+ ## 8. Workflow Computation
490
405
 
491
- ### 7.5 Role Command Dispatch
406
+ File:
492
407
 
493
- role command 不直接粘贴进 terminal。V1 应先写入文件,再向目标 session 发送短指令。
408
+ - `src/backend/services/status-service.ts`
494
409
 
495
- 任务身份以 VCM `taskSlug` 为准。Project Manager 必须只写入当前 task 的 canonical handoff directory:
410
+ Endpoint:
496
411
 
497
412
  ```text
498
- .ai/handoffs/<task-slug>/role-commands/<role>.md
413
+ GET /api/tasks/:taskSlug/status
499
414
  ```
500
415
 
501
- 如果 task slug 不符合用户意图,Project Manager 必须要求用户创建或选择正确的 VCM task,不能自行创建 `.ai/handoffs/<other-task>/` 来绕过当前 task。
502
-
503
- 示例:
504
-
505
- ```text
506
- Please read and execute the role command at: .ai/handoffs/<task-slug>/role-commands/architect.md
507
- ```
508
-
509
- 发送流程:
416
+ The workflow has five steps:
510
417
 
511
418
  ```text
512
- GUI Send Command button
513
- -> POST /api/tasks/:taskSlug/sessions/:role/dispatch
514
- -> backend checks role command file exists, non-empty, and not placeholder/draft
515
- -> backend writes short instruction to terminal runtime
516
- -> backend records dispatch event
419
+ architecture-plan -> implementation -> review -> docs-sync -> final-acceptance
517
420
  ```
518
421
 
519
- ### 7.6 Programmatic I/O Boundary
422
+ Step readiness:
520
423
 
521
- 通过 `node-pty`,backend 技术上可以对 Claude Code session 做两类程序化操作:
424
+ - Architecture is ready until `architecture-plan.md` is ok.
425
+ - Implementation is blocked until architecture is ok.
426
+ - Review is blocked until `implementation-log.md` and `validation-log.md` are ok.
427
+ - Docs Sync is blocked until `review-report.md` is ok.
428
+ - PM Final is blocked until `docs-sync-report.md` is ok.
522
429
 
523
- ```text
524
- write input:
525
- runtime.write(sessionId, "Please read ...\r")
430
+ The report is displayed in the sidebar `Workflow` section.
526
431
 
527
- read output:
528
- runtime.subscribe(sessionId, listener)
529
- ```
432
+ ## 9. Session Runtime
530
433
 
531
- V1 允许:
434
+ Files:
532
435
 
533
- - 用户点击 Send Command 后,backend 写入短指令。
534
- - 用户在 GUI terminal 中输入后,backend 转发输入。
535
- - 用户在 Start / Restart 前选择 Claude Code 权限模式。
536
- - backend 监听 output,写入 raw log。
537
- - backend 根据进程退出、输出活动和用户操作更新轻量状态。
538
- - backend 在 GUI 中提示 waiting / crashed / exited 等状态。
436
+ - `src/backend/services/session-service.ts`
437
+ - `src/backend/adapters/claude-adapter.ts`
438
+ - `src/backend/runtime/node-pty-runtime.ts`
439
+ - `src/backend/runtime/session-registry.ts`
539
440
 
540
- V1 不允许:
441
+ Session service owns role session lifecycle:
541
442
 
542
- - 自动确认 Claude Code 权限提示。
543
- - PM 写完 command 后自动发送给下一个 role。
544
- - Architect 完成后自动触发 Coder。
545
- - Coder 完成后自动触发 Reviewer。
546
- - 根据 terminal output 自动执行高风险下一步。
443
+ - start
444
+ - resume
445
+ - restart
446
+ - stop
447
+ - list
448
+ - get
547
449
 
548
- 更高级的自动编排必须进入后续版本,并带有人类 approval gate、审计日志和明确 stop conditions。
450
+ Runtime session id and Claude session id are different:
549
451
 
550
- ### 7.7 Claude Code Permission Modes
452
+ - runtime session id identifies the local `node-pty` process in VCM.
453
+ - Claude session id identifies the Claude Code conversation for resume/transcript lookup.
551
454
 
552
- V1 在 Task Workspace 的每个 role session 控制区提供三档权限模式:
455
+ Start:
553
456
 
554
457
  ```text
555
- 默认
556
- -> claude --agent <role>
557
-
558
- bypassPermissions
559
- -> claude --agent <role> --permission-mode bypassPermissions
560
-
561
- --dangerously-skip-permissions
562
- -> claude --agent <role> --dangerously-skip-permissions
458
+ claude --agent <role> --session-id <uuid>
563
459
  ```
564
460
 
565
- 规则:
566
-
567
- - 权限模式是用户显式选择,不由 Project Manager 或 backend 自动切换。
568
- - 权限模式只影响 Start / Restart 创建的新 Claude Code 进程。
569
- - `RoleSessionRecord.permissionMode` 必须记录实际启动模式。
570
- - GUI 显示实际 command,方便用户确认当前 session 的权限状态。
571
-
572
- ## 8. Repo Artifacts
573
-
574
- V1 需要创建和维护:
461
+ Resume:
575
462
 
576
463
  ```text
577
- .ai/
578
- handoffs/
579
- <task-slug>/
580
- role-commands/
581
- architect.md
582
- coder.md
583
- reviewer.md
584
- logs/
585
- project-manager.log
586
- architect.log
587
- coder.log
588
- reviewer.log
589
- architecture-plan.md
590
- implementation-log.md
591
- validation-log.md
592
- review-report.md
593
-
594
- .vcm/
595
- config.json
596
- tasks/
597
- <task-slug>.json
598
- sessions/
599
- <task-slug>.json
600
- app-state.json
464
+ claude --agent <role> --resume <uuid>
601
465
  ```
602
466
 
603
- V1 可以不自动创建 `.ai/task-specs/`,但如果 Project Manager 已经生成 task spec,应在 task metadata 中记录路径。
604
-
605
- ## 9. 模块划分
606
-
607
- 推荐代码结构:
467
+ Permission flags:
608
468
 
609
469
  ```text
610
- src/
611
- main.ts
612
-
613
- frontend/
614
- app.tsx
615
- routes/
616
- project-dashboard.tsx
617
- task-workspace.tsx
618
- components/
619
- app-shell.tsx
620
- task-nav.tsx
621
- role-session-tabs.tsx
622
- session-console.tsx
623
- event-log.tsx
624
- status-badge.tsx
625
- terminal/
626
- xterm-view.tsx
627
- terminal-client.ts
628
- state/
629
- api-client.ts
630
- task-store.ts
631
- session-store.ts
632
-
633
- backend/
634
- server.ts
635
- api/
636
- project-routes.ts
637
- task-routes.ts
638
- session-routes.ts
639
- artifact-routes.ts
640
- ws/
641
- terminal-ws.ts
642
- runtime/
643
- terminal-runtime.ts
644
- node-pty-runtime.ts
645
- session-registry.ts
646
- services/
647
- project-service.ts
648
- task-service.ts
649
- session-service.ts
650
- artifact-service.ts
651
- command-dispatcher.ts
652
- status-service.ts
653
- adapters/
654
- git-adapter.ts
655
- claude-adapter.ts
656
- filesystem.ts
657
- command-runner.ts
658
- validation/
659
- environment-check.ts
660
- artifact-check.ts
661
- slug-check.ts
662
- templates/
663
- handoff.ts
664
- role-command.ts
665
- types/
666
- project.ts
667
- task.ts
668
- session.ts
669
- role.ts
670
- artifact.ts
671
- terminal.ts
672
- api.ts
673
-
674
- tests/
675
- unit/
676
- integration/
677
- e2e/
470
+ --permission-mode bypassPermissions
471
+ --dangerously-skip-permissions
678
472
  ```
679
473
 
680
- ### 9.1 Frontend App
681
-
682
- 职责:
474
+ Session persistence:
683
475
 
684
- - 渲染 GUI。
685
- - 调用 REST API。
686
- - 连接 terminal WebSocket。
687
- - 管理 active task 和 active role tab state。
688
-
689
- ### 9.2 SessionConsole
690
-
691
- 职责:
476
+ ```text
477
+ <baseRepoRoot>/.ai/vcm/sessions/<task>.json
478
+ ```
692
479
 
693
- - 渲染 xterm.js。
694
- - 连接指定 role session 的 WebSocket stream。
695
- - 将用户输入写回 backend。
696
- - 处理 resize。
697
- - 显示 start / stop / restart 操作。
480
+ The persisted record includes:
698
481
 
699
- ### 9.3 EventLog
482
+ - runtime session id
483
+ - Claude session id
484
+ - transcript path
485
+ - role
486
+ - status
487
+ - command display
488
+ - permission mode
489
+ - cwd
490
+ - pid
491
+ - raw log path
492
+ - role command path
493
+ - handoff artifact path
700
494
 
701
- 职责:
495
+ If a runtime process is gone but the role has a Claude session id, `getRoleSession` returns a recoverable `resumable` status.
702
496
 
703
- - 展示任务级运行事件。
704
- - 保持短日志形态,不占用 terminal 主视野。
497
+ In task-worktree mode, `cwd` must be the immutable task worktree path. Role sessions must not start in the base repo when a task worktree exists.
705
498
 
706
- ### 9.4 Backend Server
499
+ ## 10. Terminal Runtime
707
500
 
708
- 职责:
501
+ File:
709
502
 
710
- - 提供 REST API。
711
- - 提供 WebSocket endpoint。
712
- - 管理 backend service lifecycle。
713
- - Serve frontend static assets。
503
+ - `src/backend/runtime/node-pty-runtime.ts`
714
504
 
715
- ### 9.5 TerminalRuntimeManager
505
+ The runtime:
716
506
 
717
- 职责:
507
+ - spawns `node-pty`
508
+ - sets `TERM=xterm-256color`
509
+ - sets color-friendly env vars
510
+ - appends raw PTY output to `<taskRepoRoot>/.ai/handoffs/<task>/logs/<role>.log`
511
+ - emits terminal output/input/exit events to WebSocket subscribers
512
+ - replays the log on terminal WebSocket subscribe
718
513
 
719
- - 管理 role session 生命周期。
720
- - 启动 Claude Code pty。
721
- - 转发 terminal input/output。
722
- - 保存 raw logs。
723
- - 维护 runtime status。
514
+ Terminal WebSocket:
724
515
 
725
- ### 9.6 SessionRegistry
516
+ ```text
517
+ GET /ws/terminal/:sessionId
518
+ ```
726
519
 
727
- 职责:
520
+ Client messages:
728
521
 
729
- - 保存当前 backend 进程中的 live sessions。
730
- - 对比 `.vcm/sessions/<task-slug>.json`。
731
- - 支持页面刷新后的 session 查询。
732
- - 标记 crashed / exited / missing。
522
+ - input
523
+ - resize
733
524
 
734
- ### 9.7 ArtifactService
525
+ Server messages:
735
526
 
736
- 职责:
527
+ - output
528
+ - exit
529
+ - error
737
530
 
738
- - 创建 handoff directory。
739
- - 创建 `role-commands/` 和 `logs/`。
740
- - 创建 artifact 模板。
741
- - 检查 artifact 是否存在。
742
- - 检查 artifact 是否包含关键标题。
743
- - 保存 role command。
744
- - 追加 raw terminal logs。
531
+ ## 11. Message Bus
745
532
 
746
- ### 9.8 CommandDispatcher
533
+ Files:
747
534
 
748
- 职责:
535
+ - `src/backend/services/message-service.ts`
536
+ - `src/backend/templates/message-envelope.ts`
537
+ - `src/cli/vcmctl.ts`
749
538
 
750
- - 读取 `role-commands/<role>.md`。
751
- - 校验目标 role session 是否 running。
752
- - 将短指令写入目标 terminal session。
753
- - 记录 dispatch event。
539
+ State:
754
540
 
755
- 原则:
541
+ ```text
542
+ .ai/vcm/messages/<task>.jsonl
543
+ .ai/vcm/orchestration/<task>.json
544
+ .ai/handoffs/<task>/messages/<message-id>.md
545
+ ```
756
546
 
757
- - 不发送未落盘的长 prompt。
758
- - 每次 dispatch 都必须有 role command artifact。
759
- - 高风险 command 后续可增加用户确认 gate。
547
+ Policy:
760
548
 
761
- ## 10. API 设计
549
+ - User can only send `user-request` to `project-manager`.
550
+ - PM can send `task`, `question`, `review-request`, `revise`, `cancel` to non-PM roles.
551
+ - Non-PM roles can send `result`, `question`, `blocked`, `finding` to PM.
762
552
 
763
- ### 10.1 Project API
553
+ Manual mode:
764
554
 
765
555
  ```text
766
- GET /api/health
767
- POST /api/projects/connect
768
- GET /api/projects/current
769
- GET /api/projects/harness
556
+ send -> pending_approval -> Stage -> staged
770
557
  ```
771
558
 
772
- `POST /api/projects/connect`:
559
+ `Stage` writes:
773
560
 
774
- ```json
775
- {
776
- "repoPath": "/path/to/repo"
777
- }
561
+ ```text
562
+ Read and handle VCM message <id> at <bodyPath>
778
563
  ```
779
564
 
780
- ### 10.2 Task API
565
+ It does not append Enter.
566
+
567
+ Auto mode:
781
568
 
782
569
  ```text
783
- GET /api/tasks
784
- POST /api/tasks
785
- GET /api/tasks/:taskSlug
786
- GET /api/tasks/:taskSlug/status
570
+ send -> delivered
787
571
  ```
788
572
 
789
- `POST /api/tasks`:
573
+ The backend writes a `[VCM MESSAGE]` envelope to the target terminal and appends Enter.
790
574
 
791
- ```json
792
- {
793
- "taskSlug": "fix-refund-coupon",
794
- "title": "Fix refund coupon behavior",
795
- "specPath": ".ai/task-specs/fix-refund-coupon.md"
796
- }
797
- ```
575
+ The backend still exposes pause/resume orchestration API routes and stores `paused` for compatibility. The current GUI only toggles `mode` between `manual` and `auto`.
798
576
 
799
- ### 10.3 Session API
577
+ Messages and orchestration snapshots are central project state under `baseRepoRoot/.ai/vcm`. Message body markdown lives in the task worktree handoff directory.
800
578
 
801
- ```text
802
- GET /api/tasks/:taskSlug/sessions
803
- POST /api/tasks/:taskSlug/sessions/:role/start
804
- POST /api/tasks/:taskSlug/sessions/:role/stop
805
- POST /api/tasks/:taskSlug/sessions/:role/resume
806
- POST /api/tasks/:taskSlug/sessions/:role/restart
807
- POST /api/tasks/:taskSlug/sessions/:role/resize
808
- POST /api/tasks/:taskSlug/sessions/:role/dispatch
809
- ```
579
+ ## 12. Role Command Compatibility
810
580
 
811
- ### 10.4 Artifact API
581
+ Files:
812
582
 
813
- ```text
814
- GET /api/tasks/:taskSlug/artifacts
815
- GET /api/tasks/:taskSlug/artifacts/:artifactName
816
- GET /api/tasks/:taskSlug/role-commands/:role
817
- PUT /api/tasks/:taskSlug/role-commands/:role
818
- GET /api/tasks/:taskSlug/logs/:role
819
- ```
583
+ - `src/backend/services/command-dispatcher.ts`
584
+ - `src/backend/api/session-routes.ts`
585
+ - `src/backend/api/artifact-routes.ts`
820
586
 
821
- ### 10.5 Terminal WebSocket
587
+ Compatibility endpoint:
822
588
 
823
589
  ```text
824
- WS /ws/tasks/:taskSlug/sessions/:role
590
+ POST /api/tasks/:taskSlug/sessions/:role/dispatch
825
591
  ```
826
592
 
827
- Client -> server:
593
+ Dispatchable roles:
828
594
 
829
- ```json
830
- { "type": "input", "data": "..." }
831
- { "type": "resize", "cols": 120, "rows": 32 }
832
- ```
595
+ - `architect`
596
+ - `coder`
597
+ - `reviewer`
833
598
 
834
- Server -> client:
599
+ The dispatcher:
835
600
 
836
- ```json
837
- { "type": "output", "data": "..." }
838
- { "type": "status", "status": "running" }
839
- { "type": "exit", "exitCode": 0 }
840
- { "type": "error", "message": "Claude Code is not available" }
841
- ```
601
+ 1. Loads the task.
602
+ 2. Reads the role command artifact.
603
+ 3. Rejects missing, empty, or placeholder role commands.
604
+ 4. Resolves primary command path `role-commands/<role>.md`, with legacy fallback `<role>-command.md`.
605
+ 5. Writes `Please read and execute the role command at: <path>` to the target terminal and submits Enter.
842
606
 
843
- ## 11. 数据模型
607
+ This is a compatibility path. The preferred V1 coordination path is `vcmctl` message bus.
844
608
 
845
- ### 11.1 ProjectConfig
846
-
847
- ```json
848
- {
849
- "version": 1,
850
- "repoRoot": "/path/to/repo",
851
- "defaultRoles": ["project-manager", "architect", "coder", "reviewer"],
852
- "handoffRoot": ".ai/handoffs",
853
- "stateRoot": ".vcm",
854
- "terminalBackend": "node-pty",
855
- "claudeCommand": "claude"
856
- }
857
- ```
609
+ ## 13. Harness Service
858
610
 
859
- ### 11.2 TaskRecord
611
+ File:
860
612
 
861
- ```json
862
- {
863
- "version": 1,
864
- "taskSlug": "fix-refund-coupon",
865
- "title": "Fix refund coupon behavior",
866
- "createdAt": "2026-05-29T00:00:00+08:00",
867
- "updatedAt": "2026-05-29T00:00:00+08:00",
868
- "repoRoot": "/path/to/repo",
869
- "branch": "feature/refund-coupon",
870
- "handoffDir": ".ai/handoffs/fix-refund-coupon",
871
- "status": "created",
872
- "specPath": ".ai/task-specs/fix-refund-coupon.md"
873
- }
874
- ```
613
+ - `src/backend/services/harness-service.ts`
875
614
 
876
- ### 11.3 RoleSessionRecord
615
+ Harness files:
877
616
 
878
- ```json
879
- {
880
- "id": "session_architect_123",
881
- "claudeSessionId": "00000000-0000-4000-8000-000000000001",
882
- "taskSlug": "fix-refund-coupon",
883
- "role": "architect",
884
- "status": "running",
885
- "command": "claude --agent architect --permission-mode bypassPermissions",
886
- "permissionMode": "bypassPermissions",
887
- "cwd": "/path/to/repo",
888
- "terminalBackend": "node-pty",
889
- "pid": 12345,
890
- "logPath": ".ai/handoffs/fix-refund-coupon/logs/architect.log",
891
- "roleCommandPath": ".ai/handoffs/fix-refund-coupon/role-commands/architect.md",
892
- "handoffArtifactPath": ".ai/handoffs/fix-refund-coupon/architecture-plan.md",
893
- "startedAt": "2026-05-29T00:00:00+08:00",
894
- "lastOutputAt": "2026-05-29T00:03:14+08:00",
895
- "exitCode": null
896
- }
617
+ ```text
618
+ CLAUDE.md
619
+ .gitignore
620
+ .claude/agents/project-manager.md
621
+ .claude/agents/architect.md
622
+ .claude/agents/coder.md
623
+ .claude/agents/reviewer.md
897
624
  ```
898
625
 
899
- ### 11.4 TaskSessionRecord
626
+ Managed block:
900
627
 
901
- ```json
902
- {
903
- "version": 1,
904
- "taskSlug": "fix-refund-coupon",
905
- "updatedAt": "2026-05-29T00:03:14+08:00",
906
- "roles": {
907
- "project-manager": {
908
- "id": "session_pm_123",
909
- "status": "running"
910
- },
911
- "architect": {
912
- "id": "session_architect_123",
913
- "claudeSessionId": "00000000-0000-4000-8000-000000000001",
914
- "status": "running",
915
- "record": "{...RoleSessionRecord}"
916
- },
917
- "coder": {
918
- "id": null,
919
- "status": "not_started"
920
- },
921
- "reviewer": {
922
- "id": null,
923
- "status": "not_started"
924
- }
925
- }
926
- }
628
+ ```md
629
+ <!-- VCM:BEGIN version=1 -->
630
+ ...
631
+ <!-- VCM:END -->
927
632
  ```
928
633
 
929
- ### 11.5 RoleStatus
634
+ `.gitignore` uses the same VCM managed-block concept with hash comments:
930
635
 
931
- V1 状态枚举:
932
-
933
- ```text
934
- not_started
935
- starting
936
- running
937
- waiting
938
- blocked
939
- done
940
- resumable
941
- crashed
942
- exited
943
- missing
944
- unknown
636
+ ```gitignore
637
+ # VCM:BEGIN version=1
638
+ .ai/vcm/
639
+ .vcm/
640
+ # VCM:END
945
641
  ```
946
642
 
947
- V1 很难可靠判断 Claude Code 内部语义状态,因此:
643
+ The service:
948
644
 
949
- - `not_started` 来自 metadata。
950
- - `running` 来自 live pty。
951
- - `exited/crashed` 来自 process exit。
952
- - `missing` 来自 metadata 存在但 live process 不存在。
953
- - `resumable` 来自 metadata 中存在 `claudeSessionId`,但当前没有 live pty。
954
- - `waiting/blocked/done` 可以先由用户或 role output marker 显式标记。
955
- - 自动推断只能作为 best-effort。
645
+ - checks whether files exist
646
+ - checks whether a managed block exists
647
+ - compares the managed block with the current template
648
+ - plans `create`, `insert`, `update`, or `ok`
649
+ - applies only the planned managed-block change
956
650
 
957
- ### 11.6 TerminalEvent
651
+ It must not overwrite user content outside the VCM block.
958
652
 
959
- ```json
960
- {
961
- "id": "evt_123",
962
- "sessionId": "session_architect_123",
963
- "taskSlug": "fix-refund-coupon",
964
- "role": "architect",
965
- "type": "output",
966
- "timestamp": "2026-05-29T00:03:14+08:00",
967
- "data": "..."
968
- }
969
- ```
653
+ ## 14. Translation Architecture
970
654
 
971
- ## 12. 核心工作流
655
+ Files:
972
656
 
973
- ### 12.1 启动应用
657
+ - `src/backend/services/translation-service.ts`
658
+ - `src/backend/services/translation-queue.ts`
659
+ - `src/backend/services/translation-prompts.ts`
660
+ - `src/backend/services/claude-transcript-service.ts`
661
+ - `src/backend/adapters/translation-provider.ts`
662
+ - `src/backend/ws/translation-ws.ts`
663
+ - `src/backend/api/translation-routes.ts`
664
+ - `src/frontend/components/translation-panel.tsx`
665
+ - `src/frontend/components/translation-settings-modal.tsx`
974
666
 
975
- ```text
976
- vcm dev 或桌面入口
977
- -> start local Node backend
978
- -> serve React frontend
979
- -> open browser / desktop shell
980
- -> show Project Dashboard
981
- ```
667
+ ### Settings
982
668
 
983
- ### 12.2 连接 repo
669
+ Settings service:
984
670
 
985
- ```text
986
- User selects repo path
987
- -> POST /api/projects/connect
988
- -> check git repo
989
- -> check claude --version
990
- -> create .vcm/config.json
991
- -> create .ai/handoffs/
992
- -> show branch and dirty warning
993
- ```
671
+ - `src/backend/services/app-settings-service.ts`
994
672
 
995
- ### 12.3 创建任务 workspace
673
+ Storage:
996
674
 
997
675
  ```text
998
- User clicks New Task
999
- -> enter task slug / title
1000
- -> POST /api/tasks
1001
- -> create .ai/handoffs/<task-slug>/
1002
- -> create role-commands/
1003
- -> create logs/
1004
- -> create artifact templates
1005
- -> create .vcm/tasks/<task-slug>.json
1006
- -> open Task Workspace
676
+ ~/.vcm/settings.json
1007
677
  ```
1008
678
 
1009
- ### 12.4 启动 role session
679
+ Stored data:
1010
680
 
1011
- ```text
1012
- User clicks Start project-manager
1013
- -> POST /api/tasks/<task-slug>/sessions/project-manager/start
1014
- -> NodePtyTerminalRuntime spawns claude --agent project-manager
1015
- -> backend writes RoleSessionRecord
1016
- -> frontend opens WebSocket
1017
- -> xterm.js renders output
1018
- ```
681
+ - translation settings
682
+ - translation secrets
683
+ - recent repository paths, max 5
1019
684
 
1020
- ### 12.5 用户切换和沟通
685
+ Legacy migration:
1021
686
 
1022
- ```text
1023
- User clicks Architect tab
1024
- -> frontend switches active role
1025
- -> if session exists, subscribe to WebSocket
1026
- -> if session not started, show Start button
1027
- -> user types directly into terminal
1028
- ```
687
+ - `~/.vibe-coding-master/settings.json`
688
+ - `~/.vibe-coding-master/translation.json`
689
+
690
+ ### Provider
1029
691
 
1030
- ### 12.6 下发 role command
692
+ Provider type:
1031
693
 
1032
694
  ```text
1033
- PM writes architect.md
1034
- -> User can inspect the command file in the task directory when needed
1035
- -> User clicks Send Command in the target role toolbar
1036
- -> backend validates command file
1037
- -> backend writes short instruction to architect pty
1038
- -> backend records dispatch event
695
+ openai-compatible
1039
696
  ```
1040
697
 
1041
- ### 12.7 查看 artifacts
698
+ It uses chat completions and builds the URL from `baseUrl`.
1042
699
 
1043
- ```text
1044
- V1 main GUI does not render artifact status.
1045
- Handoff files remain available in the task directory and backend services.
1046
- ```
700
+ Prompt keys:
1047
701
 
1048
- ### 12.8 重启 role session
702
+ - `zh-to-en`
703
+ - `zh-to-en-with-context`
704
+ - `en-to-zh`
1049
705
 
1050
- ```text
1051
- User clicks Restart coder
1052
- -> backend stops existing coder pty if any
1053
- -> preserves logs and artifacts
1054
- -> starts new claude --agent coder
1055
- -> updates session record
1056
- -> frontend reconnects WebSocket
1057
- ```
706
+ ### Claude Output Path
1058
707
 
1059
- ## 13. Artifact Schema Checks
708
+ Output translation reads Claude transcript JSONL, not terminal raw output.
1060
709
 
1061
- V1 不判断内容质量,但必须检查关键 artifact 是否存在且包含必要标题。
710
+ Resolution order:
1062
711
 
1063
- ### 13.1 architecture-plan.md
712
+ 1. persisted `RoleSessionRecord.transcriptPath`
713
+ 2. `claudeTranscriptPath(session.cwd, session.claudeSessionId)`
714
+ 3. scan `~/.claude/projects/*/<sessionId>.jsonl` and choose newest mtime
1064
715
 
1065
- 最低标题:
716
+ Tailer:
1066
717
 
1067
- ```text
1068
- Architecture Summary
1069
- Task Classification
1070
- Required Role Route
1071
- Modules / Files
1072
- File Responsibilities
1073
- Public Surface Contract
1074
- Phases
1075
- Validation Per Phase
1076
- Risks
1077
- Stop Conditions
1078
- ```
718
+ - validates file exists
719
+ - can replay history since session start minus a grace window
720
+ - uses `fs.watch`
721
+ - also polls every 500ms
722
+ - parses only complete newline-delimited JSON records
1079
723
 
1080
- ### 13.2 implementation-log.md
724
+ Parsed transcript events:
1081
725
 
1082
- 最低标题:
726
+ - `text`
727
+ - `thinking`
728
+ - `question`
729
+ - `todo`
730
+ - `agent`
731
+ - `tool_use`
732
+ - `tool_result`
1083
733
 
1084
- ```text
1085
- Summary
1086
- Files Changed
1087
- Public Surface Changed
1088
- Tests Added / Updated
1089
- Validation Run
1090
- Deviations From Architecture Plan
1091
- Follow-ups
1092
- ```
734
+ Translation service behavior:
1093
735
 
1094
- ### 13.3 validation-log.md
736
+ - ignores thinking
737
+ - translates text/question/todo/agent as prose
738
+ - preserves tool_use/tool_result as tool-output
739
+ - queues translation per runtime session id
740
+ - emits WebSocket `translation-entry`
741
+ - emits WebSocket `translation-status`
1095
742
 
1096
- 最低要求:
743
+ ### User Input Path
1097
744
 
1098
745
  ```text
1099
- 至少存在一个 validation entry,或明确说明 not run + reason。
746
+ textarea -> POST translation/input -> provider -> English draft in the same textarea -> optional send
1100
747
  ```
1101
748
 
1102
- ### 13.4 review-report.md
1103
-
1104
- 最低标题:
749
+ Send path:
1105
750
 
1106
751
  ```text
1107
- Summary
1108
- Role / Handoff Compliance
1109
- Scope Review
1110
- Architecture Review
1111
- Public Contract Review
1112
- Test Review
1113
- Validation Evidence
1114
- Findings
1115
- Decision
752
+ POST translation/send -> runtime.write(session.id, englishText + "\r")
1116
753
  ```
1117
754
 
1118
- ## 14. 错误处理
755
+ The backend strips trailing newlines before appending `\r`.
1119
756
 
1120
- ### 14.1 Claude Code 不存在
757
+ ## 15. API Surface
1121
758
 
1122
- 连接 repo 或启动 role session 前失败,并在 GUI 中提示:
759
+ Project:
1123
760
 
1124
761
  ```text
1125
- Claude Code command is not available.
1126
- Install Claude Code or configure the claude command path.
762
+ GET /api/health
763
+ GET /api/projects/recent
764
+ GET /api/projects/current
765
+ POST /api/projects/connect
1127
766
  ```
1128
767
 
1129
- ### 14.2 Repo 无效
1130
-
1131
- `POST /api/projects/connect` 必须检查 Git repo。
1132
-
1133
- 失败时提示:
768
+ Harness:
1134
769
 
1135
770
  ```text
1136
- Selected path is not a Git repository.
771
+ GET /api/projects/harness
772
+ POST /api/projects/harness/apply
1137
773
  ```
1138
774
 
1139
- ### 14.3 Role session 已存在
1140
-
1141
- 默认不重复启动。
1142
-
1143
- GUI 显示:
1144
-
1145
- - Focus existing session。
1146
- - Restart session。
1147
- - Stop session。
1148
-
1149
- ### 14.4 role command 缺失
1150
-
1151
- 发送 command 必须失败:
775
+ Tasks:
1152
776
 
1153
777
  ```text
1154
- Missing .ai/handoffs/<task-slug>/role-commands/<role>.md
1155
- Ask project-manager to produce the role command first.
778
+ GET /api/tasks
779
+ POST /api/tasks
780
+ GET /api/tasks/:taskSlug
781
+ GET /api/tasks/:taskSlug/status
782
+ POST /api/tasks/:taskSlug/cleanup
1156
783
  ```
1157
784
 
1158
- ### 14.5 role command 为空
785
+ There is no task-level "switch worktree" API. Worktree selection happens only at task creation.
1159
786
 
1160
- 发送 command 必须失败:
787
+ Sessions:
1161
788
 
1162
789
  ```text
1163
- Role command exists but is empty.
790
+ GET /api/tasks/:taskSlug/sessions
791
+ POST /api/tasks/:taskSlug/sessions/:role/start
792
+ POST /api/tasks/:taskSlug/sessions/:role/resume
793
+ POST /api/tasks/:taskSlug/sessions/:role/restart
794
+ POST /api/tasks/:taskSlug/sessions/:role/stop
795
+ POST /api/tasks/:taskSlug/sessions/:role/dispatch
1164
796
  ```
1165
797
 
1166
- ### 14.6 artifact 缺失
1167
-
1168
- Backend artifact schema check 标记 missing,不自动补写真实内容。
1169
-
1170
- ### 14.7 进程崩溃
1171
-
1172
- role session 进程异常退出时:
1173
-
1174
- - 状态标记为 `crashed`。
1175
- - 保留 raw log。
1176
- - 显示 exit code。
1177
- - 提供 Restart。
1178
-
1179
- ### 14.8 页面刷新
1180
-
1181
- 页面刷新后:
1182
-
1183
- - 前端重新请求 task/session 状态。
1184
- - 对 live session 重新建立 WebSocket。
1185
- - 对 missing live process 显示 `missing` 或 `exited`。
1186
-
1187
- ## 15. 安全和权限边界
1188
-
1189
- V1 不是 sandbox。它是本地 GUI session orchestrator。
1190
-
1191
- V1 必须明确提示:
1192
-
1193
- - Claude Code 在用户当前 repo 环境运行。
1194
- - VCM 不拦截 Claude Code 的所有文件写入。
1195
- - GUI 中的 terminal 是真实 Claude Code session。
1196
- - 高风险任务仍需要 human approval。
1197
- - 角色隔离依赖 `.claude/agents/*`、Claude Code permissions、用户 review 和 handoff artifacts。
1198
-
1199
- V1 推荐但不强制:
1200
-
1201
- - 项目提供 `.claude/agents/project-manager.md`。
1202
- - 项目提供 `.claude/agents/architect.md`。
1203
- - 项目提供 `.claude/agents/coder.md`。
1204
- - 项目提供 `.claude/agents/reviewer.md`。
1205
- - 项目配置 Claude Code permission hooks。
1206
-
1207
- V1 可以提供 Harness Health 检查这些文件是否存在,但不自动生成复杂 role agents。
1208
-
1209
- ## 16. 后续演进接口
1210
-
1211
- V1 代码应预留这些抽象,但不完整实现:
1212
-
1213
- ### 16.1 Review Adapter
1214
-
1215
- 后续接入 Cross-Model Reviewer。
1216
-
1217
- ### 16.2 Validation Runner
1218
-
1219
- 后续自动运行 validation commands。
1220
-
1221
- ### 16.3 Worktree Manager
1222
-
1223
- 后续实现:
798
+ Artifacts:
1224
799
 
1225
800
  ```text
1226
- one task -> one branch -> one worktree
801
+ GET /api/tasks/:taskSlug/artifacts
802
+ GET /api/tasks/:taskSlug/artifacts/:artifactName
803
+ GET /api/tasks/:taskSlug/role-commands/:role
804
+ PUT /api/tasks/:taskSlug/role-commands/:role
805
+ GET /api/tasks/:taskSlug/logs/:role
1227
806
  ```
1228
807
 
1229
- V1 只做当前 repo working directory orchestration。
1230
-
1231
- ### 16.4 Session Persistence Hardening
1232
-
1233
- 后续增强:
1234
-
1235
- - backend lifecycle 管理。
1236
- - session registry 持久化。
1237
- - raw log replay。
1238
- - 页面刷新和 backend 重启后的状态恢复。
1239
- - crashed / exited session 的恢复建议。
1240
-
1241
- ### 16.5 Desktop Shell
1242
-
1243
- 后续用 Electron 或 Tauri 包装本地 Web GUI。
1244
-
1245
- ### 16.6 Permission / Hook Manager
1246
-
1247
- 后续生成 role-specific Claude Code permission hooks。
1248
-
1249
- ## 17. 实施顺序
1250
-
1251
- ### Milestone 1: Local GUI Shell
1252
-
1253
- - TypeScript monorepo / app 初始化。
1254
- - React + Vite frontend。
1255
- - Node backend。
1256
- - `vcm dev` 启动前后端。
1257
- - Project Dashboard。
1258
- - repo connect API。
1259
- - environment check。
1260
-
1261
- ### Milestone 2: Task Workspace and Artifacts
1262
-
1263
- - Task Workspace 页面。
1264
- - `POST /api/tasks`。
1265
- - handoff directory。
1266
- - role command templates。
1267
- - artifact templates。
1268
- - artifact schema checks。
1269
-
1270
- ### Milestone 3: Embedded Terminal Runtime
1271
-
1272
- - TerminalRuntime interface。
1273
- - NodePtyTerminalRuntime。
1274
- - WebSocket terminal bridge。
1275
- - xterm.js SessionConsole。
1276
- - start / stop / restart role session。
1277
- - raw logs。
1278
-
1279
- ### Milestone 4: Role Session Cockpit
1280
-
1281
- - role session tabs。
1282
- - session status badges。
1283
- - reconnect after page refresh。
1284
- - event log。
1285
- - session registry。
1286
- - crash / exited handling。
1287
-
1288
- ### Milestone 5: GUI Role Command Dispatch
1289
-
1290
- - role command viewer。
1291
- - Send Command button。
1292
- - backend dispatch API。
1293
- - short instruction write to pty。
1294
- - dispatch event recording。
1295
-
1296
- ### Milestone 6: Acceptance Smoke
1297
-
1298
- - one repo。
1299
- - one task。
1300
- - start project-manager。
1301
- - start architect。
1302
- - send architect command。
1303
- - verify output streams in GUI。
1304
- - verify raw logs saved。
1305
- - verify artifact status shown。
1306
- - restart coder session。
1307
- - stop all sessions。
1308
-
1309
- ## 18. V1 验收标准
1310
-
1311
- V1 完成时,应能在一个真实 repo 中演示:
808
+ Messages:
1312
809
 
1313
810
  ```text
1314
- 1. 打开 VibeCodingMaster GUI
1315
- 2. 选择本地 Git repo
1316
- 3. 创建 demo-task
1317
- 4. Task Workspace 打开成功
1318
- 5. project-manager session 在 embedded terminal 中启动
1319
- 6. architect session 在另一个 tab 中启动
1320
- 7. 用户可以在 GUI 中切换 PM / architect
1321
- 8. 用户可以直接在 terminal 中输入和确认 Claude Code 提示
1322
- 9. PM 产出 architect.md
1323
- 10. 用户需要时可在任务目录查看 architect.md
1324
- 11. 用户点击目标 role 的 Send Command
1325
- 12. architect session 收到短指令并执行
1326
- 13. architect raw output 写入 logs/architect.log
1327
- 14. backend artifact check 可识别 architecture-plan.md missing / incomplete / ok
1328
- 15. 用户可以 restart coder session
1329
- 16. 页面刷新后能恢复 task/session 状态
811
+ GET /api/tasks/:taskSlug/messages
812
+ POST /api/tasks/:taskSlug/messages
813
+ POST /api/tasks/:taskSlug/messages/:messageId/stage
814
+ POST /api/tasks/:taskSlug/messages/:messageId/approve
815
+ POST /api/tasks/:taskSlug/messages/:messageId/reject
816
+ GET /api/tasks/:taskSlug/orchestration
817
+ PUT /api/tasks/:taskSlug/orchestration
818
+ POST /api/tasks/:taskSlug/orchestration/pause
819
+ POST /api/tasks/:taskSlug/orchestration/resume
1330
820
  ```
1331
821
 
1332
- 成功指标:
1333
-
1334
- - GUI 启动成功。
1335
- - repo 连接成功。
1336
- - role session 创建成功。
1337
- - terminal input/output 稳定。
1338
- - raw logs 不丢。
1339
- - artifact 状态可见。
1340
- - role command dispatch 可控。
1341
- - 页面刷新后可恢复状态。
1342
-
1343
- ## 19. 主要风险和应对
1344
-
1345
- ### 19.1 Claude Code 交互终端嵌入复杂
1346
-
1347
- 应对:
822
+ Translation:
1348
823
 
1349
- - 使用 xterm.js。
1350
- - 使用 node-pty。
1351
- - 保留 raw stream。
1352
- - 支持 resize。
1353
- - 支持权限确认和用户输入。
1354
-
1355
- ### 19.2 Session 持久性不足
1356
-
1357
- 应对:
1358
-
1359
- - backend 持有 session registry。
1360
- - `.vcm/sessions` 保存每个 role 的完整 `RoleSessionRecord` 和 `claudeSessionId`。
1361
- - 首次启动使用 `claude --agent <role> --session-id <uuid>`。
1362
- - backend 重启或异常退出后,GUI 将旧 pty 标记为 `resumable`。
1363
- - Resume 使用 `claude --agent <role> --resume <uuid>` 创建新的 embedded terminal。
1364
- - raw logs 持续写入。
1365
- - 页面刷新重新订阅。
1366
- - 后续继续增强 backend lifecycle 和 raw log replay。
1367
-
1368
- ### 19.3 Claude Code 状态不可结构化
824
+ ```text
825
+ GET /api/translation/settings
826
+ PUT /api/translation/settings
827
+ GET /api/translation/prompts
828
+ POST /api/translation/test
829
+ POST /api/tasks/:taskSlug/sessions/:role/translation/input
830
+ POST /api/tasks/:taskSlug/sessions/:role/translation/send
831
+ POST /api/translation/sessions/:sessionId/clear
832
+ POST /api/translation/sessions/:sessionId/retry/:translationId
833
+ ```
1369
834
 
1370
- 应对:
835
+ WebSockets:
1371
836
 
1372
- - V1 不深度解析 Claude Code 输出。
1373
- - 状态以 process state、用户显式标记、artifact state 为主。
1374
- - 后续通过 structured reports 改进。
837
+ ```text
838
+ /ws/terminal/:sessionId
839
+ /ws/translation/:sessionId
840
+ ```
1375
841
 
1376
- ### 19.4 PM 误控其他 session
842
+ ## 16. Error Handling
1377
843
 
1378
- 应对:
844
+ File:
1379
845
 
1380
- - PM 不直接操作 runtime。
1381
- - dispatch 必须读取 role command artifact。
1382
- - GUI 展示 command 并由用户发送。
1383
- - backend 记录 dispatch event。
846
+ - `src/backend/errors.ts`
1384
847
 
1385
- ### 19.5 Handoff 空洞
848
+ Backend services throw `VcmError` with:
1386
849
 
1387
- 应对:
850
+ - code
851
+ - message
852
+ - status code
853
+ - optional hint
1388
854
 
1389
- - artifact schema check。
1390
- - backend status 可报告 missing/incomplete/ok。
1391
- - reviewer 后续检查 handoff compliance。
855
+ Fastify error handler returns:
1392
856
 
1393
- ### 19.6 用户在 main 分支上开发
857
+ ```json
858
+ {
859
+ "error": {
860
+ "code": "CODE",
861
+ "message": "Human-readable message",
862
+ "hint": "Optional hint"
863
+ }
864
+ }
865
+ ```
1394
866
 
1395
- 应对:
867
+ ## 17. Packaging Architecture
1396
868
 
1397
- - repo connect 和 task create 时显示当前 branch。
1398
- - 如果当前 branch 是 `main` 或 `master`,显示 warning。
1399
- - V1 不强制创建 branch,但强烈建议用户切到 task branch。
869
+ `package.json` publishes built artifacts:
1400
870
 
1401
- ### 19.7 GUI 复杂度过高
871
+ - `dist`
872
+ - `dist-frontend`
873
+ - `docs`
874
+ - `scripts`
875
+ - `README.md`
1402
876
 
1403
- 应对:
877
+ Bins:
1404
878
 
1405
- - V1 只做本地单用户。
1406
- - V1 只做一个 repo 的核心路径。
1407
- - V1 不做自动 review、validation runner、PR。
1408
- - 优先完成 SessionConsole、role dispatch 和 session recovery。
879
+ - `vcm` -> `dist/main.js`
880
+ - `vcmctl` -> `dist/cli/vcmctl.js`
1409
881
 
1410
- ## 20. 架构判断
882
+ Important scripts:
1411
883
 
1412
- V1 的本质不是“自动写代码”,也不是“给终端包一层命令”。
884
+ - `build`: clean, TypeScript build, Vite build
885
+ - `verify:package`: verifies required dist files and frontend assets
886
+ - `prepack`: build and package verification
887
+ - `postinstall`: fixes `node-pty` spawn helper when needed
1413
888
 
1414
- V1 的本质是:
889
+ ## 18. Security And Safety Boundaries
1415
890
 
1416
- > 搭建一个可靠的本地 Claude Code 多角色 GUI 工作台,让多个 role sessions、handoff artifacts、logs 和状态在一个任务页面中变得可见、可切换、可沟通、可恢复。
891
+ Current boundaries:
1417
892
 
1418
- 第一版应该保持克制:
893
+ - VCM runs local processes with the user's permissions.
894
+ - VCM does not auto-confirm Claude Code permission prompts.
895
+ - Relaxed Claude permission modes are user-selected per role launch.
896
+ - Translation API key is local in `~/.vcm/settings.json`.
897
+ - Translation output is UI/runtime state only unless a user or role copies it into a file.
898
+ - `.ai/vcm` is local project control state and must be ignored by Git.
899
+ - Task handoff artifacts live in the task worktree and users should decide whether those artifacts belong in task commits.
900
+ - Task worktrees are created only during task creation; VCM does not expose branch/worktree switching APIs.
901
+ - Sandbox isolation should come from a devContainer, Docker container, VM, or other user-controlled environment.
1419
902
 
1420
- ```text
1421
- 少做智能判断
1422
- 多做状态可见
1423
- 少自动修改代码
1424
- 多沉淀 artifacts
1425
- 少解析终端语义
1426
- 多保留 raw logs
1427
- 少暴露终端编排细节
1428
- 多提供 GUI 操作入口
1429
- ```
903
+ ## 19. Known Implementation Boundaries
1430
904
 
1431
- 只要 V1 能稳定做到 GUI task workspace、embedded Claude Code role sessions、terminal I/O、raw logs、role command dispatch 和 handoff artifact checks,后续 Task Spec Builder、Validation Runner、Cross-Model Review、Worktree Manager、Desktop Packaging 和 session persistence hardening 才有可靠地基。
905
+ - No tmux backend.
906
+ - No per-role worktree manager.
907
+ - No branch switching for an existing task.
908
+ - No main-page artifact inspector.
909
+ - No raw PTY output translation.
910
+ - No hard workflow gate enforcement.
911
+ - No durable backend event log for the sidebar Events modal; current events are frontend runtime events for the active task.
912
+ - No hosted multi-user collaboration.