@curdx/flow 2.1.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 (91) hide show
  1. package/.claude-plugin/marketplace.json +25 -2
  2. package/.claude-plugin/plugin.json +27 -1
  3. package/CHANGELOG.md +32 -0
  4. package/README.md +18 -8
  5. package/README.zh.md +8 -3
  6. package/agent-preamble/preamble.md +35 -2
  7. package/agents/flow-adversary.md +1 -1
  8. package/agents/flow-architect.md +2 -1
  9. package/agents/flow-brownfield-analyst.md +153 -0
  10. package/agents/flow-debugger.md +6 -11
  11. package/agents/flow-edge-hunter.md +1 -1
  12. package/agents/flow-executor.md +30 -8
  13. package/agents/flow-planner.md +38 -5
  14. package/agents/flow-product-designer.md +2 -1
  15. package/agents/flow-qa-engineer.md +25 -20
  16. package/agents/flow-researcher.md +2 -1
  17. package/agents/flow-reviewer.md +23 -5
  18. package/agents/flow-security-auditor.md +5 -3
  19. package/agents/flow-triage-analyst.md +5 -24
  20. package/agents/flow-ui-researcher.md +6 -5
  21. package/agents/flow-ux-designer.md +12 -39
  22. package/agents/flow-verifier.md +38 -6
  23. package/bin/curdx-flow +5 -0
  24. package/cli/README.md +13 -10
  25. package/cli/doctor-workflow.js +1074 -2
  26. package/cli/doctor.js +8 -0
  27. package/cli/help.js +2 -0
  28. package/cli/install-companions.js +4 -1
  29. package/cli/install-required-plugins.js +18 -5
  30. package/cli/install-self-update.js +2 -91
  31. package/cli/install.js +12 -1
  32. package/cli/lib/claude.js +42 -11
  33. package/cli/lib/doctor-report.js +303 -9
  34. package/cli/lib/frontmatter.js +44 -0
  35. package/cli/lib/json-schema.js +57 -0
  36. package/cli/lib/runtime.js +20 -2
  37. package/cli/lib/semver.js +95 -0
  38. package/cli/utils.js +7 -1
  39. package/gates/adversarial-review-gate.md +1 -1
  40. package/gates/security-gate.md +2 -2
  41. package/gates/test-quality-gate.md +59 -0
  42. package/hooks/hooks.json +16 -2
  43. package/hooks/scripts/common.sh +4 -0
  44. package/hooks/scripts/quick-mode-guard.sh +6 -7
  45. package/hooks/scripts/session-start.sh +17 -2
  46. package/hooks/scripts/stop-watcher.sh +69 -18
  47. package/hooks/scripts/subagent-artifact-guard.sh +159 -0
  48. package/hooks/scripts/subagent-statusline.sh +105 -0
  49. package/knowledge/atomic-commits.md +1 -1
  50. package/knowledge/claude-code-runtime-contracts.md +203 -0
  51. package/knowledge/epic-decomposition.md +1 -1
  52. package/knowledge/execution-strategies.md +28 -6
  53. package/knowledge/planning-reviews.md +4 -4
  54. package/knowledge/poc-first-workflow.md +8 -8
  55. package/knowledge/review-feedback-intake.md +57 -0
  56. package/knowledge/two-stage-review.md +19 -6
  57. package/knowledge/wave-execution.md +33 -18
  58. package/output-styles/curdx-evidence-first.md +34 -0
  59. package/package.json +9 -2
  60. package/schemas/agent-frontmatter.schema.json +59 -0
  61. package/schemas/config.schema.json +37 -3
  62. package/schemas/gate-frontmatter.schema.json +30 -0
  63. package/schemas/hooks.schema.json +115 -0
  64. package/schemas/output-style-frontmatter.schema.json +22 -0
  65. package/schemas/plugin-manifest.schema.json +436 -0
  66. package/schemas/plugin-settings.schema.json +29 -0
  67. package/schemas/skill-frontmatter.schema.json +177 -0
  68. package/schemas/spec-state.schema.json +35 -5
  69. package/settings.json +6 -0
  70. package/skills/brownfield-index/SKILL.md +33 -36
  71. package/skills/browser-qa/SKILL.md +16 -7
  72. package/skills/cancel/SKILL.md +82 -0
  73. package/skills/debug/SKILL.md +7 -2
  74. package/skills/epic/SKILL.md +7 -4
  75. package/skills/fast/SKILL.md +3 -1
  76. package/skills/help/SKILL.md +18 -7
  77. package/skills/implement/SKILL.md +44 -12
  78. package/skills/implement/references/wave-execution.md +9 -9
  79. package/skills/init/SKILL.md +3 -1
  80. package/skills/review/SKILL.md +6 -2
  81. package/skills/security-audit/SKILL.md +19 -4
  82. package/skills/spec/SKILL.md +6 -4
  83. package/skills/start/SKILL.md +20 -19
  84. package/skills/status/SKILL.md +85 -0
  85. package/skills/ui-sketch/SKILL.md +13 -4
  86. package/skills/verify/SKILL.md +15 -2
  87. package/templates/CONTEXT.md.tmpl +1 -1
  88. package/templates/PROJECT.md.tmpl +1 -1
  89. package/templates/config.json.tmpl +9 -6
  90. package/templates/progress.md.tmpl +21 -2
  91. package/templates/tasks.md.tmpl +26 -3
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "goal": {
19
19
  "type": "string",
20
- "description": "One-sentence goal from /flow-start"
20
+ "description": "One-sentence goal from /curdx-flow:start"
21
21
  },
