@curdx/flow 2.0.0-beta.1 → 2.0.0-beta.10
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 +1 -1
- package/.claude-plugin/plugin.json +3 -10
- package/CHANGELOG.md +20 -0
- package/README.zh.md +2 -2
- package/agent-preamble/preamble.md +81 -11
- package/agents/flow-adversary.md +40 -55
- package/agents/flow-architect.md +23 -10
- package/agents/flow-debugger.md +2 -2
- package/agents/flow-edge-hunter.md +20 -6
- package/agents/flow-executor.md +3 -3
- package/agents/flow-planner.md +51 -48
- package/agents/flow-product-designer.md +14 -1
- package/agents/flow-qa-engineer.md +1 -1
- package/agents/flow-researcher.md +17 -2
- package/agents/flow-reviewer.md +5 -1
- package/agents/flow-security-auditor.md +1 -1
- package/agents/flow-triage-analyst.md +1 -1
- package/agents/flow-ui-researcher.md +2 -2
- package/agents/flow-ux-designer.md +1 -1
- package/agents/flow-verifier.md +47 -14
- package/bin/curdx-flow.js +13 -1
- package/cli/doctor.js +28 -13
- package/cli/install.js +62 -36
- package/cli/protocols.js +63 -10
- package/cli/registry.js +73 -0
- package/cli/uninstall.js +9 -11
- package/cli/upgrade.js +6 -10
- package/cli/utils.js +104 -56
- package/commands/fast.md +1 -1
- package/commands/implement.md +4 -4
- package/commands/init.md +14 -3
- package/commands/review.md +14 -5
- package/commands/spec.md +26 -2
- package/commands/start.md +47 -17
- package/commands/verify.md +13 -0
- package/gates/adversarial-review-gate.md +19 -19
- package/gates/devex-gate.md +4 -5
- package/gates/edge-case-gate.md +1 -1
- package/hooks/hooks.json +0 -11
- package/hooks/scripts/quick-mode-guard.sh +12 -9
- package/hooks/scripts/session-start.sh +1 -1
- package/hooks/scripts/stop-watcher.sh +25 -15
- package/knowledge/execution-strategies.md +6 -5
- package/knowledge/spec-driven-development.md +8 -7
- package/knowledge/two-stage-review.md +4 -3
- package/package.json +4 -2
- package/skills/brownfield-index/SKILL.md +62 -0
- package/skills/browser-qa/SKILL.md +50 -0
- package/skills/epic/SKILL.md +68 -0
- package/skills/security-audit/SKILL.md +50 -0
- package/skills/ui-sketch/SKILL.md +49 -0
- package/templates/config.json.tmpl +1 -1
- package/templates/design.md.tmpl +32 -112
- package/templates/requirements.md.tmpl +25 -43
- package/templates/research.md.tmpl +37 -68
- package/templates/tasks.md.tmpl +27 -84
- package/hooks/scripts/fail-tracker.sh +0 -31
package/commands/start.md
CHANGED
|
@@ -32,23 +32,45 @@ Entry point for every feature. Works in four modes depending on flags and existi
|
|
|
32
32
|
|
|
33
33
|
## Flag parsing
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
**Do not shell-split `$ARGUMENTS`.** It is a user-supplied string that may
|
|
36
|
+
contain quoted substrings with spaces, `$`-signs, or embedded quotes.
|
|
37
|
+
`xargs`, naive `awk`, and `sed`-based quote stripping all mis-parse at
|
|
38
|
+
least one of those cases (e.g. `my-feature "Fix user's login bug"` breaks
|
|
39
|
+
`xargs: unmatched quote`). Parse the string as a model task instead:
|
|
40
|
+
|
|
41
|
+
1. **Flags** (order-independent, each is self-delimited):
|
|
42
|
+
- `--resume` / `--list` — boolean presence
|
|
43
|
+
- `--mode=<fast|standard|enterprise>` — value after `=`
|
|
44
|
+
Detect each with a single regex over the full `$ARGUMENTS` string and
|
|
45
|
+
remove the matched span from your working copy. Flags not in the list
|
|
46
|
+
above are errors — surface them to the user.
|
|
47
|
+
|
|
48
|
+
2. **Positional args** (after flags removed):
|
|
49
|
+
- First whitespace-separated token → `SPEC_NAME` (kebab-case `[a-z0-9-]+`).
|
|
50
|
+
- Remainder of the string, trimmed and with one layer of outer `"..."`
|
|
51
|
+
or `'...'` quotes stripped → `GOAL`. Preserve inner quotes as-is.
|
|
52
|
+
|
|
53
|
+
3. If `SPEC_NAME` does not match `^[a-z0-9][a-z0-9-]*$` (per
|
|
54
|
+
`schemas/spec-state.schema.json`), stop and ask the user to pick a
|
|
55
|
+
valid kebab-case name.
|
|
56
|
+
|
|
57
|
+
Mode must be `fast`, `standard`, or `enterprise`. Invalid → default to
|
|
58
|
+
`standard` with a warning.
|
|
59
|
+
|
|
60
|
+
Example inputs and their parse:
|
|
61
|
+
|
|
62
|
+
| `$ARGUMENTS` | SPEC_NAME | GOAL | flags |
|
|
63
|
+
|-------------------------------------------------|--------------|-------------------------------|---------------|
|
|
64
|
+
| `my-feature "Add JWT auth"` | `my-feature` | `Add JWT auth` | — |
|
|
65
|
+
| `my-feature --mode=fast "Add JWT auth"` | `my-feature` | `Add JWT auth` | mode=fast |
|
|
66
|
+
| `my-feature "Fix user's login bug"` | `my-feature` | `Fix user's login bug` | — |
|
|
67
|
+
| `--list` | — | — | list=true |
|
|
68
|
+
| `--resume` | — | — | resume=true |
|
|
47
69
|
|
|
48
70
|
## Branch logic
|
|
49
71
|
|
|
50
72
|
### Branch A: `--list`
|
|
51
|
-
Enumerate every directory under `.flow/specs/`, read each `.state.json` for `phase` and `
|
|
73
|
+
Enumerate every directory under `.flow/specs/`, read each `.state.json` for `phase` and `updated` (per `schemas/spec-state.schema.json`), print a numbered list, then `AskUserQuestion` to pick one. Picking sets `.flow/.active-spec` and exits.
|
|
52
74
|
|
|
53
75
|
### Branch B: `--resume` (no name)
|
|
54
76
|
Read `.flow/.active-spec`. If it points to a valid spec dir, report its current phase and next suggested command (`/curdx-flow:spec` if incomplete, `/curdx-flow:implement` if tasks ready). If `.active-spec` is empty or stale, fall back to Branch A.
|
|
@@ -61,17 +83,25 @@ Create a new spec:
|
|
|
61
83
|
|
|
62
84
|
```bash
|
|
63
85
|
mkdir -p ".flow/specs/$SPEC_NAME"
|
|
86
|
+
# NOTE: field names MUST match schemas/spec-state.schema.json:
|
|
87
|
+
# - spec_name (not "spec")
|
|
88
|
+
# - created (date, not "created_at")
|
|
89
|
+
# - updated (date-time, not "updated_at")
|
|
90
|
+
# - phase must be one of the enum values; the initial phase is "research"
|
|
91
|
+
# (there is no "created" phase — that was schema drift pre-beta.9)
|
|
92
|
+
# - version is required
|
|
64
93
|
cat > ".flow/specs/$SPEC_NAME/.state.json" <<JSON
|
|
65
94
|
{
|
|
66
|
-
"
|
|
95
|
+
"version": "1.0",
|
|
96
|
+
"spec_name": "$SPEC_NAME",
|
|
67
97
|
"goal": "$GOAL",
|
|
68
98
|
"mode": "$FLAG_MODE",
|
|
69
|
-
"phase": "
|
|
99
|
+
"phase": "research",
|
|
70
100
|
"phase_status": {},
|
|
71
101
|
"strategy": "auto",
|
|
72
102
|
"execute_state": {},
|
|
73
|
-
"
|
|
74
|
-
"
|
|
103
|
+
"created": "$(date -u +%Y-%m-%d)",
|
|
104
|
+
"updated": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
75
105
|
}
|
|
76
106
|
JSON
|
|
77
107
|
echo "$SPEC_NAME" > .flow/.active-spec
|
package/commands/verify.md
CHANGED
|
@@ -67,6 +67,19 @@ If `--strict`:
|
|
|
67
67
|
|
|
68
68
|
### Step 4: Produce `verification-report.md`
|
|
69
69
|
|
|
70
|
+
**Landing check**: sub-agent responses can be truncated by the model's output-length limit. After dispatching `flow-verifier`, verify the report actually landed:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
REPORT=".flow/specs/$SPEC_NAME/verification-report.md"
|
|
74
|
+
if [ ! -f "$REPORT" ] || [ "$(wc -c < "$REPORT" 2>/dev/null | tr -d ' ')" -lt 300 ]; then
|
|
75
|
+
echo "⚠ Report missing or truncated. Re-dispatching flow-verifier with a terse 'write the report now' prompt."
|
|
76
|
+
# Re-dispatch pattern:
|
|
77
|
+
# "Your only job right now is to Write the verification-report.md using the
|
|
78
|
+
# findings you already gathered. Do not re-scan. Do not narrate. Write
|
|
79
|
+
# the file and stop."
|
|
80
|
+
fi
|
|
81
|
+
```
|
|
82
|
+
|
|
70
83
|
Write to `.flow/specs/$SPEC_NAME/verification-report.md`:
|
|
71
84
|
|
|
72
85
|
```markdown
|
|
@@ -33,19 +33,19 @@ A reviewer agent's output of "everything looks fine, no issues found" is an **in
|
|
|
33
33
|
- "Looks good" is usually confirmation bias (the agent only checked the obvious)
|
|
34
34
|
- AI tends to please the user ("great job!") — fight this tendency
|
|
35
35
|
|
|
36
|
-
**Forced actions**:
|
|
37
|
-
1.
|
|
38
|
-
2.
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
|
|
36
|
+
**Forced actions when the agent reports "no issues"**:
|
|
37
|
+
1. Automatically trigger a second round framed as "what would a senior skeptic reject in this PR?"
|
|
38
|
+
2. If both rounds still honestly yield no findings, the agent must emit a **proof-of-checking report**:
|
|
39
|
+
- Every category it examined (with "N/A" for categories that don't apply)
|
|
40
|
+
- For each examined category, the specific code/file locations inspected
|
|
41
|
+
- Counterfactual hypotheses of "what this would look like if there were a problem" and why that signature is absent
|
|
42
|
+
3. Fabricating findings to avoid the proof-of-checking step is a violation of L3 red line #2 (fact-driven). Better to emit "clean verdict with proof" than invent issues.
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
46
|
-
### Rule 2:
|
|
46
|
+
### Rule 2: Coverage proportional to feature scope
|
|
47
47
|
|
|
48
|
-
A complete adversarial review
|
|
48
|
+
A complete adversarial review covers every category that applies to the feature, marks the rest as N/A with reason. Number of findings per category is proportional to real issues, not a quota:
|
|
49
49
|
|
|
50
50
|
1. **Architecture layer**: Are decisions sound? Future-extensible? Lock-in risks?
|
|
51
51
|
2. **Implementation layer**: Code quality? Error handling? Performance?
|
|
@@ -86,22 +86,22 @@ Not allowed:
|
|
|
86
86
|
Input: object under review (code range / spec / PR diff)
|
|
87
87
|
↓
|
|
88
88
|
Round 1 (agent self-analysis):
|
|
89
|
-
- Use sequential-thinking
|
|
90
|
-
- Scan
|
|
89
|
+
- Use sequential-thinking proportional to the surface being probed
|
|
90
|
+
- Scan each applicable category; mark N/A ones with reason
|
|
91
91
|
- Output findings list
|
|
92
92
|
↓
|
|
93
93
|
Decision:
|
|
94
|
-
-
|
|
95
|
-
-
|
|
94
|
+
- Any real findings? → output report with findings
|
|
95
|
+
- Zero findings after honest Round 1? → force Round 2 framed as skeptic
|
|
96
96
|
↓
|
|
97
97
|
Round 2 (deep analysis):
|
|
98
|
-
- sequential-thinking
|
|
98
|
+
- sequential-thinking proportional to residual uncertainty
|
|
99
99
|
- Focus on "seemingly no issues" parts (trust but verify)
|
|
100
|
-
-
|
|
100
|
+
- Optionally introduce external perspectives (read issues from similar projects)
|
|
101
101
|
↓
|
|
102
102
|
Decision:
|
|
103
|
-
- Still
|
|
104
|
-
-
|
|
103
|
+
- Still zero findings? → agent must emit proof-of-checking report (NOT invent findings)
|
|
104
|
+
- Findings exist? → output report
|
|
105
105
|
↓
|
|
106
106
|
Output: review-report.md
|
|
107
107
|
```
|
|
@@ -190,10 +190,10 @@ Fix loop:
|
|
|
190
190
|
|
|
191
191
|
## Failure Recovery
|
|
192
192
|
|
|
193
|
-
If after 2
|
|
193
|
+
If after Round 2 the honest verdict is still zero findings, emit a proof-of-checking report (do NOT fabricate to hit a quota — there is no quota):
|
|
194
194
|
|
|
195
195
|
```markdown
|
|
196
|
-
## Adversarial Review —
|
|
196
|
+
## Adversarial Review — Proof of Checking (zero findings)
|
|
197
197
|
|
|
198
198
|
I have examined the following dimensions across 2 rounds of analysis:
|
|
199
199
|
|
package/gates/devex-gate.md
CHANGED
|
@@ -195,12 +195,12 @@ Reading these test names = reading API behavior documentation.
|
|
|
195
195
|
|
|
196
196
|
### Agent Automatic
|
|
197
197
|
|
|
198
|
-
When `flow-ux-designer` / `flow-reviewer` applies this gate, use sequential-thinking
|
|
198
|
+
When `flow-ux-designer` / `flow-reviewer` applies this gate, use sequential-thinking proportional to the complexity of the codebase being scanned.
|
|
199
199
|
|
|
200
200
|
### Human Review
|
|
201
201
|
|
|
202
202
|
Attach a DevEx checklist at PR time:
|
|
203
|
-
- [ ] Clear naming (
|
|
203
|
+
- [ ] Clear naming (re-read until obvious to a new maintainer)
|
|
204
204
|
- [ ] Critical comments exist
|
|
205
205
|
- [ ] Consistent structure
|
|
206
206
|
- [ ] Actionable error messages
|
|
@@ -210,7 +210,7 @@ Attach a DevEx checklist at PR time:
|
|
|
210
210
|
|
|
211
211
|
## Scoring
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
Score each **applicable** dimension 0-10 (N/A dimensions are excluded from the total):
|
|
214
214
|
|
|
215
215
|
```
|
|
216
216
|
10 = best practice
|
|
@@ -220,8 +220,7 @@ Each dimension 0-10 points:
|
|
|
220
220
|
0 = serious issue
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
Total < 40 = blocked, improvement required.
|
|
223
|
+
Emit the per-dimension scores with evidence. The gate itself does not block on a numeric threshold; it surfaces the weaknesses for the user (or the reviewing agent) to decide whether any of them rise to a blocker. A single 0/10 on a material dimension is a blocker regardless of the total.
|
|
225
224
|
|
|
226
225
|
---
|
|
227
226
|
|
package/gates/edge-case-gate.md
CHANGED
|
@@ -104,7 +104,7 @@ Q4. If no test, what test should be added to cover it?
|
|
|
104
104
|
Input: object under review (function / component / API) + requirements + tests
|
|
105
105
|
↓
|
|
106
106
|
For each category (1-7):
|
|
107
|
-
1. Use sequential-thinking to list
|
|
107
|
+
1. Use sequential-thinking to list every plausible edge scenario for this category — stop when you've covered the real risk surface, don't pad to a quota, don't fabricate scenarios that won't occur in production
|
|
108
108
|
2. Check whether each scenario has corresponding coverage in tests
|
|
109
109
|
3. Add uncovered ones to the "gap list"
|
|
110
110
|
↓
|
package/hooks/hooks.json
CHANGED
|
@@ -20,17 +20,6 @@
|
|
|
20
20
|
]
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
|
-
"PostToolUseFailure": [
|
|
24
|
-
{
|
|
25
|
-
"matcher": "Bash|Edit|Write",
|
|
26
|
-
"hooks": [
|
|
27
|
-
{
|
|
28
|
-
"type": "command",
|
|
29
|
-
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/fail-tracker.sh"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
23
|
"Stop": [
|
|
35
24
|
{
|
|
36
25
|
"hooks": [
|
|
@@ -40,17 +40,20 @@ ACTIVE=$(cat .flow/.active-spec 2>/dev/null)
|
|
|
40
40
|
STATE_FILE=".flow/specs/$ACTIVE/.state.json"
|
|
41
41
|
[ ! -f "$STATE_FILE" ] && exit 0
|
|
42
42
|
|
|
43
|
-
# Read quickMode + mode
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
# Read quickMode + mode. Pass STATE_FILE via env (NOT shell interpolation
|
|
44
|
+
# into the python source) so an active-spec name containing quotes/$ cannot
|
|
45
|
+
# inject python code.
|
|
46
|
+
export STATE_FILE
|
|
47
|
+
QUICK_MODE=$(python3 -c '
|
|
48
|
+
import json, os
|
|
46
49
|
try:
|
|
47
|
-
s = json.load(open(
|
|
48
|
-
qm = s.get(
|
|
49
|
-
mode = s.get(
|
|
50
|
-
print(
|
|
50
|
+
s = json.load(open(os.environ["STATE_FILE"]))
|
|
51
|
+
qm = s.get("quickMode", False)
|
|
52
|
+
mode = s.get("mode", "")
|
|
53
|
+
print("true" if (qm or mode == "autonomous") else "false")
|
|
51
54
|
except Exception:
|
|
52
|
-
print(
|
|
53
|
-
|
|
55
|
+
print("false")
|
|
56
|
+
' 2>/dev/null)
|
|
54
57
|
|
|
55
58
|
if [ "$QUICK_MODE" = "true" ]; then
|
|
56
59
|
# Block and inject guidance
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# CurDX-Flow SessionStart Hook
|
|
3
3
|
# Duties:
|
|
4
|
-
# 1. Daily dependency check — nudge user to /flow
|
|
4
|
+
# 1. Daily dependency check — nudge user to `npx @curdx/flow install --all` if recommended plugins missing
|
|
5
5
|
# 2. Load active spec progress into session context
|
|
6
6
|
#
|
|
7
7
|
# Design notes:
|
|
@@ -56,6 +56,12 @@ if ! command -v python3 >/dev/null 2>&1; then
|
|
|
56
56
|
allow_stop
|
|
57
57
|
fi
|
|
58
58
|
|
|
59
|
+
# Export STATE_FILE BEFORE invoking python3 — the heredoc-based parser reads
|
|
60
|
+
# os.environ["STATE_FILE"]. Previously the export was placed after the
|
|
61
|
+
# heredoc, so python3 always got None, json.load(None) silently failed, and
|
|
62
|
+
# the stop-hook strategy never activated.
|
|
63
|
+
export STATE_FILE
|
|
64
|
+
|
|
59
65
|
read STRATEGY PHASE TASK_INDEX TOTAL_TASKS FAILED ROUNDS <<EOF
|
|
60
66
|
$(python3 <<'PY'
|
|
61
67
|
import json, os, sys
|
|
@@ -75,7 +81,6 @@ print(strategy, phase, ti, tt, failed, rounds)
|
|
|
75
81
|
PY
|
|
76
82
|
)
|
|
77
83
|
EOF
|
|
78
|
-
export STATE_FILE
|
|
79
84
|
|
|
80
85
|
# Only activate for stop-hook strategy + execute phase
|
|
81
86
|
[ "$STRATEGY" != "stop-hook" ] && allow_stop
|
|
@@ -95,12 +100,17 @@ if [ -n "$TRANSCRIPT_PATH" ] && [ -f "$TRANSCRIPT_PATH" ]; then
|
|
|
95
100
|
TRANSCRIPT_TAIL=$(tail -c 51200 "$TRANSCRIPT_PATH" 2>/dev/null || echo "")
|
|
96
101
|
fi
|
|
97
102
|
|
|
103
|
+
# Python state-file updates: use quoted heredocs (<<'PY') + os.environ so
|
|
104
|
+
# the spec-name-derived STATE_FILE path is NEVER interpolated into the
|
|
105
|
+
# python source text. Previously a spec name containing single quotes or
|
|
106
|
+
# $-signs could break the script or inject arbitrary code.
|
|
107
|
+
|
|
98
108
|
# Check for explicit completion signals
|
|
99
109
|
if echo "$TRANSCRIPT_TAIL" | grep -q "ALL_TASKS_COMPLETE"; then
|
|
100
110
|
# Cleanup: mark phase completed
|
|
101
|
-
python3 <<PY 2>/dev/null
|
|
102
|
-
import json
|
|
103
|
-
p = "
|
|
111
|
+
python3 <<'PY' 2>/dev/null
|
|
112
|
+
import json, os
|
|
113
|
+
p = os.environ["STATE_FILE"]
|
|
104
114
|
s = json.load(open(p))
|
|
105
115
|
s.setdefault("phase_status", {})["execute"] = "completed"
|
|
106
116
|
s["phase"] = "verify" # move to verify phase
|
|
@@ -112,16 +122,16 @@ fi
|
|
|
112
122
|
# Check for fail signal (accumulate; actual stop decision below)
|
|
113
123
|
if echo "$TRANSCRIPT_TAIL" | grep -q "TASK_FAILED"; then
|
|
114
124
|
# Increment failed_attempts
|
|
115
|
-
python3 <<PY 2>/dev/null
|
|
116
|
-
import json
|
|
117
|
-
p = "
|
|
125
|
+
python3 <<'PY' 2>/dev/null
|
|
126
|
+
import json, os
|
|
127
|
+
p = os.environ["STATE_FILE"]
|
|
118
128
|
s = json.load(open(p))
|
|
119
129
|
s.setdefault("execute_state", {})
|
|
120
130
|
s["execute_state"]["failed_attempts"] = s["execute_state"].get("failed_attempts", 0) + 1
|
|
121
131
|
json.dump(s, open(p, "w"), indent=2, ensure_ascii=False)
|
|
122
132
|
PY
|
|
123
|
-
# Re-read
|
|
124
|
-
FAILED=$(python3 -c
|
|
133
|
+
# Re-read — again via os.environ, no shell interpolation into python.
|
|
134
|
+
FAILED=$(python3 -c 'import json, os; print(json.load(open(os.environ["STATE_FILE"]))["execute_state"]["failed_attempts"])' 2>/dev/null || echo 0)
|
|
125
135
|
fi
|
|
126
136
|
|
|
127
137
|
# ---------- 6. Safety brakes ----------
|
|
@@ -138,9 +148,9 @@ fi
|
|
|
138
148
|
# Check if all tasks done
|
|
139
149
|
if [ "$TASK_INDEX" -ge "$TOTAL_TASKS" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
|
|
140
150
|
# Mark complete
|
|
141
|
-
python3 <<PY 2>/dev/null
|
|
142
|
-
import json
|
|
143
|
-
p = "
|
|
151
|
+
python3 <<'PY' 2>/dev/null
|
|
152
|
+
import json, os
|
|
153
|
+
p = os.environ["STATE_FILE"]
|
|
144
154
|
s = json.load(open(p))
|
|
145
155
|
s.setdefault("phase_status", {})["execute"] = "completed"
|
|
146
156
|
s["phase"] = "verify"
|
|
@@ -151,9 +161,9 @@ fi
|
|
|
151
161
|
|
|
152
162
|
# ---------- 7. Block and continue ----------
|
|
153
163
|
# Increment round counter
|
|
154
|
-
python3 <<PY 2>/dev/null
|
|
155
|
-
import json
|
|
156
|
-
p = "
|
|
164
|
+
python3 <<'PY' 2>/dev/null
|
|
165
|
+
import json, os
|
|
166
|
+
p = os.environ["STATE_FILE"]
|
|
157
167
|
s = json.load(open(p))
|
|
158
168
|
s.setdefault("execute_state", {})
|
|
159
169
|
s["execute_state"]["global_iteration"] = s["execute_state"].get("global_iteration", 0) + 1
|
|
@@ -223,13 +223,14 @@ return "linear"
|
|
|
223
223
|
|
|
224
224
|
## Failure Handling (common to all strategies)
|
|
225
225
|
|
|
226
|
-
`flow-executor` agent's
|
|
226
|
+
`flow-executor` agent's retry ladder — each step escalates only when the prior is honestly exhausted, not on a fixed count:
|
|
227
227
|
|
|
228
228
|
```
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
Step A: autonomous retry (edit + rerun Verify) — only for shallow failures
|
|
230
|
+
Step B: sequential-thinking root-cause analysis proportional to the hypothesis space
|
|
231
|
+
Step C: read related source + trace data flow
|
|
232
|
+
Step D: if ≥3 retries fail with no new hypothesis, stop and challenge the architecture (see preamble L3)
|
|
233
|
+
Step E: report TASK_FAILED
|
|
233
234
|
```
|
|
234
235
|
|
|
235
236
|
### Extra protections for Stop-Hook strategy
|
|
@@ -57,7 +57,7 @@ What's wasted isn't code — it's context tokens and decision fatigue from churn
|
|
|
57
57
|
**Key behaviors** (flow-researcher agent):
|
|
58
58
|
1. Read `.flow/PROJECT.md` and `.flow/CONTEXT.md` to understand project background
|
|
59
59
|
2. Call `mcp__claude_mem__search` to retrieve relevant historical experience
|
|
60
|
-
3. Use sequential-thinking for
|
|
60
|
+
3. Use sequential-thinking proportional to the unknowns (1 thought for a trivial prototype, many for a novel domain)
|
|
61
61
|
4. Scan the codebase for reusable modules
|
|
62
62
|
5. Use `mcp__context7__*` to look up latest docs for relevant libraries
|
|
63
63
|
6. When necessary, WebSearch for the latest technical trends
|
|
@@ -99,11 +99,12 @@ What's wasted isn't code — it's context tokens and decision fatigue from churn
|
|
|
99
99
|
|
|
100
100
|
**Key behaviors** (flow-architect agent):
|
|
101
101
|
1. Read `research.md` + `requirements.md`
|
|
102
|
-
2. **
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
102
|
+
2. **Use sequential-thinking proportional to the tradeoff surface** — the phases below are orientation, not a quota:
|
|
103
|
+
- Constraints (from NFR / tech stack)
|
|
104
|
+
- Option comparison (only when alternatives genuinely compete)
|
|
105
|
+
- Selection + accepted tradeoff
|
|
106
|
+
- Self-rebuttal
|
|
107
|
+
A well-known stack pick may finish in 1 thought; a distributed-system design may run many. Do not pad.
|
|
107
108
|
3. Assign an `AD-NN` ID to each architectural decision
|
|
108
109
|
4. Draw a data flow diagram (mermaid)
|
|
109
110
|
5. Define component interfaces + error paths
|
|
@@ -125,7 +126,7 @@ What's wasted isn't code — it's context tokens and decision fatigue from churn
|
|
|
125
126
|
3. Each task has 5 fields: `Do` / `Files` / `Done-when` / `Verify` / `Commit`
|
|
126
127
|
4. **Multi-source coverage audit**: for each FR / AC / AD / decision, confirm there is a covering task (no omissions)
|
|
127
128
|
5. Mark `[P]` (parallel-safe) and `[VERIFY]` (checkpoint)
|
|
128
|
-
6. Simple decomposition doesn't need sequential-thinking
|
|
129
|
+
6. Simple decomposition doesn't need sequential-thinking; run a coverage audit at the end (every FR/AC/AD has a task)
|
|
129
130
|
|
|
130
131
|
**Deliverable**: `tasks.md`
|
|
131
132
|
|
|
@@ -113,17 +113,18 @@ Stage 2 applies all enabled Gates (from `.flow/config.json`):
|
|
|
113
113
|
|
|
114
114
|
#### 2.5 (enterprise) Adversarial review (adversarial-review-gate)
|
|
115
115
|
|
|
116
|
-
-
|
|
116
|
+
- Every applicable category examined (N/A documented for the rest)?
|
|
117
|
+
- Findings proportional to real issues (zero is OK with a proof-of-checking report)?
|
|
117
118
|
- Each finding has evidence + recommendation?
|
|
118
119
|
|
|
119
120
|
#### 2.6 (enterprise) Edge cases (edge-case-gate)
|
|
120
121
|
|
|
121
|
-
-
|
|
122
|
+
- Each applicable edge-case category addressed (N/A noted for the rest)?
|
|
122
123
|
- Gap list has priorities?
|
|
123
124
|
|
|
124
125
|
### Stage 2 verdict
|
|
125
126
|
|
|
126
|
-
- **EXCELLENT**: all enabled Gates pass, adversarial
|
|
127
|
+
- **EXCELLENT**: all enabled Gates pass, adversarial review clean or only low-severity findings
|
|
127
128
|
- **GOOD**: all enabled Gates pass, but some warnings
|
|
128
129
|
- **NEEDS_IMPROVEMENT**: Gate violations (blocking)
|
|
129
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curdx/flow",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
4
|
"description": "CLI installer for CurDX-Flow — AI engineering workflow meta-framework for Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"curdx-flow": "bin/curdx-flow.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"
|
|
11
|
+
"test": "node --test test/*.test.js",
|
|
12
|
+
"prepublishOnly": "node --test test/*.test.js && node bin/curdx-flow.js --version"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
14
15
|
"bin/",
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"agent-preamble/",
|
|
23
24
|
"templates/",
|
|
24
25
|
"schemas/",
|
|
26
|
+
"skills/",
|
|
25
27
|
"README.md",
|
|
26
28
|
"CHANGELOG.md",
|
|
27
29
|
"LICENSE"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
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]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Brownfield Index
|
|
8
|
+
|
|
9
|
+
You are invoked when the user needs a structural map of an existing codebase they are not yet familiar with.
|
|
10
|
+
|
|
11
|
+
## Preconditions
|
|
12
|
+
|
|
13
|
+
1. The repository root is the current working directory (or a path the user specifies).
|
|
14
|
+
2. The project is not a new `/curdx-flow:init`-ed greenfield project (if it is, direct the user to `/curdx-flow:start` instead).
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
### Step 1: Detect project type
|
|
19
|
+
|
|
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.
|
|
21
|
+
|
|
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
|
|
53
|
+
|
|
54
|
+
Point the user at the next useful action:
|
|
55
|
+
- "Looking to add a feature here? Run `/curdx-flow:start <name>` to begin a spec."
|
|
56
|
+
- "Debugging something specific? Run `/curdx-flow:debug '<symptom>'`."
|
|
57
|
+
|
|
58
|
+
## Notes
|
|
59
|
+
|
|
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.
|
|
61
|
+
|
|
62
|
+
For deep research into a specific library or framework, use `context7` MCP directly.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
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]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Browser QA
|
|
8
|
+
|
|
9
|
+
You are invoked when the user wants real-browser QA of a UI flow.
|
|
10
|
+
|
|
11
|
+
## Preconditions
|
|
12
|
+
|
|
13
|
+
1. `chrome-devtools` MCP is available (`mcp__chrome-devtools__*`). If missing, fall back to a manual checklist.
|
|
14
|
+
2. A URL (dev server or deployed) is available. Prompt for it if not provided.
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
### Step 1: Clarify scope
|
|
19
|
+
|
|
20
|
+
Confirm with the user:
|
|
21
|
+
- **URL under test** (local `http://localhost:3000` or remote)
|
|
22
|
+
- **Flow to test** (e.g., "sign up → dashboard → logout")
|
|
23
|
+
- **What success looks like** (accessibility / performance / zero console errors / visual match)
|
|
24
|
+
|
|
25
|
+
### Step 2: Dispatch `flow-qa-engineer`
|
|
26
|
+
|
|
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`
|
|
30
|
+
3. Capture `list_console_messages`, `list_network_requests`, `take_screenshot`, optionally `lighthouse_audit`
|
|
31
|
+
4. Compare against expected behavior
|
|
32
|
+
|
|
33
|
+
### Step 3: Report findings
|
|
34
|
+
|
|
35
|
+
Produce `.flow/specs/<active>/qa-report.md` with:
|
|
36
|
+
- **Bugs** (reproducible, severity P1/P2/P3)
|
|
37
|
+
- **Performance** (LCP / INP / CLS from Lighthouse)
|
|
38
|
+
- **Accessibility** (axe violations with WCAG references)
|
|
39
|
+
- **Console errors** (full stack traces)
|
|
40
|
+
- **Screenshots** (attached)
|
|
41
|
+
|
|
42
|
+
### Step 4: Hand off
|
|
43
|
+
|
|
44
|
+
If bugs found: suggest `/curdx-flow:debug "<bug title>"` for systematic root-cause analysis.
|
|
45
|
+
If accessibility violations: suggest fixes inline with WCAG refs.
|
|
46
|
+
|
|
47
|
+
## References
|
|
48
|
+
|
|
49
|
+
- `flow-qa-engineer` agent: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-qa-engineer.md`
|
|
50
|
+
- chrome-devtools MCP docs: https://github.com/ChromeDevTools/chrome-devtools-mcp
|