@coralai/sps-cli 0.65.17 → 0.65.19

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 (37) hide show
  1. package/dist/console-assets/assets/{ShowcasePage-DloZ_1Uk.js → ShowcasePage-Bp9q9QkI.js} +1 -1
  2. package/dist/console-assets/assets/{index-C5RI91tQ.js → index-B8eM0W9n.js} +202 -202
  3. package/dist/console-assets/index.html +1 -1
  4. package/dist/providers/RuntimeSessionRuntime.d.ts.map +1 -1
  5. package/dist/providers/RuntimeSessionRuntime.js +7 -0
  6. package/dist/providers/RuntimeSessionRuntime.js.map +1 -1
  7. package/package.json +5 -1
  8. package/skills/dev-worker/SKILL.md +41 -0
  9. package/skills/dev-worker/references/architect.md +139 -0
  10. package/skills/dev-worker/references/backend.md +163 -0
  11. package/skills/dev-worker/references/frontend.md +122 -0
  12. package/skills/dev-worker/references/fullstack.md +179 -0
  13. package/skills/dev-worker/references/optimizer.md +151 -0
  14. package/skills/dev-worker/references/phaser.md +109 -0
  15. package/skills/dev-worker/references/prototyper.md +171 -0
  16. package/skills/dev-worker/references/reviewer.md +122 -0
  17. package/skills/dev-worker/references/security.md +154 -0
  18. package/skills/dev-worker/references/senior.md +155 -0
  19. package/skills/dev-worker/references/typescript.md +65 -0
  20. package/skills/dev-worker/references/writer.md +201 -0
  21. package/skills/prompt-writer/SKILL.md +81 -0
  22. package/skills/skill-creator/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
  23. package/skills/skill-creator/scripts/__pycache__/run_eval.cpython-312.pyc +0 -0
  24. package/skills/skill-creator/scripts/__pycache__/utils.cpython-312.pyc +0 -0
  25. package/skills/sps/SKILL.md +346 -0
  26. package/skills/sps/references/cli-quick-reference.md +172 -0
  27. package/skills/sps/references/diagnostic-sequence.md +106 -0
  28. package/skills/sps/references/failure-patterns.md +375 -0
  29. package/skills/sps/references/labels.md +78 -0
  30. package/skills/sps/references/monitoring.md +61 -0
  31. package/skills/sps/references/mr-and-recovery.md +74 -0
  32. package/skills/sps/references/operation-playbooks.md +248 -0
  33. package/skills/sps/references/preflight-and-setup.md +85 -0
  34. package/skills/sps/references/skills.md +62 -0
  35. package/skills/sps/references/troubleshooting.md +200 -0
  36. package/skills/sps/references/workflow-internals.md +46 -0
  37. package/skills/web-reach/SKILL.md +40 -0
