@coralai/sps-cli 0.52.2 → 0.53.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.
Files changed (86) hide show
  1. package/README-CN.md +457 -131
  2. package/README.md +460 -131
  3. package/dist/commands/agentCommand.js +1 -1
  4. package/dist/commands/agentCommand.js.map +1 -1
  5. package/dist/commands/agentRenderer.d.ts +1 -1
  6. package/dist/commands/agentRenderer.d.ts.map +1 -1
  7. package/dist/commands/skillCommand.js +14 -14
  8. package/dist/commands/skillCommand.js.map +1 -1
  9. package/dist/console/routes/chat.d.ts.map +1 -1
  10. package/dist/console/routes/chat.js +12 -3
  11. package/dist/console/routes/chat.js.map +1 -1
  12. package/dist/console/routes/fs.js +2 -2
  13. package/dist/console/routes/fs.js.map +1 -1
  14. package/dist/console-assets/assets/index-CoAkaUkW.css +10 -0
  15. package/dist/console-assets/assets/index-p6b8pcpR.js +557 -0
  16. package/dist/console-assets/index.html +2 -2
  17. package/dist/core/claudeJsonl.d.ts +43 -0
  18. package/dist/core/claudeJsonl.d.ts.map +1 -0
  19. package/dist/core/claudeJsonl.js +187 -0
  20. package/dist/core/claudeJsonl.js.map +1 -0
  21. package/dist/core/runtimeSnapshot.d.ts +1 -1
  22. package/dist/core/runtimeSnapshot.d.ts.map +1 -1
  23. package/dist/core/runtimeStore.d.ts +1 -1
  24. package/dist/core/runtimeStore.d.ts.map +1 -1
  25. package/dist/core/sessionContext.d.ts +1 -1
  26. package/dist/core/sessionContext.d.ts.map +1 -1
  27. package/dist/core/sessionLiveness.d.ts +1 -1
  28. package/dist/core/sessionLiveness.d.ts.map +1 -1
  29. package/dist/core/state.d.ts +1 -1
  30. package/dist/core/state.d.ts.map +1 -1
  31. package/dist/core/wiki/hot.js +2 -2
  32. package/dist/core/wiki/hot.js.map +1 -1
  33. package/dist/core/wiki/reader.js +4 -4
  34. package/dist/core/wiki/reader.js.map +1 -1
  35. package/dist/core/wiki/scaffold.js +1 -1
  36. package/dist/core/wiki/types.d.ts +50 -50
  37. package/dist/daemon/daemonClient.d.ts +2 -2
  38. package/dist/daemon/daemonClient.d.ts.map +1 -1
  39. package/dist/engines/MonitorEngine.js.map +1 -1
  40. package/dist/main.js +40 -40
  41. package/dist/main.js.map +1 -1
  42. package/dist/manager/worker-manager-impl.d.ts +1 -1
  43. package/dist/manager/worker-manager-impl.d.ts.map +1 -1
  44. package/dist/providers/ACPWorkerRuntime.d.ts +5 -5
  45. package/dist/providers/ACPWorkerRuntime.d.ts.map +1 -1
  46. package/dist/providers/ACPWorkerRuntime.js +1 -1
  47. package/dist/providers/ACPWorkerRuntime.js.map +1 -1
  48. package/dist/providers/MarkdownTaskBackend.d.ts +2 -6
  49. package/dist/providers/MarkdownTaskBackend.d.ts.map +1 -1
  50. package/dist/providers/MarkdownTaskBackend.js +20 -32
  51. package/dist/providers/MarkdownTaskBackend.js.map +1 -1
  52. package/dist/providers/registry.d.ts +1 -1
  53. package/dist/providers/registry.d.ts.map +1 -1
  54. package/dist/services/CardService.js +11 -11
  55. package/dist/services/CardService.js.map +1 -1
  56. package/dist/services/ChatService.d.ts +31 -1
  57. package/dist/services/ChatService.d.ts.map +1 -1
  58. package/dist/services/ChatService.js +149 -33
  59. package/dist/services/ChatService.js.map +1 -1
  60. package/dist/services/LogService.js +2 -2
  61. package/dist/services/LogService.js.map +1 -1
  62. package/dist/services/PipelineService.js +29 -29
  63. package/dist/services/PipelineService.js.map +1 -1
  64. package/dist/services/ProjectService.js +16 -16
  65. package/dist/services/ProjectService.js.map +1 -1
  66. package/dist/services/SkillService.js +9 -9
  67. package/dist/services/SkillService.js.map +1 -1
  68. package/dist/services/SystemService.js +9 -9
  69. package/dist/services/SystemService.js.map +1 -1
  70. package/dist/services/WorkerService.js +7 -7
  71. package/dist/services/WorkerService.js.map +1 -1
  72. package/dist/services/executors.d.ts +1 -0
  73. package/dist/services/executors.d.ts.map +1 -1
  74. package/dist/services/executors.js +7 -0
  75. package/dist/services/executors.js.map +1 -1
  76. package/dist/shared/runtimePaths.d.ts +8 -0
  77. package/dist/shared/runtimePaths.d.ts.map +1 -1
  78. package/dist/shared/runtimePaths.js +22 -0
  79. package/dist/shared/runtimePaths.js.map +1 -1
  80. package/dist/shared/runtimeSchemas.d.ts +14 -14
  81. package/package.json +7 -3
  82. package/skills/sps-memory/SKILL.md +1 -1
  83. package/skills/sps-pipeline/SKILL.md +19 -19
  84. package/LICENSE +0 -21
  85. package/dist/console-assets/assets/index-Bf8zeTg0.js +0 -566
  86. package/dist/console-assets/assets/index-j5Dtsmq0.css +0 -10
package/README.md CHANGED
@@ -1,218 +1,547 @@
1
- # SPS CLI
1
+ # SPS CLI — AI Agent Harness & Development Pipeline
2
2
 
