@curdx/flow 7.1.2 → 7.1.4

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,40 @@
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.4 — 2026-05-06
6
+
7
+ ### Changed
8
+
9
+ - **`~/.claude/CLAUDE.md` managed block is now language-aware.** `src/runner/claudeMd.ts` no longer emits a single Chinese-only block regardless of installer language. The managed `<!-- BEGIN @curdx/flow v1 -->` block now renders in English when the installer runs with `--lang en` (or `CURDX_FLOW_LANG=en`) and in Chinese when it runs with `zh`. This keeps the generated guidance aligned with the installer's selected language instead of mixing an English install flow with Chinese managed instructions.
10
+ - **Chinese installs inject an explicit language policy into the managed block.** When the current installer language is `zh`, flow now prepends a `Language Policy` section that instructs Claude to keep tool/model interaction in English while replying to the user in Simplified Chinese. English installs do not inject this section. This behavior is covered by new tests in `tests/runner/claudeMd.test.ts`.
11
+ - **Managed-block guidance now uses clearer Claude Code terminology.** The block now distinguishes slash commands from MCP capabilities and plugin skills instead of mixing them together. `claude-mem` calls are rendered as `/claude-mem:...`, Context7 / sequential-thinking / Chrome DevTools are described as MCP capabilities, and the overly-strong `frontend-design` "auto fire" wording was softened to "prioritize, then invoke explicitly if needed". The global decision tree also stopped leaking `TaskCreate` as a user-facing universal rule, matching current Claude Code best-practice guidance more closely.
12
+
13
+ ### Added
14
+
15
+ - **README alignment for managed `CLAUDE.md` behavior.** `README.md` and `README.zh-CN.md` now document that language selection affects not only the installer UI, but also the rendering of the managed `CLAUDE.md` block, including the extra Chinese-mode language policy injection.
16
+
17
+ ## 7.1.3 — 2026-05-05
18
+
19
+ ### Added
20
+
21
+ - **`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`).
22
+ - New 5-piece module: `src/analyze/{parser,filter,report,redact,error-logger}.ts` + `index.ts` orchestrator + `types.ts`.
23
+ - New CLI flow: `src/flows/analyze.ts` (lazy `await import('../analyze/index.ts')` so the analyze pipeline only loads when invoked).
24
+ - 4 micro-edits to `src/index.ts` (citty registration: import + `defineCommand` ref + `subCommands` extension + `SUBCOMMANDS.add('analyze')`).
25
+ - **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).
26
+ - **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`.
27
+ - **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.
28
+ - **i18n strings for `analyze`** in `src/i18n/{en,zh}.ts` — 10 + 10 keys (`analyze.description`, `analyze.flags.*`, `analyze.warning.*`).
29
+ - **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.
30
+
31
+ ### Fixed
32
+
33
+ - **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`).
34
+
35
+ ### Changed
36
+
37
+ - **`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`.
38
+
5
39
  ## 7.1.2 — 2026-05-04
6
40
 
7
41
  ### Added
package/README.md CHANGED
@@ -1,67 +1,505 @@
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
+ That language choice also controls the managed `~/.claude/CLAUDE.md` block that flow writes. The block is rendered in the selected language, and when you choose `zh` it additionally injects a language policy telling Claude to keep tool/model interaction in English while replying to the user in Simplified Chinese.
137
+
138
+ ### Common workflows
14
139
 
15
140
  ```bash
16
- npx @curdx/flow # interactive menu
17
- npx @curdx/flow install # interactive install (current state-aware)
141
+ # Interactive menu — install / update / uninstall / status
142
+ npx @curdx/flow
143
+
144
+ # Non-interactive: install everything available
18
145
  npx @curdx/flow install --all --yes
19
- npx @curdx/flow uninstall
20
- npx @curdx/flow update
146
+
147
+ # Check what is installed and whether anything is stale
21
148
  npx @curdx/flow status
22
- npx @curdx/flow status --json
23
- npx @curdx/flow --lang en # override language
149
+ npx @curdx/flow status --json # machine-readable
150
+
151
+ # Update everything to the latest version
152
+ npx @curdx/flow update
153
+
154
+ # Uninstall everything cleanly (also removes the managed CLAUDE.md block)
155
+ npx @curdx/flow uninstall
156
+
157
+ # Override the language for a single invocation
158
+ npx @curdx/flow --lang en
24
159
  ```
