@curdx/flow 7.1.1 → 7.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  All notable changes to `@curdx/flow` are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/) and the project follows [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## 7.1.3 — 2026-05-05
6
+
7
+ ### Added
8
+
9
+ - **`npx @curdx/flow analyze` CLI — local-only plugin self-observation.** New subcommand that parses Claude Code session transcripts (`~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl`) merged with curdx-flow's own `~/.claude/curdx-flow/errors.jsonl`, and emits a 7-section markdown report: **Hook Failures Top-N** · **Slash Commands** · **Subagents** · **Spec Funnel** · **Hook Duration P50/P95/P99** · **Schema Drift** · **Parent UUID Chain integrity**. Streaming `node:readline` parser handles 100MB+ transcripts (102 MB tested → 139 MB RSS bounded). Incremental byte-offset state at `~/.claude/curdx-flow/observability-state.json` makes second-run analysis ~31× faster than a cold full scan. Flags: `--json` · `--limit <N>` · `--since <7d|30d|YYYY-MM-DD>` · `--project <name>` · `--include-prompts`. Zero new npm dependencies — uses Node 20+ built-ins only (commit `ae4d7cc..0f87161`).
10
+ - New 5-piece module: `src/analyze/{parser,filter,report,redact,error-logger}.ts` + `index.ts` orchestrator + `types.ts`.
11
+ - New CLI flow: `src/flows/analyze.ts` (lazy `await import('../analyze/index.ts')` so the analyze pipeline only loads when invoked).
12
+ - 4 micro-edits to `src/index.ts` (citty registration: import + `defineCommand` ref + `subCommands` extension + `SUBCOMMANDS.add('analyze')`).
13
+ - **Declarative schema map at `plugins/curdx-flow/schemas/transcript-events.json`.** Pattern borrowed from `claude-mem`'s `transcript-watch.json`: `type → action + fields` mapping is JSON config, not hardcoded TypeScript. Ships with the 4 core event types (`hook_success`, `tool_use`, `assistant`, `user`) and is auto-resolved post-bundle via two-probe strategy (`__dirname`-relative + `process.cwd()`-relative); on missing/corrupt, parser falls back to a builtin minimal whitelist with a stderr warning. Unknown event types are silently skipped and counted into `unknown_type_count` so Claude Code schema drift is observable rather than fatal (`R-1` mitigation).
14
+ - **Hook error logger at `src/hooks/_shared/error-logger.ts`.** Synchronous `appendFileSync` writer for `~/.claude/curdx-flow/errors.jsonl` — 5 required fields (`ts`/`level`/`hook`/`event`/`msg`) + 5 optional (`session_id`/`cwd`/`spec`/`path`/`stack`), single line `< 4 KB` (POSIX `PIPE_BUF` atomic). Lazy reads `~/.claude/settings.json` once per process (`errorLogEnabled` defaults to `true`; corrupt/missing settings.json defaults `true` + stderr warning). Wired into `_shared/run-hook.ts`'s central catch so all 4 hooks (`load-spec-context` / `quick-mode-guard` / `stop-watcher` / `update-spec-index`) now write structured error trails instead of silently swallowing exceptions. Write failures are themselves swallowed (NFR-9 — never crash a hook trying to log a hook crash). Disable with `errorLogEnabled: false` in `~/.claude/settings.json`.
15
+ - **Bundle-size CI gate at `scripts/check-bundle-size.mjs`.** New `npm run check:bundle` script enforces `dist/index.mjs ≤ 84 KB` (NFR-3); wired into the `verify` chain. Pairs with `tsup.config.ts` `splitting: true` so the analyze pipeline emits as a separate content-hashed chunk (`dist/analyze-*.mjs`, ~26 KB) and only loads when the user runs `analyze` — main bundle stayed at **68.46 KB** even after adding ~1500 LoC of analyze code.
16
+ - **i18n strings for `analyze`** in `src/i18n/{en,zh}.ts` — 10 + 10 keys (`analyze.description`, `analyze.flags.*`, `analyze.warning.*`).
17
+ - **Bilingual README sections** at the end of `README.md` and `README.zh-CN.md` documenting the analyze CLI, the redact-by-default privacy model, the macOS/Linux verification scope (Windows declared supported but not tested — NTFS append atomicity not guaranteed), and the `errorLogEnabled` config.
18
+
19
+ ### Fixed
20
+
21
+ - **Hook stdin parse failures now reach `errors.jsonl`.** `src/hooks/_shared/stdin.ts` previously called `process.exit(0)` directly on `JSON.parse` failure, short-circuiting `_shared/run-hook.ts`'s outer try/catch — meaning the `logHookError({ event: 'stdin_parse', ... })` call in the wrapper was effectively dead code. Replaced `process.exit(0)` with `throw e;` so the central catch fires the logger and *then* exits 0 (FR-8 graceful-skip semantics preserved end-to-end). Caught by VE2 round-4 reality verification on the real `quick-mode-guard.mjs` bundle (commit `edf417a`).
22
+
23
+ ### Changed
24
+
25
+ - **`tsup.config.ts`: `splitting: false → true`.** Required to make the new `await import('../analyze/index.ts')` in `src/flows/analyze.ts` actually emit a separate chunk (single-entry tsup with `splitting: false` was inlining the dynamic import, growing main bundle to 94.47 KB). Output now includes `dist/analyze-<hash>.mjs` alongside `dist/index.mjs`. `package.json` `files: ["dist", ...]` already covers the new chunk for `npm publish`.
26
+
27
+ ## 7.1.2 — 2026-05-04
28
+
29
+ ### Added
30
+
31
+ - **Auto-detect-and-install Bun when installing `claude-mem`.** The `claude-mem` plugin's runtime hooks shell out to `node scripts/bun-runner.js` which requires Bun on `PATH` or `~/.bun/bin/bun(.exe)` — Windows users without Bun previously hit `Error: Bun not found` at every Claude Code session start. The installer now runs `ensureBun()` as a `prereqCheck` before installing `claude-mem`: detects Bun via `which`/`where` plus the standard fallback paths (mirrors `bun-runner.js`'s discovery order), and if missing prompts `Auto-install Bun now? (default: No)`. On accept, runs the official installer (`curl -fsSL https://bun.sh/install | bash` on macOS/Linux, `powershell -c "irm bun.sh/install.ps1 | iex"` on Windows). On decline, the installer surfaces a `skip` row for `claude-mem` and continues with the rest of the bundle — other packages are unaffected. Existing users with Bun already installed (e.g. all macOS users who manually ran the installer earlier) see zero behavior change.
32
+ - New module: `src/runner/ensureBun.ts` (~75 LoC) — exports `findBun()` and `ensureBun(t)`.
33
+ - `src/registry/plugins/claude-mem.ts` declares `prereqCheck: (t) => ensureBun(t)` (one-line wire-in via the existing `Pkg.prereqCheck` contract that `chrome-devtools-mcp` already uses).
34
+ - i18n: 9 new `bun.*` keys in `src/i18n/{zh,en}.ts`.
35
+
5
36
  ## 7.1.1 — 2026-05-04
