@curdx/flow 2.2.0 → 2.2.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.
Files changed (78) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +19 -2
  3. package/README.md +15 -8
  4. package/README.zh.md +5 -3
  5. package/agent-preamble/preamble.md +33 -0
  6. package/agents/flow-adversary.md +1 -1
  7. package/agents/flow-architect.md +2 -1
  8. package/agents/flow-brownfield-analyst.md +153 -0
  9. package/agents/flow-debugger.md +6 -11
  10. package/agents/flow-edge-hunter.md +1 -1
  11. package/agents/flow-executor.md +30 -8
  12. package/agents/flow-planner.md +38 -5
  13. package/agents/flow-product-designer.md +2 -1
  14. package/agents/flow-qa-engineer.md +9 -5
  15. package/agents/flow-researcher.md +2 -1
  16. package/agents/flow-reviewer.md +23 -5
  17. package/agents/flow-security-auditor.md +5 -3
  18. package/agents/flow-triage-analyst.md +5 -24
  19. package/agents/flow-ui-researcher.md +4 -3
  20. package/agents/flow-ux-designer.md +12 -39
  21. package/agents/flow-verifier.md +35 -3
  22. package/cli/README.md +3 -1
  23. package/cli/doctor-workflow.js +1074 -2
  24. package/cli/doctor.js +8 -0
  25. package/cli/help.js +2 -0
  26. package/cli/lib/doctor-report.js +256 -1
  27. package/cli/lib/frontmatter.js +44 -0
  28. package/cli/lib/json-schema.js +57 -0
  29. package/cli/lib/runtime.js +20 -2
  30. package/cli/utils.js +6 -1
  31. package/gates/adversarial-review-gate.md +1 -1
  32. package/gates/security-gate.md +2 -2
  33. package/gates/test-quality-gate.md +59 -0
  34. package/hooks/hooks.json +16 -2
  35. package/hooks/scripts/common.sh +4 -0
  36. package/hooks/scripts/session-start.sh +17 -2
  37. package/hooks/scripts/stop-watcher.sh +69 -18
  38. package/hooks/scripts/subagent-artifact-guard.sh +159 -0
  39. package/hooks/scripts/subagent-statusline.sh +105 -0
  40. package/knowledge/atomic-commits.md +1 -1
  41. package/knowledge/claude-code-runtime-contracts.md +203 -0
  42. package/knowledge/epic-decomposition.md +1 -1
  43. package/knowledge/execution-strategies.md +23 -1
  44. package/knowledge/planning-reviews.md +2 -2
  45. package/knowledge/poc-first-workflow.md +8 -8
  46. package/knowledge/review-feedback-intake.md +57 -0
  47. package/knowledge/two-stage-review.md +19 -6
  48. package/knowledge/wave-execution.md +16 -1
  49. package/output-styles/curdx-evidence-first.md +34 -0
  50. package/package.json +7 -1
  51. package/schemas/agent-frontmatter.schema.json +0 -7
  52. package/schemas/config.schema.json +14 -0
  53. package/schemas/hooks.schema.json +34 -2
  54. package/schemas/output-style-frontmatter.schema.json +22 -0
  55. package/schemas/plugin-manifest.schema.json +387 -17
  56. package/schemas/plugin-settings.schema.json +29 -0
  57. package/schemas/skill-frontmatter.schema.json +109 -4
  58. package/schemas/spec-state.schema.json +29 -4
  59. package/settings.json +6 -0
  60. package/skills/brownfield-index/SKILL.md +31 -35
  61. package/skills/browser-qa/SKILL.md +11 -3
  62. package/skills/cancel/SKILL.md +82 -0
  63. package/skills/debug/SKILL.md +6 -2
  64. package/skills/epic/SKILL.md +5 -3
  65. package/skills/fast/SKILL.md +1 -0
  66. package/skills/help/SKILL.md +17 -7
  67. package/skills/implement/SKILL.md +38 -7
  68. package/skills/init/SKILL.md +2 -1
  69. package/skills/review/SKILL.md +4 -1
  70. package/skills/security-audit/SKILL.md +17 -3
  71. package/skills/spec/SKILL.md +2 -1
  72. package/skills/start/SKILL.md +18 -18
  73. package/skills/status/SKILL.md +85 -0
  74. package/skills/ui-sketch/SKILL.md +11 -3
  75. package/skills/verify/SKILL.md +13 -1
  76. package/templates/config.json.tmpl +4 -1
  77. package/templates/progress.md.tmpl +19 -0
  78. package/templates/tasks.md.tmpl +26 -3
@@ -2,7 +2,30 @@
2
2
  name: brownfield-index
3
3
  description: Use when the user needs structural understanding of an unfamiliar, inherited, legacy, or brownfield codebase.
4
4
  when_to_use: Triggers on "legacy code", "brownfield", "unfamiliar", "new to this code", "new to this project", "just joined", "inherited codebase", "explore codebase", "understand structure", "index code", "map modules", "tour", "onboard", "what is this project".