25
160
 
26
- ## What it installs
161
+ ### Verifying the install
162
+
163
+ ```bash
164
+ claude plugin list # should show curdx-flow@curdx
165
+ claude mcp list # any MCP servers you opted in to
166
+ npx @curdx/flow status # green checkmarks for installed items
167
+ ```
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
+ In Claude Code, type `/curdx-flow:` and you should see autocomplete for all commands.
37
170
 
38
- ## What it writes to your filesystem
171
+ ---
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
+ ## Quick start
41
174
 
175
+ After install, in any project:
176
+
177
+ ```bash
178
+ cd ~/projects/my-app
179
+ claude # start Claude Code
180
+ ```
181
+
182
+ Then in the Claude Code prompt:
183
+
184
+ ```text
185
+ /curdx-flow:start
186
+ > I want to add a rate-limited /api/upload endpoint with S3 multipart support.
42
187
  ```
43
- <!-- BEGIN @curdx/flow v1 -->
44
- ## Tool Usage
45
188
 
46
- Available tools/plugins:
47
- - pua (v3.0.0) — `/pua:*` — auto-fires on 2+ failures or user frustration; ...
48
- - ...
189
+ 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.
190
+
191
+ ---
192
+
193
+ ## 🎬 Walkthrough — your first spec
194
+
195
+ A concrete end-to-end example, with what flow does at each step.
196
+
197
+ #### 1. `/curdx-flow:start`
198
+
199
+ ```text
200
+ > I want to add a rate-limited /api/upload endpoint with S3 multipart support.
201
+ ```
202
+
203
+ flow:
204
+
205
+ - creates `specs/upload-api/` and a `.curdx-state.json` execution-state file
206
+ - runs a 60-second interview (≈3 clarifying questions tuned to the goal)
207
+ - detects relevant skills from your installed plugins and pre-loads them
208
+ - dispatches a parallel research team — one agent investigates S3 multipart, one investigates rate-limiting strategies, one surveys your codebase for existing upload patterns
209
+ - merges results into `specs/upload-api/research.md`
210
+ - pauses for approval
211
+
212
+ #### 2. `/curdx-flow:requirements`
213
+
214
+ 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`.
215
+
216
+ #### 3. `/curdx-flow:design`
217
+
218
+ 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`.
219
+
220
+ #### 4. `/curdx-flow:tasks`
221
+
222
+ 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`.
223
+
224
+ #### 5. `/curdx-flow:implement`
225
+
226
+ The spec-executor begins the autonomous loop:
227
+
228
+ ```
229
+ loop:
230
+ pick next unchecked task from tasks.md
231
+ open fresh context with task description, design.md excerpt, relevant files
232
+ implement → run verification command → commit on success
233
+ mark task [x] in tasks.md
234
+ if verification fails → retry up to N times → if still failing, halt and surface
235
+ repeat until ALL_TASKS_COMPLETE
236
+ ```
237
+
238
+ You can step away. When you come back, `tasks.md` is fully checked off and the diff is in your branch.
239
+
240
+ ---
241
+
242
+ ## 🧱 Core concepts
243
+
244
+ #### Spec
245
+
246
+ 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.
247
+
248
+ #### Phase
49
249
 
50
- Rules:
51
- - Do not call every tool by default; ...
52
- - ...
250
+ 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.
53
251
 
54
- Run `npx @curdx/flow` to install / update / uninstall.
55
- <!-- END @curdx/flow v1 -->
252
+ #### Subagent
253
+
254
+ 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.
255
+
256
+ #### Skill
257
+
258
+ 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/`.
259
+
260
+ #### Hook
261
+
262
+ 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.
263
+
264
+ #### Autonomous loop
265
+
266
+ 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.
267
+
268
+ #### Epic
269
+
270
+ 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.
271
+
272
+ ---
273
+
274
+ ## 🛠️ Commands
275
+
276
+ The bundled plugin exposes these slash commands inside Claude Code:
277
+
278
+ | Command | Description |
279
+ | --- | --- |
280
+ | `/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. |
281
+ | `/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. |
282
+ | `/curdx-flow:research` | Run or re-run the research phase for the active spec. Dispatches the parallel research team. |
283
+ | `/curdx-flow:requirements` | Generate `requirements.md` from goal + research, via the product-manager subagent. |
284
+ | `/curdx-flow:design` | Generate `design.md` from requirements, via the architect-reviewer subagent. |
285
+ | `/curdx-flow:tasks` | Break the design into a checked task list (`tasks.md`), via the task-planner subagent. |
286
+ | `/curdx-flow:implement` | Begin the autonomous execution loop. Runs every unchecked task in `tasks.md` until completion or unrecoverable failure. |
287
+ | `/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. |
288
+ | `/curdx-flow:status` | Show all specs, their phase, and progress. |
289
+ | `/curdx-flow:switch` | Switch the active spec for resume / continuation. |
290
+ | `/curdx-flow:refactor` | Methodically update spec files (requirements → design → tasks) after execution has revealed they need revision. |
291
+ | `/curdx-flow:cancel` | Cancel the active execution loop, clean up state, and (optionally) remove the spec. |
292
+ | `/curdx-flow:index` | Index the codebase and external resources into searchable spec metadata. |
293
+ | `/curdx-flow:help` | Show plugin help and a workflow overview. |
294
+ | `/curdx-flow:feedback` | Submit feedback or report a plugin issue. |
295
+
296
+ ---
297
+
298
+ ## 🤖 Subagents
299
+
300
+ 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.
301
+
302
+ | Subagent | Role |
303
+ | --- | --- |
304
+ | `research-analyst` | Investigates the goal via web search, documentation, and codebase exploration. Multiple instances run in parallel during the research phase. |
305
+ | `product-manager` | Translates research into structured requirements (user stories, functional and non-functional requirements, acceptance criteria). |
306
+ | `architect-reviewer` | Designs scalable, maintainable systems. Produces `design.md` with components, decisions, risks, and file-change manifest. |
307
+ | `task-planner` | Breaks a design into a sequenced, checkable task list with verification gates. Supports `fine` and `coarse` granularity modes. |
308
+ | `spec-executor` | The autonomous executor. Implements one task end-to-end per invocation, verifies, commits, and signals completion to the loop. |
309
+ | `spec-reviewer` | Read-only reviewer that validates artifacts against type-specific rubrics. Outputs `REVIEW_PASS` or `REVIEW_FAIL`. |
310
+ | `qa-engineer` | Runs verification commands at quality gates. Outputs `VERIFICATION_PASS` or `VERIFICATION_FAIL`. |
311
+ | `refactor-specialist` | Updates spec files section-by-section after execution surfaces design drift. |
312
+ | `triage-analyst` | Decomposes a large feature into multiple dependency-aware specs (epic graph). |
313
+
314
+ ---
315
+
316
+ ## 📦 The marketplace
317
+
318
+ The installer ships with a curated set of plugins and MCP servers. You opt in per item.
319
+
320
+ | ID | Type | Source | Purpose |
321
+ | --- | --- | --- | --- |
322
+ | **`curdx-flow`** | plugin | bundled in this repo | Spec-driven dev workflow. **Always installed.** |
323
+ | `claude-mem` | plugin | `thedotmack/claude-mem` | Cross-session memory. Stores observations and recalls them at the start of subsequent sessions. |
324
+ | `pua` | plugin | `tanweai/pua` | "Anti-failure" pressure mode. Auto-fires on 2+ consecutive failures or detected user frustration; pushes the agent to switch approaches. |
325
+ | `chrome-devtools-mcp` | plugin | `ChromeDevTools/chrome-devtools-mcp` | Drive a real Chrome via MCP — performance traces, network inspection, console, screenshots, accessibility audits. |
326
+ | `frontend-design` | plugin | `claude-plugins-official` | Distinctive, production-grade frontend output. Avoids generic AI aesthetics. |
327
+ | `sequential-thinking` | mcp | `@modelcontextprotocol/server-sequential-thinking` | Step-by-step reasoning MCP server. |
328
+ | `context7` | mcp | `https://mcp.context7.com/mcp` | Live library documentation over MCP. Beats stale training-data answers for recent SDK changes. |
329
+
330
+ Run `npx @curdx/flow status` to see what is installed on your machine.
331
+
332
+ ---
333
+
334
+ ## ⚙️ Configuration
335
+
336
+ ### Flags
337
+
338
+ | Flag | Effect |
339
+ | --- | --- |
340
+ | `--all` | Apply to every available item (with `install` or `update`). |
341
+ | `--yes` | Skip all confirmations (non-interactive). |
342
+ | `--lang en` / `--lang zh` | Override the language for the current invocation, including the language used when rendering the managed `CLAUDE.md` block. |
343
+ | `--no-claude-md` | Do not write the managed block to `~/.claude/CLAUDE.md`. |
344
+ | `--json` | Output machine-readable JSON (with `status`). |
345
+ | `--quick` | (Plugin) Run all phases of a spec sequentially without pausing for approval. Use with caution. |
346
+ | `--commit-spec` / `--no-commit-spec` | (Plugin) Commit spec artifacts after each phase. Default: `true`. |
347
+ | `--specs-dir <path>` | (Plugin) Write specs to a non-default directory (e.g. `packages/api/specs/`). |
348
+ | `--tasks-size fine` / `--tasks-size coarse` | (Plugin) Granularity of `tasks.md` decomposition. |
349
+
350
+ ### Environment variables
351
+
352
+ | Variable | Effect |
353
+ | --- | --- |
354
+ | `CURDX_FLOW_NO_CLAUDE_MD=1` | Equivalent to `--no-claude-md`. |
355
+ | `CURDX_FLOW_LANG=en` / `=zh` | Default language for the installer and for managed `CLAUDE.md` block rendering. |
356
+ | `CONTEXT7_API_KEY` | Optional API key for the context7 MCP server. |
357
+
358
+ ### Per-project overrides
359
+
360
+ 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`.
361
+
362
+ ---
363
+
364
+ ## 📁 Project layout
365
+
366
+ After install, here is what is on your machine:
367
+
368
+ ```
369
+ ~/.claude/
370
+ ├── plugins/cache/curdx/curdx-flow/<version>/ # the bundled plugin
371
+ │ ├── commands/ # /curdx-flow:* slash commands
372
+ │ ├── agents/ # subagent definitions
373
+ │ ├── skills/ # bundled skills
374
+ │ ├── hooks/scripts/ # built hook bundles (.mjs)
375
+ │ └── schemas/ # JSON schemas
376
+ ├── plugins/cache/<other-plugins>/ # plugins you opted into
377
+ └── CLAUDE.md # global; contains <!-- BEGIN @curdx/flow v1 --> block
378
+ ```
379
+
380
+ Inside any project that uses flow:
381
+
382
+ ```
383
+ <your-project>/
384
+ └── specs/
385
+ ├── .current-spec # active spec name (or path)
386
+ ├── .current-epic # active epic, if any
387
+ ├── .index/ # spec index for search/triage
388
+ └── <spec-name>/
389
+ ├── research.md
390
+ ├── requirements.md
391
+ ├── design.md
392
+ ├── tasks.md
393
+ ├── .curdx-state.json # execution state (gitignored)
394
+ └── .progress.md # phase notes (gitignored)
56
395
  ```
57
396
 
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.
397
+ The four canonical artifacts (`research.md` `tasks.md`) are committed with your code. State and progress files are gitignored.
398
+
399
+ 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. The block is language-aware: `--lang en` renders the guidance in English, `--lang zh` renders it in Chinese, and the `zh` variant also injects a language policy requiring English for tool/model interaction and Simplified Chinese for user-facing replies. Pass `--no-claude-md` (or set `CURDX_FLOW_NO_CLAUDE_MD=1`) to opt out of the managed block.
400
+
401
+ ---
402
+
403
+ ## 💡 Why it exists
404
+
405
+ Claude Code is fast, but on real projects it has predictable failure modes:
406
+
407
+ - **It skips tests** unless you keep telling it to write them.
408
+ - **It loses context** between sessions, between rate-limit resets, and inside very long sessions.
409
+ - **It produces inconsistent output** across runs of the same task.
410
+ - **It does not push back** on under-specified requirements — it just guesses, and you discover the mismatch in code review.
411
+
412
+ 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.
413
+
414
+ `@curdx/flow` makes a different bet:
415
+
416
+ 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.
417
+ 2. **Subagents are specialized, not stacked.** One agent per phase. Each gets a fresh context window. No multi-agent orchestration salad.
418
+ 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.
419
+ 4. **Installer and plugin in one package.** No separate marketplace registration, no scaffolding, no per-project config. `npx @curdx/flow` once.
420
+
421
+ > Claude Code is the engine. `curdx-flow` is the chassis.
422
+
423
+ ---
424
+
425
+ ## ❓ FAQ
426
+
427
+ #### Does this replace Claude Code?
428
+
429
+ 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.
430
+
431
+ #### Can I use flow without installing the marketplace plugins?
432
+
433
+ 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.
434
+
435
+ #### Do I need to commit the spec files?
436
+
437
+ 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.
438
+
439
+ #### What happens if a task fails verification mid-loop?
440
+
441
+ 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.
442
+
443
+ #### Can I run multiple specs in parallel?
444
+
445
+ 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.
446
+
447
+ #### Is there a "quick mode" that skips approvals?
448
+
449
+ 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.
450
+
451
+ #### Does flow modify my code outside of `/curdx-flow:implement`?
452
+
453
+ 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.
454
+
455
+ #### How does flow compare to GitHub's Spec Kit?
456
+
457
+ 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.
458
+
459
+ #### Where do I report bugs?
460
+
461
+ Run `/curdx-flow:feedback` inside Claude Code, or open an issue at <https://github.com/curdx/curdx-flow/issues>.
462
+
463
+ ---
464
+
465
+ ## 🧱 Requirements
466
+
467
+ - **Node.js** ≥ 20.12
468
+ - **Claude Code** CLI on `PATH` (the installer shells out to `claude plugin` and `claude mcp`)
469
+ - *(Optional)* **Bun** ≥ 1.0 — auto-detected and offered if you install `claude-mem`
470
+
471
+ Tested on macOS, Linux, and Windows (WSL2 recommended on Windows).
472
+
473
+ ---
474
+
475
+ ## 📜 License
476
+
477
+ MIT. Fork it. Ship it. Make it yours.
478
+
479
+ > Want to contribute? See [`CLAUDE.md`](./CLAUDE.md) for local dev setup and release SOP.
480
+
481
+ ---
482
+
483
+ ## 🔭 Plugin Observability (`analyze` CLI)
484
+
485
+ `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:
486
+
487
+ - **Hook Failures** — Top-N hook entries by `exitCode ≠ 0` count
488
+ - **Slash Commands** — `/curdx-flow:*` invocation frequency (attribution + `<command-name>` XML fallback)
489
+ - **Subagents** — `Task` / `Agent` dispatch heat
490
+ - **Spec Funnel** — research → requirements → design → tasks → execution completion ratios
491
+ - **Hook Duration** — P50 / P95 / P99 latency per hook
492
+ - **Schema Drift** — unknown event types + parse errors
493
+ - **Parent UUID Chain** — `parentUuid` chain integrity rate (`withParent / total`)
494
+
495
+ ### Privacy (redact-by-default)
496
+
497
+ 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
498
 
60
- ## Requirements
499
+ ### Platform support
61
500
 
62
- - Node.js >= 20.12
63
- - `claude` CLI installed and on `PATH` (this tool shells out to `claude plugin` and `claude mcp`)
501
+ 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
502
 
65
- ## License
503
+ ### Configuration
66
504
 
67
- MIT
505
+ 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.