@@ -0,0 +1,106 @@
1
+ # SPS Diagnostic Sequence (v0.16+)
2
+
3
+ ## Pre-requisite check
4
+
5
+ Before diagnosing workflow issues, verify the environment:
6
+
7
+ ```bash
8
+ sps --version # Must be 0.16+
9
+ source ~/.coral/env # Credentials loaded?
10
+ sps doctor <project> --json # Full health report
11
+ ```
12
+
13
+ ## Step 1: Global health assessment
14
+
15
+ ```bash
16
+ sps doctor <project> --json # Config and infrastructure health
17
+ sps monitor tick <project> --json # Anomaly detection (orphans, timeouts, misalignment)
18
+ sps worker dashboard <project> # Worker live status
19
+ ```
20
+
21
+ ## Step 2: Narrow down by pipeline stage
22
+
23
+ ```bash
24
+ sps scheduler tick <project> --json # Card selection issues (Planning → Backlog)
25
+ sps pipeline tick <project> --json # Execution issues (Backlog → Todo → Inprogress → Done)
26
+ sps qa tick <project> --json # Closeout issues (QA → merge → Done)
27
+ ```
28
+
29
+ ## Step 3: Check ground truth
30
+
31
+ ```bash
32
+ sps pm scan <project> # PM backend state (business truth)
33
+ sps pm scan <project> Inprogress # Filter by state
34
+ sps worker dashboard <project> --json # Worker slot + PID status
35
+ cat ~/.coral/projects/<project>/runtime/state.json # Runtime state (execution truth)
36
+ cat ~/.coral/projects/<project>/pipeline_order.json # Execution queue
37
+ ```
38
+
39
+ ## Step 4: Process-level inspection (v0.16+)
40
+
41
+ ```bash
42
+ # Check if worker process is alive
43
+ cat ~/.coral/projects/<project>/runtime/state.json | jq '.workers[] | select(.status=="active") | {slot: .slot, pid, seq}'
44
+ kill -0 <pid> 2>/dev/null && echo "ALIVE" || echo "DEAD"
45
+
46
+ # Check worker output file
47
+ cat ~/.coral/projects/<project>/logs/worker-<slot>.jsonl | tail -20
48
+
49
+ # Check worktree state
50
+ ls ~/.coral/worktrees/card-<seq>/
51
+ cd ~/.coral/worktrees/card-<seq> && git log --oneline -5
52
+ cd ~/.coral/worktrees/card-<seq> && git status
53
+
54
+ # Check tick lock
55
+ cat ~/.coral/projects/<project>/runtime/tick.lock
56
+ ```
57
+
58
+ ## Step 5: Recovery actions
59
+
60
+ ```bash
61
+ # Let monitor auto-fix orphans and timeouts
62
+ sps monitor tick <project> --json
63
+
64
+ # Force state transition
65
+ sps pm move <project> <seq> <target-state>
66
+ sps pm comment <project> <seq> "Manual fix: <reason>"
67
+
68
+ # Re-trigger completion judge
69
+ sps pipeline tick <project> --json
70
+
71
+ # Remove stale tick lock (only if owning process is dead)
72
+ rm ~/.coral/projects/<project>/runtime/tick.lock
73
+
74
+ # Restart tick to trigger Recovery module
75
+ sps tick <project>
76
+ ```
77
+
78
+ ## Decision rules
79
+
80
+ 1. Always use read-only diagnostic commands first, then targeted fixes
81
+ 2. PM state is business truth, runtime state is execution truth — understand the gap before aligning
82
+ 3. Prefer single corrective move + re-inspect over multi-layer batch fixes
83
+ 4. Record recovery actions with `sps pm comment`
84
+ 5. After any manual intervention, run `sps monitor tick --json` to verify alignment
85
+ 6. If worker PID is dead but slot is active → next `sps tick` or `sps monitor tick` auto-recovers
86
+ 7. If tick lock is stale (owning PID dead) → safe to remove lock file
87
+
88
+ ## Quick decision tree
89
+
90
+ ```
91
+ Problem detected
92
+ ├── sps doctor --json → config/infra issue?
93
+ │ ├── Yes → sps doctor --fix
94
+ │ └── No ↓
95
+ ├── sps monitor tick --json → anomaly detected?
96
+ │ ├── Orphan worker → monitor auto-cleans, or restart tick
97
+ │ ├── Timeout → check INPROGRESS_TIMEOUT_HOURS setting
98
+ │ ├── State mismatch → sps pm move to align
99
+ │ └── No ↓
100
+ ├── Which stage is stuck?
101
+ │ ├── Planning → scheduler tick (check labels, pipeline_order, slot availability)
102
+ │ ├── Backlog/Todo → pipeline tick (check MAX_ACTIONS_PER_TICK, worktree, branch)
103
+ │ ├── Inprogress → worker dashboard (check PID alive, output, git push)
104
+ │ └── QA → qa tick (check MR status, CI, merge conflicts)
105
+ └── Still stuck → check ground truth (PM scan vs state.json) → manual recovery
106
+ ```
@@ -0,0 +1,375 @@
1
+ # SPS Common Failure Patterns (v0.16+)
2
+
3
+ ## Environment and setup failures
4
+
5
+ ### SPS CLI not found or outdated
6
+
7
+ **Symptoms**: `sps: command not found` or missing v0.16+ features.
8
+
9
+ **Fix**:
10
+ ```bash
11
+ npm install -g @coralai/sps-cli
12
+ sps --version # Verify 0.18.0+
13
+ ```
14
+
15
+ **If installed but not in PATH**:
16
+ ```bash
17
+ npm config get prefix
18
+ # Add <prefix>/bin to PATH in ~/.bashrc
19
+ export PATH="$(npm config get prefix)/bin:$PATH"
20
+ ```
21
+
22
+ ### Global credentials missing
23
+
24
+ **Symptoms**: `sps doctor` reports GitLab/Plane connection failures.
25
+
26
+ **Fix**:
27
+ ```bash
28
+ test -f ~/.coral/env && echo "exists" || sps setup
29
+ source ~/.coral/env
30
+ # Verify:
31
+ echo "GITLAB_TOKEN=${GITLAB_TOKEN:+SET}"
32
+ echo "PLANE_API_KEY=${PLANE_API_KEY:+SET}"
33
+ ```
34
+
35
+ ### Project not initialized
36
+
37
+ **Symptoms**: `sps doctor <project>` fails with "project directory not found".
38
+
39
+ **Fix**:
40
+ ```bash
41
+ sps project init <project>
42
+ vim ~/.coral/projects/<project>/conf # Fill required fields
43
+ sps doctor <project> --fix
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Card lifecycle failures
49
+
50
+ ### Worker completed but card didn't advance
51
+
52
+ **Symptoms**: Worker output shows "done" but card stays in Inprogress.
53
+
54
+ **Diagnosis**:
55
+ ```bash
56
+ sps pipeline tick <project> --json # CompletionJudge result?
57
+ sps worker dashboard <project> # Worker slot status?
58
+ ```
59
+
60
+ **Possible causes**:
61
+ - Worker said "done" but didn't push code → CompletionJudge can't verify
62
+ - Branch pushed but merge conflict → slot in "merging" state, PostActions retrying
63
+ - Slot in "resolving" → AI Worker is resolving merge conflict (wait for it)
64
+ - Worker slot not released → state.json still shows active/merging
65
+ - exitCode non-zero → retry logic kicked in
66
+ - CONFLICT label → merge failed after all retries, needs human
67
+
68
+ **Fix**:
69
+ ```bash
70
+ # Check if code was pushed:
71
+ cd ~/.coral/worktrees/card-<seq> && git log --oneline -3
72
+
73
+ # Check if branch is merged:
74
+ git merge-base --is-ancestor HEAD origin/<target-branch> && echo "MERGED" || echo "NOT MERGED"
75
+
76
+ # Re-trigger completion detection:
77
+ sps pipeline tick <project> --json
78
+
79
+ # If still stuck, manual recovery:
80
+ sps pm move <project> <seq> Done
81
+ sps pm comment <project> <seq> "Manual close: code verified merged"
82
+ ```
83
+
84
+ ### New card not entering pipeline
85
+
86
+ **Symptoms**: Card created but stays in Planning, never promotes to Backlog.
87
+
88
+ **Diagnosis**:
89
+ ```bash
90
+ sps pm scan <project> Planning # Card exists?
91
+ sps scheduler tick <project> --json # Promotion blocked?
92
+ sps worker dashboard <project> --json # Idle slots available?
93
+ cat ~/.coral/projects/<project>/pipeline_order.json # Card in queue?
94
+ ```
95
+
96
+ **Possible causes**:
97
+ - Missing `AI-PIPELINE` label
98
+ - Card seq not in `pipeline_order.json`
99
+ - `CONFLICT_DEFAULT=serial` and another card is active in same domain
100
+ - No idle worker slots
101
+ - Card has `BLOCKED` or `NEEDS-FIX` label
102
+
103
+ **Fix**:
104
+ ```bash
105
+ # Verify card is in queue:
106
+ cat ~/.coral/projects/<project>/pipeline_order.json
107
+ # If missing, re-add card or edit queue manually
108
+
109
+ # Check for blocking labels in PM tool and remove if inappropriate
110
+
111
+ # Check slot availability:
112
+ sps worker dashboard <project> --json
113
+ ```
114
+
115
+ ### Card stuck in Backlog/Todo
116
+
117
+ **Symptoms**: Card promoted to Backlog but never moves to Inprogress.
118
+
119
+ **Diagnosis**:
120
+ ```bash
121
+ sps pipeline tick <project> --json # What happened?
122
+ ```
123
+
124
+ **Possible causes**:
125
+ - `MAX_ACTIONS_PER_TICK=1` — only one action per cycle, may need next cycle
126
+ - `MAX_CONCURRENT_WORKERS` was increased, but the launch budget was not
127
+ - Worktree creation failed (disk space, git permissions)
128
+ - Worker tool (claude/codex) not found in PATH
129
+ - All worker slots occupied
130
+
131
+ **Fix**:
132
+ ```bash
133
+ # Check configured concurrency and launch budget:
134
+ grep -E '^(MAX_CONCURRENT_WORKERS|MAX_ACTIONS_PER_TICK)=' ~/.coral/projects/<project>/conf
135
+
136
+ # Check worker availability:
137
+ sps worker dashboard <project> --json
138
+
139
+ # Check runtime slot count:
140
+ cat ~/.coral/projects/<project>/runtime/state.json | jq '.workers | keys'
141
+
142
+ # Manually trigger pipeline:
143
+ sps pipeline tick <project> --json
144
+
145
+ # Check worktree:
146
+ ls ~/.coral/worktrees/card-<seq>/
147
+ ```
148
+
149
+ Notes:
150
+ - `MAX_CONCURRENT_WORKERS` = total simultaneous workers allowed
151
+ - `MAX_ACTIONS_PER_TICK` = launches allowed per tick cycle
152
+ - On SPS CLI `0.18.12+`, increasing `MAX_CONCURRENT_WORKERS` auto-expands legacy worker slots in `state.json`
153
+
154
+ ---
155
+
156
+ ## Worker process failures (v0.16+)
157
+
158
+ ### Worker process crashed
159
+
160
+ **Symptoms**: Worker PID dead, card still in Inprogress.
161
+
162
+ **Diagnosis**:
163
+ ```bash
164
+ sps worker dashboard <project> # Shows dead worker
165
+ sps monitor tick <project> --json # Detects orphan
166
+ ```
167
+
168
+ **Auto-recovery**:
169
+ - PostActions auto-retry (up to `WORKER_RESTART_LIMIT`, default 2)
170
+ - If retry exhausted → card gets `NEEDS-FIX` label
171
+ - On next `sps tick` startup → Recovery module detects and processes
172
+
173
+ **Manual fix**:
174
+ ```bash
175
+ # Restart tick to trigger Recovery:
176
+ sps tick <project>
177
+
178
+ # Or manually re-process:
179
+ sps pm move <project> <seq> Todo
180
+ sps pm comment <project> <seq> "Manual retry: worker crashed"
181
+ ```
182
+
183
+ ### Worker timeout
184
+
185
+ **Symptoms**: Worker running longer than `INPROGRESS_TIMEOUT_HOURS` (default 8).
186
+
187
+ **Diagnosis**:
188
+ ```bash
189
+ sps monitor tick <project> --json # Shows timeout detection
190
+ ```
191
+
192
+ **Auto-recovery**: Monitor marks card with `STALE-RUNTIME` label.
193
+
194
+ **Manual fix**:
195
+ ```bash
196
+ # Check if worker is actually making progress:
197
+ sps logs <project> --lines 50
198
+
199
+ # If genuinely stuck, kill and retry:
200
+ kill <pid>
201
+ sps pm move <project> <seq> Todo
202
+ sps pm comment <project> <seq> "Manual retry: worker timed out"
203
+ ```
204
+
205
+ ### Orphan worker (tick exited, worker still running)
206
+
207
+ **Symptoms**: Worker process alive but tick process stopped.
208
+
209
+ **Auto-recovery**: Next `sps tick` startup → Recovery scans state.json → detects PID → resumes monitoring or processes completion.
210
+
211
+ **Manual check**:
212
+ ```bash
213
+ cat ~/.coral/projects/<project>/runtime/state.json | jq '.workers'
214
+ # Check each active worker PID:
215
+ kill -0 <pid> 2>/dev/null && echo "ALIVE" || echo "DEAD"
216
+ ```
217
+
218
+ ---
219
+
220
+ ## State consistency failures
221
+
222
+ ### PM state vs Runtime state mismatch
223
+
224
+ **Symptoms**: PM shows card in state X, but state.json shows different.
225
+
226
+ **Principle**: PM is business truth, runtime is execution truth.
227
+
228
+ **Diagnosis**:
229
+ ```bash
230
+ sps pm scan <project> # PM truth
231
+ cat ~/.coral/projects/<project>/runtime/state.json # Runtime truth
232
+ sps monitor tick <project> --json # Detects misalignment
233
+ ```
234
+
235
+ **Fix**: Use PM as source of truth:
236
+ ```bash
237
+ sps pm move <project> <seq> <correct-state>
238
+ sps pm comment <project> <seq> "State realignment: <reason>"
239
+ ```
240
+
241
+ ### Tick lock stuck
242
+
243
+ **Symptoms**: `sps tick` refuses to start — "another tick process is running".
244
+
245
+ **Diagnosis**:
246
+ ```bash
247
+ cat ~/.coral/projects/<project>/runtime/tick.lock
248
+ # Shows: PID and timestamp
249
+ kill -0 <pid> 2>/dev/null && echo "ALIVE" || echo "DEAD"
250
+ ```
251
+
252
+ **Fix** (only if owning process is dead):
253
+ ```bash
254
+ rm ~/.coral/projects/<project>/runtime/tick.lock
255
+ sps tick <project>
256
+ ```
257
+
258
+ Or wait for `TICK_LOCK_TIMEOUT_MINUTES` (default 30) — lock auto-expires.
259
+
260
+ ### Pipeline order queue stale
261
+
262
+ **Symptoms**: Cards exist in PM but pipeline doesn't process them.
263
+
264
+ **Diagnosis**:
265
+ ```bash
266
+ cat ~/.coral/projects/<project>/pipeline_order.json
267
+ sps pm scan <project> Planning
268
+ ```
269
+
270
+ **Fix**:
271
+ ```bash
272
+ # Re-create cards to add to queue:
273
+ sps card add <project> "..." "..."
274
+
275
+ # Or manually edit pipeline_order.json:
276
+ # Add missing seq numbers to the array
277
+ ```
278
+
279
+ ---
280
+
281
+ ## Skill injection failures
282
+
283
+ ### Worker not using expected skill profile
284
+
285
+ **Symptoms**: Worker output doesn't follow expected coding patterns.
286
+
287
+ **Diagnosis**:
288
+ ```bash
289
+ # Check card labels:
290
+ sps pm scan <project>
291
+ # Verify: skill:<name> label exists on the card
292
+
293
+ # Check profile file exists:
294
+ ls ~/.coral/profiles/<name>.md
295
+
296
+ # Check DEFAULT_WORKER_SKILLS:
297
+ grep DEFAULT_WORKER_SKILLS ~/.coral/projects/<project>/conf
298
+
299
+ # Check assembled prompt:
300
+ cat ~/.coral/worktrees/card-<seq>/.sps/task_prompt.txt | head -50
301
+ ```
302
+
303
+ **Possible causes**:
304
+ - Label typo (e.g., `skills:react` instead of `skill:react`)
305
+ - Profile file missing or wrong name
306
+ - `~/.coral/profiles/` directory missing (run `sps setup`)
307
+ - DEFAULT_WORKER_SKILLS not set and no card labels
308
+
309
+ **Fix**:
310
+ ```bash
311
+ # Check profiles directory:
312
+ ls ~/.coral/profiles/
313
+
314
+ # If missing, re-install profiles:
315
+ sps setup --force
316
+
317
+ # Create custom profile:
318
+ cp ~/.coral/profiles/_template.md ~/.coral/profiles/<name>.md
319
+ # Edit with domain-specific content
320
+ ```
321
+
322
+ ---
323
+
324
+ ## CLAUDE.md / AGENTS.md issues
325
+
326
+ ### Worker not following project rules
327
+
328
+ **Symptoms**: Worker produces code that doesn't follow project standards.
329
+
330
+ **Cause**: Missing or outdated CLAUDE.md in the business repo.
331
+
332
+ **Fix**:
333
+ ```bash
334
+ sps doctor <project> --fix # Generates CLAUDE.md if missing
335
+ vim ~/projects/<project>/CLAUDE.md # Customize with project standards
336
+ cd ~/projects/<project> && git add CLAUDE.md && git commit -m "chore: update worker rules"
337
+ ```
338
+
339
+ ### Worktree missing CLAUDE.md
340
+
341
+ **Cause**: CLAUDE.md was added after worktree was created.
342
+
343
+ **Fix**: Worktrees inherit from the parent repo. If CLAUDE.md was committed to the target branch, new worktrees will have it. For existing worktrees:
344
+ ```bash
345
+ cd ~/.coral/worktrees/card-<seq>
346
+ git checkout origin/<target-branch> -- CLAUDE.md
347
+ ```
348
+
349
+ ---
350
+
351
+ ## Multi-project failures
352
+
353
+ ### One project failing, others OK
354
+
355
+ Each project has fully isolated context. One project's failure does not affect others.
356
+
357
+ **Diagnosis**:
358
+ ```bash
359
+ sps worker dashboard # All projects overview
360
+ sps doctor <failing-project> --json # Check specific project
361
+ ```
362
+
363
+ ### Global worker limit reached
364
+
365
+ **Symptoms**: New cards not launching even though project has idle slots.
366
+
367
+ **Cause**: `SPS_MANAGER_MAX_WORKERS` (default 30) reached across all projects.
368
+
369
+ **Fix**:
370
+ ```bash
371
+ sps worker dashboard --json | jq '.summary'
372
+ # Check total active workers
373
+ # Either wait for workers to complete or increase limit:
374
+ export SPS_MANAGER_MAX_WORKERS=50
375
+ ```
@@ -0,0 +1,78 @@
1
+ # Label system
2
+
3
+ 任务卡的标签体系:自动标签、Skills(--skill)、conflict 域标签、系统托管的辅助状态标签。
4
+
5
+ ### 2.3 Label system
6
+
7
+ Labels control pipeline behavior. Some are automatic, some must be added manually.
8
+
9
+ ### Automatic labels (do not add manually)
10
+
11
+ | Label | Added by | Purpose |
12
+ |-------|----------|---------|
13
+ | `AI-PIPELINE` | `sps card add` | Marks card as pipeline-eligible. Only cards with this label enter automation |
14
+
15
+ ### Skills (set at card-add time via `--skill`)
16
+
17
+ Set skills with `sps card add … --skill <type>` — this writes the skill into the card frontmatter. Recommended: one skill per card. Agent 在建卡时根据任务类型自动判定。
18
+
19
+ **Task type → skill mapping:**
20
+
21
+ | Task type | `--skill` | Worker role | Deliverables |
22
+ |-----------|-------|-------------|-------------|
23
+ | 架构设计、技术方案 | `architect` | Software Architect | ADR、设计文档、目录结构、技术选型 |
24
+ | 前端开发 | `frontend` | Frontend Developer | 组件、页面、样式、前端测试 |
25
+ | 后端开发 | `backend` | Backend Developer | API、DB migration、服务端逻辑、后端测试 |
26
+ | 全栈开发(含前后端) | `fullstack` | Full-stack Developer | 前后端 + DB 一体化实现 |
27
+ | 快速原型 / MVP | `prototyper` | Rapid Prototyper | 可运行的最小可用产品 |
28
+ | 代码审查 / 优化 | `reviewer` | Code Reviewer | Review 报告 + 修复 commit |
29
+ | 安全加固 / 审计 | `security` | Security Engineer | 审计报告 + 漏洞修复 |
30
+ | 技术文档 / PRD | `writer` | Technical Writer | README、API 文档、PRD、CHANGELOG |
31
+ | 性能 / 成本优化 | `optimizer` | Performance Optimizer | Benchmark 报告 + 优化 commit |
32
+ | 通用 / 不确定 | `senior` | Senior Developer | 高质量通用实现(兜底) |
33
+
34
+ **Special skills** (语言/框架特化):
35
+
36
+ | `--skill` | Purpose |
37
+ |-------|---------|
38
+ | `typescript` | TypeScript 语言严格模式规范 |
39
+ | `phaser` | Phaser 3 游戏开发 |
40
+
41
+ **Rules:**
42
+ - 推荐一张卡片一个技能 — 避免多个 skill 之间指令冲突(`--skill a,b` 支持多个,逗号分隔)
43
+ - Agent 建卡时应根据任务描述自动判定
44
+ - 如果卡片没有指定技能,fallback 到 `DEFAULT_WORKER_SKILLS` 配置
45
+ - Skill 文件位于 `~/.coral/skills/<name>/SKILL.md`
46
+
47
+ **Project-wide default (当卡片没有 skill 标签时的 fallback):**
48
+ ```bash
49
+ # In ~/.coral/projects/<project>/conf:
50
+ export DEFAULT_WORKER_SKILLS="senior"
51
+ ```
52
+
53
+ ### Conflict domain labels (manual, optional)
54
+
55
+ Format: `conflict:<domain>`
56
+
57
+ ```
58
+ conflict:auth → cards touching auth module run serially
59
+ conflict:database → cards touching DB schema run serially
60
+ conflict:api → cards touching API routes run serially
61
+ ```
62
+
63
+ - Same-domain cards never run in parallel (prevents merge conflicts)
64
+ - Cards without conflict labels follow `CONFLICT_DEFAULT` config:
65
+ - `serial` (default): all unlabeled cards share a global domain (true serial)
66
+ - `parallel`: unlabeled cards can run in parallel (use when tasks are independent)
67
+
68
+ ### Auxiliary state labels (system-managed, do not add manually)
69
+
70
+ | Label | Set by | Meaning | Effect |
71
+ |-------|--------|---------|--------|
72
+ | `BLOCKED` | Manual or Monitor | External dependency blocks progress | Card skipped in pipeline |
73
+ | `NEEDS-FIX` | Closeout/PostActions | Worker or CI failed | Card skipped, needs manual fix |
74
+ | `WAITING-CONFIRMATION` | Worker output | Awaiting user approval | Card skipped until resolved |
75
+ | `CONFLICT` | Closeout | Git merge conflict detected | Card skipped, needs resolution |
76
+ | `STALE-RUNTIME` | Monitor | Worker process anomaly | Card skipped, auto-cleanup |
77
+
78
+ Cards with any auxiliary state label are **never launched** — they must be resolved first.
@@ -0,0 +1,61 @@
1
+ # Monitor workers
2
+
3
+ 监控 worker 的命令:项目状态、worker dashboard、确认应答、日志、PM 状态。
4
+
5
+ ## 4. Monitor workers
6
+
7
+ ### Project status overview
8
+
9
+ ```bash
10
+ sps status # List all projects with tick/worker status
11
+ sps status --json # JSON output
12
+ ```
13
+
14
+ ### Worker dashboard
15
+
16
+ ```bash
17
+ sps worker dashboard # Real-time TUI (all projects)
18
+ sps worker dashboard <project> # Filter to specific project
19
+ sps worker dashboard --once # Single snapshot
20
+ sps worker dashboard --json # JSON output for scripts
21
+ ```
22
+
23
+ **Dashboard keyboard shortcuts:**
24
+ - `q` — quit
25
+ - `r` — force refresh
26
+ - `:` — enter respond mode (when Workers have pending confirmations)
27
+
28
+ **Responding to Worker confirmations in dashboard:**
29
+ ```
30
+ When a Worker needs confirmation, bottom bar shows numbered pending list:
31
+ Pending confirmations:
32
+ 1. brick/worker-1 DANGEROUS: Execute rm -rf node_modules [1=Yes, 2=No, 3=Always]
33
+
34
+ Press `:` then type: <number> <option>
35
+ 1 3 → send option 3 to pending #1
36
+ 1 1 → send option 1 (default) to pending #1
37
+ Enter to send, Escape to cancel
38
+ ```
39
+
40
+ ### Worker confirmations (CLI)
41
+
42
+ ```bash
43
+ sps acp pending <project> # List pending confirmations
44
+ sps acp respond <project> <slot> "<reply>" # Send response
45
+ ```
46
+
47
+ ### View logs
48
+
49
+ ```bash
50
+ sps logs <project> # Real-time log viewer (pm2-style)
51
+ sps logs <project> --err # Error logs only
52
+ sps logs <project> --lines 50 # Last 50 lines
53
+ ```
54
+
55
+ ### Inspect PM state
56
+
57
+ ```bash
58
+ sps pm scan <project> # All cards
59
+ sps pm scan <project> Inprogress # Filter by state
60
+ sps pm scan <project> Todo # Filter by state
61
+ ```
@@ -0,0 +1,74 @@
1
+ # MR mode, recovery & extras
2
+
3
+ MR 合并流、恢复原则、worker rules 文件、项目知识传递,以及附加接口(console/graph/memory 等)。
4
+
5
+ ## 6. MR mode and merge flow (v0.19+)
6
+
7
+ | MR_MODE | Worker does | PostActions does | Use case |
8
+ |---------|------------|------------------|----------|
9
+ | `none` (default) | code → push → say "done" | Serial merge queue (rebase + merge) | Fully automated |
10
+ | `create` | code → push → say "done" | Create GitLab MR | Requires human review |
11
+
12
+ **Worker does NOT run merge.** Merge is handled by PostActions (serial via MergeMutex):
13
+
14
+ ```
15
+ Worker A/B/C code in parallel → push → exit
16
+
17
+ PostActions serial merge queue (one at a time):
18
+ L0: fetch + rebase + merge (pure git) → success → Done
19
+ L1: rebase conflict → abort
20
+ L2: spawn --resume Worker to resolve conflict → retry L0
21
+ L3: all retries exhausted → CONFLICT label → human
22
+ ```
23
+
24
+ Slot status during merge: `merging` (waiting/executing) or `resolving` (AI fixing conflict). New cards are NOT assigned to these slots.
25
+
26
+ ---
27
+
28
+ ## 8. Recovery principles
29
+
30
+ - Respect SPS as the state authority
31
+ - Do not mutate multiple layers blindly at once
32
+ - Prefer one corrective move, then re-inspect
33
+ - Record meaningful interventions using PM comments
34
+ - Do not reintroduce legacy shell entrypoints as the main interface
35
+ - Do not treat worker completion as sufficient without SPS confirmation
36
+ - On tick restart, Recovery automatically detects orphan workers (PID scan + state.json), judges completion, and executes post-actions
37
+ - Worker processes survive tick restart (detached mode with fd redirect) — next tick picks up where the previous left off
38
+ - CompletionJudge checks: marker file → branch pushed → already merged (merge-base) → auto-push → keywords
39
+
40
+ ---
41
+
42
+ ## 9. Worker rules files
43
+
44
+ `sps doctor --fix` generates and commits these files to the business repo:
45
+
46
+ | File | Purpose | In git |
47
+ |------|---------|--------|
48
+ | `CLAUDE.md` | Project rules for Claude Code workers | Yes |
49
+ | `.sps/task_prompt.txt` | Per-task prompt (auto-generated per worktree) | No (.gitignore) |
50
+ | `.sps/merge.sh` | Merge/MR script (auto-generated, manual fallback only) | No (.gitignore) |
51
+ | `docs/DECISIONS.md` | Architecture decisions from previous workers | Yes (auto-maintained) |
52
+ | `docs/CHANGELOG.md` | Change log from previous workers | Yes (auto-maintained) |
53
+
54
+ These files are inherited by all git worktrees. SPS will not overwrite an existing CLAUDE.md.
55
+
56
+ ---
57
+
58
+ ## 10. Project knowledge transfer
59
+
60
+ Each worker is instructed to:
61
+ - **Before coding**: read `docs/DECISIONS.md` and `docs/CHANGELOG.md` for context
62
+ - **After coding**: append architecture decisions and change summaries
63
+
64
+ Files are merged to the target branch with the code, so the next worker inherits all accumulated knowledge.
65
+
66
+ ---
67
+
68
+ ## 11. Additional interfaces
69
+
70
+ - **Web console** — `sps console [--port N] [--no-open] [--kill]` launches the local SPS Console UI (board, chat, logs) in the browser.
71
+ - **Code graph** — `sps graph build|sync|status|explore|impact <...>` builds a project-level code graph (codegraph). `sps graph explore <keyword>` is the token-cheap way for a worker to pull an entry point + related symbols + call chains.
72
+ - **Project memory** — `sps memory list|search|add|ingest|context <project>` manages per-project memory (agentmemory-backed); memory is auto-injected into worker prompts.
73
+ - **Skills** — `sps skill list|add|remove|sync` manages worker skills (see section 5).
74
+ - **Reset / re-run** — `sps reset <project> [--all] [--card N,N]` resets card state and cleans its worktree + branch for a fresh run.