3
- [![npm](https://img.shields.io/npm/v/@coralai/sps-cli)](https://www.npmjs.com/package/@coralai/sps-cli) [![license](https://img.shields.io/npm/l/@coralai/sps-cli)](./LICENSE)
3
+ [![npm](https://img.shields.io/npm/v/@coralai/sps-cli)](https://www.npmjs.com/package/@coralai/sps-cli) [![license](https://img.shields.io/npm/l/@coralai/sps-cli)](../../LICENSE)
4
4
 
5
- > 中文文档:[README-CN.md](./README-CN.md)
5
+ > **中文文档**:[README-CN.md](./README-CN.md)
6
6
 
7
- ## 1. Introduction
7
+ **v0.51.3**
8
8
 
9
- SPS (Smart Pipeline System) is an open-source **AI-agent harness** that turns a single-line task into reviewed, committed, deployable output. It drives an underlying agent through a card-based pipeline plan, execute, review, ship with a per-project knowledge base auto-injected into every prompt.
9
+ SPS (Smart Pipeline System) drives a Claude Code worker through task cardscode, commit, push, QA, merge, all automated. Three modes:
10
10
 
11
- ### 24/7 unattended software development
11
+ | Mode | Command | When |
12
+ |---|---|---|
13
+ | **Harness** | `sps agent` | Zero-config — one-shot or multi-turn chat with Claude. No project, no PM. |
14
+ | **Pipeline** | `sps tick <project>` | Automated card-driven workflow with YAML-configurable stages. |
15
+ | **Console** | `sps console` | Web UI — kanban, logs, workers, projects, chat (since v0.44). |
12
16
 
13
- Drop tasks into the backlog and the harness runs them around the clock — planning, coding, testing, committing, opening MRs, escalating only when truly blocked. While you sleep, the pipeline ticks; your morning standup reads the merged commits. SPS exists so a single human can run a development team's worth of work without sitting in front of a chat window.
17
+ The headline feature in v0.51 is the **Wiki Knowledge Base** opt-in per project, structured cross-linked pages (modules / concepts / decisions / lessons / sources), 5-layer retrieval auto-injected into worker prompts. See [doc-28](../../docs/design/28-wiki-system.md) and [`ATTRIBUTION.md`](./ATTRIBUTION.md).
14
18
 
15
- ### Beyond software — extensible to any domain via skills
19
+ ---
16
20
 
17
- The pipeline, skills, and knowledge layer are intentionally generic. Any process that can be expressed as "task in → reviewed output out" can be wired up by swapping the skill bundle:
21
+ ## Table of contents
18
22
 
19
- - **Accounting** invoice intake → categorization → ledger reconciliation → period close
20
- - **Self-media** topic research → drafting → review → publishing
21
- - **AI video generation** — script → storyboard → render → cut → review
22
- - **Writing** research → outline → draft → revise → publish
23
- - **Any other workflow** — define stages in YAML, write skills in markdown; the harness runs them
23
+ - [Install & setup](#install--setup)
24
+ - [Harness mode (`sps agent`)](#harness-mode-sps-agent)
25
+ - [Console mode (`sps console`)](#console-mode-sps-console)
26
+ - [Pipeline mode (`sps tick`)](#pipeline-mode-sps-tick)
27
+ - [Card lifecycle](#card-lifecycle)
28
+ - [Memory + Wiki](#memory--wiki)
29
+ - [Skills](#skills)
30
+ - [Command reference](#command-reference)
31
+ - [Project config (conf)](#project-config-conf)
32
+ - [Project layout](#project-layout)
33
+ - [Architecture](#architecture)
34
+ - [Troubleshooting](#troubleshooting)
24
35
 
25
- One CLI, one console, one filesystem-driven workflow. No vendor lock-in.
36
+ ---
26
37
 
27
- ![CLI](docs/screenshots/01-cli-banner.png)
38
+ ## Install & setup
28
39
 
29
- ## 2. Core Concepts
40
+ ```bash
41
+ npm install -g @coralai/sps-cli # latest 0.51.x
42
+ sps setup # interactive wizard (must run once)
43
+ ```
30
44
 
31
- ### Harness
32
- A long-running shell around the AI agent: daemon, supervisor, transport, profile management, file-system task lifecycle. The agent focuses on writing code; the harness owns the infrastructure.
45
+ `sps setup`:
46
+ 1. Creates `~/.coral/` directory tree (`projects/`, `memory/{user,agents}/`).
47
+ 2. Copies bundled skills → `~/.coral/skills/`.
48
+ 3. Asks for `GITLAB_URL` / `GITLAB_TOKEN` / `MATRIX_*` (optional) → writes `~/.coral/env`.
49
+ 4. Symlinks user skills → `~/.claude/skills/`.
50
+ 5. Installs `@agentclientprotocol/claude-agent-acp` globally.
33
51
 
34
- ### Pipeline
35
- Each task is a **card** that flows through stages: `Backlog → Planning → Todo → Inprogress → QA → Done`. Every stage has its own prompt, allowed tools, exit gates — all configurable in YAML.
52
+ Re-run safe with `sps setup --force` (keeps existing values as defaults). After upgrading sps-cli later, run **`sps skill sync --force`** to pull updated skill SOPs (default sync is non-destructive — won't overwrite existing skills).
36
53
 
37
- ### Skills
38
- Stages dispatch atomic **skills** to drive each task — `sps-pipeline`, `wiki-update`, `git-commit`, persona skills, and 24 dev skills bundled. Skills compose without ballooning the system prompt; the harness loads only what the current stage needs.
54
+ **Prerequisites**: Node ≥ 18; an Anthropic API key (or Claude Pro / Max subscription); `claude` CLI in PATH.
39
55
 
40
- ### Memory
41
- A 3-layer markdown-on-disk persistence for **non-obvious, reusable facts** that should survive across sessions. Lives entirely under `~/.coral/memory/`; auto-injected into every pipeline worker prompt by `StageEngine`.
56
+ ---
42
57
 
43
- | Layer | Path | Scope |
44
- |---|---|---|
45
- | **User** | `~/.coral/memory/user/` | Cross-project preferences (style, language, workflow habits) |
46
- | **Agent** | `~/.coral/memory/agents/<id>/` | Per-agent observations (communication patterns specific to one agent ↔ user pair) |
47
- | **Project** | `~/.coral/memory/projects/<name>/` | Per-project conventions, architecture decisions, lessons, references |
58
+ ## Harness mode (`sps agent`)
59
+
60
+ Direct one-shot or multi-turn chat with Claude. No project, no PM, no Git.
61
+
62
+ ```bash
63
+ # One-shot
64
+ sps agent "Explain this repo"
65
+ sps agent --output summary.md "Summarize the architecture"
66
+
67
+ # Multi-turn (daemon-backed, persistent sessions)
68
+ sps agent --chat # interactive REPL
69
+ sps agent --chat --name reviewer # named session, resume later
70
+ sps agent status # list active sessions
71
+ sps agent close --name reviewer
72
+
73
+ # Profile + context files
74
+ sps agent --profile reviewer "Review this module" --context src/auth.ts --context src/auth.test.ts
75
+ sps agent --system "You are a release engineer" "Plan the v0.52 cut"
76
+
77
+ # Verbose
78
+ sps agent --verbose "Why did this build fail?"
79
+ ```
48
80
 
49
- Four entry types `convention` (never decays), `decision` (slow), `lesson` (30-day decay), `reference` (never decays). Each layer keeps a flat directory of `*.md` files plus a `MEMORY.md` index. The agent reads it on demand and writes back when it discovers something worth keeping a sparse, private drift; complementary to the dense, shared Wiki below.
81
+ **`--profile <name>`**: looks up `~/.coral/skills/dev-worker/references/<name>.md`, injects as system prompt. (Different from `sps skill add` — that's for project-level skill linking.)
50
82
 
51
- ### Knowledge Base LLM Wiki
83
+ **Built-in agent**: `claude` only (Codex / Gemini support removed in v0.38). Workers communicate via ACP JSON-RPC over stdio with `claude-agent-acp`.
52
84
 
53
- Inspired by Andrej Karpathy's "LLM Wiki": instead of re-reading source code from scratch every session, the agent **distills** project knowledge into a persistent, structured wiki that primes every future prompt.
85
+ **Agent skills auto-loaded by Claude Code**: `~/.claude/skills/` is scanned by `claude` itself including `sps-pipeline`, `sps-memory`, `wiki-update`, and the 24 dev/persona skills. Skill descriptions trigger lazy load; no SPS prompt injection needed for harness mode.
54
86
 
55
- **The problem**: An AI agent re-discovering your codebase on every task burns tokens, misses non-obvious decisions, and walks into the same gotcha twice. Most of the knowledge in a codebase is implicit in commit context, in design tradeoffs, in incident postmortems that never made it back into the source.
87
+ **Daemon cwd caveat**: `sps console` and `sps agent --chat` start a session daemon (`~/.coral/sessions/daemon.sock`) that captures `process.cwd()` at startup and uses it as the default working directory for all chat workers. To switch the chat's working directory, restart the daemon: `sps agent daemon stop && sps agent daemon start` from the desired cwd.
56
88
 
57
- **The wiki**: Workers continuously distill code, design docs, and completed cards into atomic, cross-linked pages:
89
+ ---
58
90
 
59
- | Page type | What it captures |
91
+ ## Console mode (`sps console`)
92
+
93
+ Local web UI bundled into the binary. Single-instance guard via `~/.coral/console.lock`.
94
+
95
+ ```bash
96
+ sps console # opens http://127.0.0.1:4311
97
+ sps console --port 5000
98
+ sps console --no-open # don't auto-open browser
99
+ sps console --kill # stop running console
100
+ sps console --dev # vite dev server (development)
101
+ ```
102
+
103
+ Pages:
104
+
105
+ | Path | Purpose |
60
106
  |---|---|
61
- | `modules/` | What each component does and how it's used |
62
- | `concepts/` | Recurring patterns and architectural primitives |
63
- | `decisions/` | Why a specific choice was made (with version anchor) |
64
- | `lessons/` | Non-obvious gotchas surfaced from incidents |
65
- | `sources/` | Distilled summaries of external materials added to `.raw/` (PDFs, articles, transcripts) |
107
+ | `/projects` | List all projects with status |
108
+ | `/projects/new` | Create project (form has Wiki toggle, v0.51+) |
109
+ | `/projects/<n>` | Pipeline editor + conf editor + delete |
110
+ | `/board` | Kanban (per-column scrolling, v0.51.1+) |
111
+ | `/workers` | Aggregate worker dashboard across projects |
112
+ | `/logs` | Live SSE log viewer |
113
+ | `/skills` | User-level skill management |
114
+ | `/system` | Global settings + daemon status |
115
+ | `/chat` | Agent chat (multi-session, persistent) |
116
+
117
+ Tech: Hono server on `127.0.0.1:4311`, chokidar watchers pushing SSE to React 19 + Vite + Tailwind v4 + shadcn/ui frontend. Design system: Pastel Neubrutalism, locked in [`console/DESIGN.md`](./console/DESIGN.md).
118
+
119
+ ---
66
120
 
67
- **Self-maintaining**: After each card, the worker auto-writes back any new lessons or module changes — no manual curation. SOP lives in `skills/wiki-update/` and follows a 4-question filter (module changed? decision made? lesson learned? new pattern?). Four NOs = no write.
121
+ ## Pipeline mode (`sps tick`)
68
122
 
69
- **Self-retrieving**: Every card prompt receives 5-layer auto-injection (~2K tokens) so the worker starts informed:
123
+ Fully automated card-driven workflow. **One worker, one card at a time, serial.** Each card walks one or more YAML-defined stages (e.g. `develop → review → Done`); failure halts pipeline until you remove the `NEEDS-FIX` label.
70
124
 
71
- - **L1** `hot.md` — recent context (~500 tokens)
72
- - **L2** `index.md` excerpt — top-30 page TL;DRs (~500 tokens)
73
- - **L3** pinned pages — explicitly referenced in card frontmatter
74
- - **L4** skill-tag matches — pages tagged with the card's active skills
75
- - **L5** BM25F keyword fallback — top-3 by title/desc
125
+ ### Create a project
76
126
 
77
- **Compounds over time**: Each completed card adds to the corpus. The longer a project runs, the better workers understand it without reading raw source. Old workers' lessons prime new workers — the wiki *is* the project's institutional memory.
127
+ ```bash
128
+ sps project init my-app
129
+ # or use Console /projects/new — has a Wiki toggle (v0.51+)
130
+ ```
131
+
132
+ Asks for: project dir, merge branch, max workers, ACK timeout, optional GitLab remote, optional Matrix room.
133
+
134
+ Generates:
78
135
 
79
- **Obsidian-compatible**: Stored at `<repo>/wiki/` with `[[wikilink]]` syntax and flat YAML frontmatter. Open the directory as an Obsidian vault for graph view, backlinks, and full-text search out of the box.
136
+ ```
137
+ ~/.coral/projects/my-app/
138
+ ├── conf # mode 600 — your active config
139
+ ├── conf.example # full reference (read-only docs)
140
+ ├── pipelines/
141
+ │ ├── project.yaml # default 1-stage pipeline (develop → Done)
142
+ │ └── sample.yaml.example # heavily-commented YAML reference
143
+ └── pipeline_order.json # active pipeline pointer
144
+ ```
80
145
 
81
- ### Agent Mode
82
- SPS is **agent-agnostic**. Any coding agent that can read a skill and shell out — Claude Code, Codex, OpenClaw, your own — can drive SPS through the bundled `sps-pipeline` skill. The harness adapts to the agent, not the other way around. Wiring up a new agent means dropping a skill file; no SPS code change required. See [§6](#6-supported-agents) for the integration matrix.
146
+ In the target repo (PROJECT_DIR):
83
147
 
84
- ## 3. Console
148
+ ```
149
+ .claude/CLAUDE.md # worker rules (auto-installed)
150
+ .claude/skills/ # symlinked from ~/.coral/skills/
151
+ .claude/settings.local.json # Claude Code local config
152
+ wiki/ # if WIKI_ENABLED — see doc-28
153
+ ATTRIBUTION.md # if WIKI_ENABLED
154
+ ```
85
155
 
86
- Launch the local web UI:
156
+ ### Run
87
157
 
88
158
  ```bash
89
- sps console # opens http://127.0.0.1:4311
90
- sps console --port 5000 # custom port
91
- sps console --no-open # don't auto-open the browser
92
- sps console --kill # stop a running console
159
+ sps tick my-app # foreground tick loop
160
+ sps pipeline start my-app # alias
161
+ sps pipeline stop my-app # graceful stop (alias: sps stop my-app)
162
+ sps stop --all # stop all running ticks
163
+ sps status # all projects
93
164
  ```
94
165
 
95
- Single command, no extra services — board, chat, skills, workers, logs, projects all in one place.
166
+ ### Pipeline YAML
167
+
168
+ `~/.coral/projects/<n>/pipelines/project.yaml` — single source of truth for stages.
169
+
170
+ ```yaml
171
+ mode: project
172
+ git: true # false = non-code project, no git ops
173
+ stages:
174
+ - name: develop
175
+ profile: fullstack
176
+ on_complete: "move_card Review"
177
+ on_fail: { action: "label NEEDS-FIX", halt: true }
178
+ - name: review
179
+ profile: reviewer
180
+ on_complete: "move_card Done"
181
+ on_fail: { action: "label REVIEW-FAILED", halt: true }
182
+ ```
183
+
184
+ Critical rules:
185
+ 1. `mode: project` for state-machine pipelines; `mode: steps` for one-shot custom (use `sps pipeline run <name>`).
186
+ 2. Each stage's `on_complete` must point to the **next** stage's target state.
187
+ 3. Last stage's `on_complete: "move_card Done"`.
188
+ 4. Don't write `agent:` field — it's silently ignored (v0.38+ Claude is the only worker).
189
+ 5. `trigger` and `card_state` are auto-derived per stage.
190
+
191
+ Field reference: see `~/.coral/projects/<n>/pipelines/sample.yaml.example` (auto-generated, comment-rich) or [doc-17](../../docs/design/17-pipeline-configuration-design.md).
192
+
193
+ ---
96
194
 
97
- **Board card-driven workflow at a glance**
195
+ ## Card lifecycle
98
196
 
99
- ![Console — Board](docs/screenshots/02-kanban.png)
197
+ ```
198
+ Backlog → Todo → Inprogress → [QA / Review] → Done
199
+ ↑↓ ↓ fail
200
+ Planning NEEDS-FIX (halt)
201
+ (manual park, v0.51.9+)
202
+ ```
100
203
 
101
- **Chat — multi-turn agent conversations with tool-call streaming**
204
+ **v0.51.10**: caller-aware default state.
205
+ - **`sps card add` (CLI / agent / API default)** → **Backlog**(自动跑)
206
+ - **Console "新卡片" 表单(人在 UI 操作)** → **Planning**(暂存,等用户拖到 Backlog)
102
207
 
103
- ![Console — Chat](docs/screenshots/03-chat.png)
208
+ CLI 用户想暂存:`sps card add ... --draft`。Console 用户想立即跑:勾"立即派发执行"。
209
+ 卡片严格按 seq 排序;不再有 pipeline_order.json。
104
210
 
105
- **Skills bundled & per-project skill management**
211
+ Default states (configurable via YAML `pm.card_states`).
106
212
 
107
- ![Console — Skills](docs/screenshots/04-skills.png)
213
+ ```bash
214
+ sps card add <p> "Title" "Description"
215
+ sps card add <p> "T" "D" --skills python,backend --labels feature
108
216
 
109
- **Workers capacity, runtime, stage-by-stage logs**
217
+ sps card dashboard <p> # CLI table
218
+ # console: /board?project=<n>
110
219
 
111
- ![Console Workers](docs/screenshots/05-workers.png)
220
+ sps card mark-started <p> <seq> # called by Claude Code UserPromptSubmit hook
221
+ sps card mark-complete <p> <seq> # called by Claude Code Stop hook
112
222
 
113
- ## 4. Install
223
+ sps reset <p> # reset all non-Done cards
224
+ sps reset <p> --card 5,6,7
225
+ sps reset <p> --all # full reset incl. Done + worktrees + branches
226
+ ```
227
+
228
+ ### Card label vocabulary
229
+
230
+ | Label | Meaning | Set by |
231
+ |---|---|---|
232
+ | `AI-PIPELINE` | Required to enter pipeline | User on creation |
233
+ | `STARTED-<stage>` | ACK signal — Claude received the prompt | UserPromptSubmit hook |
234
+ | `COMPLETED-<stage>` | Worker finished a stage | Stop hook |
235
+ | `CLAIMED` | StageEngine reserved a worker slot | Engine |
236
+ | `NEEDS-FIX` | Worker failed; pipeline halted | Engine |
237
+ | `BLOCKED` | External dep; pipeline skips | User |
238
+ | `WAITING-CONFIRMATION` | Worker waiting on user input | Engine |
239
+ | `STALE-RUNTIME` | Inprogress > timeout | MonitorEngine |
240
+ | `ACK-TIMEOUT` | Claude never ACK'd within `WORKER_ACK_TIMEOUT_S` | MonitorEngine |
241
+ | `skill:<name>` | Force-load specific skill | User |
242
+ | `conflict:<domain>` | Serial-with-others-in-same-domain | User |
243
+
244
+ The active stage writes a per-slot marker file at `~/.coral/projects/<p>/runtime/worker-<slot>-current.json` (v0.50.21+). Stop hook reads it to detect which card the worker just finished.
245
+
246
+ ---
247
+
248
+ ## Memory + Wiki
249
+
250
+ Two complementary persistence systems, both auto-injected into worker prompts.
251
+
252
+ | | **Memory** | **Wiki** (v0.51+) |
253
+ |---|---|---|
254
+ | Path | `~/.coral/memory/{user,agents,projects/<p>}/` | `<repo>/wiki/` (per-project, in repo) |
255
+ | Format | Flat markdown + YAML frontmatter | 5 page types with zod-validated frontmatter |
256
+ | Cross-link | None (flat index) | `[[type/Title]]` wikilinks |
257
+ | Auto-inject | `knowledge` section of prompt | `wikiContext` section (5-layer retrieval) |
258
+ | Opt-in | Always on (toggle via `ENABLE_MEMORY=false`) | Per-project (`WIKI_ENABLED=true`) |
259
+ | Best for | Personal prefs, ad-hoc decisions, gotchas | Structured project knowledge: modules, concepts, decisions, lessons |
260
+
261
+ ### Memory CLI
114
262
 
115
263
  ```bash
116
- # Install
117
- npm install -g @coralai/sps-cli
118
- sps setup # one-time interactive wizard
264
+ sps memory list <p> # show project memory index
265
+ sps memory list # global view (user + agents)
266
+ sps memory context <p> --card <seq> # preview prompt injection
119
267
 
120
- # Update
121
- npm update -g @coralai/sps-cli
122
- sps skill sync --force # pull updated skill SOPs after upgrade
268
+ sps memory add <p> --type convention --name "API uses camelCase" \
269
+ --description "REST endpoints use camelCase" --body "..."
123
270
  ```
124
271
 
125
- ### Build from source
272
+ Types: `convention` (no decay), `decision` (slow), `lesson` (30 days), `reference` (no decay).
273
+
274
+ ### Wiki CLI (when `WIKI_ENABLED=true`)
126
275
 
127
276
  ```bash
128
- git clone https://github.com/edwardZhang/sps-cli.git
129
- cd sps-cli
130
- npm install
131
- npm run build # tsc + console assets
132
- npm link # symlink `sps` to local build
277
+ sps wiki init <p> # scaffold wiki/ (auto on project init if toggled on)
278
+ sps wiki update <p> # show source diff
279
+ sps wiki update <p> --finalize # flush manifest after worker writes pages
280
+ sps wiki check <p> # lint: orphan / dead-link / fm-gap / stale
281
+ sps wiki list <p> --type lesson --tag pipeline
282
+ sps wiki get <p> lessons/Stop-Hook-Race
283
+ sps wiki status <p> # source ↔ manifest ↔ pages diff
284
+ sps wiki add <p> ~/notes.md --category transcripts
285
+ sps wiki read <p> "<query>" # preview the 5-layer retrieval
133
286
  ```
134
287
 
135
- ### Prerequisites
288
+ The 5-layer retrieval: hot.md / index summary / pinned / skill-tag / BM25F keyword. Type priority: lesson = 3, decision = 3, concept = 2, module = 1, source = 1. Token budget capped at ~2000.
136
289
 
137
- - **Node.js 18**
138
- - **A working Claude Code installation locally.** Run `claude --help` first — if that works for you, SPS will work. SPS does not care **how** you authenticate Claude Code:
139
- - Anthropic API key (`ANTHROPIC_API_KEY`)
140
- - Claude Pro / Max subscription
141
- - Third-party API gateway / proxy
142
- - Any other auth method Claude Code supports
290
+ Worker SOP: [`skills/wiki-update/SKILL.md`](./skills/wiki-update/SKILL.md) (300 lines, single source of truth).
143
291
 
144
- SPS spawns `claude` over the Agent Client Protocol; it inherits whatever credentials you've already configured. No separate SPS-side API key needed.
292
+ ---
145
293
 
146
- ## 5. Quick Start
294
+ ## Skills
147
295
 
148
- ### Step 1 Run the setup wizard (one time)
296
+ User-level skills live in `~/.coral/skills/` (28 bundled, copied from npm package on `sps setup`). Symlinked into `~/.claude/skills/` so Claude Code auto-loads them.
149
297
 
150
298
  ```bash
151
- sps setup
299
+ sps skill list # what's available + project status
300
+ sps skill add <name> --project <p> # symlink into <repo>/.claude/skills/
301
+ sps skill remove <name> --project <p>
302
+ sps skill freeze <name> --project <p> # symlink → real copy (allow project edits)
303
+ sps skill unfreeze <name> --project <p> # back to symlink
304
+ sps skill sync # ① bundled (npm pkg) → ~/.coral/skills/
305
+ # ② ~/.coral/skills/ → ~/.claude/skills/
306
+ sps skill sync --force # ⭐ overwrite existing user skills (after sps-cli upgrade)
152
307
  ```
153
308
 
154
- The wizard:
155
- - Creates `~/.coral/{projects,memory,sessions,skills}/` directory tree
156
- - Copies bundled skills into `~/.coral/skills/` and symlinks them into `~/.claude/skills/` so Claude Code picks them up
157
- - Installs `@agentclientprotocol/claude-agent-acp` globally so `claude` can be driven over ACP
158
- - Optionally writes `~/.coral/env` (GitLab token, Matrix notification, etc. — all optional)
309
+ Bundled skills (v0.51.3):
310
+
311
+ - **Dev (23)**: `frontend`, `frontend-developer`, `backend`, `backend-architect`, `typescript`, `golang`, `rust`, `python`, `java`, `kotlin`, `swift`, `mobile`, `database`, `database-optimizer`, `qa-tester`, `security-engineer`, `architecture-decision-records`, `coding-standards`, `debugging-workflow`, `devops`, `devops-automator`, `git-workflow`, `code-reviewer`
312
+ - **Worker profiles (3)**: `dev-worker`, `tax-worker`, `reviewer` (referenced via `--profile`)
313
+ - **SPS-specific (5)**: `sps-pipeline`, `sps-memory`, `wiki-update`
159
314
 
160
- Re-runnable safely: `sps setup --force` keeps existing values as defaults. After upgrading sps-cli later, run **`sps skill sync --force`** to pull updated skill SOPs.
315
+ ---
161
316
 
162
- ### Step 2 — Smoke-test with the agent (no project needed)
317
+ ## Command reference
163
318
 
164
319
  ```bash
165
- sps agent "Explain this repo" # one-shot
166
- sps agent --chat # multi-turn REPL, persistent session
320
+ # Setup & projects
321
+ sps setup [--force]
322
+ sps project init <name>
323
+ sps project doctor <name> [--fix] [--json] [--reset-state] [--skip-remote]
324
+ sps doctor <name> --fix # alias
325
+
326
+ # Pipeline
327
+ sps tick <project> [--json]
328
+ sps pipeline start|stop|status|reset|workers|board|card|logs|list|run|use [project] [args]
329
+ sps pipeline run <name> "<prompt>" # for mode: steps pipelines
330
+ sps pipeline tick <project> # one-off StageEngine pass
331
+ sps scheduler tick <project> # dormant since v0.51.9 (kept for tick orchestrator)
332
+ sps qa tick <project> # QA → Done finalization
333
+ sps monitor tick <project> # health probe (ACK timeout, stale)
334
+ sps pm scan <project> # rebuild card index from disk
335
+
336
+ # Cards
337
+ sps card add <p> "title" ["description"] [--skills a,b] [--labels x,y]
338
+ sps card dashboard <p>
339
+ sps card mark-started <p> [seq] [--stage <name>]
340
+ sps card mark-complete <p> <seq> [--stage <name>]
341
+
342
+ # Worker
343
+ sps worker ps <project>
344
+ sps worker dashboard <project>
345
+ sps worker kill <project> <seq>
346
+ sps worker launch <project> <seq>
347
+
348
+ # Status / logs
349
+ sps status [--json]
350
+ sps stop <project> [--all]
351
+ sps reset <project> [--all] [--card N,N,N]
352
+ sps logs [project] [--err] [--lines N] [--no-follow]
353
+
354
+ # Memory
355
+ sps memory list [project] [--agent <id>]
356
+ sps memory context <project> [--card <seq>] [--agent <id>]
357
+ sps memory add <project> --type <T> --name "title" [--body "content"]
358
+
359
+ # Wiki (v0.51+)
360
+ sps wiki init <p>
361
+ sps wiki update <p> [--finalize] [--json]
362
+ sps wiki read <p> "<query>" [--skills a,b] [--pinned id1,id2] [--budget N]
363
+ sps wiki check <p> [--json] [--fix]
364
+ sps wiki add <p> <file> [--category <name>] [--no-ingest]
365
+ sps wiki list <p> [--type T] [--tag T] [--json]
366
+ sps wiki get <p> <pageId> [--json]
367
+ sps wiki status <p> [--json]
368
+
369
+ # Skill
370
+ sps skill list [--project <p>]
371
+ sps skill add <name> [--project <p>]
372
+ sps skill remove <name> [--project <p>]
373
+ sps skill freeze <name> [--project <p>]
374
+ sps skill unfreeze <name> [--project <p>]
375
+ sps skill sync [--force]
376
+
377
+ # Console
378
+ sps console [--port N] [--host H] [--no-open] [--dev] [--kill]
379
+
380
+ # Agent
381
+ sps agent "<prompt>" [--profile <p>] [--system "..."] [--context file] [--output file] [--verbose]
382
+ sps agent --chat [--name <session>]
383
+ sps agent status|close|list|add [args]
384
+ sps agent daemon start|stop|status
385
+
386
+ # Hooks (called by Claude Code, not by users)
387
+ sps hook stop
388
+ sps hook user-prompt-submit
389
+
390
+ # ACP control (for advanced debugging)
391
+ sps acp <ensure|run|prompt|status|stop|pending|respond> <project> [args]
167
392
  ```
168
393
 
169
- If this works, your Claude Code auth is good and SPS is wired correctly.
394
+ Add `--help` after any command to see its specific usage. Add `--json` for structured output where supported.
170
395
 
171
- ### Step 3 — Launch the console
396
+ ---
172
397
 
173
- ```bash
174
- sps console # http://127.0.0.1:4311
398
+ ## Project config (conf)
399
+
400
+ Live at `~/.coral/projects/<name>/conf` (shell `export VAR="value"` syntax, mode 600). Full field reference (with comments) auto-generated at `~/.coral/projects/<name>/conf.example`.
401
+
402
+ | Field | Default | Notes |
403
+ |---|---|---|
404
+ | `PROJECT_NAME` | (required) | Internal id |
405
+ | `PROJECT_DIR` | (required) | Absolute path to repo |
406
+ | `GITLAB_PROJECT` | — | `user/repo` (optional, for GitLab API) |
407
+ | `GITLAB_PROJECT_ID` | — | Numeric ID (GitLab only; auto-resolved from path on first MR) |
408
+ | `GITLAB_MERGE_BRANCH` | `main` | Worker pushes here |
409
+ | `PM_TOOL` | `markdown` | **Only `markdown` supported as of v0.42**. Cards live in `~/.coral/projects/<n>/cards/<state>/<seq>.md` |
410
+ | `PIPELINE_LABEL` | `AI-PIPELINE` | Required label on cards to enter pipeline |
411
+ | `MR_MODE` | `none` | `none` (push direct) / `create` (open MR; needs `GITLAB_PROJECT_ID`) |
412
+ | `WORKER_TRANSPORT` | `acp-sdk` | Fixed; do not change |
413
+ | `MAX_CONCURRENT_WORKERS` | `1` | Slot count; cards still serial within a project |
414
+ | `MAX_ACTIONS_PER_TICK` | `3` | New tasks claimable per tick |
415
+ | `INPROGRESS_TIMEOUT_HOURS` | `2` | After this, MonitorEngine flags STALE-RUNTIME |
416
+ | `WORKER_ACK_TIMEOUT_S` | `300` | Wait for STARTED-<stage> label after dispatch (5min, raised in v0.50.24) |
417
+ | `WORKER_ACK_MAX_RETRIES` | `1` | ACK timeout retry count |
418
+ | `MONITOR_AUTO_QA` | `true` | Auto-advance to QA on stale runtime |
419
+ | `CONFLICT_DEFAULT` | `serial` | Fallback for cards without `conflict:` label |
420
+ | `MATRIX_ROOM_ID` | — | Project-level Matrix override |
421
+ | `WORKTREE_DIR` | `~/.coral/worktrees/<p>` | Worker scratch space |
422
+ | `DEFAULT_WORKER_SKILLS` | — | Comma-separated; fallback when no `profile:` and no `card.skills` |
423
+ | `ENABLE_MEMORY` | `true` | `false` skips memory write instructions in prompt |
424
+ | **`WIKI_ENABLED`** | unset (off) | **v0.51+**: `true` enables wiki context injection + reminder |
425
+ | `COMPLETION_SIGNAL` | `done` | Word the Stop hook listens for |
426
+
427
+ Global credentials at `~/.coral/env`: `GITLAB_URL`, `GITLAB_TOKEN`, `GITLAB_SSH_HOST`, `GITLAB_SSH_PORT`, `MATRIX_HOMESERVER`, `MATRIX_ACCESS_TOKEN`, `MATRIX_ROOM_ID`. Set via `sps setup` or `vim`.
428
+
429
+ ---
430
+
431
+ ## Project layout
432
+
433
+ ```
434
+ ~/.coral/ # User-global state
435
+ ├── env # Global credentials (mode 600)
436
+ ├── skills/ # User-level skills (synced from npm)
437
+ ├── memory/{user,agents,projects}/ # 3-layer memory store
438
+ ├── projects/<name>/ # Per-project state
439
+ │ ├── conf # Project config (mode 600)
440
+ │ ├── conf.example # Field reference (auto-generated)
441
+ │ ├── pipelines/{project,*}.yaml # Pipeline definitions
442
+ │ ├── pipeline_order.json # Active pipeline pointer
443
+ │ ├── runtime/state.json # Worker slot + active card state
444
+ │ ├── runtime/worker-<slot>-current.json # Per-slot card marker (v0.50.21+)
445
+ │ ├── runtime/tick.lock # Tick lock
446
+ │ ├── runtime/acp-state.json # ACP session state
447
+ │ ├── cards/<state>/<seq>.md # Card files (markdown PM backend)
448
+ │ ├── cards/seq.txt # Sequence counter
449
+ │ ├── logs/ # Per-tick logs
450
+ │ └── pm_meta/ # Card index
451
+ ├── sessions/ # Agent daemon (chat sessions)
452
+ │ ├── daemon.sock daemon.pid
453
+ │ └── chat-sessions/<id>.json # Persisted chat sessions
454
+ ├── console.lock # Single-instance guard for console
455
+ └── worktrees/<project>/<seq>/ # Worker worktree per active card
175
456
  ```
176
457
 
177
- ### Step 4 Run a pipeline
458
+ In the target repo (PROJECT_DIR):
178
459
 
179
- ```bash
180
- sps project init my-app --repo /path/to/repo # initialize a project
181
- sps card add my-app "Add a login button" # add a task card
182
- sps tick my-app # advance active cards one stage
460
+ ```
461
+ .claude/
462
+ ├── CLAUDE.md # Worker rules (project-specific + SPS-injected)
463
+ ├── settings.local.json # Claude Code local config
464
+ ├── skills/ # Symlinked from ~/.coral/skills/
465
+ └── hooks/{start,stop}.sh # Lifecycle hooks (call into sps)
466
+ wiki/ # If WIKI_ENABLED — see docs/design/28-wiki-system.md
467
+ ATTRIBUTION.md # If WIKI_ENABLED
183
468
  ```
184
469
 
185
- **TUI dashboard** — compact multi-project view (`sps status`):
470
+ ---
186
471
 
187
- ![Card Dashboard](docs/screenshots/06-dashboard.png)
472
+ ## Architecture
188
473
 
189
- ## 6. Supported Agents
474
+ 4-layer service architecture (v0.50+):
190
475
 
191
- SPS-CLI is shell-driven, so any coding agent that can read a skill and execute commands can use it as a task harness. We ship `skills/sps-pipeline/` — install it into the agent's skill directory and the agent immediately learns the full SPS command surface (cards, pipeline ticks, wiki, project setup, daemon lifecycle).
476
+ ```
477
+ Delivery (commands/, console/routes/) Thin parameter parsing + I/O orchestration
478
+
479
+ Service (services/) ProjectService / ChatService / PipelineService /
480
+ SkillService / WikiService — Result<T> + DomainEvent
481
+
482
+ Domain (engines/) SchedulerEngine / StageEngine / MonitorEngine /
483
+ CloseoutEngine / EventHandler — pipeline logic
484
+
485
+ Infrastructure WorkerManager (single worker), ACPWorkerRuntime,
486
+ (manager/, providers/, daemon/) sessionDaemon, TaskBackend, RepoBackend
487
+ ```
192
488
 
193
- | Agent | Wire-up |
194
- |---|---|
195
- | **Claude Code** | `sps skill sync` symlinks `sps-pipeline` into `~/.claude/skills/`; auto-loaded on description match |
196
- | **Codex** | Drop `skills/sps-pipeline/SKILL.md` into the Codex skill directory |
197
- | **OpenClaw** | ✅ Same point its skill loader at `skills/sps-pipeline/` |
198
- | **Harness Agent** | Same pattern the skill is agent-agnostic |
199
- | **Any other coding agent** | ✅ If it reads instructions and shells out, it can drive SPS |
489
+ Engines:
490
+
491
+ - **SchedulerEngine** dormant since v0.51.9 (cards go directly to Backlog on add; Planning is a manual park). Class kept as a no-op for the tick orchestrator's stable interface.
492
+ - **StageEngine** drives card through stages; builds prompt (skill + projectRules + memory + **wikiContext** + task description + **wikiUpdateReminder**); kicks worker via ACP.
493
+ - **MonitorEngine** — ACK timeout detection, stale runtime, auto-QA promotion.
494
+ - **CloseoutEngine** + **EventHandler**finalize completed cards.
200
495
 
201
- The skill is plain markdowncopy it, adapt it, fork it. SPS owns orchestration; the agent owns intent.
496
+ **Single-worker is intentional**: v0.37.2 deleted multi-worker concurrency code. Don't propose "add a parallel mode" the architecture relies on serial execution for state coherence. For higher throughput, run multiple projects in parallel.
202
497
 
203
- ## 7. Acknowledgements
498
+ For deep dives:
499
+ - [doc-27: Service Layer Architecture](../../docs/design/27-service-layer-architecture.md) — current architecture
500
+ - [doc-26: Console Architecture](../../docs/design/26-console-architecture.md) — console internals
501
+ - [doc-28: Wiki System](../../docs/design/28-wiki-system.md) — wiki design
502
+ - [doc-13: Development Guardrails](../../docs/design/13-development-guardrails.md) — hard rules for contributors
503
+ - [doc-17: Pipeline Configuration](../../docs/design/17-pipeline-configuration-design.md) — YAML field semantics
504
+ - [docs/design/](../../docs/design/) — full design tree (most v0.15-v0.32 docs are marked HISTORICAL)
204
505
 
205
- SPS stands on the shoulders of:
506
+ ---
507
+
508
+ ## Troubleshooting
509
+
510
+ ```bash
511
+ sps doctor <project> --fix # ★ first thing to try
512
+ sps logs <project> --err # stderr / errors only
513
+ sps reset <project> --card <seq> # nuke a stuck card
514
+ sps reset <project> --all # full project reset
515
+
516
+ # Worker / daemon issues
517
+ sps worker ps <project>
518
+ sps agent daemon status # is the chat daemon up?
519
+ sps agent daemon stop && sps agent daemon start # restart (clears stale cwd)
520
+
521
+ # Wiki issues
522
+ sps wiki check <project>
523
+ sps wiki status <project>
524
+ ```
525
+
526
+ Common issues:
527
+
528
+ | Symptom | Cause / fix |
529
+ |---|---|
530
+ | Pipeline halted with `NEEDS-FIX` | Open the failed card, fix the issue, remove the label. Console makes this 2 clicks. |
531
+ | Worker not starting | `sps worker ps`, then `sps logs --err`. Often Claude API key missing or `claude-agent-acp` adapter not installed (`sps setup` reinstalls). |
532
+ | Cards stuck in Planning | Need `AI-PIPELINE` label. `sps card add` applies it automatically; if added externally, add manually. |
533
+ | ACK timeout on every card | Claude cold-start is slow with many skill / memory files. Raise `WORKER_ACK_TIMEOUT_S` (default 300s as of v0.50.24). |
534
+ | Console shows stale data | SSE may have dropped; reload page; if persistent, `sps console --kill && sps console`. |
535
+ | Wiki context not injecting | Verify `WIKI_ENABLED=true` in conf and `wiki/WIKI.md` exists. StageEngine logs a warning if conf says yes but scaffold is missing. |
536
+ | New skill SOP not pulling after upgrade | `sps skill sync --force` (default sync skips existing skills). |
537
+ | Daemon chat using wrong cwd | Daemon captures cwd at startup. `sps agent daemon stop && cd <repo> && sps agent daemon start`. |
206
538
 
207
- - **Andrej Karpathy** — ["LLM Wiki"](https://gist.github.com/karpathy) mental model — the foundation for SPS's knowledge layer
208
- - **Anthropic Claude Agent SDK** — ACP transport, sub-agent infrastructure
209
- - **kepano / claude-obsidian** (MIT) — Wiki architecture, manifest, hot cache. Full attribution in [ATTRIBUTION.md](./ATTRIBUTION.md)
210
- - **hono · chokidar · zod · yaml · vitest · biome** — runtime & toolchain
539
+ ---
211
540
 
212
- ## 8. License
541
+ ## License & attribution
213
542
 
214
- [MIT](./LICENSE)
543
+ MIT, see [`LICENSE`](../../LICENSE).
215
544
 
216
- ## 9. Copyright
545
+ The Wiki system (v0.51+) borrows ~70% from [claude-obsidian](https://github.com/kepano/claude-obsidian) (MIT) — three-layer architecture, manifest delta tracking, hot cache, ingest workflow, contradiction callouts, wikilinks. SPS-specific 30%: 5 page types, `sources={card,commit,path}`, 5-layer reader, `sps wiki check` exit gate. Mental model from Karpathy's "LLM Wiki" gist.
217
546
 
218
- Copyright (c) 2026 Coral AI
547
+ Full attribution: [`ATTRIBUTION.md`](./ATTRIBUTION.md).