5
- allowed-tools: [Read, Grep, Glob, Bash]
5
+ argument-hint: "[path]"
6
+ context: fork
7
+ agent: flow-brownfield-analyst
8
+ paths:
9
+ - "package.json"
10
+ - "pnpm-workspace.yaml"
11
+ - "turbo.json"
12
+ - "nx.json"
13
+ - "pyproject.toml"
14
+ - "requirements*.txt"
15
+ - "go.mod"
16
+ - "Cargo.toml"
17
+ - "Gemfile"
18
+ - "composer.json"
19
+ - "pom.xml"
20
+ - "build.gradle*"
21
+ - "mix.exs"
22
+ - "deno.json*"
23
+ - "src/**"
24
+ - "lib/**"
25
+ - "app/**"
26
+ - "apps/**"
27
+ - "packages/**"
28
+ - "services/**"
6
29
  ---
7
30
 
8
31
  # Brownfield Index
@@ -16,41 +39,14 @@ You are invoked when the user needs a structural map of an existing codebase the
16
39
 
17
40
  ## Workflow
18
41
 
19
- ### Step 1: Detect project type
42
+ This skill runs in a forked context through `flow-brownfield-analyst`, which will:
20
43
 
21
- Read `package.json` / `Cargo.toml` / `pyproject.toml` / `go.mod` / `pom.xml` to classify the ecosystem and build tool. This determines which directory conventions to apply.
44
+ 1. Detect the actual stack from the repo's manifests.
45
+ 2. Scan structure, entry points, module boundaries, and developer-loop commands.
46
+ 3. Map API / CLI surfaces when they exist.
47
+ 4. Write `.flow/codebase-index.md` with concrete next actions.
22
48
 
23
- ### Step 2: Scan directory structure
24
-
25
- Produce a top-level inventory:
26
- - **Entry points** (main / index / bin scripts)
27
- - **Module directories** (src/, lib/, internal/, pkg/ …)
28
- - **Test directories**
29
- - **Config files**
30
- - **Tooling** (CI, lint, format configs)
31
-
32
- ### Step 3: Component inventory
33
-
34
- For each module directory, list:
35
- - Files and their apparent role (inferred from names + top-of-file comments)
36
- - Public exports / exported symbols
37
- - Third-party dependencies imported
38
-
39
- ### Step 4: API surface
40
-
41
- If HTTP / RPC endpoints exist, index them: route → handler → middleware. For CLI tools, index commands → handlers.
42
-
43
- ### Step 5: Write index document
44
-
45
- Output `.flow/codebase-index.md` containing:
46
- - **Overview** (project purpose, build tool, runtime)
47
- - **Directory tree** (with per-directory one-liner descriptions)
48
- - **Entry points** (where execution starts)
49
- - **Key abstractions** (core types, interfaces, classes that everything else hangs off)
50
- - **External dependencies** (grouped: prod runtime / dev tooling / transitive)
51
- - **Known gaps / red flags** (missing tests, TODOs, suspicious patterns)
52
-
53
- ### Step 6: Hand off
49
+ ### Hand off
54
50
 
55
51
  Point the user at the next useful action:
56
52
  - "Looking to add a feature here? Run `/curdx-flow:start <name>` to begin a spec."
@@ -58,6 +54,6 @@ Point the user at the next useful action:
58
54
 
59
55
  ## Notes
60
56
 
61
- This skill uses Read + Grep + Glob + Bash with no specialized agent — general tools are enough for structural discovery. The index is meant to be quick (5–10 minutes), not exhaustive.
57
+ The index is meant to be quick and decision-useful, not exhaustive.
62
58
 
63
59
  For deep research into a specific library or framework, use `context7` MCP directly.
@@ -2,7 +2,15 @@
2
2
  name: browser-qa
3
3
  description: Use when the user needs real-browser QA for a UI or frontend flow.
4
4
  when_to_use: Triggers on "browser test", "test in browser", "UI test", "e2e test", "frontend test", "accessibility", "a11y", "WCAG", "lighthouse", "performance audit", "console error", "network request", "cross-browser", "responsive", "mobile test", "visual regression", "screenshot".
5
- allowed-tools: [Read, Write, Bash, Grep, Glob, WebFetch]
5
+ argument-hint: "\"<url or user flow>\""
6
+ context: fork
7
+ agent: flow-qa-engineer
8
+ paths:
9
+ - "**/*.{html,css,scss,sass,less,js,jsx,ts,tsx,vue,svelte,astro}"
10
+ - "app/**"
11
+ - "pages/**"
12
+ - "components/**"
13
+ - "public/**"
6
14
  ---
7
15
 
8
16
  # Browser QA
@@ -23,9 +31,9 @@ Confirm with the user:
23
31
  - **Flow to test** (e.g., "sign up → dashboard → logout")
24
32
  - **What success looks like** (accessibility / performance / zero console errors / visual match)
25
33
 
26
- ### Step 2: Dispatch `flow-qa-engineer`
34
+ ### Step 2: Run via `flow-qa-engineer`
27
35
 
