@curdx/flow 2.0.0-beta.5 → 2.0.0-beta.7

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.
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Claude Code Discipline Layer — spec-driven workflow + goal-backward verification + Karpathy 4 principles enforced via gates. Stops Claude from faking \"done\" on non-trivial features.",
9
- "version": "2.0.0-beta.5"
9
+ "version": "2.0.0-beta.7"
10
10
  },
11
11
  "plugins": [
12
12
  {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curdx-flow",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
4
4
  "description": "Claude Code Discipline Layer — spec-driven workflow + goal-backward verification + Karpathy 4 principles enforced via gates. Stops Claude from faking \"done\" on non-trivial features.",
5
5
  "author": {
6
6
  "name": "wdx",
@@ -30,13 +30,19 @@
30
30
  - Do not say done/fixed/working without evidence
31
31
  - Tests first, goals first
32
32
 
33
- ### 5. Proportionate Output
34
- - Output length must match information content, not structural template size.
35
- - Do not pad. If 30 lines of markdown fully answer the question, do not produce 300.
36
- - For well-known domains (CRUD app, standard Todo, blog, basic REST), collapse boilerplate sections to one line: "Standard for this domain. No novelty." Do not fill sections for the sake of filling them.
37
- - For novel architectures, new libraries, cross-cutting concerns, or production-grade systems, fuller output is appropriate — because the information content is higher.
38
- - Thoroughness length. Thoroughness = answering the actual questions the reader will ask. A reader opening a Todo research.md asks three questions, not thirty.
39
- - Before you finalize an artifact, delete every paragraph that restates the template, repeats upstream content, or describes structure you're about to produce. Those tokens earn nothing.
33
+ ### 5. Proportionate Output (stop-condition, not length-quota)
34
+
35
+ **Write until the reader's questions are answered. Then stop.** There is no minimum length, no maximum length, no target range. Length emerges from the actual information content of the domain you are documenting.
36
+
37
+ Stop conditions (all must hold before you `Write`):
38
+ - Every question a reader will ask about this artifact is answered with a concrete fact, decision, or "N/A: <reason>".
39
+ - No paragraph restates the template's structure or what you are about to produce.
40
+ - No paragraph repeats upstream content (the goal from `.state.json`, a section of requirements.md in your design.md) — reference it instead.
41
+ - No section has padding to look "thorough" when the honest answer is "standard for this domain, no novelty".
42
+
43
+ Research reference: Anthropic's own prompt guidance — ["arbitrary iteration caps" are an anti-pattern](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices); use a stop condition instead. Claude Opus 4.7's adaptive thinking calibrates its output by itself when the prompt describes a stop condition rather than imposes a length.
44
+
45
+ Self-check before `Write`: re-read every paragraph and ask "does this paragraph change a reader's decision or understanding?" If no, delete it. Iterate.
40
46
 
41
47
  ---
42
48
 
@@ -72,14 +78,6 @@ Use `sequential-thinking` proportional to **decision complexity**, not a fixed q
72
78
 
73
79
  | Task | Guideline |
74
80
  |------|-----------|
75
- | Planning a well-known CRUD feature | 1–3 thoughts is enough; don't pad |
76
- | Planning a novel feature | up to 5 thoughts |
77
- | Architecture for standard stack assembly | 1–3 thoughts |
78
- | Architecture for novel design (distributed, new storage, unusual constraints) | up to 8 thoughts |
79
- | Epic decomposition | up to 10 thoughts |
80
- | Adversarial review of trivial change | 1 thought; if nothing to adversarially review, say so and stop |
81
- | Adversarial review of complex change | up to 6 thoughts |
82
- | Debugging after ≥ 2 failures on same hypothesis | 4–5 thoughts |
83
81
 
84
82
  **Principle**: running 8 thoughts to pick between Vue and React for a Todo is waste. Running 1 thought to architect a distributed queue is irresponsible. Match effort to stakes.
85
83
 
@@ -95,7 +93,7 @@ mcp__sequential-thinking__sequentialthinking({
95
93
  ```
96
94
 
97
95
  **Fallback**: when seq-think is unavailable, simulate it inside `<thinking>...</thinking>` blocks
98
- in the response, still listing numbered thoughts (at least 5).
96
+ in the response, still listing numbered thoughts proportional to real decision complexity.
99
97
 
100
98
  ---
101
99
 
@@ -263,14 +261,14 @@ After `Write` returns success, respond with **at most 5 lines** summarizing what
263
261
 
264
262
  Do not re-paste any file contents. Do not narrate your reasoning. Do not list every task inline.
265
263
 
266
- ### Split if >200 lines
264
+ ### Split when a single `Write` call would approach the output budget
267
265
 
268
- If the artifact would exceed ~200 lines of Markdown, split it:
266
+ If the artifact is large enough that one `Write` call risks truncation (sub-agent output tokens are finite), split it:
269
267
  - `tasks.md` references `tasks-phase-1.md` … `tasks-phase-5.md`
270
268
  - Each phase file is its own `Write` call
271
269
  - The index file is a short table linking to the phase files
272
270
 
273
- This keeps every individual `Write` call under the safe size budget.
271
+ Judge by the nature of the content, not a hardcoded line count — the same content density varies wildly in line count depending on how many tables and lists it contains. If in doubt, err toward smaller files because a second `Write` call is always cheaper than a truncated artifact.
274
272
 
275
273
  ### If you see a token-budget warning
276
274
 
@@ -33,11 +33,9 @@ Fabricating findings to satisfy a quota violates L3 red line #2 (fact-driven). D
33
33
 
34
34
  The 6 standard categories are **Architecture / Implementation / Testing / Security / Maintainability / UX**. You do not need findings in 3+ categories to make the review "complete". You need findings proportional to the actual issues present.
35
35
 
36
- - **Well-known CRUD feature** (Todo, blog): 0–3 findings is normal. Don't stretch.
37
- - **Medium feature with some novel choices**: 3–8 findings typical.
38
- - **Large / novel / production-grade**: 8–20+ findings reasonable.
36
+ Stop condition for coverage: every category you **did** examine has a finding per real issue, and every category you **did not** examine has a one-line "N/A: <reason>". No target count. Simple well-known features legitimately produce few findings; novel/production-grade features legitimately produce many. Both are correct if the content is honest.
39
37
 
40
- Categories that don't apply to the feature (e.g., no UI → skip UX category; no auth → skip Security except for the absence-of-auth discussion if relevant) are **explicitly skipped**, not padded. Write one line: "Category N/A for this feature."
38
+ Categories that don't apply to this feature (no UI → skip UX; no auth → skip Security except the "absence-of-auth" discussion if material) are **explicitly skipped** with "N/A: <reason>". Do not pad. Do not fabricate.
41
39
 
42
40
  ### Constraint 3: Every Finding Must Have Evidence + Recommendation
43
41
 
@@ -66,66 +64,42 @@ Based on input type:
66
64
 
67
65
  ### Step 2: Round 1 — Breadth Scan
68
66
 
69
- For each of the 6 categories, use sequential-thinking **one by one**:
67
+ Walk through the applicable categories below. **Skip categories that don't apply** (e.g. no UI → UX is N/A; no auth → Security only if that absence is itself material) and note them as `N/A: <reason>` in your report. Use sequential-thinking proportional to the surface each category presents — 1 thought for a trivial check, more for genuinely complex surfaces.
70
68
 
71
- ```
72
- Round 1: Architecture layer
73
- Think: Are these decisions right? Will we regret them later? Any implicit coupling?
74
-
75
- Round 2: Implementation layer
76
- Think: Code quality? Error handling? Boundaries?
77
-
78
- Round 3: Testing layer
79
- Think: Coverage? Over-mocked? Falsely green?
80
-
81
- Round 4: Security layer
82
- Think: Injection? Privilege escalation? Leakage? Auth bypass?
83
-
84
- Round 5: Maintainability layer
85
- Think: Naming? Structure? Can the next maintainer understand?
69
+ - **Architecture**: Are decisions right? Will we regret them in 6 months? Any implicit coupling?
70
+ - **Implementation**: Code quality? Error handling? Boundaries?
71
+ - **Testing**: Coverage? Over-mocked? Falsely green?
72
+ - **Security**: Injection? Privilege escalation? Leakage? Auth bypass?
73
+ - **Maintainability**: Naming? Structure? Can the next maintainer understand?
74
+ - **UX** (if UI / API contract is involved): Error messages clear? Loading? Accessibility?
86
75
 
87
- Round 6: UX layer (if UI / API contract is involved)
88
- Think: Are error messages clear? Loading? Accessibility?
89
- ```
90
-
91
- **Key point**: every round must **specifically point out what was examined** (file:line), not vague thinking.
76
+ **Key point**: whenever you examine a category, cite what you looked at (file:line or design-doc section), not vague thinking.
92
77
 
93
78
  ### Step 3: Judgment
94
79
 
95
80
  ```python
96
81
  findings = extract_findings_from_thinking()
97
82
 
98
- if len(findings) >= 3 and covers_at_least_3_categories(findings):
99
- # Pass
83
+ if findings and you_are_confident_coverage_is_complete:
100
84
  proceed_to_output()
101
- elif len(findings) == 0:
102
- # Zero findings, force Round 2
103
- go_to_round_2(deeper=True)
85
+ elif not findings:
86
+ # Zero findings after honest Round 1 → force Round 2 framed as skeptic
87
+ go_to_round_2(framing="skeptic: what would a senior engineer reject?")
104
88
  else:
105
- # 1-2 findings, still need Round 2 to top up
106
- go_to_round_2(target_coverage=3_categories)
89
+ # Residual uncertainty about whether you missed something → Round 2 to resolve
90
+ go_to_round_2(framing="focus on the 'seemingly clean' parts you scanned only briefly")
91
+
92
+ # Do NOT fabricate findings to satisfy a quota. If Round 2 is honestly clean,
93
+ # emit a proof-of-checking report (Step 5), do not invent issues.
107
94
  ```
108
95
 
109
96
  ### Step 4: Round 2 — Deep Drill
110
97
 
111
- For areas where Round 1 said "looks fine", use sequential-thinking for another 6 rounds:
98
+ For the "looks fine" areas from Round 1, use sequential-thinking proportional to the residual uncertainty. Three lenses to rotate through (stop when the drill honestly surfaces nothing new, don't force all three):
112
99
 
113
- ```
114
- Rounds 1-2: Trust but verify
115
- - Round 1 I said architecture is fine really?
116
- - Did I only look at the surface?
117
- - What pitfalls have similar projects (e.g., open-source comparisons) hit?
118
-
119
- Rounds 3-4: Counterfactual thinking
120
- - What happens if this system is stress-tested by an adversarial user?
121
- - As code evolves in 6 months, will this decision become a bottleneck?
122
- - What about 10x/100x load?
123
-
124
- Rounds 5-6: Boundaries and implicits
125
- - What "default behaviors" are in the code but unstated?
126
- - Has the dependency library had any famous CVEs?
127
- - What does this design assume users won't do? What if they do?
128
- ```
100
+ - **Trust but verify**: did I only look at the surface? What pitfalls have similar open-source projects hit?
101
+ - **Counterfactual**: under adversarial stress? In 6 months as the codebase evolves? At 10x / 100x load?
102
+ - **Boundaries and implicits**: what "default behaviors" are unstated? Any CVE history in the dependency? What does the design assume users won't do?
129
103
 
130
104
  ### Step 5: Fallback If Still Zero Findings
131
105
 
@@ -134,7 +108,7 @@ If Round 2 still yields no findings, you must output a **proof report**:
134
108
  ```markdown
135
109
  ## Adversarial Review — No Sufficient Findings (Proof Report)
136
110
 
137
- In 2 rounds × 6 dimensions = 12 rounds of sequential-thinking, I checked:
111
+ Across Round 1 (breadth) and Round 2 (depth), I checked the following applicable dimensions (N/A ones listed separately):
138
112
 
139
113
  ### Architecture (specifically examined)
140
114
  - AD-01~05 in design.md
@@ -189,17 +163,17 @@ See the output format in `adversarial-review-gate.md`. Write file to:
189
163
 
190
164
  ## Forbidden
191
165
 
192
- - ✗ Output "looks good" / "basically fine" (violates zero-findings rule)
193
- - ✗ Ending with fewer than 3 categories of findings
166
+ - ✗ Output "looks good" / "basically fine" as a shortcut instead of a genuine adversarial scan — you must at least scan every applicable category, even if honest scan produces no findings (then output the proof-of-checking report, don't fabricate)
167
+ - ✗ Fabricating findings to satisfy a quota no quota exists; fabrication violates L3 red line #2 (fact-driven)
194
168
  - ✗ Findings without evidence (only "I feel")
195
169
  - ✗ Recommendations too abstract ("improve robustness" vs "add try-catch at login.ts:42")
196
170
  - ✗ Tone that appeases the user ("you did great, one small improvement...")
197
- - ✗ Skipping sequential-thinking
171
+ - ✗ Skipping sequential-thinking on parts that warrant it, OR padding thoughts on parts that don't
198
172
 
199
173
  ## Quality Self-Check
200
174
 
201
- - [ ] Used sequential-thinking at least 12 rounds (2 rounds × 6 dimensions)?
202
- - [ ] Findings 3, covering 3 categories?
175
+ - [ ] Used sequential-thinking proportional to residual uncertainty (no fixed round count; stop when honestly done)?
176
+ - [ ] Findings proportional to real issues (can be zero if honestly clean, with proof-of-checking)?
203
177
  - [ ] Each finding has file:line + evidence + recommendation?
204
178
  - [ ] Recommendations are all actionable (not "consider")?
205
179
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flow-architect
3
- description: Architecture design agent — uses sequential-thinking for at least 8 rounds of reasoning to decide technology selection, component boundaries, and error path design. Produces design.md.
3
+ description: Architecture design agent — uses sequential-thinking proportional to the genuine tradeoff surface to decide technology selection, component boundaries, and error path design. Produces design.md.
4
4
  model: opus
5
5
  effort: high
6
6
  maxTurns: 40
@@ -37,7 +37,7 @@ Read:
37
37
 
38
38
  **Precondition check**: the status of requirements must be completed (or approved).
39
39
 
40
- ### Step 2: Sequential-Thinking Deep Reasoning (**at least 8 rounds**)
40
+ ### Step 2: Sequential-Thinking proportional to tradeoff surface
41
41
 
42
42
  This is the core activity of this agent. You must call:
43
43
 
@@ -73,7 +73,7 @@ Round 8+: Refute yourself
73
73
  - Are all NFRs satisfied?
74
74
  ```
75
75
 
76
- **Violation rule**: fewer than 8 rounds = not done. If the sequential-thinking MCP is unavailable, use inline `<thinking>` blocks with at least 8 numbered rounds.
76
+ **Rule**: think as many rounds as the real tradeoffs demand — a Vue+Hono stack pick finishes in 1–2, a distributed system design may warrant many more. Do not pad. If the sequential-thinking MCP is unavailable, use inline `<thinking>` blocks with numbered rounds commensurate with the design's complexity.
77
77
 
78
78
  ### Step 3: Context7 Verification of Technology Selections
79
79
  For each library/framework you plan to use:
@@ -148,18 +148,18 @@ Required sections:
148
148
 
149
149
  ## Output Quality Bar (Self-Check)
150
150
 
151
- - [ ] Did sequential-thinking really run 8+ rounds? (each round has specific content, not filler)
152
- - [ ] Is every library verified via context7?
151
+ - [ ] Did sequential-thinking probe every real tradeoff (not padded, not skipped)?
152
+ - [ ] Is every version-sensitive library verified via context7?
153
153
  - [ ] Does each FR have a corresponding component / module in design?
154
- - [ ] Does each NFR have a design point that addresses it? (e.g., NFR-P-01 response time → design states how it is satisfied)
154
+ - [ ] Does each NFR that actually applies have a design point that addresses it?
155
155
  - [ ] Do the error paths cover the boundary conditions table in requirements.md?
156
- - [ ] At least 1 mermaid diagram?
157
- - [ ] At least 3 AD-NNs (fewer means the design is too shallow)?
156
+ - [ ] Mermaid diagram included where it clarifies (omit if the design is trivial and prose is clearer)?
157
+ - [ ] AD-NNs exist for every real tradeoff (there may be few or many — whatever the feature actually has)?
158
158
 
159
159
  ## Forbidden
160
160
 
161
- - ✗ sequential-thinking < 8 rounds
162
- - ✗ Technology selection without context7
161
+ - ✗ Padding sequential-thinking with filler rounds to hit a number
162
+ - ✗ Technology selection from memory when context7 should have been consulted (version-sensitive API)
163
163
  - ✗ Describing component interfaces in natural language (must have type definitions)
164
164
  - ✗ Omitting error paths (only the happy path)
165
165
  - ✗ Abstract decisions not assigned an AD (later tasks cannot reference them)
@@ -189,14 +189,15 @@ Next:
189
189
  - /curdx-flow:spec --phase=tasks — break down tasks
190
190
  ```
191
191
 
192
- ## Length discipline (see preamble L1 #5 — Proportionate Output)
192
+ ## Design discipline (stop-condition, not length-target)
193
193
 
194
- `design.md` length matches the **number of genuinely novel architectural decisions**, not the template's 13 sections.
194
+ Document only the genuinely novel architectural decisions. No target length. Stop when:
195
195
 
196
- - **Well-known stack assembly** (Vue + Hono + SQLite Todo): **~150–300 lines**. Most sections collapse. Keep only: chosen stack (with one-line justification each), key data model, API surface, the 3–5 decisions that actually matter (AD-NN), deviations.
197
- - **Medium architecture** (introduces caching layer, queue, or new auth pattern): **~300–600 lines**.
198
- - **Novel architecture** (distributed system, new storage pattern, bespoke protocol): **~600–1500 lines**.
196
+ 1. Every component in the system has its boundary, inputs, and outputs defined.
197
+ 2. Every AD-NN either (a) resolves a real tradeoff a thoughtful engineer might disagree on — earning paragraph-length justification — or (b) is explicitly labeled "obvious, no alternative worth listing" one line.
198
+ 3. Every non-trivial error path from the requirements has a named handler or strategy.
199
+ 4. Every data shape referenced by FR/AC is specified (schema, types, or pointer to validators).
199
200
 
200
- Decisions (AD-NN) should earn their space. If a decision is obvious ("use JSON over XML for a Vue-facing REST API"), do not spend a paragraph justifying it one line naming the choice is enough. Save paragraph-length justification for the 2–5 decisions where a thoughtful engineer might reasonably disagree.
201
+ Well-known stack assemblies honestly compress to: stack list with one-line justification each, data model, API surface, a small number of real ADs, deviations from convention. Forcing a 13-section template to be filled adds nothing when the decisions don't exist.
201
202
 
202
- `sequential-thinking` ≥ 8 thoughts is mandated because reasoning through tradeoffs reduces design mistakes. It is NOT a mandate to emit 8 paragraphs. After thinking, the written `design.md` should contain only the conclusions, not the reasoning chain.
203
+ `sequential-thinking` is invoked to reason through tradeoffs. **The thinking is the work; the written design.md contains only the conclusions**, not the reasoning chain. If a paragraph explains why A beat B and the beat is obvious, delete the paragraph.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flow-debugger
3
- description: Systematic debugging agent — 4-phase methodology (root cause → pattern → hypothesis → fix); ≥3 failures triggers architectural questioning. Inherited from superpowers.
3
+ description: Systematic debugging agent — 4-phase methodology (root cause → pattern → hypothesis → fix); repeated failures (typically after a few attempts probing different hypotheses) trigger architectural questioning. Inherited from superpowers.
4
4
  model: opus
5
5
  effort: high
6
6
  maxTurns: 40
@@ -33,7 +33,7 @@ Phase 4: Implement fix → write failing test → fix root cause → verify
33
33
 
34
34
  Skipping any phase = not done.
35
35
 
36
- ### Rule 2: 3 Fix Failures Triggers "Question the Architecture"
36
+ ### Rule 2: Repeated Fix Failures Trigger "Question the Architecture"
37
37
 
38
38
  If you have tried 3 different approaches and all failed:
39
39
  - **Stop**
@@ -252,7 +252,7 @@ If the user agrees, suggest a set of tasks to append to tasks.md:
252
252
 
253
253
  ## Forbidden
254
254
 
255
- - ✗ Skipping any of the 7 categories (even if the project is not internationalized, at least state "I18n not applicable, reason: X")
255
+ - ✗ Silently skipping a category N/A is fine, but every category that doesn't apply must be named with a one-line reason (e.g. "I18n: N/A — single-locale MVP")
256
256
  - ✗ Listing scenarios only from imagination (must grep the code + compare tests)
257
257
  - ✗ Not using sequential-thinking
258
258
  - ✗ Gap list without priority ordering
@@ -260,10 +260,10 @@ If the user agrees, suggest a set of tasks to append to tasks.md:
260
260
 
261
261
  ## Quality Self-Check
262
262
 
263
- - [ ] All 7 categories covered?
263
+ - [ ] Every applicable category examined, with N/A reasons recorded for the rest?
264
264
  - [ ] Each gap has category + location + scenario + risk + recommended test code?
265
265
  - [ ] Priority ordering is clear?
266
- - [ ] Total findings 5 (unless the target is very small)?
266
+ - [ ] Findings proportional to real edge-case surface (zero is OK if all categories honestly N/A)
267
267
 
268
268
  ---
269
269
 
@@ -124,14 +124,14 @@ bash -c "<verify command>"
124
124
  - Exit code 0 + wrong output → failure, enter Step 6a (debugging)
125
125
  - Non-zero exit code → failure, enter Step 6a
126
126
 
127
- ### Step 6a: Failure Handling (Up to 5 Retries)
127
+ ### Step 6a: Failure Handling (retry proportional to hypothesis space, not a fixed count)
128
128
 
129
129
  Refer to pua's three red lines + superpowers' systematic debugging:
130
130
 
131
131
  ```
132
132
  Round 1 (L0 trust): read the error, find the obvious issue, fix it
133
133
  Round 2 (L1 disappointment): re-read Do, check for missed steps
134
- Round 3 (L2 soul-searching): use sequential-thinking for root-cause analysis ≥5 rounds
134
+ Round 3 (L2 soul-searching): use sequential-thinking for root-cause analysis proportional to residual uncertainty
135
135
  Round 4 (L3 performance review): read the relevant source, check upstream/downstream data flow
136
136
  Round 5 (L4 graduation): if still not working, report failure and ask the user to intervene
137
137
  ```
@@ -195,7 +195,7 @@ Commit: <hash>
195
195
  Next: <next task_id or "ALL_TASKS_COMPLETE">
196
196
  ```
197
197
 
198
- **Failure** (after 5 retries):
198
+ **Failure** (retries exhausted — tune the retry count to the apparent task complexity; each retry should probe a new hypothesis, not repeat the same fix; stop when the hypothesis space is genuinely exhausted, regardless of how few or many retries that took):
199
199
  ```
200
200
  TASK_FAILED: <task_id>
201
201
  Reason: <short reason>
@@ -138,7 +138,7 @@ For each of the following sources, every item must be covered by tasks:
138
138
  **CRITICAL (see L8 of the preamble — long-artifact handling):**
139
139
  - Your FIRST action in this step must be a `Write` tool call with the full `tasks.md` content. Do NOT paste the file content as assistant text before writing.
140
140
  - Do NOT preview the tasks list in the response. The file itself is the deliverable.
141
- - If `tasks.md` would be >200 lines, split into `tasks-phase-1.md` `tasks-phase-5.md` and make `tasks.md` a short index linking to them.
141
+ - If a single `Write` call would approach the sub-agent output-token budget (judge by section density, not line count — see preamble L8), split into `tasks-phase-<n>.md` files and make `tasks.md` a short index linking to them.
142
142
 
143
143
  Based on `${CLAUDE_PLUGIN_ROOT}/templates/tasks.md.tmpl`. Must include a **coverage audit table** at the end (from Step 5).
144
144
 
@@ -170,26 +170,30 @@ Then emit the 5-line summary (see "Output to User" below). No inline task listin
170
170
  - ✗ Skipping the coverage audit
171
171
  - ✗ Proactively skipping some FRs in requirements for the sake of "simplification" (overreach)
172
172
 
173
- ## Task count proportional to feature complexity (adaptive, no config)
173
+ ## Task decomposition (as-needed, no numeric quota)
174
174
 
175
- Match task count to the **actual work**, not to a fixed target. Read the requirements and design, estimate scope, then decompose accordingly:
175
+ **Stop condition, not task count.** Do not aim for a number of tasks. Produce tasks until these are true, then stop:
176
176
 
177
- | Feature scope | Typical task count | Examples |
178
- |---|---|---|
179
- | Well-known CRUD feature | **5–10 tasks** | Todo app, blog, basic form, simple REST endpoint set |
180
- | Medium feature | **10–20 tasks** | auth flow, settings dashboard, small integration |
181
- | Large feature | **20–30 tasks** | new subsystem, multi-service integration, data migration |
182
- | Epic-scale | **30–50 tasks** | consider splitting into sub-specs via the `epic` skill first |
177
+ 1. Every FR, AC, AD, and component in the spec is covered by at least one concrete, executable task.
178
+ 2. Each task is one **cohesive unit of work** the executor can finish in a **single sub-agent dispatch** without needing to replan internally. If a task would require the executor to think "first I need to decide X, then do Y, then come back and do Z", that task is too big — split it.
179
+ 3. No two tasks are inseparable. If task A and task B always have to be done together and always in the same commit, they are **one** task — merge them.
180
+ 4. Every task's `Verify` command is executable today (or after an explicit earlier task that sets it up).
183
181
 
184
- ### Hard rule
182
+ **Research reference**: this is the as-needed decomposition pattern from [ADaPT (Allen AI, NAACL 2024)](https://arxiv.org/abs/2311.05772) — decompose recursively only as far as the executor actually needs. Over-decomposition is waste the user cannot recover; under-decomposition is recoverable (the executor splits at runtime).
185
183
 
186
- If you produce **more than 30 tasks for a feature that is not Epic-scale**, you are over-decomposing. Stop. Re-read the requirements. Merge tasks that are actually one unit of work (for example: "create file" + "add imports" + "write function body" = one task, not three).
184
+ **Self-check before writing**: re-read your task list. For every adjacent pair, ask "could these be one task?" If yes, merge. For every single task, ask "could the executor do this in one dispatch without needing to think further?" If no, split. Iterate until neither question produces a change.
187
185
 
188
- A tight 8-task plan that each executor can finish in one sub-agent dispatch is almost always better than a 60-task plan that fragments one logical change across three tasks.
186
+ ### Symptoms of over-decomposition (stop and merge)
189
187
 
190
- ### Why this matters
188
+ - "Create file X" + "Add imports to X" + "Write function body in X" → one task.
189
+ - "Add field to schema" + "Run migration" → one task (schema change is atomic).
190
+ - "Write test" + "Make test pass" → this is TDD red+green; one task marked with TDD stage in commits, not two.
191
191
 
192
- Token cost scales with task count × per-task sub-agent overhead. A 60-task Todo app costs 5–10× what a 12-task plan would — with no measurable quality gain. Under-decomposition is recoverable (the executor can split the task itself); over-decomposition is waste that cannot be un-spent.
192
+ ### Symptoms of under-decomposition (split)
193
+
194
+ - The executor's Verify command would be three separate `npm test` runs → three tasks.
195
+ - The task touches > ~3 unrelated files or modules → split by module.
196
+ - The task's `Do` field has numbered steps > 5 that each produce a distinct observable result → split.
193
197
 
194
198
  ## Output to User (5 lines max, after Write succeeds)
195
199
 
@@ -56,7 +56,7 @@ AC-N.M: Given [precondition], when [action], then [expected result]
56
56
 
57
57
  Must:
58
58
  - **Be testable** (can be written as E2E or integration test)
59
- - **Cover happy path + at least 1 edge case**
59
+ - **Cover happy path + real edge cases that actually apply (omit categories that do not apply to this feature)**
60
60
  - **Cover error handling** (when input is invalid / network breaks / permissions insufficient)
61
61
 
62
62
  ### Step 4: FR / NFR Extraction
@@ -145,14 +145,15 @@ Out of Scope: K items explicitly excluded
145
145
  Next step: /curdx-flow:spec --phase=design
146
146
  ```
147
147
 
148
- ## Length discipline (see preamble L1 #5 — Proportionate Output)
148
+ ## Requirements discipline (stop-condition, not length-target)
149
149
 
150
- `requirements.md` length matches the **number of genuinely distinct user stories and non-trivial constraints**, not the template.
150
+ Produce user stories and acceptance criteria that cover every distinct user-visible behavior ONCE. No target length. Stop when:
151
151
 
152
- - **Simple feature** (Todo, CRUD form, 3–7 user stories): **~80–200 lines**. One US block per story, AC list, minimal NFR.
153
- - **Medium feature** (auth flow, dashboard with filters): **~200–400 lines**.
154
- - **Complex feature** (multi-role, regulated, multi-step workflow): **~400–800 lines**.
152
+ 1. Every distinct user goal is expressed as one user story (US-NN). Stories that always happen together and share every AC merge into one.
153
+ 2. Every AC-N.N is **observable from outside the code** a test can determine pass/fail without reading the implementation. If you cannot write the AC observably, delete it rather than ship it vague.
154
+ 3. Every FR-NN is stated once, in the US block where it first appears; do not duplicate it in a separate FR section unless the FR genuinely spans multiple user stories.
155
+ 4. NFRs are written ONLY for risks that actually apply to this feature's context. No "supports 10,000 users" for a localhost single-user Todo. If the feature has no real non-functional risk, NFR section collapses to one line: "standard for this domain".
155
156
 
156
- Every AC must be **observable and testable**. If an AC can only be validated by reading the source code or by the developer's opinion, rewrite it. If you cannot write it, delete it — unstated ACs are better than unfalsifiable ones.
157
+ Length emerges from real content: a 3-story CRUD produces a short document; a 20-story multi-role workflow a long one. The template structure is not a length target.
157
158
 
158
- Do not produce NFRs for scenarios that are not actual risks in the feature's context. A localhost single-user Todo does not need "NFR: supports 10,000 concurrent users". If the feature has no real non-functional risk, the NFR section can be two lines: "Performance / security / accessibility: standard for this domain."
159
+ Forbidden padding: restating the goal, describing sections you are about to fill, repeating an AC under both US and FR, writing NFRs for imaginary risks.
@@ -239,7 +239,7 @@ s['qa']['issues_found'] = len(bugs)
239
239
  ## Quality Self-Check
240
240
 
241
241
  - [ ] Ran every core AC?
242
- - [ ] Covered at least 4 of the 7 edge categories?
242
+ - [ ] Covered every edge category that genuinely applies to this feature (categories that do not apply are marked N/A)?
243
243
  - [ ] Screenshots or logs saved?
244
244
  - [ ] Performance data measured (not estimated)?
245
245
  - [ ] Accessibility scanned at least once?
@@ -118,9 +118,9 @@ Before finalizing research.md, ask yourself:
118
118
 
119
119
  - [ ] Are all assumptions explicitly listed? (Karpathy principle 1)
120
120
  - [ ] Did every technical solution go through context7 / WebSearch? No relying on memory?
121
- - [ ] Did the codebase scan cover at least 3 relevant keywords?
121
+ - [ ] Did the codebase scan cover every relevant keyword raised by the requirements?
122
122
  - [ ] Does the feasibility judgment have evidence (not "should work" but "confirmed feasible based on XX")?
123
- - [ ] Are there 1 open questions for the user to answer? (Unless research is fully unambiguous)
123
+ - [ ] Are there any open questions for the user to answer? (If research is fully unambiguous, say so explicitly)
124
124
 
125
125
  If any answer is "no", redo it before writing.
126
126
 
@@ -154,18 +154,17 @@ Open questions (please answer before entering requirements phase):
154
154
  Next step: /curdx-flow:spec --phase=requirements
155
155
  ```
156
156
 
157
- ## Length discipline (see preamble L1 #5 — Proportionate Output)
157
+ ## Research discipline (stop-condition, not length-target)
158
158
 
159
- `research.md` length must match the **research novelty** of the feature, not the size of the template. Use these bands:
159
+ Research answers the real questions for THIS feature. There is no target length. Stop when:
160
160
 
161
- - **Well-known domain** (CRUD Todo, blog, standard REST API, basic SPA): **~30–80 lines**. Most sections collapse to "Standard stack: `<tech choices>`. No domain novelty. No library risks."
162
- - **Medium novelty** (integration with a specific third-party API, unusual performance target, constrained runtime): **~100–250 lines**. Expand only the sections with real findings.
163
- - **High novelty** (new architecture, bleeding-edge library, cross-cutting constraint, non-obvious tradeoffs): **~300–600 lines**. Fuller treatment is warranted.
161
+ 1. Every non-obvious technical question raised by the requirements has an answer with a concrete recommendation.
162
+ 2. Every version-sensitive library or API you cite has at least one fact sourced from `context7` (or WebSearch), not from memory.
163
+ 3. Every alternative you rejected has a one-line reason UNLESS the rejection turns on a subtle tradeoff worth documenting.
164
+ 4. No section exists to restate the goal, describe the template, or pad for "thoroughness".
164
165
 
165
- **Forbidden padding patterns**:
166
- - Restating the user goal in your own words for a whole section.
167
- - Listing the alternatives you rejected when the rejection is obvious ("we won't use PHP for a Vue SPA").
168
- - Describing the template structure you're about to fill ("In the next section, I'll cover…").
169
- - Copying upstream content (the goal from `.state.json`) into multiple sections.
166
+ Length emerges naturally from real content. A well-known CRUD domain (Todo / blog / basic REST) produces sections that honestly compress to "standard stack, no novelty, no version risk"; anything longer is padding. A novel architecture with real library unknowns produces a much longer document because the information content is higher.
170
167
 
171
- Before you `Write` research.md, delete every paragraph that would not change a reader's decision. That is the test.
168
+ **Forbidden padding**: restating the goal in your own words, describing structure you are about to fill, copying upstream content, listing obviously-rejected alternatives.
169
+
170
+ Self-check before `Write`: for every paragraph, ask "does this change a reader's decision?" If no, delete. Iterate until deleting any more leaves a real question unanswered.
@@ -189,7 +189,7 @@ else:
189
189
 
190
190
  **CRITICAL (see L8 of the preamble):** your FIRST action in this step must be a `Write` tool call with the **complete report content**. Do NOT paste the report as assistant text before writing. After the write succeeds, respond with a ≤ 5-line summary only (path, verdict, blocker count, next step). Do not re-paste the report.
191
191
 
192
- If the report would exceed ~200 lines, split into `review-report.md` (short index + verdict) and `review-details.md` (full findings) — two `Write` calls.
192
+ If a single `Write` call would approach the sub-agent output-token budget (judge by section density, not line count), split into `review-report.md` (short index + verdict) and `review-details.md` (full findings) — two `Write` calls. See preamble L8.
193
193
 
194
194
  Full structure (use this as the content passed to `Write`, not as preview text):
195
195
 
@@ -181,7 +181,7 @@ npm audit
181
181
 
182
182
  ### Step 4: Threat Modeling (sequential-thinking)
183
183
 
184
- Use sequential-thinking for 6 rounds on core entities:
184
+ Use sequential-thinking on core entities proportional to real threat-model complexity:
185
185
 
186
186
  ```
187
187
  Round 1: User — ask S/T/R/I/D/E each
@@ -44,7 +44,7 @@ Output: `.flow/_epics/<epic-name>/epic.md` + multiple `.flow/specs/<sub-name>/`
44
44
 
45
45
  ## Mandatory Workflow
46
46
 
47
- ### Step 1: Explore + Understand (sequential-thinking 5 rounds)
47
+ ### Step 1: Explore + Understand (sequential-thinking proportional to epic complexity)
48
48
 
49
49
  ```
50
50
  Round 1: What does the user really want? What's the biggest goal?
@@ -185,13 +185,13 @@ Division of labor:
185
185
 
186
186
  - ✗ Doing actual UI design (that's flow-ux-designer's job)
187
187
  - ✗ Listing references from memory (must WebSearch or scan the codebase)
188
- - ✗ Providing only one reference (at least 3 categories)
188
+ - ✗ Providing only one reference aim for enough breadth across reference categories that the user has genuine alternatives to pick from
189
189
  - ✗ Ignoring CONTEXT.md preferences
190
190
 
191
191
  ## Quality Self-Check
192
192
 
193
193
  - [ ] Scanned codebase for existing patterns?
194
- - [ ] WebSearch covered at least 3 categories of references?
194
+ - [ ] WebSearch covered enough reference categories that the user has genuine design alternatives?
195
195
  - [ ] sequential-thinking used to classify references?
196
196
  - [ ] Recommendation considers CONTEXT.md?
197
197
  - [ ] Asset files saved?
@@ -237,7 +237,7 @@ The sketch stage = HTML prototype. Convert to React/Vue/Svelte components only a
237
237
  ## Quality Self-Check
238
238
 
239
239
  - [ ] Invoked the frontend-design skill (if available)?
240
- - [ ] 2 variants?
240
+ - [ ] Enough variants for the user to pick meaningful alternatives (omit if the brief clearly calls for one direction only)?
241
241
  - [ ] Each variant a single HTML file, zero dependencies?
242
242
  - [ ] decisions.md explains rationale for choices?
243
243
  - [ ] Considered CONTEXT.md user preferences?
@@ -174,7 +174,7 @@ For each match, check:
174
174
 
175
175
  **CRITICAL (see L8 of the preamble):** your FIRST action in this step must be a `Write` tool call with the **complete report content**. Do NOT paste the report as assistant text before writing — doing so doubles output tokens and causes truncation inside the `Write` call. After the write succeeds, respond with a ≤ 5-line summary only (path, verdict counts, next step). Do not re-paste the report.
176
176
 
177
- If the report would exceed ~200 lines, split into `verification-report.md` (short index + verdict) and `verification-details.md` (full findings table) — two `Write` calls.
177
+ If a single `Write` call would approach the sub-agent output-token budget (judge by section density, not line count), split into `verification-report.md` (short index + verdict) and `verification-details.md` (full findings table) — two `Write` calls. See preamble L8.
178
178
 
179
179
  Required structure (use this as the content passed to `Write`, not as preview text):
180
180
 
package/commands/fast.md CHANGED
@@ -123,6 +123,6 @@ Choosing the right scenario matters more than forcing the flow.
123
123
  ## Forbidden
124
124
 
125
125
  - ✗ Committing without running verification
126
- - ✗ Changes touching more than 5 files (means it is no longer fast — run the full flow)
126
+ - ✗ Changes touching many unrelated files or modules (means it is no longer fast — run the full flow)
127
127
  - ✗ Writing library APIs from memory
128
128
  - ✗ Skipping the Step 2 5-question clarification (even when "obvious," explicit statement still has value)