@coralai/sps-cli 0.51.11 → 0.52.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 (44) hide show
  1. package/LICENSE +21 -0
  2. package/README-CN.md +131 -457
  3. package/README.md +131 -460
  4. package/dist/commands/skillCommand.js +17 -17
  5. package/dist/commands/skillCommand.js.map +1 -1
  6. package/dist/console/routes/chat.js +3 -3
  7. package/dist/console/routes/chat.js.map +1 -1
  8. package/dist/console/routes/fs.js +2 -2
  9. package/dist/console/routes/fs.js.map +1 -1
  10. package/dist/console-assets/assets/index-DVmciGET.css +10 -0
  11. package/dist/console-assets/assets/index-mm4gDnm8.js +553 -0
  12. package/dist/console-assets/index.html +2 -2
  13. package/dist/core/wiki/hot.js +2 -2
  14. package/dist/core/wiki/hot.js.map +1 -1
  15. package/dist/core/wiki/reader.js +4 -4
  16. package/dist/core/wiki/reader.js.map +1 -1
  17. package/dist/core/wiki/scaffold.js +1 -1
  18. package/dist/main.js +79 -79
  19. package/dist/main.js.map +1 -1
  20. package/dist/providers/MarkdownTaskBackend.d.ts +6 -2
  21. package/dist/providers/MarkdownTaskBackend.d.ts.map +1 -1
  22. package/dist/providers/MarkdownTaskBackend.js +32 -20
  23. package/dist/providers/MarkdownTaskBackend.js.map +1 -1
  24. package/dist/services/CardService.js +14 -14
  25. package/dist/services/CardService.js.map +1 -1
  26. package/dist/services/ChatService.js +11 -11
  27. package/dist/services/ChatService.js.map +1 -1
  28. package/dist/services/LogService.js +2 -2
  29. package/dist/services/LogService.js.map +1 -1
  30. package/dist/services/PipelineService.js +33 -33
  31. package/dist/services/PipelineService.js.map +1 -1
  32. package/dist/services/ProjectService.js +16 -16
  33. package/dist/services/ProjectService.js.map +1 -1
  34. package/dist/services/SkillService.js +9 -9
  35. package/dist/services/SkillService.js.map +1 -1
  36. package/dist/services/SystemService.js +11 -11
  37. package/dist/services/SystemService.js.map +1 -1
  38. package/dist/services/WorkerService.js +11 -11
  39. package/dist/services/WorkerService.js.map +1 -1
  40. package/package.json +2 -2
  41. package/skills/sps-memory/SKILL.md +1 -1
  42. package/skills/sps-pipeline/SKILL.md +19 -19
  43. package/dist/console-assets/assets/index-BJ1T4p1K.css +0 -10
  44. package/dist/console-assets/assets/index-DKc9idxO.js +0 -553
package/README.md CHANGED
@@ -1,547 +1,218 @@
1
- # SPS CLI — AI Agent Harness & Development Pipeline
1
+ # SPS CLI
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
- **v0.51.3**
7
+ ## 1. Introduction
8
8
 
9
- SPS (Smart Pipeline System) drives a Claude Code worker through task cardscode, commit, push, QA, merge, all automated. Three modes:
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.
10
10
 
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). |
16
-
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).
18
-
19
- ---
20
-
21
- ## Table of contents
11
+ ### 24/7 unattended software development
22
12
 
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)
35
-
36
- ---
37
-
38
- ## Install & setup
39
-
40
- ```bash
41
- npm install -g @coralai/sps-cli # latest 0.51.x
42
- sps setup # interactive wizard (must run once)
43
- ```
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.
44
14
 
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.
15
+ ### Beyond software — extensible to any domain via skills
51
16
 
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).
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:
53
18
 
54
- **Prerequisites**: Node 18; an Anthropic API key (or Claude Pro / Max subscription); `claude` CLI in PATH.
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
55
24
 
56
- ---
25
+ One CLI, one console, one filesystem-driven workflow. No vendor lock-in.
57
26
 
58
- ## Harness mode (`sps agent`)
27
+ ![CLI](docs/screenshots/01-cli-banner.png)
59
28
 
60
- Direct one-shot or multi-turn chat with Claude. No project, no PM, no Git.
29
+ ## 2. Core Concepts
61
30
 
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
- ```
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.
80
33
 
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.)
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.
82
36
 
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`.
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.
84
39
 
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.
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`.
86
42
 
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.
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 |
88
48
 
89
- ---
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.
90
50
 
91
- ## Console mode (`sps console`)
51
+ ### Knowledge Base LLM Wiki
92
52
 
93
- Local web UI bundled into the binary. Single-instance guard via `~/.coral/console.lock`.
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.
94
54
 
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
- ```
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.
102
56
 
103
- Pages:
57
+ **The wiki**: Workers continuously distill code, design docs, and completed cards into atomic, cross-linked pages:
104
58
 
105
- | Path | Purpose |
59
+ | Page type | What it captures |
106
60
  |---|---|
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
- ---
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) |
120
66
 
121
- ## Pipeline mode (`sps tick`)
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.
122
68
 
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.
69
+ **Self-retrieving**: Every card prompt receives 5-layer auto-injection (~2K tokens) so the worker starts informed:
124
70
 
125
- ### Create a project
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
126
76
 
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:
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.
135
78
 
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
- ```
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.
145
80
 
146
- In the target repo (PROJECT_DIR):
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.
147
83
 
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
- ```
84
+ ## 3. Console
155
85
 
156
- ### Run
86
+ Launch the local web UI:
157
87
 