28
- Delegate to the `flow-qa-engineer` agent. It will:
36
+ This skill executes in a forked context through `flow-qa-engineer`. The agent will:
29
37
  1. Open the target URL via `mcp__chrome_devtools__new_page`
30
38
  2. Drive the flow with `mcp__chrome_devtools__click` / `fill` / `navigate_page`
31
39
  3. Capture `list_console_messages`, `list_network_requests`, `take_screenshot`, optionally `lighthouse_audit`
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: cancel
3
+ description: Stop the active CurDX-Flow execution loop safely. Optional --delete-spec --yes removes the spec directory.
4
+ when_to_use: Use when the user wants to stop the current execution loop, abort a stuck run, or delete the active spec intentionally.
5
+ argument-hint: "[spec-name] [--delete-spec --yes]"
6
+ disable-model-invocation: true
7
+ allowed-tools: [Read, Bash]
8
+ ---
9
+
10
+ # CurdX-Flow Cancel
11
+
12
+ Safely stop an active execution loop. Default behavior is non-destructive: preserve spec files, tasks, progress, and artifacts.
13
+
14
+ ## Target Resolution
15
+
16
+ 1. If `$ARGUMENTS` includes a spec name, use `.flow/specs/<name>`.
17
+ 2. Otherwise read `.flow/.active-spec`.
18
+ 3. If no target exists, print `No active spec to cancel` and stop.
19
+
20
+ ## Default: Cancel Execution Loop Only
21
+
22
+ Default mode removes stop-hook/subagent execution state while preserving all human-readable artifacts:
23
+
24
+ 1. Read `.flow/specs/<target>/.state.json`.
25
+ 2. Use `Edit` or `Write` to set `phase` to `tasks`.
26
+ 3. Set `phase_status.execute` to `cancelled`.
27
+ 4. Remove `execute_state` and `strategy`.
28
+ 5. If the state file is missing, print `No execution state for <target>. Nothing to cancel.` and stop.
29
+
30
+ Do not rewrite `.state.json` with a Bash heredoc or ad-hoc Python writer; use checkpoint-tracked `Edit`/`Write` operations.
31
+
32
+ Append to `.progress.md`:
33
+
34
+ ```markdown
35
+ ## Execution Cancelled YYYY-MM-DD
36
+ - Cancelled by: /curdx-flow:cancel
37
+ - Preserved: research.md, requirements.md, design.md, tasks.md, progress, reports
38
+ - Resume: /curdx-flow:implement --strategy=subagent or /curdx-flow:spec --phase=tasks --regenerate
39
+ ```
40
+
41
+ ## Destructive Mode
42
+
43
+ Only delete the spec directory when both flags are present:
44
+
45
+ ```bash
46
+ /curdx-flow:cancel <spec-name> --delete-spec --yes
47
+ ```
48
+
49
+ If `--delete-spec` is present without `--yes`, do not delete. Print the exact command required.
50
+
51
+ Destructive mode:
52
+
53
+ 1. Print target path and files that will be removed.
54
+ 2. Delete `.flow/specs/<target>`.
55
+ 3. If it was active, remove `.flow/.active-spec`.
56
+ 4. Do not delete `.flow/PROJECT.md`, `.flow/CONTEXT.md`, `.flow/STATE.md`, or other specs.
57
+
58
+ ## Output
59
+
60
+ Default mode:
61
+
62
+ ```markdown
63
+ ✓ Cancelled execution loop: <spec-name>
64
+ State: execute → cancelled, phase → tasks
65
+ Preserved: spec artifacts and progress
66
+ Resume: /curdx-flow:implement --strategy=subagent
67
+ ```
68
+
69
+ Destructive mode:
70
+
71
+ ```markdown
72
+ ✓ Deleted spec: <spec-name>
73
+ Removed: .flow/specs/<spec-name>
74
+ Active spec cleared: yes|no
75
+ ```
76
+
77
+ ## Safety Rules
78
+
79
+ - Never delete a spec unless `--delete-spec --yes` is present.
80
+ - Never delete project-level `.flow` files.
81
+ - If state JSON is corrupt, rename it to `.state.json.corrupt.<timestamp>` instead of deleting it.
82
+ - Prefer `/curdx-flow:status` after cancel to confirm recovery state.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: debug
3
- description: Systematic debugging 4-phase methodology (root cause pattern hypothesis → fix); three failures trigger architectural questioning. Routes to flow-debugger.
3
+ description: Debug bugs, test failures, and flaky behavior with a 4-phase root-cause workflow. Routes to flow-debugger.
4
+ when_to_use: Use when the user reports a bug, failing test, regression, stack trace, flaky behavior, or wants root-cause analysis instead of trial-and-error edits.
4
5
  argument-hint: "\"<bug description>\""
5
6
  disable-model-invocation: true
6
7
  context: fork
@@ -28,6 +29,7 @@ If `$ARGUMENTS` is empty, print `Usage: /curdx-flow:debug "<bug description>"` a
28
29
 