22
22
  "mode": {
23
23
  "type": "string",
@@ -29,6 +29,11 @@
29
29
  "enum": ["auto", "subagent", "stop-hook", "wave", "linear"],
30
30
  "default": "auto"
31
31
  },
32
+ "quickMode": {
33
+ "type": "boolean",
34
+ "default": false,
35
+ "description": "When true, execution hooks block AskUserQuestion and agents must record assumptions instead of asking."
36
+ },
32
37
  "phase": {
33
38
  "type": "string",
34
39
  "enum": [
@@ -39,7 +44,6 @@
39
44
  "execute",
40
45
  "verify",
41
46
  "review",
42
- "ship",
43
47
  "completed"
44
48
  ]
45
49
  },
@@ -52,8 +56,7 @@
52
56
  "tasks": { "$ref": "#/definitions/phaseStatus" },
53
57
  "execute": { "$ref": "#/definitions/phaseStatus" },
54
58
  "verify": { "$ref": "#/definitions/phaseStatus" },
55
- "review": { "$ref": "#/definitions/phaseStatus" },
56
- "ship": { "$ref": "#/definitions/phaseStatus" }
59
+ "review": { "$ref": "#/definitions/phaseStatus" }
57
60
  }
58
61
  },
59
62
  "execute_state": {
@@ -68,7 +71,34 @@
68
71
  "total_tasks": { "type": "integer", "minimum": 0 },
69
72
  "task_iteration": { "type": "integer", "minimum": 1 },
70
73
  "global_iteration": { "type": "integer", "minimum": 1 },
71
- "failed_attempts": { "type": "integer", "minimum": 0 }
74
+ "failed_attempts": { "type": "integer", "minimum": 0 },
75
+ "recovery_mode": {
76
+ "type": "string",
77
+ "enum": ["manual", "fix-task"],
78
+ "default": "manual"
79
+ },
80
+ "max_fix_tasks_per_original": {
81
+ "type": "integer",
82
+ "minimum": 1,
83
+ "maximum": 5,
84
+ "default": 2
85
+ },
86
+ "fix_task_map": {
87
+ "type": "object",
88
+ "description": "Per-original-task recovery attempts created by fix-task mode.",
89
+ "additionalProperties": {
90
+ "type": "object",
91
+ "required": ["attempts", "fix_task_ids"],
92
+ "properties": {
93
+ "attempts": { "type": "integer", "minimum": 0 },
94
+ "fix_task_ids": {
95
+ "type": "array",
96
+ "items": { "type": "string" }
97
+ },
98
+ "last_error": { "type": "string" }
99
+ }
100
+ }
101
+ }
72
102
  }
73
103
  },
