@curdx/flow 2.2.4 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -2
- package/.claude-plugin/plugin.json +27 -1
- package/CHANGELOG.md +9 -564
- package/README.md +49 -113
- package/agents/flow-adversary.md +1 -0
- package/agents/flow-architect.md +9 -36
- package/agents/flow-brownfield-analyst.md +7 -18
- package/agents/flow-debugger.md +1 -0
- package/agents/flow-edge-hunter.md +1 -0
- package/agents/flow-executor.md +1 -0
- package/agents/flow-orchestrator.md +145 -0
- package/agents/flow-planner.md +11 -37
- package/agents/flow-product-designer.md +9 -41
- package/agents/flow-qa-engineer.md +1 -0
- package/agents/flow-researcher.md +9 -45
- package/agents/flow-reviewer.md +1 -0
- package/agents/flow-security-auditor.md +1 -0
- package/agents/flow-triage-analyst.md +1 -0
- package/agents/flow-ui-researcher.md +1 -0
- package/agents/flow-ux-designer.md +1 -0
- package/agents/flow-verifier.md +1 -0
- package/cli/install-companions.js +8 -8
- package/cli/install-next-steps.js +3 -1
- package/cli/lib/doctor-claude-settings.js +1 -0
- package/cli/lib/doctor-report.js +1 -1
- package/gates/coverage-audit-gate.md +1 -3
- package/gates/tdd-gate.md +0 -6
- package/gates/verification-gate.md +1 -5
- package/hooks/scripts/common.sh +7 -0
- package/hooks/scripts/session-start.sh +1 -1
- package/hooks/scripts/stop-watcher.sh +8 -0
- package/knowledge/artifact-output-discipline.md +24 -0
- package/knowledge/artifact-summary-contracts.md +50 -0
- package/knowledge/claude-code-runtime-contracts.md +13 -1
- package/knowledge/execution-strategies.md +6 -4
- package/knowledge/poc-first-workflow.md +2 -6
- package/knowledge/spec-driven-development.md +0 -4
- package/knowledge/systematic-debugging.md +0 -6
- package/knowledge/two-stage-review.md +8 -6
- package/knowledge/wave-execution.md +2 -1
- package/monitors/monitors.json +8 -0
- package/monitors/scripts/flow-state-monitor.sh +99 -0
- package/package.json +3 -2
- package/schemas/agent-frontmatter.schema.json +4 -0
- package/settings.json +1 -0
- package/skills/brownfield-index/SKILL.md +14 -20
- package/skills/brownfield-index/references/applicability.md +12 -0
- package/skills/brownfield-index/references/handoff.md +8 -0
- package/skills/brownfield-index/references/index-contract.md +10 -0
- package/skills/browser-qa/SKILL.md +15 -35
- package/skills/browser-qa/references/handoff.md +6 -0
- package/skills/browser-qa/references/prerequisites.md +10 -0
- package/skills/browser-qa/references/qa-contract.md +20 -0
- package/skills/cancel/SKILL.md +20 -61
- package/skills/cancel/references/destructive-mode.md +17 -0
- package/skills/cancel/references/reporting.md +18 -0
- package/skills/cancel/references/state-recovery.md +30 -0
- package/skills/cancel/references/target-resolution.md +7 -0
- package/skills/debug/SKILL.md +23 -87
- package/skills/debug/references/context-gathering.md +11 -0
- package/skills/debug/references/failure-guard.md +25 -0
- package/skills/debug/references/intake.md +12 -0
- package/skills/debug/references/phase-workflow.md +34 -0
- package/skills/debug/references/reporting.md +20 -0
- package/skills/epic/SKILL.md +18 -50
- package/skills/epic/references/epic-artifacts.md +20 -0
- package/skills/epic/references/epic-intake.md +9 -0
- package/skills/epic/references/slice-handoff.md +16 -0
- package/skills/fast/SKILL.md +34 -102
- package/skills/fast/references/applicability.md +25 -0
- package/skills/fast/references/clarification.md +20 -0
- package/skills/fast/references/execution-contract.md +56 -0
- package/skills/help/SKILL.md +26 -132
- package/skills/help/references/dispatch.md +20 -0
- package/skills/help/references/overview.md +39 -0
- package/skills/help/references/troubleshoot.md +47 -0
- package/skills/help/references/workflow.md +37 -0
- package/skills/implement/SKILL.md +61 -237
- package/skills/implement/references/error-recovery.md +36 -0
- package/skills/implement/references/linear-execution.md +32 -0
- package/skills/implement/references/preflight.md +43 -0
- package/skills/implement/references/progress-contract.md +32 -0
- package/skills/implement/references/state-init.md +33 -0
- package/skills/implement/references/stop-hook-execution.md +36 -0
- package/skills/implement/references/strategy-router.md +38 -0
- package/skills/implement/references/subagent-execution.md +43 -0
- package/skills/init/SKILL.md +26 -95
- package/skills/init/references/gitignore-and-health.md +26 -0
- package/skills/init/references/next-steps.md +22 -0
- package/skills/init/references/preflight.md +15 -0
- package/skills/init/references/scaffold-contract.md +27 -0
- package/skills/review/SKILL.md +45 -153
- package/skills/review/references/optional-passes.md +48 -0
- package/skills/review/references/preflight.md +38 -0
- package/skills/review/references/report-contract.md +49 -0
- package/skills/review/references/reporting.md +20 -0
- package/skills/review/references/stage-execution.md +32 -0
- package/skills/security-audit/SKILL.md +16 -34
- package/skills/security-audit/references/audit-contract.md +21 -0
- package/skills/security-audit/references/gate-handoff.md +8 -0
- package/skills/security-audit/references/scope-and-depth.md +9 -0
- package/skills/spec/SKILL.md +55 -182
- package/skills/spec/references/artifact-landing.md +31 -0
- package/skills/spec/references/phase-execution.md +50 -0
- package/skills/spec/references/planning-review.md +31 -0
- package/skills/spec/references/preflight-and-routing.md +46 -0
- package/skills/spec/references/reporting.md +21 -0
- package/skills/start/SKILL.md +40 -123
- package/skills/start/references/branch-routing.md +51 -0
- package/skills/start/references/mode-semantics.md +12 -0
- package/skills/start/references/preflight.md +13 -0
- package/skills/start/references/reporting.md +20 -0
- package/skills/start/references/state-seeding.md +44 -0
- package/skills/start/references/workflow-handoff.md +26 -0
- package/skills/status/SKILL.md +17 -61
- package/skills/status/references/gather-contract.md +27 -0
- package/skills/status/references/health-rules.md +27 -0
- package/skills/status/references/output-contract.md +24 -0
- package/skills/status/references/preflight.md +10 -0
- package/skills/status/references/recovery-hints.md +18 -0
- package/skills/ui-sketch/SKILL.md +15 -34
- package/skills/ui-sketch/references/brief-intake.md +10 -0
- package/skills/ui-sketch/references/iteration-handoff.md +5 -0
- package/skills/ui-sketch/references/variant-contract.md +15 -0
- package/skills/verify/SKILL.md +31 -86
- package/skills/verify/references/evidence-workflow.md +39 -0
- package/skills/verify/references/output-contract.md +23 -0
- package/skills/verify/references/preflight.md +11 -0
- package/skills/verify/references/report-handoff.md +35 -0
- package/skills/verify/references/strict-mode.md +12 -0
- package/README.zh.md +0 -160
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Help Troubleshoot — Common Issues
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
🛠️ Common issues
|
|
5
|
+
|
|
6
|
+
Q: After install, /curdx-flow:* commands are not found.
|
|
7
|
+
A: Restart Claude Code. The plugin needs a fresh session to register.
|
|
8
|
+
|
|
9
|
+
Q: MCP servers not starting?
|
|
10
|
+
A: Check Node >= 18: node --version
|
|
11
|
+
Check MCPs: claude mcp list
|
|
12
|
+
Health overall: npx @curdx/flow doctor
|
|
13
|
+
|
|
14
|
+
Q: GitHub slow / blocked during install?
|
|
15
|
+
A: v1.1.5+ defaults to offline install (bundled plugin body).
|
|
16
|
+
Force-offline: npx @curdx/flow install --no-deps
|
|
17
|
+
Force-online: npx @curdx/flow install --online
|
|
18
|
+
|
|
19
|
+
Q: claude-mem MCP keeps failing?
|
|
20
|
+
A: It needs bun. Run: npx @curdx/flow doctor
|
|
21
|
+
If doctor reports bun/uv is installed but not on PATH, run:
|
|
22
|
+
npx @curdx/flow doctor --fix
|
|
23
|
+
|
|
24
|
+
Q: /curdx-flow:init says .flow/ already exists?
|
|
25
|
+
A: Use --force, or run /curdx-flow:start directly to begin a new spec in the existing .flow/.
|
|
26
|
+
|
|
27
|
+
Q: Skills don't auto-invoke reliably?
|
|
28
|
+
A: Invoke explicitly — plugin skills are namespaced. E.g., /curdx-flow:security-audit.
|
|
29
|
+
|
|
30
|
+
Q: I want the old v1 commands (research, plan-ceo, party…).
|
|
31
|
+
A: They're removed in v2. Use /curdx-flow:help workflow for the current paths, or stay on 1.x:
|
|
32
|
+
npm i -g @curdx/flow@^1.1
|
|
33
|
+
|
|
34
|
+
Q: Too many gates blocking progress?
|
|
35
|
+
A: Your spec mode decides gate strictness. Lower via:
|
|
36
|
+
/curdx-flow:start <name> "<goal>" --mode=fast
|
|
37
|
+
|
|
38
|
+
Q: Where are decisions logged?
|
|
39
|
+
A: .flow/STATE.md (D-NN entries). Edit directly — no slash command needed.
|
|
40
|
+
|
|
41
|
+
Q: Stop-hook or execution loop seems stuck?
|
|
42
|
+
A: Run /curdx-flow:status. If state/tasks disagree, run /curdx-flow:cancel, then resume with:
|
|
43
|
+
/curdx-flow:implement --strategy=subagent
|
|
44
|
+
|
|
45
|
+
Q: File a bug / request feature
|
|
46
|
+
A: https://github.com/curdx/curdx-flow/issues
|
|
47
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Help Workflow — Canonical Main Loop
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
📐 CurdX-Flow v2 Standard Workflow
|
|
5
|
+
|
|
6
|
+
1. One-time setup (outside Claude Code)
|
|
7
|
+
└─ npx @curdx/flow install --all
|
|
8
|
+
|
|
9
|
+
2. Per project (in Claude Code)
|
|
10
|
+
└─ /curdx-flow:init
|
|
11
|
+
|
|
12
|
+
3. Per feature — the main loop
|
|
13
|
+
├─ /curdx-flow:start my-feature "one-line goal"
|
|
14
|
+
├─ /curdx-flow:status ← optional: see active spec + recovery hints
|
|
15
|
+
├─ /curdx-flow:spec ← research → requirements → design → tasks
|
|
16
|
+
├─ (optional) /curdx-flow:spec --review ← add multi-dim planning review
|
|
17
|
+
├─ /curdx-flow:implement ← execute tasks
|
|
18
|
+
├─ /curdx-flow:verify ← goal-backward check
|
|
19
|
+
└─ /curdx-flow:review ← code review
|
|
20
|
+
|
|
21
|
+
4. Evidence-backed handoff
|
|
22
|
+
└─ verification-report.md + review-report.md + atomic commits → human PR/release work
|
|
23
|
+
|
|
24
|
+
5. Big feature (breaks into multiple specs)
|
|
25
|
+
└─ Say "this feature is too big, break it down" → epic skill auto-invokes
|
|
26
|
+
|
|
27
|
+
6. One-off task (skip the spec)
|
|
28
|
+
└─ /curdx-flow:fast "rename foo to bar in src/"
|
|
29
|
+
|
|
30
|
+
7. Stuck on a bug
|
|
31
|
+
└─ /curdx-flow:debug "tests fail intermittently after 3rd run"
|
|
32
|
+
|
|
33
|
+
Modes (set via /curdx-flow:start --mode=...)
|
|
34
|
+
fast One-off task paths
|
|
35
|
+
standard Default — spec + gates + review
|
|
36
|
+
enterprise Standard + adversarial + edge-case + devex + security-audit
|
|
37
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: implement
|
|
3
|
-
description: Execute spec tasks
|
|
3
|
+
description: Execute active-spec tasks with strategy routing and atomic progress.
|
|
4
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.
|
|
5
5
|
argument-hint: "[spec-name] [--strategy=auto|linear|subagent|stop-hook|wave] [--task=<id>] [--quick]"
|
|
6
6
|
disable-model-invocation: true
|
|
@@ -12,261 +12,85 @@ allowed-tools: [Read, Write, Edit, Bash, Agent, Grep, Glob]
|
|
|
12
12
|
@${CLAUDE_PLUGIN_ROOT}/knowledge/execution-strategies.md
|
|
13
13
|
@${CLAUDE_PLUGIN_ROOT}/knowledge/atomic-commits.md
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
This skill is the execution orchestrator. Keep the entrypoint focused on
|
|
16
|
+
preflight, routing, state updates, and stop conditions; load supporting files
|
|
17
|
+
for strategy-specific protocols:
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
- `references/preflight.md`
|
|
20
|
+
- `references/strategy-router.md`
|
|
21
|
+
- `references/state-init.md`
|
|
22
|
+
- `references/linear-execution.md`
|
|
23
|
+
- `references/subagent-execution.md`
|
|
24
|
+
- `references/wave-execution.md`
|
|
25
|
+
- `references/stop-hook-execution.md`
|
|
26
|
+
- `references/progress-contract.md`
|
|
27
|
+
- `references/error-recovery.md`
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
[ ! -d ".flow" ] && { echo "✗ Not a CurdX-Flow project. Run /curdx-flow:init first"; exit 1; }
|
|
29
|
+
## Arguments
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
SPEC_NAME=""
|
|
24
|
-
STRATEGY="auto"
|
|
25
|
-
TASK_ID=""
|
|
26
|
-
QUICK=0
|
|
31
|
+
`$ARGUMENTS` may include:
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
--task=*) TASK_ID="${arg#--task=}" ;;
|
|
33
|
-
--quick) QUICK=1 ;;
|
|
34
|
-
--*) ;; # ignore unknown flags
|
|
35
|
-
*) SPEC_NAME="$arg" ;;
|
|
36
|
-
esac
|
|
37
|
-
done
|
|
33
|
+
- `[spec-name]`
|
|
34
|
+
- `--strategy=auto|linear|subagent|stop-hook|wave`
|
|
35
|
+
- `--task=<id>`
|
|
36
|
+
- `--quick`
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
[ -z "$SPEC_NAME" ] && { echo "✗ No active spec. Run /curdx-flow:start first"; exit 1; }
|
|
38
|
+
## Preflight and Task Stats
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
[ ! -f "$DIR/tasks.md" ] && { echo "✗ Missing tasks.md. Run /curdx-flow:spec first (or /curdx-flow:spec --phase=tasks to rebuild just the tasks phase)"; exit 1; }
|
|
44
|
-
```
|
|
40
|
+
Use `references/preflight.md` for:
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
- `.flow/` and active-spec resolution
|
|
43
|
+
- argument parsing
|
|
44
|
+
- `tasks.md` presence checks
|
|
45
|
+
- `TOTAL`, `DONE`, `REMAINING`, `PARALLEL`, and `SEQUENTIAL` extraction
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
TOTAL=$(grep -Ec "^- \[[ xX]\] \*\*" "$DIR/tasks.md")
|
|
50
|
-
DONE=$(grep -Ec "^- \[[xX]\] \*\*" "$DIR/tasks.md")
|
|
51
|
-
REMAINING=$((TOTAL - DONE))
|
|
52
|
-
PARALLEL=$(grep -c "^- \[ \] \*\*.*\[P\]" "$DIR/tasks.md")
|
|
53
|
-
SEQUENTIAL=$(grep -c "^- \[ \] \*\*.*\[SEQUENTIAL\]" "$DIR/tasks.md")
|
|
47
|
+
## Strategy Routing
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
Use `references/strategy-router.md` for the full decision tree and routing
|
|
50
|
+
signals. The runtime selector is:
|
|
57
51
|
|
|
58
|
-
##
|
|
52
|
+
## Execute State Init
|
|
59
53
|
|
|
60
|
-
|
|
54
|
+
Use `references/state-init.md` before dispatching any execution protocol.
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
if [ "$STRATEGY" = "auto" ]; then
|
|
64
|
-
if [ $REMAINING -lt 5 ] || [ $SEQUENTIAL -gt $((REMAINING / 2)) ]; then
|
|
65
|
-
STRATEGY="linear"
|
|
66
|
-
elif [ $PARALLEL -ge $((REMAINING * 4 / 10)) ]; then
|
|
67
|
-
STRATEGY="wave"
|
|
68
|
-
elif [ $REMAINING -ge 20 ] && [ $QUICK -eq 1 ]; then
|
|
69
|
-
STRATEGY="stop-hook"
|
|
70
|
-
elif [ $REMAINING -ge 8 ]; then
|
|
71
|
-
STRATEGY="subagent"
|
|
72
|
-
else
|
|
73
|
-
STRATEGY="linear"
|
|
74
|
-
fi
|
|
75
|
-
fi
|
|
56
|
+
## Run the Selected Execution Protocol
|
|
76
57
|
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
- `linear`: stay inline in the main agent and execute the first unchecked task
|
|
59
|
+
to completion. Full task loop: `references/linear-execution.md`
|
|
60
|
+
- `subagent`: dispatch one isolated `flow-executor` at a time. Full prompt
|
|
61
|
+
contract: `references/subagent-execution.md`
|
|
62
|
+
- `wave`: dispatch multiple Agent calls in parallel within a single response;
|
|
63
|
+
the serial/parallel boundaries and conflict rules live in
|
|
64
|
+
`references/wave-execution.md`
|
|
65
|
+
- `stop-hook`: run one task per round and let the stop watcher decide whether
|
|
66
|
+
to continue. Full continuation contract:
|
|
67
|
+
`references/stop-hook-execution.md`
|
|
79
68
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- Many parallel opportunities → `wave` (parallel Agent dispatch within a wave)
|
|
83
|
-
- Long chain + quick mode → `stop-hook` (auto-loop, requires hook support)
|
|
84
|
-
- Medium scale → `subagent` (isolated context per task)
|
|
69
|
+
If `STRATEGY` is not one of `linear`, `subagent`, `wave`, `stop-hook`, stop
|
|
70
|
+
immediately rather than guessing.
|
|
85
71
|
|
|
86
|
-
|
|
72
|
+
For `subagent` and `wave`, after the agent completes, read the output marker
|
|
73
|
+
defined by the supporting file before mutating state or advancing the task
|
|
74
|
+
cursor.
|
|
87
75
|
|
|
88
|
-
|
|
89
|
-
import json
|
|
90
|
-
p = f'.flow/specs/{SPEC_NAME}/.state.json'
|
|
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)
|
|
99
|
-
s['phase'] = 'execute'
|
|
100
|
-
s['strategy'] = STRATEGY
|
|
101
|
-
s.setdefault('phase_status', {})['execute'] = 'in_progress'
|
|
102
|
-
s.setdefault('execute_state', {})
|
|
103
|
-
s['execute_state'].setdefault('task_index', DONE)
|
|
104
|
-
s['execute_state']['total_tasks'] = TOTAL
|
|
105
|
-
s['execute_state'].setdefault('failed_attempts', 0)
|
|
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', {})
|
|
110
|
-
if QUICK:
|
|
111
|
-
s['quickMode'] = True
|
|
112
|
-
json.dump(s, open(p, 'w'), indent=2, ensure_ascii=False)
|
|
113
|
-
```
|
|
76
|
+
## Progress and Completion Contract
|
|
114
77
|
|
|
115
|
-
|
|
78
|
+
Use `references/progress-contract.md` for both in-flight progress output and
|
|
79
|
+
the execute-complete summary. Do not claim the feature is shipped from execute
|
|
80
|
+
alone. The primary handoff remains:
|
|
116
81
|
|
|
117
|
-
|
|
82
|
+
- `/curdx-flow:verify` for goal-backward evidence
|
|
83
|
+
- `/curdx-flow:review` for code-quality findings after verification
|
|
118
84
|
|
|
119
|
-
|
|
85
|
+
## Recovery Rules and Stop Conditions
|
|
120
86
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
read task fields (Do/Files/Done-when/Verify/Commit)
|
|
124
|
-
execute per the flow-executor agent rules:
|
|
125
|
-
- follow Karpathy surgical principles
|
|
126
|
-
- Verify must pass
|
|
127
|
-
- atomic commit
|
|
128
|
-
- mark [x]
|
|
129
|
-
- update .progress.md
|
|
130
|
-
output "✓ Task X.Y complete"
|
|
131
|
-
next
|
|
132
|
-
output "ALL_TASKS_COMPLETE" when all tasks are done
|
|
133
|
-
```
|
|
87
|
+
All retry, fix-task, and stop thresholds are centralized in
|
|
88
|
+
`references/error-recovery.md`.
|
|
134
89
|
|
|
135
|
-
|
|
90
|
+
The stop invariant is strict:
|
|
136
91
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Agent:
|
|
143
|
-
subagent_type: general-purpose
|
|
144
|
-
description: "Execute $SPEC_NAME task $TASK_ID"
|
|
145
|
-
prompt: |
|
|
146
|
-
You are the flow-executor agent. Full definition at:
|
|
147
|
-
${CLAUDE_PLUGIN_ROOT}/agents/flow-executor.md
|
|
148
|
-
|
|
149
|
-
Execute task:
|
|
150
|
-
spec_name: $SPEC_NAME
|
|
151
|
-
task_id: next (or a specific ID)
|
|
152
|
-
quick_mode: $QUICK
|
|
153
|
-
|
|
154
|
-
Required reading:
|
|
155
|
-
- .flow/specs/$SPEC_NAME/tasks.md (locate the task)
|
|
156
|
-
- .flow/specs/$SPEC_NAME/.state.json
|
|
157
|
-
- .flow/specs/$SPEC_NAME/.progress.md
|
|
158
|
-
- .flow/specs/$SPEC_NAME/design.md (if task references AD-NN)
|
|
159
|
-
- .flow/specs/$SPEC_NAME/requirements.md (if referencing FR/AC)
|
|
160
|
-
|
|
161
|
-
On success output: TASK_COMPLETE: <task_id>
|
|
162
|
-
On failure output: TASK_FAILED: <task_id> + Reason
|
|
163
|
-
|
|
164
|
-
When all tasks are done output: ALL_TASKS_COMPLETE
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
After the agent completes, read the output marker:
|
|
168
|
-
- `TASK_COMPLETE` → continue to the next
|
|
169
|
-
- `TASK_FAILED` → accumulate failures, stop at >= 3
|
|
170
|
-
- `ALL_TASKS_COMPLETE` → mark phase completed
|
|
171
|
-
|
|
172
|
-
### Strategy: wave
|
|
173
|
-
|
|
174
|
-
See `skills/implement/references/wave-execution.md` for the full walkthrough.
|
|
175
|
-
Knowledge-layer canonical algorithm: `@${CLAUDE_PLUGIN_ROOT}/knowledge/wave-execution.md`.
|
|
176
|
-
|
|
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:
|
|
178
|
-
|
|
179
|
-
1. **DAG analysis** — group remaining `[ ]` tasks by `[P]` / `[SEQUENTIAL]` / `[VERIFY]` tags; conflicting `Files` sets split into a new wave.
|
|
180
|
-
2. **Pre-conflict detection** — within each wave, assert per-task `Files` are disjoint; auto-split if not.
|
|
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).
|
|
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.
|
|
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.
|
|
184
|
-
6. **Progress feedback** — print a wave summary after each wave (see `references/wave-execution.md` Step 6).
|
|
185
|
-
|
|
186
|
-
Configuration under `.flow/config.json.execution`: `strategy: "wave"`, `max_parallel: 5` (wave-parallel ceiling), `wave_fail_policy: "continue-on-single" | "stop-on-any"`.
|
|
187
|
-
|
|
188
|
-
### Strategy: stop-hook
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
1. Execute 1 task (dispatch flow-executor, wait for completion)
|
|
192
|
-
2. Do not loop manually — rely on the stop-watcher.sh hook
|
|
193
|
-
3. Stop event triggers → hook checks if there are remaining tasks → injects "continue"
|
|
194
|
-
4. Claude auto-starts next round
|
|
195
|
-
5. Repeat until ALL_TASKS_COMPLETE or 3 failures
|
|
196
|
-
```
|
|
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
|
-
|
|
200
|
-
Prerequisites:
|
|
201
|
-
- `--quick` must be set (otherwise AskUserQuestion will block the loop)
|
|
202
|
-
- `.flow/config.json` or `.state.json` must have strategy=stop-hook
|
|
203
|
-
|
|
204
|
-
## Step 6: Progress Feedback
|
|
205
|
-
|
|
206
|
-
At each wave boundary (or periodically during long linear runs), print status:
|
|
207
|
-
|
|
208
|
-
```
|
|
209
|
-
═════ Progress ═════
|
|
210
|
-
Spec: $SPEC_NAME
|
|
211
|
-
Strategy: $STRATEGY
|
|
212
|
-
Done: X / $TOTAL
|
|
213
|
-
Recent commits:
|
|
214
|
-
- abc123f feat(auth): ...
|
|
215
|
-
- def456g test(auth): ...
|
|
216
|
-
════════════════════
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## Step 7: Completion Handling
|
|
220
|
-
|
|
221
|
-
```
|
|
222
|
-
if all tasks done:
|
|
223
|
-
update .state.json:
|
|
224
|
-
phase = "verify"
|
|
225
|
-
phase_status.execute = "completed"
|
|
226
|
-
append .progress.md: "## execute phase complete YYYY-MM-DD"
|
|
227
|
-
output "ALL_TASKS_COMPLETE"
|
|
228
|
-
suggest next step: /curdx-flow:verify
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
## Error Recovery
|
|
232
|
-
|
|
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`
|
|
236
|
-
- 3 consecutive TASK_FAILED → stop, prompt for user intervention
|
|
237
|
-
- git operation failure → stop immediately, do not continue (avoid state corruption)
|
|
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.
|
|
255
|
-
|
|
256
|
-
## Output to User
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
✓ execute phase complete: $SPEC_NAME
|
|
260
|
-
|
|
261
|
-
Strategy: $STRATEGY
|
|
262
|
-
Tasks done: N / N
|
|
263
|
-
Commits: M atomic commits
|
|
264
|
-
Verify passed: K / K
|
|
265
|
-
|
|
266
|
-
Next steps:
|
|
267
|
-
- /curdx-flow:verify — goal-driven reverse verification
|
|
268
|
-
- /curdx-flow:review — two-stage code review after verification
|
|
269
|
-
|
|
270
|
-
Do not claim the feature is shipped from execute alone. Execute completes tasks;
|
|
271
|
-
verify proves user-visible goals; review checks implementation quality.
|
|
272
|
-
```
|
|
92
|
+
- Never skip a failed task implicitly
|
|
93
|
+
- Never continue after git-state corruption
|
|
94
|
+
- Stop after 3 consecutive `TASK_FAILED`
|
|
95
|
+
- If `.state.json` says complete but `tasks.md` still has unchecked tasks, trust
|
|
96
|
+
`tasks.md` and continue only the unchecked work
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Error Recovery — Failure Policy
|
|
2
|
+
|
|
3
|
+
All implement strategies use the same recovery ledger and stop thresholds.
|
|
4
|
+
|
|
5
|
+
## Failure Rules
|
|
6
|
+
|
|
7
|
+
- `Verify` field is `manual` or malformed -> stop and suggest
|
|
8
|
+
`/curdx-flow:spec --phase=tasks --regenerate`
|
|
9
|
+
- `TASK_FAILED` with `recovery_mode: manual` -> do not skip the task; root-cause
|
|
10
|
+
it, then retry the first unchecked task
|
|
11
|
+
- `TASK_FAILED` with `recovery_mode: fix-task` -> insert one targeted
|
|
12
|
+
`[FIX <task_id>]` task immediately after the failed task, update
|
|
13
|
+
`execute_state.fix_task_map`, execute that fix task, then retry the original
|
|
14
|
+
task
|
|
15
|
+
- Never exceed `max_fix_tasks_per_original`
|
|
16
|
+
- 3 consecutive `TASK_FAILED` -> stop and require user intervention
|
|
17
|
+
- Git operation failure -> stop immediately to avoid state corruption
|
|
18
|
+
- Missing local test framework -> stop and suggest `npx @curdx/flow doctor`
|
|
19
|
+
- State says complete but `tasks.md` still has unchecked tasks -> trust
|
|
20
|
+
`tasks.md`
|
|
21
|
+
|
|
22
|
+
## Fix-Task Recovery Format
|
|
23
|
+
|
|
24
|
+
Generated repair tasks must stay narrow and traceable:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
- [ ] **<task_id>.<n>** [FIX <task_id>] Fix: <short root cause>
|
|
28
|
+
- **Do**: <specific repair steps>
|
|
29
|
+
- **Files**: <same declared files or narrower>
|
|
30
|
+
- **Done when**: Original failure no longer reproduces
|
|
31
|
+
- **Verify**: <original verify command or tighter reproduction>
|
|
32
|
+
- **Commit**: `fix(<scope>): address <failure>`
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Do not execute a newly generated fix task until both `tasks.md` and
|
|
36
|
+
`fix_task_map` have been updated. The ledger must move ahead of execution.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Linear Execution — Inline Task Loop
|
|
2
|
+
|
|
3
|
+
Use this mode when the backlog is small, heavily sequential, or the operator
|
|
4
|
+
needs maximum visibility in the main session.
|
|
5
|
+
|
|
6
|
+
## Main Loop
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
for task in remaining tasks:
|
|
10
|
+
read task fields (Do / Files / Done when / Verify / Commit)
|
|
11
|
+
execute the task inline in the current session
|
|
12
|
+
run the task's Verify command
|
|
13
|
+
make the atomic commit declared by the task
|
|
14
|
+
mark the task [x] in tasks.md
|
|
15
|
+
append the outcome to .progress.md
|
|
16
|
+
print "✓ Task X.Y complete"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Execution Rules
|
|
20
|
+
|
|
21
|
+
- Follow the `flow-executor` contract even though you stay inline
|
|
22
|
+
- Respect the declared `Files` scope; do not quietly expand task boundaries
|
|
23
|
+
- Verification must pass before the task can be marked complete
|
|
24
|
+
- One task, one atomic commit
|
|
25
|
+
- If the task is too broad or unsafe, stop and surface `TASK_FAILED` semantics
|
|
26
|
+
instead of improvising extra subtasks
|
|
27
|
+
|
|
28
|
+
## Stop Conditions
|
|
29
|
+
|
|
30
|
+
- Any git operation failure: stop immediately
|
|
31
|
+
- Missing or invalid Verify command: stop and ask for a task regeneration
|
|
32
|
+
- 3 consecutive `TASK_FAILED`: stop and require intervention
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Implement Preflight — Resolve Scope and Task Stats
|
|
2
|
+
|
|
3
|
+
Before selecting a strategy:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
[ ! -d ".flow" ] && { echo "✗ Not a CurdX-Flow project. Run /curdx-flow:init first"; exit 1; }
|
|
7
|
+
|
|
8
|
+
ARGS="$ARGUMENTS"
|
|
9
|
+
SPEC_NAME=""
|
|
10
|
+
STRATEGY="auto"
|
|
11
|
+
TASK_ID=""
|
|
12
|
+
QUICK=0
|
|
13
|
+
|
|
14
|
+
for arg in $ARGS; do
|
|
15
|
+
case "$arg" in
|
|
16
|
+
--strategy=*) STRATEGY="${arg#--strategy=}" ;;
|
|
17
|
+
--task=*) TASK_ID="${arg#--task=}" ;;
|
|
18
|
+
--quick) QUICK=1 ;;
|
|
19
|
+
--*) ;;
|
|
20
|
+
*) SPEC_NAME="$arg" ;;
|
|
21
|
+
esac
|
|
22
|
+
done
|
|
23
|
+
|
|
24
|
+
[ -z "$SPEC_NAME" ] && SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
|
|
25
|
+
[ -z "$SPEC_NAME" ] && { echo "✗ No active spec. Run /curdx-flow:start first"; exit 1; }
|
|
26
|
+
|
|
27
|
+
DIR=".flow/specs/$SPEC_NAME"
|
|
28
|
+
[ ! -f "$DIR/tasks.md" ] && { echo "✗ Missing tasks.md. Run /curdx-flow:spec first (or /curdx-flow:spec --phase=tasks to rebuild just the tasks phase)"; exit 1; }
|
|
29
|
+
|
|
30
|
+
TOTAL=$(grep -Ec "^- \[[ xX]\] \*\*" "$DIR/tasks.md")
|
|
31
|
+
DONE=$(grep -Ec "^- \[[xX]\] \*\*" "$DIR/tasks.md")
|
|
32
|
+
REMAINING=$((TOTAL - DONE))
|
|
33
|
+
PARALLEL=$(grep -c "^- \[ \] \*\*.*\[P\]" "$DIR/tasks.md")
|
|
34
|
+
SEQUENTIAL=$(grep -c "^- \[ \] \*\*.*\[SEQUENTIAL\]" "$DIR/tasks.md")
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
These counters are part of the runtime contract:
|
|
38
|
+
|
|
39
|
+
- `TOTAL` = all declared task rows
|
|
40
|
+
- `DONE` = checked task rows
|
|
41
|
+
- `REMAINING` = `TOTAL - DONE`
|
|
42
|
+
- `PARALLEL` = unchecked `[P]` tasks
|
|
43
|
+
- `SEQUENTIAL` = unchecked `[SEQUENTIAL]` tasks
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Implement Progress Contract — Mid-Run and Completion Output
|
|
2
|
+
|
|
3
|
+
At each wave boundary, retry, or long linear stretch, print:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
═════ Progress ═════
|
|
7
|
+
Spec: $SPEC_NAME
|
|
8
|
+
Strategy: $STRATEGY
|
|
9
|
+
Done: X / $TOTAL
|
|
10
|
+
Recent commits:
|
|
11
|
+
- abc123f feat(auth): ...
|
|
12
|
+
- def456g test(auth): ...
|
|
13
|
+
════════════════════
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
When all tasks are complete:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
✓ execute phase complete: $SPEC_NAME
|
|
20
|
+
|
|
21
|
+
Strategy: $STRATEGY
|
|
22
|
+
Tasks done: N / N
|
|
23
|
+
Commits: M atomic commits
|
|
24
|
+
Verify passed: K / K
|
|
25
|
+
|
|
26
|
+
Next steps:
|
|
27
|
+
- /curdx-flow:verify — goal-driven reverse verification
|
|
28
|
+
- /curdx-flow:review — two-stage code review after verification
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Do not claim the feature is shipped from execute alone. Execute completes
|
|
32
|
+
tasks; verify proves user-visible goals; review checks implementation quality.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Implement State Init — Seed execute_state Before Running
|
|
2
|
+
|
|
3
|
+
After strategy selection and before execution begins:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
import json
|
|
7
|
+
p = f'.flow/specs/{SPEC_NAME}/.state.json'
|
|
8
|
+
s = json.load(open(p))
|
|
9
|
+
try:
|
|
10
|
+
cfg = json.load(open('.flow/config.json'))
|
|
11
|
+
except Exception:
|
|
12
|
+
cfg = {}
|
|
13
|
+
execution_cfg = cfg.get('execution', {}) if isinstance(cfg, dict) else {}
|
|
14
|
+
recovery_mode = execution_cfg.get('recovery_mode', 'manual')
|
|
15
|
+
max_fix_tasks = execution_cfg.get('max_fix_tasks_per_original', 2)
|
|
16
|
+
s['phase'] = 'execute'
|
|
17
|
+
s['strategy'] = STRATEGY
|
|
18
|
+
s.setdefault('phase_status', {})['execute'] = 'in_progress'
|
|
19
|
+
s.setdefault('execute_state', {})
|
|
20
|
+
s['execute_state'].setdefault('task_index', DONE)
|
|
21
|
+
s['execute_state']['total_tasks'] = TOTAL
|
|
22
|
+
s['execute_state'].setdefault('failed_attempts', 0)
|
|
23
|
+
s['execute_state'].setdefault('global_iteration', 1)
|
|
24
|
+
s['execute_state'].setdefault('recovery_mode', recovery_mode)
|
|
25
|
+
s['execute_state'].setdefault('max_fix_tasks_per_original', max_fix_tasks)
|
|
26
|
+
s['execute_state'].setdefault('fix_task_map', {})
|
|
27
|
+
if QUICK:
|
|
28
|
+
s['quickMode'] = True
|
|
29
|
+
json.dump(s, open(p, 'w'), indent=2, ensure_ascii=False)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The execute-state ledger must be initialized before any task dispatch so hooks,
|
|
33
|
+
recovery, and status views observe the same state transition.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Stop-Hook Execution — Hook-Driven Continuation
|
|
2
|
+
|
|
3
|
+
Use this mode for long unattended runs where each execution round should end
|
|
4
|
+
naturally and the hook layer decides whether Claude continues.
|
|
5
|
+
|
|
6
|
+
## Protocol
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
1. Execute 1 task (inline or via flow-executor, then wait for completion)
|
|
10
|
+
2. End the response naturally
|
|
11
|
+
3. stop-watcher.sh evaluates transcript markers, .state.json, and tasks.md
|
|
12
|
+
4. If unchecked tasks remain, the hook blocks stop and injects continuation
|
|
13
|
+
5. Repeat until ALL_TASKS_COMPLETE or recovery forces a halt
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Completion Invariant
|
|
17
|
+
|
|
18
|
+
Stop-hook completion is double-checked:
|
|
19
|
+
|
|
20
|
+
- `.state.json` must say execute is complete
|
|
21
|
+
- `tasks.md` must have zero unchecked tasks
|
|
22
|
+
|
|
23
|
+
If either side disagrees, the hook resumes the first unchecked task instead of
|
|
24
|
+
allowing the session to stop cleanly.
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
- `--quick` should be set; otherwise `AskUserQuestion` can stall the loop
|
|
29
|
+
- `.flow/config.json` or `.state.json` should pin `strategy=stop-hook`
|
|
30
|
+
- The hook layer must remain the final authority for continuation
|
|
31
|
+
|
|
32
|
+
## Context Signal
|
|
33
|
+
|
|
34
|
+
During a stop-hook continuation, `stop_hook_active=true` is only a hint. The
|
|
35
|
+
hook still checks transcript signals, `.state.json`, and `tasks.md` parity
|
|
36
|
+
before deciding whether to continue or stop.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Strategy Router — Selection Rules
|
|
2
|
+
|
|
3
|
+
`/curdx-flow:implement` defaults to `--strategy=auto`. The router converts task
|
|
4
|
+
shape into one of four concrete execution modes.
|
|
5
|
+
|
|
6
|
+
## Runtime Decision Tree
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
if [ "$STRATEGY" != "auto" ]; then
|
|
10
|
+
use the explicit value
|
|
11
|
+
elif [ $REMAINING -lt 5 ] || [ $SEQUENTIAL -gt $((REMAINING / 2)) ]; then
|
|
12
|
+
STRATEGY="linear"
|
|
13
|
+
elif [ $PARALLEL -ge $((REMAINING * 4 / 10)) ]; then
|
|
14
|
+
STRATEGY="wave"
|
|
15
|
+
elif [ $REMAINING -ge 20 ] && [ $QUICK -eq 1 ]; then
|
|
16
|
+
STRATEGY="stop-hook"
|
|
17
|
+
elif [ $REMAINING -ge 8 ]; then
|
|
18
|
+
STRATEGY="subagent"
|
|
19
|
+
else
|
|
20
|
+
STRATEGY="linear"
|
|
21
|
+
fi
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Routing Signals
|
|
25
|
+
|
|
26
|
+
- Few tasks or dependency-heavy work: `linear`
|
|
27
|
+
- Meaningful `[P]` coverage and disjoint file sets: `wave`
|
|
28
|
+
- Long unattended run with `--quick`: `stop-hook`
|
|
29
|
+
- Mid-sized backlog without safe parallelism: `subagent`
|
|
30
|
+
|
|
31
|
+
## Guardrails
|
|
32
|
+
|
|
33
|
+
- `--strategy=<mode>` always wins over auto-routing
|
|
34
|
+
- Unknown strategy values are fatal; do not silently fall back
|
|
35
|
+
- `--task=<id>` narrows execution scope, but does not change the selected
|
|
36
|
+
strategy by itself
|
|
37
|
+
- `--quick` is a routing hint only; it does not relax verification or commit
|
|
38
|
+
rules
|