29
30
  - Read the error carefully (stack trace + message + location).
30
31
  - Build a minimal reproduction.
32
+ - Append `## Reality Check (BEFORE)` to `.flow/specs/<active>/.progress.md` with the exact reproduction command, observed failure output, and timestamp before changing code.
31
33
  - Check recent changes that could have introduced the bug.
32
34
  - Trace the data flow from cause to symptom.
33
35
  - **Exit condition**: state the root cause in **one sentence**.
@@ -54,7 +56,8 @@ If `$ARGUMENTS` is empty, print `Usage: /curdx-flow:debug "<bug description>"` a
54
56
  2. Fix the root cause (not the symptom). Confirm the failing test now
55
57
  passes. Commit `fix(<scope>): green - ...`.
56
58
  3. Run the full regression suite; no regressions allowed.
57
- 4. If Phase 2 classified as systemic, sweep for sibling occurrences and
59
+ 4. Re-run the original reproduction command and append `## Reality Check (AFTER)` to `.progress.md`; write `Verified: Issue resolved` only when BEFORE failed and AFTER passes or no longer shows the original failure.
60
+ 5. If Phase 2 classified as systemic, sweep for sibling occurrences and
58
61
  fix them in the same stage. Optional third commit
59
62
  `fix(<scope>): sweep - N similar cases`.
60
63
 
@@ -82,6 +85,7 @@ Recommended next step: <user action — review architecture, ship a
82
85
  - Prayer-driven programming (retry without a new hypothesis each round)
83
86
  - "Maybe it's ..." as a Phase 1 conclusion
84
87
  - A fix commit without a corresponding failing-test commit
88
+ - A fix claim without BEFORE/AFTER reality verification in `.progress.md`
85
89
  - Masking the root cause with null checks / try-catch
86
90
  - Fixing multiple unrelated things in one commit (one task = one commit)
87
91
 
@@ -2,7 +2,9 @@
2
2
  name: epic
3
3
  description: Use when the user needs to decompose a large feature into smaller vertical-slice specs with dependencies.
4
4
  when_to_use: Triggers on "epic", "big feature", "too big", "decompose", "break down", "break into", "split into", "multi-spec", "multiple features", "sub-features", "vertical slice", "parent feature", "large scope", "won't fit in one sprint", "needs splitting".
5
- allowed-tools: [Read, Write, Grep, Glob, Bash]
5
+ argument-hint: "\"<epic goal>\""
6
+ context: fork
7
+ agent: flow-triage-analyst
6
8
  ---
7
9
 
8
10
  # Epic Decomposition
@@ -23,9 +25,9 @@ Ask the user (or infer from context) for:
23
25
  - **One-sentence goal** of the whole epic
24
26
  - **Hard boundary**: what is explicitly out of scope for this epic
25
27
 
26
- ### Step 2: Dispatch `flow-triage-analyst`
28
+ ### Step 2: Run via `flow-triage-analyst`
27
29
 
28
- Delegate to the `flow-triage-analyst` agent with the epic name + goal + boundary. The agent returns:
30
+ This skill executes in a forked context through `flow-triage-analyst`. The agent returns:
29
31
  - A vertical-slice decomposition (not horizontal by layer)
30
32
  - Dependency graph between slices
31
33
  - Shared interfaces that must be frozen before parallel work begins
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: fast
3
3
  description: Ultra-fast execution — skip all spec phases and implement directly per the description. Suited for one-shot small tasks.
4
+ when_to_use: Use when the task is small, surgical, low-ambiguity, and not worth a full spec workflow.
4
5
  argument-hint: "\"<task description>\""
5
6
  disable-model-invocation: true
6
7
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: help
3
3
  description: Show CurdX-Flow command list, workflow overview, or troubleshooting guide. With a command name, show that command's detail.
4
+ when_to_use: Use when the user asks how CurdX-Flow works, which command to run, what a workflow does, or how to troubleshoot common issues.
4
5
  argument-hint: "[<command-name> | workflow | troubleshoot]"
5
6
  disable-model-invocation: true
6
7
  allowed-tools: [Read, Bash]
@@ -10,17 +11,19 @@ allowed-tools: [Read, Bash]
10
11
 
11
12
  ## No argument — quick overview
12
13
 
13
- Show the 9 core slash commands + 5 auto-invoked skills. Keep the table compact, use tabs for alignment.
14
+ Show the 11 core slash commands + 5 auto-invoked skills. Keep the table compact, use tabs for alignment.
14
15
 