74
104
  "decisions": {
package/settings.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "subagentStatusLine": {
3
+ "type": "command",
4
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/subagent-statusline.sh"
5
+ }
6
+ }
@@ -1,7 +1,31 @@
1
1
  ---
2
2
  name: brownfield-index
3
- description: Invoke when the user is new to an unfamiliar / legacy / brownfield codebase and wants a structural understanding module map, component inventory, API surface, data flow. 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".
4
- allowed-tools: [Read, Grep, Glob, Bash]
3
+ description: Use when the user needs structural understanding of an unfamiliar, inherited, legacy, or brownfield codebase.
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
+ 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/**"
5
29
  ---
6
30
 
7
31
  # Brownfield Index
@@ -15,41 +39,14 @@ You are invoked when the user needs a structural map of an existing codebase the
15
39
 
16
40
  ## Workflow
17
41
 
18
- ### Step 1: Detect project type
42
+ This skill runs in a forked context through `flow-brownfield-analyst`, which will:
19
43
 
20
- 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.
21
48
 
22
- ### Step 2: Scan directory structure
23
-
24
- Produce a top-level inventory:
25
- - **Entry points** (main / index / bin scripts)
26
- - **Module directories** (src/, lib/, internal/, pkg/ …)
27
- - **Test directories**
28
- - **Config files**
29
- - **Tooling** (CI, lint, format configs)
30
-
31
- ### Step 3: Component inventory
32
-
33
- For each module directory, list:
34
- - Files and their apparent role (inferred from names + top-of-file comments)
35
- - Public exports / exported symbols
36
- - Third-party dependencies imported
37
-
38
- ### Step 4: API surface
39
-
40
- If HTTP / RPC endpoints exist, index them: route → handler → middleware. For CLI tools, index commands → handlers.
41
-
42
- ### Step 5: Write index document
43
-
44
- Output `.flow/codebase-index.md` containing:
45
- - **Overview** (project purpose, build tool, runtime)
46
- - **Directory tree** (with per-directory one-liner descriptions)
47
- - **Entry points** (where execution starts)
48
- - **Key abstractions** (core types, interfaces, classes that everything else hangs off)
49
- - **External dependencies** (grouped: prod runtime / dev tooling / transitive)
50
- - **Known gaps / red flags** (missing tests, TODOs, suspicious patterns)
51
-
52
- ### Step 6: Hand off
49
+ ### Hand off
53
50
 
54
51
  Point the user at the next useful action:
55
52
  - "Looking to add a feature here? Run `/curdx-flow:start <name>` to begin a spec."
@@ -57,6 +54,6 @@ Point the user at the next useful action:
57
54
 
58
55
  ## Notes
59
56
 
60
- 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.
61
58
 
62
59
  For deep research into a specific library or framework, use `context7` MCP directly.
@@ -1,7 +1,16 @@
1
1
  ---
2
2
  name: browser-qa
3
- description: Invoke when the user wants to test a UI/frontend in a real browser accessibility, performance, console errors, network traffic, visual regression. 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".
4
- allowed-tools: [Read, Write, Bash, Grep, Glob, WebFetch]
3
+ description: Use when the user needs real-browser QA for a UI or frontend flow.
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
+ 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/**"
5
14
  ---
6
15
 
7
16
  # Browser QA
@@ -10,7 +19,7 @@ You are invoked when the user wants real-browser QA of a UI flow.
10
19
 
11
20
  ## Preconditions
12
21
 
13
- 1. `chrome-devtools` MCP is available (`mcp__chrome-devtools__*`). If missing, fall back to a manual checklist.
22
+ 1. `chrome-devtools` MCP is available (`mcp__chrome_devtools__*`). If missing, fall back to a manual checklist.
14
23
  2. A URL (dev server or deployed) is available. Prompt for it if not provided.
15
24
 
16
25
  ## Workflow
@@ -22,11 +31,11 @@ Confirm with the user:
22
31
  - **Flow to test** (e.g., "sign up → dashboard → logout")
23
32
  - **What success looks like** (accessibility / performance / zero console errors / visual match)
24
33
 
25
- ### Step 2: Dispatch `flow-qa-engineer`
34
+ ### Step 2: Run via `flow-qa-engineer`
26
35
 
27
- Delegate to the `flow-qa-engineer` agent. It will:
28
- 1. Open the target URL via `mcp__chrome-devtools__new_page`
29
- 2. Drive the flow with `mcp__chrome-devtools__click` / `fill` / `navigate`
36
+ This skill executes in a forked context through `flow-qa-engineer`. The agent will:
37
+ 1. Open the target URL via `mcp__chrome_devtools__new_page`
38
+ 2. Drive the flow with `mcp__chrome_devtools__click` / `fill` / `navigate_page`
30
39
  3. Capture `list_console_messages`, `list_network_requests`, `take_screenshot`, optionally `lighthouse_audit`
31
40
  4. Compare against expected behavior
32
41
 
@@ -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,7 +1,9 @@
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>\""
6
+ disable-model-invocation: true
5
7
  context: fork
6
8
  agent: flow-debugger
7
9
  ---
@@ -27,6 +29,7 @@ If `$ARGUMENTS` is empty, print `Usage: /curdx-flow:debug "<bug description>"` a
27
29
 
28
30
  - Read the error carefully (stack trace + message + location).
29
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.
30
33
  - Check recent changes that could have introduced the bug.
31
34
  - Trace the data flow from cause to symptom.
32
35
  - **Exit condition**: state the root cause in **one sentence**.
@@ -53,7 +56,8 @@ If `$ARGUMENTS` is empty, print `Usage: /curdx-flow:debug "<bug description>"` a
53
56
  2. Fix the root cause (not the symptom). Confirm the failing test now
54
57
  passes. Commit `fix(<scope>): green - ...`.
55
58
  3. Run the full regression suite; no regressions allowed.
56
- 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
57
61
  fix them in the same stage. Optional third commit
58
62
  `fix(<scope>): sweep - N similar cases`.
59
63
 
@@ -81,6 +85,7 @@ Recommended next step: <user action — review architecture, ship a
81
85
  - Prayer-driven programming (retry without a new hypothesis each round)
82
86
  - "Maybe it's ..." as a Phase 1 conclusion
83
87
  - A fix commit without a corresponding failing-test commit
88
+ - A fix claim without BEFORE/AFTER reality verification in `.progress.md`
84
89
  - Masking the root cause with null checks / try-catch
85
90
  - Fixing multiple unrelated things in one commit (one task = one commit)
86
91
 
@@ -1,7 +1,10 @@
1
1
  ---
2
2
  name: epic
3
- description: Invoke when user wants to break a large feature into multiple smaller specs with a dependency graph. 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".
4
- allowed-tools: [Read, Write, Grep, Glob, Bash]
3
+ description: Use when the user needs to decompose a large feature into smaller vertical-slice specs with dependencies.
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
+ argument-hint: "\"<epic goal>\""
6
+ context: fork
7
+ agent: flow-triage-analyst
5
8
  ---
6
9
 
7
10
  # Epic Decomposition
@@ -22,9 +25,9 @@ Ask the user (or infer from context) for:
22
25
  - **One-sentence goal** of the whole epic
23
26
  - **Hard boundary**: what is explicitly out of scope for this epic
24
27
 
25
- ### Step 2: Dispatch `flow-triage-analyst`
28
+ ### Step 2: Run via `flow-triage-analyst`
26
29
 
27
- 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:
28
31
  - A vertical-slice decomposition (not horizontal by layer)
29
32
  - Dependency graph between slices
30
33
  - Shared interfaces that must be frozen before parallel work begins
@@ -1,8 +1,10 @@
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
- allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Task]
6
+ disable-model-invocation: true
7
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
6
8
  ---
7
9
 
8
10
  # Flow Fast — Ultra-Fast Execution
@@ -1,7 +1,9 @@
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]"
6
+ disable-model-invocation: true
5
7
  allowed-tools: [Read, Bash]
6
8
  ---
7
9
 
@@ -9,17 +11,19 @@ allowed-tools: [Read, Bash]
9
11
 
10
12
  ## No argument — quick overview
11
13
 
12
- 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.
13
15
 
14
16
  ```
15
17
  🚀 CurdX-Flow v2 — Claude Code Discipline Layer
16
18
 
17
- 9 slash commands (explicit control)
19
+ 11 slash commands (explicit control)
18
20
  ────────────────────────────────────
19
21
  /curdx-flow:init Initialize .flow/ in the current project
20
22
  /curdx-flow:start Create / resume / switch a feature spec
23
+ /curdx-flow:status Show active spec, phase, task progress, recovery hints
21
24
  /curdx-flow:spec Write or refresh the spec (--phase, --review, --regenerate)
22
25
  /curdx-flow:implement Execute the tasks (auto-routed strategy)
26
+ /curdx-flow:cancel Cancel execution loop safely; optional spec deletion
23
27
  /curdx-flow:verify Goal-backward verification — the differentiator
24
28
  /curdx-flow:review Two-stage code review (+ --adversarial, --edge-case)
25
29
  /curdx-flow:fast Skip the spec — one-shot small task
@@ -48,7 +52,7 @@ Show the 9 core slash commands + 5 auto-invoked skills. Keep the table compact,
48
52
 
49
53
  ## `<command-name>` — command detail
50
54
 
51
- 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:
52
56
 
53
57
  ```bash
54
58
  CMD="$ARGUMENTS"
@@ -59,13 +63,13 @@ elif [ -f "${CLAUDE_PLUGIN_ROOT}/commands/${CMD}.md" ]; then
59
63
  cat "${CLAUDE_PLUGIN_ROOT}/commands/${CMD}.md"
60
64
  else
61
65
  echo "Unknown: ${CMD}"
62
- 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"
63
67
  echo "Skills: epic browser-qa ui-sketch security-audit brownfield-index"
64
68
  exit 1
65
69
  fi
66
70
  ```
67
71
 
68
- 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.
69
73
 
70
74
  ## `workflow` — standard workflow
71
75
 
@@ -80,6 +84,7 @@ If the argument isn't a known slash name, the block above prints the 14 candidat
80
84
 
81
85
  3. Per feature — the main loop
82
86
  ├─ /curdx-flow:start my-feature "one-line goal"
87
+ ├─ /curdx-flow:status ← optional: see active spec + recovery hints
83
88
  ├─ /curdx-flow:spec ← research → requirements → design → tasks
84
89
  ├─ (optional) /curdx-flow:spec --review ← add multi-dim planning review
85
90
  ├─ /curdx-flow:implement ← execute tasks
@@ -120,13 +125,15 @@ A: v1.1.5+ defaults to offline install (bundled plugin body).
120
125
  Force-online: npx @curdx/flow install --online
121
126
 
122
127
  Q: claude-mem MCP keeps failing?
123
- 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
124
131
 
125
132
  Q: /curdx-flow:init says .flow/ already exists?
126
133
  A: Use --force, or run /curdx-flow:start directly to begin a new spec in the existing .flow/.
127
134
 
128
135
  Q: Skills don't auto-invoke reliably?
129
- 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.
130
137
 
131
138
  Q: I want the old v1 commands (research, plan-ceo, party…).
132
139
  A: They're removed in v2. See MIGRATION.md for mappings, or stay on 1.x:
@@ -139,6 +146,10 @@ A: Your spec mode decides gate strictness. Lower via:
139
146
  Q: Where are decisions logged?
140
147
  A: .flow/STATE.md (D-NN entries). Edit directly — no slash command needed.
141
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
+
142
153
  Q: File a bug / request feature
143
154
  A: https://github.com/curdx/curdx-flow/issues
144
155
  ```
@@ -1,8 +1,10 @@
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
- allowed-tools: [Read, Write, Edit, Bash, Task, Grep, Glob]
6
+ disable-model-invocation: true
7
+ allowed-tools: [Read, Write, Edit, Bash, Agent, Grep, Glob]
6
8
  ---
7
9
 
8
10
  # Flow Implement — Execute Spec
@@ -44,9 +46,9 @@ DIR=".flow/specs/$SPEC_NAME"
44
46
  ## Step 2: Parse Task Characteristics from tasks.md
45
47
 
46
48
  ```bash
47
- TOTAL=$(grep -c "^- \[ \] \*\*" "$DIR/tasks.md")
48
- DONE=$(grep -c "^- \[x\] \*\*" "$DIR/tasks.md")
49
- REMAINING=$((TOTAL))
49
+ TOTAL=$(grep -Ec "^- \[[ xX]\] \*\*" "$DIR/tasks.md")
50
+ DONE=$(grep -Ec "^- \[[xX]\] \*\*" "$DIR/tasks.md")
51
+ REMAINING=$((TOTAL - DONE))
50
52
  PARALLEL=$(grep -c "^- \[ \] \*\*.*\[P\]" "$DIR/tasks.md")
51
53
  SEQUENTIAL=$(grep -c "^- \[ \] \*\*.*\[SEQUENTIAL\]" "$DIR/tasks.md")
52
54
 
@@ -77,7 +79,7 @@ echo "✓ Selected strategy: $STRATEGY"
77
79
 
78
80
  **Decision tree explanation**:
79
81
  - Few tasks / strong dependencies → `linear` (main agent executes sequentially)
80
- - Many parallel opportunities → `wave` (parallel Task dispatch within a wave)
82
+ - Many parallel opportunities → `wave` (parallel Agent dispatch within a wave)
81
83
  - Long chain + quick mode → `stop-hook` (auto-loop, requires hook support)
82
84
  - Medium scale → `subagent` (isolated context per task)
83
85
 
@@ -87,6 +89,13 @@ echo "✓ Selected strategy: $STRATEGY"
87
89
  import json
88
90
  p = f'.flow/specs/{SPEC_NAME}/.state.json'
89
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)
90
99
  s['phase'] = 'execute'
91
100
  s['strategy'] = STRATEGY
92
101
  s.setdefault('phase_status', {})['execute'] = 'in_progress'
@@ -95,6 +104,9 @@ s['execute_state'].setdefault('task_index', DONE)
95
104
  s['execute_state']['total_tasks'] = TOTAL
96
105
  s['execute_state'].setdefault('failed_attempts', 0)
97
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', {})
98
110
  if QUICK:
99
111
  s['quickMode'] = True
100
112
  json.dump(s, open(p, 'w'), indent=2, ensure_ascii=False)
@@ -127,7 +139,7 @@ If there are 5 failures, stop + TASK_FAILED.
127
139
  For each remaining task, dispatch flow-executor:
128
140
 
129
141
  ```
130
- Task:
142
+ Agent:
131
143
  subagent_type: general-purpose
132
144
  description: "Execute $SPEC_NAME task $TASK_ID"
133
145
  prompt: |
@@ -162,11 +174,11 @@ After the agent completes, read the output marker:
162
174
  See `skills/implement/references/wave-execution.md` for the full walkthrough.
163
175
  Knowledge-layer canonical algorithm: `@${CLAUDE_PLUGIN_ROOT}/knowledge/wave-execution.md`.
164
176
 
165
- **Core**: consecutive `[P]` tasks form a wave; dispatch multiple Tasks in parallel within a single response; serial across waves. The execution loop is:
177
+ **Core**: consecutive `[P]` tasks form a wave; dispatch multiple Agent calls in parallel within a single response; serial across waves. The execution loop is:
166
178
 
167
179
  1. **DAG analysis** — group remaining `[ ]` tasks by `[P]` / `[SEQUENTIAL]` / `[VERIFY]` tags; conflicting `Files` sets split into a new wave.
168
180
  2. **Pre-conflict detection** — within each wave, assert per-task `Files` are disjoint; auto-split if not.
169
- 3. **Dispatch** — list multiple `Task(...)` tool calls in a single main-agent response (splitting across responses = serial degradation; nested `Task` dispatches forbidden). Each Task prompt follows the subagent strategy's uniform format (see `references/wave-execution.md` Step 3).
181
+ 3. **Dispatch** — list multiple `Agent(...)` tool calls in a single main-agent response (splitting across responses = serial degradation; nested `Agent` dispatches forbidden). Each Agent prompt follows the subagent strategy's uniform format (see `references/wave-execution.md` Step 3).
170
182
  4. **Aggregate** — parse each result for `TASK_COMPLETE` / `TASK_FAILED`; run post-hoc conflict detection via git diff to confirm executors only touched declared files.
171
183
  5. **Failure handling** — 0 failed → next wave; 1 failed → `config.wave_fail_policy` (`continue-on-single` or `stop-on-any`); ≥2 failed → likely environment issue, stop immediately; cumulative `failed_attempts >= 3` → stop, user intervention.
172
184
  6. **Progress feedback** — print a wave summary after each wave (see `references/wave-execution.md` Step 6).
@@ -183,6 +195,8 @@ Configuration under `.flow/config.json.execution`: `strategy: "wave"`, `max_para
183
195
  5. Repeat until ALL_TASKS_COMPLETE or 3 failures
184
196
  ```
185
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
+
186
200
  Prerequisites:
187
201
  - `--quick` must be set (otherwise AskUserQuestion will block the loop)
188
202
  - `.flow/config.json` or `.state.json` must have strategy=stop-hook
@@ -217,9 +231,27 @@ if all tasks done:
217
231
  ## Error Recovery
218
232
 
219
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`
220
236
  - 3 consecutive TASK_FAILED → stop, prompt for user intervention
221
237
  - git operation failure → stop immediately, do not continue (avoid state corruption)
222
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.
223
255
 
224
256
  ## Output to User
225
257
 
@@ -232,9 +264,9 @@ Commits: M atomic commits
232
264
  Verify passed: K / K
233
265
 
234
266
  Next steps:
235
- - /curdx-flow:verify — goal-driven reverse verification (after Phase 3 ships)
236
- - 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
237
269
 
238
- Phase 3 (Gates & Review) has not yet shipped.
239
- 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.
240
272
  ```
@@ -5,7 +5,7 @@ implement skill routes to the `wave` strategy. The knowledge-layer canonical
5
5
  algorithm lives in `@${CLAUDE_PLUGIN_ROOT}/knowledge/wave-execution.md`;
6
6
  this file is the walkthrough the skill itself embeds for implementers.
7
7
 
8
- **Core**: consecutive `[P]` tasks form a wave, dispatch multiple Tasks in
8
+ **Core**: consecutive `[P]` tasks form a wave, dispatch multiple Agent calls in
9
9
  parallel within a single message, serial across waves.
10
10
 
11
11
  ## Step 1: DAG Analysis
@@ -51,13 +51,13 @@ If the planner mis-tagged `[P]` (modifies the same file), split the wave automat
51
51
  ## Step 3: Dispatch a Single Wave (key: within a single response)
52
52
 
53
53
  ```
54
- # List multiple Task tool calls in one response of the main agent:
55
- Task(description="Execute 1.1", prompt=<...flow-executor + task_id=1.1...>)
56
- Task(description="Execute 1.2", prompt=<...flow-executor + task_id=1.2...>)
57
- Task(description="Execute 1.3", prompt=<...flow-executor + task_id=1.3...>)
54
+ # List multiple Agent tool calls in one response of the main agent:
55
+ Agent(description="Execute 1.1", prompt=<...flow-executor + task_id=1.1...>)
56
+ Agent(description="Execute 1.2", prompt=<...flow-executor + task_id=1.2...>)
57
+ Agent(description="Execute 1.3", prompt=<...flow-executor + task_id=1.3...>)
58
58
  ```
59
59
 
60
- Each Task prompt follows a uniform format (similar to subagent strategy):
60
+ Each Agent prompt follows a uniform format (similar to subagent strategy):
61
61
 
62
62
  ```
63
63
  You are the flow-executor agent. Full definition:
@@ -82,12 +82,12 @@ Output:
82
82
  ```
83
83
 
84
84
  **Not allowed**:
85
- - Splitting multiple Task calls across multiple responses (that is serial degradation)
86
- - Nesting another Task dispatch inside a Task
85
+ - Splitting multiple Agent calls across multiple responses (that is serial degradation)
86
+ - Nesting another Agent dispatch inside an Agent
87
87
 
88
88
  ## Step 4: Aggregate Wave Results
89
89
 
90
- Wait for all Tasks to return:
90
+ Wait for all Agent calls to return:
91
91
 
92
92
  ```python
93
93
  completed = []; failed = []