6
37
 
7
38
  ### Fixed
package/README.md CHANGED
@@ -1,67 +1,503 @@
1
- # @curdx/flow
1
+ <div align="center">
2
2
 
3
- Interactive installer for Claude Code plugins and MCP servers.
3
+ **English** · [中文](./README.zh-CN.md)
4
4
 
5
- ## Quick start
5
+ # `@curdx/flow`
6
+
7
+ ### *Spec-driven development for Claude Code, with autonomous task execution.*
8
+
9
+ A complete development workflow that turns a vague feature request into structured specifications, then executes them task-by-task in fresh contexts. Bundles a curated marketplace of complementary plugins and MCP servers — installed, updated, and uninstalled with one command.
10
+
11
+ [![npm version](https://img.shields.io/npm/v/@curdx/flow?color=FF6B35&label=npm)](https://www.npmjs.com/package/@curdx/flow)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13
+ [![Built for Claude Code](https://img.shields.io/badge/Built%20for-Claude%20Code-5B6CFF)](https://claude.ai/code)
14
+ [![Node](https://img.shields.io/badge/Node-%E2%89%A520.12-3C873A)](https://nodejs.org)
15
+
16
+ [Installation](#-installation) · [Quick start](#-quick-start) · [How it works](#-how-it-works) · [Concepts](#-core-concepts) · [Commands](#%EF%B8%8F-commands) · [Configuration](#%EF%B8%8F-configuration) · [FAQ](#-faq)
6
17
 
7
18
  ```bash
8
19
  npx @curdx/flow
9
20
  ```
10
21
 
11
- On first run you'll be asked to pick a language (中文 / English). Then choose what to install, update, uninstall, or just check status.
22
+ </div>
23
+
24
+ ---
25
+
26
+ ## Table of contents
27
+
28
+ - [What is `@curdx/flow`](#-what-is-curdxflow)
29
+ - [Who it is for](#-who-it-is-for)
30
+ - [How it works](#-how-it-works)
31
+ - [Installation](#-installation)
32
+ - [Quick start](#-quick-start)
33
+ - [Walkthrough — your first spec](#-walkthrough--your-first-spec)
34
+ - [Core concepts](#-core-concepts)
35
+ - [Commands](#%EF%B8%8F-commands)
36
+ - [Subagents](#-subagents)
37
+ - [The marketplace](#-the-marketplace)
38
+ - [Configuration](#%EF%B8%8F-configuration)
39
+ - [Project layout](#-project-layout)
40
+ - [Why it exists](#-why-it-exists)
41
+ - [FAQ](#-faq)
42
+ - [Requirements](#-requirements)
43
+ - [License](#-license)
44
+
45
+ ---
46
+
47
+ ## 🚀 What is `@curdx/flow`
48
+
49
+ `@curdx/flow` is **a single npm package that delivers two products** built around Claude Code:
50
+
51
+ 1. **A spec-driven development plugin.** Provides the `/curdx-flow:*` slash commands. Turns an unstructured feature request into a research report, requirements document, technical design, and a task list — then executes the task list autonomously in fresh contexts, one task at a time, with verification gates between every task.
52
+
53
+ 2. **A curated plugin & MCP marketplace.** A single interactive installer that picks, installs, updates, and uninstalls a set of complementary tools for Claude Code (cross-session memory, browser automation, live documentation lookup, etc.) — keeping a managed manifest in `~/.claude/CLAUDE.md` so Claude knows what is available.
54
+
55
+ The plugin and the installer ship in the same npm package and share a single version number. Run `npx @curdx/flow` once and you have a fully wired Claude Code environment.
56
+
57
+ ```text
58
+ You: /curdx-flow:start "Add OAuth login with token refresh"
59
+ flow: ✓ Interview: 3 clarifying questions answered (60s)
60
+ flow: ✓ Parallel research team dispatched (3 specialist agents)
61
+ → research.md (148 lines, 9 references, 4 risks identified)
62
+ You: review · approve → /curdx-flow:requirements
63
+ flow: ✓ product-manager agent
64
+ → requirements.md (US-1..US-9, FR-1..FR-23, NFR-1..NFR-12)
65
+ You: review · approve → /curdx-flow:design
66
+ flow: ✓ architect-reviewer
67
+ → design.md (9 decisions, 7 risks, component diagram)
68
+ You: review · approve → /curdx-flow:tasks
69
+ flow: ✓ task-planner
70
+ → tasks.md (12 tasks across 4 phases, with VERIFY gates)
71
+ You: review · approve → /curdx-flow:implement
72
+ flow: ⟳ task 1.1 → verify → commit ✓
73
+ ⟳ task 1.2 → verify → commit ✓
74
+
75
+ ✓ ALL_TASKS_COMPLETE (12/12 tasks, 47 commits, all green)
76
+ You: review the diff. open the PR. ship.
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 🎯 Who it is for
82
+
83
+ `@curdx/flow` is built for developers who use Claude Code on real projects — not throwaway prototypes. It pays off most when:
84
+
85
+ - **You ship code others will read.** Specs become a paper trail your reviewers and future self can audit.
86
+ - **Your codebase has conventions and constraints.** The research and design phases force these to be surfaced before code is written, not discovered after.
87
+ - **You context-switch.** Every task starts with a clean context window, so you do not have to manually re-explain the project after a long pause or a rate-limit reset.
88
+ - **You delegate, then come back.** The autonomous loop runs unattended; you review the diff when it finishes.
89
+
90
+ It is less useful when you only want a one-off script or a five-line tweak. For those, plain Claude Code is faster.
91
+
92
+ ---
12
93
 
13
- ## Subcommands
94
+ ## 🧭 How it works
95
+
96
+ <div align="center">
97
+ <img src="docs/img/workflow.svg" alt="curdx-flow workflow: research → requirements → design → tasks → implement, with autonomous loop on the final phase" width="100%">
98
+ </div>
99
+
100
+ The workflow has **five phases**. Each phase is owned by a specialist subagent, produces exactly one Markdown artifact, and **pauses for human approval** before the next phase begins. The final phase, `implement`, runs an autonomous loop — execute task, verify, commit, advance — until every task in `tasks.md` is checked off.
101
+
102
+ | Phase | Command | Subagent | Output |
103
+ | --- | --- | --- | --- |
104
+ | Research | `/curdx-flow:research` | research-analyst (parallel team) | `research.md` |
105
+ | Requirements | `/curdx-flow:requirements` | product-manager | `requirements.md` |
106
+ | Design | `/curdx-flow:design` | architect-reviewer | `design.md` |
107
+ | Tasks | `/curdx-flow:tasks` | task-planner | `tasks.md` |
108
+ | Implement | `/curdx-flow:implement` | spec-executor (autonomous loop) | code, tests, commits |
109
+
110
+ All artifacts live under `specs/<spec-name>/` in your repository. They are plain Markdown, version-controlled, and survive across sessions.
111
+
112
+ <div align="center">
113
+ <img src="docs/img/architecture.svg" alt="curdx-flow architecture: one npm package, two products — bundled plugin and plugin/MCP marketplace installer" width="100%">
114
+ </div>
115
+
116
+ The same npm package delivers both products. The installer reads its descriptor catalog, executes `claude plugin install` / `claude mcp add` on your behalf, and writes a managed block to `~/.claude/CLAUDE.md` so Claude Code knows what is installed. Everything is idempotent — run the installer again any time to reconcile drift.
117
+
118
+ ---
119
+
120
+ ## 📥 Installation
121
+
122
+ ### Prerequisites
123
+
124
+ - **Node.js** ≥ 20.12 ([download](https://nodejs.org))
125
+ - **Claude Code CLI** installed and on `PATH` ([install instructions](https://docs.anthropic.com/en/docs/claude-code))
126
+ - *(Optional)* **Bun** ≥ 1.0 — auto-detected; the installer offers to install it if you choose `claude-mem`
127
+
128
+ ### Install
129
+
130
+ ```bash
131
+ npx @curdx/flow
132
+ ```
133
+
134
+ On first run, you pick a language (中文 / English), then select what to install. The bundled `curdx-flow` plugin (the spec workflow itself) is always installed. Everything else is opt-in.
135
+
136
+ ### Common workflows
14
137
 
15
138
  ```bash
16
- npx @curdx/flow # interactive menu
17
- npx @curdx/flow install # interactive install (current state-aware)
139
+ # Interactive menu — install / update / uninstall / status
140
+ npx @curdx/flow
141
+
142
+ # Non-interactive: install everything available
18
143
  npx @curdx/flow install --all --yes
19
- npx @curdx/flow uninstall
20
- npx @curdx/flow update
144
+
145
+ # Check what is installed and whether anything is stale
21
146
  npx @curdx/flow status
22
- npx @curdx/flow status --json
23
- npx @curdx/flow --lang en # override language
147
+ npx @curdx/flow status --json # machine-readable
148
+
149
+ # Update everything to the latest version
150
+ npx @curdx/flow update
151
+
152
+ # Uninstall everything cleanly (also removes the managed CLAUDE.md block)
153
+ npx @curdx/flow uninstall
154
+
155
+ # Override the language for a single invocation
156
+ npx @curdx/flow --lang en
157
+ ```
158
+
159
+ ### Verifying the install
160
+
161
+ ```bash
162
+ claude plugin list # should show curdx-flow@curdx
163
+ claude mcp list # any MCP servers you opted in to
164
+ npx @curdx/flow status # green checkmarks for installed items
24
165
  ```
25
166
 
26
- ## What it installs
167
+ In Claude Code, type `/curdx-flow:` and you should see autocomplete for all commands.
27
168
 
28
- | id | type | source |
29
- | --- | --- | --- |
30
- | `pua` | plugin | `tanweai/pua` → `pua@pua-skills` |
31
- | `claude-mem` | plugin | `thedotmack/claude-mem` |
32
- | `chrome-devtools-mcp` | plugin | `ChromeDevTools/chrome-devtools-mcp` |
33
- | `frontend-design` | plugin | `claude-plugins-official` (built-in) |
34
- | `curdx-flow` | plugin | bundled in this repo (always installed) — spec-driven dev with autonomous task execution |
35
- | `sequential-thinking` | mcp | `@modelcontextprotocol/server-sequential-thinking` |
36
- | `context7` | mcp | HTTP — `https://mcp.context7.com/mcp` (optional API key) |
169
+ ---
37
170
 
38
- ## What it writes to your filesystem
171
+ ## Quick start
39
172
 
40
- After every successful `install` / `update` / `uninstall`, flow keeps a short managed block in your global `~/.claude/CLAUDE.md` so Claude Code knows at session start which tools are installed and when to use them. The block looks like:
173
+ After install, in any project:
41
174
 
175
+ ```bash
176
+ cd ~/projects/my-app
177
+ claude # start Claude Code
42
178
  ```
43
- <!-- BEGIN @curdx/flow v1 -->
44
- ## Tool Usage
45
179
 
46
- Available tools/plugins:
47
- - pua (v3.0.0) — `/pua:*` — auto-fires on 2+ failures or user frustration; ...
48
- - ...
180
+ Then in the Claude Code prompt:
181
+
182
+ ```text
183
+ /curdx-flow:start
184
+ > I want to add a rate-limited /api/upload endpoint with S3 multipart support.
185
+ ```
186
+
187
+ flow runs a brief interview, dispatches the research team, writes `specs/upload-api/research.md`, and pauses for your approval. From there, advance through the phases (`requirements` → `design` → `tasks` → `implement`) by approving each artifact.
188
+
189
+ ---
49
190
 
50
- Rules:
51
- - Do not call every tool by default; ...
52
- - ...
191
+ ## 🎬 Walkthrough — your first spec
53
192
 
54
- Run `npx @curdx/flow` to install / update / uninstall.
55
- <!-- END @curdx/flow v1 -->
193
+ A concrete end-to-end example, with what flow does at each step.
194
+
195
+ #### 1. `/curdx-flow:start`
196
+
197
+ ```text
198
+ > I want to add a rate-limited /api/upload endpoint with S3 multipart support.
56
199
  ```
57
200
 
58
- Anything outside the BEGIN/END markers is preserved verbatim — flow only ever rewrites or removes the block itself. Uninstalling all managed items removes the block entirely. Pass `--no-claude-md` (or set `CURDX_FLOW_NO_CLAUDE_MD=1`) to opt out.
201
+ flow:
202
+
203
+ - creates `specs/upload-api/` and a `.curdx-state.json` execution-state file
204
+ - runs a 60-second interview (≈3 clarifying questions tuned to the goal)
205
+ - detects relevant skills from your installed plugins and pre-loads them
206
+ - dispatches a parallel research team — one agent investigates S3 multipart, one investigates rate-limiting strategies, one surveys your codebase for existing upload patterns
207
+ - merges results into `specs/upload-api/research.md`
208
+ - pauses for approval
209
+
210
+ #### 2. `/curdx-flow:requirements`
211
+
212
+ The product-manager subagent translates the goal + research into structured requirements: user stories (`US-1`, `US-2`, …), functional requirements (`FR-*`), non-functional requirements (`NFR-*`, e.g. latency, durability, security), and acceptance criteria (`AC-*`). Saved to `requirements.md`.
213
+
214
+ #### 3. `/curdx-flow:design`
215
+
216
+ The architect-reviewer turns requirements into a technical design: components, data flow, API contracts, key decisions (`D-1`..`D-N`), known risks (`R-1`..`R-N`), and a file-level change manifest. Saved to `design.md`.
217
+
218
+ #### 4. `/curdx-flow:tasks`
219
+
220
+ The task-planner breaks the design into a checked task list — typically grouped into phases, with `[VERIFY]` gates that run real verification commands (typecheck, tests, smoke tests). Saved to `tasks.md`.
221
+
222
+ #### 5. `/curdx-flow:implement`
223
+
224
+ The spec-executor begins the autonomous loop:
225
+
226
+ ```
227
+ loop:
228
+ pick next unchecked task from tasks.md
229
+ open fresh context with task description, design.md excerpt, relevant files
230
+ implement → run verification command → commit on success
231
+ mark task [x] in tasks.md
232
+ if verification fails → retry up to N times → if still failing, halt and surface
233
+ repeat until ALL_TASKS_COMPLETE
234
+ ```
235
+
236
+ You can step away. When you come back, `tasks.md` is fully checked off and the diff is in your branch.
237
+
238
+ ---
239
+
240
+ ## 🧱 Core concepts
241
+
242
+ #### Spec
243
+
244
+ A directory under `specs/` containing the four canonical artifacts (`research.md`, `requirements.md`, `design.md`, `tasks.md`) plus an execution-state file. Specs are first-class citizens — they version with your repo and act as the contract for what is being built and why.
245
+
246
+ #### Phase
247
+
248
+ One of the five steps in the workflow (research, requirements, design, tasks, implement). Each phase has exactly one owner subagent and exactly one output artifact. Phases are sequential by design — skipping or reordering them is not supported.
249
+
250
+ #### Subagent
251
+
252
+ A specialist agent invoked by the coordinator for a specific phase. Each subagent runs in its own context window and is given only the inputs it needs (goal, prior artifacts, relevant skills). This keeps every phase reasoning fresh and prevents prompt bloat.
253
+
254
+ #### Skill
255
+
256
+ A reusable capability scanned at the start of each spec. flow looks at all installed Claude Code skills, semantically matches them to the goal, and loads the relevant ones into the active context. You can install your own skills under `.claude/skills/` or `.agents/skills/`.
257
+
258
+ #### Hook
259
+
260
+ A script that runs at lifecycle events (`SessionStart`, `Stop`, `PreToolUse`, `UserPromptSubmit`). flow ships with four hooks that maintain the spec index, enforce quick-mode guardrails, and watch for stop-loop completion. Hooks are TypeScript sources bundled to `.mjs` at build time.
261
+
262
+ #### Autonomous loop
263
+
264
+ The behaviour of `/curdx-flow:implement`. After a human approves `tasks.md`, the executor takes over and runs through every task without further human input — provided each verification gate passes. If verification fails repeatedly, the loop halts and surfaces the failure so a human can intervene.
265
+
266
+ #### Epic
267
+
268
+ A collection of related specs with declared dependencies. Created with `/curdx-flow:triage`. Useful when a single feature decomposes into multiple specs that must be built in a specific order.
269
+
270
+ ---
271
+
272
+ ## 🛠️ Commands
273
+
274
+ The bundled plugin exposes these slash commands inside Claude Code:
275
+
276
+ | Command | Description |
277
+ | --- | --- |
278
+ | `/curdx-flow:start` | Smart entry point. Detects whether to create a new spec or resume an existing one. Runs the interview, sets up state, dispatches the research phase. |
279
+ | `/curdx-flow:new` | Force-create a new spec, skipping resume detection. Useful when the smart entry point would otherwise resume something you no longer want. |
280
+ | `/curdx-flow:research` | Run or re-run the research phase for the active spec. Dispatches the parallel research team. |
281
+ | `/curdx-flow:requirements` | Generate `requirements.md` from goal + research, via the product-manager subagent. |
282
+ | `/curdx-flow:design` | Generate `design.md` from requirements, via the architect-reviewer subagent. |
283
+ | `/curdx-flow:tasks` | Break the design into a checked task list (`tasks.md`), via the task-planner subagent. |
284
+ | `/curdx-flow:implement` | Begin the autonomous execution loop. Runs every unchecked task in `tasks.md` until completion or unrecoverable failure. |
285
+ | `/curdx-flow:triage` | Decompose a large feature into multiple dependency-aware specs (an epic). Produces `specs/_epics/<name>/epic.md` and a per-spec graph. |
286
+ | `/curdx-flow:status` | Show all specs, their phase, and progress. |
287
+ | `/curdx-flow:switch` | Switch the active spec for resume / continuation. |
288
+ | `/curdx-flow:refactor` | Methodically update spec files (requirements → design → tasks) after execution has revealed they need revision. |
289
+ | `/curdx-flow:cancel` | Cancel the active execution loop, clean up state, and (optionally) remove the spec. |
290
+ | `/curdx-flow:index` | Index the codebase and external resources into searchable spec metadata. |
291
+ | `/curdx-flow:help` | Show plugin help and a workflow overview. |
292
+ | `/curdx-flow:feedback` | Submit feedback or report a plugin issue. |
293
+
294
+ ---
295
+
296
+ ## 🤖 Subagents
297
+
298
+ flow ships with nine specialist subagents, each with a narrow responsibility. They are invoked automatically by the coordinator commands above; you do not call them directly.
299
+
300
+ | Subagent | Role |
301
+ | --- | --- |
302
+ | `research-analyst` | Investigates the goal via web search, documentation, and codebase exploration. Multiple instances run in parallel during the research phase. |
303
+ | `product-manager` | Translates research into structured requirements (user stories, functional and non-functional requirements, acceptance criteria). |
304
+ | `architect-reviewer` | Designs scalable, maintainable systems. Produces `design.md` with components, decisions, risks, and file-change manifest. |
305
+ | `task-planner` | Breaks a design into a sequenced, checkable task list with verification gates. Supports `fine` and `coarse` granularity modes. |
306
+ | `spec-executor` | The autonomous executor. Implements one task end-to-end per invocation, verifies, commits, and signals completion to the loop. |
307
+ | `spec-reviewer` | Read-only reviewer that validates artifacts against type-specific rubrics. Outputs `REVIEW_PASS` or `REVIEW_FAIL`. |
308
+ | `qa-engineer` | Runs verification commands at quality gates. Outputs `VERIFICATION_PASS` or `VERIFICATION_FAIL`. |
309
+ | `refactor-specialist` | Updates spec files section-by-section after execution surfaces design drift. |
310
+ | `triage-analyst` | Decomposes a large feature into multiple dependency-aware specs (epic graph). |
311
+
312
+ ---
313
+
314
+ ## 📦 The marketplace
315
+
316
+ The installer ships with a curated set of plugins and MCP servers. You opt in per item.
317
+
318
+ | ID | Type | Source | Purpose |
319
+ | --- | --- | --- | --- |
320
+ | **`curdx-flow`** | plugin | bundled in this repo | Spec-driven dev workflow. **Always installed.** |
321
+ | `claude-mem` | plugin | `thedotmack/claude-mem` | Cross-session memory. Stores observations and recalls them at the start of subsequent sessions. |
322
+ | `pua` | plugin | `tanweai/pua` | "Anti-failure" pressure mode. Auto-fires on 2+ consecutive failures or detected user frustration; pushes the agent to switch approaches. |
323
+ | `chrome-devtools-mcp` | plugin | `ChromeDevTools/chrome-devtools-mcp` | Drive a real Chrome via MCP — performance traces, network inspection, console, screenshots, accessibility audits. |
324
+ | `frontend-design` | plugin | `claude-plugins-official` | Distinctive, production-grade frontend output. Avoids generic AI aesthetics. |
325
+ | `sequential-thinking` | mcp | `@modelcontextprotocol/server-sequential-thinking` | Step-by-step reasoning MCP server. |
326
+ | `context7` | mcp | `https://mcp.context7.com/mcp` | Live library documentation over MCP. Beats stale training-data answers for recent SDK changes. |
327
+
328
+ Run `npx @curdx/flow status` to see what is installed on your machine.
329
+
330
+ ---
331
+
332
+ ## ⚙️ Configuration
333
+
334
+ ### Flags
335
+
336
+ | Flag | Effect |
337
+ | --- | --- |
338
+ | `--all` | Apply to every available item (with `install` or `update`). |
339
+ | `--yes` | Skip all confirmations (non-interactive). |
340
+ | `--lang en` / `--lang zh` | Override the language for the current invocation. |
341
+ | `--no-claude-md` | Do not write the managed block to `~/.claude/CLAUDE.md`. |
342
+ | `--json` | Output machine-readable JSON (with `status`). |
343
+ | `--quick` | (Plugin) Run all phases of a spec sequentially without pausing for approval. Use with caution. |
344
+ | `--commit-spec` / `--no-commit-spec` | (Plugin) Commit spec artifacts after each phase. Default: `true`. |
345
+ | `--specs-dir <path>` | (Plugin) Write specs to a non-default directory (e.g. `packages/api/specs/`). |
346
+ | `--tasks-size fine` / `--tasks-size coarse` | (Plugin) Granularity of `tasks.md` decomposition. |
347
+
348
+ ### Environment variables
349
+
350
+ | Variable | Effect |
351
+ | --- | --- |
352
+ | `CURDX_FLOW_NO_CLAUDE_MD=1` | Equivalent to `--no-claude-md`. |
353
+ | `CURDX_FLOW_LANG=en` / `=zh` | Default language for the installer. |
354
+ | `CONTEXT7_API_KEY` | Optional API key for the context7 MCP server. |
355
+
356
+ ### Per-project overrides
357
+
358
+ Project-specific settings live in `.claude/settings.json` (Claude Code's own config). flow does not write to this file by default; it only manages its block in `~/.claude/CLAUDE.md`.
359
+
360
+ ---
361
+
362
+ ## 📁 Project layout
363
+
364
+ After install, here is what is on your machine:
365
+
366
+ ```
367
+ ~/.claude/
368
+ ├── plugins/cache/curdx/curdx-flow/<version>/ # the bundled plugin
369
+ │ ├── commands/ # /curdx-flow:* slash commands
370
+ │ ├── agents/ # subagent definitions
371
+ │ ├── skills/ # bundled skills
372
+ │ ├── hooks/scripts/ # built hook bundles (.mjs)
373
+ │ └── schemas/ # JSON schemas
374
+ ├── plugins/cache/<other-plugins>/ # plugins you opted into
375
+ └── CLAUDE.md # global; contains <!-- BEGIN @curdx/flow v1 --> block
376
+ ```
377
+
378
+ Inside any project that uses flow:
379
+
380
+ ```
381
+ <your-project>/
382
+ └── specs/
383
+ ├── .current-spec # active spec name (or path)
384
+ ├── .current-epic # active epic, if any
385
+ ├── .index/ # spec index for search/triage
386
+ └── <spec-name>/
387
+ ├── research.md
388
+ ├── requirements.md
389
+ ├── design.md
390
+ ├── tasks.md
391
+ ├── .curdx-state.json # execution state (gitignored)
392
+ └── .progress.md # phase notes (gitignored)
393
+ ```
394
+
395
+ The four canonical artifacts (`research.md` … `tasks.md`) are committed with your code. State and progress files are gitignored.
396
+
397
+ The `<!-- BEGIN @curdx/flow v1 -->` block in `~/.claude/CLAUDE.md` tells Claude what is installed and how to invoke it. flow only ever rewrites this block — content outside the markers is preserved verbatim. Pass `--no-claude-md` (or set `CURDX_FLOW_NO_CLAUDE_MD=1`) to opt out of the managed block.
398
+
399
+ ---
400
+
401
+ ## 💡 Why it exists
402
+
403
+ Claude Code is fast, but on real projects it has predictable failure modes:
404
+
405
+ - **It skips tests** unless you keep telling it to write them.
406
+ - **It loses context** between sessions, between rate-limit resets, and inside very long sessions.
407
+ - **It produces inconsistent output** across runs of the same task.
408
+ - **It does not push back** on under-specified requirements — it just guesses, and you discover the mismatch in code review.
409
+
410
+ Most workflow frameworks address this by adding more agents, more orchestration, more prompt files. The result is more tokens spent, longer wait times, and a harder-to-audit pipeline. The output rarely improves.
411
+
412
+ `@curdx/flow` makes a different bet:
413
+
414
+ 1. **Specs are the contract, not the prompt.** Every change has `research.md` → `requirements.md` → `design.md` → `tasks.md` written before any implementation begins. They live in your repo. Reviewers can read them. Future-you can read them.
415
+ 2. **Subagents are specialized, not stacked.** One agent per phase. Each gets a fresh context window. No multi-agent orchestration salad.
416
+ 3. **The loop runs itself.** Once `tasks.md` is approved, `/curdx-flow:implement` executes the entire task list autonomously, with verification gates between every task. You walk away. You come back. You read the diff.
417
+ 4. **Installer and plugin in one package.** No separate marketplace registration, no scaffolding, no per-project config. `npx @curdx/flow` once.
418
+
419
+ > Claude Code is the engine. `curdx-flow` is the chassis.
420
+
421
+ ---
422
+
423
+ ## ❓ FAQ
424
+
425
+ #### Does this replace Claude Code?
426
+
427
+ No. flow runs **inside** Claude Code as a plugin. You still use the Claude Code CLI / IDE extension to chat; flow adds the `/curdx-flow:*` commands, subagents, hooks, and the bundled marketplace.
428
+
429
+ #### Can I use flow without installing the marketplace plugins?
430
+
431
+ Yes. The bundled `curdx-flow` plugin is the spec workflow itself; everything else (claude-mem, chrome-devtools-mcp, …) is opt-in. `npx @curdx/flow install` lets you pick.
432
+
433
+ #### Do I need to commit the spec files?
434
+
435
+ You should commit the four canonical artifacts (`research.md`, `requirements.md`, `design.md`, `tasks.md`). The state and progress files (`.curdx-state.json`, `.progress.md`) should be gitignored — flow's default `.gitignore` entries handle this.
436
+
437
+ #### What happens if a task fails verification mid-loop?
438
+
439
+ The executor retries up to a configurable number of times (default 5). If it still fails, the loop halts, the task remains unchecked, and the failure is surfaced for human intervention. Resume with `/curdx-flow:implement` after the underlying issue is fixed.
440
+
441
+ #### Can I run multiple specs in parallel?
442
+
443
+ Specs are scoped per-project, but only one is active at a time. Use `/curdx-flow:switch` to change the active spec. For genuinely parallel work, use separate git worktrees or branches.
444
+
445
+ #### Is there a "quick mode" that skips approvals?
446
+
447
+ Yes — pass `--quick` to `/curdx-flow:start` (or set it in your spec config). This runs all phases sequentially without pausing. Recommended only for low-risk specs you have confidence in.
448
+
449
+ #### Does flow modify my code outside of `/curdx-flow:implement`?
450
+
451
+ No. The first four phases (`research` → `tasks`) only write to `specs/<spec>/`. Code changes happen exclusively in the `implement` phase, and every change is committed.
452
+
453
+ #### How does flow compare to GitHub's Spec Kit?
454
+
455
+ Spec Kit and flow share the spec-driven philosophy but differ in scope. Spec Kit is multi-agent-host (Claude Code, Copilot, Cursor, Codex, …) and CLI-driven (`specify init`). flow is Claude-Code-only, slash-command-driven, ships an autonomous execution loop, and bundles a marketplace. Pick flow if you live in Claude Code; pick Spec Kit if you need agent-host portability.
456
+
457
+ #### Where do I report bugs?
458
+
459
+ Run `/curdx-flow:feedback` inside Claude Code, or open an issue at <https://github.com/curdx/curdx-flow/issues>.
460
+
461
+ ---
462
+
463
+ ## 🧱 Requirements
464
+
465
+ - **Node.js** ≥ 20.12
466
+ - **Claude Code** CLI on `PATH` (the installer shells out to `claude plugin` and `claude mcp`)
467
+ - *(Optional)* **Bun** ≥ 1.0 — auto-detected and offered if you install `claude-mem`
468
+
469
+ Tested on macOS, Linux, and Windows (WSL2 recommended on Windows).
470
+
471
+ ---
472
+
473
+ ## 📜 License
474
+
475
+ MIT. Fork it. Ship it. Make it yours.
476
+
477
+ > Want to contribute? See [`CLAUDE.md`](./CLAUDE.md) for local dev setup and release SOP.
478
+
479
+ ---
480
+
481
+ ## 🔭 Plugin Observability (`analyze` CLI)
482
+
483
+ `npx @curdx/flow analyze` parses Claude Code session jsonl (`~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl`) merged with curdx-flow `~/.claude/curdx-flow/errors.jsonl` and outputs a 7-section markdown report:
484
+
485
+ - **Hook Failures** — Top-N hook entries by `exitCode ≠ 0` count
486
+ - **Slash Commands** — `/curdx-flow:*` invocation frequency (attribution + `<command-name>` XML fallback)
487
+ - **Subagents** — `Task` / `Agent` dispatch heat
488
+ - **Spec Funnel** — research → requirements → design → tasks → execution completion ratios
489
+ - **Hook Duration** — P50 / P95 / P99 latency per hook
490
+ - **Schema Drift** — unknown event types + parse errors
491
+ - **Parent UUID Chain** — `parentUuid` chain integrity rate (`withParent / total`)
492
+
493
+ ### Privacy (redact-by-default)
494
+
495
+ By default the report does **NOT** contain prompt full text, full file paths, or `file-history-snapshot` contents. Use `--include-prompts` to opt in (local debugging only).
59
496
 
60
- ## Requirements
497
+ ### Platform support
61
498
 
62
- - Node.js >= 20.12
63
- - `claude` CLI installed and on `PATH` (this tool shells out to `claude plugin` and `claude mcp`)
499
+ Verified on **macOS** and **Linux**. Windows is **declared supported but not tested** — `~/.claude/curdx-flow/errors.jsonl` write atomicity on NTFS is not guaranteed (POSIX `PIPE_BUF` 4 KB only applies to POSIX). Please report issues.
64
500
 
65
- ## License
501
+ ### Configuration
66
502
 
67
- MIT
503
+ Set `errorLogEnabled: false` in `~/.claude/settings.json` to disable hook error logging. The schema map at `plugins/curdx-flow/schemas/transcript-events.json` is auto-resolved post-bundle; if missing, the parser falls back to a builtin minimal whitelist with a stderr warning.