15
16
  ```
16
17
  🚀 CurdX-Flow v2 — Claude Code Discipline Layer
17
18
 
18
- 9 slash commands (explicit control)
19
+ 11 slash commands (explicit control)
19
20
  ────────────────────────────────────
20
21
  /curdx-flow:init Initialize .flow/ in the current project
21
22
  /curdx-flow:start Create / resume / switch a feature spec
23
+ /curdx-flow:status Show active spec, phase, task progress, recovery hints
22
24
  /curdx-flow:spec Write or refresh the spec (--phase, --review, --regenerate)
23
25
  /curdx-flow:implement Execute the tasks (auto-routed strategy)
26
+ /curdx-flow:cancel Cancel execution loop safely; optional spec deletion
24
27
  /curdx-flow:verify Goal-backward verification — the differentiator
25
28
  /curdx-flow:review Two-stage code review (+ --adversarial, --edge-case)
26
29
  /curdx-flow:fast Skip the spec — one-shot small task
@@ -49,7 +52,7 @@ Show the 9 core slash commands + 5 auto-invoked skills. Keep the table compact,
49
52
 
50
53
  ## `<command-name>` — command detail
51
54
 
52
- When the argument matches a slash name — one of the 9 primary workflows or one of the 5 auto-invoked skills — read the corresponding body and present it cleanly. The lookup tries the `skills/` layout first and falls back to the legacy `commands/` layout, which keeps help correct throughout the Phase 3 migration window:
55
+ When the argument matches a slash name — one of the 11 slash commands or one of the 5 auto-invoked skills — read the corresponding body and present it cleanly. The lookup tries the `skills/` layout first and falls back to the legacy `commands/` layout for older installed bundles:
53
56
 
54
57
  ```bash
55
58
  CMD="$ARGUMENTS"
@@ -60,13 +63,13 @@ elif [ -f "${CLAUDE_PLUGIN_ROOT}/commands/${CMD}.md" ]; then
60
63
  cat "${CLAUDE_PLUGIN_ROOT}/commands/${CMD}.md"
61
64
  else
62
65
  echo "Unknown: ${CMD}"
63
- echo "Workflows: init start spec implement verify review fast debug help"
66
+ echo "Workflows: init start status spec implement cancel verify review fast debug help"
64
67
  echo "Skills: epic browser-qa ui-sketch security-audit brownfield-index"
65
68
  exit 1
66
69
  fi
67
70
  ```
68
71
 
69
- If the argument isn't a known slash name, the block above prints the 14 candidates.
72
+ If the argument isn't a known slash name, the block above prints the 16 candidates.
70
73
 
71
74
  ## `workflow` — standard workflow
72
75
 
@@ -81,6 +84,7 @@ If the argument isn't a known slash name, the block above prints the 14 candidat
81
84
 
82
85
  3. Per feature — the main loop
83
86
  ├─ /curdx-flow:start my-feature "one-line goal"
87
+ ├─ /curdx-flow:status ← optional: see active spec + recovery hints
84
88
  ├─ /curdx-flow:spec ← research → requirements → design → tasks
85
89
  ├─ (optional) /curdx-flow:spec --review ← add multi-dim planning review
86
90
  ├─ /curdx-flow:implement ← execute tasks
@@ -121,13 +125,15 @@ A: v1.1.5+ defaults to offline install (bundled plugin body).
121
125
  Force-online: npx @curdx/flow install --online
122
126
 
123
127
  Q: claude-mem MCP keeps failing?
124
- A: It needs bun. Run: npx @curdx/flow doctor — it auto-symlinks bun if installed.
128
+ A: It needs bun. Run: npx @curdx/flow doctor
129
+ If doctor reports bun/uv is installed but not on PATH, run:
130
+ npx @curdx/flow doctor --fix
125
131
 
126
132
  Q: /curdx-flow:init says .flow/ already exists?
127
133
  A: Use --force, or run /curdx-flow:start directly to begin a new spec in the existing .flow/.
128
134
 
129
135
  Q: Skills don't auto-invoke reliably?
130
- A: Invoke explicitly — every skill also has a /skill-name slash. E.g., /curdx-flow:security-audit.
136
+ A: Invoke explicitly — plugin skills are namespaced. E.g., /curdx-flow:security-audit.
131
137
 
132
138
  Q: I want the old v1 commands (research, plan-ceo, party…).
133
139
  A: They're removed in v2. See MIGRATION.md for mappings, or stay on 1.x:
@@ -140,6 +146,10 @@ A: Your spec mode decides gate strictness. Lower via:
140
146
  Q: Where are decisions logged?
141
147
  A: .flow/STATE.md (D-NN entries). Edit directly — no slash command needed.
142
148
 
149
+ Q: Stop-hook or execution loop seems stuck?
150
+ A: Run /curdx-flow:status. If state/tasks disagree, run /curdx-flow:cancel, then resume with:
151
+ /curdx-flow:implement --strategy=subagent
152
+
143
153
  Q: File a bug / request feature
144
154
  A: https://github.com/curdx/curdx-flow/issues
145
155
  ```
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: implement
3
3
  description: Execute spec tasks — the Strategy Router picks linear/subagent/stop-hook/wave based on task characteristics. Atomic commit per task.
4
+ when_to_use: Use when the active spec already has tasks and the user wants execution, optionally with a chosen strategy or a single task id.
4
5
  argument-hint: "[spec-name] [--strategy=auto|linear|subagent|stop-hook|wave] [--task=<id>] [--quick]"
5
6
  disable-model-invocation: true