158
88
  ```bash
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
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
164
93
  ```
165
94
 
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
- ---
95
+ Single command, no extra services — kanban, chat, skills, workers, logs, projects all in one place.
194
96
 
195
- ## Card lifecycle
97
+ **Kanban card-driven workflow at a glance**
196
98
 
197
- ```
198
- Backlog → Todo → Inprogress → [QA / Review] → Done
199
- ↑↓ ↓ fail
200
- Planning NEEDS-FIX (halt)
201
- (manual park, v0.51.9+)
202
- ```
99
+ ![Console — Kanban](docs/screenshots/02-kanban.png)
203
100
 
204
- **v0.51.10**: caller-aware default state.
205
- - **`sps card add` (CLI / agent / API default)** → **Backlog**(自动跑)
206
- - **Console "新卡片" 表单(人在 UI 操作)** → **Planning**(暂存,等用户拖到 Backlog)
101
+ **Chat — multi-turn agent conversations with tool-call streaming**
207
102
 
208
- CLI 用户想暂存:`sps card add ... --draft`。Console 用户想立即跑:勾"立即派发执行"。
209
- 卡片严格按 seq 排序;不再有 pipeline_order.json。
103
+ ![Console Chat](docs/screenshots/03-chat.png)
210
104
 
211
- Default states (configurable via YAML `pm.card_states`).
105
+ **Skills bundled & per-project skill management**
212
106
 
213
- ```bash
214
- sps card add <p> "Title" "Description"
215
- sps card add <p> "T" "D" --skills python,backend --labels feature
107
+ ![Console — Skills](docs/screenshots/04-skills.png)
216
108
 
217
- sps card dashboard <p> # CLI table
218
- # console: /board?project=<n>
109
+ **Workers capacity, runtime, stage-by-stage logs**
219
110
 
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
111
+ ![Console Workers](docs/screenshots/05-workers.png)
222
112
 
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
113
+ ## 4. Install
262
114
 
263
115
  ```bash
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
116
+ # Install
117
+ npm install -g @coralai/sps-cli
118
+ sps setup # one-time interactive wizard
267
119
 
268
- sps memory add <p> --type convention --name "API uses camelCase" \
269
- --description "REST endpoints use camelCase" --body "..."
120
+ # Update
121
+ npm update -g @coralai/sps-cli
122
+ sps skill sync --force # pull updated skill SOPs after upgrade
270
123
  ```
271
124
 
272
- Types: `convention` (no decay), `decision` (slow), `lesson` (30 days), `reference` (no decay).
273
-
274
- ### Wiki CLI (when `WIKI_ENABLED=true`)
125
+ ### Build from source
275
126
 
276
127
  ```bash
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
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
286
133
  ```
287
134
 
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.
135
+ ### Prerequisites
289
136
 
290
- Worker SOP: [`skills/wiki-update/SKILL.md`](./skills/wiki-update/SKILL.md) (300 lines, single source of truth).
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
291
143
 
292
- ---
144
+ SPS spawns `claude` over the Agent Client Protocol; it inherits whatever credentials you've already configured. No separate SPS-side API key needed.
293
145
 
294
- ## Skills
146
+ ## 5. Quick Start
295
147
 
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.
148
+ ### Step 1 Run the setup wizard (one time)
297
149
 
298
150
  ```bash
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)
151
+ sps setup
307
152
  ```
308
153
 
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`
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)
314
159
 
315
- ---
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.
316
161
 
317
- ## Command reference
162
+ ### Step 2 — Smoke-test with the agent (no project needed)
318
163
 
319
164
  ```bash
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]
165
+ sps agent "Explain this repo" # one-shot
166
+ sps agent --chat # multi-turn REPL, persistent session
392
167
  ```
393
168
 
394
- Add `--help` after any command to see its specific usage. Add `--json` for structured output where supported.
169
+ If this works, your Claude Code auth is good and SPS is wired correctly.
395
170
 
396
- ---
397
-
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
171
+ ### Step 3 — Launch the console
432
172
 
173
+ ```bash
174
+ sps console # http://127.0.0.1:4311
433
175
  ```
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
456
- ```
457
-
458
- In the target repo (PROJECT_DIR):
459
-
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
468
- ```
469
-
470
- ---
471
-
472
- ## Architecture
473
176
 
474
- 4-layer service architecture (v0.50+):
177
+ ### Step 4 Run a pipeline
475
178
 
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
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
487
183
  ```
488
184
 
489
- Engines:
185
+ **TUI dashboard** — compact multi-project view (`sps status`):
490
186
 
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.
187
+ ![Card Dashboard](docs/screenshots/06-dashboard.png)
495
188
 
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.
189
+ ## 6. Supported Agents
497
190
 
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)
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).
505
192
 
506
- ---
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 |
507
200
 
508
- ## Troubleshooting
201
+ The skill is plain markdown — copy it, adapt it, fork it. SPS owns orchestration; the agent owns intent.
509
202
 
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:
203
+ ## 7. Acknowledgements
527
204
 
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`. |
205
+ SPS stands on the shoulders of:
538
206
 
539
- ---
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
540
211
 
541
- ## License & attribution
212
+ ## 8. License
542
213
 
543
- MIT, see [`LICENSE`](../../LICENSE).
214
+ [MIT](./LICENSE)
544
215
 
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.
216
+ ## 9. Copyright
546
217
 
547
- Full attribution: [`ATTRIBUTION.md`](./ATTRIBUTION.md).
218
+ Copyright (c) 2026 Coral AI