6
7
  allowed-tools: [Read, Write, Edit, Bash, Agent, Grep, Glob]
@@ -45,9 +46,9 @@ DIR=".flow/specs/$SPEC_NAME"
45
46
  ## Step 2: Parse Task Characteristics from tasks.md
46
47
 
47
48
  ```bash
48
- TOTAL=$(grep -c "^- \[ \] \*\*" "$DIR/tasks.md")
49
- DONE=$(grep -c "^- \[x\] \*\*" "$DIR/tasks.md")
50
- REMAINING=$((TOTAL))
49
+ TOTAL=$(grep -Ec "^- \[[ xX]\] \*\*" "$DIR/tasks.md")
50
+ DONE=$(grep -Ec "^- \[[xX]\] \*\*" "$DIR/tasks.md")
51
+ REMAINING=$((TOTAL - DONE))
51
52
  PARALLEL=$(grep -c "^- \[ \] \*\*.*\[P\]" "$DIR/tasks.md")
52
53
  SEQUENTIAL=$(grep -c "^- \[ \] \*\*.*\[SEQUENTIAL\]" "$DIR/tasks.md")
53
54
 
@@ -88,6 +89,13 @@ echo "✓ Selected strategy: $STRATEGY"
88
89
  import json
89
90
  p = f'.flow/specs/{SPEC_NAME}/.state.json'
90
91
  s = json.load(open(p))
92
+ try:
93
+ cfg = json.load(open('.flow/config.json'))
94
+ except Exception:
95
+ cfg = {}
96
+ execution_cfg = cfg.get('execution', {}) if isinstance(cfg, dict) else {}
97
+ recovery_mode = execution_cfg.get('recovery_mode', 'manual')
98
+ max_fix_tasks = execution_cfg.get('max_fix_tasks_per_original', 2)
91
99
  s['phase'] = 'execute'
92
100
  s['strategy'] = STRATEGY
93
101
  s.setdefault('phase_status', {})['execute'] = 'in_progress'
@@ -96,6 +104,9 @@ s['execute_state'].setdefault('task_index', DONE)
96
104
  s['execute_state']['total_tasks'] = TOTAL
97
105
  s['execute_state'].setdefault('failed_attempts', 0)
98
106
  s['execute_state'].setdefault('global_iteration', 1)
107
+ s['execute_state'].setdefault('recovery_mode', recovery_mode)
108
+ s['execute_state'].setdefault('max_fix_tasks_per_original', max_fix_tasks)
109
+ s['execute_state'].setdefault('fix_task_map', {})
99
110
  if QUICK:
100
111
  s['quickMode'] = True
101
112
  json.dump(s, open(p, 'w'), indent=2, ensure_ascii=False)
@@ -184,6 +195,8 @@ Configuration under `.flow/config.json.execution`: `strategy: "wave"`, `max_para
184
195
  5. Repeat until ALL_TASKS_COMPLETE or 3 failures
185
196
  ```
186
197
 
198
+ Stop-hook completion is double-checked: `.state.json` must say execute is complete AND `tasks.md` must have zero unchecked tasks. If either disagrees, the hook blocks and resumes the first unchecked task. During a stop-hook continuation, `stop_hook_active=true` is only a context signal; the hook still evaluates transcript signals, `.state.json`, and `tasks.md` parity before deciding whether to continue or stop.
199
+
187
200
  Prerequisites:
188
201
  - `--quick` must be set (otherwise AskUserQuestion will block the loop)
189
202
  - `.flow/config.json` or `.state.json` must have strategy=stop-hook
@@ -218,9 +231,27 @@ if all tasks done:
218
231
  ## Error Recovery
219
232
 
220
233
  - Verify field in tasks.md is "manual" → stop, suggest re-running `/curdx-flow:spec --phase=tasks --regenerate` to fix
234
+ - `TASK_FAILED` default (`recovery_mode: manual`) → do not skip the task; root-cause, retry the first unchecked task, stop at 3 failures
235
+ - `TASK_FAILED` with `recovery_mode: fix-task` → insert one targeted `[FIX <task_id>]` task immediately after the failed task, update `execute_state.fix_task_map`, execute that fix task, then retry the original task; never exceed `max_fix_tasks_per_original`
221
236
  - 3 consecutive TASK_FAILED → stop, prompt for user intervention
222
237
  - git operation failure → stop immediately, do not continue (avoid state corruption)
223
238
  - Test framework not found (npm test not found) → stop, suggest running npx @curdx/flow doctor
239
+ - State says complete but tasks.md still has unchecked tasks → trust tasks.md, continue remaining unchecked tasks only
240
+
241
+ ### Fix-Task Recovery Format
242
+
243
+ When enabled, generated recovery tasks must be narrowly scoped and traceable:
244
+
245
+ ```markdown
246
+ - [ ] **<task_id>.<n>** [FIX <task_id>] Fix: <short root cause>
247
+ - **Do**: <specific repair steps>
248
+ - **Files**: <same declared files or narrower>
249
+ - **Done when**: Original failure no longer reproduces
250
+ - **Verify**: <original verify command or tighter reproduction>
251
+ - **Commit**: `fix(<scope>): address <failure>`
252
+ ```
253
+
254
+ Do not execute a newly generated fix task in the same breath that creates it unless the task is already written to `tasks.md` and `fix_task_map` has been updated. The ledger stays ahead of execution.
224
255
 
225
256
  ## Output to User
226
257
 
@@ -233,9 +264,9 @@ Commits: M atomic commits
233
264
  Verify passed: K / K
234
265
 
235
266
  Next steps:
236
- - /curdx-flow:verify — goal-driven reverse verification (after Phase 3 ships)
237
- - If verify is not needed, go directly to /curdx-flow:ship (after Phase 6 ships)
267
+ - /curdx-flow:verify — goal-driven reverse verification
268
+ - /curdx-flow:review — two-stage code review after verification
238
269
 
239
- Phase 3 (Gates & Review) has not yet shipped.
240
- You may manually review .flow/specs/$SPEC_NAME/ and git log to confirm quality.
270
+ Do not claim the feature is shipped from execute alone. Execute completes tasks;
271
+ verify proves user-visible goals; review checks implementation quality.
241
272
  ```
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: init
3
3
  description: Initialize the CurdX-Flow project structure (create the .flow/ directory and core files)
4
+ when_to_use: Use when the current repository is not yet a CurdX-Flow project and needs the initial .flow scaffold.
4
5
  argument-hint: "[--force]"
5
6
  disable-model-invocation: true
6
7
  allowed-tools: [Read, Write, Bash, AskUserQuestion]
@@ -106,7 +107,7 @@ Next steps (in order):
106
107
  3. npx @curdx/flow doctor — verify health
107
108
  4. /curdx-flow:start <name> "<goal>" — begin your first feature spec
108
109
 
109
- Start development (after Phase 1 ships):
110
+ Start development:
110
111
  5. /curdx-flow:start <name> "<goal>" — kick off the first spec
111
112
  ```
112
113
 
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: review
3
- description: Two-stage code review — Stage 1 spec compliance, Stage 2 code quality. Optional flags add adversarial review, edge-case hunting, or developer-experience audit.
3
+ description: "Run two-stage review: spec compliance first, code quality second. Optional flags add adversarial, edge-case, and DevEx passes."
4
+ when_to_use: Use when implementation exists and the user wants review findings, spec-compliance checks, adversarial review, edge-case hunting, or a DevEx audit.
4
5
  argument-hint: "[--stage=<1|2|both>] [--adversarial] [--edge-case] [--devex]"
5
6
  disable-model-invocation: true
6
7
  allowed-tools: [Read, Bash, Agent, Grep, Glob]
@@ -12,6 +13,8 @@ Distinct from `/curdx-flow:verify`:
12
13
  - **verify** checks that the spec's stated goals actually work (goal-backward).
13
14
  - **review** checks that the code is good (spec compliance + craftsmanship).
14
15
 
16
+ When this command is used to review follow-up work after prior review comments, apply `@${CLAUDE_PLUGIN_ROOT}/knowledge/review-feedback-intake.md` first: classify each feedback item before changing code, verify it against the current code/spec, and record accepted fixes or technical pushback in `.progress.md`.
17
+
15
18
  ## Flags
16
19
 
17
20
  | Flag | Default | Purpose |
@@ -2,7 +2,21 @@
2
2
  name: security-audit
3
3
  description: Use when the user needs security review of code, specs, credentials, sensitive data, or dependency risk.
4
4
  when_to_use: Triggers on "security", "auth", "authentication", "credential", "password", "secret", "API key", "token", "OWASP", "STRIDE", "CVE", "vulnerability", "injection", "XSS", "CSRF", "SSRF", "SQL injection", "hardcoded secret", "sensitive data", "leak", "will my API key leak", "is this safe".
5
- allowed-tools: [Read, Grep, Glob, Bash, WebSearch]
5
+ argument-hint: "[scope] [--depth=<owasp|stride|full>]"
6
+ context: fork
7
+ agent: flow-security-auditor
8
+ paths:
9
+ - "**/*.{js,jsx,ts,tsx,py,rb,go,java,kt,php,cs,rs,swift,sql,sh}"
10
+ - "**/*.{json,yml,yaml,toml,tf,hcl,conf,ini}"
11
+ - "**/.env*"
12
+ - "**/Dockerfile*"
13
+ - ".github/workflows/**"
14
+ - ".gitlab-ci.yml"
15
+ - "docker-compose*.yml"
16
+ - "k8s/**"
17
+ - "helm/**"
18
+ - "infra/**"
19
+ - "terraform/**"
6
20
  ---
7
21
 
8
22
  # Security Audit
@@ -23,9 +37,9 @@ Confirm:
23
37
  - **Depth** (OWASP-only / OWASP + STRIDE / + dependency CVE scan)
24
38
  - **Risk tolerance** (block on any SR / only block on SR with POC / advisory only)
25
39
 
26
- ### Step 2: Dispatch `flow-security-auditor`
40
+ ### Step 2: Run via `flow-security-auditor`
27
41
 
28
- Delegate to the `flow-security-auditor` agent. It will:
42
+ This skill executes in a forked context through `flow-security-auditor`. It will:
29
43
  1. Scan for hardcoded secrets, weak crypto, unsanitized inputs
30
44
  2. Apply OWASP Top 10 (A01 Broken Access Control → A10 SSRF)
31
45
  3. Apply STRIDE threat modeling (Spoofing, Tampering, Repudiation, Information disclosure, DoS, Elevation)
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: spec
3
- description: Generate or refresh a feature specification. By default runs research requirements design tasks in sequence. Flags let you target a single phase, stop early, regenerate, or tack on a multi-dimensional planning review.
3
+ description: Generate or refresh the active spec across research, requirements, design, and tasks. Flags target phases, regeneration, and planning review.
4
+ when_to_use: Use when the user wants to generate, resume, regenerate, or review a feature spec across research, requirements, design, and task planning.
4
5
  argument-hint: "[--phase=<X[,Y,...]>] [--until=<X>] [--review[=<dim[,dim]>]] [--regenerate] [--resume]"
5
6
  disable-model-invocation: true
6
7
  allowed-tools: [Read, Write, Bash, Agent, AskUserQuestion]
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: start
3
3
  description: Smart entry point — create a new spec, resume an existing one, or switch between specs. Replaces v1's /start + /switch.
4
+ when_to_use: Use when the user wants to create a spec, switch active work, resume a prior spec, list specs, or set the workflow mode for a feature.
4
5
  argument-hint: "[<spec-name>] [\"<one-line goal>\"] [--resume] [--list] [--mode=<fast|standard|enterprise>]"
5
6
  disable-model-invocation: true
6
7
  allowed-tools: [Read, Write, Bash, AskUserQuestion, Agent]
@@ -82,16 +83,17 @@ Switch `.flow/.active-spec` to `SPEC_NAME`. Confirm with the user if they intend
82
83
  ### Branch D: `SPEC_NAME` provided, spec does NOT exist
83
84
  Create a new spec:
84
85
 
85
- ```bash
86
- mkdir -p ".flow/specs/$SPEC_NAME"
87
- # NOTE: field names MUST match schemas/spec-state.schema.json:
88
- # - spec_name (not "spec")
89
- # - created (date, not "created_at")
90
- # - updated (date-time, not "updated_at")
91
- # - phase must be one of the enum values; the initial phase is "research"
92
- # (there is no "created" phase — that was schema drift pre-beta.9)
93
- # - version is required
94
- cat > ".flow/specs/$SPEC_NAME/.state.json" <<JSON
86
+ Use the `Write` tool for `.flow/specs/$SPEC_NAME/.state.json` and `.flow/.active-spec` so Claude Code checkpoints can rewind the new spec. The state file must match `schemas/spec-state.schema.json`:
87
+
88
+ - `spec_name`, not `spec`
89
+ - `created` as date, not `created_at`
90
+ - `updated` as date-time, not `updated_at`
91
+ - `phase` starts as `research`; there is no `created` phase
92
+ - `version` is required
93
+
94
+ Initial state JSON shape:
95
+
96
+ ```json
95
97
  {
96
98
  "version": "1.0",
97
99
  "spec_name": "$SPEC_NAME",
@@ -101,31 +103,29 @@ cat > ".flow/specs/$SPEC_NAME/.state.json" <<JSON
101
103
  "phase_status": {},
102
104
  "strategy": "auto",
103
105
  "execute_state": {},
104
- "created": "$(date -u +%Y-%m-%d)",
105
- "updated": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
106
+ "created": "YYYY-MM-DD",
107
+ "updated": "YYYY-MM-DDTHH:MM:SSZ"
106
108
  }
107
- JSON
108
- echo "$SPEC_NAME" > .flow/.active-spec
109
109
  ```
110
110
 
111
111
  If `GOAL` is empty, `AskUserQuestion` to gather it before writing `.state.json`.
112
112
 
113
113
  Then seed a minimal `.progress.md`:
114
114
 
115
- ```bash
116
- cat > ".flow/specs/$SPEC_NAME/.progress.md" <<MD
115
+ Use the `Write` tool for `.flow/specs/$SPEC_NAME/.progress.md`:
116
+
117
+ ```markdown
117
118
  # Progress Log — $SPEC_NAME
118
119
 
119
120
  **Goal**: $GOAL
120
121
  **Mode**: $FLAG_MODE
121
- **Created**: $(date -u +%Y-%m-%d)
122
+ **Created**: YYYY-MM-DD
122
123
 
123
124
  ## Decisions
124
125
  (populated during /curdx-flow:spec)
125
126
 
126
127
  ## Learnings
127
128
  (populated during /curdx-flow:implement)
128
- MD
129
129
  ```
130
130
 
131
131
  ### Branch E: no args, no flags